Skip to content

armgit / cua

Public Imported from GitHub
0

Scale computer-use 2.0 with open-source drivers, cross-OS sandboxes, and benchmarks for training, evaluation, and data generation.

feat(fleet-sdk): migrate to the native osgym.cua.ai CRDs (#6316)

r33drichards946206bebd19
diff --git a/libs/fleet/backend/auth/authz.rego b/libs/fleet/backend/auth/authz.rego
index 5d77518bb9..9fdc20bc2a 100644
--- a/libs/fleet/backend/auth/authz.rego
+++ b/libs/fleet/backend/auth/authz.rego
@@ -127,6 +127,10 @@ allow {
# apis/osgym.cua.ai/v1alpha1/osgymsandboxclaims
# — cluster-wide claim listing
# (namespaced claims stay open)
+# apis/osgym.cua.ai/v1alpha1/{osgymsandboxwarmpools,osgymsandboxtemplates,osgymsandboxes}
+# — cluster-wide listings of the
+# native fleet CRDs (namespaced
+# access stays open)
# apis/capsule.clastix.io/<version>/tenants
# — cluster-wide Tenant ownership
# and provisioning API, across
@@ -143,6 +147,9 @@ is_infra_k8s_path(path) { startswith(path, "apis/batch/v1") }
is_infra_k8s_path(path) { startswith(path, "api/v1/namespaces/cyclops-cs/configmaps") }
is_infra_k8s_path(path) { path == "apis/cua.ai/v1/osgymworkspacepools" }
is_infra_k8s_path(path) { path == "apis/osgym.cua.ai/v1alpha1/osgymsandboxclaims" }
+is_infra_k8s_path(path) { path == "apis/osgym.cua.ai/v1alpha1/osgymsandboxwarmpools" }
+is_infra_k8s_path(path) { path == "apis/osgym.cua.ai/v1alpha1/osgymsandboxtemplates" }
+is_infra_k8s_path(path) { path == "apis/osgym.cua.ai/v1alpha1/osgymsandboxes" }
is_infra_k8s_path(path) {
parts := split(path, "/")
count(parts) >= 4
diff --git a/libs/fleet/backend/auth/policy_test.go b/libs/fleet/backend/auth/policy_test.go
index 642fc4165c..81330bf09d 100644
--- a/libs/fleet/backend/auth/policy_test.go
+++ b/libs/fleet/backend/auth/policy_test.go
@@ -164,6 +164,10 @@ func TestK8sAllow_InfraPathsRequireAdmin(t *testing.T) {
{"cluster-wide pools / admin", "apis/cua.ai/v1/osgymworkspacepools", true, true},
{"cluster-wide claims / non-admin", "apis/osgym.cua.ai/v1alpha1/osgymsandboxclaims", false, false},
{"cluster-wide claims / admin", "apis/osgym.cua.ai/v1alpha1/osgymsandboxclaims", true, true},
+ {"cluster-wide warm pools / non-admin", "apis/osgym.cua.ai/v1alpha1/osgymsandboxwarmpools", false, false},
+ {"cluster-wide warm pools / admin", "apis/osgym.cua.ai/v1alpha1/osgymsandboxwarmpools", true, true},
+ {"cluster-wide templates / non-admin", "apis/osgym.cua.ai/v1alpha1/osgymsandboxtemplates", false, false},
+ {"cluster-wide sandboxes / non-admin", "apis/osgym.cua.ai/v1alpha1/osgymsandboxes", false, false},
{"Capsule tenants / non-admin", "apis/capsule.clastix.io/v1beta2/tenants", false, false},
{"Capsule tenant item / non-admin", "apis/capsule.clastix.io/v1beta2/tenants/user-u-1", false, false},
{"Capsule legacy tenants / non-admin", "apis/capsule.clastix.io/v1beta1/tenants", false, false},
@@ -180,6 +184,8 @@ func TestK8sAllow_InfraPathsRequireAdmin(t *testing.T) {
// (Capsule RBAC scopes the user to their own namespaces).
{"namespaced pools / non-admin", "apis/cua.ai/v1/namespaces/pool-foo/osgymworkspacepools", false, true},
{"namespaced claims / non-admin", "apis/osgym.cua.ai/v1alpha1/namespaces/pool-foo/osgymsandboxclaims", false, true},
+ {"namespaced warm pools / non-admin", "apis/osgym.cua.ai/v1alpha1/namespaces/pool-foo/osgymsandboxwarmpools", false, true},
+ {"namespaced templates / non-admin", "apis/osgym.cua.ai/v1alpha1/namespaces/pool-foo/osgymsandboxtemplates", false, true},
{"events list / non-admin (contents filtered elsewhere)", "api/v1/events", false, true},
{"namespaced events / non-admin", "api/v1/namespaces/pool-foo/events", false, true},
}
diff --git a/libs/fleet/backend/auth/pool_admission.rego b/libs/fleet/backend/auth/pool_admission.rego
index 4036a1fed1..dbfa583476 100644
--- a/libs/fleet/backend/auth/pool_admission.rego
+++ b/libs/fleet/backend/auth/pool_admission.rego
@@ -14,7 +14,20 @@ allowed_image_repositories := {
"296062593712.dkr.ecr.us-west-2.amazonaws.com/ubuntu-vnc-cua-kubevirt",
}
-template := object.get(object.get(input.object, "spec", {}), "template", {})
+# The VM shape lives at spec.vmTemplate on the native OSGymSandboxTemplate
+# and at spec.template on the retired legacy OSGymWorkspacePool (still
+# evaluated so a stale client cannot slip past the gate).
+vm_template := object.get(object.get(input.object, "spec", {}), "vmTemplate", {})
+
+legacy_template := object.get(object.get(input.object, "spec", {}), "template", {})
+
+template := vm_template {
+ vm_template != {}
+}
+
+template := legacy_template {
+ vm_template == {}
+}
has_pull_secret {
object.get(template, "imagePullSecret", null) != null
diff --git a/libs/fleet/backend/auth/pool_admission_test.rego b/libs/fleet/backend/auth/pool_admission_test.rego
index fa1b14759e..caa8f0f984 100644
--- a/libs/fleet/backend/auth/pool_admission_test.rego
+++ b/libs/fleet/backend/auth/pool_admission_test.rego
@@ -92,3 +92,49 @@ test_secret_only_patch_denied {
"object": {"spec": {"template": {"imagePullSecret": "ecr-credentials"}}},
}
}
+
+# ── Native OSGymSandboxTemplate shape (spec.vmTemplate) ─────────────────
+
+test_vm_template_no_pull_secret_allowed {
+ pool_admission.allow with input as {
+ "method": "POST",
+ "object": {"spec": {"vmTemplate": {"containerDiskImage": "docker.io/library/alpine:3.20"}}},
+ }
+}
+
+test_vm_template_non_ecr_secret_denied {
+ not pool_admission.allow with input as {
+ "method": "POST",
+ "object": {"spec": {"vmTemplate": {
+ "containerDiskImage": allowed_image,
+ "imagePullSecret": "other-secret",
+ }}},
+ }
+}
+
+test_vm_template_ecr_secret_allowlisted_image_allowed {
+ pool_admission.allow with input as {
+ "method": "POST",
+ "object": {"spec": {"vmTemplate": {
+ "containerDiskImage": allowed_image,
+ "imagePullSecret": "ecr-credentials",
+ }}},
+ }
+}
+
+test_vm_template_ecr_secret_unlisted_image_denied {
+ not pool_admission.allow with input as {
+ "method": "POST",
+ "object": {"spec": {"vmTemplate": {
+ "containerDiskImage": "docker.io/evil/image:latest",
+ "imagePullSecret": "ecr-credentials",
+ }}},
+ }
+}
+
+test_vm_template_patch_pull_secret_swap_denied {
+ not pool_admission.allow with input as {
+ "method": "PATCH",
+ "object": {"spec": {"vmTemplate": {"imagePullSecret": "other-secret"}}},
+ }
+}
diff --git a/libs/fleet/backend/handlers/k8s.go b/libs/fleet/backend/handlers/k8s.go
index 71258576d0..7d7bc60f07 100644
--- a/libs/fleet/backend/handlers/k8s.go
+++ b/libs/fleet/backend/handlers/k8s.go
@@ -128,7 +128,7 @@ func poolImagePullSecretAllowed(ctx context.Context, r *http.Request) (bool, err
default:
return true, nil
}
- if !strings.Contains(r.PathValue("path"), "osgymworkspacepools") || r.Body == nil {
+ if !isPoolShapedWrite(r.PathValue("path")) || r.Body == nil {
return true, nil
}
body, err := io.ReadAll(io.LimitReader(r.Body, 1<<20))
@@ -143,7 +143,16 @@ func poolImagePullSecretAllowed(ctx context.Context, r *http.Request) (bool, err
return auth.EvalPoolAdmission(ctx, r.Method, object)
}
-// macosPoolNeedsAdmin returns true if r is a write to an osgymworkspacepools
+// isPoolShapedWrite reports whether path targets a resource whose body can
+// carry a VM shape (image, runtime, node placement): the native
+// OSGymSandboxTemplate, or the retired legacy OSGymWorkspacePool (kept so a
+// stale client cannot slip past the gate while the CRD deletion propagates).
+func isPoolShapedWrite(path string) bool {
+ return strings.Contains(path, "osgymsandboxtemplates") ||
+ strings.Contains(path, "osgymworkspacepools")
+}
+
+// macosPoolNeedsAdmin returns true if r is a write to a pool-shaped
// resource whose body opts into the macOS runtime AND the caller is not an
// admin. It rebuffers r.Body so the downstream proxy can still read it. Reads
// and non-macOS writes always return false (no restriction).
@@ -153,7 +162,7 @@ func macosPoolNeedsAdmin(ctx context.Context, user *auth.User, r *http.Request)
default:
return false, nil
}
- if !strings.Contains(r.PathValue("path"), "osgymworkspacepools") || r.Body == nil {
+ if !isPoolShapedWrite(r.PathValue("path")) || r.Body == nil {
return false, nil
}
body, err := io.ReadAll(io.LimitReader(r.Body, 1<<20))
@@ -171,16 +180,21 @@ func macosPoolNeedsAdmin(ctx context.Context, user *auth.User, r *http.Request)
return !isAdmin, nil
}
-// bodyRequestsMacOS reports whether an OSGymWorkspacePool CR body opts into the
-// macOS runtime — via spec.template.runtime=macos, or (defence in depth) the
-// macOS-only runtimeClass / nodeSelector that a macOS pod carries.
+// bodyRequestsMacOS reports whether a pool-shaped CR body opts into the
+// macOS runtime — via the VM template's runtime=macos, or (defence in depth)
+// the macOS-only runtimeClass / nodeSelector that a macOS pod carries. The VM
+// shape lives at spec.vmTemplate on the native OSGymSandboxTemplate and at
+// spec.template on the retired legacy OSGymWorkspacePool.
func bodyRequestsMacOS(body []byte) bool {
var obj map[string]any
if json.Unmarshal(body, &obj) != nil {
return false
}
spec, _ := obj["spec"].(map[string]any)
- tmpl, _ := spec["template"].(map[string]any)
+ tmpl, _ := spec["vmTemplate"].(map[string]any)
+ if tmpl == nil {
+ tmpl, _ = spec["template"].(map[string]any)
+ }
if tmpl == nil {
return false
}
diff --git a/libs/fleet/rbac-e2e/pool_rbac_test.go b/libs/fleet/rbac-e2e/pool_rbac_test.go
index 86d13f2f79..8eecd9e6a9 100644
--- a/libs/fleet/rbac-e2e/pool_rbac_test.go
+++ b/libs/fleet/rbac-e2e/pool_rbac_test.go
@@ -1,10 +1,13 @@
// Package rbace2e reproduces — against a real kube-apiserver (envtest, no
// cluster/VM/Docker) — the production 403 a cyclops-cs user hit creating a
-// workspace pool:
+// workspace pool. The incident happened on the legacy
+// cua.ai/osgymworkspacepools resource; the RBAC property it pinned is
+// resource-agnostic, so since the native-CRD migration the same tests run
+// against osgym.cua.ai/osgymsandboxwarmpools:
//
-// osgymworkspacepools.cua.ai is forbidden: User
+// osgymsandboxwarmpools.osgym.cua.ai is forbidden: User
// "oidc:f70ef30e-9282-4a3b-b630-8a6bb4528c5d" cannot create resource
-// "osgymworkspacepools" in API group "cua.ai" in the namespace
+// "osgymsandboxwarmpools" in API group "osgym.cua.ai" in the namespace
// "godot-qa-godot-qa"
//
// Why this is the faithful layer: the 403 is an apiserver RBAC decision, not
@@ -76,14 +79,17 @@ const (
// test honest: if the grant changes, the test reflects it.
const poolClusterRole = "../../clusters/kopf-k3s/capsule/pool-manager-clusterrole.yaml"
-var poolGVR = schema.GroupVersionResource{Group: "cua.ai", Version: "v1", Resource: "osgymworkspacepools"}
+var poolGVR = schema.GroupVersionResource{Group: "osgym.cua.ai", Version: "v1alpha1", Resource: "osgymsandboxwarmpools"}
func newPool(name string) *unstructured.Unstructured {
return &unstructured.Unstructured{Object: map[string]any{
- "apiVersion": "cua.ai/v1",
- "kind": "OSGymWorkspacePool",
+ "apiVersion": "osgym.cua.ai/v1alpha1",
+ "kind": "OSGymSandboxWarmPool",
"metadata": map[string]any{"name": name},
- "spec": map[string]any{"replicas": int64(1)},
+ "spec": map[string]any{
+ "replicas": int64(1),
+ "sandboxTemplateRef": map[string]any{"name": name + "-template"},
+ },
}}
}
@@ -172,8 +178,8 @@ func TestPoolCreate_Forbidden_WhenOwnerUngoverned(t *testing.T) {
// Assert it is the exact apiserver RBAC denial from the report.
msg := err.Error()
for _, want := range []string{
- `cannot create resource "osgymworkspacepools"`,
- `in API group "cua.ai"`,
+ `cannot create resource "osgymsandboxwarmpools"`,
+ `in API group "osgym.cua.ai"`,
impUser,
namespace,
} {
@@ -230,17 +236,19 @@ func TestPoolCreate_Succeeds_WhenRemovedClusterWideGrantRestored(t *testing.T) {
t.Fatalf("baseline: expected Forbidden without the cluster-wide grant, got: %v", err)
}
- // Restore EXACTLY the rule 5516dcf7 deleted (pre-regression state):
+ // Restore the modern equivalent of the rule 5516dcf7 deleted (the
+ // original granted cua.ai/osgymworkspacepools; the CRD is gone, so the
+ // analogous cluster-wide grant targets the native warm pools):
// ClusterRole capsule-tenant-cluster-resources
- // - apiGroups: ["cua.ai"]
- // resources: ["osgymworkspacepools"]
+ // - apiGroups: ["osgym.cua.ai"]
+ // resources: ["osgymsandboxwarmpools"]
// verbs: ["list","get","create","update","patch","delete"]
// + ClusterRoleBinding of it to group system:authenticated.
if _, err := admin.RbacV1().ClusterRoles().Create(ctx, &rbacv1.ClusterRole{
ObjectMeta: metav1.ObjectMeta{Name: "capsule-tenant-cluster-resources"},
Rules: []rbacv1.PolicyRule{{
- APIGroups: []string{"cua.ai"},
- Resources: []string{"osgymworkspacepools"},
+ APIGroups: []string{"osgym.cua.ai"},
+ Resources: []string{"osgymsandboxwarmpools"},
Verbs: []string{"list", "get", "create", "update", "patch", "delete"},
}},
}, metav1.CreateOptions{}); err != nil {
diff --git a/libs/fleet/rbac-e2e/testdata/osgym-pool-crd.yaml b/libs/fleet/rbac-e2e/testdata/osgym-pool-crd.yaml
index aa54487a15..c3ae33f4f1 100644
--- a/libs/fleet/rbac-e2e/testdata/osgym-pool-crd.yaml
+++ b/libs/fleet/rbac-e2e/testdata/osgym-pool-crd.yaml
@@ -1,21 +1,21 @@
-# Minimal OSGymWorkspacePool CRD — just enough for the apiserver to serve the
-# resource the RBAC test targets. Schema is irrelevant to authorization (RBAC
-# keys off apiGroup/resource/verb), so this mirrors the e2e fixture
-# (nixos/tenant-rbac/osgym-pool-crd.yaml) and keeps the test self-contained.
+# Minimal native fleet CRDs for the e2e test — just enough schema to
+# create/list the resources the tenant RBAC targets (OSGymSandboxWarmPool +
+# OSGymSandboxTemplate). The production CRDs live with the operator; this
+# fixture keeps the test self-contained.
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
- name: osgymworkspacepools.cua.ai
+ name: osgymsandboxwarmpools.osgym.cua.ai
spec:
- group: cua.ai
+ group: osgym.cua.ai
scope: Namespaced
names:
- plural: osgymworkspacepools
- singular: osgymworkspacepool
- kind: OSGymWorkspacePool
- shortNames: ["owp"]
+ plural: osgymsandboxwarmpools
+ singular: osgymsandboxwarmpool
+ kind: OSGymSandboxWarmPool
+ shortNames: ["oswp"]
versions:
- - name: v1
+ - name: v1alpha1
served: true
storage: true
schema:
@@ -28,3 +28,27 @@ spec:
status:
type: object
x-kubernetes-preserve-unknown-fields: true
+---
+apiVersion: apiextensions.k8s.io/v1
+kind: CustomResourceDefinition
+metadata:
+ name: osgymsandboxtemplates.osgym.cua.ai
+spec:
+ group: osgym.cua.ai
+ scope: Namespaced
+ names:
+ plural: osgymsandboxtemplates
+ singular: osgymsandboxtemplate
+ kind: OSGymSandboxTemplate
+ shortNames: ["ost"]
+ versions:
+ - name: v1alpha1
+ served: true
+ storage: true
+ schema:
+ openAPIV3Schema:
+ type: object
+ properties:
+ spec:
+ type: object
+ x-kubernetes-preserve-unknown-fields: true
diff --git a/libs/fleet/scripts/check_sdk_binding_contract_sources.py b/libs/fleet/scripts/check_sdk_binding_contract_sources.py
index b360773c03..2fa7016107 100755
--- a/libs/fleet/scripts/check_sdk_binding_contract_sources.py
+++ b/libs/fleet/scripts/check_sdk_binding_contract_sources.py
@@ -206,7 +206,9 @@ def check(root: Path) -> None:
require_all(source["kotlin_live"], files["kotlin_live"], [
("Kotlin live HTTP callback", r"class\s+JavaHttpClient\s*:\s*HttpClient"),
- ("Kotlin live typed pool", r"PoolSpec\(.*SandboxService\(\"mcp\",\s*3000u"),
+ ("Kotlin live typed pool", r"OsGymSandboxWarmPoolSpec\(.*SandboxTemplateRef\(templateName\)"),
+ ("Kotlin live typed template", r"CreateTemplateRequest\(namespace,\s*templateName,"),
+ ("Kotlin live template service", r"SandboxService\(\"mcp\",\s*3000u"),
("Kotlin live typed claim", r"CreateClaimRequest\(pool,\s*null\)"),
("Kotlin live MCP retry", r"response\.status\.toInt\(\)\s+in\s+setOf\(502,\s*503,\s*504\)"),
("Kotlin live cleanup", r"client\.deleteClaim.*client\.deletePool"),
@@ -222,7 +224,9 @@ def check(root: Path) -> None:
])
require_all(source["swift_live"], files["swift_live"], [
("Swift live URLSession callback", r"final\s+class\s+UrlSessionHttpClient\s*:\s*HttpClient"),
- ("Swift live typed pool", r"PoolSpec\(.*SandboxService\(name:\s*\"mcp\",\s*targetPort:\s*3000"),
+ ("Swift live typed pool", r"OsGymSandboxWarmPoolSpec\(replicas:\s*1,\s*sandboxTemplateRef:"),
+ ("Swift live typed template", r"CreateTemplateRequest\(namespace:\s*namespace,\s*name:\s*templateName"),
+ ("Swift live template service", r"SandboxService\(name:\s*\"mcp\",\s*targetPort:\s*3000"),
("Swift live typed claim", r"CreateClaimRequest\(pool:\s*pool,\s*spec:\s*nil\)"),
("Swift live MCP retry", r"\[502,\s*503,\s*504\]\.contains\(Int\(response\.status\)\)"),
("Swift live portable duration", r"advanced\(by:\s*\.seconds\(300\)\)"),
@@ -240,7 +244,9 @@ def check(root: Path) -> None:
])
require_all(source["ruby_live"], files["ruby_live"], [
("Ruby live Net HTTP callback", r"class\s+NetHttpClient\s*<\s*FleetSdk::HttpClient"),
- ("Ruby live typed pool", r"FleetSdk::PoolSpec\.new.*FleetSdk::SandboxService\.new\(name:\s*\x27mcp\x27,\s*target_port:\s*3000"),
+ ("Ruby live typed pool", r"FleetSdk::OSGymSandboxWarmPoolSpec\.new\(replicas:\s*1,\s*sandbox_template_ref:"),
+ ("Ruby live typed template", r"FleetSdk::CreateTemplateRequest\.new\(namespace:\s*namespace,\s*name:\s*template_name"),
+ ("Ruby live template service", r"FleetSdk::SandboxService\.new\(name:\s*\x27mcp\x27,\s*target_port:\s*3000"),
("Ruby live typed claim", r"CreateClaimRequest\.new\(pool:\s*pool,\s*spec:\s*nil\)"),
("Ruby live MCP retry", r"\[502,\s*503,\s*504\]\.include\?\(response\.status\)"),
("Ruby live cleanup", r"client\.delete_claim.*client\.delete_pool"),
@@ -274,7 +280,9 @@ def check(root: Path) -> None:
require(files["python_live"].read_text(encoding="utf-8"), "Python live environment", r"os\.environ\[\"CUA_CLIENT_ID\"\].*os\.environ\[\"CUA_IMAGE\"\]", files["python_live"])
require_all(source["python_live"], files["python_live"], [
("Python live native HTTP constructor", r"CyclopsClient\.connect_with_native_http_client\("),
- ("Python live typed pool", r"PoolSpec\(.*SandboxService\(.*target_port=3000"),
+ ("Python live typed pool", r"OsGymSandboxWarmPoolSpec\(.*sandbox_template_ref"),
+ ("Python live typed template", r"CreateTemplateRequest\("),
+ ("Python live template service", r"SandboxService\(.*target_port=3000"),
("Python live typed claim", r"CreateClaimRequest\(pool=pool,\s*spec=None\)"),
("Python live MCP retry", r"response\.status\s+in\s+\(502,\s*503,\s*504\)"),
("Python live cleanup", r"await\s+client\.delete_claim.*await\s+client\.delete_pool"),
diff --git a/libs/fleet/scripts/generate-sdk-bindings.sh b/libs/fleet/scripts/generate-sdk-bindings.sh
index 77bf3ab4d4..5ccbd55c7a 100755
--- a/libs/fleet/scripts/generate-sdk-bindings.sh
+++ b/libs/fleet/scripts/generate-sdk-bindings.sh
@@ -615,6 +615,14 @@ mv "$raw_output/CyclopsSdkFFI.modulemap" "$generated_root/swift/"
mv "$raw_output/CyclopsSdkSchemaFFI.h" "$generated_root/swift/"
mv "$raw_output/CyclopsSdkSchemaFFI.modulemap" "$generated_root/swift/"
cat "$generated_root/swift/CyclopsSdkFFI.modulemap" "$generated_root/swift/CyclopsSdkSchemaFFI.modulemap" > "$generated_root/swift/CyclopsSdk.modulemap"
+# UniFFI 0.31.0 assumes cross-crate external record types conform to
+# Equatable/Hashable. OsGymSandboxTemplateSpec transitively holds a
+# PreservedJson object, which is not Hashable in the schema module — drop the
+# synthesized conformance uniffi claims for every sdk record embedding it.
+for template_struct in Template CreateTemplateRequest; do
+ sed -i.bak "s/^public struct $template_struct: Equatable, Hashable {/public struct $template_struct {/" "$generated_root/swift/CyclopsSdk.swift"
+ rm "$generated_root/swift/CyclopsSdk.swift.bak"
+done
mv "$raw_output/fleet_sdk.rb" "$generated_root/ruby/cyclops_sdk/sdk.rb"
mv "$raw_output/cyclops_sdk_schema.rb" "$generated_root/ruby/cyclops_sdk/schema.rb"
@@ -798,8 +806,8 @@ def replace_buffer(match):
f"{indent})"
)
text, buffer_replacements = re.subn(buffer_pattern, replace_buffer, text)
-if buffer_replacements != 12:
- raise SystemExit(f"expected 12 Ruby Rust-buffer future wrappers, found {buffer_replacements}")
+if buffer_replacements != 17:
+ raise SystemExit(f"expected 17 Ruby Rust-buffer future wrappers, found {buffer_replacements}")
void_pattern = r"(?m)^(\s*)FleetSdk\.rust_call_with_error\(([^,]+),:([a-z0-9_]+),(.*)\)$"
def replace_void(match):
@@ -811,8 +819,8 @@ def replace_void(match):
f"{indent})"
)
text, void_replacements = re.subn(void_pattern, replace_void, text)
-if void_replacements != 2:
- raise SystemExit(f"expected 2 Ruby void future wrappers, found {void_replacements}")
+if void_replacements != 3:
+ raise SystemExit(f"expected 3 Ruby void future wrappers, found {void_replacements}")
handle_map_anchor = """def self.uniffi_bytes(v)
raise TypeError, \"no implicit conversion of #{v} into String\" unless v.respond_to?(:to_str)
diff --git a/libs/fleet/scripts/test-generate-sdk-bindings.sh b/libs/fleet/scripts/test-generate-sdk-bindings.sh
index da29bb07fc..a0f8a13424 100755
--- a/libs/fleet/scripts/test-generate-sdk-bindings.sh
+++ b/libs/fleet/scripts/test-generate-sdk-bindings.sh
@@ -229,23 +229,20 @@ kotlin_sdk = (bindings / "kotlin/ai/cua/cyclops/sdk/fleet_sdk.kt").read_text(enc
kotlin_schema = (bindings / "kotlin/ai/cua/cyclops/sdk/schema/cyclops_sdk_schema.kt").read_text(encoding="utf-8")
if "package ai.cua.cyclops.sdk" not in kotlin_sdk or "package ai.cua.cyclops.sdk.schema" not in kotlin_schema:
raise AssertionError("Kotlin components are not generated into distinct configured packages")
-if "var `spec`: PoolSpec" not in kotlin_sdk or "data class PoolSpec" not in kotlin_schema:
- raise AssertionError("Kotlin PoolSpec external type is not linked through the schema package")
+if "var `spec`: OsGymSandboxWarmPoolSpec" not in kotlin_sdk or "data class OsGymSandboxWarmPoolSpec" not in kotlin_schema:
+ raise AssertionError("Kotlin OsGymSandboxWarmPoolSpec external type is not linked through the schema package")
swift_sdk = (bindings / "swift/CyclopsSdk.swift").read_text(encoding="utf-8")
swift_schema = (bindings / "swift/CyclopsSdkSchema.swift").read_text(encoding="utf-8")
-if "public var spec: PoolSpec" not in swift_sdk or "public struct PoolSpec" not in swift_schema:
- raise AssertionError("Swift PoolSpec external type is not available for one-module compilation")
-pool_spec = re.search(
- r"public struct PoolSpec: Equatable, Hashable \{(?P<body>.*?)\n\}\n\n#if compiler",
- swift_schema,
- re.DOTALL,
-)
-if pool_spec is None:
- raise AssertionError("Swift PoolSpec is missing explicit Equatable and Hashable conformances")
-for method in ("public static func ==", "public func hash(into hasher: inout Hasher)"):
- if method not in pool_spec.group("body"):
- raise AssertionError(f"Swift PoolSpec is missing Rust-backed conformance method: {method}")
+if "public var spec: OsGymSandboxWarmPoolSpec" not in swift_sdk or "public struct OsGymSandboxWarmPoolSpec" not in swift_schema:
+ raise AssertionError("Swift OsGymSandboxWarmPoolSpec external type is not available for one-module compilation")
+if "public struct OsGymSandboxWarmPoolSpec: Equatable, Hashable {" not in swift_schema:
+ raise AssertionError("Swift OsGymSandboxWarmPoolSpec is missing Equatable and Hashable conformances")
+# The legacy PoolSpec carried Rust-backed ==/hash methods (it embedded a
+# PreservedJson object); no surviving schema record does, so records that
+# embed objects must instead NOT claim the conformances they cannot satisfy.
+if "public struct VmTemplate: Equatable" in swift_schema:
+ raise AssertionError("Swift VmTemplate (object-bearing record) must not claim Equatable")
LANGUAGE_AUDIT
}
run_language_linkage_audits
@@ -296,14 +293,14 @@ class CallbackHttpClient(fleet_sdk.HttpClient):
body = {"access_token": "offline-token", "expires_in": 3600}
elif request.url.endswith("/api/namespaces"):
body = {"metadata": {"name": "default"}}
- elif request.url.endswith("/api/k8s/apis/cua.ai/v1/namespaces/default/osgymworkspacepools"):
+ elif request.url.endswith("/api/k8s/apis/osgym.cua.ai/v1alpha1/namespaces/default/osgymsandboxwarmpools"):
body = {
- "apiVersion": "cua.ai/v1",
- "kind": "OSGymWorkspacePool",
+ "apiVersion": "osgym.cua.ai/v1alpha1",
+ "kind": "OSGymSandboxWarmPool",
"metadata": {"namespace": "default", "name": "offline-pool"},
"spec": {
"replicas": 1,
- "template": {"containerDiskImage": "registry.example/desktop:offline"},
+ "sandboxTemplateRef": {"name": "default"},
},
}
else:
@@ -324,28 +321,14 @@ async def smoke_create_pool():
),
transport,
)
- spec = fleet_sdk.PoolSpec(
+ spec = fleet_sdk.OsGymSandboxWarmPoolSpec(
replicas=1,
- template=fleet_sdk.PoolTemplate(
- runtime=None,
- runtime_class_name=None,
- node_selector=None,
- tolerations=None,
- command=None,
- container_disk_image="registry.example/desktop:offline",
- image_pull_secret=None,
- cpu_cores=None,
- memory=None,
- firmware=None,
- probes=None,
- oidc=None,
- ),
+ sandbox_template_ref=fleet_sdk.SandboxTemplateRef(name="default"),
autoscaling=None,
- services=None,
)
pool = await client.create_pool(fleet_sdk.CreatePoolRequest(namespace="default", spec=spec))
assert pool.metadata.name == "offline-pool"
- assert any(request.url.endswith("/osgymworkspacepools") for request in transport.requests)
+ assert any(request.url.endswith("/osgymsandboxwarmpools") for request in transport.requests)
asyncio.run(smoke_create_pool())
PYTHON_SMOKE
@@ -366,11 +349,11 @@ grep -Fq -- "FleetSdk.uniffi_rust_future_rust_buffer" "$ruby_sdk_source" || fail
grep -Fq -- "def self.uniffi_rust_future_void" "$ruby_sdk_source" || fail "Ruby bindings do not resolve void futures"
grep -Fq -- "FleetSdk.uniffi_rust_future_void" "$ruby_sdk_source" || fail "Ruby async void methods do not resolve Rust futures"
grep -Fq -- "UniFFILib.uniffi_cyclops_sdk_fn_method_cyclopsclient_create_pool(uniffi_clone_handle(),RustBuffer.alloc_from_TypeCreatePoolRequest(request),RustCallStatus.new)" "$ruby_sdk_source" || fail "Ruby async factories do not pass the generated status placeholder"
-grep -Fq -- " readTypePoolSpec" "$bindings_dir/ruby/cyclops_sdk.rb" || fail "Ruby facade does not delegate schema record readers"
+grep -Fq -- " readTypeOSGymSandboxWarmPoolSpec" "$bindings_dir/ruby/cyclops_sdk.rb" || fail "Ruby facade does not delegate schema record readers"
if grep -Fq -- "OsGym" "$ruby_sdk_source"; then
fail "Ruby SDK retains cross-crate OsGym helper names"
fi
-grep -Fq -- " readTypeOSGymWorkspacePoolStatus" "$bindings_dir/ruby/cyclops_sdk.rb" || fail "Ruby facade does not delegate schema optional readers"
+grep -Fq -- " readTypeOSGymSandboxWarmPoolStatus" "$bindings_dir/ruby/cyclops_sdk.rb" || fail "Ruby facade does not delegate schema status readers"
if grep -Fq -- "return 0 if @handle.nil?" "$ruby_sdk_source"; then
fail "Ruby callback bindings lower native callbacks to an invalid zero handle"
fi
diff --git a/libs/fleet/sdk-bindings/examples/kotlin/AppControlled.kt b/libs/fleet/sdk-bindings/examples/kotlin/AppControlled.kt
index 3515326fd7..8bd874f429 100644
--- a/libs/fleet/sdk-bindings/examples/kotlin/AppControlled.kt
+++ b/libs/fleet/sdk-bindings/examples/kotlin/AppControlled.kt
@@ -9,13 +9,13 @@ private class ScriptedHttpClient : HttpClient {
private val expected = ArrayDeque(listOf(
Expected("POST", "https://keycloak.invalid/token", listOf("accept" to "application/json", "content-type" to "application/x-www-form-urlencoded", "authorization" to "Basic Y2xpZW50LWlkOmNsaWVudC1zZWNyZXQ="), "grant_type=client_credentials".encodeToByteArray(), 200u, "{\"access_token\":\"offline-token\",\"expires_in\":3600}"),
Expected("POST", "https://cyclops.invalid/api/namespaces", listOf("accept" to "application/json", "content-type" to "application/json", "authorization" to "Bearer offline-token"), "{\"name\":\"default\"}".encodeToByteArray(), 201u, "{}"),
- Expected("POST", "https://cyclops.invalid/api/k8s/apis/cua.ai/v1/namespaces/default/osgymworkspacepools", listOf("accept" to "application/json", "content-type" to "application/json", "authorization" to "Bearer offline-token"), "{\"apiVersion\":\"cua.ai/v1\",\"kind\":\"OSGymWorkspacePool\",\"metadata\":{\"namespace\":\"default\",\"name\":\"default\",\"labels\":null},\"spec\":{\"replicas\":1,\"template\":{\"containerDiskImage\":\"registry.example/desktop:offline\"},\"services\":[{\"name\":\"mcp\",\"targetPort\":8080}]},\"status\":null}".encodeToByteArray(), 201u, "{\"apiVersion\":\"cua.ai/v1\",\"kind\":\"OSGymWorkspacePool\",\"metadata\":{\"namespace\":\"default\",\"name\":\"default\",\"labels\":null},\"spec\":{\"replicas\":1,\"template\":{\"containerDiskImage\":\"registry.example/desktop:offline\"},\"services\":[{\"name\":\"mcp\",\"targetPort\":8080}]},\"status\":null}"),
+ Expected("POST", "https://cyclops.invalid/api/k8s/apis/osgym.cua.ai/v1alpha1/namespaces/default/osgymsandboxwarmpools", listOf("accept" to "application/json", "content-type" to "application/json", "authorization" to "Bearer offline-token"), "{\"apiVersion\":\"osgym.cua.ai/v1alpha1\",\"kind\":\"OSGymSandboxWarmPool\",\"metadata\":{\"namespace\":\"default\",\"name\":\"default\",\"labels\":null},\"spec\":{\"replicas\":1,\"sandboxTemplateRef\":{\"name\":\"default\"}},\"status\":null}".encodeToByteArray(), 201u, "{\"apiVersion\":\"osgym.cua.ai/v1alpha1\",\"kind\":\"OSGymSandboxWarmPool\",\"metadata\":{\"namespace\":\"default\",\"name\":\"default\",\"labels\":null},\"spec\":{\"replicas\":1,\"sandboxTemplateRef\":{\"name\":\"default\"}},\"status\":null}"),
Expected("POST", "https://cyclops.invalid/api/k8s/apis/osgym.cua.ai/v1alpha1/namespaces/default/osgymsandboxclaims", listOf("accept" to "application/json", "content-type" to "application/json", "authorization" to "Bearer offline-token"), "{\"apiVersion\":\"osgym.cua.ai/v1alpha1\",\"kind\":\"OSGymSandboxClaim\",\"metadata\":{\"namespace\":\"default\",\"name\":\"claim-1\",\"labels\":null},\"spec\":{\"sandboxTemplateRef\":{\"name\":\"default\"}},\"status\":null}".encodeToByteArray(), 201u, "{\"apiVersion\":\"osgym.cua.ai/v1alpha1\",\"kind\":\"OSGymSandboxClaim\",\"metadata\":{\"namespace\":\"default\",\"name\":\"default\",\"labels\":null},\"spec\":{\"sandboxTemplateRef\":{\"name\":\"default\"}},\"status\":{\"phase\":\"Bound\",\"sandbox\":{\"name\":\"offline-sandbox\"}}}"),
Expected("GET", "https://cyclops.invalid/api/k8s/apis/osgym.cua.ai/v1alpha1/namespaces/default/osgymsandboxclaims/default", listOf("accept" to "application/json", "content-type" to "application/json", "authorization" to "Bearer offline-token"), null, 200u, "{\"apiVersion\":\"osgym.cua.ai/v1alpha1\",\"kind\":\"OSGymSandboxClaim\",\"metadata\":{\"namespace\":\"default\",\"name\":\"default\",\"labels\":null},\"spec\":{\"sandboxTemplateRef\":{\"name\":\"default\"}},\"status\":{\"phase\":\"Bound\",\"sandbox\":{\"name\":\"offline-sandbox\"}}}"),
- Expected("GET", "https://cyclops.invalid/api/k8s/apis/cua.ai/v1/namespaces/default/osgymworkspacepools/default", listOf("accept" to "application/json", "content-type" to "application/json", "authorization" to "Bearer offline-token"), null, 200u, "{\"apiVersion\":\"cua.ai/v1\",\"kind\":\"OSGymWorkspacePool\",\"metadata\":{\"namespace\":\"default\",\"name\":\"default\",\"labels\":null},\"spec\":{\"replicas\":1,\"template\":{\"containerDiskImage\":\"registry.example/desktop:offline\"},\"services\":[{\"name\":\"mcp\",\"targetPort\":8080}]},\"status\":null}"),
+ Expected("GET", "https://cyclops.invalid/api/k8s/apis/osgym.cua.ai/v1alpha1/namespaces/default/osgymsandboxtemplates/default", listOf("accept" to "application/json", "content-type" to "application/json", "authorization" to "Bearer offline-token"), null, 200u, "{\"apiVersion\":\"osgym.cua.ai/v1alpha1\",\"kind\":\"OSGymSandboxTemplate\",\"metadata\":{\"namespace\":\"default\",\"name\":\"default\",\"labels\":null},\"spec\":{\"vmTemplate\":{\"containerDiskImage\":\"registry.example/desktop:offline\",\"services\":[{\"name\":\"mcp\",\"targetPort\":8080}]}}}"),
Expected("POST", "https://cyclops.invalid/api/svc/default/offline-sandbox-mcp/mcp", listOf("authorization" to "Bearer offline-token"), "{\"offline\":true}".encodeToByteArray(), 202u, "offline service accepted"),
Expected("DELETE", "https://cyclops.invalid/api/k8s/apis/osgym.cua.ai/v1alpha1/namespaces/default/osgymsandboxclaims/default", listOf("accept" to "application/json", "content-type" to "application/json", "authorization" to "Bearer offline-token"), null, 204u, ""),
- Expected("DELETE", "https://cyclops.invalid/api/k8s/apis/cua.ai/v1/namespaces/default/osgymworkspacepools/default", listOf("accept" to "application/json", "content-type" to "application/json", "authorization" to "Bearer offline-token"), null, 204u, ""),
+ Expected("DELETE", "https://cyclops.invalid/api/k8s/apis/osgym.cua.ai/v1alpha1/namespaces/default/osgymsandboxwarmpools/default", listOf("accept" to "application/json", "content-type" to "application/json", "authorization" to "Bearer offline-token"), null, 204u, ""),
Expected("DELETE", "https://cyclops.invalid/api/namespaces/default", listOf("accept" to "application/json", "content-type" to "application/json", "authorization" to "Bearer offline-token"), null, 204u, "")
))
override suspend fun execute(request: HttpRequest): HttpResponse = synchronized(lock) {
@@ -29,8 +29,7 @@ private class ScriptedHttpClient : HttpClient {
}
fun main() = runBlocking {
- val vmTemplate = VmTemplate("registry.example/desktop:offline", null, null, null, null, null, null, null, null, null, null, null, null, null)
- val spec = PoolSpec(1u, PoolTemplate(null, null, null, null, null, vmTemplate.containerDiskImage, null, null, null, null, null, null), null, listOf(SandboxService("mcp", 8080u, null)))
+ val spec = OsGymSandboxWarmPoolSpec(1u, SandboxTemplateRef("default"), null)
val transport = ScriptedHttpClient()
val credentials = CyclopsCredentials("client-id", "client-secret")
val client = CyclopsClient.connect(CyclopsConfiguration("https://cyclops.invalid", "https://keycloak.invalid/token", credentials, 1uL, 1u, 1uL, 2u), transport)
diff --git a/libs/fleet/sdk-bindings/examples/kotlin/LiveAppControlled.kt b/libs/fleet/sdk-bindings/examples/kotlin/LiveAppControlled.kt
index 427e426d94..c39450910f 100644
--- a/libs/fleet/sdk-bindings/examples/kotlin/LiveAppControlled.kt
+++ b/libs/fleet/sdk-bindings/examples/kotlin/LiveAppControlled.kt
@@ -29,18 +29,23 @@ private class JavaHttpClient : HttpClient {
}
}
-private fun poolSpec() = PoolSpec(
+private fun poolSpec(templateName: String) = OsGymSandboxWarmPoolSpec(
1u,
- PoolTemplate(
- null, null, null, null, null,
+ SandboxTemplateRef(templateName),
+ null,
+)
+
+private fun templateSpec() = OsGymSandboxTemplateSpec(
+ VmTemplate(
required("CUA_IMAGE"),
+ null, null, null, null, null, null,
required("CUA_IMAGE_PULL_SECRET"),
4u,
"4Gi",
- null, null, null,
+ null, null,
+ listOf(SandboxService("mcp", 3000u, null)),
+ null,
),
- null,
- listOf(SandboxService("mcp", 3000u, null)),
)
private suspend fun initializeMcp(client: CyclopsClient, sandbox: Sandbox): UShort {
@@ -81,16 +86,20 @@ fun main() = runBlocking {
),
JavaHttpClient(),
)
+ val templateName = "$namespace-template"
var pool: Pool? = null
+ var template: Template? = null
var claim: Claim? = null
try {
- pool = client.createPool(CreatePoolRequest(namespace, poolSpec()))
+ pool = client.createPool(CreatePoolRequest(namespace, poolSpec(templateName)))
+ template = client.createTemplate(CreateTemplateRequest(namespace, templateName, templateSpec()))
claim = client.createClaim(CreateClaimRequest(pool, null))
val sandbox = client.waitClaim(claim)
val status = initializeMcp(client, sandbox)
println("namespace=$namespace pool=${pool.metadata.name} claim=${claim.metadata.name} sandbox=${sandbox.name} mcp_status=$status")
} finally {
claim?.let { client.deleteClaim(it) }
+ template?.let { client.deleteTemplate(it) }
pool?.let { client.deletePool(it) }
client.close()
}
diff --git a/libs/fleet/sdk-bindings/examples/python/live_app_controlled.py b/libs/fleet/sdk-bindings/examples/python/live_app_controlled.py
index e5b4d4767f..1b8eae6416 100755
--- a/libs/fleet/sdk-bindings/examples/python/live_app_controlled.py
+++ b/libs/fleet/sdk-bindings/examples/python/live_app_controlled.py
@@ -6,36 +6,46 @@ import time
from fleet_sdk import (
CreateClaimRequest,
CreatePoolRequest,
+ CreateTemplateRequest,
CyclopsClient,
CyclopsConfiguration,
CyclopsCredentials,
HttpHeader,
HttpRequest,
- PoolSpec,
- PoolTemplate,
+ OsGymSandboxTemplateSpec,
+ OsGymSandboxWarmPoolSpec,
SandboxService,
+ SandboxTemplateRef,
+ VmTemplate,
)
-def pool_spec(image: str, image_pull_secret: str) -> PoolSpec:
- return PoolSpec(
+def pool_spec(template_name: str) -> OsGymSandboxWarmPoolSpec:
+ return OsGymSandboxWarmPoolSpec(
replicas=1,
- template=PoolTemplate(
+ sandbox_template_ref=SandboxTemplateRef(name=template_name),
+ autoscaling=None,
+ )
+
+
+def template_spec(image: str, image_pull_secret: str) -> OsGymSandboxTemplateSpec:
+ return OsGymSandboxTemplateSpec(
+ vm_template=VmTemplate(
+ container_disk_image=image,
+ command=None,
runtime=None,
runtime_class_name=None,
node_selector=None,
tolerations=None,
- command=None,
- container_disk_image=image,
+ image_pull_policy=None,
image_pull_secret=image_pull_secret,
cpu_cores=4,
memory="4Gi",
firmware=None,
probes=None,
+ services=[SandboxService(name="mcp", target_port=3000, protocol=None)],
oidc=None,
- ),
- autoscaling=None,
- services=[SandboxService(name="mcp", target_port=3000, protocol=None)],
+ )
)
@@ -97,11 +107,20 @@ async def main() -> None:
claim_poll_limit=120,
)
)
+ template_name = f"{namespace}-template"
pool = None
+ template = None
claim = None
try:
pool = await client.create_pool(
- CreatePoolRequest(namespace=namespace, spec=pool_spec(image, image_pull_secret))
+ CreatePoolRequest(namespace=namespace, spec=pool_spec(template_name))
+ )
+ template = await client.create_template(
+ CreateTemplateRequest(
+ namespace=namespace,
+ name=template_name,
+ spec=template_spec(image, image_pull_secret),
+ )
)
claim = await client.create_claim(CreateClaimRequest(pool=pool, spec=None))
sandbox = await client.wait_claim(claim)
@@ -121,6 +140,8 @@ async def main() -> None:
finally:
if claim is not None:
await client.delete_claim(claim)
+ if template is not None:
+ await client.delete_template(template)
if pool is not None:
await client.delete_pool(pool)
diff --git a/libs/fleet/sdk-bindings/examples/ruby/app_controlled.rb b/libs/fleet/sdk-bindings/examples/ruby/app_controlled.rb
index 99f379812e..c38b088840 100644
--- a/libs/fleet/sdk-bindings/examples/ruby/app_controlled.rb
+++ b/libs/fleet/sdk-bindings/examples/ruby/app_controlled.rb
@@ -5,11 +5,12 @@ require 'json'
require 'thread'
Expected = Struct.new(:method, :url, :headers, :body, :status, :response)
BASE = 'https://cyclops.invalid'; TOKEN = 'https://keycloak.invalid/token'; JSON_HEADERS = [['accept','application/json'],['content-type','application/json'],['authorization','Bearer offline-token']]
-def pool_json; { apiVersion:'cua.ai/v1',kind:'OSGymWorkspacePool',metadata:{namespace:'default',name:'default',labels:nil},spec:{replicas:1,template:{containerDiskImage:'registry.example/desktop:offline'},services:[{name:'mcp',targetPort:8080}]},status:nil }; end
+def pool_json; { apiVersion:'osgym.cua.ai/v1alpha1',kind:'OSGymSandboxWarmPool',metadata:{namespace:'default',name:'default',labels:nil},spec:{replicas:1,sandboxTemplateRef:{name:'default'}},status:nil }; end
+def template_json; { apiVersion:'osgym.cua.ai/v1alpha1',kind:'OSGymSandboxTemplate',metadata:{namespace:'default',name:'default',labels:nil},spec:{vmTemplate:{containerDiskImage:'registry.example/desktop:offline',services:[{name:'mcp',targetPort:8080}]}} }; end
def claim_json(bound=false); value={apiVersion:'osgym.cua.ai/v1alpha1',kind:'OSGymSandboxClaim',metadata:{namespace:'default',name:'default',labels:nil},spec:{sandboxTemplateRef:{name:'default'}},status:nil}; value[:status]={phase:'Bound',sandbox:{name:'offline-sandbox'}} if bound; value; end
def queue
- pool_url="#{BASE}/api/k8s/apis/cua.ai/v1/namespaces/default/osgymworkspacepools/default"; claim_url="#{BASE}/api/k8s/apis/osgym.cua.ai/v1alpha1/namespaces/default/osgymsandboxclaims/default"; pool_body=JSON.generate(pool_json).b; claim_body='{"apiVersion":"osgym.cua.ai/v1alpha1","kind":"OSGymSandboxClaim","metadata":{"namespace":"default","name":"claim-1","labels":null},"spec":{"sandboxTemplateRef":{"name":"default"}},"status":null}'.b
- [Expected.new('POST',TOKEN,[['accept','application/json'],['content-type','application/x-www-form-urlencoded'],['authorization','Basic Y2xpZW50LWlkOmNsaWVudC1zZWNyZXQ=']], 'grant_type=client_credentials'.b,200,{access_token:'offline-token',expires_in:3600}),Expected.new('POST',"#{BASE}/api/namespaces",JSON_HEADERS,'{"name":"default"}'.b,201,{}),Expected.new('POST',pool_url.sub(%r{/default\z}, ''),JSON_HEADERS,pool_body,201,pool_json),Expected.new('POST',claim_url.sub(%r{/default\z}, ''),JSON_HEADERS,claim_body,201,claim_json),Expected.new('GET',claim_url,JSON_HEADERS,nil,200,claim_json(true)),Expected.new('GET',pool_url,JSON_HEADERS,nil,200,pool_json),Expected.new('POST',"#{BASE}/api/svc/default/offline-sandbox-mcp/mcp",[['authorization','Bearer offline-token']],'{"offline":true}'.b,202,'offline service accepted'),Expected.new('DELETE',claim_url,JSON_HEADERS,nil,204,''),Expected.new('DELETE',pool_url,JSON_HEADERS,nil,204,''),Expected.new('DELETE',"#{BASE}/api/namespaces/default",JSON_HEADERS,nil,204,'')]
+ pool_url="#{BASE}/api/k8s/apis/osgym.cua.ai/v1alpha1/namespaces/default/osgymsandboxwarmpools/default"; template_url="#{BASE}/api/k8s/apis/osgym.cua.ai/v1alpha1/namespaces/default/osgymsandboxtemplates/default"; claim_url="#{BASE}/api/k8s/apis/osgym.cua.ai/v1alpha1/namespaces/default/osgymsandboxclaims/default"; pool_body=JSON.generate(pool_json).b; claim_body='{"apiVersion":"osgym.cua.ai/v1alpha1","kind":"OSGymSandboxClaim","metadata":{"namespace":"default","name":"claim-1","labels":null},"spec":{"sandboxTemplateRef":{"name":"default"}},"status":null}'.b
+ [Expected.new('POST',TOKEN,[['accept','application/json'],['content-type','application/x-www-form-urlencoded'],['authorization','Basic Y2xpZW50LWlkOmNsaWVudC1zZWNyZXQ=']], 'grant_type=client_credentials'.b,200,{access_token:'offline-token',expires_in:3600}),Expected.new('POST',"#{BASE}/api/namespaces",JSON_HEADERS,'{"name":"default"}'.b,201,{}),Expected.new('POST',pool_url.sub(%r{/default\z}, ''),JSON_HEADERS,pool_body,201,pool_json),Expected.new('POST',claim_url.sub(%r{/default\z}, ''),JSON_HEADERS,claim_body,201,claim_json),Expected.new('GET',claim_url,JSON_HEADERS,nil,200,claim_json(true)),Expected.new('GET',template_url,JSON_HEADERS,nil,200,template_json),Expected.new('POST',"#{BASE}/api/svc/default/offline-sandbox-mcp/mcp",[['authorization','Bearer offline-token']],'{"offline":true}'.b,202,'offline service accepted'),Expected.new('DELETE',claim_url,JSON_HEADERS,nil,204,''),Expected.new('DELETE',pool_url,JSON_HEADERS,nil,204,''),Expected.new('DELETE',"#{BASE}/api/namespaces/default",JSON_HEADERS,nil,204,'')]
end
class ScriptedHttpClient < FleetSdk::HttpClient
@@ -26,8 +27,7 @@ class ScriptedHttpClient < FleetSdk::HttpClient
def assert_exhausted!; raise @expected.inspect unless @expected.empty?; end
end
-vm_template = FleetSdk::VmTemplate.new(container_disk_image: 'registry.example/desktop:offline', command: nil, runtime: nil, runtime_class_name: nil, node_selector: nil, tolerations: nil, image_pull_policy: nil, image_pull_secret: nil, cpu_cores: nil, memory: nil, firmware: nil, probes: nil, services: nil, oidc: nil)
-spec = FleetSdk::PoolSpec.new(replicas: 1, template: FleetSdk::PoolTemplate.new(runtime: nil, runtime_class_name: nil, node_selector: nil, tolerations: nil, command: nil, container_disk_image: vm_template.container_disk_image, image_pull_secret: nil, cpu_cores: nil, memory: nil, firmware: nil, probes: nil, oidc: nil), autoscaling: nil, services: [FleetSdk::SandboxService.new(name: 'mcp', target_port: 8080, protocol: nil)])
+spec = FleetSdk::OSGymSandboxWarmPoolSpec.new(replicas: 1, sandbox_template_ref: FleetSdk::SandboxTemplateRef.new(name: 'default'), autoscaling: nil)
transport = ScriptedHttpClient.new
credentials = FleetSdk::CyclopsCredentials.new('client-id', 'client-secret')
client = FleetSdk::CyclopsClient.connect(FleetSdk::CyclopsConfiguration.new(base_url: 'https://cyclops.invalid', token_url: 'https://keycloak.invalid/token', credentials: credentials, pool_poll_interval_ms: 1, pool_poll_limit: 1, claim_poll_interval_ms: 1, claim_poll_limit: 2), transport)
diff --git a/libs/fleet/sdk-bindings/examples/ruby/live_app_controlled.rb b/libs/fleet/sdk-bindings/examples/ruby/live_app_controlled.rb
index d8bc291b97..0073ed3dea 100755
--- a/libs/fleet/sdk-bindings/examples/ruby/live_app_controlled.rb
+++ b/libs/fleet/sdk-bindings/examples/ruby/live_app_controlled.rb
@@ -20,8 +20,12 @@ def required(name)
ENV.fetch(name).tap { |value| raise "#{name} is required" if value.empty? }
end
-def pool_spec
- FleetSdk::PoolSpec.new(replicas: 1, template: FleetSdk::PoolTemplate.new(runtime: nil, runtime_class_name: nil, node_selector: nil, tolerations: nil, command: nil, container_disk_image: required('CUA_IMAGE'), image_pull_secret: required('CUA_IMAGE_PULL_SECRET'), cpu_cores: 4, memory: '4Gi', firmware: nil, probes: nil, oidc: nil), autoscaling: nil, services: [FleetSdk::SandboxService.new(name: 'mcp', target_port: 3000, protocol: nil)])
+def pool_spec(template_name)
+ FleetSdk::OSGymSandboxWarmPoolSpec.new(replicas: 1, sandbox_template_ref: FleetSdk::SandboxTemplateRef.new(name: template_name), autoscaling: nil)
+end
+
+def template_spec
+ FleetSdk::OSGymSandboxTemplateSpec.new(vm_template: FleetSdk::VmTemplate.new(container_disk_image: required('CUA_IMAGE'), command: nil, runtime: nil, runtime_class_name: nil, node_selector: nil, tolerations: nil, image_pull_policy: nil, image_pull_secret: required('CUA_IMAGE_PULL_SECRET'), cpu_cores: 4, memory: '4Gi', firmware: nil, probes: nil, services: [FleetSdk::SandboxService.new(name: 'mcp', target_port: 3000, protocol: nil)], oidc: nil))
end
def initialize_mcp(client, sandbox)
@@ -42,10 +46,13 @@ namespace = required('CYCLOPS_NAMESPACE')
credentials = FleetSdk::CyclopsCredentials.new(required('CUA_CLIENT_ID'), required('CUA_CLIENT_SECRET'))
configuration = FleetSdk::CyclopsConfiguration.new(base_url: required('CUA_BASE_URL'), token_url: required('CUA_TOKEN_URL'), credentials: credentials, pool_poll_interval_ms: 5000, pool_poll_limit: 120, claim_poll_interval_ms: 5000, claim_poll_limit: 120)
client = FleetSdk::CyclopsClient.connect(configuration, NetHttpClient.new)
+template_name = "#{namespace}-template"
pool = nil
+template = nil
claim = nil
begin
- pool = client.create_pool(FleetSdk::CreatePoolRequest.new(namespace: namespace, spec: pool_spec))
+ pool = client.create_pool(FleetSdk::CreatePoolRequest.new(namespace: namespace, spec: pool_spec(template_name)))
+ template = client.create_template(FleetSdk::CreateTemplateRequest.new(namespace: namespace, name: template_name, spec: template_spec))
claim = client.create_claim(FleetSdk::CreateClaimRequest.new(pool: pool, spec: nil))
sandbox = client.wait_claim(claim)
status = initialize_mcp(client, sandbox)
@@ -54,6 +61,10 @@ ensure
begin
client.delete_claim(claim) unless claim.nil?
ensure
- client.delete_pool(pool) unless pool.nil?
+ begin
+ client.delete_template(template) unless template.nil?
+ ensure
+ client.delete_pool(pool) unless pool.nil?
+ end
end
end
diff --git a/libs/fleet/sdk-bindings/examples/swift/AppControlled.swift b/libs/fleet/sdk-bindings/examples/swift/AppControlled.swift
index 7712e45890..80cbf336ea 100644
--- a/libs/fleet/sdk-bindings/examples/swift/AppControlled.swift
+++ b/libs/fleet/sdk-bindings/examples/swift/AppControlled.swift
@@ -4,13 +4,13 @@ actor ScriptedHttpClient: HttpClient {
private var expected: [(String, String, UInt16, String)] = [
("POST", "https://keycloak.invalid/token", 200, #"{"access_token":"offline-token","expires_in":3600}"#),
("POST", "https://cyclops.invalid/api/namespaces", 201, "{}"),
- ("POST", "https://cyclops.invalid/api/k8s/apis/cua.ai/v1/namespaces/default/osgymworkspacepools", 201, #"{"apiVersion":"cua.ai/v1","kind":"OSGymWorkspacePool","metadata":{"namespace":"default","name":"default","labels":null},"spec":{"replicas":1,"template":{"containerDiskImage":"registry.example/desktop:offline"},"services":[{"name":"mcp","targetPort":8080}]},"status":null}"#),
+ ("POST", "https://cyclops.invalid/api/k8s/apis/osgym.cua.ai/v1alpha1/namespaces/default/osgymsandboxwarmpools", 201, #"{"apiVersion":"osgym.cua.ai/v1alpha1","kind":"OSGymSandboxWarmPool","metadata":{"namespace":"default","name":"default","labels":null},"spec":{"replicas":1,"sandboxTemplateRef":{"name":"default"}},"status":null}"#),
("POST", "https://cyclops.invalid/api/k8s/apis/osgym.cua.ai/v1alpha1/namespaces/default/osgymsandboxclaims", 201, #"{"apiVersion":"osgym.cua.ai/v1alpha1","kind":"OSGymSandboxClaim","metadata":{"namespace":"default","name":"default","labels":null},"spec":{"sandboxTemplateRef":{"name":"default"}},"status":{"phase":"Bound","sandbox":{"name":"offline-sandbox"}}}"#),
("GET", "https://cyclops.invalid/api/k8s/apis/osgym.cua.ai/v1alpha1/namespaces/default/osgymsandboxclaims/default", 200, #"{"apiVersion":"osgym.cua.ai/v1alpha1","kind":"OSGymSandboxClaim","metadata":{"namespace":"default","name":"default","labels":null},"spec":{"sandboxTemplateRef":{"name":"default"}},"status":{"phase":"Bound","sandbox":{"name":"offline-sandbox"}}}"#),
- ("GET", "https://cyclops.invalid/api/k8s/apis/cua.ai/v1/namespaces/default/osgymworkspacepools/default", 200, #"{"apiVersion":"cua.ai/v1","kind":"OSGymWorkspacePool","metadata":{"namespace":"default","name":"default","labels":null},"spec":{"replicas":1,"template":{"containerDiskImage":"registry.example/desktop:offline"},"services":[{"name":"mcp","targetPort":8080}]},"status":null}"#),
+ ("GET", "https://cyclops.invalid/api/k8s/apis/osgym.cua.ai/v1alpha1/namespaces/default/osgymsandboxtemplates/default", 200, #"{"apiVersion":"osgym.cua.ai/v1alpha1","kind":"OSGymSandboxTemplate","metadata":{"namespace":"default","name":"default","labels":null},"spec":{"vmTemplate":{"containerDiskImage":"registry.example/desktop:offline","services":[{"name":"mcp","targetPort":8080}]}}}"#),
("POST", "https://cyclops.invalid/api/svc/default/offline-sandbox-mcp/mcp", 202, "offline service accepted"),
("DELETE", "https://cyclops.invalid/api/k8s/apis/osgym.cua.ai/v1alpha1/namespaces/default/osgymsandboxclaims/default", 204, ""),
- ("DELETE", "https://cyclops.invalid/api/k8s/apis/cua.ai/v1/namespaces/default/osgymworkspacepools/default", 204, ""),
+ ("DELETE", "https://cyclops.invalid/api/k8s/apis/osgym.cua.ai/v1alpha1/namespaces/default/osgymsandboxwarmpools/default", 204, ""),
("DELETE", "https://cyclops.invalid/api/namespaces/default", 204, "")]
private var requests = [HttpRequest]()
func execute(request: HttpRequest) async throws -> HttpResponse { let item = expected.removeFirst(); precondition(request.method == item.0 && request.url == item.1); requests.append(request); return HttpResponse(status: item.2, headers: [], body: Data(item.3.utf8)) }
@@ -20,8 +20,7 @@ actor ScriptedHttpClient: HttpClient {
@main struct AppControlled {
static func main() async throws {
- let vmTemplate = VmTemplate(containerDiskImage: "registry.example/desktop:offline", command: nil, runtime: nil, runtimeClassName: nil, nodeSelector: nil, tolerations: nil, imagePullPolicy: nil, imagePullSecret: nil, cpuCores: nil, memory: nil, firmware: nil, probes: nil, services: nil, oidc: nil)
- let spec = PoolSpec(replicas: 1, template: PoolTemplate(runtime: nil, runtimeClassName: nil, nodeSelector: nil, tolerations: nil, command: nil, containerDiskImage: vmTemplate.containerDiskImage, imagePullSecret: nil, cpuCores: nil, memory: nil, firmware: nil, probes: nil, oidc: nil), autoscaling: nil, services: [SandboxService(name: "mcp", targetPort: 8080, protocol: nil)])
+ let spec = OsGymSandboxWarmPoolSpec(replicas: 1, sandboxTemplateRef: SandboxTemplateRef(name: "default"), autoscaling: nil)
let transport = ScriptedHttpClient()
let credentials = CyclopsCredentials(clientId: "client-id", clientSecret: "client-secret")
let client = try CyclopsClient.connect(configuration: CyclopsConfiguration(baseUrl: "https://cyclops.invalid", tokenUrl: "https://keycloak.invalid/token", credentials: credentials, poolPollIntervalMs: 1, poolPollLimit: 1, claimPollIntervalMs: 1, claimPollLimit: 2), httpClient: transport)
diff --git a/libs/fleet/sdk-bindings/examples/swift/LiveAppControlled.swift b/libs/fleet/sdk-bindings/examples/swift/LiveAppControlled.swift
index 1fb2891c2a..d98ddd907e 100644
--- a/libs/fleet/sdk-bindings/examples/swift/LiveAppControlled.swift
+++ b/libs/fleet/sdk-bindings/examples/swift/LiveAppControlled.swift
@@ -37,16 +37,19 @@ private func required(_ name: String) -> String {
return value
}
-private func poolSpec() -> PoolSpec {
- PoolSpec(
- replicas: 1,
- template: PoolTemplate(
- runtime: nil, runtimeClassName: nil, nodeSelector: nil, tolerations: nil, command: nil,
- containerDiskImage: required("CUA_IMAGE"), imagePullSecret: required("CUA_IMAGE_PULL_SECRET"),
- cpuCores: 4, memory: "4Gi", firmware: nil, probes: nil, oidc: nil
- ),
- autoscaling: nil,
- services: [SandboxService(name: "mcp", targetPort: 3000, protocol: nil)]
+private func poolSpec(templateName: String) -> OsGymSandboxWarmPoolSpec {
+ OsGymSandboxWarmPoolSpec(replicas: 1, sandboxTemplateRef: SandboxTemplateRef(name: templateName), autoscaling: nil)
+}
+
+private func templateSpec() -> OsGymSandboxTemplateSpec {
+ OsGymSandboxTemplateSpec(
+ vmTemplate: VmTemplate(
+ containerDiskImage: required("CUA_IMAGE"), command: nil, runtime: nil, runtimeClassName: nil,
+ nodeSelector: nil, tolerations: nil, imagePullPolicy: nil,
+ imagePullSecret: required("CUA_IMAGE_PULL_SECRET"),
+ cpuCores: 4, memory: "4Gi", firmware: nil, probes: nil,
+ services: [SandboxService(name: "mcp", targetPort: 3000, protocol: nil)], oidc: nil
+ )
)
}
@@ -78,12 +81,17 @@ private func initializeMcp(client: CyclopsClient, sandbox: Sandbox) async throws
}
}
-private func cleanup(client: CyclopsClient, claim: Claim?, pool: Pool?) async {
+private func cleanup(client: CyclopsClient, claim: Claim?, template: Template?, pool: Pool?) async {
do {
if let claim { try await client.deleteClaim(claim: claim) }
} catch {
FileHandle.standardError.write(Data("claim cleanup failed: \(error)\n".utf8))
}
+ do {
+ if let template { try await client.deleteTemplate(template: template) }
+ } catch {
+ FileHandle.standardError.write(Data("template cleanup failed: \(error)\n".utf8))
+ }
do {
if let pool { try await client.deletePool(pool: pool) }
} catch {
@@ -99,20 +107,23 @@ private func cleanup(client: CyclopsClient, claim: Claim?, pool: Pool?) async {
configuration: CyclopsConfiguration(baseUrl: required("CUA_BASE_URL"), tokenUrl: required("CUA_TOKEN_URL"), credentials: credentials, poolPollIntervalMs: 5_000, poolPollLimit: 120, claimPollIntervalMs: 5_000, claimPollLimit: 120),
httpClient: UrlSessionHttpClient()
)
+ let templateName = "\(namespace)-template"
var createdPool: Pool?
+ var createdTemplate: Template?
var createdClaim: Claim?
do {
- let pool = try await client.createPool(request: CreatePoolRequest(namespace: namespace, spec: poolSpec()))
+ let pool = try await client.createPool(request: CreatePoolRequest(namespace: namespace, spec: poolSpec(templateName: templateName)))
createdPool = pool
+ createdTemplate = try await client.createTemplate(request: CreateTemplateRequest(namespace: namespace, name: templateName, spec: templateSpec()))
let claim = try await client.createClaim(request: CreateClaimRequest(pool: pool, spec: nil))
createdClaim = claim
let sandbox = try await client.waitClaim(claim: claim)
let status = try await initializeMcp(client: client, sandbox: sandbox)
print(#"{"namespace":"\#(namespace)","pool":"\#(pool.metadata.name)","claim":"\#(claim.metadata.name)","sandbox":"\#(sandbox.name)","mcp_status":\#(status)}"#)
} catch {
- await cleanup(client: client, claim: createdClaim, pool: createdPool)
+ await cleanup(client: client, claim: createdClaim, template: createdTemplate, pool: createdPool)
throw error
}
- await cleanup(client: client, claim: createdClaim, pool: createdPool)
+ await cleanup(client: client, claim: createdClaim, template: createdTemplate, pool: createdPool)
}
}
diff --git a/libs/fleet/sdk-bindings/go-uniffi/cyclops_sdk/compile_test.go b/libs/fleet/sdk-bindings/go-uniffi/cyclops_sdk/compile_test.go
deleted file mode 100644
index d9e8b85ed7..0000000000
--- a/libs/fleet/sdk-bindings/go-uniffi/cyclops_sdk/compile_test.go
+++ /dev/null
@@ -1,7 +0,0 @@
-package cyclops_sdk
-
-import "testing"
-
-func TestGeneratedSdkCompiles(t *testing.T) {
- var _ func(CyclopsConfiguration, HttpClient) (*CyclopsClient, error) = CyclopsClientConnect
-}
diff --git a/libs/fleet/sdk-bindings/go-uniffi/cyclops_sdk_schema/cyclops_sdk_schema.go b/libs/fleet/sdk-bindings/go-uniffi/cyclops_sdk_schema/cyclops_sdk_schema.go
index 1e6a0341b0..a505dd63ca 100644
--- a/libs/fleet/sdk-bindings/go-uniffi/cyclops_sdk_schema/cyclops_sdk_schema.go
+++ b/libs/fleet/sdk-bindings/go-uniffi/cyclops_sdk_schema/cyclops_sdk_schema.go
@@ -437,30 +437,6 @@ type FfiDestroyerUint32 struct{}
func (FfiDestroyerUint32) Destroy(_ uint32) {}
-type FfiConverterUint64 struct{}
-
-var FfiConverterUint64INSTANCE = FfiConverterUint64{}
-
-func (FfiConverterUint64) Lower(value uint64) C.uint64_t {
- return C.uint64_t(value)
-}
-
-func (FfiConverterUint64) Write(writer io.Writer, value uint64) {
- writeUint64(writer, value)
-}
-
-func (FfiConverterUint64) Lift(value C.uint64_t) uint64 {
- return uint64(value)
-}
-
-func (FfiConverterUint64) Read(reader io.Reader) uint64 {
- return readUint64(reader)
-}
-
-type FfiDestroyerUint64 struct{}
-
-func (FfiDestroyerUint64) Destroy(_ uint64) {}
-
type FfiConverterBool struct{}
var FfiConverterBoolINSTANCE = FfiConverterBool{}
@@ -1189,58 +1165,6 @@ func (_ FfiDestroyerOsGymSandboxWarmPoolStatus) Destroy(value OsGymSandboxWarmPo
value.Destroy()
}
-type OsGymWorkspacePoolStatus struct {
- Phase *string
- TotalCount *uint32
- AvailableCount *uint32
- ClaimedCount *uint32
-}
-
-func (r *OsGymWorkspacePoolStatus) Destroy() {
- FfiDestroyerOptionalString{}.Destroy(r.Phase)
- FfiDestroyerOptionalUint32{}.Destroy(r.TotalCount)
- FfiDestroyerOptionalUint32{}.Destroy(r.AvailableCount)
- FfiDestroyerOptionalUint32{}.Destroy(r.ClaimedCount)
-}
-
-type FfiConverterOsGymWorkspacePoolStatus struct{}
-
-var FfiConverterOsGymWorkspacePoolStatusINSTANCE = FfiConverterOsGymWorkspacePoolStatus{}
-
-func (c FfiConverterOsGymWorkspacePoolStatus) Lift(rb RustBufferI) OsGymWorkspacePoolStatus {
- return LiftFromRustBuffer[OsGymWorkspacePoolStatus](c, rb)
-}
-
-func (c FfiConverterOsGymWorkspacePoolStatus) Read(reader io.Reader) OsGymWorkspacePoolStatus {
- return OsGymWorkspacePoolStatus{
- FfiConverterOptionalStringINSTANCE.Read(reader),
- FfiConverterOptionalUint32INSTANCE.Read(reader),
- FfiConverterOptionalUint32INSTANCE.Read(reader),
- FfiConverterOptionalUint32INSTANCE.Read(reader),
- }
-}
-
-func (c FfiConverterOsGymWorkspacePoolStatus) Lower(value OsGymWorkspacePoolStatus) C.RustBuffer {
- return LowerIntoRustBuffer[OsGymWorkspacePoolStatus](c, value)
-}
-
-func (c FfiConverterOsGymWorkspacePoolStatus) LowerExternal(value OsGymWorkspacePoolStatus) ExternalCRustBuffer {
- return RustBufferFromC(LowerIntoRustBuffer[OsGymWorkspacePoolStatus](c, value))
-}
-
-func (c FfiConverterOsGymWorkspacePoolStatus) Write(writer io.Writer, value OsGymWorkspacePoolStatus) {
- FfiConverterOptionalStringINSTANCE.Write(writer, value.Phase)
- FfiConverterOptionalUint32INSTANCE.Write(writer, value.TotalCount)
- FfiConverterOptionalUint32INSTANCE.Write(writer, value.AvailableCount)
- FfiConverterOptionalUint32INSTANCE.Write(writer, value.ClaimedCount)
-}
-
-type FfiDestroyerOsGymWorkspacePoolStatus struct{}
-
-func (_ FfiDestroyerOsGymWorkspacePoolStatus) Destroy(value OsGymWorkspacePoolStatus) {
- value.Destroy()
-}
-
type OidcConfig struct {
CredentialsSecret string
TokenUrl string
@@ -1297,163 +1221,6 @@ func (_ FfiDestroyerOidcConfig) Destroy(value OidcConfig) {
value.Destroy()
}
-type PoolSpec struct {
- Replicas uint32
- Template PoolTemplate
- Autoscaling *WarmPoolAutoscaling
- Services *[]SandboxService
-}
-
-func (r *PoolSpec) Destroy() {
- FfiDestroyerUint32{}.Destroy(r.Replicas)
- FfiDestroyerPoolTemplate{}.Destroy(r.Template)
- FfiDestroyerOptionalWarmPoolAutoscaling{}.Destroy(r.Autoscaling)
- FfiDestroyerOptionalSequenceSandboxService{}.Destroy(r.Services)
-}
-func (_self PoolSpec) Eq(other PoolSpec) bool {
- _selfBuf := FfiConverterPoolSpecINSTANCE.Lower(_self)
- return FfiConverterBoolINSTANCE.Lift(rustCall(func(_uniffiStatus *C.RustCallStatus) C.int8_t {
- return C.uniffi_cyclops_sdk_schema_fn_method_poolspec_uniffi_trait_eq_eq(
- _selfBuf, FfiConverterPoolSpecINSTANCE.Lower(other), _uniffiStatus)
- }))
-}
-func (_self PoolSpec) Ne(other PoolSpec) bool {
- _selfBuf := FfiConverterPoolSpecINSTANCE.Lower(_self)
- return FfiConverterBoolINSTANCE.Lift(rustCall(func(_uniffiStatus *C.RustCallStatus) C.int8_t {
- return C.uniffi_cyclops_sdk_schema_fn_method_poolspec_uniffi_trait_eq_ne(
- _selfBuf, FfiConverterPoolSpecINSTANCE.Lower(other), _uniffiStatus)
- }))
-}
-func (_self PoolSpec) Hash() uint64 {
- _selfBuf := FfiConverterPoolSpecINSTANCE.Lower(_self)
- return FfiConverterUint64INSTANCE.Lift(rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint64_t {
- return C.uniffi_cyclops_sdk_schema_fn_method_poolspec_uniffi_trait_hash(
- _selfBuf, _uniffiStatus)
- }))
-}
-
-type FfiConverterPoolSpec struct{}
-
-var FfiConverterPoolSpecINSTANCE = FfiConverterPoolSpec{}
-
-func (c FfiConverterPoolSpec) Lift(rb RustBufferI) PoolSpec {
- return LiftFromRustBuffer[PoolSpec](c, rb)
-}
-
-func (c FfiConverterPoolSpec) Read(reader io.Reader) PoolSpec {
- return PoolSpec{
- FfiConverterUint32INSTANCE.Read(reader),
- FfiConverterPoolTemplateINSTANCE.Read(reader),
- FfiConverterOptionalWarmPoolAutoscalingINSTANCE.Read(reader),
- FfiConverterOptionalSequenceSandboxServiceINSTANCE.Read(reader),
- }
-}
-
-func (c FfiConverterPoolSpec) Lower(value PoolSpec) C.RustBuffer {
- return LowerIntoRustBuffer[PoolSpec](c, value)
-}
-
-func (c FfiConverterPoolSpec) LowerExternal(value PoolSpec) ExternalCRustBuffer {
- return RustBufferFromC(LowerIntoRustBuffer[PoolSpec](c, value))
-}
-
-func (c FfiConverterPoolSpec) Write(writer io.Writer, value PoolSpec) {
- FfiConverterUint32INSTANCE.Write(writer, value.Replicas)
- FfiConverterPoolTemplateINSTANCE.Write(writer, value.Template)
- FfiConverterOptionalWarmPoolAutoscalingINSTANCE.Write(writer, value.Autoscaling)
- FfiConverterOptionalSequenceSandboxServiceINSTANCE.Write(writer, value.Services)
-}
-
-type FfiDestroyerPoolSpec struct{}
-
-func (_ FfiDestroyerPoolSpec) Destroy(value PoolSpec) {
- value.Destroy()
-}
-
-type PoolTemplate struct {
- Runtime *RuntimeKind
- RuntimeClassName *string
- NodeSelector *map[string]string
- Tolerations *[]*PreservedJson
- Command *[]string
- ContainerDiskImage string
- ImagePullSecret *string
- CpuCores *uint32
- Memory *string
- Firmware *Firmware
- Probes **PreservedJson
- Oidc *OidcConfig
-}
-
-func (r *PoolTemplate) Destroy() {
- FfiDestroyerOptionalRuntimeKind{}.Destroy(r.Runtime)
- FfiDestroyerOptionalString{}.Destroy(r.RuntimeClassName)
- FfiDestroyerOptionalMapStringString{}.Destroy(r.NodeSelector)
- FfiDestroyerOptionalSequencePreservedJson{}.Destroy(r.Tolerations)
- FfiDestroyerOptionalSequenceString{}.Destroy(r.Command)
- FfiDestroyerString{}.Destroy(r.ContainerDiskImage)
- FfiDestroyerOptionalString{}.Destroy(r.ImagePullSecret)
- FfiDestroyerOptionalUint32{}.Destroy(r.CpuCores)
- FfiDestroyerOptionalString{}.Destroy(r.Memory)
- FfiDestroyerOptionalFirmware{}.Destroy(r.Firmware)
- FfiDestroyerOptionalPreservedJson{}.Destroy(r.Probes)
- FfiDestroyerOptionalOidcConfig{}.Destroy(r.Oidc)
-}
-
-type FfiConverterPoolTemplate struct{}
-
-var FfiConverterPoolTemplateINSTANCE = FfiConverterPoolTemplate{}
-
-func (c FfiConverterPoolTemplate) Lift(rb RustBufferI) PoolTemplate {
- return LiftFromRustBuffer[PoolTemplate](c, rb)
-}
-
-func (c FfiConverterPoolTemplate) Read(reader io.Reader) PoolTemplate {
- return PoolTemplate{
- FfiConverterOptionalRuntimeKindINSTANCE.Read(reader),
- FfiConverterOptionalStringINSTANCE.Read(reader),
- FfiConverterOptionalMapStringStringINSTANCE.Read(reader),
- FfiConverterOptionalSequencePreservedJsonINSTANCE.Read(reader),
- FfiConverterOptionalSequenceStringINSTANCE.Read(reader),
- FfiConverterStringINSTANCE.Read(reader),
- FfiConverterOptionalStringINSTANCE.Read(reader),
- FfiConverterOptionalUint32INSTANCE.Read(reader),
- FfiConverterOptionalStringINSTANCE.Read(reader),
- FfiConverterOptionalFirmwareINSTANCE.Read(reader),
- FfiConverterOptionalPreservedJsonINSTANCE.Read(reader),
- FfiConverterOptionalOidcConfigINSTANCE.Read(reader),
- }
-}
-
-func (c FfiConverterPoolTemplate) Lower(value PoolTemplate) C.RustBuffer {
- return LowerIntoRustBuffer[PoolTemplate](c, value)
-}
-
-func (c FfiConverterPoolTemplate) LowerExternal(value PoolTemplate) ExternalCRustBuffer {
- return RustBufferFromC(LowerIntoRustBuffer[PoolTemplate](c, value))
-}
-
-func (c FfiConverterPoolTemplate) Write(writer io.Writer, value PoolTemplate) {
- FfiConverterOptionalRuntimeKindINSTANCE.Write(writer, value.Runtime)
- FfiConverterOptionalStringINSTANCE.Write(writer, value.RuntimeClassName)
- FfiConverterOptionalMapStringStringINSTANCE.Write(writer, value.NodeSelector)
- FfiConverterOptionalSequencePreservedJsonINSTANCE.Write(writer, value.Tolerations)
- FfiConverterOptionalSequenceStringINSTANCE.Write(writer, value.Command)
- FfiConverterStringINSTANCE.Write(writer, value.ContainerDiskImage)
- FfiConverterOptionalStringINSTANCE.Write(writer, value.ImagePullSecret)
- FfiConverterOptionalUint32INSTANCE.Write(writer, value.CpuCores)
- FfiConverterOptionalStringINSTANCE.Write(writer, value.Memory)
- FfiConverterOptionalFirmwareINSTANCE.Write(writer, value.Firmware)
- FfiConverterOptionalPreservedJsonINSTANCE.Write(writer, value.Probes)
- FfiConverterOptionalOidcConfigINSTANCE.Write(writer, value.Oidc)
-}
-
-type FfiDestroyerPoolTemplate struct{}
-
-func (_ FfiDestroyerPoolTemplate) Destroy(value PoolTemplate) {
- value.Destroy()
-}
-
type SandboxService struct {
Name string
TargetPort uint16
diff --git a/libs/fleet/sdk-bindings/go-uniffi/examples/main.go b/libs/fleet/sdk-bindings/go-uniffi/examples/main.go
index 87bb38020c..048e80bc02 100644
--- a/libs/fleet/sdk-bindings/go-uniffi/examples/main.go
+++ b/libs/fleet/sdk-bindings/go-uniffi/examples/main.go
@@ -9,7 +9,7 @@ import (
"net/http"
"os"
- "github.com/trycua/cloud/cyclops-cs/sdk-bindings/go-uniffi/cyclops_sdk"
+ "github.com/trycua/cloud/cyclops-cs/sdk-bindings/go-uniffi/fleet_sdk"
"github.com/trycua/cloud/cyclops-cs/sdk-bindings/go-uniffi/cyclops_sdk_schema"
)
@@ -20,34 +20,34 @@ const (
type netHTTPClient struct{ client *http.Client }
-func (c netHTTPClient) Execute(request cyclops_sdk.HttpRequest) (cyclops_sdk.HttpResponse, error) {
+func (c netHTTPClient) Execute(request fleet_sdk.HttpRequest) (fleet_sdk.HttpResponse, error) {
var body io.Reader
if request.Body != nil {
body = bytes.NewReader(*request.Body)
}
nativeRequest, err := http.NewRequest(request.Method, request.Url, body)
if err != nil {
- return cyclops_sdk.HttpResponse{}, err
+ return fleet_sdk.HttpResponse{}, err
}
for _, header := range request.Headers {
nativeRequest.Header.Add(header.Name, header.Value)
}
nativeResponse, err := c.client.Do(nativeRequest)
if err != nil {
- return cyclops_sdk.HttpResponse{}, err
+ return fleet_sdk.HttpResponse{}, err
}
defer nativeResponse.Body.Close()
responseBody, err := io.ReadAll(nativeResponse.Body)
if err != nil {
- return cyclops_sdk.HttpResponse{}, err
+ return fleet_sdk.HttpResponse{}, err
}
- headers := make([]cyclops_sdk.HttpHeader, 0, len(nativeResponse.Header))
+ headers := make([]fleet_sdk.HttpHeader, 0, len(nativeResponse.Header))
for name, values := range nativeResponse.Header {
for _, value := range values {
- headers = append(headers, cyclops_sdk.HttpHeader{Name: name, Value: value})
+ headers = append(headers, fleet_sdk.HttpHeader{Name: name, Value: value})
}
}
- return cyclops_sdk.HttpResponse{Status: uint16(nativeResponse.StatusCode), Headers: headers, Body: responseBody}, nil
+ return fleet_sdk.HttpResponse{Status: uint16(nativeResponse.StatusCode), Headers: headers, Body: responseBody}, nil
}
func main() {
@@ -68,8 +68,8 @@ func run() error {
return fmt.Errorf("set all required CYCLOPS_* environment variables; see README.md")
}
- credentials := cyclops_sdk.NewCyclopsCredentials(clientID, clientSecret)
- client, err := cyclops_sdk.CyclopsClientConnect(cyclops_sdk.CyclopsConfiguration{
+ credentials := fleet_sdk.NewCyclopsCredentials(clientID, clientSecret)
+ client, err := fleet_sdk.CyclopsClientConnect(fleet_sdk.CyclopsConfiguration{
BaseUrl: baseURL, TokenUrl: tokenURL, Credentials: credentials,
PoolPollIntervalMs: 5000, PoolPollLimit: 100,
ClaimPollIntervalMs: 5000, ClaimPollLimit: 120,
@@ -79,8 +79,9 @@ func run() error {
}
defer client.Destroy()
- var pool *cyclops_sdk.Pool
- var claim *cyclops_sdk.Claim
+ var pool *fleet_sdk.Pool
+ var template *fleet_sdk.Template
+ var claim *fleet_sdk.Claim
defer func() {
if claim != nil {
fmt.Println("[cleanup] Deleting claim...")
@@ -88,6 +89,12 @@ func run() error {
fmt.Fprintf(os.Stderr, "cleanup claim failed: %v\n", err)
}
}
+ if template != nil {
+ fmt.Println("[cleanup] Deleting template...")
+ if err := client.DeleteTemplate(*template); err != nil {
+ fmt.Fprintf(os.Stderr, "cleanup template failed: %v\n", err)
+ }
+ }
if pool != nil {
fmt.Println("[cleanup] Deleting pool...")
if err := client.DeletePool(*pool); err != nil {
@@ -96,22 +103,28 @@ func run() error {
}
}()
- fmt.Println("[1/5] Creating pool...")
+ fmt.Println("[1/5] Creating pool and template...")
cpuCores := uint32(4)
memory := "4Gi"
- poolSpec := cyclops_sdk_schema.PoolSpec{Replicas: 1, Template: cyclops_sdk_schema.PoolTemplate{ContainerDiskImage: image, CpuCores: &cpuCores, Memory: &memory}}
- if imagePullSecret := os.Getenv("CYCLOPS_IMAGE_PULL_SECRET"); imagePullSecret != "" {
- poolSpec.Template.ImagePullSecret = &imagePullSecret
- }
- services := []cyclops_sdk_schema.SandboxService{{Name: serviceName, TargetPort: 3000}}
- poolSpec.Services = &services
- createdPool, err := client.CreatePool(cyclops_sdk.CreatePoolRequest{Namespace: namespace, Spec: poolSpec})
+ templateName := namespace + "-template"
+ poolSpec := cyclops_sdk_schema.OsGymSandboxWarmPoolSpec{Replicas: 1, SandboxTemplateRef: cyclops_sdk_schema.SandboxTemplateRef{Name: templateName}}
+ createdPool, err := client.CreatePool(fleet_sdk.CreatePoolRequest{Namespace: namespace, Spec: poolSpec})
if err != nil { return fmt.Errorf("create pool: %w", err) }
pool = &createdPool
fmt.Printf("Pool: %+v\n", *pool)
+ services := []cyclops_sdk_schema.SandboxService{{Name: serviceName, TargetPort: 3000}}
+ vmTemplate := cyclops_sdk_schema.VmTemplate{ContainerDiskImage: image, CpuCores: &cpuCores, Memory: &memory, Services: &services}
+ if imagePullSecret := os.Getenv("CYCLOPS_IMAGE_PULL_SECRET"); imagePullSecret != "" {
+ vmTemplate.ImagePullSecret = &imagePullSecret
+ }
+ createdTemplate, err := client.CreateTemplate(fleet_sdk.CreateTemplateRequest{Namespace: namespace, Name: templateName, Spec: cyclops_sdk_schema.OsGymSandboxTemplateSpec{VmTemplate: vmTemplate}})
+ if err != nil { return fmt.Errorf("create template: %w", err) }
+ template = &createdTemplate
+ fmt.Printf("Template: %+v\n", *template)
+
fmt.Println("[2/5] Creating claim...")
- createdClaim, err := client.CreateClaim(cyclops_sdk.CreateClaimRequest{Pool: *pool})
+ createdClaim, err := client.CreateClaim(fleet_sdk.CreateClaimRequest{Pool: *pool})
if err != nil { return fmt.Errorf("create claim: %w", err) }
claim = &createdClaim
fmt.Printf("Claim: %+v\n", *claim)
@@ -122,7 +135,7 @@ func run() error {
fmt.Printf("Sandbox: %+v\n", sandbox)
fmt.Println("[4/5] Calling the sandbox service...")
- response, err := client.ServiceRequest(sandbox, serviceName, servicePath, cyclops_sdk.HttpRequest{Method: http.MethodGet, Url: "https://ignored.invalid" + servicePath, Headers: []cyclops_sdk.HttpHeader{}})
+ response, err := client.ServiceRequest(sandbox, serviceName, servicePath, fleet_sdk.HttpRequest{Method: http.MethodGet, Url: "https://ignored.invalid" + servicePath, Headers: []fleet_sdk.HttpHeader{}})
if err != nil { return fmt.Errorf("service request: %w", err) }
fmt.Printf("Service response: status=%d body=%q\n", response.Status, response.Body)
fmt.Println("[5/5] Lifecycle completed; cleanup will now run.")
diff --git a/libs/fleet/sdk-bindings/go-uniffi/cyclops_sdk/cyclops_sdk.go b/libs/fleet/sdk-bindings/go-uniffi/fleet_sdk/fleet_sdk.go
similarity index 80%
rename from libs/fleet/sdk-bindings/go-uniffi/cyclops_sdk/cyclops_sdk.go
rename to libs/fleet/sdk-bindings/go-uniffi/fleet_sdk/fleet_sdk.go
index 60e0896f78..4c12b9c626 100644
--- a/libs/fleet/sdk-bindings/go-uniffi/cyclops_sdk/cyclops_sdk.go
+++ b/libs/fleet/sdk-bindings/go-uniffi/fleet_sdk/fleet_sdk.go
@@ -1,6 +1,6 @@
-package cyclops_sdk
+package fleet_sdk
-// #include <cyclops_sdk.h>
+// #include <fleet_sdk.h>
import "C"
import (
@@ -374,7 +374,7 @@ func uniffiCheckChecksums() {
})
if bindingsContractVersion != int(scaffoldingContractVersion) {
// If this happens try cleaning and rebuilding your project
- panic("cyclops_sdk: UniFFI contract version mismatch")
+ panic("fleet_sdk: UniFFI contract version mismatch")
}
{
checksum := rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint16_t {
@@ -382,7 +382,7 @@ func uniffiCheckChecksums() {
})
if checksum != 23330 {
// If this happens try cleaning and rebuilding your project
- panic("cyclops_sdk: uniffi_cyclops_sdk_checksum_method_cyclopsclient_create_claim: UniFFI API checksum mismatch")
+ panic("fleet_sdk: uniffi_cyclops_sdk_checksum_method_cyclopsclient_create_claim: UniFFI API checksum mismatch")
}
}
{
@@ -391,7 +391,7 @@ func uniffiCheckChecksums() {
})
if checksum != 20460 {
// If this happens try cleaning and rebuilding your project
- panic("cyclops_sdk: uniffi_cyclops_sdk_checksum_method_cyclopsclient_delete_claim: UniFFI API checksum mismatch")
+ panic("fleet_sdk: uniffi_cyclops_sdk_checksum_method_cyclopsclient_delete_claim: UniFFI API checksum mismatch")
}
}
{
@@ -400,7 +400,7 @@ func uniffiCheckChecksums() {
})
if checksum != 17760 {
// If this happens try cleaning and rebuilding your project
- panic("cyclops_sdk: uniffi_cyclops_sdk_checksum_method_cyclopsclient_get_claim: UniFFI API checksum mismatch")
+ panic("fleet_sdk: uniffi_cyclops_sdk_checksum_method_cyclopsclient_get_claim: UniFFI API checksum mismatch")
}
}
{
@@ -409,7 +409,7 @@ func uniffiCheckChecksums() {
})
if checksum != 7802 {
// If this happens try cleaning and rebuilding your project
- panic("cyclops_sdk: uniffi_cyclops_sdk_checksum_method_cyclopsclient_list_claims: UniFFI API checksum mismatch")
+ panic("fleet_sdk: uniffi_cyclops_sdk_checksum_method_cyclopsclient_list_claims: UniFFI API checksum mismatch")
}
}
{
@@ -418,7 +418,7 @@ func uniffiCheckChecksums() {
})
if checksum != 18984 {
// If this happens try cleaning and rebuilding your project
- panic("cyclops_sdk: uniffi_cyclops_sdk_checksum_method_cyclopsclient_wait_claim: UniFFI API checksum mismatch")
+ panic("fleet_sdk: uniffi_cyclops_sdk_checksum_method_cyclopsclient_wait_claim: UniFFI API checksum mismatch")
}
}
{
@@ -427,7 +427,7 @@ func uniffiCheckChecksums() {
})
if checksum != 48557 {
// If this happens try cleaning and rebuilding your project
- panic("cyclops_sdk: uniffi_cyclops_sdk_checksum_method_cyclopsclient_create_pool: UniFFI API checksum mismatch")
+ panic("fleet_sdk: uniffi_cyclops_sdk_checksum_method_cyclopsclient_create_pool: UniFFI API checksum mismatch")
}
}
{
@@ -436,7 +436,7 @@ func uniffiCheckChecksums() {
})
if checksum != 31235 {
// If this happens try cleaning and rebuilding your project
- panic("cyclops_sdk: uniffi_cyclops_sdk_checksum_method_cyclopsclient_delete_pool: UniFFI API checksum mismatch")
+ panic("fleet_sdk: uniffi_cyclops_sdk_checksum_method_cyclopsclient_delete_pool: UniFFI API checksum mismatch")
}
}
{
@@ -445,7 +445,7 @@ func uniffiCheckChecksums() {
})
if checksum != 49450 {
// If this happens try cleaning and rebuilding your project
- panic("cyclops_sdk: uniffi_cyclops_sdk_checksum_method_cyclopsclient_get_pool: UniFFI API checksum mismatch")
+ panic("fleet_sdk: uniffi_cyclops_sdk_checksum_method_cyclopsclient_get_pool: UniFFI API checksum mismatch")
}
}
{
@@ -454,7 +454,16 @@ func uniffiCheckChecksums() {
})
if checksum != 27984 {
// If this happens try cleaning and rebuilding your project
- panic("cyclops_sdk: uniffi_cyclops_sdk_checksum_method_cyclopsclient_list_pools: UniFFI API checksum mismatch")
+ panic("fleet_sdk: uniffi_cyclops_sdk_checksum_method_cyclopsclient_list_pools: UniFFI API checksum mismatch")
+ }
+ }
+ {
+ checksum := rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint16_t {
+ return C.uniffi_cyclops_sdk_checksum_method_cyclopsclient_reconcile_pool()
+ })
+ if checksum != 53919 {
+ // If this happens try cleaning and rebuilding your project
+ panic("fleet_sdk: uniffi_cyclops_sdk_checksum_method_cyclopsclient_reconcile_pool: UniFFI API checksum mismatch")
}
}
{
@@ -463,7 +472,7 @@ func uniffiCheckChecksums() {
})
if checksum != 17695 {
// If this happens try cleaning and rebuilding your project
- panic("cyclops_sdk: uniffi_cyclops_sdk_checksum_method_cyclopsclient_update_pool: UniFFI API checksum mismatch")
+ panic("fleet_sdk: uniffi_cyclops_sdk_checksum_method_cyclopsclient_update_pool: UniFFI API checksum mismatch")
}
}
{
@@ -472,7 +481,61 @@ func uniffiCheckChecksums() {
})
if checksum != 46699 {
// If this happens try cleaning and rebuilding your project
- panic("cyclops_sdk: uniffi_cyclops_sdk_checksum_method_cyclopsclient_service_request: UniFFI API checksum mismatch")
+ panic("fleet_sdk: uniffi_cyclops_sdk_checksum_method_cyclopsclient_service_request: UniFFI API checksum mismatch")
+ }
+ }
+ {
+ checksum := rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint16_t {
+ return C.uniffi_cyclops_sdk_checksum_method_cyclopsclient_create_template()
+ })
+ if checksum != 13689 {
+ // If this happens try cleaning and rebuilding your project
+ panic("fleet_sdk: uniffi_cyclops_sdk_checksum_method_cyclopsclient_create_template: UniFFI API checksum mismatch")
+ }
+ }
+ {
+ checksum := rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint16_t {
+ return C.uniffi_cyclops_sdk_checksum_method_cyclopsclient_delete_template()
+ })
+ if checksum != 54852 {
+ // If this happens try cleaning and rebuilding your project
+ panic("fleet_sdk: uniffi_cyclops_sdk_checksum_method_cyclopsclient_delete_template: UniFFI API checksum mismatch")
+ }
+ }
+ {
+ checksum := rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint16_t {
+ return C.uniffi_cyclops_sdk_checksum_method_cyclopsclient_get_template()
+ })
+ if checksum != 8909 {
+ // If this happens try cleaning and rebuilding your project
+ panic("fleet_sdk: uniffi_cyclops_sdk_checksum_method_cyclopsclient_get_template: UniFFI API checksum mismatch")
+ }
+ }
+ {
+ checksum := rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint16_t {
+ return C.uniffi_cyclops_sdk_checksum_method_cyclopsclient_list_templates()
+ })
+ if checksum != 58376 {
+ // If this happens try cleaning and rebuilding your project
+ panic("fleet_sdk: uniffi_cyclops_sdk_checksum_method_cyclopsclient_list_templates: UniFFI API checksum mismatch")
+ }
+ }
+ {
+ checksum := rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint16_t {
+ return C.uniffi_cyclops_sdk_checksum_method_cyclopsclient_reconcile_template()
+ })
+ if checksum != 36469 {
+ // If this happens try cleaning and rebuilding your project
+ panic("fleet_sdk: uniffi_cyclops_sdk_checksum_method_cyclopsclient_reconcile_template: UniFFI API checksum mismatch")
+ }
+ }
+ {
+ checksum := rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint16_t {
+ return C.uniffi_cyclops_sdk_checksum_method_cyclopsclient_update_template()
+ })
+ if checksum != 18704 {
+ // If this happens try cleaning and rebuilding your project
+ panic("fleet_sdk: uniffi_cyclops_sdk_checksum_method_cyclopsclient_update_template: UniFFI API checksum mismatch")
}
}
{
@@ -481,7 +544,7 @@ func uniffiCheckChecksums() {
})
if checksum != 1180 {
// If this happens try cleaning and rebuilding your project
- panic("cyclops_sdk: uniffi_cyclops_sdk_checksum_method_accesstokenprovider_get_access_token: UniFFI API checksum mismatch")
+ panic("fleet_sdk: uniffi_cyclops_sdk_checksum_method_accesstokenprovider_get_access_token: UniFFI API checksum mismatch")
}
}
{
@@ -490,7 +553,7 @@ func uniffiCheckChecksums() {
})
if checksum != 38803 {
// If this happens try cleaning and rebuilding your project
- panic("cyclops_sdk: uniffi_cyclops_sdk_checksum_method_httpclient_execute: UniFFI API checksum mismatch")
+ panic("fleet_sdk: uniffi_cyclops_sdk_checksum_method_httpclient_execute: UniFFI API checksum mismatch")
}
}
{
@@ -499,7 +562,7 @@ func uniffiCheckChecksums() {
})
if checksum != 54404 {
// If this happens try cleaning and rebuilding your project
- panic("cyclops_sdk: uniffi_cyclops_sdk_checksum_constructor_cyclopsclient_connect: UniFFI API checksum mismatch")
+ panic("fleet_sdk: uniffi_cyclops_sdk_checksum_constructor_cyclopsclient_connect: UniFFI API checksum mismatch")
}
}
{
@@ -508,7 +571,7 @@ func uniffiCheckChecksums() {
})
if checksum != 55589 {
// If this happens try cleaning and rebuilding your project
- panic("cyclops_sdk: uniffi_cyclops_sdk_checksum_constructor_cyclopsclient_connect_browser_with_access_token: UniFFI API checksum mismatch")
+ panic("fleet_sdk: uniffi_cyclops_sdk_checksum_constructor_cyclopsclient_connect_browser_with_access_token: UniFFI API checksum mismatch")
}
}
{
@@ -517,7 +580,16 @@ func uniffiCheckChecksums() {
})
if checksum != 10148 {
// If this happens try cleaning and rebuilding your project
- panic("cyclops_sdk: uniffi_cyclops_sdk_checksum_constructor_cyclopsclient_connect_with_access_token: UniFFI API checksum mismatch")
+ panic("fleet_sdk: uniffi_cyclops_sdk_checksum_constructor_cyclopsclient_connect_with_access_token: UniFFI API checksum mismatch")
+ }
+ }
+ {
+ checksum := rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint16_t {
+ return C.uniffi_cyclops_sdk_checksum_constructor_cyclopsclient_connect_with_access_token_and_native_http_client()
+ })
+ if checksum != 42291 {
+ // If this happens try cleaning and rebuilding your project
+ panic("fleet_sdk: uniffi_cyclops_sdk_checksum_constructor_cyclopsclient_connect_with_access_token_and_native_http_client: UniFFI API checksum mismatch")
}
}
{
@@ -526,7 +598,25 @@ func uniffiCheckChecksums() {
})
if checksum != 58487 {
// If this happens try cleaning and rebuilding your project
- panic("cyclops_sdk: uniffi_cyclops_sdk_checksum_constructor_cyclopsclient_connect_with_access_token_provider: UniFFI API checksum mismatch")
+ panic("fleet_sdk: uniffi_cyclops_sdk_checksum_constructor_cyclopsclient_connect_with_access_token_provider: UniFFI API checksum mismatch")
+ }
+ }
+ {
+ checksum := rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint16_t {
+ return C.uniffi_cyclops_sdk_checksum_constructor_cyclopsclient_connect_with_access_token_provider_and_native_http_client()
+ })
+ if checksum != 62005 {
+ // If this happens try cleaning and rebuilding your project
+ panic("fleet_sdk: uniffi_cyclops_sdk_checksum_constructor_cyclopsclient_connect_with_access_token_provider_and_native_http_client: UniFFI API checksum mismatch")
+ }
+ }
+ {
+ checksum := rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint16_t {
+ return C.uniffi_cyclops_sdk_checksum_constructor_cyclopsclient_connect_with_native_http_client()
+ })
+ if checksum != 49301 {
+ // If this happens try cleaning and rebuilding your project
+ panic("fleet_sdk: uniffi_cyclops_sdk_checksum_constructor_cyclopsclient_connect_with_native_http_client: UniFFI API checksum mismatch")
}
}
{
@@ -535,7 +625,7 @@ func uniffiCheckChecksums() {
})
if checksum != 25746 {
// If this happens try cleaning and rebuilding your project
- panic("cyclops_sdk: uniffi_cyclops_sdk_checksum_constructor_cyclopscredentials_new: UniFFI API checksum mismatch")
+ panic("fleet_sdk: uniffi_cyclops_sdk_checksum_constructor_cyclopscredentials_new: UniFFI API checksum mismatch")
}
}
}
@@ -992,7 +1082,7 @@ func cyclops_sdk_transport_cgo_dispatchCallbackInterfaceAccessTokenProviderMetho
guardHandle := cgo.NewHandle(cancel)
*uniffiOutDroppedCallback = C.UniffiForeignFutureDroppedCallbackStruct{
handle: C.uint64_t(guardHandle),
- free: C.UniffiForeignFutureDroppedCallback(C.cyclops_sdk_uniffiFreeGorutine),
+ free: C.UniffiForeignFutureDroppedCallback(C.fleet_sdk_uniffiFreeGorutine),
}
// Wait for compleation or cancel
@@ -1071,8 +1161,15 @@ type CyclopsClientInterface interface {
DeletePool(pool Pool) error
GetPool(name string) (Pool, error)
ListPools(namespace string) ([]Pool, error)
+ ReconcilePool(request CreatePoolRequest) (Pool, error)
UpdatePool(pool Pool) (Pool, error)
ServiceRequest(sandbox Sandbox, service string, path string, request HttpRequest) (HttpResponse, error)
+ CreateTemplate(request CreateTemplateRequest) (Template, error)
+ DeleteTemplate(template Template) error
+ GetTemplate(namespace string, name string) (Template, error)
+ ListTemplates(namespace string) ([]Template, error)
+ ReconcileTemplate(request CreateTemplateRequest) (Template, error)
+ UpdateTemplate(template Template) (Template, error)
}
type CyclopsClient struct {
ffiObject FfiObject
@@ -1114,6 +1211,18 @@ func CyclopsClientConnectWithAccessToken(configuration CyclopsTokenProviderConfi
}
}
+func CyclopsClientConnectWithAccessTokenAndNativeHttpClient(configuration CyclopsTokenProviderConfiguration, accessToken string) (*CyclopsClient, error) {
+ _uniffiRV, _uniffiErr := rustCallWithError[*SdkError](FfiConverterSdkError{}, func(_uniffiStatus *C.RustCallStatus) C.uint64_t {
+ return C.uniffi_cyclops_sdk_fn_constructor_cyclopsclient_connect_with_access_token_and_native_http_client(FfiConverterCyclopsTokenProviderConfigurationINSTANCE.Lower(configuration), FfiConverterStringINSTANCE.Lower(accessToken), _uniffiStatus)
+ })
+ if _uniffiErr != nil {
+ var _uniffiDefaultValue *CyclopsClient
+ return _uniffiDefaultValue, _uniffiErr
+ } else {
+ return FfiConverterCyclopsClientINSTANCE.Lift(_uniffiRV), nil
+ }
+}
+
func CyclopsClientConnectWithAccessTokenProvider(configuration CyclopsTokenProviderConfiguration, tokenProvider AccessTokenProvider, httpClient HttpClient) (*CyclopsClient, error) {
_uniffiRV, _uniffiErr := rustCallWithError[*SdkError](FfiConverterSdkError{}, func(_uniffiStatus *C.RustCallStatus) C.uint64_t {
return C.uniffi_cyclops_sdk_fn_constructor_cyclopsclient_connect_with_access_token_provider(FfiConverterCyclopsTokenProviderConfigurationINSTANCE.Lower(configuration), FfiConverterAccessTokenProviderINSTANCE.Lower(tokenProvider), FfiConverterHttpClientINSTANCE.Lower(httpClient), _uniffiStatus)
@@ -1126,6 +1235,30 @@ func CyclopsClientConnectWithAccessTokenProvider(configuration CyclopsTokenProvi
}
}
+func CyclopsClientConnectWithAccessTokenProviderAndNativeHttpClient(configuration CyclopsTokenProviderConfiguration, tokenProvider AccessTokenProvider) (*CyclopsClient, error) {
+ _uniffiRV, _uniffiErr := rustCallWithError[*SdkError](FfiConverterSdkError{}, func(_uniffiStatus *C.RustCallStatus) C.uint64_t {
+ return C.uniffi_cyclops_sdk_fn_constructor_cyclopsclient_connect_with_access_token_provider_and_native_http_client(FfiConverterCyclopsTokenProviderConfigurationINSTANCE.Lower(configuration), FfiConverterAccessTokenProviderINSTANCE.Lower(tokenProvider), _uniffiStatus)
+ })
+ if _uniffiErr != nil {
+ var _uniffiDefaultValue *CyclopsClient
+ return _uniffiDefaultValue, _uniffiErr
+ } else {
+ return FfiConverterCyclopsClientINSTANCE.Lift(_uniffiRV), nil
+ }
+}
+
+func CyclopsClientConnectWithNativeHttpClient(configuration CyclopsConfiguration) (*CyclopsClient, error) {
+ _uniffiRV, _uniffiErr := rustCallWithError[*SdkError](FfiConverterSdkError{}, func(_uniffiStatus *C.RustCallStatus) C.uint64_t {
+ return C.uniffi_cyclops_sdk_fn_constructor_cyclopsclient_connect_with_native_http_client(FfiConverterCyclopsConfigurationINSTANCE.Lower(configuration), _uniffiStatus)
+ })
+ if _uniffiErr != nil {
+ var _uniffiDefaultValue *CyclopsClient
+ return _uniffiDefaultValue, _uniffiErr
+ } else {
+ return FfiConverterCyclopsClientINSTANCE.Lift(_uniffiRV), nil
+ }
+}
+
func (_self *CyclopsClient) CreateClaim(request CreateClaimRequest) (Claim, error) {
_pointer := _self.ffiObject.incrementPointer("*CyclopsClient")
defer _self.ffiObject.decrementPointer()
@@ -1433,6 +1566,41 @@ func (_self *CyclopsClient) ListPools(namespace string) ([]Pool, error) {
return res, err
}
+func (_self *CyclopsClient) ReconcilePool(request CreatePoolRequest) (Pool, error) {
+ _pointer := _self.ffiObject.incrementPointer("*CyclopsClient")
+ defer _self.ffiObject.decrementPointer()
+ res, err := uniffiRustCallAsync[*SdkError](
+ FfiConverterSdkErrorINSTANCE,
+ // completeFn
+ func(handle C.uint64_t, status *C.RustCallStatus) RustBufferI {
+ res := C.ffi_cyclops_sdk_rust_future_complete_rust_buffer(handle, status)
+ return GoRustBuffer{
+ inner: res,
+ }
+ },
+ // liftFn
+ func(ffi RustBufferI) Pool {
+ return FfiConverterPoolINSTANCE.Lift(ffi)
+ },
+ C.uniffi_cyclops_sdk_fn_method_cyclopsclient_reconcile_pool(
+ _pointer, FfiConverterCreatePoolRequestINSTANCE.Lower(request)),
+ // pollFn
+ func(handle C.uint64_t, continuation C.UniffiRustFutureContinuationCallback, data C.uint64_t) {
+ C.ffi_cyclops_sdk_rust_future_poll_rust_buffer(handle, continuation, data)
+ },
+ // freeFn
+ func(handle C.uint64_t) {
+ C.ffi_cyclops_sdk_rust_future_free_rust_buffer(handle)
+ },
+ )
+
+ if err == nil {
+ return res, nil
+ }
+
+ return res, err
+}
+
func (_self *CyclopsClient) UpdatePool(pool Pool) (Pool, error) {
_pointer := _self.ffiObject.incrementPointer("*CyclopsClient")
defer _self.ffiObject.decrementPointer()
@@ -1502,6 +1670,212 @@ func (_self *CyclopsClient) ServiceRequest(sandbox Sandbox, service string, path
return res, err
}
+
+func (_self *CyclopsClient) CreateTemplate(request CreateTemplateRequest) (Template, error) {
+ _pointer := _self.ffiObject.incrementPointer("*CyclopsClient")
+ defer _self.ffiObject.decrementPointer()
+ res, err := uniffiRustCallAsync[*SdkError](
+ FfiConverterSdkErrorINSTANCE,
+ // completeFn
+ func(handle C.uint64_t, status *C.RustCallStatus) RustBufferI {
+ res := C.ffi_cyclops_sdk_rust_future_complete_rust_buffer(handle, status)
+ return GoRustBuffer{
+ inner: res,
+ }
+ },
+ // liftFn
+ func(ffi RustBufferI) Template {
+ return FfiConverterTemplateINSTANCE.Lift(ffi)
+ },
+ C.uniffi_cyclops_sdk_fn_method_cyclopsclient_create_template(
+ _pointer, FfiConverterCreateTemplateRequestINSTANCE.Lower(request)),
+ // pollFn
+ func(handle C.uint64_t, continuation C.UniffiRustFutureContinuationCallback, data C.uint64_t) {
+ C.ffi_cyclops_sdk_rust_future_poll_rust_buffer(handle, continuation, data)
+ },
+ // freeFn
+ func(handle C.uint64_t) {
+ C.ffi_cyclops_sdk_rust_future_free_rust_buffer(handle)
+ },
+ )
+
+ if err == nil {
+ return res, nil
+ }
+
+ return res, err
+}
+
+func (_self *CyclopsClient) DeleteTemplate(template Template) error {
+ _pointer := _self.ffiObject.incrementPointer("*CyclopsClient")
+ defer _self.ffiObject.decrementPointer()
+ _, err := uniffiRustCallAsync[*SdkError](
+ FfiConverterSdkErrorINSTANCE,
+ // completeFn
+ func(handle C.uint64_t, status *C.RustCallStatus) struct{} {
+ C.ffi_cyclops_sdk_rust_future_complete_void(handle, status)
+ return struct{}{}
+ },
+ // liftFn
+ func(_ struct{}) struct{} { return struct{}{} },
+ C.uniffi_cyclops_sdk_fn_method_cyclopsclient_delete_template(
+ _pointer, FfiConverterTemplateINSTANCE.Lower(template)),
+ // pollFn
+ func(handle C.uint64_t, continuation C.UniffiRustFutureContinuationCallback, data C.uint64_t) {
+ C.ffi_cyclops_sdk_rust_future_poll_void(handle, continuation, data)
+ },
+ // freeFn
+ func(handle C.uint64_t) {
+ C.ffi_cyclops_sdk_rust_future_free_void(handle)
+ },
+ )
+
+ if err == nil {
+ return nil
+ }
+
+ return err
+}
+
+func (_self *CyclopsClient) GetTemplate(namespace string, name string) (Template, error) {
+ _pointer := _self.ffiObject.incrementPointer("*CyclopsClient")
+ defer _self.ffiObject.decrementPointer()
+ res, err := uniffiRustCallAsync[*SdkError](
+ FfiConverterSdkErrorINSTANCE,
+ // completeFn
+ func(handle C.uint64_t, status *C.RustCallStatus) RustBufferI {
+ res := C.ffi_cyclops_sdk_rust_future_complete_rust_buffer(handle, status)
+ return GoRustBuffer{
+ inner: res,
+ }
+ },
+ // liftFn
+ func(ffi RustBufferI) Template {
+ return FfiConverterTemplateINSTANCE.Lift(ffi)
+ },
+ C.uniffi_cyclops_sdk_fn_method_cyclopsclient_get_template(
+ _pointer, FfiConverterStringINSTANCE.Lower(namespace), FfiConverterStringINSTANCE.Lower(name)),
+ // pollFn
+ func(handle C.uint64_t, continuation C.UniffiRustFutureContinuationCallback, data C.uint64_t) {
+ C.ffi_cyclops_sdk_rust_future_poll_rust_buffer(handle, continuation, data)
+ },
+ // freeFn
+ func(handle C.uint64_t) {
+ C.ffi_cyclops_sdk_rust_future_free_rust_buffer(handle)
+ },
+ )
+
+ if err == nil {
+ return res, nil
+ }
+
+ return res, err
+}
+
+func (_self *CyclopsClient) ListTemplates(namespace string) ([]Template, error) {
+ _pointer := _self.ffiObject.incrementPointer("*CyclopsClient")
+ defer _self.ffiObject.decrementPointer()
+ res, err := uniffiRustCallAsync[*SdkError](
+ FfiConverterSdkErrorINSTANCE,
+ // completeFn
+ func(handle C.uint64_t, status *C.RustCallStatus) RustBufferI {
+ res := C.ffi_cyclops_sdk_rust_future_complete_rust_buffer(handle, status)
+ return GoRustBuffer{
+ inner: res,
+ }
+ },
+ // liftFn
+ func(ffi RustBufferI) []Template {
+ return FfiConverterSequenceTemplateINSTANCE.Lift(ffi)
+ },
+ C.uniffi_cyclops_sdk_fn_method_cyclopsclient_list_templates(
+ _pointer, FfiConverterStringINSTANCE.Lower(namespace)),
+ // pollFn
+ func(handle C.uint64_t, continuation C.UniffiRustFutureContinuationCallback, data C.uint64_t) {
+ C.ffi_cyclops_sdk_rust_future_poll_rust_buffer(handle, continuation, data)
+ },
+ // freeFn
+ func(handle C.uint64_t) {
+ C.ffi_cyclops_sdk_rust_future_free_rust_buffer(handle)
+ },
+ )
+
+ if err == nil {
+ return res, nil
+ }
+
+ return res, err
+}
+
+func (_self *CyclopsClient) ReconcileTemplate(request CreateTemplateRequest) (Template, error) {
+ _pointer := _self.ffiObject.incrementPointer("*CyclopsClient")
+ defer _self.ffiObject.decrementPointer()
+ res, err := uniffiRustCallAsync[*SdkError](
+ FfiConverterSdkErrorINSTANCE,
+ // completeFn
+ func(handle C.uint64_t, status *C.RustCallStatus) RustBufferI {
+ res := C.ffi_cyclops_sdk_rust_future_complete_rust_buffer(handle, status)
+ return GoRustBuffer{
+ inner: res,
+ }
+ },
+ // liftFn
+ func(ffi RustBufferI) Template {
+ return FfiConverterTemplateINSTANCE.Lift(ffi)
+ },
+ C.uniffi_cyclops_sdk_fn_method_cyclopsclient_reconcile_template(
+ _pointer, FfiConverterCreateTemplateRequestINSTANCE.Lower(request)),
+ // pollFn
+ func(handle C.uint64_t, continuation C.UniffiRustFutureContinuationCallback, data C.uint64_t) {
+ C.ffi_cyclops_sdk_rust_future_poll_rust_buffer(handle, continuation, data)
+ },
+ // freeFn
+ func(handle C.uint64_t) {
+ C.ffi_cyclops_sdk_rust_future_free_rust_buffer(handle)
+ },
+ )
+
+ if err == nil {
+ return res, nil
+ }
+
+ return res, err
+}
+
+func (_self *CyclopsClient) UpdateTemplate(template Template) (Template, error) {
+ _pointer := _self.ffiObject.incrementPointer("*CyclopsClient")
+ defer _self.ffiObject.decrementPointer()
+ res, err := uniffiRustCallAsync[*SdkError](
+ FfiConverterSdkErrorINSTANCE,
+ // completeFn
+ func(handle C.uint64_t, status *C.RustCallStatus) RustBufferI {
+ res := C.ffi_cyclops_sdk_rust_future_complete_rust_buffer(handle, status)
+ return GoRustBuffer{
+ inner: res,
+ }
+ },
+ // liftFn
+ func(ffi RustBufferI) Template {
+ return FfiConverterTemplateINSTANCE.Lift(ffi)
+ },
+ C.uniffi_cyclops_sdk_fn_method_cyclopsclient_update_template(
+ _pointer, FfiConverterTemplateINSTANCE.Lower(template)),
+ // pollFn
+ func(handle C.uint64_t, continuation C.UniffiRustFutureContinuationCallback, data C.uint64_t) {
+ C.ffi_cyclops_sdk_rust_future_poll_rust_buffer(handle, continuation, data)
+ },
+ // freeFn
+ func(handle C.uint64_t) {
+ C.ffi_cyclops_sdk_rust_future_free_rust_buffer(handle)
+ },
+ )
+
+ if err == nil {
+ return res, nil
+ }
+
+ return res, err
+}
func (object *CyclopsClient) Destroy() {
runtime.SetFinalizer(object, nil)
object.ffiObject.destroy()
@@ -1759,7 +2133,7 @@ func cyclops_sdk_transport_cgo_dispatchCallbackInterfaceHttpClientMethod0(uniffi
guardHandle := cgo.NewHandle(cancel)
*uniffiOutDroppedCallback = C.UniffiForeignFutureDroppedCallbackStruct{
handle: C.uint64_t(guardHandle),
- free: C.UniffiForeignFutureDroppedCallback(C.cyclops_sdk_uniffiFreeGorutine),
+ free: C.UniffiForeignFutureDroppedCallback(C.fleet_sdk_uniffiFreeGorutine),
}
// Wait for compleation or cancel
@@ -1932,12 +2306,12 @@ func (_ FfiDestroyerCreateClaimRequest) Destroy(value CreateClaimRequest) {
type CreatePoolRequest struct {
Namespace string
- Spec cyclops_sdk_schema.PoolSpec
+ Spec cyclops_sdk_schema.OsGymSandboxWarmPoolSpec
}
func (r *CreatePoolRequest) Destroy() {
FfiDestroyerString{}.Destroy(r.Namespace)
- cyclops_sdk_schema.FfiDestroyerPoolSpec{}.Destroy(r.Spec)
+ cyclops_sdk_schema.FfiDestroyerOsGymSandboxWarmPoolSpec{}.Destroy(r.Spec)
}
type FfiConverterCreatePoolRequest struct{}
@@ -1951,7 +2325,7 @@ func (c FfiConverterCreatePoolRequest) Lift(rb RustBufferI) CreatePoolRequest {
func (c FfiConverterCreatePoolRequest) Read(reader io.Reader) CreatePoolRequest {
return CreatePoolRequest{
FfiConverterStringINSTANCE.Read(reader),
- cyclops_sdk_schema.FfiConverterPoolSpecINSTANCE.Read(reader),
+ cyclops_sdk_schema.FfiConverterOsGymSandboxWarmPoolSpecINSTANCE.Read(reader),
}
}
@@ -1965,7 +2339,7 @@ func (c FfiConverterCreatePoolRequest) LowerExternal(value CreatePoolRequest) Ex
func (c FfiConverterCreatePoolRequest) Write(writer io.Writer, value CreatePoolRequest) {
FfiConverterStringINSTANCE.Write(writer, value.Namespace)
- cyclops_sdk_schema.FfiConverterPoolSpecINSTANCE.Write(writer, value.Spec)
+ cyclops_sdk_schema.FfiConverterOsGymSandboxWarmPoolSpecINSTANCE.Write(writer, value.Spec)
}
type FfiDestroyerCreatePoolRequest struct{}
@@ -1974,6 +2348,54 @@ func (_ FfiDestroyerCreatePoolRequest) Destroy(value CreatePoolRequest) {
value.Destroy()
}
+type CreateTemplateRequest struct {
+ Namespace string
+ Name string
+ Spec cyclops_sdk_schema.OsGymSandboxTemplateSpec
+}
+
+func (r *CreateTemplateRequest) Destroy() {
+ FfiDestroyerString{}.Destroy(r.Namespace)
+ FfiDestroyerString{}.Destroy(r.Name)
+ cyclops_sdk_schema.FfiDestroyerOsGymSandboxTemplateSpec{}.Destroy(r.Spec)
+}
+
+type FfiConverterCreateTemplateRequest struct{}
+
+var FfiConverterCreateTemplateRequestINSTANCE = FfiConverterCreateTemplateRequest{}
+
+func (c FfiConverterCreateTemplateRequest) Lift(rb RustBufferI) CreateTemplateRequest {
+ return LiftFromRustBuffer[CreateTemplateRequest](c, rb)
+}
+
+func (c FfiConverterCreateTemplateRequest) Read(reader io.Reader) CreateTemplateRequest {
+ return CreateTemplateRequest{
+ FfiConverterStringINSTANCE.Read(reader),
+ FfiConverterStringINSTANCE.Read(reader),
+ cyclops_sdk_schema.FfiConverterOsGymSandboxTemplateSpecINSTANCE.Read(reader),
+ }
+}
+
+func (c FfiConverterCreateTemplateRequest) Lower(value CreateTemplateRequest) C.RustBuffer {
+ return LowerIntoRustBuffer[CreateTemplateRequest](c, value)
+}
+
+func (c FfiConverterCreateTemplateRequest) LowerExternal(value CreateTemplateRequest) ExternalCRustBuffer {
+ return RustBufferFromC(LowerIntoRustBuffer[CreateTemplateRequest](c, value))
+}
+
+func (c FfiConverterCreateTemplateRequest) Write(writer io.Writer, value CreateTemplateRequest) {
+ FfiConverterStringINSTANCE.Write(writer, value.Namespace)
+ FfiConverterStringINSTANCE.Write(writer, value.Name)
+ cyclops_sdk_schema.FfiConverterOsGymSandboxTemplateSpecINSTANCE.Write(writer, value.Spec)
+}
+
+type FfiDestroyerCreateTemplateRequest struct{}
+
+func (_ FfiDestroyerCreateTemplateRequest) Destroy(value CreateTemplateRequest) {
+ value.Destroy()
+}
+
type CyclopsConfiguration struct {
BaseUrl string
TokenUrl string
@@ -2239,21 +2661,26 @@ func (_ FfiDestroyerHttpResponse) Destroy(value HttpResponse) {
}
// UniFFI cannot emit aliases for external record types. Generated bindings use
-// `OSGymWorkspacePoolStatus` and `OSGymSandboxClaimStatus` from cyclops_sdk_schema.
+// `OSGymSandboxWarmPoolStatus` and `OSGymSandboxClaimStatus` from cyclops_sdk_schema.
+//
+// A `Pool` is the `osgym.cua.ai/v1alpha1 OSGymSandboxWarmPool` CR verbatim —
+// the SDK is a naive CRUD mapper over the native CRDs, with no translation
+// layer (the legacy `cua.ai/v1 OSGymWorkspacePool` and its operator compat
+// shim are gone).
type Pool struct {
ApiVersion string
Kind string
Metadata ResourceMetadata
- Spec cyclops_sdk_schema.PoolSpec
- Status *cyclops_sdk_schema.OsGymWorkspacePoolStatus
+ Spec cyclops_sdk_schema.OsGymSandboxWarmPoolSpec
+ Status *cyclops_sdk_schema.OsGymSandboxWarmPoolStatus
}
func (r *Pool) Destroy() {
FfiDestroyerString{}.Destroy(r.ApiVersion)
FfiDestroyerString{}.Destroy(r.Kind)
FfiDestroyerResourceMetadata{}.Destroy(r.Metadata)
- cyclops_sdk_schema.FfiDestroyerPoolSpec{}.Destroy(r.Spec)
- FfiDestroyerOptionalOsGymWorkspacePoolStatus{}.Destroy(r.Status)
+ cyclops_sdk_schema.FfiDestroyerOsGymSandboxWarmPoolSpec{}.Destroy(r.Spec)
+ FfiDestroyerOptionalOsGymSandboxWarmPoolStatus{}.Destroy(r.Status)
}
type FfiConverterPool struct{}
@@ -2269,8 +2696,8 @@ func (c FfiConverterPool) Read(reader io.Reader) Pool {
FfiConverterStringINSTANCE.Read(reader),
FfiConverterStringINSTANCE.Read(reader),
FfiConverterResourceMetadataINSTANCE.Read(reader),
- cyclops_sdk_schema.FfiConverterPoolSpecINSTANCE.Read(reader),
- FfiConverterOptionalOsGymWorkspacePoolStatusINSTANCE.Read(reader),
+ cyclops_sdk_schema.FfiConverterOsGymSandboxWarmPoolSpecINSTANCE.Read(reader),
+ FfiConverterOptionalOsGymSandboxWarmPoolStatusINSTANCE.Read(reader),
}
}
@@ -2286,8 +2713,8 @@ func (c FfiConverterPool) Write(writer io.Writer, value Pool) {
FfiConverterStringINSTANCE.Write(writer, value.ApiVersion)
FfiConverterStringINSTANCE.Write(writer, value.Kind)
FfiConverterResourceMetadataINSTANCE.Write(writer, value.Metadata)
- cyclops_sdk_schema.FfiConverterPoolSpecINSTANCE.Write(writer, value.Spec)
- FfiConverterOptionalOsGymWorkspacePoolStatusINSTANCE.Write(writer, value.Status)
+ cyclops_sdk_schema.FfiConverterOsGymSandboxWarmPoolSpecINSTANCE.Write(writer, value.Spec)
+ FfiConverterOptionalOsGymSandboxWarmPoolStatusINSTANCE.Write(writer, value.Status)
}
type FfiDestroyerPool struct{}
@@ -2396,6 +2823,60 @@ func (_ FfiDestroyerSandbox) Destroy(value Sandbox) {
value.Destroy()
}
+// The `osgym.cua.ai/v1alpha1 OSGymSandboxTemplate` CR verbatim. Warm pools
+// and claims reference one by name via `spec.sandboxTemplateRef.name`.
+type Template struct {
+ ApiVersion string
+ Kind string
+ Metadata ResourceMetadata
+ Spec cyclops_sdk_schema.OsGymSandboxTemplateSpec
+}
+
+func (r *Template) Destroy() {
+ FfiDestroyerString{}.Destroy(r.ApiVersion)
+ FfiDestroyerString{}.Destroy(r.Kind)
+ FfiDestroyerResourceMetadata{}.Destroy(r.Metadata)
+ cyclops_sdk_schema.FfiDestroyerOsGymSandboxTemplateSpec{}.Destroy(r.Spec)
+}
+
+type FfiConverterTemplate struct{}
+
+var FfiConverterTemplateINSTANCE = FfiConverterTemplate{}
+
+func (c FfiConverterTemplate) Lift(rb RustBufferI) Template {
+ return LiftFromRustBuffer[Template](c, rb)
+}
+
+func (c FfiConverterTemplate) Read(reader io.Reader) Template {
+ return Template{
+ FfiConverterStringINSTANCE.Read(reader),
+ FfiConverterStringINSTANCE.Read(reader),
+ FfiConverterResourceMetadataINSTANCE.Read(reader),
+ cyclops_sdk_schema.FfiConverterOsGymSandboxTemplateSpecINSTANCE.Read(reader),
+ }
+}
+
+func (c FfiConverterTemplate) Lower(value Template) C.RustBuffer {
+ return LowerIntoRustBuffer[Template](c, value)
+}
+
+func (c FfiConverterTemplate) LowerExternal(value Template) ExternalCRustBuffer {
+ return RustBufferFromC(LowerIntoRustBuffer[Template](c, value))
+}
+
+func (c FfiConverterTemplate) Write(writer io.Writer, value Template) {
+ FfiConverterStringINSTANCE.Write(writer, value.ApiVersion)
+ FfiConverterStringINSTANCE.Write(writer, value.Kind)
+ FfiConverterResourceMetadataINSTANCE.Write(writer, value.Metadata)
+ cyclops_sdk_schema.FfiConverterOsGymSandboxTemplateSpecINSTANCE.Write(writer, value.Spec)
+}
+
+type FfiDestroyerTemplate struct{}
+
+func (_ FfiDestroyerTemplate) Destroy(value Template) {
+ value.Destroy()
+}
+
type AccessTokenProviderError struct {
err error
}
@@ -3220,44 +3701,44 @@ func (_ FfiDestroyerOptionalOsGymSandboxClaimStatus) Destroy(value *cyclops_sdk_
}
}
-type FfiConverterOptionalOsGymWorkspacePoolStatus struct{}
+type FfiConverterOptionalOsGymSandboxWarmPoolStatus struct{}
-var FfiConverterOptionalOsGymWorkspacePoolStatusINSTANCE = FfiConverterOptionalOsGymWorkspacePoolStatus{}
+var FfiConverterOptionalOsGymSandboxWarmPoolStatusINSTANCE = FfiConverterOptionalOsGymSandboxWarmPoolStatus{}
-func (c FfiConverterOptionalOsGymWorkspacePoolStatus) Lift(rb RustBufferI) *cyclops_sdk_schema.OsGymWorkspacePoolStatus {
- return LiftFromRustBuffer[*cyclops_sdk_schema.OsGymWorkspacePoolStatus](c, rb)
+func (c FfiConverterOptionalOsGymSandboxWarmPoolStatus) Lift(rb RustBufferI) *cyclops_sdk_schema.OsGymSandboxWarmPoolStatus {
+ return LiftFromRustBuffer[*cyclops_sdk_schema.OsGymSandboxWarmPoolStatus](c, rb)
}
-func (_ FfiConverterOptionalOsGymWorkspacePoolStatus) Read(reader io.Reader) *cyclops_sdk_schema.OsGymWorkspacePoolStatus {
+func (_ FfiConverterOptionalOsGymSandboxWarmPoolStatus) Read(reader io.Reader) *cyclops_sdk_schema.OsGymSandboxWarmPoolStatus {
if readInt8(reader) == 0 {
return nil
}
- temp := cyclops_sdk_schema.FfiConverterOsGymWorkspacePoolStatusINSTANCE.Read(reader)
+ temp := cyclops_sdk_schema.FfiConverterOsGymSandboxWarmPoolStatusINSTANCE.Read(reader)
return &temp
}
-func (c FfiConverterOptionalOsGymWorkspacePoolStatus) Lower(value *cyclops_sdk_schema.OsGymWorkspacePoolStatus) C.RustBuffer {
- return LowerIntoRustBuffer[*cyclops_sdk_schema.OsGymWorkspacePoolStatus](c, value)
+func (c FfiConverterOptionalOsGymSandboxWarmPoolStatus) Lower(value *cyclops_sdk_schema.OsGymSandboxWarmPoolStatus) C.RustBuffer {
+ return LowerIntoRustBuffer[*cyclops_sdk_schema.OsGymSandboxWarmPoolStatus](c, value)
}
-func (c FfiConverterOptionalOsGymWorkspacePoolStatus) LowerExternal(value *cyclops_sdk_schema.OsGymWorkspacePoolStatus) ExternalCRustBuffer {
- return RustBufferFromC(LowerIntoRustBuffer[*cyclops_sdk_schema.OsGymWorkspacePoolStatus](c, value))
+func (c FfiConverterOptionalOsGymSandboxWarmPoolStatus) LowerExternal(value *cyclops_sdk_schema.OsGymSandboxWarmPoolStatus) ExternalCRustBuffer {
+ return RustBufferFromC(LowerIntoRustBuffer[*cyclops_sdk_schema.OsGymSandboxWarmPoolStatus](c, value))
}
-func (_ FfiConverterOptionalOsGymWorkspacePoolStatus) Write(writer io.Writer, value *cyclops_sdk_schema.OsGymWorkspacePoolStatus) {
+func (_ FfiConverterOptionalOsGymSandboxWarmPoolStatus) Write(writer io.Writer, value *cyclops_sdk_schema.OsGymSandboxWarmPoolStatus) {
if value == nil {
writeInt8(writer, 0)
} else {
writeInt8(writer, 1)
- cyclops_sdk_schema.FfiConverterOsGymWorkspacePoolStatusINSTANCE.Write(writer, *value)
+ cyclops_sdk_schema.FfiConverterOsGymSandboxWarmPoolStatusINSTANCE.Write(writer, *value)
}
}
-type FfiDestroyerOptionalOsGymWorkspacePoolStatus struct{}
+type FfiDestroyerOptionalOsGymSandboxWarmPoolStatus struct{}
-func (_ FfiDestroyerOptionalOsGymWorkspacePoolStatus) Destroy(value *cyclops_sdk_schema.OsGymWorkspacePoolStatus) {
+func (_ FfiDestroyerOptionalOsGymSandboxWarmPoolStatus) Destroy(value *cyclops_sdk_schema.OsGymSandboxWarmPoolStatus) {
if value != nil {
- cyclops_sdk_schema.FfiDestroyerOsGymWorkspacePoolStatus{}.Destroy(*value)
+ cyclops_sdk_schema.FfiDestroyerOsGymSandboxWarmPoolStatus{}.Destroy(*value)
}
}
@@ -3490,6 +3971,53 @@ func (FfiDestroyerSequencePool) Destroy(sequence []Pool) {
}
}
+type FfiConverterSequenceTemplate struct{}
+
+var FfiConverterSequenceTemplateINSTANCE = FfiConverterSequenceTemplate{}
+
+func (c FfiConverterSequenceTemplate) Lift(rb RustBufferI) []Template {
+ return LiftFromRustBuffer[[]Template](c, rb)
+}
+
+func (c FfiConverterSequenceTemplate) Read(reader io.Reader) []Template {
+ length := readInt32(reader)
+ if length == 0 {
+ return nil
+ }
+ result := make([]Template, 0, length)
+ for i := int32(0); i < length; i++ {
+ result = append(result, FfiConverterTemplateINSTANCE.Read(reader))
+ }
+ return result
+}
+
+func (c FfiConverterSequenceTemplate) Lower(value []Template) C.RustBuffer {
+ return LowerIntoRustBuffer[[]Template](c, value)
+}
+
+func (c FfiConverterSequenceTemplate) LowerExternal(value []Template) ExternalCRustBuffer {
+ return RustBufferFromC(LowerIntoRustBuffer[[]Template](c, value))
+}
+
+func (c FfiConverterSequenceTemplate) Write(writer io.Writer, value []Template) {
+ if len(value) > math.MaxInt32 {
+ panic("[]Template is too large to fit into Int32")
+ }
+
+ writeInt32(writer, int32(len(value)))
+ for _, item := range value {
+ FfiConverterTemplateINSTANCE.Write(writer, item)
+ }
+}
+
+type FfiDestroyerSequenceTemplate struct{}
+
+func (FfiDestroyerSequenceTemplate) Destroy(sequence []Template) {
+ for _, value := range sequence {
+ FfiDestroyerTemplate{}.Destroy(value)
+ }
+}
+
type FfiConverterMapStringString struct{}
var FfiConverterMapStringStringINSTANCE = FfiConverterMapStringString{}
@@ -3547,8 +4075,8 @@ type rustFuturePollFunc func(C.uint64_t, C.UniffiRustFutureContinuationCallback,
type rustFutureCompleteFunc[T any] func(C.uint64_t, *C.RustCallStatus) T
type rustFutureFreeFunc func(C.uint64_t)
-//export cyclops_sdk_uniffiFutureContinuationCallback
-func cyclops_sdk_uniffiFutureContinuationCallback(data C.uint64_t, pollResult C.int8_t) {
+//export fleet_sdk_uniffiFutureContinuationCallback
+func fleet_sdk_uniffiFutureContinuationCallback(data C.uint64_t, pollResult C.int8_t) {
h := cgo.Handle(uintptr(data))
waiter := h.Value().(chan int8)
waiter <- int8(pollResult)
@@ -3573,7 +4101,7 @@ func uniffiRustCallAsync[E any, T any, F any](
for pollResult != uniffiRustFuturePollReady {
pollFunc(
rustFuture,
- (C.UniffiRustFutureContinuationCallback)(C.cyclops_sdk_uniffiFutureContinuationCallback),
+ (C.UniffiRustFutureContinuationCallback)(C.fleet_sdk_uniffiFutureContinuationCallback),
C.uint64_t(chanHandle),
)
pollResult = <-waiter
@@ -3589,8 +4117,8 @@ func uniffiRustCallAsync[E any, T any, F any](
return liftFunc(ffiValue), err
}
-//export cyclops_sdk_uniffiFreeGorutine
-func cyclops_sdk_uniffiFreeGorutine(data C.uint64_t) {
+//export fleet_sdk_uniffiFreeGorutine
+func fleet_sdk_uniffiFreeGorutine(data C.uint64_t) {
handle := cgo.Handle(uintptr(data))
defer handle.Delete()
diff --git a/libs/fleet/sdk-bindings/go-uniffi/cyclops_sdk/cyclops_sdk.h b/libs/fleet/sdk-bindings/go-uniffi/fleet_sdk/fleet_sdk.h
similarity index 86%
rename from libs/fleet/sdk-bindings/go-uniffi/cyclops_sdk/cyclops_sdk.h
rename to libs/fleet/sdk-bindings/go-uniffi/fleet_sdk/fleet_sdk.h
index 108ebde1e6..45080b8b4d 100644
--- a/libs/fleet/sdk-bindings/go-uniffi/cyclops_sdk/cyclops_sdk.h
+++ b/libs/fleet/sdk-bindings/go-uniffi/fleet_sdk/fleet_sdk.h
@@ -441,11 +441,26 @@ uint64_t uniffi_cyclops_sdk_fn_constructor_cyclopsclient_connect_browser_with_ac
uint64_t uniffi_cyclops_sdk_fn_constructor_cyclopsclient_connect_with_access_token(RustBuffer configuration, RustBuffer access_token, uint64_t http_client, RustCallStatus *out_status
);
#endif
+#ifndef UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_FN_CONSTRUCTOR_CYCLOPSCLIENT_CONNECT_WITH_ACCESS_TOKEN_AND_NATIVE_HTTP_CLIENT
+#define UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_FN_CONSTRUCTOR_CYCLOPSCLIENT_CONNECT_WITH_ACCESS_TOKEN_AND_NATIVE_HTTP_CLIENT
+uint64_t uniffi_cyclops_sdk_fn_constructor_cyclopsclient_connect_with_access_token_and_native_http_client(RustBuffer configuration, RustBuffer access_token, RustCallStatus *out_status
+);
+#endif
#ifndef UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_FN_CONSTRUCTOR_CYCLOPSCLIENT_CONNECT_WITH_ACCESS_TOKEN_PROVIDER
#define UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_FN_CONSTRUCTOR_CYCLOPSCLIENT_CONNECT_WITH_ACCESS_TOKEN_PROVIDER
uint64_t uniffi_cyclops_sdk_fn_constructor_cyclopsclient_connect_with_access_token_provider(RustBuffer configuration, uint64_t token_provider, uint64_t http_client, RustCallStatus *out_status
);
#endif
+#ifndef UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_FN_CONSTRUCTOR_CYCLOPSCLIENT_CONNECT_WITH_ACCESS_TOKEN_PROVIDER_AND_NATIVE_HTTP_CLIENT
+#define UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_FN_CONSTRUCTOR_CYCLOPSCLIENT_CONNECT_WITH_ACCESS_TOKEN_PROVIDER_AND_NATIVE_HTTP_CLIENT
+uint64_t uniffi_cyclops_sdk_fn_constructor_cyclopsclient_connect_with_access_token_provider_and_native_http_client(RustBuffer configuration, uint64_t token_provider, RustCallStatus *out_status
+);
+#endif
+#ifndef UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_FN_CONSTRUCTOR_CYCLOPSCLIENT_CONNECT_WITH_NATIVE_HTTP_CLIENT
+#define UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_FN_CONSTRUCTOR_CYCLOPSCLIENT_CONNECT_WITH_NATIVE_HTTP_CLIENT
+uint64_t uniffi_cyclops_sdk_fn_constructor_cyclopsclient_connect_with_native_http_client(RustBuffer configuration, RustCallStatus *out_status
+);
+#endif
#ifndef UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_FN_METHOD_CYCLOPSCLIENT_CREATE_CLAIM
#define UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_FN_METHOD_CYCLOPSCLIENT_CREATE_CLAIM
uint64_t uniffi_cyclops_sdk_fn_method_cyclopsclient_create_claim(uint64_t ptr, RustBuffer request
@@ -483,7 +498,7 @@ uint64_t uniffi_cyclops_sdk_fn_method_cyclopsclient_delete_pool(uint64_t ptr, Ru
#endif
#ifndef UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_FN_METHOD_CYCLOPSCLIENT_GET_POOL
#define UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_FN_METHOD_CYCLOPSCLIENT_GET_POOL
-uint64_t uniffi_cyclops_sdk_fn_method_cyclopsclient_get_pool(uint64_t ptr, RustBuffer pool
+uint64_t uniffi_cyclops_sdk_fn_method_cyclopsclient_get_pool(uint64_t ptr, RustBuffer name
);
#endif
#ifndef UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_FN_METHOD_CYCLOPSCLIENT_LIST_POOLS
@@ -491,6 +506,11 @@ uint64_t uniffi_cyclops_sdk_fn_method_cyclopsclient_get_pool(uint64_t ptr, RustB
uint64_t uniffi_cyclops_sdk_fn_method_cyclopsclient_list_pools(uint64_t ptr, RustBuffer namespace
);
#endif
+#ifndef UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_FN_METHOD_CYCLOPSCLIENT_RECONCILE_POOL
+#define UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_FN_METHOD_CYCLOPSCLIENT_RECONCILE_POOL
+uint64_t uniffi_cyclops_sdk_fn_method_cyclopsclient_reconcile_pool(uint64_t ptr, RustBuffer request
+);
+#endif
#ifndef UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_FN_METHOD_CYCLOPSCLIENT_UPDATE_POOL
#define UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_FN_METHOD_CYCLOPSCLIENT_UPDATE_POOL
uint64_t uniffi_cyclops_sdk_fn_method_cyclopsclient_update_pool(uint64_t ptr, RustBuffer pool
@@ -501,6 +521,36 @@ uint64_t uniffi_cyclops_sdk_fn_method_cyclopsclient_update_pool(uint64_t ptr, Ru
uint64_t uniffi_cyclops_sdk_fn_method_cyclopsclient_service_request(uint64_t ptr, RustBuffer sandbox, RustBuffer service, RustBuffer path, RustBuffer request
);
#endif
+#ifndef UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_FN_METHOD_CYCLOPSCLIENT_CREATE_TEMPLATE
+#define UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_FN_METHOD_CYCLOPSCLIENT_CREATE_TEMPLATE
+uint64_t uniffi_cyclops_sdk_fn_method_cyclopsclient_create_template(uint64_t ptr, RustBuffer request
+);
+#endif
+#ifndef UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_FN_METHOD_CYCLOPSCLIENT_DELETE_TEMPLATE
+#define UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_FN_METHOD_CYCLOPSCLIENT_DELETE_TEMPLATE
+uint64_t uniffi_cyclops_sdk_fn_method_cyclopsclient_delete_template(uint64_t ptr, RustBuffer template
+);
+#endif
+#ifndef UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_FN_METHOD_CYCLOPSCLIENT_GET_TEMPLATE
+#define UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_FN_METHOD_CYCLOPSCLIENT_GET_TEMPLATE
+uint64_t uniffi_cyclops_sdk_fn_method_cyclopsclient_get_template(uint64_t ptr, RustBuffer namespace, RustBuffer name
+);
+#endif
+#ifndef UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_FN_METHOD_CYCLOPSCLIENT_LIST_TEMPLATES
+#define UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_FN_METHOD_CYCLOPSCLIENT_LIST_TEMPLATES
+uint64_t uniffi_cyclops_sdk_fn_method_cyclopsclient_list_templates(uint64_t ptr, RustBuffer namespace
+);
+#endif
+#ifndef UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_FN_METHOD_CYCLOPSCLIENT_RECONCILE_TEMPLATE
+#define UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_FN_METHOD_CYCLOPSCLIENT_RECONCILE_TEMPLATE
+uint64_t uniffi_cyclops_sdk_fn_method_cyclopsclient_reconcile_template(uint64_t ptr, RustBuffer request
+);
+#endif
+#ifndef UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_FN_METHOD_CYCLOPSCLIENT_UPDATE_TEMPLATE
+#define UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_FN_METHOD_CYCLOPSCLIENT_UPDATE_TEMPLATE
+uint64_t uniffi_cyclops_sdk_fn_method_cyclopsclient_update_template(uint64_t ptr, RustBuffer template
+);
+#endif
#ifndef UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_FN_CLONE_ACCESSTOKENPROVIDER
#define UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_FN_CLONE_ACCESSTOKENPROVIDER
uint64_t uniffi_cyclops_sdk_fn_clone_accesstokenprovider(uint64_t handle, RustCallStatus *out_status
@@ -819,115 +869,175 @@ void ffi_cyclops_sdk_rust_future_complete_void(uint64_t handle, RustCallStatus *
#ifndef UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_CHECKSUM_METHOD_CYCLOPSCLIENT_CREATE_CLAIM
#define UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_CHECKSUM_METHOD_CYCLOPSCLIENT_CREATE_CLAIM
uint16_t uniffi_cyclops_sdk_checksum_method_cyclopsclient_create_claim(void
-
+
);
#endif
#ifndef UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_CHECKSUM_METHOD_CYCLOPSCLIENT_DELETE_CLAIM
#define UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_CHECKSUM_METHOD_CYCLOPSCLIENT_DELETE_CLAIM
uint16_t uniffi_cyclops_sdk_checksum_method_cyclopsclient_delete_claim(void
-
+
);
#endif
#ifndef UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_CHECKSUM_METHOD_CYCLOPSCLIENT_GET_CLAIM
#define UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_CHECKSUM_METHOD_CYCLOPSCLIENT_GET_CLAIM
uint16_t uniffi_cyclops_sdk_checksum_method_cyclopsclient_get_claim(void
-
+
);
#endif
#ifndef UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_CHECKSUM_METHOD_CYCLOPSCLIENT_LIST_CLAIMS
#define UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_CHECKSUM_METHOD_CYCLOPSCLIENT_LIST_CLAIMS
uint16_t uniffi_cyclops_sdk_checksum_method_cyclopsclient_list_claims(void
-
+
);
#endif
#ifndef UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_CHECKSUM_METHOD_CYCLOPSCLIENT_WAIT_CLAIM
#define UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_CHECKSUM_METHOD_CYCLOPSCLIENT_WAIT_CLAIM
uint16_t uniffi_cyclops_sdk_checksum_method_cyclopsclient_wait_claim(void
-
+
);
#endif
#ifndef UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_CHECKSUM_METHOD_CYCLOPSCLIENT_CREATE_POOL
#define UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_CHECKSUM_METHOD_CYCLOPSCLIENT_CREATE_POOL
uint16_t uniffi_cyclops_sdk_checksum_method_cyclopsclient_create_pool(void
-
+
);
#endif
#ifndef UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_CHECKSUM_METHOD_CYCLOPSCLIENT_DELETE_POOL
#define UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_CHECKSUM_METHOD_CYCLOPSCLIENT_DELETE_POOL
uint16_t uniffi_cyclops_sdk_checksum_method_cyclopsclient_delete_pool(void
-
+
);
#endif
#ifndef UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_CHECKSUM_METHOD_CYCLOPSCLIENT_GET_POOL
#define UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_CHECKSUM_METHOD_CYCLOPSCLIENT_GET_POOL
uint16_t uniffi_cyclops_sdk_checksum_method_cyclopsclient_get_pool(void
-
+
);
#endif
#ifndef UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_CHECKSUM_METHOD_CYCLOPSCLIENT_LIST_POOLS
#define UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_CHECKSUM_METHOD_CYCLOPSCLIENT_LIST_POOLS
uint16_t uniffi_cyclops_sdk_checksum_method_cyclopsclient_list_pools(void
-
+
+);
+#endif
+#ifndef UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_CHECKSUM_METHOD_CYCLOPSCLIENT_RECONCILE_POOL
+#define UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_CHECKSUM_METHOD_CYCLOPSCLIENT_RECONCILE_POOL
+uint16_t uniffi_cyclops_sdk_checksum_method_cyclopsclient_reconcile_pool(void
+
);
#endif
#ifndef UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_CHECKSUM_METHOD_CYCLOPSCLIENT_UPDATE_POOL
#define UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_CHECKSUM_METHOD_CYCLOPSCLIENT_UPDATE_POOL
uint16_t uniffi_cyclops_sdk_checksum_method_cyclopsclient_update_pool(void
-
+
);
#endif
#ifndef UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_CHECKSUM_METHOD_CYCLOPSCLIENT_SERVICE_REQUEST
#define UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_CHECKSUM_METHOD_CYCLOPSCLIENT_SERVICE_REQUEST
uint16_t uniffi_cyclops_sdk_checksum_method_cyclopsclient_service_request(void
-
+
+);
+#endif
+#ifndef UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_CHECKSUM_METHOD_CYCLOPSCLIENT_CREATE_TEMPLATE
+#define UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_CHECKSUM_METHOD_CYCLOPSCLIENT_CREATE_TEMPLATE
+uint16_t uniffi_cyclops_sdk_checksum_method_cyclopsclient_create_template(void
+
+);
+#endif
+#ifndef UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_CHECKSUM_METHOD_CYCLOPSCLIENT_DELETE_TEMPLATE
+#define UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_CHECKSUM_METHOD_CYCLOPSCLIENT_DELETE_TEMPLATE
+uint16_t uniffi_cyclops_sdk_checksum_method_cyclopsclient_delete_template(void
+
+);
+#endif
+#ifndef UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_CHECKSUM_METHOD_CYCLOPSCLIENT_GET_TEMPLATE
+#define UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_CHECKSUM_METHOD_CYCLOPSCLIENT_GET_TEMPLATE
+uint16_t uniffi_cyclops_sdk_checksum_method_cyclopsclient_get_template(void
+
+);
+#endif
+#ifndef UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_CHECKSUM_METHOD_CYCLOPSCLIENT_LIST_TEMPLATES
+#define UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_CHECKSUM_METHOD_CYCLOPSCLIENT_LIST_TEMPLATES
+uint16_t uniffi_cyclops_sdk_checksum_method_cyclopsclient_list_templates(void
+
+);
+#endif
+#ifndef UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_CHECKSUM_METHOD_CYCLOPSCLIENT_RECONCILE_TEMPLATE
+#define UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_CHECKSUM_METHOD_CYCLOPSCLIENT_RECONCILE_TEMPLATE
+uint16_t uniffi_cyclops_sdk_checksum_method_cyclopsclient_reconcile_template(void
+
+);
+#endif
+#ifndef UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_CHECKSUM_METHOD_CYCLOPSCLIENT_UPDATE_TEMPLATE
+#define UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_CHECKSUM_METHOD_CYCLOPSCLIENT_UPDATE_TEMPLATE
+uint16_t uniffi_cyclops_sdk_checksum_method_cyclopsclient_update_template(void
+
);
#endif
#ifndef UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_CHECKSUM_METHOD_ACCESSTOKENPROVIDER_GET_ACCESS_TOKEN
#define UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_CHECKSUM_METHOD_ACCESSTOKENPROVIDER_GET_ACCESS_TOKEN
uint16_t uniffi_cyclops_sdk_checksum_method_accesstokenprovider_get_access_token(void
-
+
);
#endif
#ifndef UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_CHECKSUM_METHOD_HTTPCLIENT_EXECUTE
#define UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_CHECKSUM_METHOD_HTTPCLIENT_EXECUTE
uint16_t uniffi_cyclops_sdk_checksum_method_httpclient_execute(void
-
+
);
#endif
#ifndef UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_CHECKSUM_CONSTRUCTOR_CYCLOPSCLIENT_CONNECT
#define UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_CHECKSUM_CONSTRUCTOR_CYCLOPSCLIENT_CONNECT
uint16_t uniffi_cyclops_sdk_checksum_constructor_cyclopsclient_connect(void
-
+
);
#endif
#ifndef UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_CHECKSUM_CONSTRUCTOR_CYCLOPSCLIENT_CONNECT_BROWSER_WITH_ACCESS_TOKEN
#define UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_CHECKSUM_CONSTRUCTOR_CYCLOPSCLIENT_CONNECT_BROWSER_WITH_ACCESS_TOKEN
uint16_t uniffi_cyclops_sdk_checksum_constructor_cyclopsclient_connect_browser_with_access_token(void
-
+
);
#endif
#ifndef UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_CHECKSUM_CONSTRUCTOR_CYCLOPSCLIENT_CONNECT_WITH_ACCESS_TOKEN
#define UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_CHECKSUM_CONSTRUCTOR_CYCLOPSCLIENT_CONNECT_WITH_ACCESS_TOKEN
uint16_t uniffi_cyclops_sdk_checksum_constructor_cyclopsclient_connect_with_access_token(void
-
+
+);
+#endif
+#ifndef UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_CHECKSUM_CONSTRUCTOR_CYCLOPSCLIENT_CONNECT_WITH_ACCESS_TOKEN_AND_NATIVE_HTTP_CLIENT
+#define UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_CHECKSUM_CONSTRUCTOR_CYCLOPSCLIENT_CONNECT_WITH_ACCESS_TOKEN_AND_NATIVE_HTTP_CLIENT
+uint16_t uniffi_cyclops_sdk_checksum_constructor_cyclopsclient_connect_with_access_token_and_native_http_client(void
+
);
#endif
#ifndef UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_CHECKSUM_CONSTRUCTOR_CYCLOPSCLIENT_CONNECT_WITH_ACCESS_TOKEN_PROVIDER
#define UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_CHECKSUM_CONSTRUCTOR_CYCLOPSCLIENT_CONNECT_WITH_ACCESS_TOKEN_PROVIDER
uint16_t uniffi_cyclops_sdk_checksum_constructor_cyclopsclient_connect_with_access_token_provider(void
-
+
+);
+#endif
+#ifndef UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_CHECKSUM_CONSTRUCTOR_CYCLOPSCLIENT_CONNECT_WITH_ACCESS_TOKEN_PROVIDER_AND_NATIVE_HTTP_CLIENT
+#define UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_CHECKSUM_CONSTRUCTOR_CYCLOPSCLIENT_CONNECT_WITH_ACCESS_TOKEN_PROVIDER_AND_NATIVE_HTTP_CLIENT
+uint16_t uniffi_cyclops_sdk_checksum_constructor_cyclopsclient_connect_with_access_token_provider_and_native_http_client(void
+
+);
+#endif
+#ifndef UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_CHECKSUM_CONSTRUCTOR_CYCLOPSCLIENT_CONNECT_WITH_NATIVE_HTTP_CLIENT
+#define UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_CHECKSUM_CONSTRUCTOR_CYCLOPSCLIENT_CONNECT_WITH_NATIVE_HTTP_CLIENT
+uint16_t uniffi_cyclops_sdk_checksum_constructor_cyclopsclient_connect_with_native_http_client(void
+
);
#endif
#ifndef UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_CHECKSUM_CONSTRUCTOR_CYCLOPSCREDENTIALS_NEW
#define UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_CHECKSUM_CONSTRUCTOR_CYCLOPSCREDENTIALS_NEW
uint16_t uniffi_cyclops_sdk_checksum_constructor_cyclopscredentials_new(void
-
+
);
#endif
#ifndef UNIFFI_FFIDEF_FFI_CYCLOPS_SDK_UNIFFI_CONTRACT_VERSION
#define UNIFFI_FFIDEF_FFI_CYCLOPS_SDK_UNIFFI_CONTRACT_VERSION
uint32_t ffi_cyclops_sdk_uniffi_contract_version(void
-
+
);
#endif
@@ -938,5 +1048,5 @@ uint64_t cyclops_sdk_transport_cgo_dispatchCallbackInterfaceAccessTokenProviderC
void cyclops_sdk_transport_cgo_dispatchCallbackInterfaceHttpClientFree(uint64_t handle);
uint64_t cyclops_sdk_transport_cgo_dispatchCallbackInterfaceHttpClientClone(uint64_t handle);
-void cyclops_sdk_uniffiFutureContinuationCallback(uint64_t, int8_t);
-void cyclops_sdk_uniffiFreeGorutine(uint64_t);
+void fleet_sdk_uniffiFutureContinuationCallback(uint64_t, int8_t);
+void fleet_sdk_uniffiFreeGorutine(uint64_t);
diff --git a/libs/fleet/sdk-bindings/kotlin/ai/cua/cyclops/sdk/fleet_sdk.kt b/libs/fleet/sdk-bindings/kotlin/ai/cua/cyclops/sdk/fleet_sdk.kt
index 15983904db..55a995c753 100644
--- a/libs/fleet/sdk-bindings/kotlin/ai/cua/cyclops/sdk/fleet_sdk.kt
+++ b/libs/fleet/sdk-bindings/kotlin/ai/cua/cyclops/sdk/fleet_sdk.kt
@@ -33,11 +33,13 @@ import java.util.concurrent.ConcurrentHashMap
import ai.cua.cyclops.sdk.schema.ClaimSpec
import ai.cua.cyclops.sdk.schema.FfiConverterTypeClaimSpec
import ai.cua.cyclops.sdk.schema.FfiConverterTypeOSGymSandboxClaimStatus
-import ai.cua.cyclops.sdk.schema.FfiConverterTypeOSGymWorkspacePoolStatus
-import ai.cua.cyclops.sdk.schema.FfiConverterTypePoolSpec
+import ai.cua.cyclops.sdk.schema.FfiConverterTypeOSGymSandboxTemplateSpec
+import ai.cua.cyclops.sdk.schema.FfiConverterTypeOSGymSandboxWarmPoolSpec
+import ai.cua.cyclops.sdk.schema.FfiConverterTypeOSGymSandboxWarmPoolStatus
import ai.cua.cyclops.sdk.schema.OsGymSandboxClaimStatus
-import ai.cua.cyclops.sdk.schema.OsGymWorkspacePoolStatus
-import ai.cua.cyclops.sdk.schema.PoolSpec
+import ai.cua.cyclops.sdk.schema.OsGymSandboxTemplateSpec
+import ai.cua.cyclops.sdk.schema.OsGymSandboxWarmPoolSpec
+import ai.cua.cyclops.sdk.schema.OsGymSandboxWarmPoolStatus
import java.util.concurrent.atomic.AtomicBoolean
import kotlin.coroutines.resume
import kotlinx.coroutines.CancellableContinuation
@@ -48,8 +50,9 @@ import kotlinx.coroutines.launch
import kotlinx.coroutines.suspendCancellableCoroutine
import ai.cua.cyclops.sdk.schema.RustBuffer as RustBufferClaimSpec
import ai.cua.cyclops.sdk.schema.RustBuffer as RustBufferOSGymSandboxClaimStatus
-import ai.cua.cyclops.sdk.schema.RustBuffer as RustBufferOSGymWorkspacePoolStatus
-import ai.cua.cyclops.sdk.schema.RustBuffer as RustBufferPoolSpec
+import ai.cua.cyclops.sdk.schema.RustBuffer as RustBufferOSGymSandboxTemplateSpec
+import ai.cua.cyclops.sdk.schema.RustBuffer as RustBufferOSGymSandboxWarmPoolSpec
+import ai.cua.cyclops.sdk.schema.RustBuffer as RustBufferOSGymSandboxWarmPoolStatus
// This is a helper for safely working with byte buffers returned from the Rust code.
// A rust-owned buffer is represented by its capacity, its current length, and a
@@ -723,6 +726,18 @@ internal object IntegrityCheckingUniffiLib {
): Short
external fun uniffi_cyclops_sdk_checksum_method_cyclopsclient_service_request(
): Short
+ external fun uniffi_cyclops_sdk_checksum_method_cyclopsclient_create_template(
+ ): Short
+ external fun uniffi_cyclops_sdk_checksum_method_cyclopsclient_delete_template(
+ ): Short
+ external fun uniffi_cyclops_sdk_checksum_method_cyclopsclient_get_template(
+ ): Short
+ external fun uniffi_cyclops_sdk_checksum_method_cyclopsclient_list_templates(
+ ): Short
+ external fun uniffi_cyclops_sdk_checksum_method_cyclopsclient_reconcile_template(
+ ): Short
+ external fun uniffi_cyclops_sdk_checksum_method_cyclopsclient_update_template(
+ ): Short
external fun uniffi_cyclops_sdk_checksum_method_accesstokenprovider_get_access_token(
): Short
external fun uniffi_cyclops_sdk_checksum_method_httpclient_execute(
@@ -806,6 +821,18 @@ external fun uniffi_cyclops_sdk_fn_method_cyclopsclient_update_pool(`ptr`: Long,
): Long
external fun uniffi_cyclops_sdk_fn_method_cyclopsclient_service_request(`ptr`: Long,`sandbox`: RustBuffer.ByValue,`service`: RustBuffer.ByValue,`path`: RustBuffer.ByValue,`request`: RustBuffer.ByValue,
): Long
+external fun uniffi_cyclops_sdk_fn_method_cyclopsclient_create_template(`ptr`: Long,`request`: RustBuffer.ByValue,
+): Long
+external fun uniffi_cyclops_sdk_fn_method_cyclopsclient_delete_template(`ptr`: Long,`template`: RustBuffer.ByValue,
+): Long
+external fun uniffi_cyclops_sdk_fn_method_cyclopsclient_get_template(`ptr`: Long,`namespace`: RustBuffer.ByValue,`name`: RustBuffer.ByValue,
+): Long
+external fun uniffi_cyclops_sdk_fn_method_cyclopsclient_list_templates(`ptr`: Long,`namespace`: RustBuffer.ByValue,
+): Long
+external fun uniffi_cyclops_sdk_fn_method_cyclopsclient_reconcile_template(`ptr`: Long,`request`: RustBuffer.ByValue,
+): Long
+external fun uniffi_cyclops_sdk_fn_method_cyclopsclient_update_template(`ptr`: Long,`template`: RustBuffer.ByValue,
+): Long
external fun uniffi_cyclops_sdk_fn_clone_accesstokenprovider(`handle`: Long,uniffi_out_err: UniffiRustCallStatus,
): Long
external fun uniffi_cyclops_sdk_fn_free_accesstokenprovider(`handle`: Long,uniffi_out_err: UniffiRustCallStatus,
@@ -983,6 +1010,24 @@ private fun uniffiCheckApiChecksums(lib: IntegrityCheckingUniffiLib) {
if (lib.uniffi_cyclops_sdk_checksum_method_cyclopsclient_service_request() != 46699.toShort()) {
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
}
+ if (lib.uniffi_cyclops_sdk_checksum_method_cyclopsclient_create_template() != 13689.toShort()) {
+ throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
+ }
+ if (lib.uniffi_cyclops_sdk_checksum_method_cyclopsclient_delete_template() != 54852.toShort()) {
+ throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
+ }
+ if (lib.uniffi_cyclops_sdk_checksum_method_cyclopsclient_get_template() != 8909.toShort()) {
+ throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
+ }
+ if (lib.uniffi_cyclops_sdk_checksum_method_cyclopsclient_list_templates() != 58376.toShort()) {
+ throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
+ }
+ if (lib.uniffi_cyclops_sdk_checksum_method_cyclopsclient_reconcile_template() != 36469.toShort()) {
+ throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
+ }
+ if (lib.uniffi_cyclops_sdk_checksum_method_cyclopsclient_update_template() != 18704.toShort()) {
+ throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
+ }
if (lib.uniffi_cyclops_sdk_checksum_method_accesstokenprovider_get_access_token() != 1180.toShort()) {
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
}
@@ -1956,6 +2001,18 @@ public interface CyclopsClientInterface {
suspend fun `serviceRequest`(`sandbox`: Sandbox, `service`: kotlin.String, `path`: kotlin.String, `request`: HttpRequest): HttpResponse
+ suspend fun `createTemplate`(`request`: CreateTemplateRequest): Template
+
+ suspend fun `deleteTemplate`(`template`: Template)
+
+ suspend fun `getTemplate`(`namespace`: kotlin.String, `name`: kotlin.String): Template
+
+ suspend fun `listTemplates`(`namespace`: kotlin.String): List<Template>
+
+ suspend fun `reconcileTemplate`(`request`: CreateTemplateRequest): Template
+
+ suspend fun `updateTemplate`(`template`: Template): Template
+
companion object
}
@@ -2310,6 +2367,133 @@ open class CyclopsClient: Disposable, AutoCloseable, CyclopsClientInterface
}
+ @Throws(SdkException::class)
+ @Suppress("ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE")
+ override suspend fun `createTemplate`(`request`: CreateTemplateRequest) : Template {
+ return uniffiRustCallAsync(
+ callWithHandle { uniffiHandle ->
+ UniffiLib.uniffi_cyclops_sdk_fn_method_cyclopsclient_create_template(
+ uniffiHandle,
+ FfiConverterTypeCreateTemplateRequest.lower(`request`),
+ )
+ },
+ { future, callback, continuation -> UniffiLib.ffi_cyclops_sdk_rust_future_poll_rust_buffer(future, callback, continuation) },
+ { future, continuation -> UniffiLib.ffi_cyclops_sdk_rust_future_complete_rust_buffer(future, continuation) },
+ { future -> UniffiLib.ffi_cyclops_sdk_rust_future_free_rust_buffer(future) },
+ // lift function
+ { FfiConverterTypeTemplate.lift(it) },
+ // Error FFI converter
+ SdkException.ErrorHandler,
+ )
+ }
+
+
+ @Throws(SdkException::class)
+ @Suppress("ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE")
+ override suspend fun `deleteTemplate`(`template`: Template) {
+ return uniffiRustCallAsync(
+ callWithHandle { uniffiHandle ->
+ UniffiLib.uniffi_cyclops_sdk_fn_method_cyclopsclient_delete_template(
+ uniffiHandle,
+ FfiConverterTypeTemplate.lower(`template`),
+ )
+ },
+ { future, callback, continuation -> UniffiLib.ffi_cyclops_sdk_rust_future_poll_void(future, callback, continuation) },
+ { future, continuation -> UniffiLib.ffi_cyclops_sdk_rust_future_complete_void(future, continuation) },
+ { future -> UniffiLib.ffi_cyclops_sdk_rust_future_free_void(future) },
+ // lift function
+ { Unit },
+
+ // Error FFI converter
+ SdkException.ErrorHandler,
+ )
+ }
+
+
+ @Throws(SdkException::class)
+ @Suppress("ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE")
+ override suspend fun `getTemplate`(`namespace`: kotlin.String, `name`: kotlin.String) : Template {
+ return uniffiRustCallAsync(
+ callWithHandle { uniffiHandle ->
+ UniffiLib.uniffi_cyclops_sdk_fn_method_cyclopsclient_get_template(
+ uniffiHandle,
+ FfiConverterString.lower(`namespace`),FfiConverterString.lower(`name`),
+ )
+ },
+ { future, callback, continuation -> UniffiLib.ffi_cyclops_sdk_rust_future_poll_rust_buffer(future, callback, continuation) },
+ { future, continuation -> UniffiLib.ffi_cyclops_sdk_rust_future_complete_rust_buffer(future, continuation) },
+ { future -> UniffiLib.ffi_cyclops_sdk_rust_future_free_rust_buffer(future) },
+ // lift function
+ { FfiConverterTypeTemplate.lift(it) },
+ // Error FFI converter
+ SdkException.ErrorHandler,
+ )
+ }
+
+
+ @Throws(SdkException::class)
+ @Suppress("ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE")
+ override suspend fun `listTemplates`(`namespace`: kotlin.String) : List<Template> {
+ return uniffiRustCallAsync(
+ callWithHandle { uniffiHandle ->
+ UniffiLib.uniffi_cyclops_sdk_fn_method_cyclopsclient_list_templates(
+ uniffiHandle,
+ FfiConverterString.lower(`namespace`),
+ )
+ },
+ { future, callback, continuation -> UniffiLib.ffi_cyclops_sdk_rust_future_poll_rust_buffer(future, callback, continuation) },
+ { future, continuation -> UniffiLib.ffi_cyclops_sdk_rust_future_complete_rust_buffer(future, continuation) },
+ { future -> UniffiLib.ffi_cyclops_sdk_rust_future_free_rust_buffer(future) },
+ // lift function
+ { FfiConverterSequenceTypeTemplate.lift(it) },
+ // Error FFI converter
+ SdkException.ErrorHandler,
+ )
+ }
+
+
+ @Throws(SdkException::class)
+ @Suppress("ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE")
+ override suspend fun `reconcileTemplate`(`request`: CreateTemplateRequest) : Template {
+ return uniffiRustCallAsync(
+ callWithHandle { uniffiHandle ->
+ UniffiLib.uniffi_cyclops_sdk_fn_method_cyclopsclient_reconcile_template(
+ uniffiHandle,
+ FfiConverterTypeCreateTemplateRequest.lower(`request`),
+ )
+ },
+ { future, callback, continuation -> UniffiLib.ffi_cyclops_sdk_rust_future_poll_rust_buffer(future, callback, continuation) },
+ { future, continuation -> UniffiLib.ffi_cyclops_sdk_rust_future_complete_rust_buffer(future, continuation) },
+ { future -> UniffiLib.ffi_cyclops_sdk_rust_future_free_rust_buffer(future) },
+ // lift function
+ { FfiConverterTypeTemplate.lift(it) },
+ // Error FFI converter
+ SdkException.ErrorHandler,
+ )
+ }
+
+
+ @Throws(SdkException::class)
+ @Suppress("ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE")
+ override suspend fun `updateTemplate`(`template`: Template) : Template {
+ return uniffiRustCallAsync(
+ callWithHandle { uniffiHandle ->
+ UniffiLib.uniffi_cyclops_sdk_fn_method_cyclopsclient_update_template(
+ uniffiHandle,
+ FfiConverterTypeTemplate.lower(`template`),
+ )
+ },
+ { future, callback, continuation -> UniffiLib.ffi_cyclops_sdk_rust_future_poll_rust_buffer(future, callback, continuation) },
+ { future, continuation -> UniffiLib.ffi_cyclops_sdk_rust_future_complete_rust_buffer(future, continuation) },
+ { future -> UniffiLib.ffi_cyclops_sdk_rust_future_free_rust_buffer(future) },
+ // lift function
+ { FfiConverterTypeTemplate.lift(it) },
+ // Error FFI converter
+ SdkException.ErrorHandler,
+ )
+ }
+
+
@@ -3104,7 +3288,7 @@ public object FfiConverterTypeCreateClaimRequest: FfiConverterRustBuffer<CreateC
data class CreatePoolRequest (
var `namespace`: kotlin.String
,
- var `spec`: PoolSpec
+ var `spec`: OsGymSandboxWarmPoolSpec
){
@@ -3122,18 +3306,61 @@ public object FfiConverterTypeCreatePoolRequest: FfiConverterRustBuffer<CreatePo
override fun read(buf: ByteBuffer): CreatePoolRequest {
return CreatePoolRequest(
FfiConverterString.read(buf),
- FfiConverterTypePoolSpec.read(buf),
+ FfiConverterTypeOSGymSandboxWarmPoolSpec.read(buf),
)
}
override fun allocationSize(value: CreatePoolRequest) = (
FfiConverterString.allocationSize(value.`namespace`) +
- FfiConverterTypePoolSpec.allocationSize(value.`spec`)
+ FfiConverterTypeOSGymSandboxWarmPoolSpec.allocationSize(value.`spec`)
)
override fun write(value: CreatePoolRequest, buf: ByteBuffer) {
FfiConverterString.write(value.`namespace`, buf)
- FfiConverterTypePoolSpec.write(value.`spec`, buf)
+ FfiConverterTypeOSGymSandboxWarmPoolSpec.write(value.`spec`, buf)
+ }
+}
+
+
+
+data class CreateTemplateRequest (
+ var `namespace`: kotlin.String
+ ,
+ var `name`: kotlin.String
+ ,
+ var `spec`: OsGymSandboxTemplateSpec
+
+){
+
+
+
+
+
+ companion object
+}
+
+/**
+ * @suppress
+ */
+public object FfiConverterTypeCreateTemplateRequest: FfiConverterRustBuffer<CreateTemplateRequest> {
+ override fun read(buf: ByteBuffer): CreateTemplateRequest {
+ return CreateTemplateRequest(
+ FfiConverterString.read(buf),
+ FfiConverterString.read(buf),
+ FfiConverterTypeOSGymSandboxTemplateSpec.read(buf),
+ )
+ }
+
+ override fun allocationSize(value: CreateTemplateRequest) = (
+ FfiConverterString.allocationSize(value.`namespace`) +
+ FfiConverterString.allocationSize(value.`name`) +
+ FfiConverterTypeOSGymSandboxTemplateSpec.allocationSize(value.`spec`)
+ )
+
+ override fun write(value: CreateTemplateRequest, buf: ByteBuffer) {
+ FfiConverterString.write(value.`namespace`, buf)
+ FfiConverterString.write(value.`name`, buf)
+ FfiConverterTypeOSGymSandboxTemplateSpec.write(value.`spec`, buf)
}
}
@@ -3400,7 +3627,12 @@ public object FfiConverterTypeHttpResponse: FfiConverterRustBuffer<HttpResponse>
/**
* UniFFI cannot emit aliases for external record types. Generated bindings use
- * `OSGymWorkspacePoolStatus` and `OSGymSandboxClaimStatus` from cyclops_sdk_schema.
+ * `OSGymSandboxWarmPoolStatus` and `OSGymSandboxClaimStatus` from cyclops_sdk_schema.
+ *
+ * A `Pool` is the `osgym.cua.ai/v1alpha1 OSGymSandboxWarmPool` CR verbatim —
+ * the SDK is a naive CRUD mapper over the native CRDs, with no translation
+ * layer (the legacy `cua.ai/v1 OSGymWorkspacePool` and its operator compat
+ * shim are gone).
*/
data class Pool (
var `apiVersion`: kotlin.String
@@ -3409,9 +3641,9 @@ data class Pool (
,
var `metadata`: ResourceMetadata
,
- var `spec`: PoolSpec
+ var `spec`: OsGymSandboxWarmPoolSpec
,
- var `status`: OsGymWorkspacePoolStatus?
+ var `status`: OsGymSandboxWarmPoolStatus?
){
@@ -3431,8 +3663,8 @@ public object FfiConverterTypePool: FfiConverterRustBuffer<Pool> {
FfiConverterString.read(buf),
FfiConverterString.read(buf),
FfiConverterTypeResourceMetadata.read(buf),
- FfiConverterTypePoolSpec.read(buf),
- FfiConverterOptionalTypeOSGymWorkspacePoolStatus.read(buf),
+ FfiConverterTypeOSGymSandboxWarmPoolSpec.read(buf),
+ FfiConverterOptionalTypeOSGymSandboxWarmPoolStatus.read(buf),
)
}
@@ -3440,16 +3672,16 @@ public object FfiConverterTypePool: FfiConverterRustBuffer<Pool> {
FfiConverterString.allocationSize(value.`apiVersion`) +
FfiConverterString.allocationSize(value.`kind`) +
FfiConverterTypeResourceMetadata.allocationSize(value.`metadata`) +
- FfiConverterTypePoolSpec.allocationSize(value.`spec`) +
- FfiConverterOptionalTypeOSGymWorkspacePoolStatus.allocationSize(value.`status`)
+ FfiConverterTypeOSGymSandboxWarmPoolSpec.allocationSize(value.`spec`) +
+ FfiConverterOptionalTypeOSGymSandboxWarmPoolStatus.allocationSize(value.`status`)
)
override fun write(value: Pool, buf: ByteBuffer) {
FfiConverterString.write(value.`apiVersion`, buf)
FfiConverterString.write(value.`kind`, buf)
FfiConverterTypeResourceMetadata.write(value.`metadata`, buf)
- FfiConverterTypePoolSpec.write(value.`spec`, buf)
- FfiConverterOptionalTypeOSGymWorkspacePoolStatus.write(value.`status`, buf)
+ FfiConverterTypeOSGymSandboxWarmPoolSpec.write(value.`spec`, buf)
+ FfiConverterOptionalTypeOSGymSandboxWarmPoolStatus.write(value.`status`, buf)
}
}
@@ -3546,6 +3778,58 @@ public object FfiConverterTypeSandbox: FfiConverterRustBuffer<Sandbox> {
+/**
+ * The `osgym.cua.ai/v1alpha1 OSGymSandboxTemplate` CR verbatim. Warm pools
+ * and claims reference one by name via `spec.sandboxTemplateRef.name`.
+ */
+data class Template (
+ var `apiVersion`: kotlin.String
+ ,
+ var `kind`: kotlin.String
+ ,
+ var `metadata`: ResourceMetadata
+ ,
+ var `spec`: OsGymSandboxTemplateSpec
+
+){
+
+
+
+
+
+ companion object
+}
+
+/**
+ * @suppress
+ */
+public object FfiConverterTypeTemplate: FfiConverterRustBuffer<Template> {
+ override fun read(buf: ByteBuffer): Template {
+ return Template(
+ FfiConverterString.read(buf),
+ FfiConverterString.read(buf),
+ FfiConverterTypeResourceMetadata.read(buf),
+ FfiConverterTypeOSGymSandboxTemplateSpec.read(buf),
+ )
+ }
+
+ override fun allocationSize(value: Template) = (
+ FfiConverterString.allocationSize(value.`apiVersion`) +
+ FfiConverterString.allocationSize(value.`kind`) +
+ FfiConverterTypeResourceMetadata.allocationSize(value.`metadata`) +
+ FfiConverterTypeOSGymSandboxTemplateSpec.allocationSize(value.`spec`)
+ )
+
+ override fun write(value: Template, buf: ByteBuffer) {
+ FfiConverterString.write(value.`apiVersion`, buf)
+ FfiConverterString.write(value.`kind`, buf)
+ FfiConverterTypeResourceMetadata.write(value.`metadata`, buf)
+ FfiConverterTypeOSGymSandboxTemplateSpec.write(value.`spec`, buf)
+ }
+}
+
+
+
sealed class AccessTokenProviderException: kotlin.Exception() {
@@ -4045,28 +4329,28 @@ public object FfiConverterOptionalTypeOSGymSandboxClaimStatus: FfiConverterRustB
/**
* @suppress
*/
-public object FfiConverterOptionalTypeOSGymWorkspacePoolStatus: FfiConverterRustBuffer<OsGymWorkspacePoolStatus?> {
- override fun read(buf: ByteBuffer): OsGymWorkspacePoolStatus? {
+public object FfiConverterOptionalTypeOSGymSandboxWarmPoolStatus: FfiConverterRustBuffer<OsGymSandboxWarmPoolStatus?> {
+ override fun read(buf: ByteBuffer): OsGymSandboxWarmPoolStatus? {
if (buf.get().toInt() == 0) {
return null
}
- return FfiConverterTypeOSGymWorkspacePoolStatus.read(buf)
+ return FfiConverterTypeOSGymSandboxWarmPoolStatus.read(buf)
}
- override fun allocationSize(value: OsGymWorkspacePoolStatus?): ULong {
+ override fun allocationSize(value: OsGymSandboxWarmPoolStatus?): ULong {
if (value == null) {
return 1UL
} else {
- return 1UL + FfiConverterTypeOSGymWorkspacePoolStatus.allocationSize(value)
+ return 1UL + FfiConverterTypeOSGymSandboxWarmPoolStatus.allocationSize(value)
}
}
- override fun write(value: OsGymWorkspacePoolStatus?, buf: ByteBuffer) {
+ override fun write(value: OsGymSandboxWarmPoolStatus?, buf: ByteBuffer) {
if (value == null) {
buf.put(0)
} else {
buf.put(1)
- FfiConverterTypeOSGymWorkspacePoolStatus.write(value, buf)
+ FfiConverterTypeOSGymSandboxWarmPoolStatus.write(value, buf)
}
}
}
@@ -4218,6 +4502,34 @@ public object FfiConverterSequenceTypePool: FfiConverterRustBuffer<List<Pool>> {
+/**
+ * @suppress
+ */
+public object FfiConverterSequenceTypeTemplate: FfiConverterRustBuffer<List<Template>> {
+ override fun read(buf: ByteBuffer): List<Template> {
+ val len = buf.getInt()
+ return List<Template>(len) {
+ FfiConverterTypeTemplate.read(buf)
+ }
+ }
+
+ override fun allocationSize(value: List<Template>): ULong {
+ val sizeForLength = 4UL
+ val sizeForItems = value.map { FfiConverterTypeTemplate.allocationSize(it) }.sum()
+ return sizeForLength + sizeForItems
+ }
+
+ override fun write(value: List<Template>, buf: ByteBuffer) {
+ buf.putInt(value.size)
+ value.iterator().forEach {
+ FfiConverterTypeTemplate.write(it, buf)
+ }
+ }
+}
+
+
+
+
/**
* @suppress
*/
diff --git a/libs/fleet/sdk-bindings/kotlin/ai/cua/cyclops/sdk/schema/cyclops_sdk_schema.kt b/libs/fleet/sdk-bindings/kotlin/ai/cua/cyclops/sdk/schema/cyclops_sdk_schema.kt
index ca6d9139cc..1e663be1de 100644
--- a/libs/fleet/sdk-bindings/kotlin/ai/cua/cyclops/sdk/schema/cyclops_sdk_schema.kt
+++ b/libs/fleet/sdk-bindings/kotlin/ai/cua/cyclops/sdk/schema/cyclops_sdk_schema.kt
@@ -666,12 +666,6 @@ internal object UniffiLib {
): Long
external fun uniffi_cyclops_sdk_schema_fn_method_preservedjson_to_json(`ptr`: Long,uniffi_out_err: UniffiRustCallStatus,
): RustBuffer.ByValue
- external fun uniffi_cyclops_sdk_schema_fn_method_poolspec_uniffi_trait_eq_eq(`ptr`: RustBuffer.ByValue,`other`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus,
- ): Byte
- external fun uniffi_cyclops_sdk_schema_fn_method_poolspec_uniffi_trait_eq_ne(`ptr`: RustBuffer.ByValue,`other`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus,
- ): Byte
- external fun uniffi_cyclops_sdk_schema_fn_method_poolspec_uniffi_trait_hash(`ptr`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus,
- ): Long
external fun ffi_cyclops_sdk_schema_rustbuffer_alloc(`size`: Long,uniffi_out_err: UniffiRustCallStatus,
): RustBuffer.ByValue
external fun ffi_cyclops_sdk_schema_rustbuffer_from_bytes(`bytes`: ForeignBytes.ByValue,uniffi_out_err: UniffiRustCallStatus,
@@ -1000,29 +994,6 @@ public object FfiConverterUInt: FfiConverter<UInt, Int> {
}
}
-/**
- * @suppress
- */
-public object FfiConverterULong: FfiConverter<ULong, Long> {
- override fun lift(value: Long): ULong {
- return value.toULong()
- }
-
- override fun read(buf: ByteBuffer): ULong {
- return lift(buf.getLong())
- }
-
- override fun lower(value: ULong): Long {
- return value.toLong()
- }
-
- override fun allocationSize(value: ULong) = 8UL
-
- override fun write(value: ULong, buf: ByteBuffer) {
- buf.putLong(value.toLong())
- }
-}
-
/**
* @suppress
*/
@@ -1826,54 +1797,6 @@ public object FfiConverterTypeOSGymSandboxWarmPoolStatus: FfiConverterRustBuffer
-data class OsGymWorkspacePoolStatus (
- var `phase`: kotlin.String?
- ,
- var `totalCount`: kotlin.UInt?
- ,
- var `availableCount`: kotlin.UInt?
- ,
- var `claimedCount`: kotlin.UInt?
-
-){
-
-
-
-
-
- companion object
-}
-
-/**
- * @suppress
- */
-public object FfiConverterTypeOSGymWorkspacePoolStatus: FfiConverterRustBuffer<OsGymWorkspacePoolStatus> {
- override fun read(buf: ByteBuffer): OsGymWorkspacePoolStatus {
- return OsGymWorkspacePoolStatus(
- FfiConverterOptionalString.read(buf),
- FfiConverterOptionalUInt.read(buf),
- FfiConverterOptionalUInt.read(buf),
- FfiConverterOptionalUInt.read(buf),
- )
- }
-
- override fun allocationSize(value: OsGymWorkspacePoolStatus) = (
- FfiConverterOptionalString.allocationSize(value.`phase`) +
- FfiConverterOptionalUInt.allocationSize(value.`totalCount`) +
- FfiConverterOptionalUInt.allocationSize(value.`availableCount`) +
- FfiConverterOptionalUInt.allocationSize(value.`claimedCount`)
- )
-
- override fun write(value: OsGymWorkspacePoolStatus, buf: ByteBuffer) {
- FfiConverterOptionalString.write(value.`phase`, buf)
- FfiConverterOptionalUInt.write(value.`totalCount`, buf)
- FfiConverterOptionalUInt.write(value.`availableCount`, buf)
- FfiConverterOptionalUInt.write(value.`claimedCount`, buf)
- }
-}
-
-
-
data class OidcConfig (
var `credentialsSecret`: kotlin.String
,
@@ -1927,191 +1850,6 @@ public object FfiConverterTypeOidcConfig: FfiConverterRustBuffer<OidcConfig> {
-data class PoolSpec (
- var `replicas`: kotlin.UInt
- ,
- var `template`: PoolTemplate
- ,
- var `autoscaling`: WarmPoolAutoscaling?
- ,
- var `services`: List<SandboxService>?
-
-): Disposable{
-
-
-
-
- // The local Rust `Eq` implementation - only `eq` is used.
- override fun equals(other: Any?): Boolean {
- if (other !is PoolSpec) return false
- return FfiConverterBoolean.lift(
- uniffiRustCall() { _status ->
- UniffiLib.uniffi_cyclops_sdk_schema_fn_method_poolspec_uniffi_trait_eq_eq(FfiConverterTypePoolSpec.lower(this),
- FfiConverterTypePoolSpec.lower(`other`),_status)
-}
- )
- }
- // The local Rust `Hash` implementation
- override fun hashCode(): Int {
- return FfiConverterULong.lift(
- uniffiRustCall() { _status ->
- UniffiLib.uniffi_cyclops_sdk_schema_fn_method_poolspec_uniffi_trait_hash(FfiConverterTypePoolSpec.lower(this),
- _status)
-}
- ).toInt()
- }
-
- @Suppress("UNNECESSARY_SAFE_CALL") // codegen is much simpler if we unconditionally emit safe calls here
- override fun destroy() {
-
- Disposable.destroy(
- this.`replicas`,
- this.`template`,
- this.`autoscaling`,
- this.`services`
- )
- }
-
- companion object
-}
-
-/**
- * @suppress
- */
-public object FfiConverterTypePoolSpec: FfiConverterRustBuffer<PoolSpec> {
- override fun read(buf: ByteBuffer): PoolSpec {
- return PoolSpec(
- FfiConverterUInt.read(buf),
- FfiConverterTypePoolTemplate.read(buf),
- FfiConverterOptionalTypeWarmPoolAutoscaling.read(buf),
- FfiConverterOptionalSequenceTypeSandboxService.read(buf),
- )
- }
-
- override fun allocationSize(value: PoolSpec) = (
- FfiConverterUInt.allocationSize(value.`replicas`) +
- FfiConverterTypePoolTemplate.allocationSize(value.`template`) +
- FfiConverterOptionalTypeWarmPoolAutoscaling.allocationSize(value.`autoscaling`) +
- FfiConverterOptionalSequenceTypeSandboxService.allocationSize(value.`services`)
- )
-
- override fun write(value: PoolSpec, buf: ByteBuffer) {
- FfiConverterUInt.write(value.`replicas`, buf)
- FfiConverterTypePoolTemplate.write(value.`template`, buf)
- FfiConverterOptionalTypeWarmPoolAutoscaling.write(value.`autoscaling`, buf)
- FfiConverterOptionalSequenceTypeSandboxService.write(value.`services`, buf)
- }
-}
-
-
-
-data class PoolTemplate (
- var `runtime`: RuntimeKind?
- ,
- var `runtimeClassName`: kotlin.String?
- ,
- var `nodeSelector`: Map<kotlin.String, kotlin.String>?
- ,
- var `tolerations`: List<PreservedJson>?
- ,
- var `command`: List<kotlin.String>?
- ,
- var `containerDiskImage`: kotlin.String
- ,
- var `imagePullSecret`: kotlin.String?
- ,
- var `cpuCores`: kotlin.UInt?
- ,
- var `memory`: kotlin.String?
- ,
- var `firmware`: Firmware?
- ,
- var `probes`: PreservedJson?
- ,
- var `oidc`: OidcConfig?
-
-): Disposable{
-
-
-
-
-
- @Suppress("UNNECESSARY_SAFE_CALL") // codegen is much simpler if we unconditionally emit safe calls here
- override fun destroy() {
-
- Disposable.destroy(
- this.`runtime`,
- this.`runtimeClassName`,
- this.`nodeSelector`,
- this.`tolerations`,
- this.`command`,
- this.`containerDiskImage`,
- this.`imagePullSecret`,
- this.`cpuCores`,
- this.`memory`,
- this.`firmware`,
- this.`probes`,
- this.`oidc`
- )
- }
-
- companion object
-}
-
-/**
- * @suppress
- */
-public object FfiConverterTypePoolTemplate: FfiConverterRustBuffer<PoolTemplate> {
- override fun read(buf: ByteBuffer): PoolTemplate {
- return PoolTemplate(
- FfiConverterOptionalTypeRuntimeKind.read(buf),
- FfiConverterOptionalString.read(buf),
- FfiConverterOptionalMapStringString.read(buf),
- FfiConverterOptionalSequenceTypePreservedJson.read(buf),
- FfiConverterOptionalSequenceString.read(buf),
- FfiConverterString.read(buf),
- FfiConverterOptionalString.read(buf),
- FfiConverterOptionalUInt.read(buf),
- FfiConverterOptionalString.read(buf),
- FfiConverterOptionalTypeFirmware.read(buf),
- FfiConverterOptionalTypePreservedJson.read(buf),
- FfiConverterOptionalTypeOidcConfig.read(buf),
- )
- }
-
- override fun allocationSize(value: PoolTemplate) = (
- FfiConverterOptionalTypeRuntimeKind.allocationSize(value.`runtime`) +
- FfiConverterOptionalString.allocationSize(value.`runtimeClassName`) +
- FfiConverterOptionalMapStringString.allocationSize(value.`nodeSelector`) +
- FfiConverterOptionalSequenceTypePreservedJson.allocationSize(value.`tolerations`) +
- FfiConverterOptionalSequenceString.allocationSize(value.`command`) +
- FfiConverterString.allocationSize(value.`containerDiskImage`) +
- FfiConverterOptionalString.allocationSize(value.`imagePullSecret`) +
- FfiConverterOptionalUInt.allocationSize(value.`cpuCores`) +
- FfiConverterOptionalString.allocationSize(value.`memory`) +
- FfiConverterOptionalTypeFirmware.allocationSize(value.`firmware`) +
- FfiConverterOptionalTypePreservedJson.allocationSize(value.`probes`) +
- FfiConverterOptionalTypeOidcConfig.allocationSize(value.`oidc`)
- )
-
- override fun write(value: PoolTemplate, buf: ByteBuffer) {
- FfiConverterOptionalTypeRuntimeKind.write(value.`runtime`, buf)
- FfiConverterOptionalString.write(value.`runtimeClassName`, buf)
- FfiConverterOptionalMapStringString.write(value.`nodeSelector`, buf)
- FfiConverterOptionalSequenceTypePreservedJson.write(value.`tolerations`, buf)
- FfiConverterOptionalSequenceString.write(value.`command`, buf)
- FfiConverterString.write(value.`containerDiskImage`, buf)
- FfiConverterOptionalString.write(value.`imagePullSecret`, buf)
- FfiConverterOptionalUInt.write(value.`cpuCores`, buf)
- FfiConverterOptionalString.write(value.`memory`, buf)
- FfiConverterOptionalTypeFirmware.write(value.`firmware`, buf)
- FfiConverterOptionalTypePreservedJson.write(value.`probes`, buf)
- FfiConverterOptionalTypeOidcConfig.write(value.`oidc`, buf)
- }
-}
-
-
-
data class SandboxService (
var `name`: kotlin.String
,
diff --git a/libs/fleet/sdk-bindings/kotlin/tests/TestAsyncClient.kt b/libs/fleet/sdk-bindings/kotlin/tests/TestAsyncClient.kt
index 0e0287ee55..8af0ddbfe0 100644
--- a/libs/fleet/sdk-bindings/kotlin/tests/TestAsyncClient.kt
+++ b/libs/fleet/sdk-bindings/kotlin/tests/TestAsyncClient.kt
@@ -50,13 +50,13 @@ private fun serviceExpected(body: ByteArray?, response: ByteArray) = Expected(
private fun lifecycleQueue() = listOf(
tokenExpected(),
textExpected("POST", "https://cyclops.invalid/api/namespaces", jsonHeaders, "{\"name\":\"default\"}".encodeToByteArray(), 201u, "{}"),
- textExpected("POST", "https://cyclops.invalid/api/k8s/apis/cua.ai/v1/namespaces/default/osgymworkspacepools", jsonHeaders, "{\"apiVersion\":\"cua.ai/v1\",\"kind\":\"OSGymWorkspacePool\",\"metadata\":{\"namespace\":\"default\",\"name\":\"default\",\"labels\":null},\"spec\":{\"replicas\":1,\"template\":{\"containerDiskImage\":\"registry.example/desktop:offline\"},\"services\":[{\"name\":\"mcp\",\"targetPort\":8080}]},\"status\":null}".encodeToByteArray(), 201u, "{\"apiVersion\":\"cua.ai/v1\",\"kind\":\"OSGymWorkspacePool\",\"metadata\":{\"namespace\":\"default\",\"name\":\"default\",\"labels\":null},\"spec\":{\"replicas\":1,\"template\":{\"containerDiskImage\":\"registry.example/desktop:offline\"},\"services\":[{\"name\":\"mcp\",\"targetPort\":8080}]},\"status\":null}"),
+ textExpected("POST", "https://cyclops.invalid/api/k8s/apis/osgym.cua.ai/v1alpha1/namespaces/default/osgymsandboxwarmpools", jsonHeaders, "{\"apiVersion\":\"osgym.cua.ai/v1alpha1\",\"kind\":\"OSGymSandboxWarmPool\",\"metadata\":{\"namespace\":\"default\",\"name\":\"default\",\"labels\":null},\"spec\":{\"replicas\":1,\"sandboxTemplateRef\":{\"name\":\"default\"}},\"status\":null}".encodeToByteArray(), 201u, "{\"apiVersion\":\"osgym.cua.ai/v1alpha1\",\"kind\":\"OSGymSandboxWarmPool\",\"metadata\":{\"namespace\":\"default\",\"name\":\"default\",\"labels\":null},\"spec\":{\"replicas\":1,\"sandboxTemplateRef\":{\"name\":\"default\"}},\"status\":null}"),
textExpected("POST", "https://cyclops.invalid/api/k8s/apis/osgym.cua.ai/v1alpha1/namespaces/default/osgymsandboxclaims", jsonHeaders, "{\"apiVersion\":\"osgym.cua.ai/v1alpha1\",\"kind\":\"OSGymSandboxClaim\",\"metadata\":{\"namespace\":\"default\",\"name\":\"claim-1\",\"labels\":null},\"spec\":{\"sandboxTemplateRef\":{\"name\":\"default\"}},\"status\":null}".encodeToByteArray(), 201u, "{\"apiVersion\":\"osgym.cua.ai/v1alpha1\",\"kind\":\"OSGymSandboxClaim\",\"metadata\":{\"namespace\":\"default\",\"name\":\"default\",\"labels\":null},\"spec\":{\"sandboxTemplateRef\":{\"name\":\"default\"}},\"status\":{\"phase\":\"Bound\",\"sandbox\":{\"name\":\"offline-sandbox\"}}}"),
textExpected("GET", "https://cyclops.invalid/api/k8s/apis/osgym.cua.ai/v1alpha1/namespaces/default/osgymsandboxclaims/default", jsonHeaders, null, 200u, "{\"apiVersion\":\"osgym.cua.ai/v1alpha1\",\"kind\":\"OSGymSandboxClaim\",\"metadata\":{\"namespace\":\"default\",\"name\":\"default\",\"labels\":null},\"spec\":{\"sandboxTemplateRef\":{\"name\":\"default\"}},\"status\":{\"phase\":\"Bound\",\"sandbox\":{\"name\":\"offline-sandbox\"}}}"),
- textExpected("GET", "https://cyclops.invalid/api/k8s/apis/cua.ai/v1/namespaces/default/osgymworkspacepools/default", jsonHeaders, null, 200u, "{\"apiVersion\":\"cua.ai/v1\",\"kind\":\"OSGymWorkspacePool\",\"metadata\":{\"namespace\":\"default\",\"name\":\"default\",\"labels\":null},\"spec\":{\"replicas\":1,\"template\":{\"containerDiskImage\":\"registry.example/desktop:offline\"},\"services\":[{\"name\":\"mcp\",\"targetPort\":8080}]},\"status\":null}"),
+ textExpected("GET", "https://cyclops.invalid/api/k8s/apis/osgym.cua.ai/v1alpha1/namespaces/default/osgymsandboxtemplates/default", jsonHeaders, null, 200u, "{\"apiVersion\":\"osgym.cua.ai/v1alpha1\",\"kind\":\"OSGymSandboxTemplate\",\"metadata\":{\"namespace\":\"default\",\"name\":\"default\",\"labels\":null},\"spec\":{\"vmTemplate\":{\"containerDiskImage\":\"registry.example/desktop:offline\",\"services\":[{\"name\":\"mcp\",\"targetPort\":8080}]}}}"),
serviceExpected("{\"offline\":true}".encodeToByteArray(), "offline service accepted".encodeToByteArray()),
textExpected("DELETE", "https://cyclops.invalid/api/k8s/apis/osgym.cua.ai/v1alpha1/namespaces/default/osgymsandboxclaims/default", jsonHeaders, null, 204u, ""),
- textExpected("DELETE", "https://cyclops.invalid/api/k8s/apis/cua.ai/v1/namespaces/default/osgymworkspacepools/default", jsonHeaders, null, 204u, ""),
+ textExpected("DELETE", "https://cyclops.invalid/api/k8s/apis/osgym.cua.ai/v1alpha1/namespaces/default/osgymsandboxwarmpools/default", jsonHeaders, null, 204u, ""),
textExpected("DELETE", "https://cyclops.invalid/api/namespaces/default", jsonHeaders, null, 204u, ""),
)
@@ -95,8 +95,7 @@ private fun serviceRequest(body: ByteArray?) = HttpRequest("POST", "https://igno
private val sandbox = Sandbox("default", "default", "offline-sandbox", listOf("mcp"))
fun main() = runBlocking {
- val vmTemplate = VmTemplate("registry.example/desktop:offline", null, null, null, null, null, null, null, null, null, null, null, null, null)
- val spec = PoolSpec(1u, PoolTemplate(null, null, null, null, null, vmTemplate.containerDiskImage, null, null, null, null, null, null), null, listOf(SandboxService("mcp", 8080u, null)))
+ val spec = OsGymSandboxWarmPoolSpec(1u, SandboxTemplateRef("default"), null)
val transport = ScriptedHttpClient(lifecycleQueue())
val client = CyclopsClient.connect(configuration(), transport)
val pool = client.createPool(CreatePoolRequest("default", spec))
diff --git a/libs/fleet/sdk-bindings/python/contract_fixture.py b/libs/fleet/sdk-bindings/python/contract_fixture.py
index 754bdff33e..dbcce63a3d 100644
--- a/libs/fleet/sdk-bindings/python/contract_fixture.py
+++ b/libs/fleet/sdk-bindings/python/contract_fixture.py
@@ -3,8 +3,8 @@ import json
from dataclasses import dataclass
from fleet_sdk import (ClaimSpec, CreateClaimRequest, CreatePoolRequest, CyclopsClient,
- CyclopsConfiguration, CyclopsCredentials, HttpClient, HttpRequest, HttpResponse, PoolSpec,
- PoolTemplate, Sandbox, SandboxService, SandboxTemplateRef, VmTemplate)
+ CyclopsConfiguration, CyclopsCredentials, HttpClient, HttpRequest, HttpResponse,
+ OsGymSandboxWarmPoolSpec, Sandbox, SandboxTemplateRef, VmTemplate)
BASE = 'https://cyclops.invalid'
TOKEN = 'https://keycloak.invalid/realms/offline/protocol/openid-connect/token'
@@ -56,10 +56,13 @@ def service_request(body):
return HttpRequest(method='POST', url='https://ignored.invalid/mcp', headers=[], body=body)
def pool_spec():
- return PoolSpec(replicas=1, template=PoolTemplate(runtime=None, runtime_class_name=None, node_selector=None, tolerations=None, command=None, container_disk_image='registry.example/desktop:offline', image_pull_secret=None, cpu_cores=None, memory=None, firmware=None, probes=None, oidc=None), autoscaling=None, services=[SandboxService(name='mcp', target_port=8080, protocol=None)])
+ return OsGymSandboxWarmPoolSpec(replicas=1, sandbox_template_ref=SandboxTemplateRef(name='default'), autoscaling=None)
def pool_response():
- return {'apiVersion': 'cua.ai/v1', 'kind': 'OSGymWorkspacePool', 'metadata': {'namespace': 'default', 'name': 'default', 'labels': None}, 'spec': {'replicas': 1, 'template': {'containerDiskImage': 'registry.example/desktop:offline'}, 'services': [{'name': 'mcp', 'targetPort': 8080}]}, 'status': None}
+ return {'apiVersion': 'osgym.cua.ai/v1alpha1', 'kind': 'OSGymSandboxWarmPool', 'metadata': {'namespace': 'default', 'name': 'default', 'labels': None}, 'spec': {'replicas': 1, 'sandboxTemplateRef': {'name': 'default'}}, 'status': None}
+
+def template_response():
+ return {'apiVersion': 'osgym.cua.ai/v1alpha1', 'kind': 'OSGymSandboxTemplate', 'metadata': {'namespace': 'default', 'name': 'default', 'labels': None}, 'spec': {'vmTemplate': {'containerDiskImage': 'registry.example/desktop:offline', 'services': [{'name': 'mcp', 'targetPort': 8080}]}}}
def claim_response(bound=False):
result = {'apiVersion': 'osgym.cua.ai/v1alpha1', 'kind': 'OSGymSandboxClaim', 'metadata': {'namespace': 'default', 'name': 'default', 'labels': None}, 'spec': {'sandboxTemplateRef': {'name': 'default'}}, 'status': None}
@@ -71,14 +74,15 @@ def expected_lifecycle():
pool_body = json.dumps(pool_response(), separators=(',', ':')).encode()
claim_body = b'{"apiVersion":"osgym.cua.ai/v1alpha1","kind":"OSGymSandboxClaim","metadata":{"namespace":"default","name":"claim-1","labels":null},"spec":{"sandboxTemplateRef":{"name":"default"}},"status":null}'
claim_url = f'{BASE}/api/k8s/apis/osgym.cua.ai/v1alpha1/namespaces/default/osgymsandboxclaims/default'
- pool_url = f'{BASE}/api/k8s/apis/cua.ai/v1/namespaces/default/osgymworkspacepools/default'
+ pool_url = f'{BASE}/api/k8s/apis/osgym.cua.ai/v1alpha1/namespaces/default/osgymsandboxwarmpools/default'
+ template_url = f'{BASE}/api/k8s/apis/osgym.cua.ai/v1alpha1/namespaces/default/osgymsandboxtemplates/default'
return [
token_expected(),
Expected('POST', f'{BASE}/api/namespaces', JSON_HEADERS, b'{"name":"default"}', 201, {}),
Expected('POST', pool_url.removesuffix('/default'), JSON_HEADERS, pool_body, 201, pool_response()),
Expected('POST', claim_url.removesuffix('/default'), JSON_HEADERS, claim_body, 201, claim_response()),
Expected('GET', claim_url, JSON_HEADERS, None, 200, claim_response(True)),
- Expected('GET', pool_url, JSON_HEADERS, None, 200, pool_response()),
+ Expected('GET', template_url, JSON_HEADERS, None, 200, template_response()),
service_expected(b'{"offline":true}', b'offline service accepted'),
Expected('DELETE', claim_url, JSON_HEADERS, None, 204, b''),
Expected('DELETE', pool_url, JSON_HEADERS, None, 204, b''),
diff --git a/libs/fleet/sdk-bindings/python/fleet_sdk/__init__.py b/libs/fleet/sdk-bindings/python/fleet_sdk/__init__.py
index fb39d42c0e..c70a1cb69c 100644
--- a/libs/fleet/sdk-bindings/python/fleet_sdk/__init__.py
+++ b/libs/fleet/sdk-bindings/python/fleet_sdk/__init__.py
@@ -2,8 +2,9 @@ from . import _schema as _schema_component
from ._schema import *
_UniffiFfiConverterTypeClaimSpec = _schema_component._UniffiFfiConverterTypeClaimSpec
_UniffiFfiConverterTypeOSGymSandboxClaimStatus = _schema_component._UniffiFfiConverterTypeOSGymSandboxClaimStatus
-_UniffiFfiConverterTypeOSGymWorkspacePoolStatus = _schema_component._UniffiFfiConverterTypeOSGymWorkspacePoolStatus
-_UniffiFfiConverterTypePoolSpec = _schema_component._UniffiFfiConverterTypePoolSpec
+_UniffiFfiConverterTypeOSGymSandboxTemplateSpec = _schema_component._UniffiFfiConverterTypeOSGymSandboxTemplateSpec
+_UniffiFfiConverterTypeOSGymSandboxWarmPoolSpec = _schema_component._UniffiFfiConverterTypeOSGymSandboxWarmPoolSpec
+_UniffiFfiConverterTypeOSGymSandboxWarmPoolStatus = _schema_component._UniffiFfiConverterTypeOSGymSandboxWarmPoolStatus
from . import _sdk as _sdk_component
from ._sdk import *
diff --git a/libs/fleet/sdk-bindings/python/fleet_sdk/_schema.py b/libs/fleet/sdk-bindings/python/fleet_sdk/_schema.py
index 263dce05e5..3b51d12ac0 100644
--- a/libs/fleet/sdk-bindings/python/fleet_sdk/_schema.py
+++ b/libs/fleet/sdk-bindings/python/fleet_sdk/_schema.py
@@ -755,23 +755,6 @@ _UniffiLib.uniffi_cyclops_sdk_schema_fn_free_preservedjson.argtypes = (
ctypes.POINTER(_UniffiRustCallStatus),
)
_UniffiLib.uniffi_cyclops_sdk_schema_fn_free_preservedjson.restype = None
-_UniffiLib.uniffi_cyclops_sdk_schema_fn_method_poolspec_uniffi_trait_eq_eq.argtypes = (
- _UniffiRustBuffer,
- _UniffiRustBuffer,
- ctypes.POINTER(_UniffiRustCallStatus),
-)
-_UniffiLib.uniffi_cyclops_sdk_schema_fn_method_poolspec_uniffi_trait_eq_eq.restype = ctypes.c_int8
-_UniffiLib.uniffi_cyclops_sdk_schema_fn_method_poolspec_uniffi_trait_eq_ne.argtypes = (
- _UniffiRustBuffer,
- _UniffiRustBuffer,
- ctypes.POINTER(_UniffiRustCallStatus),
-)
-_UniffiLib.uniffi_cyclops_sdk_schema_fn_method_poolspec_uniffi_trait_eq_ne.restype = ctypes.c_int8
-_UniffiLib.uniffi_cyclops_sdk_schema_fn_method_poolspec_uniffi_trait_hash.argtypes = (
- _UniffiRustBuffer,
- ctypes.POINTER(_UniffiRustCallStatus),
-)
-_UniffiLib.uniffi_cyclops_sdk_schema_fn_method_poolspec_uniffi_trait_hash.restype = ctypes.c_uint64
_UniffiLib.uniffi_cyclops_sdk_schema_fn_constructor_preservedjson_from_json.argtypes = (
_UniffiRustBuffer,
ctypes.POINTER(_UniffiRustCallStatus),
@@ -2404,238 +2387,6 @@ class _UniffiFfiConverterTypeOSGymSandboxWarmPoolStatus(_UniffiConverterRustBuff
_UniffiFfiConverterOptionalUInt32.write(value.ready_replicas, buf)
_UniffiFfiConverterOptionalString.write(value.selector, buf)
-@dataclass
-class OsGymWorkspacePoolStatus:
- def __init__(self, *, phase:typing.Optional[str], total_count:typing.Optional[int], available_count:typing.Optional[int], claimed_count:typing.Optional[int]):
- self.phase = phase
- self.total_count = total_count
- self.available_count = available_count
- self.claimed_count = claimed_count
-
-
-
-
- def __str__(self):
- return "OsGymWorkspacePoolStatus(phase={}, total_count={}, available_count={}, claimed_count={})".format(self.phase, self.total_count, self.available_count, self.claimed_count)
- def __eq__(self, other):
- if self.phase != other.phase:
- return False
- if self.total_count != other.total_count:
- return False
- if self.available_count != other.available_count:
- return False
- if self.claimed_count != other.claimed_count:
- return False
- return True
-
-class _UniffiFfiConverterTypeOSGymWorkspacePoolStatus(_UniffiConverterRustBuffer):
- @staticmethod
- def read(buf):
- return OsGymWorkspacePoolStatus(
- phase=_UniffiFfiConverterOptionalString.read(buf),
- total_count=_UniffiFfiConverterOptionalUInt32.read(buf),
- available_count=_UniffiFfiConverterOptionalUInt32.read(buf),
- claimed_count=_UniffiFfiConverterOptionalUInt32.read(buf),
- )
-
- @staticmethod
- def check_lower(value):
- _UniffiFfiConverterOptionalString.check_lower(value.phase)
- _UniffiFfiConverterOptionalUInt32.check_lower(value.total_count)
- _UniffiFfiConverterOptionalUInt32.check_lower(value.available_count)
- _UniffiFfiConverterOptionalUInt32.check_lower(value.claimed_count)
-
- @staticmethod
- def write(value, buf):
- _UniffiFfiConverterOptionalString.write(value.phase, buf)
- _UniffiFfiConverterOptionalUInt32.write(value.total_count, buf)
- _UniffiFfiConverterOptionalUInt32.write(value.available_count, buf)
- _UniffiFfiConverterOptionalUInt32.write(value.claimed_count, buf)
-
-@dataclass
-class PoolTemplate:
- def __init__(self, *, runtime:typing.Optional[RuntimeKind], runtime_class_name:typing.Optional[str], node_selector:typing.Optional[dict[str, str]], tolerations:typing.Optional[typing.List[PreservedJson]], command:typing.Optional[typing.List[str]], container_disk_image:str, image_pull_secret:typing.Optional[str], cpu_cores:typing.Optional[int], memory:typing.Optional[str], firmware:typing.Optional[Firmware], probes:typing.Optional[PreservedJson], oidc:typing.Optional[OidcConfig]):
- self.runtime = runtime
- self.runtime_class_name = runtime_class_name
- self.node_selector = node_selector
- self.tolerations = tolerations
- self.command = command
- self.container_disk_image = container_disk_image
- self.image_pull_secret = image_pull_secret
- self.cpu_cores = cpu_cores
- self.memory = memory
- self.firmware = firmware
- self.probes = probes
- self.oidc = oidc
-
-
-
-
- def __str__(self):
- return "PoolTemplate(runtime={}, runtime_class_name={}, node_selector={}, tolerations={}, command={}, container_disk_image={}, image_pull_secret={}, cpu_cores={}, memory={}, firmware={}, probes={}, oidc={})".format(self.runtime, self.runtime_class_name, self.node_selector, self.tolerations, self.command, self.container_disk_image, self.image_pull_secret, self.cpu_cores, self.memory, self.firmware, self.probes, self.oidc)
- def __eq__(self, other):
- if self.runtime != other.runtime:
- return False
- if self.runtime_class_name != other.runtime_class_name:
- return False
- if self.node_selector != other.node_selector:
- return False
- if self.tolerations != other.tolerations:
- return False
- if self.command != other.command:
- return False
- if self.container_disk_image != other.container_disk_image:
- return False
- if self.image_pull_secret != other.image_pull_secret:
- return False
- if self.cpu_cores != other.cpu_cores:
- return False
- if self.memory != other.memory:
- return False
- if self.firmware != other.firmware:
- return False
- if self.probes != other.probes:
- return False
- if self.oidc != other.oidc:
- return False
- return True
-
-class _UniffiFfiConverterTypePoolTemplate(_UniffiConverterRustBuffer):
- @staticmethod
- def read(buf):
- return PoolTemplate(
- runtime=_UniffiFfiConverterOptionalTypeRuntimeKind.read(buf),
- runtime_class_name=_UniffiFfiConverterOptionalString.read(buf),
- node_selector=_UniffiFfiConverterOptionalMapStringString.read(buf),
- tolerations=_UniffiFfiConverterOptionalSequenceTypePreservedJson.read(buf),
- command=_UniffiFfiConverterOptionalSequenceString.read(buf),
- container_disk_image=_UniffiFfiConverterString.read(buf),
- image_pull_secret=_UniffiFfiConverterOptionalString.read(buf),
- cpu_cores=_UniffiFfiConverterOptionalUInt32.read(buf),
- memory=_UniffiFfiConverterOptionalString.read(buf),
- firmware=_UniffiFfiConverterOptionalTypeFirmware.read(buf),
- probes=_UniffiFfiConverterOptionalTypePreservedJson.read(buf),
- oidc=_UniffiFfiConverterOptionalTypeOidcConfig.read(buf),
- )
-
- @staticmethod
- def check_lower(value):
- _UniffiFfiConverterOptionalTypeRuntimeKind.check_lower(value.runtime)
- _UniffiFfiConverterOptionalString.check_lower(value.runtime_class_name)
- _UniffiFfiConverterOptionalMapStringString.check_lower(value.node_selector)
- _UniffiFfiConverterOptionalSequenceTypePreservedJson.check_lower(value.tolerations)
- _UniffiFfiConverterOptionalSequenceString.check_lower(value.command)
- _UniffiFfiConverterString.check_lower(value.container_disk_image)
- _UniffiFfiConverterOptionalString.check_lower(value.image_pull_secret)
- _UniffiFfiConverterOptionalUInt32.check_lower(value.cpu_cores)
- _UniffiFfiConverterOptionalString.check_lower(value.memory)
- _UniffiFfiConverterOptionalTypeFirmware.check_lower(value.firmware)
- _UniffiFfiConverterOptionalTypePreservedJson.check_lower(value.probes)
- _UniffiFfiConverterOptionalTypeOidcConfig.check_lower(value.oidc)
-
- @staticmethod
- def write(value, buf):
- _UniffiFfiConverterOptionalTypeRuntimeKind.write(value.runtime, buf)
- _UniffiFfiConverterOptionalString.write(value.runtime_class_name, buf)
- _UniffiFfiConverterOptionalMapStringString.write(value.node_selector, buf)
- _UniffiFfiConverterOptionalSequenceTypePreservedJson.write(value.tolerations, buf)
- _UniffiFfiConverterOptionalSequenceString.write(value.command, buf)
- _UniffiFfiConverterString.write(value.container_disk_image, buf)
- _UniffiFfiConverterOptionalString.write(value.image_pull_secret, buf)
- _UniffiFfiConverterOptionalUInt32.write(value.cpu_cores, buf)
- _UniffiFfiConverterOptionalString.write(value.memory, buf)
- _UniffiFfiConverterOptionalTypeFirmware.write(value.firmware, buf)
- _UniffiFfiConverterOptionalTypePreservedJson.write(value.probes, buf)
- _UniffiFfiConverterOptionalTypeOidcConfig.write(value.oidc, buf)
-
-@dataclass
-class PoolSpec:
- def __init__(self, *, replicas:int, template:PoolTemplate, autoscaling:typing.Optional[WarmPoolAutoscaling], services:typing.Optional[typing.List[SandboxService]]):
- self.replicas = replicas
- self.template = template
- self.autoscaling = autoscaling
- self.services = services
-
- # The Rust `Eq::eq` implementation.
- def __eq__(self, other: object) -> bool:
- if not isinstance(other, PoolSpec):
- return NotImplemented
-
-
- _UniffiFfiConverterTypePoolSpec.check_lower(other)
- _uniffi_lowered_args = (
- _UniffiFfiConverterTypePoolSpec.lower(self),
- _UniffiFfiConverterTypePoolSpec.lower(other),
- )
- _uniffi_lift_return = _UniffiFfiConverterBoolean.lift
- _uniffi_error_converter = None
- _uniffi_ffi_result = _uniffi_rust_call_with_error(
- _uniffi_error_converter,
- _UniffiLib.uniffi_cyclops_sdk_schema_fn_method_poolspec_uniffi_trait_eq_eq,
- *_uniffi_lowered_args,
- )
- return _uniffi_lift_return(_uniffi_ffi_result)
- # The Rust `Eq::ne` implementation.
- def __ne__(self, other: object) -> bool:
- if not isinstance(other, PoolSpec):
- return NotImplemented
-
- _UniffiFfiConverterTypePoolSpec.check_lower(other)
- _uniffi_lowered_args = (
- _UniffiFfiConverterTypePoolSpec.lower(self),
- _UniffiFfiConverterTypePoolSpec.lower(other),
- )
- _uniffi_lift_return = _UniffiFfiConverterBoolean.lift
- _uniffi_error_converter = None
- _uniffi_ffi_result = _uniffi_rust_call_with_error(
- _uniffi_error_converter,
- _UniffiLib.uniffi_cyclops_sdk_schema_fn_method_poolspec_uniffi_trait_eq_ne,
- *_uniffi_lowered_args,
- )
- return _uniffi_lift_return(_uniffi_ffi_result)
- # The Rust `Hash::hash` implementation.
- def __hash__(self) -> int:
- _uniffi_lowered_args = (
- _UniffiFfiConverterTypePoolSpec.lower(self),
- )
- _uniffi_lift_return = _UniffiFfiConverterUInt64.lift
- _uniffi_error_converter = None
- _uniffi_ffi_result = _uniffi_rust_call_with_error(
- _uniffi_error_converter,
- _UniffiLib.uniffi_cyclops_sdk_schema_fn_method_poolspec_uniffi_trait_hash,
- *_uniffi_lowered_args,
- )
- return _uniffi_lift_return(_uniffi_ffi_result)
-
-
-
- def __str__(self):
- return "PoolSpec(replicas={}, template={}, autoscaling={}, services={})".format(self.replicas, self.template, self.autoscaling, self.services)
-
-class _UniffiFfiConverterTypePoolSpec(_UniffiConverterRustBuffer):
- @staticmethod
- def read(buf):
- return PoolSpec(
- replicas=_UniffiFfiConverterUInt32.read(buf),
- template=_UniffiFfiConverterTypePoolTemplate.read(buf),
- autoscaling=_UniffiFfiConverterOptionalTypeWarmPoolAutoscaling.read(buf),
- services=_UniffiFfiConverterOptionalSequenceTypeSandboxService.read(buf),
- )
-
- @staticmethod
- def check_lower(value):
- _UniffiFfiConverterUInt32.check_lower(value.replicas)
- _UniffiFfiConverterTypePoolTemplate.check_lower(value.template)
- _UniffiFfiConverterOptionalTypeWarmPoolAutoscaling.check_lower(value.autoscaling)
- _UniffiFfiConverterOptionalSequenceTypeSandboxService.check_lower(value.services)
-
- @staticmethod
- def write(value, buf):
- _UniffiFfiConverterUInt32.write(value.replicas, buf)
- _UniffiFfiConverterTypePoolTemplate.write(value.template, buf)
- _UniffiFfiConverterOptionalTypeWarmPoolAutoscaling.write(value.autoscaling, buf)
- _UniffiFfiConverterOptionalSequenceTypeSandboxService.write(value.services, buf)
-
# JsonValueError
@@ -2689,19 +2440,6 @@ class _UniffiFfiConverterTypeJsonValueError(_UniffiConverterRustBuffer):
buf.write_i32(1)
_UniffiFfiConverterString.write(value.reason, buf)
-class _UniffiFfiConverterUInt64(_UniffiConverterPrimitiveInt):
- CLASS_NAME = "u64"
- VALUE_MIN = 0
- VALUE_MAX = 2**64
-
- @staticmethod
- def read(buf):
- return buf.read_u64()
-
- @staticmethod
- def write(value, buf):
- buf.write_u64(value)
-
class _UniffiFfiConverterUInt8(_UniffiConverterPrimitiveInt):
CLASS_NAME = "u8"
VALUE_MIN = 0
@@ -2737,9 +2475,6 @@ __all__ = [
"WarmPoolAutoscaling",
"OsGymSandboxWarmPoolSpec",
"OsGymSandboxWarmPoolStatus",
- "OsGymWorkspacePoolStatus",
- "PoolTemplate",
- "PoolSpec",
"PreservedJson",
"PreservedJsonProtocol",
]
diff --git a/libs/fleet/sdk-bindings/python/fleet_sdk/_sdk.py b/libs/fleet/sdk-bindings/python/fleet_sdk/_sdk.py
index 3e6f725a6b..d7270278e9 100644
--- a/libs/fleet/sdk-bindings/python/fleet_sdk/_sdk.py
+++ b/libs/fleet/sdk-bindings/python/fleet_sdk/_sdk.py
@@ -500,24 +500,36 @@ def _uniffi_check_api_checksums(lib):
raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
if lib.uniffi_cyclops_sdk_checksum_method_cyclopsclient_create_pool() != 48557:
raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
+ if lib.uniffi_cyclops_sdk_checksum_method_cyclopsclient_create_template() != 13689:
+ raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
if lib.uniffi_cyclops_sdk_checksum_method_cyclopsclient_delete_claim() != 20460:
raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
if lib.uniffi_cyclops_sdk_checksum_method_cyclopsclient_delete_pool() != 31235:
raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
+ if lib.uniffi_cyclops_sdk_checksum_method_cyclopsclient_delete_template() != 54852:
+ raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
if lib.uniffi_cyclops_sdk_checksum_method_cyclopsclient_get_claim() != 17760:
raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
if lib.uniffi_cyclops_sdk_checksum_method_cyclopsclient_get_pool() != 49450:
raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
+ if lib.uniffi_cyclops_sdk_checksum_method_cyclopsclient_get_template() != 8909:
+ raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
if lib.uniffi_cyclops_sdk_checksum_method_cyclopsclient_list_claims() != 7802:
raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
if lib.uniffi_cyclops_sdk_checksum_method_cyclopsclient_list_pools() != 27984:
raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
+ if lib.uniffi_cyclops_sdk_checksum_method_cyclopsclient_list_templates() != 58376:
+ raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
if lib.uniffi_cyclops_sdk_checksum_method_cyclopsclient_reconcile_pool() != 53919:
raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
+ if lib.uniffi_cyclops_sdk_checksum_method_cyclopsclient_reconcile_template() != 36469:
+ raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
if lib.uniffi_cyclops_sdk_checksum_method_cyclopsclient_service_request() != 46699:
raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
if lib.uniffi_cyclops_sdk_checksum_method_cyclopsclient_update_pool() != 17695:
raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
+ if lib.uniffi_cyclops_sdk_checksum_method_cyclopsclient_update_template() != 18704:
+ raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
if lib.uniffi_cyclops_sdk_checksum_method_cyclopsclient_wait_claim() != 18984:
raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
if lib.uniffi_cyclops_sdk_checksum_constructor_cyclopscredentials_new() != 25746:
@@ -924,6 +936,11 @@ _UniffiLib.uniffi_cyclops_sdk_fn_method_cyclopsclient_create_pool.argtypes = (
_UniffiRustBuffer,
)
_UniffiLib.uniffi_cyclops_sdk_fn_method_cyclopsclient_create_pool.restype = ctypes.c_uint64
+_UniffiLib.uniffi_cyclops_sdk_fn_method_cyclopsclient_create_template.argtypes = (
+ ctypes.c_uint64,
+ _UniffiRustBuffer,
+)
+_UniffiLib.uniffi_cyclops_sdk_fn_method_cyclopsclient_create_template.restype = ctypes.c_uint64
_UniffiLib.uniffi_cyclops_sdk_fn_method_cyclopsclient_delete_claim.argtypes = (
ctypes.c_uint64,
_UniffiRustBuffer,
@@ -934,6 +951,11 @@ _UniffiLib.uniffi_cyclops_sdk_fn_method_cyclopsclient_delete_pool.argtypes = (
_UniffiRustBuffer,
)
_UniffiLib.uniffi_cyclops_sdk_fn_method_cyclopsclient_delete_pool.restype = ctypes.c_uint64
+_UniffiLib.uniffi_cyclops_sdk_fn_method_cyclopsclient_delete_template.argtypes = (
+ ctypes.c_uint64,
+ _UniffiRustBuffer,
+)
+_UniffiLib.uniffi_cyclops_sdk_fn_method_cyclopsclient_delete_template.restype = ctypes.c_uint64
_UniffiLib.uniffi_cyclops_sdk_fn_method_cyclopsclient_get_claim.argtypes = (
ctypes.c_uint64,
_UniffiRustBuffer,
@@ -944,6 +966,12 @@ _UniffiLib.uniffi_cyclops_sdk_fn_method_cyclopsclient_get_pool.argtypes = (
_UniffiRustBuffer,
)
_UniffiLib.uniffi_cyclops_sdk_fn_method_cyclopsclient_get_pool.restype = ctypes.c_uint64
+_UniffiLib.uniffi_cyclops_sdk_fn_method_cyclopsclient_get_template.argtypes = (
+ ctypes.c_uint64,
+ _UniffiRustBuffer,
+ _UniffiRustBuffer,
+)
+_UniffiLib.uniffi_cyclops_sdk_fn_method_cyclopsclient_get_template.restype = ctypes.c_uint64
_UniffiLib.uniffi_cyclops_sdk_fn_method_cyclopsclient_list_claims.argtypes = (
ctypes.c_uint64,
_UniffiRustBuffer,
@@ -954,11 +982,21 @@ _UniffiLib.uniffi_cyclops_sdk_fn_method_cyclopsclient_list_pools.argtypes = (
_UniffiRustBuffer,
)
_UniffiLib.uniffi_cyclops_sdk_fn_method_cyclopsclient_list_pools.restype = ctypes.c_uint64
+_UniffiLib.uniffi_cyclops_sdk_fn_method_cyclopsclient_list_templates.argtypes = (
+ ctypes.c_uint64,
+ _UniffiRustBuffer,
+)
+_UniffiLib.uniffi_cyclops_sdk_fn_method_cyclopsclient_list_templates.restype = ctypes.c_uint64
_UniffiLib.uniffi_cyclops_sdk_fn_method_cyclopsclient_reconcile_pool.argtypes = (
ctypes.c_uint64,
_UniffiRustBuffer,
)
_UniffiLib.uniffi_cyclops_sdk_fn_method_cyclopsclient_reconcile_pool.restype = ctypes.c_uint64
+_UniffiLib.uniffi_cyclops_sdk_fn_method_cyclopsclient_reconcile_template.argtypes = (
+ ctypes.c_uint64,
+ _UniffiRustBuffer,
+)
+_UniffiLib.uniffi_cyclops_sdk_fn_method_cyclopsclient_reconcile_template.restype = ctypes.c_uint64
_UniffiLib.uniffi_cyclops_sdk_fn_method_cyclopsclient_service_request.argtypes = (
ctypes.c_uint64,
_UniffiRustBuffer,
@@ -972,6 +1010,11 @@ _UniffiLib.uniffi_cyclops_sdk_fn_method_cyclopsclient_update_pool.argtypes = (
_UniffiRustBuffer,
)
_UniffiLib.uniffi_cyclops_sdk_fn_method_cyclopsclient_update_pool.restype = ctypes.c_uint64
+_UniffiLib.uniffi_cyclops_sdk_fn_method_cyclopsclient_update_template.argtypes = (
+ ctypes.c_uint64,
+ _UniffiRustBuffer,
+)
+_UniffiLib.uniffi_cyclops_sdk_fn_method_cyclopsclient_update_template.restype = ctypes.c_uint64
_UniffiLib.uniffi_cyclops_sdk_fn_method_cyclopsclient_wait_claim.argtypes = (
ctypes.c_uint64,
_UniffiRustBuffer,
@@ -1021,33 +1064,51 @@ _UniffiLib.uniffi_cyclops_sdk_checksum_method_cyclopsclient_create_claim.restype
_UniffiLib.uniffi_cyclops_sdk_checksum_method_cyclopsclient_create_pool.argtypes = (
)
_UniffiLib.uniffi_cyclops_sdk_checksum_method_cyclopsclient_create_pool.restype = ctypes.c_uint16
+_UniffiLib.uniffi_cyclops_sdk_checksum_method_cyclopsclient_create_template.argtypes = (
+)
+_UniffiLib.uniffi_cyclops_sdk_checksum_method_cyclopsclient_create_template.restype = ctypes.c_uint16
_UniffiLib.uniffi_cyclops_sdk_checksum_method_cyclopsclient_delete_claim.argtypes = (
)
_UniffiLib.uniffi_cyclops_sdk_checksum_method_cyclopsclient_delete_claim.restype = ctypes.c_uint16
_UniffiLib.uniffi_cyclops_sdk_checksum_method_cyclopsclient_delete_pool.argtypes = (
)
_UniffiLib.uniffi_cyclops_sdk_checksum_method_cyclopsclient_delete_pool.restype = ctypes.c_uint16
+_UniffiLib.uniffi_cyclops_sdk_checksum_method_cyclopsclient_delete_template.argtypes = (
+)
+_UniffiLib.uniffi_cyclops_sdk_checksum_method_cyclopsclient_delete_template.restype = ctypes.c_uint16
_UniffiLib.uniffi_cyclops_sdk_checksum_method_cyclopsclient_get_claim.argtypes = (
)
_UniffiLib.uniffi_cyclops_sdk_checksum_method_cyclopsclient_get_claim.restype = ctypes.c_uint16
_UniffiLib.uniffi_cyclops_sdk_checksum_method_cyclopsclient_get_pool.argtypes = (
)
_UniffiLib.uniffi_cyclops_sdk_checksum_method_cyclopsclient_get_pool.restype = ctypes.c_uint16
+_UniffiLib.uniffi_cyclops_sdk_checksum_method_cyclopsclient_get_template.argtypes = (
+)
+_UniffiLib.uniffi_cyclops_sdk_checksum_method_cyclopsclient_get_template.restype = ctypes.c_uint16
_UniffiLib.uniffi_cyclops_sdk_checksum_method_cyclopsclient_list_claims.argtypes = (
)
_UniffiLib.uniffi_cyclops_sdk_checksum_method_cyclopsclient_list_claims.restype = ctypes.c_uint16
_UniffiLib.uniffi_cyclops_sdk_checksum_method_cyclopsclient_list_pools.argtypes = (
)
_UniffiLib.uniffi_cyclops_sdk_checksum_method_cyclopsclient_list_pools.restype = ctypes.c_uint16
+_UniffiLib.uniffi_cyclops_sdk_checksum_method_cyclopsclient_list_templates.argtypes = (
+)
+_UniffiLib.uniffi_cyclops_sdk_checksum_method_cyclopsclient_list_templates.restype = ctypes.c_uint16
_UniffiLib.uniffi_cyclops_sdk_checksum_method_cyclopsclient_reconcile_pool.argtypes = (
)
_UniffiLib.uniffi_cyclops_sdk_checksum_method_cyclopsclient_reconcile_pool.restype = ctypes.c_uint16
+_UniffiLib.uniffi_cyclops_sdk_checksum_method_cyclopsclient_reconcile_template.argtypes = (
+)
+_UniffiLib.uniffi_cyclops_sdk_checksum_method_cyclopsclient_reconcile_template.restype = ctypes.c_uint16
_UniffiLib.uniffi_cyclops_sdk_checksum_method_cyclopsclient_service_request.argtypes = (
)
_UniffiLib.uniffi_cyclops_sdk_checksum_method_cyclopsclient_service_request.restype = ctypes.c_uint16
_UniffiLib.uniffi_cyclops_sdk_checksum_method_cyclopsclient_update_pool.argtypes = (
)
_UniffiLib.uniffi_cyclops_sdk_checksum_method_cyclopsclient_update_pool.restype = ctypes.c_uint16
+_UniffiLib.uniffi_cyclops_sdk_checksum_method_cyclopsclient_update_template.argtypes = (
+)
+_UniffiLib.uniffi_cyclops_sdk_checksum_method_cyclopsclient_update_template.restype = ctypes.c_uint16
_UniffiLib.uniffi_cyclops_sdk_checksum_method_cyclopsclient_wait_claim.argtypes = (
)
_UniffiLib.uniffi_cyclops_sdk_checksum_method_cyclopsclient_wait_claim.restype = ctypes.c_uint16
@@ -1407,11 +1468,11 @@ class _UniffiFfiConverterTypeClaim(_UniffiConverterRustBuffer):
-class _UniffiFfiConverterOptionalTypeOSGymWorkspacePoolStatus(_UniffiConverterRustBuffer):
+class _UniffiFfiConverterOptionalTypeOSGymSandboxWarmPoolStatus(_UniffiConverterRustBuffer):
@classmethod
def check_lower(cls, value):
if value is not None:
- fleet_sdk._UniffiFfiConverterTypeOSGymWorkspacePoolStatus.check_lower(value)
+ fleet_sdk._UniffiFfiConverterTypeOSGymSandboxWarmPoolStatus.check_lower(value)
@classmethod
def write(cls, value, buf):
@@ -1420,7 +1481,7 @@ class _UniffiFfiConverterOptionalTypeOSGymWorkspacePoolStatus(_UniffiConverterRu
return
buf.write_u8(1)
- fleet_sdk._UniffiFfiConverterTypeOSGymWorkspacePoolStatus.write(value, buf)
+ fleet_sdk._UniffiFfiConverterTypeOSGymSandboxWarmPoolStatus.write(value, buf)
@classmethod
def read(cls, buf):
@@ -1428,7 +1489,7 @@ class _UniffiFfiConverterOptionalTypeOSGymWorkspacePoolStatus(_UniffiConverterRu
if flag == 0:
return None
elif flag == 1:
- return fleet_sdk._UniffiFfiConverterTypeOSGymWorkspacePoolStatus.read(buf)
+ return fleet_sdk._UniffiFfiConverterTypeOSGymSandboxWarmPoolStatus.read(buf)
else:
raise InternalError("Unexpected flag byte for optional type")
@@ -1436,9 +1497,14 @@ class _UniffiFfiConverterOptionalTypeOSGymWorkspacePoolStatus(_UniffiConverterRu
class Pool:
"""
UniFFI cannot emit aliases for external record types. Generated bindings use
- `OSGymWorkspacePoolStatus` and `OSGymSandboxClaimStatus` from cyclops_sdk_schema.
+ `OSGymSandboxWarmPoolStatus` and `OSGymSandboxClaimStatus` from cyclops_sdk_schema.
+
+ A `Pool` is the `osgym.cua.ai/v1alpha1 OSGymSandboxWarmPool` CR verbatim —
+ the SDK is a naive CRUD mapper over the native CRDs, with no translation
+ layer (the legacy `cua.ai/v1 OSGymWorkspacePool` and its operator compat
+ shim are gone).
"""
- def __init__(self, *, api_version:str, kind:str, metadata:ResourceMetadata, spec:fleet_sdk.PoolSpec, status:typing.Optional[fleet_sdk.OsGymWorkspacePoolStatus]):
+ def __init__(self, *, api_version:str, kind:str, metadata:ResourceMetadata, spec:fleet_sdk.OsGymSandboxWarmPoolSpec, status:typing.Optional[fleet_sdk.OsGymSandboxWarmPoolStatus]):
self.api_version = api_version
self.kind = kind
self.metadata = metadata
@@ -1470,8 +1536,8 @@ class _UniffiFfiConverterTypePool(_UniffiConverterRustBuffer):
api_version=_UniffiFfiConverterString.read(buf),
kind=_UniffiFfiConverterString.read(buf),
metadata=_UniffiFfiConverterTypeResourceMetadata.read(buf),
- spec=fleet_sdk._UniffiFfiConverterTypePoolSpec.read(buf),
- status=_UniffiFfiConverterOptionalTypeOSGymWorkspacePoolStatus.read(buf),
+ spec=fleet_sdk._UniffiFfiConverterTypeOSGymSandboxWarmPoolSpec.read(buf),
+ status=_UniffiFfiConverterOptionalTypeOSGymSandboxWarmPoolStatus.read(buf),
)
@staticmethod
@@ -1479,16 +1545,16 @@ class _UniffiFfiConverterTypePool(_UniffiConverterRustBuffer):
_UniffiFfiConverterString.check_lower(value.api_version)
_UniffiFfiConverterString.check_lower(value.kind)
_UniffiFfiConverterTypeResourceMetadata.check_lower(value.metadata)
- fleet_sdk._UniffiFfiConverterTypePoolSpec.check_lower(value.spec)
- _UniffiFfiConverterOptionalTypeOSGymWorkspacePoolStatus.check_lower(value.status)
+ fleet_sdk._UniffiFfiConverterTypeOSGymSandboxWarmPoolSpec.check_lower(value.spec)
+ _UniffiFfiConverterOptionalTypeOSGymSandboxWarmPoolStatus.check_lower(value.status)
@staticmethod
def write(value, buf):
_UniffiFfiConverterString.write(value.api_version, buf)
_UniffiFfiConverterString.write(value.kind, buf)
_UniffiFfiConverterTypeResourceMetadata.write(value.metadata, buf)
- fleet_sdk._UniffiFfiConverterTypePoolSpec.write(value.spec, buf)
- _UniffiFfiConverterOptionalTypeOSGymWorkspacePoolStatus.write(value.status, buf)
+ fleet_sdk._UniffiFfiConverterTypeOSGymSandboxWarmPoolSpec.write(value.spec, buf)
+ _UniffiFfiConverterOptionalTypeOSGymSandboxWarmPoolStatus.write(value.status, buf)
class _UniffiFfiConverterOptionalTypeClaimSpec(_UniffiConverterRustBuffer):
@classmethod
@@ -1553,7 +1619,7 @@ class _UniffiFfiConverterTypeCreateClaimRequest(_UniffiConverterRustBuffer):
@dataclass
class CreatePoolRequest:
- def __init__(self, *, namespace:str, spec:fleet_sdk.PoolSpec):
+ def __init__(self, *, namespace:str, spec:fleet_sdk.OsGymSandboxWarmPoolSpec):
self.namespace = namespace
self.spec = spec
@@ -1574,18 +1640,62 @@ class _UniffiFfiConverterTypeCreatePoolRequest(_UniffiConverterRustBuffer):
def read(buf):
return CreatePoolRequest(
namespace=_UniffiFfiConverterString.read(buf),
- spec=fleet_sdk._UniffiFfiConverterTypePoolSpec.read(buf),
+ spec=fleet_sdk._UniffiFfiConverterTypeOSGymSandboxWarmPoolSpec.read(buf),
+ )
+
+ @staticmethod
+ def check_lower(value):
+ _UniffiFfiConverterString.check_lower(value.namespace)
+ fleet_sdk._UniffiFfiConverterTypeOSGymSandboxWarmPoolSpec.check_lower(value.spec)
+
+ @staticmethod
+ def write(value, buf):
+ _UniffiFfiConverterString.write(value.namespace, buf)
+ fleet_sdk._UniffiFfiConverterTypeOSGymSandboxWarmPoolSpec.write(value.spec, buf)
+
+
+
+@dataclass
+class CreateTemplateRequest:
+ def __init__(self, *, namespace:str, name:str, spec:fleet_sdk.OsGymSandboxTemplateSpec):
+ self.namespace = namespace
+ self.name = name
+ self.spec = spec
+
+
+
+
+ def __str__(self):
+ return "CreateTemplateRequest(namespace={}, name={}, spec={})".format(self.namespace, self.name, self.spec)
+ def __eq__(self, other):
+ if self.namespace != other.namespace:
+ return False
+ if self.name != other.name:
+ return False
+ if self.spec != other.spec:
+ return False
+ return True
+
+class _UniffiFfiConverterTypeCreateTemplateRequest(_UniffiConverterRustBuffer):
+ @staticmethod
+ def read(buf):
+ return CreateTemplateRequest(
+ namespace=_UniffiFfiConverterString.read(buf),
+ name=_UniffiFfiConverterString.read(buf),
+ spec=fleet_sdk._UniffiFfiConverterTypeOSGymSandboxTemplateSpec.read(buf),
)
@staticmethod
def check_lower(value):
_UniffiFfiConverterString.check_lower(value.namespace)
- fleet_sdk._UniffiFfiConverterTypePoolSpec.check_lower(value.spec)
+ _UniffiFfiConverterString.check_lower(value.name)
+ fleet_sdk._UniffiFfiConverterTypeOSGymSandboxTemplateSpec.check_lower(value.spec)
@staticmethod
def write(value, buf):
_UniffiFfiConverterString.write(value.namespace, buf)
- fleet_sdk._UniffiFfiConverterTypePoolSpec.write(value.spec, buf)
+ _UniffiFfiConverterString.write(value.name, buf)
+ fleet_sdk._UniffiFfiConverterTypeOSGymSandboxTemplateSpec.write(value.spec, buf)
class CyclopsCredentialsProtocol(typing.Protocol):
@@ -2084,6 +2194,58 @@ class _UniffiFfiConverterTypeSandbox(_UniffiConverterRustBuffer):
_UniffiFfiConverterString.write(value.name, buf)
_UniffiFfiConverterSequenceString.write(value.services, buf)
+@dataclass
+class Template:
+ """
+ The `osgym.cua.ai/v1alpha1 OSGymSandboxTemplate` CR verbatim. Warm pools
+ and claims reference one by name via `spec.sandboxTemplateRef.name`.
+"""
+ def __init__(self, *, api_version:str, kind:str, metadata:ResourceMetadata, spec:fleet_sdk.OsGymSandboxTemplateSpec):
+ self.api_version = api_version
+ self.kind = kind
+ self.metadata = metadata
+ self.spec = spec
+
+
+
+
+ def __str__(self):
+ return "Template(api_version={}, kind={}, metadata={}, spec={})".format(self.api_version, self.kind, self.metadata, self.spec)
+ def __eq__(self, other):
+ if self.api_version != other.api_version:
+ return False
+ if self.kind != other.kind:
+ return False
+ if self.metadata != other.metadata:
+ return False
+ if self.spec != other.spec:
+ return False
+ return True
+
+class _UniffiFfiConverterTypeTemplate(_UniffiConverterRustBuffer):
+ @staticmethod
+ def read(buf):
+ return Template(
+ api_version=_UniffiFfiConverterString.read(buf),
+ kind=_UniffiFfiConverterString.read(buf),
+ metadata=_UniffiFfiConverterTypeResourceMetadata.read(buf),
+ spec=fleet_sdk._UniffiFfiConverterTypeOSGymSandboxTemplateSpec.read(buf),
+ )
+
+ @staticmethod
+ def check_lower(value):
+ _UniffiFfiConverterString.check_lower(value.api_version)
+ _UniffiFfiConverterString.check_lower(value.kind)
+ _UniffiFfiConverterTypeResourceMetadata.check_lower(value.metadata)
+ fleet_sdk._UniffiFfiConverterTypeOSGymSandboxTemplateSpec.check_lower(value.spec)
+
+ @staticmethod
+ def write(value, buf):
+ _UniffiFfiConverterString.write(value.api_version, buf)
+ _UniffiFfiConverterString.write(value.kind, buf)
+ _UniffiFfiConverterTypeResourceMetadata.write(value.metadata, buf)
+ fleet_sdk._UniffiFfiConverterTypeOSGymSandboxTemplateSpec.write(value.spec, buf)
+
# AccessTokenProviderError
@@ -2673,6 +2835,29 @@ class _UniffiFfiConverterSequenceTypePool(_UniffiConverterRustBuffer):
_UniffiFfiConverterTypePool.read(buf) for i in range(count)
]
+class _UniffiFfiConverterSequenceTypeTemplate(_UniffiConverterRustBuffer):
+ @classmethod
+ def check_lower(cls, value):
+ for item in value:
+ _UniffiFfiConverterTypeTemplate.check_lower(item)
+
+ @classmethod
+ def write(cls, value, buf):
+ items = len(value)
+ buf.write_i32(items)
+ for item in value:
+ _UniffiFfiConverterTypeTemplate.write(item, buf)
+
+ @classmethod
+ def read(cls, buf):
+ count = buf.read_i32()
+ if count < 0:
+ raise InternalError("Unexpected negative sequence length")
+
+ return [
+ _UniffiFfiConverterTypeTemplate.read(buf) for i in range(count)
+ ]
+
class CyclopsClientProtocol(typing.Protocol):
@@ -2680,24 +2865,36 @@ class CyclopsClientProtocol(typing.Protocol):
raise NotImplementedError
async def create_pool(self, request: CreatePoolRequest) -> Pool:
raise NotImplementedError
+ async def create_template(self, request: CreateTemplateRequest) -> Template:
+ raise NotImplementedError
async def delete_claim(self, claim: Claim) -> None:
raise NotImplementedError
async def delete_pool(self, pool: Pool) -> None:
raise NotImplementedError
+ async def delete_template(self, template: Template) -> None:
+ raise NotImplementedError
async def get_claim(self, claim: Claim) -> Claim:
raise NotImplementedError
async def get_pool(self, name: str) -> Pool:
raise NotImplementedError
+ async def get_template(self, namespace: str,name: str) -> Template:
+ raise NotImplementedError
async def list_claims(self, namespace: str) -> typing.List[Claim]:
raise NotImplementedError
async def list_pools(self, namespace: str) -> typing.List[Pool]:
raise NotImplementedError
+ async def list_templates(self, namespace: str) -> typing.List[Template]:
+ raise NotImplementedError
async def reconcile_pool(self, request: CreatePoolRequest) -> Pool:
raise NotImplementedError
+ async def reconcile_template(self, request: CreateTemplateRequest) -> Template:
+ raise NotImplementedError
async def service_request(self, sandbox: Sandbox,service: str,path: str,request: HttpRequest) -> HttpResponse:
raise NotImplementedError
async def update_pool(self, pool: Pool) -> Pool:
raise NotImplementedError
+ async def update_template(self, template: Template) -> Template:
+ raise NotImplementedError
async def wait_claim(self, claim: Claim) -> Sandbox:
raise NotImplementedError
@@ -2888,6 +3085,23 @@ class CyclopsClient(CyclopsClientProtocol):
_uniffi_lift_return,
_uniffi_error_converter,
)
+ async def create_template(self, request: CreateTemplateRequest) -> Template:
+
+ _UniffiFfiConverterTypeCreateTemplateRequest.check_lower(request)
+ _uniffi_lowered_args = (
+ self._uniffi_clone_handle(),
+ _UniffiFfiConverterTypeCreateTemplateRequest.lower(request),
+ )
+ _uniffi_lift_return = _UniffiFfiConverterTypeTemplate.lift
+ _uniffi_error_converter = _UniffiFfiConverterTypeSdkError
+ return await _uniffi_rust_call_async(
+ _UniffiLib.uniffi_cyclops_sdk_fn_method_cyclopsclient_create_template(*_uniffi_lowered_args),
+ _UniffiLib.ffi_cyclops_sdk_rust_future_poll_rust_buffer,
+ _UniffiLib.ffi_cyclops_sdk_rust_future_complete_rust_buffer,
+ _UniffiLib.ffi_cyclops_sdk_rust_future_free_rust_buffer,
+ _uniffi_lift_return,
+ _uniffi_error_converter,
+ )
async def delete_claim(self, claim: Claim) -> None:
_UniffiFfiConverterTypeClaim.check_lower(claim)
@@ -2922,6 +3136,23 @@ class CyclopsClient(CyclopsClientProtocol):
_uniffi_lift_return,
_uniffi_error_converter,
)
+ async def delete_template(self, template: Template) -> None:
+
+ _UniffiFfiConverterTypeTemplate.check_lower(template)
+ _uniffi_lowered_args = (
+ self._uniffi_clone_handle(),
+ _UniffiFfiConverterTypeTemplate.lower(template),
+ )
+ _uniffi_lift_return = lambda val: None
+ _uniffi_error_converter = _UniffiFfiConverterTypeSdkError
+ return await _uniffi_rust_call_async(
+ _UniffiLib.uniffi_cyclops_sdk_fn_method_cyclopsclient_delete_template(*_uniffi_lowered_args),
+ _UniffiLib.ffi_cyclops_sdk_rust_future_poll_void,
+ _UniffiLib.ffi_cyclops_sdk_rust_future_complete_void,
+ _UniffiLib.ffi_cyclops_sdk_rust_future_free_void,
+ _uniffi_lift_return,
+ _uniffi_error_converter,
+ )
async def get_claim(self, claim: Claim) -> Claim:
_UniffiFfiConverterTypeClaim.check_lower(claim)
@@ -2956,6 +3187,26 @@ class CyclopsClient(CyclopsClientProtocol):
_uniffi_lift_return,
_uniffi_error_converter,
)
+ async def get_template(self, namespace: str,name: str) -> Template:
+
+ _UniffiFfiConverterString.check_lower(namespace)
+
+ _UniffiFfiConverterString.check_lower(name)
+ _uniffi_lowered_args = (
+ self._uniffi_clone_handle(),
+ _UniffiFfiConverterString.lower(namespace),
+ _UniffiFfiConverterString.lower(name),
+ )
+ _uniffi_lift_return = _UniffiFfiConverterTypeTemplate.lift
+ _uniffi_error_converter = _UniffiFfiConverterTypeSdkError
+ return await _uniffi_rust_call_async(
+ _UniffiLib.uniffi_cyclops_sdk_fn_method_cyclopsclient_get_template(*_uniffi_lowered_args),
+ _UniffiLib.ffi_cyclops_sdk_rust_future_poll_rust_buffer,
+ _UniffiLib.ffi_cyclops_sdk_rust_future_complete_rust_buffer,
+ _UniffiLib.ffi_cyclops_sdk_rust_future_free_rust_buffer,
+ _uniffi_lift_return,
+ _uniffi_error_converter,
+ )
async def list_claims(self, namespace: str) -> typing.List[Claim]:
_UniffiFfiConverterString.check_lower(namespace)
@@ -2990,6 +3241,23 @@ class CyclopsClient(CyclopsClientProtocol):
_uniffi_lift_return,
_uniffi_error_converter,
)
+ async def list_templates(self, namespace: str) -> typing.List[Template]:
+
+ _UniffiFfiConverterString.check_lower(namespace)
+ _uniffi_lowered_args = (
+ self._uniffi_clone_handle(),
+ _UniffiFfiConverterString.lower(namespace),
+ )
+ _uniffi_lift_return = _UniffiFfiConverterSequenceTypeTemplate.lift
+ _uniffi_error_converter = _UniffiFfiConverterTypeSdkError
+ return await _uniffi_rust_call_async(
+ _UniffiLib.uniffi_cyclops_sdk_fn_method_cyclopsclient_list_templates(*_uniffi_lowered_args),
+ _UniffiLib.ffi_cyclops_sdk_rust_future_poll_rust_buffer,
+ _UniffiLib.ffi_cyclops_sdk_rust_future_complete_rust_buffer,
+ _UniffiLib.ffi_cyclops_sdk_rust_future_free_rust_buffer,
+ _uniffi_lift_return,
+ _uniffi_error_converter,
+ )
async def reconcile_pool(self, request: CreatePoolRequest) -> Pool:
_UniffiFfiConverterTypeCreatePoolRequest.check_lower(request)
@@ -3007,6 +3275,23 @@ class CyclopsClient(CyclopsClientProtocol):
_uniffi_lift_return,
_uniffi_error_converter,
)
+ async def reconcile_template(self, request: CreateTemplateRequest) -> Template:
+
+ _UniffiFfiConverterTypeCreateTemplateRequest.check_lower(request)
+ _uniffi_lowered_args = (
+ self._uniffi_clone_handle(),
+ _UniffiFfiConverterTypeCreateTemplateRequest.lower(request),
+ )
+ _uniffi_lift_return = _UniffiFfiConverterTypeTemplate.lift
+ _uniffi_error_converter = _UniffiFfiConverterTypeSdkError
+ return await _uniffi_rust_call_async(
+ _UniffiLib.uniffi_cyclops_sdk_fn_method_cyclopsclient_reconcile_template(*_uniffi_lowered_args),
+ _UniffiLib.ffi_cyclops_sdk_rust_future_poll_rust_buffer,
+ _UniffiLib.ffi_cyclops_sdk_rust_future_complete_rust_buffer,
+ _UniffiLib.ffi_cyclops_sdk_rust_future_free_rust_buffer,
+ _uniffi_lift_return,
+ _uniffi_error_converter,
+ )
async def service_request(self, sandbox: Sandbox,service: str,path: str,request: HttpRequest) -> HttpResponse:
_UniffiFfiConverterTypeSandbox.check_lower(sandbox)
@@ -3050,6 +3335,23 @@ class CyclopsClient(CyclopsClientProtocol):
_uniffi_lift_return,
_uniffi_error_converter,
)
+ async def update_template(self, template: Template) -> Template:
+
+ _UniffiFfiConverterTypeTemplate.check_lower(template)
+ _uniffi_lowered_args = (
+ self._uniffi_clone_handle(),
+ _UniffiFfiConverterTypeTemplate.lower(template),
+ )
+ _uniffi_lift_return = _UniffiFfiConverterTypeTemplate.lift
+ _uniffi_error_converter = _UniffiFfiConverterTypeSdkError
+ return await _uniffi_rust_call_async(
+ _UniffiLib.uniffi_cyclops_sdk_fn_method_cyclopsclient_update_template(*_uniffi_lowered_args),
+ _UniffiLib.ffi_cyclops_sdk_rust_future_poll_rust_buffer,
+ _UniffiLib.ffi_cyclops_sdk_rust_future_complete_rust_buffer,
+ _UniffiLib.ffi_cyclops_sdk_rust_future_free_rust_buffer,
+ _uniffi_lift_return,
+ _uniffi_error_converter,
+ )
async def wait_claim(self, claim: Claim) -> Sandbox:
_UniffiFfiConverterTypeClaim.check_lower(claim)
@@ -3270,12 +3572,14 @@ __all__ = [
"Pool",
"CreateClaimRequest",
"CreatePoolRequest",
+ "CreateTemplateRequest",
"CyclopsConfiguration",
"CyclopsTokenProviderConfiguration",
"HttpHeader",
"HttpRequest",
"HttpResponse",
"Sandbox",
+ "Template",
"CyclopsCredentials",
"CyclopsCredentialsProtocol",
"AccessTokenProviderImpl",
diff --git a/libs/fleet/sdk-bindings/python/tests/test_public_package.py b/libs/fleet/sdk-bindings/python/tests/test_public_package.py
index 5d97e58ebf..fa881def03 100644
--- a/libs/fleet/sdk-bindings/python/tests/test_public_package.py
+++ b/libs/fleet/sdk-bindings/python/tests/test_public_package.py
@@ -9,8 +9,8 @@ from fleet_sdk import (
Firmware,
HttpHeader,
HttpRequest,
- PoolSpec,
- PoolTemplate,
+ OsGymSandboxTemplateSpec,
+ OsGymSandboxWarmPoolSpec,
RuntimeKind,
SandboxService,
)
diff --git a/libs/fleet/sdk-bindings/ruby/cyclops_sdk.rb b/libs/fleet/sdk-bindings/ruby/cyclops_sdk.rb
index de71b1b18c..6f318f324c 100644
--- a/libs/fleet/sdk-bindings/ruby/cyclops_sdk.rb
+++ b/libs/fleet/sdk-bindings/ruby/cyclops_sdk.rb
@@ -8,20 +8,23 @@ module FleetSdk
SCHEMA_CHECK_LOWER_METHODS = %i[
check_lower_TypeClaimSpec
check_lower_TypeOSGymSandboxClaimStatus
- check_lower_TypeOSGymWorkspacePoolStatus
- check_lower_TypePoolSpec
+ check_lower_TypeOSGymSandboxTemplateSpec
+ check_lower_TypeOSGymSandboxWarmPoolSpec
+ check_lower_TypeOSGymSandboxWarmPoolStatus
].freeze
SCHEMA_READ_METHODS = %i[
readTypeClaimSpec
readTypeOSGymSandboxClaimStatus
- readTypeOSGymWorkspacePoolStatus
- readTypePoolSpec
+ readTypeOSGymSandboxTemplateSpec
+ readTypeOSGymSandboxWarmPoolSpec
+ readTypeOSGymSandboxWarmPoolStatus
].freeze
SCHEMA_WRITE_METHODS = %i[
write_TypeClaimSpec
write_TypeOSGymSandboxClaimStatus
- write_TypeOSGymWorkspacePoolStatus
- write_TypePoolSpec
+ write_TypeOSGymSandboxTemplateSpec
+ write_TypeOSGymSandboxWarmPoolSpec
+ write_TypeOSGymSandboxWarmPoolStatus
].freeze
schema_rust_buffer = CyclopsSdkSchema::RustBuffer
diff --git a/libs/fleet/sdk-bindings/ruby/cyclops_sdk/schema.rb b/libs/fleet/sdk-bindings/ruby/cyclops_sdk/schema.rb
index 7eff16b74c..a5d5e6144f 100644
--- a/libs/fleet/sdk-bindings/ruby/cyclops_sdk/schema.rb
+++ b/libs/fleet/sdk-bindings/ruby/cyclops_sdk/schema.rb
@@ -324,28 +324,6 @@ end
end
end
- # The Record type OSGymWorkspacePoolStatus.
-
- def self.check_lower_TypeOSGymWorkspacePoolStatus(v)
- RustBuffer.check_lower_Optionalstring(v.phase)
- RustBuffer.check_lower_Optionalu32(v.total_count)
- RustBuffer.check_lower_Optionalu32(v.available_count)
- RustBuffer.check_lower_Optionalu32(v.claimed_count)
- end
-
- def self.alloc_from_TypeOSGymWorkspacePoolStatus(v)
- RustBuffer.allocWithBuilder do |builder|
- builder.write_TypeOSGymWorkspacePoolStatus(v)
- return builder.finalize
- end
- end
-
- def consumeIntoTypeOSGymWorkspacePoolStatus
- consumeWithStream do |stream|
- return stream.readTypeOSGymWorkspacePoolStatus
- end
- end
-
# The Record type OidcConfig.
def self.check_lower_TypeOidcConfig(v)
@@ -369,58 +347,6 @@ end
end
end
- # The Record type PoolSpec.
-
- def self.check_lower_TypePoolSpec(v)
-
- RustBuffer.check_lower_TypePoolTemplate(v.template)
- RustBuffer.check_lower_OptionalTypeWarmPoolAutoscaling(v.autoscaling)
- RustBuffer.check_lower_OptionalSequenceTypeSandboxService(v.services)
- end
-
- def self.alloc_from_TypePoolSpec(v)
- RustBuffer.allocWithBuilder do |builder|
- builder.write_TypePoolSpec(v)
- return builder.finalize
- end
- end
-
- def consumeIntoTypePoolSpec
- consumeWithStream do |stream|
- return stream.readTypePoolSpec
- end
- end
-
- # The Record type PoolTemplate.
-
- def self.check_lower_TypePoolTemplate(v)
- RustBuffer.check_lower_OptionalTypeRuntimeKind(v.runtime)
- RustBuffer.check_lower_Optionalstring(v.runtime_class_name)
- RustBuffer.check_lower_OptionalMapStringString(v.node_selector)
- RustBuffer.check_lower_OptionalSequenceTypePreservedJson(v.tolerations)
- RustBuffer.check_lower_OptionalSequencestring(v.command)
-
- RustBuffer.check_lower_Optionalstring(v.image_pull_secret)
- RustBuffer.check_lower_Optionalu32(v.cpu_cores)
- RustBuffer.check_lower_Optionalstring(v.memory)
- RustBuffer.check_lower_OptionalTypeFirmware(v.firmware)
- RustBuffer.check_lower_OptionalTypePreservedJson(v.probes)
- RustBuffer.check_lower_OptionalTypeOidcConfig(v.oidc)
- end
-
- def self.alloc_from_TypePoolTemplate(v)
- RustBuffer.allocWithBuilder do |builder|
- builder.write_TypePoolTemplate(v)
- return builder.finalize
- end
- end
-
- def consumeIntoTypePoolTemplate
- consumeWithStream do |stream|
- return stream.readTypePoolTemplate
- end
- end
-
# The Record type SandboxService.
def self.check_lower_TypeSandboxService(v)
@@ -1107,10 +1033,6 @@ class RustBufferStream
unpack_from 4, 'L>'
end
- def readU64
- unpack_from 8, 'Q>'
- end
-
def readBool
v = unpack_from 1, 'c'
@@ -1238,17 +1160,6 @@ class RustBufferStream
)
end
- # The Record type OSGymWorkspacePoolStatus.
-
- def readTypeOSGymWorkspacePoolStatus
- OSGymWorkspacePoolStatus.new(
- phase: readOptionalstring,
- total_count: readOptionalu32,
- available_count: readOptionalu32,
- claimed_count: readOptionalu32
- )
- end
-
# The Record type OidcConfig.
def readTypeOidcConfig
@@ -1261,36 +1172,6 @@ class RustBufferStream
)
end
- # The Record type PoolSpec.
-
- def readTypePoolSpec
- PoolSpec.new(
- replicas: readU32,
- template: readTypePoolTemplate,
- autoscaling: readOptionalTypeWarmPoolAutoscaling,
- services: readOptionalSequenceTypeSandboxService
- )
- end
-
- # The Record type PoolTemplate.
-
- def readTypePoolTemplate
- PoolTemplate.new(
- runtime: readOptionalTypeRuntimeKind,
- runtime_class_name: readOptionalstring,
- node_selector: readOptionalMapStringString,
- tolerations: readOptionalSequenceTypePreservedJson,
- command: readOptionalSequencestring,
- container_disk_image: readString,
- image_pull_secret: readOptionalstring,
- cpu_cores: readOptionalu32,
- memory: readOptionalstring,
- firmware: readOptionalTypeFirmware,
- probes: readOptionalTypePreservedJson,
- oidc: readOptionalTypeOidcConfig
- )
- end
-
# The Record type SandboxService.
def readTypeSandboxService
@@ -1812,11 +1693,6 @@ class RustBufferBuilder
pack_into(4, 'L>', v)
end
- def write_U64(v)
- v = CyclopsSdkSchema::uniffi_in_range(v, "u64", 0, 2**64)
- pack_into(8, 'Q>', v)
- end
-
def write_Bool(v)
pack_into(1, 'c', v ? 1 : 0)
end
@@ -1917,15 +1793,6 @@ class RustBufferBuilder
self.write_Optionalstring(v.selector)
end
- # The Record type OSGymWorkspacePoolStatus.
-
- def write_TypeOSGymWorkspacePoolStatus(v)
- self.write_Optionalstring(v.phase)
- self.write_Optionalu32(v.total_count)
- self.write_Optionalu32(v.available_count)
- self.write_Optionalu32(v.claimed_count)
- end
-
# The Record type OidcConfig.
def write_TypeOidcConfig(v)
@@ -1936,32 +1803,6 @@ class RustBufferBuilder
self.write_Optionalu32(v.refresh_interval_seconds)
end
- # The Record type PoolSpec.
-
- def write_TypePoolSpec(v)
- self.write_U32(v.replicas)
- self.write_TypePoolTemplate(v.template)
- self.write_OptionalTypeWarmPoolAutoscaling(v.autoscaling)
- self.write_OptionalSequenceTypeSandboxService(v.services)
- end
-
- # The Record type PoolTemplate.
-
- def write_TypePoolTemplate(v)
- self.write_OptionalTypeRuntimeKind(v.runtime)
- self.write_Optionalstring(v.runtime_class_name)
- self.write_OptionalMapStringString(v.node_selector)
- self.write_OptionalSequenceTypePreservedJson(v.tolerations)
- self.write_OptionalSequencestring(v.command)
- self.write_String(v.container_disk_image)
- self.write_Optionalstring(v.image_pull_secret)
- self.write_Optionalu32(v.cpu_cores)
- self.write_Optionalstring(v.memory)
- self.write_OptionalTypeFirmware(v.firmware)
- self.write_OptionalTypePreservedJson(v.probes)
- self.write_OptionalTypeOidcConfig(v.oidc)
- end
-
# The Record type SandboxService.
def write_TypeSandboxService(v)
@@ -2428,15 +2269,6 @@ module UniFFILib
attach_function :uniffi_cyclops_sdk_schema_fn_method_preservedjson_to_json,
[:uint64, RustCallStatus.by_ref],
RustBuffer.by_value
- attach_function :uniffi_cyclops_sdk_schema_fn_method_poolspec_uniffi_trait_eq_eq,
- [RustBuffer.by_value, RustBuffer.by_value, RustCallStatus.by_ref],
- :int8
- attach_function :uniffi_cyclops_sdk_schema_fn_method_poolspec_uniffi_trait_eq_ne,
- [RustBuffer.by_value, RustBuffer.by_value, RustCallStatus.by_ref],
- :int8
- attach_function :uniffi_cyclops_sdk_schema_fn_method_poolspec_uniffi_trait_hash,
- [RustBuffer.by_value, RustCallStatus.by_ref],
- :uint64
attach_function :ffi_cyclops_sdk_schema_rustbuffer_alloc,
[:uint64, RustCallStatus.by_ref],
RustBuffer.by_value
@@ -2942,125 +2774,6 @@ class WarmPoolAutoscaling
end
end
- # Record type OSGymWorkspacePoolStatus
-class OSGymWorkspacePoolStatus
- attr_reader :phase, :total_count, :available_count, :claimed_count
-
- def initialize(phase:, total_count:, available_count:, claimed_count:)
- @phase = phase
- @total_count = total_count
- @available_count = available_count
- @claimed_count = claimed_count
- end
-
- def ==(other)
- if @phase != other.phase
- return false
- end
- if @total_count != other.total_count
- return false
- end
- if @available_count != other.available_count
- return false
- end
- if @claimed_count != other.claimed_count
- return false
- end
-
- true
- end
-end
-
- # Record type PoolSpec
-class PoolSpec
- attr_reader :replicas, :template, :autoscaling, :services
-
- def initialize(replicas:, template:, autoscaling:, services:)
- @replicas = replicas
- @template = template
- @autoscaling = autoscaling
- @services = services
- end
-
- def ==(other)
- if @replicas != other.replicas
- return false
- end
- if @template != other.template
- return false
- end
- if @autoscaling != other.autoscaling
- return false
- end
- if @services != other.services
- return false
- end
-
- true
- end
-end
-
- # Record type PoolTemplate
-class PoolTemplate
- attr_reader :runtime, :runtime_class_name, :node_selector, :tolerations, :command, :container_disk_image, :image_pull_secret, :cpu_cores, :memory, :firmware, :probes, :oidc
-
- def initialize(runtime:, runtime_class_name:, node_selector:, tolerations:, command:, container_disk_image:, image_pull_secret:, cpu_cores:, memory:, firmware:, probes:, oidc:)
- @runtime = runtime
- @runtime_class_name = runtime_class_name
- @node_selector = node_selector
- @tolerations = tolerations
- @command = command
- @container_disk_image = container_disk_image
- @image_pull_secret = image_pull_secret
- @cpu_cores = cpu_cores
- @memory = memory
- @firmware = firmware
- @probes = probes
- @oidc = oidc
- end
-
- def ==(other)
- if @runtime != other.runtime
- return false
- end
- if @runtime_class_name != other.runtime_class_name
- return false
- end
- if @node_selector != other.node_selector
- return false
- end
- if @tolerations != other.tolerations
- return false
- end
- if @command != other.command
- return false
- end
- if @container_disk_image != other.container_disk_image
- return false
- end
- if @image_pull_secret != other.image_pull_secret
- return false
- end
- if @cpu_cores != other.cpu_cores
- return false
- end
- if @memory != other.memory
- return false
- end
- if @firmware != other.firmware
- return false
- end
- if @probes != other.probes
- return false
- end
- if @oidc != other.oidc
- return false
- end
-
- true
- end
-end
-
diff --git a/libs/fleet/sdk-bindings/ruby/cyclops_sdk/sdk.rb b/libs/fleet/sdk-bindings/ruby/cyclops_sdk/sdk.rb
index b9e5092dd6..99e4b7b419 100644
--- a/libs/fleet/sdk-bindings/ruby/cyclops_sdk/sdk.rb
+++ b/libs/fleet/sdk-bindings/ruby/cyclops_sdk/sdk.rb
@@ -216,7 +216,7 @@ private_constant :UniffiHandleMap
def self.check_lower_TypeCreatePoolRequest(v)
- RustBuffer.check_lower_TypePoolSpec(v.spec)
+ RustBuffer.check_lower_TypeOSGymSandboxWarmPoolSpec(v.spec)
end
def self.alloc_from_TypeCreatePoolRequest(v)
@@ -232,6 +232,27 @@ private_constant :UniffiHandleMap
end
end
+ # The Record type CreateTemplateRequest.
+
+ def self.check_lower_TypeCreateTemplateRequest(v)
+
+
+ RustBuffer.check_lower_TypeOSGymSandboxTemplateSpec(v.spec)
+ end
+
+ def self.alloc_from_TypeCreateTemplateRequest(v)
+ RustBuffer.allocWithBuilder do |builder|
+ builder.write_TypeCreateTemplateRequest(v)
+ return builder.finalize
+ end
+ end
+
+ def consumeIntoTypeCreateTemplateRequest
+ consumeWithStream do |stream|
+ return stream.readTypeCreateTemplateRequest
+ end
+ end
+
# The Record type CyclopsConfiguration.
def self.check_lower_TypeCyclopsConfiguration(v)
@@ -349,8 +370,8 @@ private_constant :UniffiHandleMap
RustBuffer.check_lower_TypeResourceMetadata(v.metadata)
- RustBuffer.check_lower_TypePoolSpec(v.spec)
- RustBuffer.check_lower_OptionalTypeOSGymWorkspacePoolStatus(v.status)
+ RustBuffer.check_lower_TypeOSGymSandboxWarmPoolSpec(v.spec)
+ RustBuffer.check_lower_OptionalTypeOSGymSandboxWarmPoolStatus(v.status)
end
def self.alloc_from_TypePool(v)
@@ -409,6 +430,28 @@ private_constant :UniffiHandleMap
end
end
+ # The Record type Template.
+
+ def self.check_lower_TypeTemplate(v)
+
+
+ RustBuffer.check_lower_TypeResourceMetadata(v.metadata)
+ RustBuffer.check_lower_TypeOSGymSandboxTemplateSpec(v.spec)
+ end
+
+ def self.alloc_from_TypeTemplate(v)
+ RustBuffer.allocWithBuilder do |builder|
+ builder.write_TypeTemplate(v)
+ return builder.finalize
+ end
+ end
+
+ def consumeIntoTypeTemplate
+ consumeWithStream do |stream|
+ return stream.readTypeTemplate
+ end
+ end
+
@@ -478,24 +521,24 @@ private_constant :UniffiHandleMap
end
end
- # The Optional<T> type for TypeOSGymWorkspacePoolStatus.
+ # The Optional<T> type for TypeOSGymSandboxWarmPoolStatus.
- def self.check_lower_OptionalTypeOSGymWorkspacePoolStatus(v)
+ def self.check_lower_OptionalTypeOSGymSandboxWarmPoolStatus(v)
if not v.nil?
- RustBuffer.check_lower_TypeOSGymWorkspacePoolStatus(v)
+ RustBuffer.check_lower_TypeOSGymSandboxWarmPoolStatus(v)
end
end
- def self.alloc_from_OptionalTypeOSGymWorkspacePoolStatus(v)
+ def self.alloc_from_OptionalTypeOSGymSandboxWarmPoolStatus(v)
RustBuffer.allocWithBuilder do |builder|
- builder.write_OptionalTypeOSGymWorkspacePoolStatus(v)
+ builder.write_OptionalTypeOSGymSandboxWarmPoolStatus(v)
return builder.finalize()
end
end
- def consumeIntoOptionalTypeOSGymWorkspacePoolStatus
+ def consumeIntoOptionalTypeOSGymSandboxWarmPoolStatus
consumeWithStream do |stream|
- return stream.readOptionalTypeOSGymWorkspacePoolStatus
+ return stream.readOptionalTypeOSGymSandboxWarmPoolStatus
end
end
@@ -604,6 +647,27 @@ private_constant :UniffiHandleMap
end
end
+ # The Sequence<T> type for TypeTemplate.
+
+ def self.check_lower_SequenceTypeTemplate(v)
+ v.each do |item|
+ RustBuffer.check_lower_TypeTemplate(item)
+ end
+ end
+
+ def self.alloc_from_SequenceTypeTemplate(v)
+ RustBuffer.allocWithBuilder do |builder|
+ builder.write_SequenceTypeTemplate(v)
+ return builder.finalize()
+ end
+ end
+
+ def consumeIntoSequenceTypeTemplate
+ consumeWithStream do |stream|
+ return stream.readSequenceTypeTemplate
+ end
+ end
+
# The Map<T> type for string.
def self.check_lower_MapStringString(v)
@@ -761,7 +825,17 @@ class RustBufferStream
def readTypeCreatePoolRequest
CreatePoolRequest.new(
namespace: readString,
- spec: readTypePoolSpec
+ spec: readTypeOSGymSandboxWarmPoolSpec
+ )
+ end
+
+ # The Record type CreateTemplateRequest.
+
+ def readTypeCreateTemplateRequest
+ CreateTemplateRequest.new(
+ namespace: readString,
+ name: readString,
+ spec: readTypeOSGymSandboxTemplateSpec
)
end
@@ -828,8 +902,8 @@ class RustBufferStream
api_version: readString,
kind: readString,
metadata: readTypeResourceMetadata,
- spec: readTypePoolSpec,
- status: readOptionalTypeOSGymWorkspacePoolStatus
+ spec: readTypeOSGymSandboxWarmPoolSpec,
+ status: readOptionalTypeOSGymSandboxWarmPoolStatus
)
end
@@ -854,6 +928,17 @@ class RustBufferStream
)
end
+ # The Record type Template.
+
+ def readTypeTemplate
+ Template.new(
+ api_version: readString,
+ kind: readString,
+ metadata: readTypeResourceMetadata,
+ spec: readTypeOSGymSandboxTemplateSpec
+ )
+ end
+
@@ -1002,17 +1087,17 @@ class RustBufferStream
end
end
- # The Optional<T> type for TypeOSGymWorkspacePoolStatus.
+ # The Optional<T> type for TypeOSGymSandboxWarmPoolStatus.
- def readOptionalTypeOSGymWorkspacePoolStatus
+ def readOptionalTypeOSGymSandboxWarmPoolStatus
flag = unpack_from 1, 'c'
if flag == 0
return nil
elsif flag == 1
- return readTypeOSGymWorkspacePoolStatus
+ return readTypeOSGymSandboxWarmPoolStatus
else
- raise InternalError, 'Unexpected flag byte for OptionalTypeOSGymWorkspacePoolStatus'
+ raise InternalError, 'Unexpected flag byte for OptionalTypeOSGymSandboxWarmPoolStatus'
end
end
@@ -1094,6 +1179,22 @@ class RustBufferStream
items
end
+ # The Sequence<T> type for TypeTemplate.
+
+ def readSequenceTypeTemplate
+ count = unpack_from 4, 'l>'
+
+ raise InternalError, 'Unexpected negative sequence length' if count.negative?
+
+ items = []
+
+ count.times do
+ items.append readTypeTemplate
+ end
+
+ items
+ end
+
# The Map<T> type for string.
def readMapStringString
@@ -1233,7 +1334,15 @@ class RustBufferBuilder
def write_TypeCreatePoolRequest(v)
self.write_String(v.namespace)
- self.write_TypePoolSpec(v.spec)
+ self.write_TypeOSGymSandboxWarmPoolSpec(v.spec)
+ end
+
+ # The Record type CreateTemplateRequest.
+
+ def write_TypeCreateTemplateRequest(v)
+ self.write_String(v.namespace)
+ self.write_String(v.name)
+ self.write_TypeOSGymSandboxTemplateSpec(v.spec)
end
# The Record type CyclopsConfiguration.
@@ -1288,8 +1397,8 @@ class RustBufferBuilder
self.write_String(v.api_version)
self.write_String(v.kind)
self.write_TypeResourceMetadata(v.metadata)
- self.write_TypePoolSpec(v.spec)
- self.write_OptionalTypeOSGymWorkspacePoolStatus(v.status)
+ self.write_TypeOSGymSandboxWarmPoolSpec(v.spec)
+ self.write_OptionalTypeOSGymSandboxWarmPoolStatus(v.status)
end
# The Record type ResourceMetadata.
@@ -1309,6 +1418,15 @@ class RustBufferBuilder
self.write_Sequencestring(v.services)
end
+ # The Record type Template.
+
+ def write_TypeTemplate(v)
+ self.write_String(v.api_version)
+ self.write_String(v.kind)
+ self.write_TypeResourceMetadata(v.metadata)
+ self.write_TypeOSGymSandboxTemplateSpec(v.spec)
+ end
+
@@ -1348,14 +1466,14 @@ class RustBufferBuilder
end
end
- # The Optional<T> type for TypeOSGymWorkspacePoolStatus.
+ # The Optional<T> type for TypeOSGymSandboxWarmPoolStatus.
- def write_OptionalTypeOSGymWorkspacePoolStatus(v)
+ def write_OptionalTypeOSGymSandboxWarmPoolStatus(v)
if v.nil?
pack_into(1, 'c', 0)
else
pack_into(1, 'c', 1)
- self.write_TypeOSGymWorkspacePoolStatus(v)
+ self.write_TypeOSGymSandboxWarmPoolStatus(v)
end
end
@@ -1410,6 +1528,16 @@ class RustBufferBuilder
end
end
+ # The Sequence<T> type for TypeTemplate.
+
+ def write_SequenceTypeTemplate(items)
+ pack_into(4, 'l>', items.size)
+
+ items.each do |item|
+ self.write_TypeTemplate(item)
+ end
+ end
+
# The Map<T> type for string.
def write_MapStringString(items)
@@ -1923,6 +2051,24 @@ module UniFFILib
attach_function :uniffi_cyclops_sdk_fn_method_cyclopsclient_service_request,
[:uint64, RustBuffer.by_value, RustBuffer.by_value, RustBuffer.by_value, RustBuffer.by_value, RustCallStatus.by_ref],
:uint64
+ attach_function :uniffi_cyclops_sdk_fn_method_cyclopsclient_create_template,
+ [:uint64, RustBuffer.by_value, RustCallStatus.by_ref],
+ :uint64
+ attach_function :uniffi_cyclops_sdk_fn_method_cyclopsclient_delete_template,
+ [:uint64, RustBuffer.by_value, RustCallStatus.by_ref],
+ :uint64
+ attach_function :uniffi_cyclops_sdk_fn_method_cyclopsclient_get_template,
+ [:uint64, RustBuffer.by_value, RustBuffer.by_value, RustCallStatus.by_ref],
+ :uint64
+ attach_function :uniffi_cyclops_sdk_fn_method_cyclopsclient_list_templates,
+ [:uint64, RustBuffer.by_value, RustCallStatus.by_ref],
+ :uint64
+ attach_function :uniffi_cyclops_sdk_fn_method_cyclopsclient_reconcile_template,
+ [:uint64, RustBuffer.by_value, RustCallStatus.by_ref],
+ :uint64
+ attach_function :uniffi_cyclops_sdk_fn_method_cyclopsclient_update_template,
+ [:uint64, RustBuffer.by_value, RustCallStatus.by_ref],
+ :uint64
attach_function :uniffi_cyclops_sdk_fn_clone_accesstokenprovider,
[:uint64, RustCallStatus.by_ref],
:uint64
@@ -2032,6 +2178,24 @@ module UniFFILib
attach_function :uniffi_cyclops_sdk_checksum_method_cyclopsclient_service_request,
[RustCallStatus.by_ref],
:uint16
+ attach_function :uniffi_cyclops_sdk_checksum_method_cyclopsclient_create_template,
+ [RustCallStatus.by_ref],
+ :uint16
+ attach_function :uniffi_cyclops_sdk_checksum_method_cyclopsclient_delete_template,
+ [RustCallStatus.by_ref],
+ :uint16
+ attach_function :uniffi_cyclops_sdk_checksum_method_cyclopsclient_get_template,
+ [RustCallStatus.by_ref],
+ :uint16
+ attach_function :uniffi_cyclops_sdk_checksum_method_cyclopsclient_list_templates,
+ [RustCallStatus.by_ref],
+ :uint16
+ attach_function :uniffi_cyclops_sdk_checksum_method_cyclopsclient_reconcile_template,
+ [RustCallStatus.by_ref],
+ :uint16
+ attach_function :uniffi_cyclops_sdk_checksum_method_cyclopsclient_update_template,
+ [RustCallStatus.by_ref],
+ :uint16
attach_function :uniffi_cyclops_sdk_checksum_method_accesstokenprovider_get_access_token,
[RustCallStatus.by_ref],
:uint16
@@ -2149,6 +2313,31 @@ class CreatePoolRequest
end
end
+ # Record type CreateTemplateRequest
+class CreateTemplateRequest
+ attr_reader :namespace, :name, :spec
+
+ def initialize(namespace:, name:, spec:)
+ @namespace = namespace
+ @name = name
+ @spec = spec
+ end
+
+ def ==(other)
+ if @namespace != other.namespace
+ return false
+ end
+ if @name != other.name
+ return false
+ end
+ if @spec != other.spec
+ return false
+ end
+
+ true
+ end
+end
+
# Record type CyclopsConfiguration
class CyclopsConfiguration
attr_reader :base_url, :token_url, :credentials, :pool_poll_interval_ms, :pool_poll_limit, :claim_poll_interval_ms, :claim_poll_limit
@@ -2385,6 +2574,35 @@ class Sandbox
end
end
+ # Record type Template
+class Template
+ attr_reader :api_version, :kind, :metadata, :spec
+
+ def initialize(api_version:, kind:, metadata:, spec:)
+ @api_version = api_version
+ @kind = kind
+ @metadata = metadata
+ @spec = spec
+ end
+
+ def ==(other)
+ if @api_version != other.api_version
+ return false
+ end
+ if @kind != other.kind
+ return false
+ end
+ if @metadata != other.metadata
+ return false
+ end
+ if @spec != other.spec
+ return false
+ end
+
+ true
+ end
+end
+
@@ -2629,6 +2847,68 @@ end
)
return result.consumeIntoTypeHttpResponse
end
+ def create_template(request)
+ request = request
+ RustBuffer.check_lower_TypeCreateTemplateRequest(request)
+ result = FleetSdk.uniffi_rust_future_rust_buffer(
+ SdkError,
+ UniFFILib.uniffi_cyclops_sdk_fn_method_cyclopsclient_create_template(uniffi_clone_handle(),RustBuffer.alloc_from_TypeCreateTemplateRequest(request),RustCallStatus.new),
+ )
+ return result.consumeIntoTypeTemplate
+ end
+ def delete_template(template)
+ template = template
+ RustBuffer.check_lower_TypeTemplate(template)
+ FleetSdk.uniffi_rust_future_void(
+ SdkError,
+ UniFFILib.uniffi_cyclops_sdk_fn_method_cyclopsclient_delete_template(uniffi_clone_handle(),RustBuffer.alloc_from_TypeTemplate(template),RustCallStatus.new),
+ )
+ end
+
+ def get_template(namespace, name)
+ namespace = FleetSdk::uniffi_utf8(namespace)
+
+ name = FleetSdk::uniffi_utf8(name)
+
+ result = FleetSdk.uniffi_rust_future_rust_buffer(
+
+ SdkError,
+
+ UniFFILib.uniffi_cyclops_sdk_fn_method_cyclopsclient_get_template(uniffi_clone_handle(),RustBuffer.allocFromString(namespace),RustBuffer.allocFromString(name),RustCallStatus.new),
+
+ )
+ return result.consumeIntoTypeTemplate
+ end
+ def list_templates(namespace)
+ namespace = FleetSdk::uniffi_utf8(namespace)
+
+ result = FleetSdk.uniffi_rust_future_rust_buffer(
+
+ SdkError,
+
+ UniFFILib.uniffi_cyclops_sdk_fn_method_cyclopsclient_list_templates(uniffi_clone_handle(),RustBuffer.allocFromString(namespace),RustCallStatus.new),
+
+ )
+ return result.consumeIntoSequenceTypeTemplate
+ end
+ def reconcile_template(request)
+ request = request
+ RustBuffer.check_lower_TypeCreateTemplateRequest(request)
+ result = FleetSdk.uniffi_rust_future_rust_buffer(
+ SdkError,
+ UniFFILib.uniffi_cyclops_sdk_fn_method_cyclopsclient_reconcile_template(uniffi_clone_handle(),RustBuffer.alloc_from_TypeCreateTemplateRequest(request),RustCallStatus.new),
+ )
+ return result.consumeIntoTypeTemplate
+ end
+ def update_template(template)
+ template = template
+ RustBuffer.check_lower_TypeTemplate(template)
+ result = FleetSdk.uniffi_rust_future_rust_buffer(
+ SdkError,
+ UniFFILib.uniffi_cyclops_sdk_fn_method_cyclopsclient_update_template(uniffi_clone_handle(),RustBuffer.alloc_from_TypeTemplate(template),RustCallStatus.new),
+ )
+ return result.consumeIntoTypeTemplate
+ end
end
diff --git a/libs/fleet/sdk-bindings/ruby/tests/test_async_client.rb b/libs/fleet/sdk-bindings/ruby/tests/test_async_client.rb
index 8f08a5dda4..3e55918ad0 100644
--- a/libs/fleet/sdk-bindings/ruby/tests/test_async_client.rb
+++ b/libs/fleet/sdk-bindings/ruby/tests/test_async_client.rb
@@ -7,7 +7,11 @@ TOKEN = 'https://keycloak.invalid/token'
JSON_HEADERS = [['accept', 'application/json'], ['content-type', 'application/json'], ['authorization', 'Bearer offline-token']]
def pool_json
- { apiVersion: 'cua.ai/v1', kind: 'OSGymWorkspacePool', metadata: { namespace: 'default', name: 'default', labels: nil }, spec: { replicas: 1, template: { containerDiskImage: 'registry.example/desktop:offline' }, services: [{ name: 'mcp', targetPort: 8080 }] }, status: nil }
+ { apiVersion: 'osgym.cua.ai/v1alpha1', kind: 'OSGymSandboxWarmPool', metadata: { namespace: 'default', name: 'default', labels: nil }, spec: { replicas: 1, sandboxTemplateRef: { name: 'default' } }, status: nil }
+end
+
+def template_json
+ { apiVersion: 'osgym.cua.ai/v1alpha1', kind: 'OSGymSandboxTemplate', metadata: { namespace: 'default', name: 'default', labels: nil }, spec: { vmTemplate: { containerDiskImage: 'registry.example/desktop:offline', services: [{ name: 'mcp', targetPort: 8080 }] } } }
end
def claim_json(bound = false)
@@ -25,7 +29,8 @@ def service_expected(body, response)
end
def lifecycle_queue
- pool_url = "#{BASE}/api/k8s/apis/cua.ai/v1/namespaces/default/osgymworkspacepools/default"
+ pool_url = "#{BASE}/api/k8s/apis/osgym.cua.ai/v1alpha1/namespaces/default/osgymsandboxwarmpools/default"
+ template_url = "#{BASE}/api/k8s/apis/osgym.cua.ai/v1alpha1/namespaces/default/osgymsandboxtemplates/default"
claim_url = "#{BASE}/api/k8s/apis/osgym.cua.ai/v1alpha1/namespaces/default/osgymsandboxclaims/default"
pool_body = JSON.generate(pool_json).b
claim_body = '{"apiVersion":"osgym.cua.ai/v1alpha1","kind":"OSGymSandboxClaim","metadata":{"namespace":"default","name":"claim-1","labels":null},"spec":{"sandboxTemplateRef":{"name":"default"}},"status":null}'.b
@@ -35,7 +40,7 @@ def lifecycle_queue
Expected.new('POST', pool_url.sub(%r{/default\z}, ''), JSON_HEADERS, pool_body, 201, pool_json),
Expected.new('POST', claim_url.sub(%r{/default\z}, ''), JSON_HEADERS, claim_body, 201, claim_json),
Expected.new('GET', claim_url, JSON_HEADERS, nil, 200, claim_json(true)),
- Expected.new('GET', pool_url, JSON_HEADERS, nil, 200, pool_json),
+ Expected.new('GET', template_url, JSON_HEADERS, nil, 200, template_json),
service_expected('{"offline":true}'.b, 'offline service accepted'),
Expected.new('DELETE', claim_url, JSON_HEADERS, nil, 204, ''),
Expected.new('DELETE', pool_url, JSON_HEADERS, nil, 204, ''),
@@ -85,8 +90,7 @@ def service_request(body)
end
sandbox = FleetSdk::Sandbox.new(namespace: 'default', claim: 'default', name: 'offline-sandbox', services: ['mcp'])
-vm_template = FleetSdk::VmTemplate.new(container_disk_image: 'registry.example/desktop:offline', command: nil, runtime: nil, runtime_class_name: nil, node_selector: nil, tolerations: nil, image_pull_policy: nil, image_pull_secret: nil, cpu_cores: nil, memory: nil, firmware: nil, probes: nil, services: nil, oidc: nil)
-spec = FleetSdk::PoolSpec.new(replicas: 1, template: FleetSdk::PoolTemplate.new(runtime: nil, runtime_class_name: nil, node_selector: nil, tolerations: nil, command: nil, container_disk_image: vm_template.container_disk_image, image_pull_secret: nil, cpu_cores: nil, memory: nil, firmware: nil, probes: nil, oidc: nil), autoscaling: nil, services: [FleetSdk::SandboxService.new(name: 'mcp', target_port: 8080, protocol: nil)])
+spec = FleetSdk::OSGymSandboxWarmPoolSpec.new(replicas: 1, sandbox_template_ref: FleetSdk::SandboxTemplateRef.new(name: 'default'), autoscaling: nil)
transport = ScriptedHttpClient.new(lifecycle_queue)
client = FleetSdk::CyclopsClient.connect(configuration, transport)
pool = client.create_pool(FleetSdk::CreatePoolRequest.new(namespace: 'default', spec: spec))
diff --git a/libs/fleet/sdk-bindings/swift/CyclopsSdk.swift b/libs/fleet/sdk-bindings/swift/CyclopsSdk.swift
index eb2e244281..4114f36a71 100644
--- a/libs/fleet/sdk-bindings/swift/CyclopsSdk.swift
+++ b/libs/fleet/sdk-bindings/swift/CyclopsSdk.swift
@@ -796,6 +796,18 @@ public protocol CyclopsClientProtocol: AnyObject, Sendable {
func serviceRequest(sandbox: Sandbox, service: String, path: String, request: HttpRequest) async throws -> HttpResponse
+ func createTemplate(request: CreateTemplateRequest) async throws -> Template
+
+ func deleteTemplate(template: Template) async throws
+
+ func getTemplate(namespace: String, name: String) async throws -> Template
+
+ func listTemplates(namespace: String) async throws -> [Template]
+
+ func reconcileTemplate(request: CreateTemplateRequest) async throws -> Template
+
+ func updateTemplate(template: Template) async throws -> Template
+
}
open class CyclopsClient: CyclopsClientProtocol, @unchecked Sendable {
fileprivate let handle: UInt64
@@ -1118,6 +1130,108 @@ open func serviceRequest(sandbox: Sandbox, service: String, path: String, reques
)
}
+open func createTemplate(request: CreateTemplateRequest)async throws -> Template {
+ return
+ try await uniffiRustCallAsync(
+ rustFutureFunc: {
+ uniffi_cyclops_sdk_fn_method_cyclopsclient_create_template(
+ self.uniffiCloneHandle(),
+ FfiConverterTypeCreateTemplateRequest_lower(request)
+ )
+ },
+ pollFunc: ffi_cyclops_sdk_rust_future_poll_rust_buffer,
+ completeFunc: ffi_cyclops_sdk_rust_future_complete_rust_buffer,
+ freeFunc: ffi_cyclops_sdk_rust_future_free_rust_buffer,
+ liftFunc: FfiConverterTypeTemplate_lift,
+ errorHandler: FfiConverterTypeSdkError_lift
+ )
+}
+
+open func deleteTemplate(template: Template)async throws {
+ return
+ try await uniffiRustCallAsync(
+ rustFutureFunc: {
+ uniffi_cyclops_sdk_fn_method_cyclopsclient_delete_template(
+ self.uniffiCloneHandle(),
+ FfiConverterTypeTemplate_lower(template)
+ )
+ },
+ pollFunc: ffi_cyclops_sdk_rust_future_poll_void,
+ completeFunc: ffi_cyclops_sdk_rust_future_complete_void,
+ freeFunc: ffi_cyclops_sdk_rust_future_free_void,
+ liftFunc: { $0 },
+ errorHandler: FfiConverterTypeSdkError_lift
+ )
+}
+
+open func getTemplate(namespace: String, name: String)async throws -> Template {
+ return
+ try await uniffiRustCallAsync(
+ rustFutureFunc: {
+ uniffi_cyclops_sdk_fn_method_cyclopsclient_get_template(
+ self.uniffiCloneHandle(),
+ FfiConverterString.lower(namespace),FfiConverterString.lower(name)
+ )
+ },
+ pollFunc: ffi_cyclops_sdk_rust_future_poll_rust_buffer,
+ completeFunc: ffi_cyclops_sdk_rust_future_complete_rust_buffer,
+ freeFunc: ffi_cyclops_sdk_rust_future_free_rust_buffer,
+ liftFunc: FfiConverterTypeTemplate_lift,
+ errorHandler: FfiConverterTypeSdkError_lift
+ )
+}
+
+open func listTemplates(namespace: String)async throws -> [Template] {
+ return
+ try await uniffiRustCallAsync(
+ rustFutureFunc: {
+ uniffi_cyclops_sdk_fn_method_cyclopsclient_list_templates(
+ self.uniffiCloneHandle(),
+ FfiConverterString.lower(namespace)
+ )
+ },
+ pollFunc: ffi_cyclops_sdk_rust_future_poll_rust_buffer,
+ completeFunc: ffi_cyclops_sdk_rust_future_complete_rust_buffer,
+ freeFunc: ffi_cyclops_sdk_rust_future_free_rust_buffer,
+ liftFunc: FfiConverterSequenceTypeTemplate.lift,
+ errorHandler: FfiConverterTypeSdkError_lift
+ )
+}
+
+open func reconcileTemplate(request: CreateTemplateRequest)async throws -> Template {
+ return
+ try await uniffiRustCallAsync(
+ rustFutureFunc: {
+ uniffi_cyclops_sdk_fn_method_cyclopsclient_reconcile_template(
+ self.uniffiCloneHandle(),
+ FfiConverterTypeCreateTemplateRequest_lower(request)
+ )
+ },
+ pollFunc: ffi_cyclops_sdk_rust_future_poll_rust_buffer,
+ completeFunc: ffi_cyclops_sdk_rust_future_complete_rust_buffer,
+ freeFunc: ffi_cyclops_sdk_rust_future_free_rust_buffer,
+ liftFunc: FfiConverterTypeTemplate_lift,
+ errorHandler: FfiConverterTypeSdkError_lift
+ )
+}
+
+open func updateTemplate(template: Template)async throws -> Template {
+ return
+ try await uniffiRustCallAsync(
+ rustFutureFunc: {
+ uniffi_cyclops_sdk_fn_method_cyclopsclient_update_template(
+ self.uniffiCloneHandle(),
+ FfiConverterTypeTemplate_lower(template)
+ )
+ },
+ pollFunc: ffi_cyclops_sdk_rust_future_poll_rust_buffer,
+ completeFunc: ffi_cyclops_sdk_rust_future_complete_rust_buffer,
+ freeFunc: ffi_cyclops_sdk_rust_future_free_rust_buffer,
+ liftFunc: FfiConverterTypeTemplate_lift,
+ errorHandler: FfiConverterTypeSdkError_lift
+ )
+}
+
}
@@ -1617,11 +1731,11 @@ public func FfiConverterTypeCreateClaimRequest_lower(_ value: CreateClaimRequest
public struct CreatePoolRequest: Equatable, Hashable {
public var namespace: String
- public var spec: PoolSpec
+ public var spec: OsGymSandboxWarmPoolSpec
// Default memberwise initializers are never public by default, so we
// declare one manually.
- public init(namespace: String, spec: PoolSpec) {
+ public init(namespace: String, spec: OsGymSandboxWarmPoolSpec) {
self.namespace = namespace
self.spec = spec
}
@@ -1643,13 +1757,13 @@ public struct FfiConverterTypeCreatePoolRequest: FfiConverterRustBuffer {
return
try CreatePoolRequest(
namespace: FfiConverterString.read(from: &buf),
- spec: FfiConverterTypePoolSpec.read(from: &buf)
+ spec: FfiConverterTypeOSGymSandboxWarmPoolSpec.read(from: &buf)
)
}
public static func write(_ value: CreatePoolRequest, into buf: inout [UInt8]) {
FfiConverterString.write(value.namespace, into: &buf)
- FfiConverterTypePoolSpec.write(value.spec, into: &buf)
+ FfiConverterTypeOSGymSandboxWarmPoolSpec.write(value.spec, into: &buf)
}
}
@@ -1669,6 +1783,64 @@ public func FfiConverterTypeCreatePoolRequest_lower(_ value: CreatePoolRequest)
}
+public struct CreateTemplateRequest {
+ public var namespace: String
+ public var name: String
+ public var spec: OsGymSandboxTemplateSpec
+
+ // Default memberwise initializers are never public by default, so we
+ // declare one manually.
+ public init(namespace: String, name: String, spec: OsGymSandboxTemplateSpec) {
+ self.namespace = namespace
+ self.name = name
+ self.spec = spec
+ }
+
+
+
+
+}
+
+#if compiler(>=6)
+extension CreateTemplateRequest: Sendable {}
+#endif
+
+#if swift(>=5.8)
+@_documentation(visibility: private)
+#endif
+public struct FfiConverterTypeCreateTemplateRequest: FfiConverterRustBuffer {
+ public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> CreateTemplateRequest {
+ return
+ try CreateTemplateRequest(
+ namespace: FfiConverterString.read(from: &buf),
+ name: FfiConverterString.read(from: &buf),
+ spec: FfiConverterTypeOSGymSandboxTemplateSpec.read(from: &buf)
+ )
+ }
+
+ public static func write(_ value: CreateTemplateRequest, into buf: inout [UInt8]) {
+ FfiConverterString.write(value.namespace, into: &buf)
+ FfiConverterString.write(value.name, into: &buf)
+ FfiConverterTypeOSGymSandboxTemplateSpec.write(value.spec, into: &buf)
+ }
+}
+
+
+#if swift(>=5.8)
+@_documentation(visibility: private)
+#endif
+public func FfiConverterTypeCreateTemplateRequest_lift(_ buf: RustBuffer) throws -> CreateTemplateRequest {
+ return try FfiConverterTypeCreateTemplateRequest.lift(buf)
+}
+
+#if swift(>=5.8)
+@_documentation(visibility: private)
+#endif
+public func FfiConverterTypeCreateTemplateRequest_lower(_ value: CreateTemplateRequest) -> RustBuffer {
+ return FfiConverterTypeCreateTemplateRequest.lower(value)
+}
+
+
public struct CyclopsConfiguration {
public var baseUrl: String
public var tokenUrl: String
@@ -1985,18 +2157,23 @@ public func FfiConverterTypeHttpResponse_lower(_ value: HttpResponse) -> RustBuf
/**
* UniFFI cannot emit aliases for external record types. Generated bindings use
- * `OSGymWorkspacePoolStatus` and `OSGymSandboxClaimStatus` from cyclops_sdk_schema.
+ * `OSGymSandboxWarmPoolStatus` and `OSGymSandboxClaimStatus` from cyclops_sdk_schema.
+ *
+ * A `Pool` is the `osgym.cua.ai/v1alpha1 OSGymSandboxWarmPool` CR verbatim —
+ * the SDK is a naive CRUD mapper over the native CRDs, with no translation
+ * layer (the legacy `cua.ai/v1 OSGymWorkspacePool` and its operator compat
+ * shim are gone).
*/
public struct Pool: Equatable, Hashable {
public var apiVersion: String
public var kind: String
public var metadata: ResourceMetadata
- public var spec: PoolSpec
- public var status: OsGymWorkspacePoolStatus?
+ public var spec: OsGymSandboxWarmPoolSpec
+ public var status: OsGymSandboxWarmPoolStatus?
// Default memberwise initializers are never public by default, so we
// declare one manually.
- public init(apiVersion: String, kind: String, metadata: ResourceMetadata, spec: PoolSpec, status: OsGymWorkspacePoolStatus?) {
+ public init(apiVersion: String, kind: String, metadata: ResourceMetadata, spec: OsGymSandboxWarmPoolSpec, status: OsGymSandboxWarmPoolStatus?) {
self.apiVersion = apiVersion
self.kind = kind
self.metadata = metadata
@@ -2023,8 +2200,8 @@ public struct FfiConverterTypePool: FfiConverterRustBuffer {
apiVersion: FfiConverterString.read(from: &buf),
kind: FfiConverterString.read(from: &buf),
metadata: FfiConverterTypeResourceMetadata.read(from: &buf),
- spec: FfiConverterTypePoolSpec.read(from: &buf),
- status: FfiConverterOptionTypeOSGymWorkspacePoolStatus.read(from: &buf)
+ spec: FfiConverterTypeOSGymSandboxWarmPoolSpec.read(from: &buf),
+ status: FfiConverterOptionTypeOSGymSandboxWarmPoolStatus.read(from: &buf)
)
}
@@ -2032,8 +2209,8 @@ public struct FfiConverterTypePool: FfiConverterRustBuffer {
FfiConverterString.write(value.apiVersion, into: &buf)
FfiConverterString.write(value.kind, into: &buf)
FfiConverterTypeResourceMetadata.write(value.metadata, into: &buf)
- FfiConverterTypePoolSpec.write(value.spec, into: &buf)
- FfiConverterOptionTypeOSGymWorkspacePoolStatus.write(value.status, into: &buf)
+ FfiConverterTypeOSGymSandboxWarmPoolSpec.write(value.spec, into: &buf)
+ FfiConverterOptionTypeOSGymSandboxWarmPoolStatus.write(value.status, into: &buf)
}
}
@@ -2173,6 +2350,72 @@ public func FfiConverterTypeSandbox_lower(_ value: Sandbox) -> RustBuffer {
}
+/**
+ * The `osgym.cua.ai/v1alpha1 OSGymSandboxTemplate` CR verbatim. Warm pools
+ * and claims reference one by name via `spec.sandboxTemplateRef.name`.
+ */
+public struct Template {
+ public var apiVersion: String
+ public var kind: String
+ public var metadata: ResourceMetadata
+ public var spec: OsGymSandboxTemplateSpec
+
+ // Default memberwise initializers are never public by default, so we
+ // declare one manually.
+ public init(apiVersion: String, kind: String, metadata: ResourceMetadata, spec: OsGymSandboxTemplateSpec) {
+ self.apiVersion = apiVersion
+ self.kind = kind
+ self.metadata = metadata
+ self.spec = spec
+ }
+
+
+
+
+}
+
+#if compiler(>=6)
+extension Template: Sendable {}
+#endif
+
+#if swift(>=5.8)
+@_documentation(visibility: private)
+#endif
+public struct FfiConverterTypeTemplate: FfiConverterRustBuffer {
+ public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> Template {
+ return
+ try Template(
+ apiVersion: FfiConverterString.read(from: &buf),
+ kind: FfiConverterString.read(from: &buf),
+ metadata: FfiConverterTypeResourceMetadata.read(from: &buf),
+ spec: FfiConverterTypeOSGymSandboxTemplateSpec.read(from: &buf)
+ )
+ }
+
+ public static func write(_ value: Template, into buf: inout [UInt8]) {
+ FfiConverterString.write(value.apiVersion, into: &buf)
+ FfiConverterString.write(value.kind, into: &buf)
+ FfiConverterTypeResourceMetadata.write(value.metadata, into: &buf)
+ FfiConverterTypeOSGymSandboxTemplateSpec.write(value.spec, into: &buf)
+ }
+}
+
+
+#if swift(>=5.8)
+@_documentation(visibility: private)
+#endif
+public func FfiConverterTypeTemplate_lift(_ buf: RustBuffer) throws -> Template {
+ return try FfiConverterTypeTemplate.lift(buf)
+}
+
+#if swift(>=5.8)
+@_documentation(visibility: private)
+#endif
+public func FfiConverterTypeTemplate_lower(_ value: Template) -> RustBuffer {
+ return FfiConverterTypeTemplate.lower(value)
+}
+
+
public enum AccessTokenProviderError: Swift.Error, Equatable, Hashable, Foundation.LocalizedError {
@@ -2567,8 +2810,8 @@ fileprivate struct FfiConverterOptionTypeOSGymSandboxClaimStatus: FfiConverterRu
#if swift(>=5.8)
@_documentation(visibility: private)
#endif
-fileprivate struct FfiConverterOptionTypeOSGymWorkspacePoolStatus: FfiConverterRustBuffer {
- typealias SwiftType = OsGymWorkspacePoolStatus?
+fileprivate struct FfiConverterOptionTypeOSGymSandboxWarmPoolStatus: FfiConverterRustBuffer {
+ typealias SwiftType = OsGymSandboxWarmPoolStatus?
public static func write(_ value: SwiftType, into buf: inout [UInt8]) {
guard let value = value else {
@@ -2576,13 +2819,13 @@ fileprivate struct FfiConverterOptionTypeOSGymWorkspacePoolStatus: FfiConverterR
return
}
writeInt(&buf, Int8(1))
- FfiConverterTypeOSGymWorkspacePoolStatus.write(value, into: &buf)
+ FfiConverterTypeOSGymSandboxWarmPoolStatus.write(value, into: &buf)
}
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SwiftType {
switch try readInt(&buf) as Int8 {
case 0: return nil
- case 1: return try FfiConverterTypeOSGymWorkspacePoolStatus.read(from: &buf)
+ case 1: return try FfiConverterTypeOSGymSandboxWarmPoolStatus.read(from: &buf)
default: throw UniffiInternalError.unexpectedOptionalTag
}
}
@@ -2712,6 +2955,31 @@ fileprivate struct FfiConverterSequenceTypePool: FfiConverterRustBuffer {
}
}
+#if swift(>=5.8)
+@_documentation(visibility: private)
+#endif
+fileprivate struct FfiConverterSequenceTypeTemplate: FfiConverterRustBuffer {
+ typealias SwiftType = [Template]
+
+ public static func write(_ value: [Template], into buf: inout [UInt8]) {
+ let len = Int32(value.count)
+ writeInt(&buf, len)
+ for item in value {
+ FfiConverterTypeTemplate.write(item, into: &buf)
+ }
+ }
+
+ public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> [Template] {
+ let len: Int32 = try readInt(&buf)
+ var seq = [Template]()
+ seq.reserveCapacity(Int(len))
+ for _ in 0 ..< len {
+ seq.append(try FfiConverterTypeTemplate.read(from: &buf))
+ }
+ return seq
+ }
+}
+
#if swift(>=5.8)
@_documentation(visibility: private)
#endif
@@ -2927,6 +3195,24 @@ private let initializationResult: InitializationResult = {
if (uniffi_cyclops_sdk_checksum_method_cyclopsclient_service_request() != 46699) {
return InitializationResult.apiChecksumMismatch
}
+ if (uniffi_cyclops_sdk_checksum_method_cyclopsclient_create_template() != 13689) {
+ return InitializationResult.apiChecksumMismatch
+ }
+ if (uniffi_cyclops_sdk_checksum_method_cyclopsclient_delete_template() != 54852) {
+ return InitializationResult.apiChecksumMismatch
+ }
+ if (uniffi_cyclops_sdk_checksum_method_cyclopsclient_get_template() != 8909) {
+ return InitializationResult.apiChecksumMismatch
+ }
+ if (uniffi_cyclops_sdk_checksum_method_cyclopsclient_list_templates() != 58376) {
+ return InitializationResult.apiChecksumMismatch
+ }
+ if (uniffi_cyclops_sdk_checksum_method_cyclopsclient_reconcile_template() != 36469) {
+ return InitializationResult.apiChecksumMismatch
+ }
+ if (uniffi_cyclops_sdk_checksum_method_cyclopsclient_update_template() != 18704) {
+ return InitializationResult.apiChecksumMismatch
+ }
if (uniffi_cyclops_sdk_checksum_method_accesstokenprovider_get_access_token() != 1180) {
return InitializationResult.apiChecksumMismatch
}
diff --git a/libs/fleet/sdk-bindings/swift/CyclopsSdkFFI.h b/libs/fleet/sdk-bindings/swift/CyclopsSdkFFI.h
index 2fdd3b12f5..8c7cb53abe 100644
--- a/libs/fleet/sdk-bindings/swift/CyclopsSdkFFI.h
+++ b/libs/fleet/sdk-bindings/swift/CyclopsSdkFFI.h
@@ -378,6 +378,36 @@ uint64_t uniffi_cyclops_sdk_fn_method_cyclopsclient_update_pool(uint64_t ptr, Ru
uint64_t uniffi_cyclops_sdk_fn_method_cyclopsclient_service_request(uint64_t ptr, RustBuffer sandbox, RustBuffer service, RustBuffer path, RustBuffer request
);
#endif
+#ifndef UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_FN_METHOD_CYCLOPSCLIENT_CREATE_TEMPLATE
+#define UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_FN_METHOD_CYCLOPSCLIENT_CREATE_TEMPLATE
+uint64_t uniffi_cyclops_sdk_fn_method_cyclopsclient_create_template(uint64_t ptr, RustBuffer request
+);
+#endif
+#ifndef UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_FN_METHOD_CYCLOPSCLIENT_DELETE_TEMPLATE
+#define UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_FN_METHOD_CYCLOPSCLIENT_DELETE_TEMPLATE
+uint64_t uniffi_cyclops_sdk_fn_method_cyclopsclient_delete_template(uint64_t ptr, RustBuffer template
+);
+#endif
+#ifndef UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_FN_METHOD_CYCLOPSCLIENT_GET_TEMPLATE
+#define UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_FN_METHOD_CYCLOPSCLIENT_GET_TEMPLATE
+uint64_t uniffi_cyclops_sdk_fn_method_cyclopsclient_get_template(uint64_t ptr, RustBuffer namespace, RustBuffer name
+);
+#endif
+#ifndef UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_FN_METHOD_CYCLOPSCLIENT_LIST_TEMPLATES
+#define UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_FN_METHOD_CYCLOPSCLIENT_LIST_TEMPLATES
+uint64_t uniffi_cyclops_sdk_fn_method_cyclopsclient_list_templates(uint64_t ptr, RustBuffer namespace
+);
+#endif
+#ifndef UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_FN_METHOD_CYCLOPSCLIENT_RECONCILE_TEMPLATE
+#define UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_FN_METHOD_CYCLOPSCLIENT_RECONCILE_TEMPLATE
+uint64_t uniffi_cyclops_sdk_fn_method_cyclopsclient_reconcile_template(uint64_t ptr, RustBuffer request
+);
+#endif
+#ifndef UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_FN_METHOD_CYCLOPSCLIENT_UPDATE_TEMPLATE
+#define UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_FN_METHOD_CYCLOPSCLIENT_UPDATE_TEMPLATE
+uint64_t uniffi_cyclops_sdk_fn_method_cyclopsclient_update_template(uint64_t ptr, RustBuffer template
+);
+#endif
#ifndef UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_FN_CLONE_ACCESSTOKENPROVIDER
#define UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_FN_CLONE_ACCESSTOKENPROVIDER
uint64_t uniffi_cyclops_sdk_fn_clone_accesstokenprovider(uint64_t handle, RustCallStatus *_Nonnull out_status
@@ -763,6 +793,42 @@ uint16_t uniffi_cyclops_sdk_checksum_method_cyclopsclient_update_pool(void
#define UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_CHECKSUM_METHOD_CYCLOPSCLIENT_SERVICE_REQUEST
uint16_t uniffi_cyclops_sdk_checksum_method_cyclopsclient_service_request(void
+);
+#endif
+#ifndef UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_CHECKSUM_METHOD_CYCLOPSCLIENT_CREATE_TEMPLATE
+#define UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_CHECKSUM_METHOD_CYCLOPSCLIENT_CREATE_TEMPLATE
+uint16_t uniffi_cyclops_sdk_checksum_method_cyclopsclient_create_template(void
+
+);
+#endif
+#ifndef UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_CHECKSUM_METHOD_CYCLOPSCLIENT_DELETE_TEMPLATE
+#define UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_CHECKSUM_METHOD_CYCLOPSCLIENT_DELETE_TEMPLATE
+uint16_t uniffi_cyclops_sdk_checksum_method_cyclopsclient_delete_template(void
+
+);
+#endif
+#ifndef UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_CHECKSUM_METHOD_CYCLOPSCLIENT_GET_TEMPLATE
+#define UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_CHECKSUM_METHOD_CYCLOPSCLIENT_GET_TEMPLATE
+uint16_t uniffi_cyclops_sdk_checksum_method_cyclopsclient_get_template(void
+
+);
+#endif
+#ifndef UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_CHECKSUM_METHOD_CYCLOPSCLIENT_LIST_TEMPLATES
+#define UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_CHECKSUM_METHOD_CYCLOPSCLIENT_LIST_TEMPLATES
+uint16_t uniffi_cyclops_sdk_checksum_method_cyclopsclient_list_templates(void
+
+);
+#endif
+#ifndef UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_CHECKSUM_METHOD_CYCLOPSCLIENT_RECONCILE_TEMPLATE
+#define UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_CHECKSUM_METHOD_CYCLOPSCLIENT_RECONCILE_TEMPLATE
+uint16_t uniffi_cyclops_sdk_checksum_method_cyclopsclient_reconcile_template(void
+
+);
+#endif
+#ifndef UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_CHECKSUM_METHOD_CYCLOPSCLIENT_UPDATE_TEMPLATE
+#define UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_CHECKSUM_METHOD_CYCLOPSCLIENT_UPDATE_TEMPLATE
+uint16_t uniffi_cyclops_sdk_checksum_method_cyclopsclient_update_template(void
+
);
#endif
#ifndef UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_CHECKSUM_METHOD_ACCESSTOKENPROVIDER_GET_ACCESS_TOKEN
diff --git a/libs/fleet/sdk-bindings/swift/CyclopsSdkSchema.swift b/libs/fleet/sdk-bindings/swift/CyclopsSdkSchema.swift
index 47292463cf..ab5f93a8c6 100644
--- a/libs/fleet/sdk-bindings/swift/CyclopsSdkSchema.swift
+++ b/libs/fleet/sdk-bindings/swift/CyclopsSdkSchema.swift
@@ -448,22 +448,6 @@ fileprivate struct FfiConverterUInt32: FfiConverterPrimitive {
}
}
-#if swift(>=5.8)
-@_documentation(visibility: private)
-#endif
-fileprivate struct FfiConverterUInt64: FfiConverterPrimitive {
- typealias FfiType = UInt64
- typealias SwiftType = UInt64
-
- public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> UInt64 {
- return try lift(readInt(&buf))
- }
-
- public static func write(_ value: SwiftType, into buf: inout [UInt8]) {
- writeInt(&buf, lower(value))
- }
-}
-
#if swift(>=5.8)
@_documentation(visibility: private)
#endif
@@ -1246,68 +1230,6 @@ public func FfiConverterTypeOSGymSandboxWarmPoolStatus_lower(_ value: OsGymSandb
}
-public struct OsGymWorkspacePoolStatus: Equatable, Hashable {
- public var phase: String?
- public var totalCount: UInt32?
- public var availableCount: UInt32?
- public var claimedCount: UInt32?
-
- // Default memberwise initializers are never public by default, so we
- // declare one manually.
- public init(phase: String?, totalCount: UInt32?, availableCount: UInt32?, claimedCount: UInt32?) {
- self.phase = phase
- self.totalCount = totalCount
- self.availableCount = availableCount
- self.claimedCount = claimedCount
- }
-
-
-
-
-}
-
-#if compiler(>=6)
-extension OsGymWorkspacePoolStatus: Sendable {}
-#endif
-
-#if swift(>=5.8)
-@_documentation(visibility: private)
-#endif
-public struct FfiConverterTypeOSGymWorkspacePoolStatus: FfiConverterRustBuffer {
- public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> OsGymWorkspacePoolStatus {
- return
- try OsGymWorkspacePoolStatus(
- phase: FfiConverterOptionString.read(from: &buf),
- totalCount: FfiConverterOptionUInt32.read(from: &buf),
- availableCount: FfiConverterOptionUInt32.read(from: &buf),
- claimedCount: FfiConverterOptionUInt32.read(from: &buf)
- )
- }
-
- public static func write(_ value: OsGymWorkspacePoolStatus, into buf: inout [UInt8]) {
- FfiConverterOptionString.write(value.phase, into: &buf)
- FfiConverterOptionUInt32.write(value.totalCount, into: &buf)
- FfiConverterOptionUInt32.write(value.availableCount, into: &buf)
- FfiConverterOptionUInt32.write(value.claimedCount, into: &buf)
- }
-}
-
-
-#if swift(>=5.8)
-@_documentation(visibility: private)
-#endif
-public func FfiConverterTypeOSGymWorkspacePoolStatus_lift(_ buf: RustBuffer) throws -> OsGymWorkspacePoolStatus {
- return try FfiConverterTypeOSGymWorkspacePoolStatus.lift(buf)
-}
-
-#if swift(>=5.8)
-@_documentation(visibility: private)
-#endif
-public func FfiConverterTypeOSGymWorkspacePoolStatus_lower(_ value: OsGymWorkspacePoolStatus) -> RustBuffer {
- return FfiConverterTypeOSGymWorkspacePoolStatus.lower(value)
-}
-
-
public struct OidcConfig: Equatable, Hashable {
public var credentialsSecret: String
public var tokenUrl: String
@@ -1374,184 +1296,6 @@ public func FfiConverterTypeOidcConfig_lower(_ value: OidcConfig) -> RustBuffer
}
-public struct PoolSpec: Equatable, Hashable {
- public var replicas: UInt32
- public var template: PoolTemplate
- public var autoscaling: WarmPoolAutoscaling?
- public var services: [SandboxService]?
-
- // Default memberwise initializers are never public by default, so we
- // declare one manually.
- public init(replicas: UInt32, template: PoolTemplate, autoscaling: WarmPoolAutoscaling?, services: [SandboxService]?) {
- self.replicas = replicas
- self.template = template
- self.autoscaling = autoscaling
- self.services = services
- }
-
-
-
-
-// The local Rust `Eq` implementation - only `eq` is used.
-public static func == (self: PoolSpec, other: PoolSpec) -> Bool {
- return try! FfiConverterBool.lift(
- try! rustCall() {
- uniffi_cyclops_sdk_schema_fn_method_poolspec_uniffi_trait_eq_eq(
- FfiConverterTypePoolSpec_lower(self),
- FfiConverterTypePoolSpec_lower(other),$0
- )
-}
- )
-}
-// The local Rust `Hash` implementation
-public func hash(into hasher: inout Hasher) {
- let val = try! FfiConverterUInt64.lift(
- try! rustCall() {
- uniffi_cyclops_sdk_schema_fn_method_poolspec_uniffi_trait_hash(
- FfiConverterTypePoolSpec_lower(self),$0
- )
-}
- )
- hasher.combine(val)
-}
-}
-
-#if compiler(>=6)
-extension PoolSpec: Sendable {}
-#endif
-
-#if swift(>=5.8)
-@_documentation(visibility: private)
-#endif
-public struct FfiConverterTypePoolSpec: FfiConverterRustBuffer {
- public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> PoolSpec {
- return
- try PoolSpec(
- replicas: FfiConverterUInt32.read(from: &buf),
- template: FfiConverterTypePoolTemplate.read(from: &buf),
- autoscaling: FfiConverterOptionTypeWarmPoolAutoscaling.read(from: &buf),
- services: FfiConverterOptionSequenceTypeSandboxService.read(from: &buf)
- )
- }
-
- public static func write(_ value: PoolSpec, into buf: inout [UInt8]) {
- FfiConverterUInt32.write(value.replicas, into: &buf)
- FfiConverterTypePoolTemplate.write(value.template, into: &buf)
- FfiConverterOptionTypeWarmPoolAutoscaling.write(value.autoscaling, into: &buf)
- FfiConverterOptionSequenceTypeSandboxService.write(value.services, into: &buf)
- }
-}
-
-
-#if swift(>=5.8)
-@_documentation(visibility: private)
-#endif
-public func FfiConverterTypePoolSpec_lift(_ buf: RustBuffer) throws -> PoolSpec {
- return try FfiConverterTypePoolSpec.lift(buf)
-}
-
-#if swift(>=5.8)
-@_documentation(visibility: private)
-#endif
-public func FfiConverterTypePoolSpec_lower(_ value: PoolSpec) -> RustBuffer {
- return FfiConverterTypePoolSpec.lower(value)
-}
-
-
-public struct PoolTemplate {
- public var runtime: RuntimeKind?
- public var runtimeClassName: String?
- public var nodeSelector: [String: String]?
- public var tolerations: [PreservedJson]?
- public var command: [String]?
- public var containerDiskImage: String
- public var imagePullSecret: String?
- public var cpuCores: UInt32?
- public var memory: String?
- public var firmware: Firmware?
- public var probes: PreservedJson?
- public var oidc: OidcConfig?
-
- // Default memberwise initializers are never public by default, so we
- // declare one manually.
- public init(runtime: RuntimeKind?, runtimeClassName: String?, nodeSelector: [String: String]?, tolerations: [PreservedJson]?, command: [String]?, containerDiskImage: String, imagePullSecret: String?, cpuCores: UInt32?, memory: String?, firmware: Firmware?, probes: PreservedJson?, oidc: OidcConfig?) {
- self.runtime = runtime
- self.runtimeClassName = runtimeClassName
- self.nodeSelector = nodeSelector
- self.tolerations = tolerations
- self.command = command
- self.containerDiskImage = containerDiskImage
- self.imagePullSecret = imagePullSecret
- self.cpuCores = cpuCores
- self.memory = memory
- self.firmware = firmware
- self.probes = probes
- self.oidc = oidc
- }
-
-
-
-
-}
-
-#if compiler(>=6)
-extension PoolTemplate: Sendable {}
-#endif
-
-#if swift(>=5.8)
-@_documentation(visibility: private)
-#endif
-public struct FfiConverterTypePoolTemplate: FfiConverterRustBuffer {
- public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> PoolTemplate {
- return
- try PoolTemplate(
- runtime: FfiConverterOptionTypeRuntimeKind.read(from: &buf),
- runtimeClassName: FfiConverterOptionString.read(from: &buf),
- nodeSelector: FfiConverterOptionDictionaryStringString.read(from: &buf),
- tolerations: FfiConverterOptionSequenceTypePreservedJson.read(from: &buf),
- command: FfiConverterOptionSequenceString.read(from: &buf),
- containerDiskImage: FfiConverterString.read(from: &buf),
- imagePullSecret: FfiConverterOptionString.read(from: &buf),
- cpuCores: FfiConverterOptionUInt32.read(from: &buf),
- memory: FfiConverterOptionString.read(from: &buf),
- firmware: FfiConverterOptionTypeFirmware.read(from: &buf),
- probes: FfiConverterOptionTypePreservedJson.read(from: &buf),
- oidc: FfiConverterOptionTypeOidcConfig.read(from: &buf)
- )
- }
-
- public static func write(_ value: PoolTemplate, into buf: inout [UInt8]) {
- FfiConverterOptionTypeRuntimeKind.write(value.runtime, into: &buf)
- FfiConverterOptionString.write(value.runtimeClassName, into: &buf)
- FfiConverterOptionDictionaryStringString.write(value.nodeSelector, into: &buf)
- FfiConverterOptionSequenceTypePreservedJson.write(value.tolerations, into: &buf)
- FfiConverterOptionSequenceString.write(value.command, into: &buf)
- FfiConverterString.write(value.containerDiskImage, into: &buf)
- FfiConverterOptionString.write(value.imagePullSecret, into: &buf)
- FfiConverterOptionUInt32.write(value.cpuCores, into: &buf)
- FfiConverterOptionString.write(value.memory, into: &buf)
- FfiConverterOptionTypeFirmware.write(value.firmware, into: &buf)
- FfiConverterOptionTypePreservedJson.write(value.probes, into: &buf)
- FfiConverterOptionTypeOidcConfig.write(value.oidc, into: &buf)
- }
-}
-
-
-#if swift(>=5.8)
-@_documentation(visibility: private)
-#endif
-public func FfiConverterTypePoolTemplate_lift(_ buf: RustBuffer) throws -> PoolTemplate {
- return try FfiConverterTypePoolTemplate.lift(buf)
-}
-
-#if swift(>=5.8)
-@_documentation(visibility: private)
-#endif
-public func FfiConverterTypePoolTemplate_lower(_ value: PoolTemplate) -> RustBuffer {
- return FfiConverterTypePoolTemplate.lower(value)
-}
-
-
public struct SandboxService: Equatable, Hashable {
public var name: String
public var targetPort: UInt16
diff --git a/libs/fleet/sdk-bindings/swift/CyclopsSdkSchemaFFI.h b/libs/fleet/sdk-bindings/swift/CyclopsSdkSchemaFFI.h
index b86c185c46..bd17120c9a 100644
--- a/libs/fleet/sdk-bindings/swift/CyclopsSdkSchemaFFI.h
+++ b/libs/fleet/sdk-bindings/swift/CyclopsSdkSchemaFFI.h
@@ -263,21 +263,6 @@ uint64_t uniffi_cyclops_sdk_schema_fn_constructor_preservedjson_from_json(RustBu
RustBuffer uniffi_cyclops_sdk_schema_fn_method_preservedjson_to_json(uint64_t ptr, RustCallStatus *_Nonnull out_status
);
#endif
-#ifndef UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_SCHEMA_FN_METHOD_POOLSPEC_UNIFFI_TRAIT_EQ_EQ
-#define UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_SCHEMA_FN_METHOD_POOLSPEC_UNIFFI_TRAIT_EQ_EQ
-int8_t uniffi_cyclops_sdk_schema_fn_method_poolspec_uniffi_trait_eq_eq(RustBuffer ptr, RustBuffer other, RustCallStatus *_Nonnull out_status
-);
-#endif
-#ifndef UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_SCHEMA_FN_METHOD_POOLSPEC_UNIFFI_TRAIT_EQ_NE
-#define UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_SCHEMA_FN_METHOD_POOLSPEC_UNIFFI_TRAIT_EQ_NE
-int8_t uniffi_cyclops_sdk_schema_fn_method_poolspec_uniffi_trait_eq_ne(RustBuffer ptr, RustBuffer other, RustCallStatus *_Nonnull out_status
-);
-#endif
-#ifndef UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_SCHEMA_FN_METHOD_POOLSPEC_UNIFFI_TRAIT_HASH
-#define UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_SCHEMA_FN_METHOD_POOLSPEC_UNIFFI_TRAIT_HASH
-uint64_t uniffi_cyclops_sdk_schema_fn_method_poolspec_uniffi_trait_hash(RustBuffer ptr, RustCallStatus *_Nonnull out_status
-);
-#endif
#ifndef UNIFFI_FFIDEF_FFI_CYCLOPS_SDK_SCHEMA_RUSTBUFFER_ALLOC
#define UNIFFI_FFIDEF_FFI_CYCLOPS_SDK_SCHEMA_RUSTBUFFER_ALLOC
RustBuffer ffi_cyclops_sdk_schema_rustbuffer_alloc(uint64_t size, RustCallStatus *_Nonnull out_status
diff --git a/libs/fleet/sdk-bindings/swift/tests/TestAsyncClient.swift b/libs/fleet/sdk-bindings/swift/tests/TestAsyncClient.swift
index c62c53370d..3edc46e9d7 100644
--- a/libs/fleet/sdk-bindings/swift/tests/TestAsyncClient.swift
+++ b/libs/fleet/sdk-bindings/swift/tests/TestAsyncClient.swift
@@ -45,13 +45,13 @@ private func lifecycleQueue() -> [Expected] {
[
tokenExpected(),
Expected(method: "POST", url: "https://cyclops.invalid/api/namespaces", headers: jsonHeaders, body: Data(#"{"name":"default"}"#.utf8), status: 201, response: Data("{}".utf8)),
- Expected(method: "POST", url: "https://cyclops.invalid/api/k8s/apis/cua.ai/v1/namespaces/default/osgymworkspacepools", headers: jsonHeaders, body: Data(#"{"apiVersion":"cua.ai/v1","kind":"OSGymWorkspacePool","metadata":{"namespace":"default","name":"default","labels":null},"spec":{"replicas":1,"template":{"containerDiskImage":"registry.example/desktop:offline"},"services":[{"name":"mcp","targetPort":8080}]},"status":null}"#.utf8), status: 201, response: Data(#"{"apiVersion":"cua.ai/v1","kind":"OSGymWorkspacePool","metadata":{"namespace":"default","name":"default","labels":null},"spec":{"replicas":1,"template":{"containerDiskImage":"registry.example/desktop:offline"},"services":[{"name":"mcp","targetPort":8080}]},"status":null}"#.utf8)),
+ Expected(method: "POST", url: "https://cyclops.invalid/api/k8s/apis/osgym.cua.ai/v1alpha1/namespaces/default/osgymsandboxwarmpools", headers: jsonHeaders, body: Data(#"{"apiVersion":"osgym.cua.ai/v1alpha1","kind":"OSGymSandboxWarmPool","metadata":{"namespace":"default","name":"default","labels":null},"spec":{"replicas":1,"sandboxTemplateRef":{"name":"default"}},"status":null}"#.utf8), status: 201, response: Data(#"{"apiVersion":"osgym.cua.ai/v1alpha1","kind":"OSGymSandboxWarmPool","metadata":{"namespace":"default","name":"default","labels":null},"spec":{"replicas":1,"sandboxTemplateRef":{"name":"default"}},"status":null}"#.utf8)),
Expected(method: "POST", url: "https://cyclops.invalid/api/k8s/apis/osgym.cua.ai/v1alpha1/namespaces/default/osgymsandboxclaims", headers: jsonHeaders, body: Data(#"{"apiVersion":"osgym.cua.ai/v1alpha1","kind":"OSGymSandboxClaim","metadata":{"namespace":"default","name":"claim-1","labels":null},"spec":{"sandboxTemplateRef":{"name":"default"}},"status":null}"#.utf8), status: 201, response: Data(#"{"apiVersion":"osgym.cua.ai/v1alpha1","kind":"OSGymSandboxClaim","metadata":{"namespace":"default","name":"default","labels":null},"spec":{"sandboxTemplateRef":{"name":"default"}},"status":{"phase":"Bound","sandbox":{"name":"offline-sandbox"}}}"#.utf8)),
Expected(method: "GET", url: "https://cyclops.invalid/api/k8s/apis/osgym.cua.ai/v1alpha1/namespaces/default/osgymsandboxclaims/default", headers: jsonHeaders, body: nil, status: 200, response: Data(#"{"apiVersion":"osgym.cua.ai/v1alpha1","kind":"OSGymSandboxClaim","metadata":{"namespace":"default","name":"default","labels":null},"spec":{"sandboxTemplateRef":{"name":"default"}},"status":{"phase":"Bound","sandbox":{"name":"offline-sandbox"}}}"#.utf8)),
- Expected(method: "GET", url: "https://cyclops.invalid/api/k8s/apis/cua.ai/v1/namespaces/default/osgymworkspacepools/default", headers: jsonHeaders, body: nil, status: 200, response: Data(#"{"apiVersion":"cua.ai/v1","kind":"OSGymWorkspacePool","metadata":{"namespace":"default","name":"default","labels":null},"spec":{"replicas":1,"template":{"containerDiskImage":"registry.example/desktop:offline"},"services":[{"name":"mcp","targetPort":8080}]},"status":null}"#.utf8)),
+ Expected(method: "GET", url: "https://cyclops.invalid/api/k8s/apis/osgym.cua.ai/v1alpha1/namespaces/default/osgymsandboxtemplates/default", headers: jsonHeaders, body: nil, status: 200, response: Data(#"{"apiVersion":"osgym.cua.ai/v1alpha1","kind":"OSGymSandboxTemplate","metadata":{"namespace":"default","name":"default","labels":null},"spec":{"vmTemplate":{"containerDiskImage":"registry.example/desktop:offline","services":[{"name":"mcp","targetPort":8080}]}}}"#.utf8)),
serviceExpected(body: Data(#"{"offline":true}"#.utf8), response: Data("offline service accepted".utf8)),
Expected(method: "DELETE", url: "https://cyclops.invalid/api/k8s/apis/osgym.cua.ai/v1alpha1/namespaces/default/osgymsandboxclaims/default", headers: jsonHeaders, body: nil, status: 204, response: Data()),
- Expected(method: "DELETE", url: "https://cyclops.invalid/api/k8s/apis/cua.ai/v1/namespaces/default/osgymworkspacepools/default", headers: jsonHeaders, body: nil, status: 204, response: Data()),
+ Expected(method: "DELETE", url: "https://cyclops.invalid/api/k8s/apis/osgym.cua.ai/v1alpha1/namespaces/default/osgymsandboxwarmpools/default", headers: jsonHeaders, body: nil, status: 204, response: Data()),
Expected(method: "DELETE", url: "https://cyclops.invalid/api/namespaces/default", headers: jsonHeaders, body: nil, status: 204, response: Data()),
]
}
@@ -95,8 +95,7 @@ private func serviceRequest(_ body: Data?) -> HttpRequest {
@main struct AppControlled {
static func main() async throws {
- let vmTemplate = VmTemplate(containerDiskImage: "registry.example/desktop:offline", command: nil, runtime: nil, runtimeClassName: nil, nodeSelector: nil, tolerations: nil, imagePullPolicy: nil, imagePullSecret: nil, cpuCores: nil, memory: nil, firmware: nil, probes: nil, services: nil, oidc: nil)
- let spec = PoolSpec(replicas: 1, template: PoolTemplate(runtime: nil, runtimeClassName: nil, nodeSelector: nil, tolerations: nil, command: nil, containerDiskImage: vmTemplate.containerDiskImage, imagePullSecret: nil, cpuCores: nil, memory: nil, firmware: nil, probes: nil, oidc: nil), autoscaling: nil, services: [SandboxService(name: "mcp", targetPort: 8080, protocol: nil)])
+ let spec = OsGymSandboxWarmPoolSpec(replicas: 1, sandboxTemplateRef: SandboxTemplateRef(name: "default"), autoscaling: nil)
let transport = ScriptedHttpClient(expected: lifecycleQueue())
let client = try CyclopsClient.connect(configuration: configuration(), httpClient: transport)
let pool = try await client.createPool(request: CreatePoolRequest(namespace: "default", spec: spec))
diff --git a/libs/fleet/sdk-bindings/ts-uniffi-browser/examples/browser.ts b/libs/fleet/sdk-bindings/ts-uniffi-browser/examples/browser.ts
index 0e3ff42134..f023201f98 100644
--- a/libs/fleet/sdk-bindings/ts-uniffi-browser/examples/browser.ts
+++ b/libs/fleet/sdk-bindings/ts-uniffi-browser/examples/browser.ts
@@ -3,8 +3,9 @@ import {
uniffiInitAsync,
type Claim,
type Pool,
+ type Template,
} from "../ts/index.web"
-import type { PoolSpec } from "../ts/cyclops_sdk_schema"
+import type { OsGymSandboxTemplateSpec, OsGymSandboxWarmPoolSpec } from "../ts/cyclops_sdk_schema"
declare global {
interface Window {
@@ -70,16 +71,22 @@ function runtimeConfig(): BrowserRuntimeConfig {
return config
}
-function makePoolSpec(image: string, imagePullSecret?: string): PoolSpec {
+function makeTemplateSpec(image: string, imagePullSecret?: string): OsGymSandboxTemplateSpec {
return {
- replicas: 1,
- template: {
+ vmTemplate: {
containerDiskImage: image,
cpuCores: 4,
memory: "4Gi",
imagePullSecret,
+ services: [{ name: serviceName, targetPort: 3000 }],
},
- services: [{ name: serviceName, targetPort: 3000 }],
+ }
+}
+
+function makePoolSpec(namespace: string): OsGymSandboxWarmPoolSpec {
+ return {
+ replicas: 1,
+ sandboxTemplateRef: { name: `${namespace}-template` },
}
}
@@ -100,12 +107,18 @@ async function runLifecycle(): Promise<void> {
log("[auth] SDK client connected.")
let pool: Pool | undefined
+ let template: Template | undefined
let claim: Claim | undefined
try {
- log("[1/5] Creating pool...")
+ log("[1/5] Creating pool and template...")
pool = await client.createPool({
namespace: config.namespace,
- spec: makePoolSpec(config.image, config.imagePullSecret),
+ spec: makePoolSpec(config.namespace),
+ })
+ template = await client.createTemplate({
+ namespace: config.namespace,
+ name: `${config.namespace}-template`,
+ spec: makeTemplateSpec(config.image, config.imagePullSecret),
})
log("[2/5] Creating claim...")
@@ -131,6 +144,10 @@ async function runLifecycle(): Promise<void> {
log("[cleanup] Deleting claim...")
await client.deleteClaim(claim)
}
+ if (template) {
+ log("[cleanup] Deleting template...")
+ await client.deleteTemplate(template)
+ }
if (pool) {
log("[cleanup] Deleting pool...")
await client.deletePool(pool)
diff --git a/libs/fleet/sdk-bindings/ts-uniffi-browser/ts/cyclops_sdk_schema.ts b/libs/fleet/sdk-bindings/ts-uniffi-browser/ts/cyclops_sdk_schema.ts
index 4936b7ec57..8e91fdc62d 100644
--- a/libs/fleet/sdk-bindings/ts-uniffi-browser/ts/cyclops_sdk_schema.ts
+++ b/libs/fleet/sdk-bindings/ts-uniffi-browser/ts/cyclops_sdk_schema.ts
@@ -24,7 +24,6 @@ import {
FfiConverterOptional,
FfiConverterUInt16,
FfiConverterUInt32,
- FfiConverterUInt64,
FfiConverterUInt8,
RustBuffer,
UniffiAbstractObject,
@@ -1211,248 +1210,6 @@ const FfiConverterTypeOSGymSandboxWarmPoolStatus = (() => {
return new FFIConverter();
})();
-export type OsGymWorkspacePoolStatus = {
- phase?: string;
- totalCount?: number;
- availableCount?: number;
- claimedCount?: number;
-};
-
-/**
- * Generated factory for {@link OsGymWorkspacePoolStatus} record objects.
- */
-export const OsGymWorkspacePoolStatus = (() => {
- const defaults = () => ({});
- const create = (() => {
- return uniffiCreateRecord<
- OsGymWorkspacePoolStatus,
- ReturnType<typeof defaults>
- >(defaults);
- })();
- return Object.freeze({
- create,
- new: create,
- defaults: () =>
- Object.freeze(defaults()) as Partial<OsGymWorkspacePoolStatus>,
- });
-})();
-
-const FfiConverterTypeOSGymWorkspacePoolStatus = (() => {
- type TypeName = OsGymWorkspacePoolStatus;
- class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
- read(from: RustBuffer): TypeName {
- return {
- phase: FfiConverterOptionalString.read(from),
- totalCount: FfiConverterOptionalUInt32.read(from),
- availableCount: FfiConverterOptionalUInt32.read(from),
- claimedCount: FfiConverterOptionalUInt32.read(from),
- };
- }
- write(value: TypeName, into: RustBuffer): void {
- FfiConverterOptionalString.write(value.phase, into);
- FfiConverterOptionalUInt32.write(value.totalCount, into);
- FfiConverterOptionalUInt32.write(value.availableCount, into);
- FfiConverterOptionalUInt32.write(value.claimedCount, into);
- }
- allocationSize(value: TypeName): number {
- return (
- FfiConverterOptionalString.allocationSize(value.phase) +
- FfiConverterOptionalUInt32.allocationSize(value.totalCount) +
- FfiConverterOptionalUInt32.allocationSize(value.availableCount) +
- FfiConverterOptionalUInt32.allocationSize(value.claimedCount)
- );
- }
- }
- return new FFIConverter();
-})();
-
-export type PoolTemplate = {
- runtime?: RuntimeKind;
- runtimeClassName?: string;
- nodeSelector?: Map<string, string>;
- tolerations?: Array<PreservedJsonLike>;
- command?: Array<string>;
- containerDiskImage: string;
- imagePullSecret?: string;
- cpuCores?: number;
- memory?: string;
- firmware?: Firmware;
- probes?: PreservedJsonLike;
- oidc?: OidcConfig;
-};
-
-/**
- * Generated factory for {@link PoolTemplate} record objects.
- */
-export const PoolTemplate = (() => {
- const defaults = () => ({});
- const create = (() => {
- return uniffiCreateRecord<PoolTemplate, ReturnType<typeof defaults>>(
- defaults,
- );
- })();
- return Object.freeze({
- create,
- new: create,
- defaults: () => Object.freeze(defaults()) as Partial<PoolTemplate>,
- });
-})();
-
-const FfiConverterTypePoolTemplate = (() => {
- type TypeName = PoolTemplate;
- class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
- read(from: RustBuffer): TypeName {
- return {
- runtime: FfiConverterOptionalTypeRuntimeKind.read(from),
- runtimeClassName: FfiConverterOptionalString.read(from),
- nodeSelector: FfiConverterOptionalMapStringString.read(from),
- tolerations: FfiConverterOptionalSequenceTypePreservedJson.read(from),
- command: FfiConverterOptionalSequenceString.read(from),
- containerDiskImage: FfiConverterString.read(from),
- imagePullSecret: FfiConverterOptionalString.read(from),
- cpuCores: FfiConverterOptionalUInt32.read(from),
- memory: FfiConverterOptionalString.read(from),
- firmware: FfiConverterOptionalTypeFirmware.read(from),
- probes: FfiConverterOptionalTypePreservedJson.read(from),
- oidc: FfiConverterOptionalTypeOidcConfig.read(from),
- };
- }
- write(value: TypeName, into: RustBuffer): void {
- FfiConverterOptionalTypeRuntimeKind.write(value.runtime, into);
- FfiConverterOptionalString.write(value.runtimeClassName, into);
- FfiConverterOptionalMapStringString.write(value.nodeSelector, into);
- FfiConverterOptionalSequenceTypePreservedJson.write(
- value.tolerations,
- into,
- );
- FfiConverterOptionalSequenceString.write(value.command, into);
- FfiConverterString.write(value.containerDiskImage, into);
- FfiConverterOptionalString.write(value.imagePullSecret, into);
- FfiConverterOptionalUInt32.write(value.cpuCores, into);
- FfiConverterOptionalString.write(value.memory, into);
- FfiConverterOptionalTypeFirmware.write(value.firmware, into);
- FfiConverterOptionalTypePreservedJson.write(value.probes, into);
- FfiConverterOptionalTypeOidcConfig.write(value.oidc, into);
- }
- allocationSize(value: TypeName): number {
- return (
- FfiConverterOptionalTypeRuntimeKind.allocationSize(value.runtime) +
- FfiConverterOptionalString.allocationSize(value.runtimeClassName) +
- FfiConverterOptionalMapStringString.allocationSize(value.nodeSelector) +
- FfiConverterOptionalSequenceTypePreservedJson.allocationSize(
- value.tolerations,
- ) +
- FfiConverterOptionalSequenceString.allocationSize(value.command) +
- FfiConverterString.allocationSize(value.containerDiskImage) +
- FfiConverterOptionalString.allocationSize(value.imagePullSecret) +
- FfiConverterOptionalUInt32.allocationSize(value.cpuCores) +
- FfiConverterOptionalString.allocationSize(value.memory) +
- FfiConverterOptionalTypeFirmware.allocationSize(value.firmware) +
- FfiConverterOptionalTypePreservedJson.allocationSize(value.probes) +
- FfiConverterOptionalTypeOidcConfig.allocationSize(value.oidc)
- );
- }
- }
- return new FFIConverter();
-})();
-
-export type PoolSpec = {
- replicas: number;
- template: PoolTemplate;
- autoscaling?: WarmPoolAutoscaling;
- services?: Array<SandboxService>;
-};
-
-/**
- * Generated factory for {@link PoolSpec} record objects.
- */
-export const PoolSpec = (() => {
- const defaults = () => ({});
- const create = (() => {
- return uniffiCreateRecord<PoolSpec, ReturnType<typeof defaults>>(defaults);
- })();
- return Object.freeze({
- create,
- new: create,
- defaults: () => Object.freeze(defaults()) as Partial<PoolSpec>,
- equals(self_: PoolSpec, other: PoolSpec): boolean {
- return FfiConverterBool.lift(
- uniffiCaller.rustCall(
- /*caller:*/ (callStatus) => {
- return nativeModule().ubrn_uniffi_cyclops_sdk_schema_fn_method_poolspec_uniffi_trait_eq_eq(
- FfiConverterTypePoolSpec.lower(
- self_,
- nativeModule().rustbuffer_alloc,
- ),
- FfiConverterTypePoolSpec.lower(
- other,
- nativeModule().rustbuffer_alloc,
- ),
- callStatus,
- );
- },
- /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
- ),
- );
- },
- hashCode(self_: PoolSpec): bigint {
- return FfiConverterUInt64.lift(
- uniffiCaller.rustCall(
- /*caller:*/ (callStatus) => {
- return nativeModule().ubrn_uniffi_cyclops_sdk_schema_fn_method_poolspec_uniffi_trait_hash(
- FfiConverterTypePoolSpec.lower(
- self_,
- nativeModule().rustbuffer_alloc,
- ),
- callStatus,
- );
- },
- /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
- ),
- );
- },
- });
-})();
-
-const FfiConverterTypePoolSpec = (() => {
- type TypeName = PoolSpec;
- class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
- read(from: RustBuffer): TypeName {
- return {
- replicas: FfiConverterUInt32.read(from),
- template: FfiConverterTypePoolTemplate.read(from),
- autoscaling: FfiConverterOptionalTypeWarmPoolAutoscaling.read(from),
- services: FfiConverterOptionalSequenceTypeSandboxService.read(from),
- };
- }
- write(value: TypeName, into: RustBuffer): void {
- FfiConverterUInt32.write(value.replicas, into);
- FfiConverterTypePoolTemplate.write(value.template, into);
- FfiConverterOptionalTypeWarmPoolAutoscaling.write(
- value.autoscaling,
- into,
- );
- FfiConverterOptionalSequenceTypeSandboxService.write(
- value.services,
- into,
- );
- }
- allocationSize(value: TypeName): number {
- return (
- FfiConverterUInt32.allocationSize(value.replicas) +
- FfiConverterTypePoolTemplate.allocationSize(value.template) +
- FfiConverterOptionalTypeWarmPoolAutoscaling.allocationSize(
- value.autoscaling,
- ) +
- FfiConverterOptionalSequenceTypeSandboxService.allocationSize(
- value.services,
- )
- );
- }
- }
- return new FFIConverter();
-})();
-
// Error type: JsonValueError
export enum JsonValueError_Tags {
Invalid = "Invalid",
@@ -1702,10 +1459,7 @@ export default Object.freeze({
FfiConverterTypeOSGymSandboxTemplateSpec,
FfiConverterTypeOSGymSandboxWarmPoolSpec,
FfiConverterTypeOSGymSandboxWarmPoolStatus,
- FfiConverterTypeOSGymWorkspacePoolStatus,
FfiConverterTypeOidcConfig,
- FfiConverterTypePoolSpec,
- FfiConverterTypePoolTemplate,
FfiConverterTypePreservedJson,
FfiConverterTypeRuntimeKind,
FfiConverterTypeSandboxService,
diff --git a/libs/fleet/sdk-bindings/ts-uniffi-browser/ts/cyclops_sdk-ffi.ts b/libs/fleet/sdk-bindings/ts-uniffi-browser/ts/fleet_sdk-ffi.ts
similarity index 58%
rename from libs/fleet/sdk-bindings/ts-uniffi-browser/ts/cyclops_sdk-ffi.ts
rename to libs/fleet/sdk-bindings/ts-uniffi-browser/ts/fleet_sdk-ffi.ts
index 65d8a8b447..e76b42f428 100644
--- a/libs/fleet/sdk-bindings/ts-uniffi-browser/ts/cyclops_sdk-ffi.ts
+++ b/libs/fleet/sdk-bindings/ts-uniffi-browser/ts/fleet_sdk-ffi.ts
@@ -23,35 +23,35 @@ export type UniffiForeignFutureCompleterustBuffer = (
callbackData: bigint,
result: UniffiForeignFutureResultRustBuffer,
) => void;
-type UniffiCallbackInterfaceCyclopsSdkAccessTokenProviderMethod0 = (
+type UniffiCallbackInterfaceFleetSdkAccessTokenProviderMethod0 = (
uniffiHandle: bigint,
forceRefresh: number,
uniffiFutureCallback: UniffiForeignFutureCompleterustBuffer,
uniffiCallbackData: bigint,
) => UniffiForeignFutureDroppedCallbackStruct;
-type UniffiCallbackInterfaceCloneCyclopsSdkAccessTokenProvider = (
+type UniffiCallbackInterfaceCloneFleetSdkAccessTokenProvider = (
handle: bigint,
) => UniffiResult<void>;
-type UniffiCallbackInterfaceFreeCyclopsSdkAccessTokenProvider = (
+type UniffiCallbackInterfaceFreeFleetSdkAccessTokenProvider = (
handle: bigint,
) => void;
-export type UniffiVTableCallbackInterfaceCyclopsSdkAccessTokenProvider = {
- uniffi_free: UniffiCallbackInterfaceFreeCyclopsSdkAccessTokenProvider;
- uniffi_clone: UniffiCallbackInterfaceCloneCyclopsSdkAccessTokenProvider;
- get_access_token: UniffiCallbackInterfaceCyclopsSdkAccessTokenProviderMethod0;
+export type UniffiVTableCallbackInterfaceFleetSdkAccessTokenProvider = {
+ uniffi_free: UniffiCallbackInterfaceFreeFleetSdkAccessTokenProvider;
+ uniffi_clone: UniffiCallbackInterfaceCloneFleetSdkAccessTokenProvider;
+ get_access_token: UniffiCallbackInterfaceFleetSdkAccessTokenProviderMethod0;
};
-type UniffiCallbackInterfaceCyclopsSdkHttpClientMethod0 = (
+type UniffiCallbackInterfaceFleetSdkHttpClientMethod0 = (
uniffiHandle: bigint,
request: Uint8Array,
uniffiFutureCallback: UniffiForeignFutureCompleterustBuffer,
uniffiCallbackData: bigint,
) => UniffiForeignFutureDroppedCallbackStruct;
-type UniffiCallbackInterfaceCloneCyclopsSdkHttpClient = (
+type UniffiCallbackInterfaceCloneFleetSdkHttpClient = (
handle: bigint,
) => UniffiResult<void>;
-type UniffiCallbackInterfaceFreeCyclopsSdkHttpClient = (handle: bigint) => void;
-export type UniffiVTableCallbackInterfaceCyclopsSdkHttpClient = {
- uniffi_free: UniffiCallbackInterfaceFreeCyclopsSdkHttpClient;
- uniffi_clone: UniffiCallbackInterfaceCloneCyclopsSdkHttpClient;
- execute: UniffiCallbackInterfaceCyclopsSdkHttpClientMethod0;
+type UniffiCallbackInterfaceFreeFleetSdkHttpClient = (handle: bigint) => void;
+export type UniffiVTableCallbackInterfaceFleetSdkHttpClient = {
+ uniffi_free: UniffiCallbackInterfaceFreeFleetSdkHttpClient;
+ uniffi_clone: UniffiCallbackInterfaceCloneFleetSdkHttpClient;
+ execute: UniffiCallbackInterfaceFleetSdkHttpClientMethod0;
};
diff --git a/libs/fleet/sdk-bindings/ts-uniffi-browser/ts/cyclops_sdk.ts b/libs/fleet/sdk-bindings/ts-uniffi-browser/ts/fleet_sdk.ts
similarity index 81%
rename from libs/fleet/sdk-bindings/ts-uniffi-browser/ts/cyclops_sdk.ts
rename to libs/fleet/sdk-bindings/ts-uniffi-browser/ts/fleet_sdk.ts
index a2889a0aa4..391c1c784d 100644
--- a/libs/fleet/sdk-bindings/ts-uniffi-browser/ts/cyclops_sdk.ts
+++ b/libs/fleet/sdk-bindings/ts-uniffi-browser/ts/fleet_sdk.ts
@@ -10,14 +10,15 @@ import {
type UniffiForeignFutureDroppedCallbackStruct,
type UniffiForeignFutureResultRustBuffer,
type UniffiForeignFutureCompleterustBuffer,
- type UniffiVTableCallbackInterfaceCyclopsSdkAccessTokenProvider,
- type UniffiVTableCallbackInterfaceCyclopsSdkHttpClient,
-} from "./cyclops_sdk-ffi";
+ type UniffiVTableCallbackInterfaceFleetSdkAccessTokenProvider,
+ type UniffiVTableCallbackInterfaceFleetSdkHttpClient,
+} from "./fleet_sdk-ffi";
import {
type ClaimSpec,
type OsGymSandboxClaimStatus,
- type OsGymWorkspacePoolStatus,
- type PoolSpec,
+ type OsGymSandboxTemplateSpec,
+ type OsGymSandboxWarmPoolSpec,
+ type OsGymSandboxWarmPoolStatus,
} from "./cyclops_sdk_schema";
import {
type FfiConverter,
@@ -59,8 +60,9 @@ import uniffiCyclopsSdkSchemaModule from "./cyclops_sdk_schema";
const {
FfiConverterTypeClaimSpec,
FfiConverterTypeOSGymSandboxClaimStatus,
- FfiConverterTypeOSGymWorkspacePoolStatus,
- FfiConverterTypePoolSpec,
+ FfiConverterTypeOSGymSandboxTemplateSpec,
+ FfiConverterTypeOSGymSandboxWarmPoolSpec,
+ FfiConverterTypeOSGymSandboxWarmPoolStatus,
} = uniffiCyclopsSdkSchemaModule.converters;
// wasm1: wrap the wasm-bindgen namespace once so the codegen call sites can
// uniformly reference `nativeModule().rustbuffer_alloc` / `.rustbuffer_free`.
@@ -213,14 +215,19 @@ const FfiConverterTypeClaim = (() => {
/**
* UniFFI cannot emit aliases for external record types. Generated bindings use
- * `OSGymWorkspacePoolStatus` and `OSGymSandboxClaimStatus` from cyclops_sdk_schema.
+ * `OSGymSandboxWarmPoolStatus` and `OSGymSandboxClaimStatus` from cyclops_sdk_schema.
+ *
+ * A `Pool` is the `osgym.cua.ai/v1alpha1 OSGymSandboxWarmPool` CR verbatim —
+ * the SDK is a naive CRUD mapper over the native CRDs, with no translation
+ * layer (the legacy `cua.ai/v1 OSGymWorkspacePool` and its operator compat
+ * shim are gone).
*/
export type Pool = {
apiVersion: string;
kind: string;
metadata: ResourceMetadata;
- spec: PoolSpec;
- status?: OsGymWorkspacePoolStatus;
+ spec: OsGymSandboxWarmPoolSpec;
+ status?: OsGymSandboxWarmPoolStatus;
};
/**
@@ -246,16 +253,16 @@ const FfiConverterTypePool = (() => {
apiVersion: FfiConverterString.read(from),
kind: FfiConverterString.read(from),
metadata: FfiConverterTypeResourceMetadata.read(from),
- spec: FfiConverterTypePoolSpec.read(from),
- status: FfiConverterOptionalTypeOSGymWorkspacePoolStatus.read(from),
+ spec: FfiConverterTypeOSGymSandboxWarmPoolSpec.read(from),
+ status: FfiConverterOptionalTypeOSGymSandboxWarmPoolStatus.read(from),
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterString.write(value.apiVersion, into);
FfiConverterString.write(value.kind, into);
FfiConverterTypeResourceMetadata.write(value.metadata, into);
- FfiConverterTypePoolSpec.write(value.spec, into);
- FfiConverterOptionalTypeOSGymWorkspacePoolStatus.write(
+ FfiConverterTypeOSGymSandboxWarmPoolSpec.write(value.spec, into);
+ FfiConverterOptionalTypeOSGymSandboxWarmPoolStatus.write(
value.status,
into,
);
@@ -265,8 +272,8 @@ const FfiConverterTypePool = (() => {
FfiConverterString.allocationSize(value.apiVersion) +
FfiConverterString.allocationSize(value.kind) +
FfiConverterTypeResourceMetadata.allocationSize(value.metadata) +
- FfiConverterTypePoolSpec.allocationSize(value.spec) +
- FfiConverterOptionalTypeOSGymWorkspacePoolStatus.allocationSize(
+ FfiConverterTypeOSGymSandboxWarmPoolSpec.allocationSize(value.spec) +
+ FfiConverterOptionalTypeOSGymSandboxWarmPoolStatus.allocationSize(
value.status,
)
);
@@ -322,7 +329,7 @@ const FfiConverterTypeCreateClaimRequest = (() => {
export type CreatePoolRequest = {
namespace: string;
- spec: PoolSpec;
+ spec: OsGymSandboxWarmPoolSpec;
};
/**
@@ -348,17 +355,67 @@ const FfiConverterTypeCreatePoolRequest = (() => {
read(from: RustBuffer): TypeName {
return {
namespace: FfiConverterString.read(from),
- spec: FfiConverterTypePoolSpec.read(from),
+ spec: FfiConverterTypeOSGymSandboxWarmPoolSpec.read(from),
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterString.write(value.namespace, into);
- FfiConverterTypePoolSpec.write(value.spec, into);
+ FfiConverterTypeOSGymSandboxWarmPoolSpec.write(value.spec, into);
}
allocationSize(value: TypeName): number {
return (
FfiConverterString.allocationSize(value.namespace) +
- FfiConverterTypePoolSpec.allocationSize(value.spec)
+ FfiConverterTypeOSGymSandboxWarmPoolSpec.allocationSize(value.spec)
+ );
+ }
+ }
+ return new FFIConverter();
+})();
+
+export type CreateTemplateRequest = {
+ namespace: string;
+ name: string;
+ spec: OsGymSandboxTemplateSpec;
+};
+
+/**
+ * Generated factory for {@link CreateTemplateRequest} record objects.
+ */
+export const CreateTemplateRequest = (() => {
+ const defaults = () => ({});
+ const create = (() => {
+ return uniffiCreateRecord<
+ CreateTemplateRequest,
+ ReturnType<typeof defaults>
+ >(defaults);
+ })();
+ return Object.freeze({
+ create,
+ new: create,
+ defaults: () => Object.freeze(defaults()) as Partial<CreateTemplateRequest>,
+ });
+})();
+
+const FfiConverterTypeCreateTemplateRequest = (() => {
+ type TypeName = CreateTemplateRequest;
+ class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
+ read(from: RustBuffer): TypeName {
+ return {
+ namespace: FfiConverterString.read(from),
+ name: FfiConverterString.read(from),
+ spec: FfiConverterTypeOSGymSandboxTemplateSpec.read(from),
+ };
+ }
+ write(value: TypeName, into: RustBuffer): void {
+ FfiConverterString.write(value.namespace, into);
+ FfiConverterString.write(value.name, into);
+ FfiConverterTypeOSGymSandboxTemplateSpec.write(value.spec, into);
+ }
+ allocationSize(value: TypeName): number {
+ return (
+ FfiConverterString.allocationSize(value.namespace) +
+ FfiConverterString.allocationSize(value.name) +
+ FfiConverterTypeOSGymSandboxTemplateSpec.allocationSize(value.spec)
);
}
}
@@ -814,6 +871,61 @@ const FfiConverterTypeSandbox = (() => {
return new FFIConverter();
})();
+/**
+ * The `osgym.cua.ai/v1alpha1 OSGymSandboxTemplate` CR verbatim. Warm pools
+ * and claims reference one by name via `spec.sandboxTemplateRef.name`.
+ */
+export type Template = {
+ apiVersion: string;
+ kind: string;
+ metadata: ResourceMetadata;
+ spec: OsGymSandboxTemplateSpec;
+};
+
+/**
+ * Generated factory for {@link Template} record objects.
+ */
+export const Template = (() => {
+ const defaults = () => ({});
+ const create = (() => {
+ return uniffiCreateRecord<Template, ReturnType<typeof defaults>>(defaults);
+ })();
+ return Object.freeze({
+ create,
+ new: create,
+ defaults: () => Object.freeze(defaults()) as Partial<Template>,
+ });
+})();
+
+const FfiConverterTypeTemplate = (() => {
+ type TypeName = Template;
+ class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
+ read(from: RustBuffer): TypeName {
+ return {
+ apiVersion: FfiConverterString.read(from),
+ kind: FfiConverterString.read(from),
+ metadata: FfiConverterTypeResourceMetadata.read(from),
+ spec: FfiConverterTypeOSGymSandboxTemplateSpec.read(from),
+ };
+ }
+ write(value: TypeName, into: RustBuffer): void {
+ FfiConverterString.write(value.apiVersion, into);
+ FfiConverterString.write(value.kind, into);
+ FfiConverterTypeResourceMetadata.write(value.metadata, into);
+ FfiConverterTypeOSGymSandboxTemplateSpec.write(value.spec, into);
+ }
+ allocationSize(value: TypeName): number {
+ return (
+ FfiConverterString.allocationSize(value.apiVersion) +
+ FfiConverterString.allocationSize(value.kind) +
+ FfiConverterTypeResourceMetadata.allocationSize(value.metadata) +
+ FfiConverterTypeOSGymSandboxTemplateSpec.allocationSize(value.spec)
+ );
+ }
+ }
+ return new FFIConverter();
+})();
+
// Error type: AccessTokenProviderError
export enum AccessTokenProviderError_Tags {
Failed = "Failed",
@@ -1835,6 +1947,10 @@ export interface CyclopsClientLike {
request: CreatePoolRequest,
asyncOpts_?: { signal: AbortSignal },
) /*throws*/ : Promise<Pool>;
+ createTemplate(
+ request: CreateTemplateRequest,
+ asyncOpts_?: { signal: AbortSignal },
+ ) /*throws*/ : Promise<Template>;
deleteClaim(
claim: Claim,
asyncOpts_?: { signal: AbortSignal },
@@ -1843,14 +1959,23 @@ export interface CyclopsClientLike {
pool: Pool,
asyncOpts_?: { signal: AbortSignal },
) /*throws*/ : Promise<void>;
+ deleteTemplate(
+ template: Template,
+ asyncOpts_?: { signal: AbortSignal },
+ ) /*throws*/ : Promise<void>;
getClaim(
claim: Claim,
asyncOpts_?: { signal: AbortSignal },
) /*throws*/ : Promise<Claim>;
getPool(
- pool: Pool,
+ name: string,
asyncOpts_?: { signal: AbortSignal },
) /*throws*/ : Promise<Pool>;
+ getTemplate(
+ namespace: string,
+ name: string,
+ asyncOpts_?: { signal: AbortSignal },
+ ) /*throws*/ : Promise<Template>;
listClaims(
namespace: string,
asyncOpts_?: { signal: AbortSignal },
@@ -1859,6 +1984,18 @@ export interface CyclopsClientLike {
namespace: string,
asyncOpts_?: { signal: AbortSignal },
) /*throws*/ : Promise<Array<Pool>>;
+ listTemplates(
+ namespace: string,
+ asyncOpts_?: { signal: AbortSignal },
+ ) /*throws*/ : Promise<Array<Template>>;
+ reconcilePool(
+ request: CreatePoolRequest,
+ asyncOpts_?: { signal: AbortSignal },
+ ) /*throws*/ : Promise<Pool>;
+ reconcileTemplate(
+ request: CreateTemplateRequest,
+ asyncOpts_?: { signal: AbortSignal },
+ ) /*throws*/ : Promise<Template>;
serviceRequest(
sandbox: Sandbox,
service: string,
@@ -1870,6 +2007,10 @@ export interface CyclopsClientLike {
pool: Pool,
asyncOpts_?: { signal: AbortSignal },
) /*throws*/ : Promise<Pool>;
+ updateTemplate(
+ template: Template,
+ asyncOpts_?: { signal: AbortSignal },
+ ) /*throws*/ : Promise<Template>;
waitClaim(
claim: Claim,
asyncOpts_?: { signal: AbortSignal },
@@ -1981,6 +2122,33 @@ export class CyclopsClient
);
}
+ static connectWithAccessTokenAndNativeHttpClient(
+ configuration: CyclopsTokenProviderConfiguration,
+ accessToken: string,
+ ): CyclopsClientLike /*throws*/ {
+ return FfiConverterTypeCyclopsClient.lift(
+ uniffiCaller.rustCallWithError(
+ /*liftError:*/ FfiConverterTypeSdkError.lift.bind(
+ FfiConverterTypeSdkError,
+ ),
+ /*caller:*/ (callStatus) => {
+ return nativeModule().ubrn_uniffi_cyclops_sdk_fn_constructor_cyclopsclient_connect_with_access_token_and_native_http_client(
+ FfiConverterTypeCyclopsTokenProviderConfiguration.lower(
+ configuration,
+ nativeModule().rustbuffer_alloc,
+ ),
+ FfiConverterString.lower(
+ accessToken,
+ nativeModule().rustbuffer_alloc,
+ ),
+ callStatus,
+ );
+ },
+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
+ ),
+ );
+ }
+
static connectWithAccessTokenProvider(
configuration: CyclopsTokenProviderConfiguration,
tokenProvider: AccessTokenProvider,
@@ -2013,6 +2181,55 @@ export class CyclopsClient
);
}
+ static connectWithAccessTokenProviderAndNativeHttpClient(
+ configuration: CyclopsTokenProviderConfiguration,
+ tokenProvider: AccessTokenProvider,
+ ): CyclopsClientLike /*throws*/ {
+ return FfiConverterTypeCyclopsClient.lift(
+ uniffiCaller.rustCallWithError(
+ /*liftError:*/ FfiConverterTypeSdkError.lift.bind(
+ FfiConverterTypeSdkError,
+ ),
+ /*caller:*/ (callStatus) => {
+ return nativeModule().ubrn_uniffi_cyclops_sdk_fn_constructor_cyclopsclient_connect_with_access_token_provider_and_native_http_client(
+ FfiConverterTypeCyclopsTokenProviderConfiguration.lower(
+ configuration,
+ nativeModule().rustbuffer_alloc,
+ ),
+ FfiConverterTypeAccessTokenProvider.lower(
+ tokenProvider,
+ nativeModule().rustbuffer_alloc,
+ ),
+ callStatus,
+ );
+ },
+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
+ ),
+ );
+ }
+
+ static connectWithNativeHttpClient(
+ configuration: CyclopsConfiguration,
+ ): CyclopsClientLike /*throws*/ {
+ return FfiConverterTypeCyclopsClient.lift(
+ uniffiCaller.rustCallWithError(
+ /*liftError:*/ FfiConverterTypeSdkError.lift.bind(
+ FfiConverterTypeSdkError,
+ ),
+ /*caller:*/ (callStatus) => {
+ return nativeModule().ubrn_uniffi_cyclops_sdk_fn_constructor_cyclopsclient_connect_with_native_http_client(
+ FfiConverterTypeCyclopsConfiguration.lower(
+ configuration,
+ nativeModule().rustbuffer_alloc,
+ ),
+ callStatus,
+ );
+ },
+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
+ ),
+ );
+ }
+
async createClaim(
request: CreateClaimRequest,
asyncOpts_?: { signal: AbortSignal },
@@ -2087,6 +2304,45 @@ export class CyclopsClient
);
}
+ async createTemplate(
+ request: CreateTemplateRequest,
+ asyncOpts_?: { signal: AbortSignal },
+ ): Promise<Template> /*throws*/ {
+ return await uniffiRustCallAsync(
+ /*rustCaller:*/ uniffiCaller,
+ /*rustFutureFunc:*/ () => {
+ return nativeModule().ubrn_uniffi_cyclops_sdk_fn_method_cyclopsclient_create_template(
+ uniffiTypeCyclopsClientObjectFactory.clonePointer(this),
+ FfiConverterTypeCreateTemplateRequest.lower(
+ request,
+ nativeModule().rustbuffer_alloc,
+ ),
+ );
+ },
+ /*pollFunc:*/ nativeModule()
+ .ubrn_ffi_cyclops_sdk_rust_future_poll_rust_buffer,
+ /*cancelFunc:*/ nativeModule()
+ .ubrn_ffi_cyclops_sdk_rust_future_cancel_rust_buffer,
+ /*completeFunc:*/ nativeModule()
+ .ubrn_ffi_cyclops_sdk_rust_future_complete_rust_buffer,
+ /*freeFunc:*/ nativeModule()
+ .ubrn_ffi_cyclops_sdk_rust_future_free_rust_buffer,
+ // Async returns always go through the JS-side converter: the
+ // FFI symbol returns the future handle (u64), and the user-level
+ // RustBuffer comes back via the shared `rust_future_complete_*`
+ // export. The bytes the runtime hands back must be deserialized
+ // here using the per-callable return-type converter.
+ /*liftFunc:*/ FfiConverterTypeTemplate.lift.bind(
+ FfiConverterTypeTemplate,
+ ),
+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
+ /*asyncOpts:*/ asyncOpts_,
+ /*errorHandler:*/ FfiConverterTypeSdkError.lift.bind(
+ FfiConverterTypeSdkError,
+ ),
+ );
+ }
+
async deleteClaim(
claim: Claim,
asyncOpts_?: { signal: AbortSignal },
@@ -2141,6 +2397,36 @@ export class CyclopsClient
);
}
+ async deleteTemplate(
+ template: Template,
+ asyncOpts_?: { signal: AbortSignal },
+ ): Promise<void> /*throws*/ {
+ return await uniffiRustCallAsync(
+ /*rustCaller:*/ uniffiCaller,
+ /*rustFutureFunc:*/ () => {
+ return nativeModule().ubrn_uniffi_cyclops_sdk_fn_method_cyclopsclient_delete_template(
+ uniffiTypeCyclopsClientObjectFactory.clonePointer(this),
+ FfiConverterTypeTemplate.lower(
+ template,
+ nativeModule().rustbuffer_alloc,
+ ),
+ );
+ },
+ /*pollFunc:*/ nativeModule().ubrn_ffi_cyclops_sdk_rust_future_poll_void,
+ /*cancelFunc:*/ nativeModule()
+ .ubrn_ffi_cyclops_sdk_rust_future_cancel_void,
+ /*completeFunc:*/ nativeModule()
+ .ubrn_ffi_cyclops_sdk_rust_future_complete_void,
+ /*freeFunc:*/ nativeModule().ubrn_ffi_cyclops_sdk_rust_future_free_void,
+ /*liftFunc:*/ (_v) => {},
+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
+ /*asyncOpts:*/ asyncOpts_,
+ /*errorHandler:*/ FfiConverterTypeSdkError.lift.bind(
+ FfiConverterTypeSdkError,
+ ),
+ );
+ }
+
async getClaim(
claim: Claim,
asyncOpts_?: { signal: AbortSignal },
@@ -2176,7 +2462,7 @@ export class CyclopsClient
}
async getPool(
- pool: Pool,
+ name: string,
asyncOpts_?: { signal: AbortSignal },
): Promise<Pool> /*throws*/ {
return await uniffiRustCallAsync(
@@ -2184,7 +2470,7 @@ export class CyclopsClient
/*rustFutureFunc:*/ () => {
return nativeModule().ubrn_uniffi_cyclops_sdk_fn_method_cyclopsclient_get_pool(
uniffiTypeCyclopsClientObjectFactory.clonePointer(this),
- FfiConverterTypePool.lower(pool, nativeModule().rustbuffer_alloc),
+ FfiConverterString.lower(name, nativeModule().rustbuffer_alloc),
);
},
/*pollFunc:*/ nativeModule()
@@ -2209,6 +2495,44 @@ export class CyclopsClient
);
}
+ async getTemplate(
+ namespace: string,
+ name: string,
+ asyncOpts_?: { signal: AbortSignal },
+ ): Promise<Template> /*throws*/ {
+ return await uniffiRustCallAsync(
+ /*rustCaller:*/ uniffiCaller,
+ /*rustFutureFunc:*/ () => {
+ return nativeModule().ubrn_uniffi_cyclops_sdk_fn_method_cyclopsclient_get_template(
+ uniffiTypeCyclopsClientObjectFactory.clonePointer(this),
+ FfiConverterString.lower(namespace, nativeModule().rustbuffer_alloc),
+ FfiConverterString.lower(name, nativeModule().rustbuffer_alloc),
+ );
+ },
+ /*pollFunc:*/ nativeModule()
+ .ubrn_ffi_cyclops_sdk_rust_future_poll_rust_buffer,
+ /*cancelFunc:*/ nativeModule()
+ .ubrn_ffi_cyclops_sdk_rust_future_cancel_rust_buffer,
+ /*completeFunc:*/ nativeModule()
+ .ubrn_ffi_cyclops_sdk_rust_future_complete_rust_buffer,
+ /*freeFunc:*/ nativeModule()
+ .ubrn_ffi_cyclops_sdk_rust_future_free_rust_buffer,
+ // Async returns always go through the JS-side converter: the
+ // FFI symbol returns the future handle (u64), and the user-level
+ // RustBuffer comes back via the shared `rust_future_complete_*`
+ // export. The bytes the runtime hands back must be deserialized
+ // here using the per-callable return-type converter.
+ /*liftFunc:*/ FfiConverterTypeTemplate.lift.bind(
+ FfiConverterTypeTemplate,
+ ),
+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
+ /*asyncOpts:*/ asyncOpts_,
+ /*errorHandler:*/ FfiConverterTypeSdkError.lift.bind(
+ FfiConverterTypeSdkError,
+ ),
+ );
+ }
+
async listClaims(
namespace: string,
asyncOpts_?: { signal: AbortSignal },
@@ -2281,6 +2605,118 @@ export class CyclopsClient
);
}
+ async listTemplates(
+ namespace: string,
+ asyncOpts_?: { signal: AbortSignal },
+ ): Promise<Array<Template>> /*throws*/ {
+ return await uniffiRustCallAsync(
+ /*rustCaller:*/ uniffiCaller,
+ /*rustFutureFunc:*/ () => {
+ return nativeModule().ubrn_uniffi_cyclops_sdk_fn_method_cyclopsclient_list_templates(
+ uniffiTypeCyclopsClientObjectFactory.clonePointer(this),
+ FfiConverterString.lower(namespace, nativeModule().rustbuffer_alloc),
+ );
+ },
+ /*pollFunc:*/ nativeModule()
+ .ubrn_ffi_cyclops_sdk_rust_future_poll_rust_buffer,
+ /*cancelFunc:*/ nativeModule()
+ .ubrn_ffi_cyclops_sdk_rust_future_cancel_rust_buffer,
+ /*completeFunc:*/ nativeModule()
+ .ubrn_ffi_cyclops_sdk_rust_future_complete_rust_buffer,
+ /*freeFunc:*/ nativeModule()
+ .ubrn_ffi_cyclops_sdk_rust_future_free_rust_buffer,
+ // Async returns always go through the JS-side converter: the
+ // FFI symbol returns the future handle (u64), and the user-level
+ // RustBuffer comes back via the shared `rust_future_complete_*`
+ // export. The bytes the runtime hands back must be deserialized
+ // here using the per-callable return-type converter.
+ /*liftFunc:*/ FfiConverterSequenceTypeTemplate.lift.bind(
+ FfiConverterSequenceTypeTemplate,
+ ),
+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
+ /*asyncOpts:*/ asyncOpts_,
+ /*errorHandler:*/ FfiConverterTypeSdkError.lift.bind(
+ FfiConverterTypeSdkError,
+ ),
+ );
+ }
+
+ async reconcilePool(
+ request: CreatePoolRequest,
+ asyncOpts_?: { signal: AbortSignal },
+ ): Promise<Pool> /*throws*/ {
+ return await uniffiRustCallAsync(
+ /*rustCaller:*/ uniffiCaller,
+ /*rustFutureFunc:*/ () => {
+ return nativeModule().ubrn_uniffi_cyclops_sdk_fn_method_cyclopsclient_reconcile_pool(
+ uniffiTypeCyclopsClientObjectFactory.clonePointer(this),
+ FfiConverterTypeCreatePoolRequest.lower(
+ request,
+ nativeModule().rustbuffer_alloc,
+ ),
+ );
+ },
+ /*pollFunc:*/ nativeModule()
+ .ubrn_ffi_cyclops_sdk_rust_future_poll_rust_buffer,
+ /*cancelFunc:*/ nativeModule()
+ .ubrn_ffi_cyclops_sdk_rust_future_cancel_rust_buffer,
+ /*completeFunc:*/ nativeModule()
+ .ubrn_ffi_cyclops_sdk_rust_future_complete_rust_buffer,
+ /*freeFunc:*/ nativeModule()
+ .ubrn_ffi_cyclops_sdk_rust_future_free_rust_buffer,
+ // Async returns always go through the JS-side converter: the
+ // FFI symbol returns the future handle (u64), and the user-level
+ // RustBuffer comes back via the shared `rust_future_complete_*`
+ // export. The bytes the runtime hands back must be deserialized
+ // here using the per-callable return-type converter.
+ /*liftFunc:*/ FfiConverterTypePool.lift.bind(FfiConverterTypePool),
+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
+ /*asyncOpts:*/ asyncOpts_,
+ /*errorHandler:*/ FfiConverterTypeSdkError.lift.bind(
+ FfiConverterTypeSdkError,
+ ),
+ );
+ }
+
+ async reconcileTemplate(
+ request: CreateTemplateRequest,
+ asyncOpts_?: { signal: AbortSignal },
+ ): Promise<Template> /*throws*/ {
+ return await uniffiRustCallAsync(
+ /*rustCaller:*/ uniffiCaller,
+ /*rustFutureFunc:*/ () => {
+ return nativeModule().ubrn_uniffi_cyclops_sdk_fn_method_cyclopsclient_reconcile_template(
+ uniffiTypeCyclopsClientObjectFactory.clonePointer(this),
+ FfiConverterTypeCreateTemplateRequest.lower(
+ request,
+ nativeModule().rustbuffer_alloc,
+ ),
+ );
+ },
+ /*pollFunc:*/ nativeModule()
+ .ubrn_ffi_cyclops_sdk_rust_future_poll_rust_buffer,
+ /*cancelFunc:*/ nativeModule()
+ .ubrn_ffi_cyclops_sdk_rust_future_cancel_rust_buffer,
+ /*completeFunc:*/ nativeModule()
+ .ubrn_ffi_cyclops_sdk_rust_future_complete_rust_buffer,
+ /*freeFunc:*/ nativeModule()
+ .ubrn_ffi_cyclops_sdk_rust_future_free_rust_buffer,
+ // Async returns always go through the JS-side converter: the
+ // FFI symbol returns the future handle (u64), and the user-level
+ // RustBuffer comes back via the shared `rust_future_complete_*`
+ // export. The bytes the runtime hands back must be deserialized
+ // here using the per-callable return-type converter.
+ /*liftFunc:*/ FfiConverterTypeTemplate.lift.bind(
+ FfiConverterTypeTemplate,
+ ),
+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
+ /*asyncOpts:*/ asyncOpts_,
+ /*errorHandler:*/ FfiConverterTypeSdkError.lift.bind(
+ FfiConverterTypeSdkError,
+ ),
+ );
+ }
+
async serviceRequest(
sandbox: Sandbox,
service: string,
@@ -2363,6 +2799,45 @@ export class CyclopsClient
);
}
+ async updateTemplate(
+ template: Template,
+ asyncOpts_?: { signal: AbortSignal },
+ ): Promise<Template> /*throws*/ {
+ return await uniffiRustCallAsync(
+ /*rustCaller:*/ uniffiCaller,
+ /*rustFutureFunc:*/ () => {
+ return nativeModule().ubrn_uniffi_cyclops_sdk_fn_method_cyclopsclient_update_template(
+ uniffiTypeCyclopsClientObjectFactory.clonePointer(this),
+ FfiConverterTypeTemplate.lower(
+ template,
+ nativeModule().rustbuffer_alloc,
+ ),
+ );
+ },
+ /*pollFunc:*/ nativeModule()
+ .ubrn_ffi_cyclops_sdk_rust_future_poll_rust_buffer,
+ /*cancelFunc:*/ nativeModule()
+ .ubrn_ffi_cyclops_sdk_rust_future_cancel_rust_buffer,
+ /*completeFunc:*/ nativeModule()
+ .ubrn_ffi_cyclops_sdk_rust_future_complete_rust_buffer,
+ /*freeFunc:*/ nativeModule()
+ .ubrn_ffi_cyclops_sdk_rust_future_free_rust_buffer,
+ // Async returns always go through the JS-side converter: the
+ // FFI symbol returns the future handle (u64), and the user-level
+ // RustBuffer comes back via the shared `rust_future_complete_*`
+ // export. The bytes the runtime hands back must be deserialized
+ // here using the per-callable return-type converter.
+ /*liftFunc:*/ FfiConverterTypeTemplate.lift.bind(
+ FfiConverterTypeTemplate,
+ ),
+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
+ /*asyncOpts:*/ asyncOpts_,
+ /*errorHandler:*/ FfiConverterTypeSdkError.lift.bind(
+ FfiConverterTypeSdkError,
+ ),
+ );
+ }
+
async waitClaim(
claim: Claim,
asyncOpts_?: { signal: AbortSignal },
@@ -2731,9 +3206,9 @@ const FfiConverterOptionalMapStringString = new FfiConverterOptional(
const FfiConverterOptionalTypeOSGymSandboxClaimStatus =
new FfiConverterOptional(FfiConverterTypeOSGymSandboxClaimStatus);
-// FfiConverter for OsGymWorkspacePoolStatus | undefined
-const FfiConverterOptionalTypeOSGymWorkspacePoolStatus =
- new FfiConverterOptional(FfiConverterTypeOSGymWorkspacePoolStatus);
+// FfiConverter for OsGymSandboxWarmPoolStatus | undefined
+const FfiConverterOptionalTypeOSGymSandboxWarmPoolStatus =
+ new FfiConverterOptional(FfiConverterTypeOSGymSandboxWarmPoolStatus);
// FfiConverter for ClaimSpec | undefined
const FfiConverterOptionalTypeClaimSpec = new FfiConverterOptional(
@@ -2763,6 +3238,11 @@ const FfiConverterSequenceTypePool = new FfiConverterArray(
FfiConverterTypePool,
);
+// FfiConverter for Array<Template>
+const FfiConverterSequenceTypeTemplate = new FfiConverterArray(
+ FfiConverterTypeTemplate,
+);
+
/**
* This should be called before anything else.
*
@@ -2817,6 +3297,14 @@ function uniffiEnsureInitialized() {
"uniffi_cyclops_sdk_checksum_constructor_cyclopsclient_connect_with_access_token",
);
}
+ if (
+ nativeModule().ubrn_uniffi_cyclops_sdk_checksum_constructor_cyclopsclient_connect_with_access_token_and_native_http_client() !==
+ 42291
+ ) {
+ throw new UniffiInternalError.ApiChecksumMismatch(
+ "uniffi_cyclops_sdk_checksum_constructor_cyclopsclient_connect_with_access_token_and_native_http_client",
+ );
+ }
if (
nativeModule().ubrn_uniffi_cyclops_sdk_checksum_constructor_cyclopsclient_connect_with_access_token_provider() !==
58487
@@ -2825,6 +3313,22 @@ function uniffiEnsureInitialized() {
"uniffi_cyclops_sdk_checksum_constructor_cyclopsclient_connect_with_access_token_provider",
);
}
+ if (
+ nativeModule().ubrn_uniffi_cyclops_sdk_checksum_constructor_cyclopsclient_connect_with_access_token_provider_and_native_http_client() !==
+ 62005
+ ) {
+ throw new UniffiInternalError.ApiChecksumMismatch(
+ "uniffi_cyclops_sdk_checksum_constructor_cyclopsclient_connect_with_access_token_provider_and_native_http_client",
+ );
+ }
+ if (
+ nativeModule().ubrn_uniffi_cyclops_sdk_checksum_constructor_cyclopsclient_connect_with_native_http_client() !==
+ 49301
+ ) {
+ throw new UniffiInternalError.ApiChecksumMismatch(
+ "uniffi_cyclops_sdk_checksum_constructor_cyclopsclient_connect_with_native_http_client",
+ );
+ }
if (
nativeModule().ubrn_uniffi_cyclops_sdk_checksum_method_cyclopsclient_create_claim() !==
23330
@@ -2841,6 +3345,14 @@ function uniffiEnsureInitialized() {
"uniffi_cyclops_sdk_checksum_method_cyclopsclient_create_pool",
);
}
+ if (
+ nativeModule().ubrn_uniffi_cyclops_sdk_checksum_method_cyclopsclient_create_template() !==
+ 13689
+ ) {
+ throw new UniffiInternalError.ApiChecksumMismatch(
+ "uniffi_cyclops_sdk_checksum_method_cyclopsclient_create_template",
+ );
+ }
if (
nativeModule().ubrn_uniffi_cyclops_sdk_checksum_method_cyclopsclient_delete_claim() !==
20460
@@ -2857,6 +3369,14 @@ function uniffiEnsureInitialized() {
"uniffi_cyclops_sdk_checksum_method_cyclopsclient_delete_pool",
);
}
+ if (
+ nativeModule().ubrn_uniffi_cyclops_sdk_checksum_method_cyclopsclient_delete_template() !==
+ 54852
+ ) {
+ throw new UniffiInternalError.ApiChecksumMismatch(
+ "uniffi_cyclops_sdk_checksum_method_cyclopsclient_delete_template",
+ );
+ }
if (
nativeModule().ubrn_uniffi_cyclops_sdk_checksum_method_cyclopsclient_get_claim() !==
17760
@@ -2867,12 +3387,20 @@ function uniffiEnsureInitialized() {
}
if (
nativeModule().ubrn_uniffi_cyclops_sdk_checksum_method_cyclopsclient_get_pool() !==
- 43327
+ 49450
) {
throw new UniffiInternalError.ApiChecksumMismatch(
"uniffi_cyclops_sdk_checksum_method_cyclopsclient_get_pool",
);
}
+ if (
+ nativeModule().ubrn_uniffi_cyclops_sdk_checksum_method_cyclopsclient_get_template() !==
+ 8909
+ ) {
+ throw new UniffiInternalError.ApiChecksumMismatch(
+ "uniffi_cyclops_sdk_checksum_method_cyclopsclient_get_template",
+ );
+ }
if (
nativeModule().ubrn_uniffi_cyclops_sdk_checksum_method_cyclopsclient_list_claims() !==
7802
@@ -2889,6 +3417,30 @@ function uniffiEnsureInitialized() {
"uniffi_cyclops_sdk_checksum_method_cyclopsclient_list_pools",
);
}
+ if (
+ nativeModule().ubrn_uniffi_cyclops_sdk_checksum_method_cyclopsclient_list_templates() !==
+ 58376
+ ) {
+ throw new UniffiInternalError.ApiChecksumMismatch(
+ "uniffi_cyclops_sdk_checksum_method_cyclopsclient_list_templates",
+ );
+ }
+ if (
+ nativeModule().ubrn_uniffi_cyclops_sdk_checksum_method_cyclopsclient_reconcile_pool() !==
+ 53919
+ ) {
+ throw new UniffiInternalError.ApiChecksumMismatch(
+ "uniffi_cyclops_sdk_checksum_method_cyclopsclient_reconcile_pool",
+ );
+ }
+ if (
+ nativeModule().ubrn_uniffi_cyclops_sdk_checksum_method_cyclopsclient_reconcile_template() !==
+ 36469
+ ) {
+ throw new UniffiInternalError.ApiChecksumMismatch(
+ "uniffi_cyclops_sdk_checksum_method_cyclopsclient_reconcile_template",
+ );
+ }
if (
nativeModule().ubrn_uniffi_cyclops_sdk_checksum_method_cyclopsclient_service_request() !==
46699
@@ -2905,6 +3457,14 @@ function uniffiEnsureInitialized() {
"uniffi_cyclops_sdk_checksum_method_cyclopsclient_update_pool",
);
}
+ if (
+ nativeModule().ubrn_uniffi_cyclops_sdk_checksum_method_cyclopsclient_update_template() !==
+ 18704
+ ) {
+ throw new UniffiInternalError.ApiChecksumMismatch(
+ "uniffi_cyclops_sdk_checksum_method_cyclopsclient_update_template",
+ );
+ }
if (
nativeModule().ubrn_uniffi_cyclops_sdk_checksum_method_cyclopsclient_wait_claim() !==
18984
@@ -2942,6 +3502,7 @@ export default Object.freeze({
FfiConverterTypeClaim,
FfiConverterTypeCreateClaimRequest,
FfiConverterTypeCreatePoolRequest,
+ FfiConverterTypeCreateTemplateRequest,
FfiConverterTypeCyclopsClient,
FfiConverterTypeCyclopsConfiguration,
FfiConverterTypeCyclopsCredentials,
@@ -2955,5 +3516,6 @@ export default Object.freeze({
FfiConverterTypeResourceMetadata,
FfiConverterTypeSandbox,
FfiConverterTypeSdkError,
+ FfiConverterTypeTemplate,
},
});
diff --git a/libs/fleet/sdk-bindings/ts-uniffi/cyclops_sdk_schema-ffi.ts b/libs/fleet/sdk-bindings/ts-uniffi/cyclops_sdk_schema-ffi.ts
index 6f7788b709..528d2607cf 100644
--- a/libs/fleet/sdk-bindings/ts-uniffi/cyclops_sdk_schema-ffi.ts
+++ b/libs/fleet/sdk-bindings/ts-uniffi/cyclops_sdk_schema-ffi.ts
@@ -273,21 +273,6 @@ const DEFINITIONS = {
ret: FfiType.Void,
hasRustCallStatus: true,
},
- "uniffi_cyclops_sdk_schema_fn_method_poolspec_uniffi_trait_eq_eq": {
- args: [FfiType.RustBuffer, FfiType.RustBuffer],
- ret: FfiType.Int8,
- hasRustCallStatus: true,
- },
- "uniffi_cyclops_sdk_schema_fn_method_poolspec_uniffi_trait_eq_ne": {
- args: [FfiType.RustBuffer, FfiType.RustBuffer],
- ret: FfiType.Int8,
- hasRustCallStatus: true,
- },
- "uniffi_cyclops_sdk_schema_fn_method_poolspec_uniffi_trait_hash": {
- args: [FfiType.RustBuffer],
- ret: FfiType.UInt64,
- hasRustCallStatus: true,
- },
"uniffi_cyclops_sdk_schema_fn_constructor_preservedjson_from_json": {
args: [FfiType.RustBuffer],
ret: FfiType.Handle,
@@ -385,9 +370,6 @@ interface NativeModuleInterface {
ffi_cyclops_sdk_schema_rust_future_free_void(handle: bigint): void;
uniffi_cyclops_sdk_schema_fn_clone_preservedjson(ptr: bigint, uniffi_out_err: UniffiRustCallStatus): bigint;
uniffi_cyclops_sdk_schema_fn_free_preservedjson(ptr: bigint, uniffi_out_err: UniffiRustCallStatus): void;
- uniffi_cyclops_sdk_schema_fn_method_poolspec_uniffi_trait_eq_eq(uniffiSelf: Uint8Array, other: Uint8Array, uniffi_out_err: UniffiRustCallStatus): number;
- uniffi_cyclops_sdk_schema_fn_method_poolspec_uniffi_trait_eq_ne(uniffiSelf: Uint8Array, other: Uint8Array, uniffi_out_err: UniffiRustCallStatus): number;
- uniffi_cyclops_sdk_schema_fn_method_poolspec_uniffi_trait_hash(uniffiSelf: Uint8Array, uniffi_out_err: UniffiRustCallStatus): bigint;
uniffi_cyclops_sdk_schema_fn_constructor_preservedjson_from_json(value: Uint8Array, uniffi_out_err: UniffiRustCallStatus): bigint;
uniffi_cyclops_sdk_schema_fn_method_preservedjson_to_json(uniffiSelf: bigint, uniffi_out_err: UniffiRustCallStatus): Uint8Array;
ffi_cyclops_sdk_schema_uniffi_contract_version(): number;
diff --git a/libs/fleet/sdk-bindings/ts-uniffi/cyclops_sdk_schema.ts b/libs/fleet/sdk-bindings/ts-uniffi/cyclops_sdk_schema.ts
index 95e45c47b4..6a890978fd 100644
--- a/libs/fleet/sdk-bindings/ts-uniffi/cyclops_sdk_schema.ts
+++ b/libs/fleet/sdk-bindings/ts-uniffi/cyclops_sdk_schema.ts
@@ -6,7 +6,7 @@
import nativeModule from "./cyclops_sdk_schema-ffi";
import { type UniffiRustFutureContinuationCallback, type UniffiForeignFutureDroppedCallback, type UniffiForeignFutureDroppedCallbackStruct,
} from "./cyclops_sdk_schema-ffi";
-import { type FfiConverter, type UniffiByteArray, type UniffiGcObject, type UniffiHandle, type UniffiObjectFactory, AbstractFfiConverterByteArray, FfiConverterArray, FfiConverterBool, FfiConverterInt32, FfiConverterMap, FfiConverterObject, FfiConverterOptional, FfiConverterUInt16, FfiConverterUInt32, FfiConverterUInt64, FfiConverterUInt8, RustBuffer, UniffiAbstractObject, UniffiEnum, UniffiError, UniffiInternalError, UniffiRustCaller, destructorGuardSymbol, pointerLiteralSymbol, uniffiCreateFfiConverterString, uniffiCreateRecord, uniffiTypeNameSymbol, variantOrdinalSymbol,
+import { type FfiConverter, type UniffiByteArray, type UniffiGcObject, type UniffiHandle, type UniffiObjectFactory, AbstractFfiConverterByteArray, FfiConverterArray, FfiConverterBool, FfiConverterInt32, FfiConverterMap, FfiConverterObject, FfiConverterOptional, FfiConverterUInt16, FfiConverterUInt32, FfiConverterUInt8, RustBuffer, UniffiAbstractObject, UniffiEnum, UniffiError, UniffiInternalError, UniffiRustCaller, destructorGuardSymbol, pointerLiteralSymbol, uniffiCreateFfiConverterString, uniffiCreateRecord, uniffiTypeNameSymbol, variantOrdinalSymbol,
} from "@ubjs/core";
const uniffiCaller = new UniffiRustCaller(() => ({ code: 0 }));
@@ -1057,214 +1057,6 @@ const FfiConverterTypeOSGymSandboxWarmPoolStatus = (() => {
return new FFIConverter();
})();
-export type OsGymWorkspacePoolStatus = {
- phase?: string,
- totalCount?: number,
- availableCount?: number,
- claimedCount?: number
-}
-
-/**
- * Generated factory for {@link OsGymWorkspacePoolStatus} record objects.
- */
-export const OsGymWorkspacePoolStatus = (() => {
- const defaults = () => ({
- });
- const create = (() => {
- return uniffiCreateRecord<OsGymWorkspacePoolStatus, ReturnType<typeof defaults>>(defaults);
- })();
- return Object.freeze({
- create,
- new: create,
- defaults: () => Object.freeze(defaults()) as Partial<OsGymWorkspacePoolStatus>,
- });
-})();
-
-const FfiConverterTypeOSGymWorkspacePoolStatus = (() => {
- type TypeName = OsGymWorkspacePoolStatus;
- class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
- read(from: RustBuffer): TypeName {
- return {
- phase: FfiConverterOptionalString.read(from),
- totalCount: FfiConverterOptionalUInt32.read(from),
- availableCount: FfiConverterOptionalUInt32.read(from),
- claimedCount: FfiConverterOptionalUInt32.read(from)
- };
- }
- write(value: TypeName, into: RustBuffer): void {
- FfiConverterOptionalString.write(value.phase, into);
- FfiConverterOptionalUInt32.write(value.totalCount, into);
- FfiConverterOptionalUInt32.write(value.availableCount, into);
- FfiConverterOptionalUInt32.write(value.claimedCount, into);
- }
- allocationSize(value: TypeName): number {
- return FfiConverterOptionalString.allocationSize(value.phase) +
- FfiConverterOptionalUInt32.allocationSize(value.totalCount) +
- FfiConverterOptionalUInt32.allocationSize(value.availableCount) +
- FfiConverterOptionalUInt32.allocationSize(value.claimedCount);
-
- }
- };
- return new FFIConverter();
-})();
-
-export type PoolTemplate = {
- runtime?: RuntimeKind,
- runtimeClassName?: string,
- nodeSelector?: Map<string, string>,
- tolerations?: Array<PreservedJsonLike>,
- command?: Array<string>,
- containerDiskImage: string,
- imagePullSecret?: string,
- cpuCores?: number,
- memory?: string,
- firmware?: Firmware,
- probes?: PreservedJsonLike,
- oidc?: OidcConfig
-}
-
-/**
- * Generated factory for {@link PoolTemplate} record objects.
- */
-export const PoolTemplate = (() => {
- const defaults = () => ({
- });
- const create = (() => {
- return uniffiCreateRecord<PoolTemplate, ReturnType<typeof defaults>>(defaults);
- })();
- return Object.freeze({
- create,
- new: create,
- defaults: () => Object.freeze(defaults()) as Partial<PoolTemplate>,
- });
-})();
-
-const FfiConverterTypePoolTemplate = (() => {
- type TypeName = PoolTemplate;
- class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
- read(from: RustBuffer): TypeName {
- return {
- runtime: FfiConverterOptionalTypeRuntimeKind.read(from),
- runtimeClassName: FfiConverterOptionalString.read(from),
- nodeSelector: FfiConverterOptionalMapStringString.read(from),
- tolerations: FfiConverterOptionalSequenceTypePreservedJson.read(from),
- command: FfiConverterOptionalSequenceString.read(from),
- containerDiskImage: FfiConverterString.read(from),
- imagePullSecret: FfiConverterOptionalString.read(from),
- cpuCores: FfiConverterOptionalUInt32.read(from),
- memory: FfiConverterOptionalString.read(from),
- firmware: FfiConverterOptionalTypeFirmware.read(from),
- probes: FfiConverterOptionalTypePreservedJson.read(from),
- oidc: FfiConverterOptionalTypeOidcConfig.read(from)
- };
- }
- write(value: TypeName, into: RustBuffer): void {
- FfiConverterOptionalTypeRuntimeKind.write(value.runtime, into);
- FfiConverterOptionalString.write(value.runtimeClassName, into);
- FfiConverterOptionalMapStringString.write(value.nodeSelector, into);
- FfiConverterOptionalSequenceTypePreservedJson.write(value.tolerations, into);
- FfiConverterOptionalSequenceString.write(value.command, into);
- FfiConverterString.write(value.containerDiskImage, into);
- FfiConverterOptionalString.write(value.imagePullSecret, into);
- FfiConverterOptionalUInt32.write(value.cpuCores, into);
- FfiConverterOptionalString.write(value.memory, into);
- FfiConverterOptionalTypeFirmware.write(value.firmware, into);
- FfiConverterOptionalTypePreservedJson.write(value.probes, into);
- FfiConverterOptionalTypeOidcConfig.write(value.oidc, into);
- }
- allocationSize(value: TypeName): number {
- return FfiConverterOptionalTypeRuntimeKind.allocationSize(value.runtime) +
- FfiConverterOptionalString.allocationSize(value.runtimeClassName) +
- FfiConverterOptionalMapStringString.allocationSize(value.nodeSelector) +
- FfiConverterOptionalSequenceTypePreservedJson.allocationSize(value.tolerations) +
- FfiConverterOptionalSequenceString.allocationSize(value.command) +
- FfiConverterString.allocationSize(value.containerDiskImage) +
- FfiConverterOptionalString.allocationSize(value.imagePullSecret) +
- FfiConverterOptionalUInt32.allocationSize(value.cpuCores) +
- FfiConverterOptionalString.allocationSize(value.memory) +
- FfiConverterOptionalTypeFirmware.allocationSize(value.firmware) +
- FfiConverterOptionalTypePreservedJson.allocationSize(value.probes) +
- FfiConverterOptionalTypeOidcConfig.allocationSize(value.oidc);
-
- }
- };
- return new FFIConverter();
-})();
-
-export type PoolSpec = {
- replicas: number,
- template: PoolTemplate,
- autoscaling?: WarmPoolAutoscaling,
- services?: Array<SandboxService>
-}
-
-/**
- * Generated factory for {@link PoolSpec} record objects.
- */
-export const PoolSpec = (() => {
- const defaults = () => ({
- });
- const create = (() => {
- return uniffiCreateRecord<PoolSpec, ReturnType<typeof defaults>>(defaults);
- })();
- return Object.freeze({
- create,
- new: create,
- defaults: () => Object.freeze(defaults()) as Partial<PoolSpec>,
- equals(self_: PoolSpec, other: PoolSpec): boolean {
-
- return FfiConverterBool.lift(uniffiCaller.rustCall(
- /*caller:*/ (callStatus) => {
- return nativeModule().uniffi_cyclops_sdk_schema_fn_method_poolspec_uniffi_trait_eq_eq(
- FfiConverterTypePoolSpec.lower(self_, nativeModule().rustbuffer_alloc),
- FfiConverterTypePoolSpec.lower(other, nativeModule().rustbuffer_alloc),
- callStatus);
- },
- /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
- ));
- },
- hashCode(self_: PoolSpec): bigint {
-
- return FfiConverterUInt64.lift(uniffiCaller.rustCall(
- /*caller:*/ (callStatus) => {
- return nativeModule().uniffi_cyclops_sdk_schema_fn_method_poolspec_uniffi_trait_hash(
- FfiConverterTypePoolSpec.lower(self_, nativeModule().rustbuffer_alloc),
- callStatus);
- },
- /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
- ));
- },
- });
-})();
-
-const FfiConverterTypePoolSpec = (() => {
- type TypeName = PoolSpec;
- class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
- read(from: RustBuffer): TypeName {
- return {
- replicas: FfiConverterUInt32.read(from),
- template: FfiConverterTypePoolTemplate.read(from),
- autoscaling: FfiConverterOptionalTypeWarmPoolAutoscaling.read(from),
- services: FfiConverterOptionalSequenceTypeSandboxService.read(from)
- };
- }
- write(value: TypeName, into: RustBuffer): void {
- FfiConverterUInt32.write(value.replicas, into);
- FfiConverterTypePoolTemplate.write(value.template, into);
- FfiConverterOptionalTypeWarmPoolAutoscaling.write(value.autoscaling, into);
- FfiConverterOptionalSequenceTypeSandboxService.write(value.services, into);
- }
- allocationSize(value: TypeName): number {
- return FfiConverterUInt32.allocationSize(value.replicas) +
- FfiConverterTypePoolTemplate.allocationSize(value.template) +
- FfiConverterOptionalTypeWarmPoolAutoscaling.allocationSize(value.autoscaling) +
- FfiConverterOptionalSequenceTypeSandboxService.allocationSize(value.services);
-
- }
- };
- return new FFIConverter();
-})();
-
// Error type: JsonValueError
export enum JsonValueError_Tags {
@@ -1474,10 +1266,7 @@ export default Object.freeze({
FfiConverterTypeOSGymSandboxTemplateSpec,
FfiConverterTypeOSGymSandboxWarmPoolSpec,
FfiConverterTypeOSGymSandboxWarmPoolStatus,
- FfiConverterTypeOSGymWorkspacePoolStatus,
FfiConverterTypeOidcConfig,
- FfiConverterTypePoolSpec,
- FfiConverterTypePoolTemplate,
FfiConverterTypePreservedJson,
FfiConverterTypeRuntimeKind,
FfiConverterTypeSandboxService,
diff --git a/libs/fleet/sdk-bindings/ts-uniffi/examples/node.ts b/libs/fleet/sdk-bindings/ts-uniffi/examples/node.ts
index 804c0ba3fd..efccc5dfb9 100644
--- a/libs/fleet/sdk-bindings/ts-uniffi/examples/node.ts
+++ b/libs/fleet/sdk-bindings/ts-uniffi/examples/node.ts
@@ -8,7 +8,10 @@ import {
type HttpRequest,
type HttpResponse,
type Pool,
- type PoolSpec,
+ type CreateTemplateRequest,
+ type OsGymSandboxWarmPoolSpec,
+ type OsGymSandboxTemplateSpec,
+ type Template,
} from "../index.ts";
const serviceName = "mcp";
@@ -35,17 +38,23 @@ function requiredEnv(name: string): string {
return value;
}
-function poolSpec(image: string, imagePullSecret?: string): PoolSpec {
+function templateSpec(image: string, imagePullSecret?: string): OsGymSandboxTemplateSpec {
return {
- replicas: 1,
- template: {
+ vmTemplate: {
// The live example requests the same resources as the working SDK examples.
containerDiskImage: image,
imagePullSecret,
cpuCores: 4,
memory: "4Gi",
+ services: [{ name: serviceName, targetPort: 3000 }],
},
- services: [{ name: serviceName, targetPort: 3000 }],
+ };
+}
+
+function poolSpec(namespace: string): OsGymSandboxWarmPoolSpec {
+ return {
+ replicas: 1,
+ sandboxTemplateRef: { name: `${namespace}-template` },
};
}
@@ -63,11 +72,18 @@ async function main(): Promise<void> {
}, new FetchHttpClient());
let pool: Pool | undefined;
+ let template: Template | undefined;
let claim: Claim | undefined;
try {
- console.log("[1/5] Creating pool...");
- const createPool: CreatePoolRequest = { namespace, spec: poolSpec(image, process.env.CYCLOPS_IMAGE_PULL_SECRET) };
+ console.log("[1/5] Creating pool and template...");
+ const createPool: CreatePoolRequest = { namespace, spec: poolSpec(namespace) };
pool = await client.createPool(createPool);
+ const createTemplate: CreateTemplateRequest = {
+ namespace,
+ name: `${namespace}-template`,
+ spec: templateSpec(image, process.env.CYCLOPS_IMAGE_PULL_SECRET),
+ };
+ template = await client.createTemplate(createTemplate);
console.log(pool);
console.log("[2/5] Creating claim...");
@@ -90,6 +106,10 @@ async function main(): Promise<void> {
console.log("[cleanup] Deleting claim...");
await client.deleteClaim(claim);
}
+ if (template) {
+ console.log("[cleanup] Deleting template...");
+ await client.deleteTemplate(template);
+ }
if (pool) {
console.log("[cleanup] Deleting pool...");
await client.deletePool(pool);
diff --git a/libs/fleet/sdk-bindings/ts-uniffi/cyclops_sdk-ffi.ts b/libs/fleet/sdk-bindings/ts-uniffi/fleet_sdk-ffi.ts
similarity index 67%
rename from libs/fleet/sdk-bindings/ts-uniffi/cyclops_sdk-ffi.ts
rename to libs/fleet/sdk-bindings/ts-uniffi/fleet_sdk-ffi.ts
index ef89900b43..05f781907d 100644
--- a/libs/fleet/sdk-bindings/ts-uniffi/cyclops_sdk-ffi.ts
+++ b/libs/fleet/sdk-bindings/ts-uniffi/fleet_sdk-ffi.ts
@@ -263,6 +263,16 @@ const DEFINITIONS = {
ret: FfiType.Void,
hasRustCallStatus: false,
},
+ "uniffi_cyclops_sdk_fn_clone_accesstokenprovider": {
+ args: [FfiType.Handle],
+ ret: FfiType.Handle,
+ hasRustCallStatus: true,
+ },
+ "uniffi_cyclops_sdk_fn_free_accesstokenprovider": {
+ args: [FfiType.Handle],
+ ret: FfiType.Void,
+ hasRustCallStatus: true,
+ },
"uniffi_cyclops_sdk_fn_clone_cyclopsclient": {
args: [FfiType.Handle],
ret: FfiType.Handle,
@@ -293,16 +303,56 @@ const DEFINITIONS = {
ret: FfiType.Void,
hasRustCallStatus: true,
},
+ "uniffi_cyclops_sdk_fn_init_callback_vtable_accesstokenprovider": {
+ args: [FfiType.Reference(FfiType.Struct("VTableCallbackInterfaceFleetSdkAccessTokenProvider"))],
+ ret: FfiType.Void,
+ hasRustCallStatus: false,
+ },
"uniffi_cyclops_sdk_fn_init_callback_vtable_httpclient": {
- args: [FfiType.Reference(FfiType.Struct("VTableCallbackInterfaceCyclopsSdkHttpClient"))],
+ args: [FfiType.Reference(FfiType.Struct("VTableCallbackInterfaceFleetSdkHttpClient"))],
ret: FfiType.Void,
hasRustCallStatus: false,
},
+ "uniffi_cyclops_sdk_fn_method_accesstokenprovider_get_access_token": {
+ args: [FfiType.Handle, FfiType.Int8],
+ ret: FfiType.Handle,
+ hasRustCallStatus: false,
+ },
"uniffi_cyclops_sdk_fn_constructor_cyclopsclient_connect": {
args: [FfiType.RustBuffer, FfiType.Handle],
ret: FfiType.Handle,
hasRustCallStatus: true,
},
+ "uniffi_cyclops_sdk_fn_constructor_cyclopsclient_connect_browser_with_access_token": {
+ args: [FfiType.RustBuffer, FfiType.RustBuffer],
+ ret: FfiType.Handle,
+ hasRustCallStatus: true,
+ },
+ "uniffi_cyclops_sdk_fn_constructor_cyclopsclient_connect_with_access_token": {
+ args: [FfiType.RustBuffer, FfiType.RustBuffer, FfiType.Handle],
+ ret: FfiType.Handle,
+ hasRustCallStatus: true,
+ },
+ "uniffi_cyclops_sdk_fn_constructor_cyclopsclient_connect_with_access_token_and_native_http_client": {
+ args: [FfiType.RustBuffer, FfiType.RustBuffer],
+ ret: FfiType.Handle,
+ hasRustCallStatus: true,
+ },
+ "uniffi_cyclops_sdk_fn_constructor_cyclopsclient_connect_with_access_token_provider": {
+ args: [FfiType.RustBuffer, FfiType.Handle, FfiType.Handle],
+ ret: FfiType.Handle,
+ hasRustCallStatus: true,
+ },
+ "uniffi_cyclops_sdk_fn_constructor_cyclopsclient_connect_with_access_token_provider_and_native_http_client": {
+ args: [FfiType.RustBuffer, FfiType.Handle],
+ ret: FfiType.Handle,
+ hasRustCallStatus: true,
+ },
+ "uniffi_cyclops_sdk_fn_constructor_cyclopsclient_connect_with_native_http_client": {
+ args: [FfiType.RustBuffer],
+ ret: FfiType.Handle,
+ hasRustCallStatus: true,
+ },
"uniffi_cyclops_sdk_fn_method_cyclopsclient_create_claim": {
args: [FfiType.Handle, FfiType.RustBuffer],
ret: FfiType.Handle,
@@ -313,6 +363,11 @@ const DEFINITIONS = {
ret: FfiType.Handle,
hasRustCallStatus: false,
},
+ "uniffi_cyclops_sdk_fn_method_cyclopsclient_create_template": {
+ args: [FfiType.Handle, FfiType.RustBuffer],
+ ret: FfiType.Handle,
+ hasRustCallStatus: false,
+ },
"uniffi_cyclops_sdk_fn_method_cyclopsclient_delete_claim": {
args: [FfiType.Handle, FfiType.RustBuffer],
ret: FfiType.Handle,
@@ -323,6 +378,11 @@ const DEFINITIONS = {
ret: FfiType.Handle,
hasRustCallStatus: false,
},
+ "uniffi_cyclops_sdk_fn_method_cyclopsclient_delete_template": {
+ args: [FfiType.Handle, FfiType.RustBuffer],
+ ret: FfiType.Handle,
+ hasRustCallStatus: false,
+ },
"uniffi_cyclops_sdk_fn_method_cyclopsclient_get_claim": {
args: [FfiType.Handle, FfiType.RustBuffer],
ret: FfiType.Handle,
@@ -333,6 +393,11 @@ const DEFINITIONS = {
ret: FfiType.Handle,
hasRustCallStatus: false,
},
+ "uniffi_cyclops_sdk_fn_method_cyclopsclient_get_template": {
+ args: [FfiType.Handle, FfiType.RustBuffer, FfiType.RustBuffer],
+ ret: FfiType.Handle,
+ hasRustCallStatus: false,
+ },
"uniffi_cyclops_sdk_fn_method_cyclopsclient_list_claims": {
args: [FfiType.Handle, FfiType.RustBuffer],
ret: FfiType.Handle,
@@ -343,6 +408,21 @@ const DEFINITIONS = {
ret: FfiType.Handle,
hasRustCallStatus: false,
},
+ "uniffi_cyclops_sdk_fn_method_cyclopsclient_list_templates": {
+ args: [FfiType.Handle, FfiType.RustBuffer],
+ ret: FfiType.Handle,
+ hasRustCallStatus: false,
+ },
+ "uniffi_cyclops_sdk_fn_method_cyclopsclient_reconcile_pool": {
+ args: [FfiType.Handle, FfiType.RustBuffer],
+ ret: FfiType.Handle,
+ hasRustCallStatus: false,
+ },
+ "uniffi_cyclops_sdk_fn_method_cyclopsclient_reconcile_template": {
+ args: [FfiType.Handle, FfiType.RustBuffer],
+ ret: FfiType.Handle,
+ hasRustCallStatus: false,
+ },
"uniffi_cyclops_sdk_fn_method_cyclopsclient_service_request": {
args: [FfiType.Handle, FfiType.RustBuffer, FfiType.RustBuffer, FfiType.RustBuffer, FfiType.RustBuffer],
ret: FfiType.Handle,
@@ -353,6 +433,11 @@ const DEFINITIONS = {
ret: FfiType.Handle,
hasRustCallStatus: false,
},
+ "uniffi_cyclops_sdk_fn_method_cyclopsclient_update_template": {
+ args: [FfiType.Handle, FfiType.RustBuffer],
+ ret: FfiType.Handle,
+ hasRustCallStatus: false,
+ },
"uniffi_cyclops_sdk_fn_method_cyclopsclient_wait_claim": {
args: [FfiType.Handle, FfiType.RustBuffer],
ret: FfiType.Handle,
@@ -373,11 +458,46 @@ const DEFINITIONS = {
ret: FfiType.UInt32,
hasRustCallStatus: false,
},
+ "uniffi_cyclops_sdk_checksum_method_accesstokenprovider_get_access_token": {
+ args: [],
+ ret: FfiType.UInt16,
+ hasRustCallStatus: false,
+ },
"uniffi_cyclops_sdk_checksum_constructor_cyclopsclient_connect": {
args: [],
ret: FfiType.UInt16,
hasRustCallStatus: false,
},
+ "uniffi_cyclops_sdk_checksum_constructor_cyclopsclient_connect_browser_with_access_token": {
+ args: [],
+ ret: FfiType.UInt16,
+ hasRustCallStatus: false,
+ },
+ "uniffi_cyclops_sdk_checksum_constructor_cyclopsclient_connect_with_access_token": {
+ args: [],
+ ret: FfiType.UInt16,
+ hasRustCallStatus: false,
+ },
+ "uniffi_cyclops_sdk_checksum_constructor_cyclopsclient_connect_with_access_token_and_native_http_client": {
+ args: [],
+ ret: FfiType.UInt16,
+ hasRustCallStatus: false,
+ },
+ "uniffi_cyclops_sdk_checksum_constructor_cyclopsclient_connect_with_access_token_provider": {
+ args: [],
+ ret: FfiType.UInt16,
+ hasRustCallStatus: false,
+ },
+ "uniffi_cyclops_sdk_checksum_constructor_cyclopsclient_connect_with_access_token_provider_and_native_http_client": {
+ args: [],
+ ret: FfiType.UInt16,
+ hasRustCallStatus: false,
+ },
+ "uniffi_cyclops_sdk_checksum_constructor_cyclopsclient_connect_with_native_http_client": {
+ args: [],
+ ret: FfiType.UInt16,
+ hasRustCallStatus: false,
+ },
"uniffi_cyclops_sdk_checksum_method_cyclopsclient_create_claim": {
args: [],
ret: FfiType.UInt16,
@@ -388,6 +508,11 @@ const DEFINITIONS = {
ret: FfiType.UInt16,
hasRustCallStatus: false,
},
+ "uniffi_cyclops_sdk_checksum_method_cyclopsclient_create_template": {
+ args: [],
+ ret: FfiType.UInt16,
+ hasRustCallStatus: false,
+ },
"uniffi_cyclops_sdk_checksum_method_cyclopsclient_delete_claim": {
args: [],
ret: FfiType.UInt16,
@@ -398,6 +523,11 @@ const DEFINITIONS = {
ret: FfiType.UInt16,
hasRustCallStatus: false,
},
+ "uniffi_cyclops_sdk_checksum_method_cyclopsclient_delete_template": {
+ args: [],
+ ret: FfiType.UInt16,
+ hasRustCallStatus: false,
+ },
"uniffi_cyclops_sdk_checksum_method_cyclopsclient_get_claim": {
args: [],
ret: FfiType.UInt16,
@@ -408,6 +538,11 @@ const DEFINITIONS = {
ret: FfiType.UInt16,
hasRustCallStatus: false,
},
+ "uniffi_cyclops_sdk_checksum_method_cyclopsclient_get_template": {
+ args: [],
+ ret: FfiType.UInt16,
+ hasRustCallStatus: false,
+ },
"uniffi_cyclops_sdk_checksum_method_cyclopsclient_list_claims": {
args: [],
ret: FfiType.UInt16,
@@ -418,6 +553,21 @@ const DEFINITIONS = {
ret: FfiType.UInt16,
hasRustCallStatus: false,
},
+ "uniffi_cyclops_sdk_checksum_method_cyclopsclient_list_templates": {
+ args: [],
+ ret: FfiType.UInt16,
+ hasRustCallStatus: false,
+ },
+ "uniffi_cyclops_sdk_checksum_method_cyclopsclient_reconcile_pool": {
+ args: [],
+ ret: FfiType.UInt16,
+ hasRustCallStatus: false,
+ },
+ "uniffi_cyclops_sdk_checksum_method_cyclopsclient_reconcile_template": {
+ args: [],
+ ret: FfiType.UInt16,
+ hasRustCallStatus: false,
+ },
"uniffi_cyclops_sdk_checksum_method_cyclopsclient_service_request": {
args: [],
ret: FfiType.UInt16,
@@ -428,6 +578,11 @@ const DEFINITIONS = {
ret: FfiType.UInt16,
hasRustCallStatus: false,
},
+ "uniffi_cyclops_sdk_checksum_method_cyclopsclient_update_template": {
+ args: [],
+ ret: FfiType.UInt16,
+ hasRustCallStatus: false,
+ },
"uniffi_cyclops_sdk_checksum_method_cyclopsclient_wait_claim": {
args: [],
ret: FfiType.UInt16,
@@ -460,18 +615,34 @@ const DEFINITIONS = {
ret: FfiType.Void,
hasRustCallStatus: false,
},
- "CallbackInterfaceCyclopsSdkHttpClientMethod0": {
+ "CallbackInterfaceFleetSdkAccessTokenProviderMethod0": {
+ args: [FfiType.Handle, FfiType.Int8, FfiType.Callback("ForeignFutureCompleterust_buffer"), FfiType.Handle],
+ ret: FfiType.Struct("ForeignFutureDroppedCallbackStruct"),
+ hasRustCallStatus: false,
+ outReturn: true,
+ },
+ "CallbackInterfaceCloneFleetSdk_AccessTokenProvider": {
+ args: [FfiType.Handle],
+ ret: FfiType.Handle,
+ hasRustCallStatus: false,
+ },
+ "CallbackInterfaceFreeFleetSdk_AccessTokenProvider": {
+ args: [FfiType.Handle],
+ ret: FfiType.Void,
+ hasRustCallStatus: false,
+ },
+ "CallbackInterfaceFleetSdkHttpClientMethod0": {
args: [FfiType.Handle, FfiType.RustBuffer, FfiType.Callback("ForeignFutureCompleterust_buffer"), FfiType.Handle],
ret: FfiType.Struct("ForeignFutureDroppedCallbackStruct"),
hasRustCallStatus: false,
outReturn: true,
},
- "CallbackInterfaceCloneCyclopsSdk_HttpClient": {
+ "CallbackInterfaceCloneFleetSdk_HttpClient": {
args: [FfiType.Handle],
ret: FfiType.Handle,
hasRustCallStatus: false,
},
- "CallbackInterfaceFreeCyclopsSdk_HttpClient": {
+ "CallbackInterfaceFreeFleetSdk_HttpClient": {
args: [FfiType.Handle],
ret: FfiType.Void,
hasRustCallStatus: false,
@@ -486,10 +657,15 @@ const DEFINITIONS = {
{ name: "return_value", type: FfiType.RustBuffer },
{ name: "call_status", type: FfiType.RustCallStatus },
],
- "VTableCallbackInterfaceCyclopsSdkHttpClient": [
- { name: "uniffi_free", type: FfiType.Callback("CallbackInterfaceFreeCyclopsSdk_HttpClient") },
- { name: "uniffi_clone", type: FfiType.Callback("CallbackInterfaceCloneCyclopsSdk_HttpClient") },
- { name: "execute", type: FfiType.Callback("CallbackInterfaceCyclopsSdkHttpClientMethod0") },
+ "VTableCallbackInterfaceFleetSdkAccessTokenProvider": [
+ { name: "uniffi_free", type: FfiType.Callback("CallbackInterfaceFreeFleetSdk_AccessTokenProvider") },
+ { name: "uniffi_clone", type: FfiType.Callback("CallbackInterfaceCloneFleetSdk_AccessTokenProvider") },
+ { name: "get_access_token", type: FfiType.Callback("CallbackInterfaceFleetSdkAccessTokenProviderMethod0") },
+ ],
+ "VTableCallbackInterfaceFleetSdkHttpClient": [
+ { name: "uniffi_free", type: FfiType.Callback("CallbackInterfaceFreeFleetSdk_HttpClient") },
+ { name: "uniffi_clone", type: FfiType.Callback("CallbackInterfaceCloneFleetSdk_HttpClient") },
+ { name: "execute", type: FfiType.Callback("CallbackInterfaceFleetSdkHttpClientMethod0") },
],
},
} as const;
@@ -543,39 +719,70 @@ interface NativeModuleInterface {
ffi_cyclops_sdk_rust_future_cancel_void(handle: bigint): void;
ffi_cyclops_sdk_rust_future_complete_void(handle: bigint, uniffi_out_err: UniffiRustCallStatus): void;
ffi_cyclops_sdk_rust_future_free_void(handle: bigint): void;
+ uniffi_cyclops_sdk_fn_clone_accesstokenprovider(ptr: bigint, uniffi_out_err: UniffiRustCallStatus): bigint;
+ uniffi_cyclops_sdk_fn_free_accesstokenprovider(ptr: bigint, uniffi_out_err: UniffiRustCallStatus): void;
uniffi_cyclops_sdk_fn_clone_cyclopsclient(ptr: bigint, uniffi_out_err: UniffiRustCallStatus): bigint;
uniffi_cyclops_sdk_fn_free_cyclopsclient(ptr: bigint, uniffi_out_err: UniffiRustCallStatus): void;
uniffi_cyclops_sdk_fn_clone_cyclopscredentials(ptr: bigint, uniffi_out_err: UniffiRustCallStatus): bigint;
uniffi_cyclops_sdk_fn_free_cyclopscredentials(ptr: bigint, uniffi_out_err: UniffiRustCallStatus): void;
uniffi_cyclops_sdk_fn_clone_httpclient(ptr: bigint, uniffi_out_err: UniffiRustCallStatus): bigint;
uniffi_cyclops_sdk_fn_free_httpclient(ptr: bigint, uniffi_out_err: UniffiRustCallStatus): void;
- uniffi_cyclops_sdk_fn_init_callback_vtable_httpclient(vtable: UniffiVTableCallbackInterfaceCyclopsSdkHttpClient): void;
+ uniffi_cyclops_sdk_fn_init_callback_vtable_accesstokenprovider(vtable: UniffiVTableCallbackInterfaceFleetSdkAccessTokenProvider): void;
+ uniffi_cyclops_sdk_fn_init_callback_vtable_httpclient(vtable: UniffiVTableCallbackInterfaceFleetSdkHttpClient): void;
+ uniffi_cyclops_sdk_fn_method_accesstokenprovider_get_access_token(uniffiSelf: bigint, forceRefresh: number): bigint;
uniffi_cyclops_sdk_fn_constructor_cyclopsclient_connect(configuration: Uint8Array, httpClient: bigint, uniffi_out_err: UniffiRustCallStatus): bigint;
+ uniffi_cyclops_sdk_fn_constructor_cyclopsclient_connect_browser_with_access_token(configuration: Uint8Array, accessToken: Uint8Array, uniffi_out_err: UniffiRustCallStatus): bigint;
+ uniffi_cyclops_sdk_fn_constructor_cyclopsclient_connect_with_access_token(configuration: Uint8Array, accessToken: Uint8Array, httpClient: bigint, uniffi_out_err: UniffiRustCallStatus): bigint;
+ uniffi_cyclops_sdk_fn_constructor_cyclopsclient_connect_with_access_token_and_native_http_client(configuration: Uint8Array, accessToken: Uint8Array, uniffi_out_err: UniffiRustCallStatus): bigint;
+ uniffi_cyclops_sdk_fn_constructor_cyclopsclient_connect_with_access_token_provider(configuration: Uint8Array, tokenProvider: bigint, httpClient: bigint, uniffi_out_err: UniffiRustCallStatus): bigint;
+ uniffi_cyclops_sdk_fn_constructor_cyclopsclient_connect_with_access_token_provider_and_native_http_client(configuration: Uint8Array, tokenProvider: bigint, uniffi_out_err: UniffiRustCallStatus): bigint;
+ uniffi_cyclops_sdk_fn_constructor_cyclopsclient_connect_with_native_http_client(configuration: Uint8Array, uniffi_out_err: UniffiRustCallStatus): bigint;
uniffi_cyclops_sdk_fn_method_cyclopsclient_create_claim(uniffiSelf: bigint, request: Uint8Array): bigint;
uniffi_cyclops_sdk_fn_method_cyclopsclient_create_pool(uniffiSelf: bigint, request: Uint8Array): bigint;
+ uniffi_cyclops_sdk_fn_method_cyclopsclient_create_template(uniffiSelf: bigint, request: Uint8Array): bigint;
uniffi_cyclops_sdk_fn_method_cyclopsclient_delete_claim(uniffiSelf: bigint, claim: Uint8Array): bigint;
uniffi_cyclops_sdk_fn_method_cyclopsclient_delete_pool(uniffiSelf: bigint, pool: Uint8Array): bigint;
+ uniffi_cyclops_sdk_fn_method_cyclopsclient_delete_template(uniffiSelf: bigint, template: Uint8Array): bigint;
uniffi_cyclops_sdk_fn_method_cyclopsclient_get_claim(uniffiSelf: bigint, claim: Uint8Array): bigint;
- uniffi_cyclops_sdk_fn_method_cyclopsclient_get_pool(uniffiSelf: bigint, pool: Uint8Array): bigint;
+ uniffi_cyclops_sdk_fn_method_cyclopsclient_get_pool(uniffiSelf: bigint, name: Uint8Array): bigint;
+ uniffi_cyclops_sdk_fn_method_cyclopsclient_get_template(uniffiSelf: bigint, namespace: Uint8Array, name: Uint8Array): bigint;
uniffi_cyclops_sdk_fn_method_cyclopsclient_list_claims(uniffiSelf: bigint, namespace: Uint8Array): bigint;
uniffi_cyclops_sdk_fn_method_cyclopsclient_list_pools(uniffiSelf: bigint, namespace: Uint8Array): bigint;
+ uniffi_cyclops_sdk_fn_method_cyclopsclient_list_templates(uniffiSelf: bigint, namespace: Uint8Array): bigint;
+ uniffi_cyclops_sdk_fn_method_cyclopsclient_reconcile_pool(uniffiSelf: bigint, request: Uint8Array): bigint;
+ uniffi_cyclops_sdk_fn_method_cyclopsclient_reconcile_template(uniffiSelf: bigint, request: Uint8Array): bigint;
uniffi_cyclops_sdk_fn_method_cyclopsclient_service_request(uniffiSelf: bigint, sandbox: Uint8Array, service: Uint8Array, path: Uint8Array, request: Uint8Array): bigint;
uniffi_cyclops_sdk_fn_method_cyclopsclient_update_pool(uniffiSelf: bigint, pool: Uint8Array): bigint;
+ uniffi_cyclops_sdk_fn_method_cyclopsclient_update_template(uniffiSelf: bigint, template: Uint8Array): bigint;
uniffi_cyclops_sdk_fn_method_cyclopsclient_wait_claim(uniffiSelf: bigint, claim: Uint8Array): bigint;
uniffi_cyclops_sdk_fn_constructor_cyclopscredentials_new(clientId: Uint8Array, clientSecret: Uint8Array, uniffi_out_err: UniffiRustCallStatus): bigint;
uniffi_cyclops_sdk_fn_method_httpclient_execute(uniffiSelf: bigint, request: Uint8Array): bigint;
ffi_cyclops_sdk_uniffi_contract_version(): number;
+ uniffi_cyclops_sdk_checksum_method_accesstokenprovider_get_access_token(): number;
uniffi_cyclops_sdk_checksum_constructor_cyclopsclient_connect(): number;
+ uniffi_cyclops_sdk_checksum_constructor_cyclopsclient_connect_browser_with_access_token(): number;
+ uniffi_cyclops_sdk_checksum_constructor_cyclopsclient_connect_with_access_token(): number;
+ uniffi_cyclops_sdk_checksum_constructor_cyclopsclient_connect_with_access_token_and_native_http_client(): number;
+ uniffi_cyclops_sdk_checksum_constructor_cyclopsclient_connect_with_access_token_provider(): number;
+ uniffi_cyclops_sdk_checksum_constructor_cyclopsclient_connect_with_access_token_provider_and_native_http_client(): number;
+ uniffi_cyclops_sdk_checksum_constructor_cyclopsclient_connect_with_native_http_client(): number;
uniffi_cyclops_sdk_checksum_method_cyclopsclient_create_claim(): number;
uniffi_cyclops_sdk_checksum_method_cyclopsclient_create_pool(): number;
+ uniffi_cyclops_sdk_checksum_method_cyclopsclient_create_template(): number;
uniffi_cyclops_sdk_checksum_method_cyclopsclient_delete_claim(): number;
uniffi_cyclops_sdk_checksum_method_cyclopsclient_delete_pool(): number;
+ uniffi_cyclops_sdk_checksum_method_cyclopsclient_delete_template(): number;
uniffi_cyclops_sdk_checksum_method_cyclopsclient_get_claim(): number;
uniffi_cyclops_sdk_checksum_method_cyclopsclient_get_pool(): number;
+ uniffi_cyclops_sdk_checksum_method_cyclopsclient_get_template(): number;
uniffi_cyclops_sdk_checksum_method_cyclopsclient_list_claims(): number;
uniffi_cyclops_sdk_checksum_method_cyclopsclient_list_pools(): number;
+ uniffi_cyclops_sdk_checksum_method_cyclopsclient_list_templates(): number;
+ uniffi_cyclops_sdk_checksum_method_cyclopsclient_reconcile_pool(): number;
+ uniffi_cyclops_sdk_checksum_method_cyclopsclient_reconcile_template(): number;
uniffi_cyclops_sdk_checksum_method_cyclopsclient_service_request(): number;
uniffi_cyclops_sdk_checksum_method_cyclopsclient_update_pool(): number;
+ uniffi_cyclops_sdk_checksum_method_cyclopsclient_update_template(): number;
uniffi_cyclops_sdk_checksum_method_cyclopsclient_wait_claim(): number;
uniffi_cyclops_sdk_checksum_constructor_cyclopscredentials_new(): number;
uniffi_cyclops_sdk_checksum_method_httpclient_execute(): number;
@@ -612,11 +819,19 @@ export type UniffiForeignFutureResultRustBuffer = {
call_status: UniffiRustCallStatus;
};
export type UniffiForeignFutureCompleterustBuffer = (callbackData: bigint, result: UniffiForeignFutureResultRustBuffer) => void;
-type UniffiCallbackInterfaceCyclopsSdkHttpClientMethod0 = (uniffiHandle: bigint, request: Uint8Array, uniffiFutureCallback: UniffiForeignFutureCompleterustBuffer, uniffiCallbackData: bigint) => UniffiForeignFutureDroppedCallbackStruct;
-type UniffiCallbackInterfaceCloneCyclopsSdkHttpClient = (handle: bigint) => UniffiResult<void>;
-type UniffiCallbackInterfaceFreeCyclopsSdkHttpClient = (handle: bigint) => void;
-export type UniffiVTableCallbackInterfaceCyclopsSdkHttpClient = {
- uniffi_free: UniffiCallbackInterfaceFreeCyclopsSdkHttpClient;
- uniffi_clone: UniffiCallbackInterfaceCloneCyclopsSdkHttpClient;
- execute: UniffiCallbackInterfaceCyclopsSdkHttpClientMethod0;
+type UniffiCallbackInterfaceFleetSdkAccessTokenProviderMethod0 = (uniffiHandle: bigint, forceRefresh: number, uniffiFutureCallback: UniffiForeignFutureCompleterustBuffer, uniffiCallbackData: bigint) => UniffiForeignFutureDroppedCallbackStruct;
+type UniffiCallbackInterfaceCloneFleetSdkAccessTokenProvider = (handle: bigint) => UniffiResult<void>;
+type UniffiCallbackInterfaceFreeFleetSdkAccessTokenProvider = (handle: bigint) => void;
+export type UniffiVTableCallbackInterfaceFleetSdkAccessTokenProvider = {
+ uniffi_free: UniffiCallbackInterfaceFreeFleetSdkAccessTokenProvider;
+ uniffi_clone: UniffiCallbackInterfaceCloneFleetSdkAccessTokenProvider;
+ get_access_token: UniffiCallbackInterfaceFleetSdkAccessTokenProviderMethod0;
+};
+type UniffiCallbackInterfaceFleetSdkHttpClientMethod0 = (uniffiHandle: bigint, request: Uint8Array, uniffiFutureCallback: UniffiForeignFutureCompleterustBuffer, uniffiCallbackData: bigint) => UniffiForeignFutureDroppedCallbackStruct;
+type UniffiCallbackInterfaceCloneFleetSdkHttpClient = (handle: bigint) => UniffiResult<void>;
+type UniffiCallbackInterfaceFreeFleetSdkHttpClient = (handle: bigint) => void;
+export type UniffiVTableCallbackInterfaceFleetSdkHttpClient = {
+ uniffi_free: UniffiCallbackInterfaceFreeFleetSdkHttpClient;
+ uniffi_clone: UniffiCallbackInterfaceCloneFleetSdkHttpClient;
+ execute: UniffiCallbackInterfaceFleetSdkHttpClientMethod0;
};
\ No newline at end of file
diff --git a/libs/fleet/sdk-bindings/ts-uniffi/cyclops_sdk.ts b/libs/fleet/sdk-bindings/ts-uniffi/fleet_sdk.ts
similarity index 66%
rename from libs/fleet/sdk-bindings/ts-uniffi/cyclops_sdk.ts
rename to libs/fleet/sdk-bindings/ts-uniffi/fleet_sdk.ts
index 3cdac50df7..d35a3ac336 100644
--- a/libs/fleet/sdk-bindings/ts-uniffi/cyclops_sdk.ts
+++ b/libs/fleet/sdk-bindings/ts-uniffi/fleet_sdk.ts
@@ -3,15 +3,15 @@
/* tslint:disable */
/* eslint-disable */
// @ts-nocheck
-import nativeModule from "./cyclops_sdk-ffi";
-import { type UniffiRustFutureContinuationCallback, type UniffiForeignFutureDroppedCallback, type UniffiForeignFutureDroppedCallbackStruct, type UniffiForeignFutureResultRustBuffer, type UniffiForeignFutureCompleterustBuffer, type UniffiVTableCallbackInterfaceCyclopsSdkHttpClient,
-} from "./cyclops_sdk-ffi";
-import { type ClaimSpec, type OsGymSandboxClaimStatus, type OsGymWorkspacePoolStatus, type PoolSpec,
+import nativeModule from "./fleet_sdk-ffi";
+import { type UniffiRustFutureContinuationCallback, type UniffiForeignFutureDroppedCallback, type UniffiForeignFutureDroppedCallbackStruct, type UniffiForeignFutureResultRustBuffer, type UniffiForeignFutureCompleterustBuffer, type UniffiVTableCallbackInterfaceFleetSdkAccessTokenProvider, type UniffiVTableCallbackInterfaceFleetSdkHttpClient,
+} from "./fleet_sdk-ffi";
+import { type ClaimSpec, type OsGymSandboxClaimStatus, type OsGymSandboxTemplateSpec, type OsGymSandboxWarmPoolSpec, type OsGymSandboxWarmPoolStatus,
} from "./cyclops_sdk_schema";
-import { type FfiConverter, type UniffiByteArray, type UniffiGcObject, type UniffiHandle, type UniffiObjectFactory, type UniffiReferenceHolder, type UniffiRustCallStatus, AbstractFfiConverterByteArray, FfiConverterArray, FfiConverterArrayBuffer, FfiConverterInt32, FfiConverterMap, FfiConverterObject, FfiConverterObjectWithCallbacks, FfiConverterOptional, FfiConverterUInt16, FfiConverterUInt32, FfiConverterUInt64, FfiConverterUInt8, RustBuffer, UniffiAbstractObject, UniffiError, UniffiInternalError, UniffiResult, UniffiRustCaller, destructorGuardSymbol, pointerLiteralSymbol, uniffiCreateFfiConverterString, uniffiCreateRecord, uniffiRustCallAsync, uniffiTraitInterfaceCallAsyncWithError, uniffiTypeNameSymbol, variantOrdinalSymbol,
+import { type FfiConverter, type UniffiByteArray, type UniffiGcObject, type UniffiHandle, type UniffiObjectFactory, type UniffiReferenceHolder, type UniffiRustCallStatus, AbstractFfiConverterByteArray, FfiConverterArray, FfiConverterArrayBuffer, FfiConverterBool, FfiConverterInt32, FfiConverterMap, FfiConverterObject, FfiConverterObjectWithCallbacks, FfiConverterOptional, FfiConverterUInt16, FfiConverterUInt32, FfiConverterUInt64, FfiConverterUInt8, RustBuffer, UniffiAbstractObject, UniffiError, UniffiInternalError, UniffiResult, UniffiRustCaller, destructorGuardSymbol, pointerLiteralSymbol, uniffiCreateFfiConverterString, uniffiCreateRecord, uniffiRustCallAsync, uniffiTraitInterfaceCallAsyncWithError, uniffiTypeNameSymbol, variantOrdinalSymbol,
} from "@ubjs/core";
import uniffiCyclopsSdkSchemaModule from "./cyclops_sdk_schema";
-const { FfiConverterTypeClaimSpec, FfiConverterTypeOSGymSandboxClaimStatus, FfiConverterTypeOSGymWorkspacePoolStatus, FfiConverterTypePoolSpec } = uniffiCyclopsSdkSchemaModule.converters;
+const { FfiConverterTypeClaimSpec, FfiConverterTypeOSGymSandboxClaimStatus, FfiConverterTypeOSGymSandboxTemplateSpec, FfiConverterTypeOSGymSandboxWarmPoolSpec, FfiConverterTypeOSGymSandboxWarmPoolStatus } = uniffiCyclopsSdkSchemaModule.converters;
const uniffiCaller = new UniffiRustCaller(() => ({ code: 0 }));
const uniffiIsDebug =
@@ -148,14 +148,19 @@ const FfiConverterTypeClaim = (() => {
/**
* UniFFI cannot emit aliases for external record types. Generated bindings use
- * `OSGymWorkspacePoolStatus` and `OSGymSandboxClaimStatus` from cyclops_sdk_schema.
+ * `OSGymSandboxWarmPoolStatus` and `OSGymSandboxClaimStatus` from cyclops_sdk_schema.
+ *
+ * A `Pool` is the `osgym.cua.ai/v1alpha1 OSGymSandboxWarmPool` CR verbatim —
+ * the SDK is a naive CRUD mapper over the native CRDs, with no translation
+ * layer (the legacy `cua.ai/v1 OSGymWorkspacePool` and its operator compat
+ * shim are gone).
*/
export type Pool = {
apiVersion: string,
kind: string,
metadata: ResourceMetadata,
- spec: PoolSpec,
- status?: OsGymWorkspacePoolStatus
+ spec: OsGymSandboxWarmPoolSpec,
+ status?: OsGymSandboxWarmPoolStatus
}
/**
@@ -182,23 +187,23 @@ const FfiConverterTypePool = (() => {
apiVersion: FfiConverterString.read(from),
kind: FfiConverterString.read(from),
metadata: FfiConverterTypeResourceMetadata.read(from),
- spec: FfiConverterTypePoolSpec.read(from),
- status: FfiConverterOptionalTypeOSGymWorkspacePoolStatus.read(from)
+ spec: FfiConverterTypeOSGymSandboxWarmPoolSpec.read(from),
+ status: FfiConverterOptionalTypeOSGymSandboxWarmPoolStatus.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterString.write(value.apiVersion, into);
FfiConverterString.write(value.kind, into);
FfiConverterTypeResourceMetadata.write(value.metadata, into);
- FfiConverterTypePoolSpec.write(value.spec, into);
- FfiConverterOptionalTypeOSGymWorkspacePoolStatus.write(value.status, into);
+ FfiConverterTypeOSGymSandboxWarmPoolSpec.write(value.spec, into);
+ FfiConverterOptionalTypeOSGymSandboxWarmPoolStatus.write(value.status, into);
}
allocationSize(value: TypeName): number {
return FfiConverterString.allocationSize(value.apiVersion) +
FfiConverterString.allocationSize(value.kind) +
FfiConverterTypeResourceMetadata.allocationSize(value.metadata) +
- FfiConverterTypePoolSpec.allocationSize(value.spec) +
- FfiConverterOptionalTypeOSGymWorkspacePoolStatus.allocationSize(value.status);
+ FfiConverterTypeOSGymSandboxWarmPoolSpec.allocationSize(value.spec) +
+ FfiConverterOptionalTypeOSGymSandboxWarmPoolStatus.allocationSize(value.status);
}
};
@@ -250,7 +255,7 @@ const FfiConverterTypeCreateClaimRequest = (() => {
export type CreatePoolRequest = {
namespace: string,
- spec: PoolSpec
+ spec: OsGymSandboxWarmPoolSpec
}
/**
@@ -275,16 +280,63 @@ const FfiConverterTypeCreatePoolRequest = (() => {
read(from: RustBuffer): TypeName {
return {
namespace: FfiConverterString.read(from),
- spec: FfiConverterTypePoolSpec.read(from)
+ spec: FfiConverterTypeOSGymSandboxWarmPoolSpec.read(from)
+ };
+ }
+ write(value: TypeName, into: RustBuffer): void {
+ FfiConverterString.write(value.namespace, into);
+ FfiConverterTypeOSGymSandboxWarmPoolSpec.write(value.spec, into);
+ }
+ allocationSize(value: TypeName): number {
+ return FfiConverterString.allocationSize(value.namespace) +
+ FfiConverterTypeOSGymSandboxWarmPoolSpec.allocationSize(value.spec);
+
+ }
+ };
+ return new FFIConverter();
+})();
+
+export type CreateTemplateRequest = {
+ namespace: string,
+ name: string,
+ spec: OsGymSandboxTemplateSpec
+}
+
+/**
+ * Generated factory for {@link CreateTemplateRequest} record objects.
+ */
+export const CreateTemplateRequest = (() => {
+ const defaults = () => ({
+ });
+ const create = (() => {
+ return uniffiCreateRecord<CreateTemplateRequest, ReturnType<typeof defaults>>(defaults);
+ })();
+ return Object.freeze({
+ create,
+ new: create,
+ defaults: () => Object.freeze(defaults()) as Partial<CreateTemplateRequest>,
+ });
+})();
+
+const FfiConverterTypeCreateTemplateRequest = (() => {
+ type TypeName = CreateTemplateRequest;
+ class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
+ read(from: RustBuffer): TypeName {
+ return {
+ namespace: FfiConverterString.read(from),
+ name: FfiConverterString.read(from),
+ spec: FfiConverterTypeOSGymSandboxTemplateSpec.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterString.write(value.namespace, into);
- FfiConverterTypePoolSpec.write(value.spec, into);
+ FfiConverterString.write(value.name, into);
+ FfiConverterTypeOSGymSandboxTemplateSpec.write(value.spec, into);
}
allocationSize(value: TypeName): number {
return FfiConverterString.allocationSize(value.namespace) +
- FfiConverterTypePoolSpec.allocationSize(value.spec);
+ FfiConverterString.allocationSize(value.name) +
+ FfiConverterTypeOSGymSandboxTemplateSpec.allocationSize(value.spec);
}
};
@@ -467,6 +519,61 @@ const FfiConverterTypeCyclopsConfiguration = (() => {
return new FFIConverter();
})();
+export type CyclopsTokenProviderConfiguration = {
+ baseUrl: string,
+ poolPollIntervalMs: bigint,
+ poolPollLimit: number,
+ claimPollIntervalMs: bigint,
+ claimPollLimit: number
+}
+
+/**
+ * Generated factory for {@link CyclopsTokenProviderConfiguration} record objects.
+ */
+export const CyclopsTokenProviderConfiguration = (() => {
+ const defaults = () => ({
+ });
+ const create = (() => {
+ return uniffiCreateRecord<CyclopsTokenProviderConfiguration, ReturnType<typeof defaults>>(defaults);
+ })();
+ return Object.freeze({
+ create,
+ new: create,
+ defaults: () => Object.freeze(defaults()) as Partial<CyclopsTokenProviderConfiguration>,
+ });
+})();
+
+const FfiConverterTypeCyclopsTokenProviderConfiguration = (() => {
+ type TypeName = CyclopsTokenProviderConfiguration;
+ class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
+ read(from: RustBuffer): TypeName {
+ return {
+ baseUrl: FfiConverterString.read(from),
+ poolPollIntervalMs: FfiConverterUInt64.read(from),
+ poolPollLimit: FfiConverterUInt32.read(from),
+ claimPollIntervalMs: FfiConverterUInt64.read(from),
+ claimPollLimit: FfiConverterUInt32.read(from)
+ };
+ }
+ write(value: TypeName, into: RustBuffer): void {
+ FfiConverterString.write(value.baseUrl, into);
+ FfiConverterUInt64.write(value.poolPollIntervalMs, into);
+ FfiConverterUInt32.write(value.poolPollLimit, into);
+ FfiConverterUInt64.write(value.claimPollIntervalMs, into);
+ FfiConverterUInt32.write(value.claimPollLimit, into);
+ }
+ allocationSize(value: TypeName): number {
+ return FfiConverterString.allocationSize(value.baseUrl) +
+ FfiConverterUInt64.allocationSize(value.poolPollIntervalMs) +
+ FfiConverterUInt32.allocationSize(value.poolPollLimit) +
+ FfiConverterUInt64.allocationSize(value.claimPollIntervalMs) +
+ FfiConverterUInt32.allocationSize(value.claimPollLimit);
+
+ }
+ };
+ return new FFIConverter();
+})();
+
export type HttpHeader = {
name: string,
value: string
@@ -659,6 +766,160 @@ const FfiConverterTypeSandbox = (() => {
return new FFIConverter();
})();
+/**
+ * The `osgym.cua.ai/v1alpha1 OSGymSandboxTemplate` CR verbatim. Warm pools
+ * and claims reference one by name via `spec.sandboxTemplateRef.name`.
+ */
+export type Template = {
+ apiVersion: string,
+ kind: string,
+ metadata: ResourceMetadata,
+ spec: OsGymSandboxTemplateSpec
+}
+
+/**
+ * Generated factory for {@link Template} record objects.
+ */
+export const Template = (() => {
+ const defaults = () => ({
+ });
+ const create = (() => {
+ return uniffiCreateRecord<Template, ReturnType<typeof defaults>>(defaults);
+ })();
+ return Object.freeze({
+ create,
+ new: create,
+ defaults: () => Object.freeze(defaults()) as Partial<Template>,
+ });
+})();
+
+const FfiConverterTypeTemplate = (() => {
+ type TypeName = Template;
+ class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
+ read(from: RustBuffer): TypeName {
+ return {
+ apiVersion: FfiConverterString.read(from),
+ kind: FfiConverterString.read(from),
+ metadata: FfiConverterTypeResourceMetadata.read(from),
+ spec: FfiConverterTypeOSGymSandboxTemplateSpec.read(from)
+ };
+ }
+ write(value: TypeName, into: RustBuffer): void {
+ FfiConverterString.write(value.apiVersion, into);
+ FfiConverterString.write(value.kind, into);
+ FfiConverterTypeResourceMetadata.write(value.metadata, into);
+ FfiConverterTypeOSGymSandboxTemplateSpec.write(value.spec, into);
+ }
+ allocationSize(value: TypeName): number {
+ return FfiConverterString.allocationSize(value.apiVersion) +
+ FfiConverterString.allocationSize(value.kind) +
+ FfiConverterTypeResourceMetadata.allocationSize(value.metadata) +
+ FfiConverterTypeOSGymSandboxTemplateSpec.allocationSize(value.spec);
+
+ }
+ };
+ return new FFIConverter();
+})();
+
+
+// Error type: AccessTokenProviderError
+export enum AccessTokenProviderError_Tags {
+ Failed = "Failed"
+}
+export const AccessTokenProviderError = (() => {
+
+ type Failed__interface = {
+ tag: AccessTokenProviderError_Tags.Failed;
+ inner:
+Readonly<{reason: string}>
+ };
+ class Failed_ extends UniffiError implements Failed__interface {
+ /**
+ * @private
+ * This field is private and should not be used, use `tag` instead.
+ */
+ readonly [uniffiTypeNameSymbol] = "AccessTokenProviderError";
+ readonly tag = AccessTokenProviderError_Tags.Failed;
+ readonly inner:
+Readonly<{reason: string}>;
+ constructor(
+inner: {reason: string }) {
+ super("AccessTokenProviderError", "Failed");
+
+ this.inner = Object.freeze(inner);
+ }
+ static new(
+inner: {reason: string }): Failed_ {
+ return new Failed_(inner);
+ }
+
+ static instanceOf(obj: any): obj is Failed_ {
+ return obj.tag === AccessTokenProviderError_Tags.Failed;
+ }
+ static hasInner(obj: any): obj is Failed_ {
+ return Failed_.instanceOf(obj);
+ }
+
+ static getInner(obj: Failed_):
+Readonly<{reason: string}> {
+ return obj.inner;
+ }
+
+ }
+
+ function instanceOf(obj: any): obj is AccessTokenProviderError {
+ return obj[uniffiTypeNameSymbol] === "AccessTokenProviderError";
+ }
+
+ return Object.freeze({
+ instanceOf,
+ Failed: Failed_
+ });
+
+})();
+export type AccessTokenProviderError = InstanceType<
+ typeof AccessTokenProviderError['Failed']
+>;
+
+// FfiConverter for enum AccessTokenProviderError
+const FfiConverterTypeAccessTokenProviderError = (() => {
+ const ordinalConverter = FfiConverterInt32;
+ type TypeName = AccessTokenProviderError;
+ class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
+ read(from: RustBuffer): TypeName {
+ switch (ordinalConverter.read(from)) {
+ case 1: return new AccessTokenProviderError.Failed({reason: FfiConverterString.read(from) });
+ default: throw new UniffiInternalError.UnexpectedEnumCase();
+ }
+ }
+ write(value: TypeName, into: RustBuffer): void {
+ switch (value.tag) {
+ case AccessTokenProviderError_Tags.Failed: {
+ ordinalConverter.write(1, into);
+ const inner = value.inner;
+ FfiConverterString.write(inner.reason, into);
+ return;
+ }
+ default:
+ // Throwing from here means that AccessTokenProviderError_Tags hasn't matched an ordinal.
+ throw new UniffiInternalError.UnexpectedEnumCase();
+ }
+ }
+ allocationSize(value: TypeName): number {
+ switch (value.tag) {
+ case AccessTokenProviderError_Tags.Failed: {
+ const inner = value.inner;
+ let size = ordinalConverter.allocationSize(1);
+ size += FfiConverterString.allocationSize(inner.reason);
+ return size;
+ }
+ default: throw new UniffiInternalError.UnexpectedEnumCase();
+ }
+ }
+ }
+ return new FFIConverter();
+})();
+
// Error type: HttpError
export enum HttpError_Tags {
@@ -1338,62 +1599,35 @@ const FfiConverterTypeSdkError = (() => {
return new FFIConverter();
})();
-export interface CyclopsClientLike {
+export interface AccessTokenProvider {
- createClaim(request: CreateClaimRequest, asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<Claim>;
- createPool(request: CreatePoolRequest, asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<Pool>;
- deleteClaim(claim: Claim, asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<void>;
- deletePool(pool: Pool, asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<void>;
- getClaim(claim: Claim, asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<Claim>;
- getPool(pool: Pool, asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<Pool>;
- listClaims(namespace: string, asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<Array<Claim>>;
- listPools(namespace: string, asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<Array<Pool>>;
- serviceRequest(sandbox: Sandbox, service: string, path: string, request: HttpRequest, asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<HttpResponse>;
- updatePool(pool: Pool, asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<Pool>;
- waitClaim(claim: Claim, asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<Sandbox>;
+ getAccessToken(forceRefresh: boolean, asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<string>;
}
-/**
- * @deprecated Use `CyclopsClientLike` instead.
- */
-export type CyclopsClientInterface = CyclopsClientLike;
-export class CyclopsClient extends UniffiAbstractObject implements CyclopsClientLike {
+export class AccessTokenProviderImpl extends UniffiAbstractObject implements AccessTokenProvider {
- readonly [uniffiTypeNameSymbol] = "CyclopsClient";
+ readonly [uniffiTypeNameSymbol] = "AccessTokenProviderImpl";
readonly [destructorGuardSymbol]: UniffiGcObject;
readonly [pointerLiteralSymbol]: UniffiHandle;
// No primary constructor declared for this class.
private constructor(pointer: UniffiHandle) {
super();
this[pointerLiteralSymbol] = pointer;
- this[destructorGuardSymbol] = uniffiTypeCyclopsClientObjectFactory.bless(pointer);
+ this[destructorGuardSymbol] = uniffiTypeAccessTokenProviderImplObjectFactory.bless(pointer);
}
- static connect(configuration: CyclopsConfiguration, httpClient: HttpClient): CyclopsClientLike /*throws*/ {
- return FfiConverterTypeCyclopsClient.lift(uniffiCaller.rustCallWithError(
- /*liftError:*/ FfiConverterTypeSdkError.lift.bind(FfiConverterTypeSdkError),
- /*caller:*/ (callStatus) => {
- return nativeModule().uniffi_cyclops_sdk_fn_constructor_cyclopsclient_connect(
- FfiConverterTypeCyclopsConfiguration.lower(configuration, nativeModule().rustbuffer_alloc),
- FfiConverterTypeHttpClient.lower(httpClient, nativeModule().rustbuffer_alloc),
- callStatus);
- },
- /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
- ));
- }
-
- async createClaim(request: CreateClaimRequest, asyncOpts_?: { signal: AbortSignal }): Promise<Claim> /*throws*/ {
+ async getAccessToken(forceRefresh: boolean, asyncOpts_?: { signal: AbortSignal }): Promise<string> /*throws*/ {
const __stack = uniffiIsDebug ? new Error().stack : undefined;
try {
return await uniffiRustCallAsync(
/*rustCaller:*/ uniffiCaller,
/*rustFutureFunc:*/ () => {
- return nativeModule().uniffi_cyclops_sdk_fn_method_cyclopsclient_create_claim(
- uniffiTypeCyclopsClientObjectFactory.clonePointer(this),FfiConverterTypeCreateClaimRequest.lower(request, nativeModule().rustbuffer_alloc)
+ return nativeModule().uniffi_cyclops_sdk_fn_method_accesstokenprovider_get_access_token(
+ uniffiTypeAccessTokenProviderImplObjectFactory.clonePointer(this),FfiConverterBool.lower(forceRefresh, nativeModule().rustbuffer_alloc)
);
},
/*pollFunc:*/ nativeModule().ffi_cyclops_sdk_rust_future_poll_rust_buffer,
@@ -1405,10 +1639,10 @@ private constructor(pointer: UniffiHandle) {
// RustBuffer comes back via the shared `rust_future_complete_*`
// export. The bytes the runtime hands back must be deserialized
// here using the per-callable return-type converter.
- /*liftFunc:*/ FfiConverterTypeClaim.lift.bind(FfiConverterTypeClaim),
+ /*liftFunc:*/ FfiConverterString.lift.bind(FfiConverterString),
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
/*asyncOpts:*/ asyncOpts_,
- /*errorHandler:*/ FfiConverterTypeSdkError.lift.bind(FfiConverterTypeSdkError)
+ /*errorHandler:*/ FfiConverterTypeAccessTokenProviderError.lift.bind(FfiConverterTypeAccessTokenProviderError)
);
} catch (__error: any) {
if (uniffiIsDebug && __error instanceof Error) {
@@ -1418,29 +1652,373 @@ private constructor(pointer: UniffiHandle) {
}
}
- async createPool(request: CreatePoolRequest, asyncOpts_?: { signal: AbortSignal }): Promise<Pool> /*throws*/ {
- const __stack = uniffiIsDebug ? new Error().stack : undefined;
- try {
- return await uniffiRustCallAsync(
- /*rustCaller:*/ uniffiCaller,
- /*rustFutureFunc:*/ () => {
- return nativeModule().uniffi_cyclops_sdk_fn_method_cyclopsclient_create_pool(
- uniffiTypeCyclopsClientObjectFactory.clonePointer(this),FfiConverterTypeCreatePoolRequest.lower(request, nativeModule().rustbuffer_alloc)
- );
- },
- /*pollFunc:*/ nativeModule().ffi_cyclops_sdk_rust_future_poll_rust_buffer,
- /*cancelFunc:*/ nativeModule().ffi_cyclops_sdk_rust_future_cancel_rust_buffer,
- /*completeFunc:*/ nativeModule().ffi_cyclops_sdk_rust_future_complete_rust_buffer,
- /*freeFunc:*/ nativeModule().ffi_cyclops_sdk_rust_future_free_rust_buffer,
- // Async returns always go through the JS-side converter: the
- // FFI symbol returns the future handle (u64), and the user-level
- // RustBuffer comes back via the shared `rust_future_complete_*`
- // export. The bytes the runtime hands back must be deserialized
- // here using the per-callable return-type converter.
- /*liftFunc:*/ FfiConverterTypePool.lift.bind(FfiConverterTypePool),
- /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
- /*asyncOpts:*/ asyncOpts_,
- /*errorHandler:*/ FfiConverterTypeSdkError.lift.bind(FfiConverterTypeSdkError)
+
+ uniffiDestroy(): void {
+ const ptr = (this as any)[destructorGuardSymbol];
+ if (ptr !== undefined) {
+ const pointer = uniffiTypeAccessTokenProviderImplObjectFactory.pointer(this);
+ uniffiTypeAccessTokenProviderImplObjectFactory.freePointer(pointer);
+ uniffiTypeAccessTokenProviderImplObjectFactory.unbless(ptr);
+ delete (this as any)[destructorGuardSymbol];
+ }
+ }
+
+ static instanceOf(obj_: any): obj_ is AccessTokenProviderImpl {
+ return uniffiTypeAccessTokenProviderImplObjectFactory.isConcreteType(obj_);
+ }
+
+
+}
+
+const uniffiTypeAccessTokenProviderImplObjectFactory: UniffiObjectFactory<AccessTokenProvider> = (() => {
+
+ /// <reference lib="es2021" />
+ const registry = typeof FinalizationRegistry !== 'undefined' ? new FinalizationRegistry<UniffiHandle>((heldValue: UniffiHandle) => {
+ uniffiTypeAccessTokenProviderImplObjectFactory.freePointer(heldValue);
+ }) : null;
+
+ return {
+ create(pointer: UniffiHandle): AccessTokenProvider {
+ const instance = Object.create(AccessTokenProviderImpl.prototype);
+ instance[pointerLiteralSymbol] = pointer;
+ instance[destructorGuardSymbol] = this.bless(pointer);
+ instance[uniffiTypeNameSymbol] = "AccessTokenProviderImpl";
+ return instance;
+ },
+
+
+ bless(p: UniffiHandle): UniffiGcObject {
+ const ptr = {
+ p, // make sure this object doesn't get optimized away.
+ markDestroyed: () => undefined,
+ };
+ if (registry) {
+ registry.register(ptr, p, ptr);
+ }
+ return ptr;
+ },
+
+ unbless(ptr_: UniffiGcObject) {
+ if (registry) {
+ registry.unregister(ptr_);
+ }
+ },
+
+ pointer(obj_: AccessTokenProvider): UniffiHandle {
+ if ((obj_ as any)[destructorGuardSymbol] === undefined) {
+ throw new UniffiInternalError.UnexpectedNullPointer();
+ }
+ return (obj_ as any)[pointerLiteralSymbol];
+ },
+
+ clonePointer(obj_: AccessTokenProvider): UniffiHandle {
+ const pointer = this.pointer(obj_);
+ return uniffiCaller.rustCall(
+ /*caller:*/ (callStatus) => nativeModule().uniffi_cyclops_sdk_fn_clone_accesstokenprovider(pointer, callStatus),
+ /*liftString:*/ FfiConverterString.lift
+ );
+ },
+
+ freePointer(pointer: UniffiHandle): void {
+ uniffiCaller.rustCall(
+ /*caller:*/ (callStatus) => nativeModule().uniffi_cyclops_sdk_fn_free_accesstokenprovider(pointer, callStatus),
+ /*liftString:*/ FfiConverterString.lift
+ );
+ },
+
+ isConcreteType(obj_: any): obj_ is AccessTokenProvider {
+ return obj_[destructorGuardSymbol] && obj_[uniffiTypeNameSymbol] === "AccessTokenProviderImpl";
+ },
+}})();
+const FfiConverterTypeAccessTokenProvider = new FfiConverterObjectWithCallbacks(uniffiTypeAccessTokenProviderImplObjectFactory);
+
+// Add a vtable for the callbacks that go in AccessTokenProvider.
+
+// Put the implementation in a struct so we don't pollute the top-level namespace
+const uniffiCallbackInterfaceAccessTokenProvider: { vtable: any; register: () => void; } = {
+ // Create the VTable using a series of closures.
+ // ts automatically converts these into C callback functions.
+ vtable: {
+ get_access_token: (
+ uniffiHandle: bigint,
+ forceRefresh: number,
+ uniffiFutureCallback: UniffiForeignFutureCompleterustBuffer,
+ uniffiCallbackData: bigint) => {
+ const uniffiMakeCall =
+ async (signal: AbortSignal)
+ : Promise<string> => {
+ const jsCallback = FfiConverterTypeAccessTokenProvider.lift(uniffiHandle);
+ return await jsCallback.getAccessToken(
+ FfiConverterBool.lift(forceRefresh), { signal }
+ )
+ };
+ const uniffiHandleSuccess = (returnValue: string) => {
+ uniffiFutureCallback.call(
+ uniffiFutureCallback,
+ uniffiCallbackData,
+ /* UniffiForeignFutureResultRustBuffer */{
+ return_value: FfiConverterString.lower(returnValue, nativeModule().rustbuffer_alloc),
+ call_status: uniffiCaller.createCallStatus()
+ }
+ );
+ };
+ const uniffiHandleError = (code: number, errorBuf: UniffiByteArray) => {
+ uniffiFutureCallback.call(
+ uniffiFutureCallback,
+ uniffiCallbackData,
+ /* UniffiForeignFutureResultRustBuffer */{
+ return_value: /*empty*/ new Uint8Array(0),
+ // TODO create callstatus with error.
+ call_status: uniffiCaller.createErrorStatus(code, errorBuf),
+ }
+ );
+ };
+ const uniffiForeignFuture = uniffiTraitInterfaceCallAsyncWithError(
+ /*makeCall:*/ uniffiMakeCall,
+ /*handleSuccess:*/ uniffiHandleSuccess,
+ /*handleError:*/ uniffiHandleError,
+ /*isErrorType:*/ AccessTokenProviderError.instanceOf,
+ /*lowerError:*/ FfiConverterTypeAccessTokenProviderError.lower.bind(FfiConverterTypeAccessTokenProviderError),
+ /*lowerString:*/ FfiConverterString.lower.bind(FfiConverterString),
+ /*alloc:*/ nativeModule().rustbuffer_alloc,
+ );
+ return uniffiForeignFuture;
+ },
+ uniffi_free: (uniffiHandle: UniffiHandle): void => {
+ // this will throw a stale handle error if the handle isn't found.
+ FfiConverterTypeAccessTokenProvider.drop(uniffiHandle);
+ },
+ uniffi_clone: (uniffiHandle: UniffiHandle): UniffiHandle => {
+ return FfiConverterTypeAccessTokenProvider.clone(uniffiHandle);
+ }
+ },
+ register: () => {nativeModule().uniffi_cyclops_sdk_fn_init_callback_vtable_accesstokenprovider(
+ uniffiCallbackInterfaceAccessTokenProvider.vtable
+ );
+ },
+};
+
+export interface CyclopsClientLike {
+
+ createClaim(request: CreateClaimRequest, asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<Claim>;
+ createPool(request: CreatePoolRequest, asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<Pool>;
+ createTemplate(request: CreateTemplateRequest, asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<Template>;
+ deleteClaim(claim: Claim, asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<void>;
+ deletePool(pool: Pool, asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<void>;
+ deleteTemplate(template: Template, asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<void>;
+ getClaim(claim: Claim, asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<Claim>;
+ getPool(name: string, asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<Pool>;
+ getTemplate(namespace: string, name: string, asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<Template>;
+ listClaims(namespace: string, asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<Array<Claim>>;
+ listPools(namespace: string, asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<Array<Pool>>;
+ listTemplates(namespace: string, asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<Array<Template>>;
+ reconcilePool(request: CreatePoolRequest, asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<Pool>;
+ reconcileTemplate(request: CreateTemplateRequest, asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<Template>;
+ serviceRequest(sandbox: Sandbox, service: string, path: string, request: HttpRequest, asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<HttpResponse>;
+ updatePool(pool: Pool, asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<Pool>;
+ updateTemplate(template: Template, asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<Template>;
+ waitClaim(claim: Claim, asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<Sandbox>;
+}
+/**
+ * @deprecated Use `CyclopsClientLike` instead.
+ */
+export type CyclopsClientInterface = CyclopsClientLike;
+
+
+export class CyclopsClient extends UniffiAbstractObject implements CyclopsClientLike {
+
+ readonly [uniffiTypeNameSymbol] = "CyclopsClient";
+ readonly [destructorGuardSymbol]: UniffiGcObject;
+ readonly [pointerLiteralSymbol]: UniffiHandle;
+ // No primary constructor declared for this class.
+private constructor(pointer: UniffiHandle) {
+ super();
+ this[pointerLiteralSymbol] = pointer;
+ this[destructorGuardSymbol] = uniffiTypeCyclopsClientObjectFactory.bless(pointer);
+}
+
+
+ static connect(configuration: CyclopsConfiguration, httpClient: HttpClient): CyclopsClientLike /*throws*/ {
+ return FfiConverterTypeCyclopsClient.lift(uniffiCaller.rustCallWithError(
+ /*liftError:*/ FfiConverterTypeSdkError.lift.bind(FfiConverterTypeSdkError),
+ /*caller:*/ (callStatus) => {
+ return nativeModule().uniffi_cyclops_sdk_fn_constructor_cyclopsclient_connect(
+ FfiConverterTypeCyclopsConfiguration.lower(configuration, nativeModule().rustbuffer_alloc),
+ FfiConverterTypeHttpClient.lower(httpClient, nativeModule().rustbuffer_alloc),
+ callStatus);
+ },
+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
+ ));
+ }
+
+ static connectBrowserWithAccessToken(configuration: CyclopsTokenProviderConfiguration, accessToken: string): CyclopsClientLike /*throws*/ {
+ return FfiConverterTypeCyclopsClient.lift(uniffiCaller.rustCallWithError(
+ /*liftError:*/ FfiConverterTypeSdkError.lift.bind(FfiConverterTypeSdkError),
+ /*caller:*/ (callStatus) => {
+ return nativeModule().uniffi_cyclops_sdk_fn_constructor_cyclopsclient_connect_browser_with_access_token(
+ FfiConverterTypeCyclopsTokenProviderConfiguration.lower(configuration, nativeModule().rustbuffer_alloc),
+ FfiConverterString.lower(accessToken, nativeModule().rustbuffer_alloc),
+ callStatus);
+ },
+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
+ ));
+ }
+
+ static connectWithAccessToken(configuration: CyclopsTokenProviderConfiguration, accessToken: string, httpClient: HttpClient): CyclopsClientLike /*throws*/ {
+ return FfiConverterTypeCyclopsClient.lift(uniffiCaller.rustCallWithError(
+ /*liftError:*/ FfiConverterTypeSdkError.lift.bind(FfiConverterTypeSdkError),
+ /*caller:*/ (callStatus) => {
+ return nativeModule().uniffi_cyclops_sdk_fn_constructor_cyclopsclient_connect_with_access_token(
+ FfiConverterTypeCyclopsTokenProviderConfiguration.lower(configuration, nativeModule().rustbuffer_alloc),
+ FfiConverterString.lower(accessToken, nativeModule().rustbuffer_alloc),
+ FfiConverterTypeHttpClient.lower(httpClient, nativeModule().rustbuffer_alloc),
+ callStatus);
+ },
+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
+ ));
+ }
+
+ static connectWithAccessTokenAndNativeHttpClient(configuration: CyclopsTokenProviderConfiguration, accessToken: string): CyclopsClientLike /*throws*/ {
+ return FfiConverterTypeCyclopsClient.lift(uniffiCaller.rustCallWithError(
+ /*liftError:*/ FfiConverterTypeSdkError.lift.bind(FfiConverterTypeSdkError),
+ /*caller:*/ (callStatus) => {
+ return nativeModule().uniffi_cyclops_sdk_fn_constructor_cyclopsclient_connect_with_access_token_and_native_http_client(
+ FfiConverterTypeCyclopsTokenProviderConfiguration.lower(configuration, nativeModule().rustbuffer_alloc),
+ FfiConverterString.lower(accessToken, nativeModule().rustbuffer_alloc),
+ callStatus);
+ },
+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
+ ));
+ }
+
+ static connectWithAccessTokenProvider(configuration: CyclopsTokenProviderConfiguration, tokenProvider: AccessTokenProvider, httpClient: HttpClient): CyclopsClientLike /*throws*/ {
+ return FfiConverterTypeCyclopsClient.lift(uniffiCaller.rustCallWithError(
+ /*liftError:*/ FfiConverterTypeSdkError.lift.bind(FfiConverterTypeSdkError),
+ /*caller:*/ (callStatus) => {
+ return nativeModule().uniffi_cyclops_sdk_fn_constructor_cyclopsclient_connect_with_access_token_provider(
+ FfiConverterTypeCyclopsTokenProviderConfiguration.lower(configuration, nativeModule().rustbuffer_alloc),
+ FfiConverterTypeAccessTokenProvider.lower(tokenProvider, nativeModule().rustbuffer_alloc),
+ FfiConverterTypeHttpClient.lower(httpClient, nativeModule().rustbuffer_alloc),
+ callStatus);
+ },
+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
+ ));
+ }
+
+ static connectWithAccessTokenProviderAndNativeHttpClient(configuration: CyclopsTokenProviderConfiguration, tokenProvider: AccessTokenProvider): CyclopsClientLike /*throws*/ {
+ return FfiConverterTypeCyclopsClient.lift(uniffiCaller.rustCallWithError(
+ /*liftError:*/ FfiConverterTypeSdkError.lift.bind(FfiConverterTypeSdkError),
+ /*caller:*/ (callStatus) => {
+ return nativeModule().uniffi_cyclops_sdk_fn_constructor_cyclopsclient_connect_with_access_token_provider_and_native_http_client(
+ FfiConverterTypeCyclopsTokenProviderConfiguration.lower(configuration, nativeModule().rustbuffer_alloc),
+ FfiConverterTypeAccessTokenProvider.lower(tokenProvider, nativeModule().rustbuffer_alloc),
+ callStatus);
+ },
+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
+ ));
+ }
+
+ static connectWithNativeHttpClient(configuration: CyclopsConfiguration): CyclopsClientLike /*throws*/ {
+ return FfiConverterTypeCyclopsClient.lift(uniffiCaller.rustCallWithError(
+ /*liftError:*/ FfiConverterTypeSdkError.lift.bind(FfiConverterTypeSdkError),
+ /*caller:*/ (callStatus) => {
+ return nativeModule().uniffi_cyclops_sdk_fn_constructor_cyclopsclient_connect_with_native_http_client(
+ FfiConverterTypeCyclopsConfiguration.lower(configuration, nativeModule().rustbuffer_alloc),
+ callStatus);
+ },
+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
+ ));
+ }
+
+
+
+ async createClaim(request: CreateClaimRequest, asyncOpts_?: { signal: AbortSignal }): Promise<Claim> /*throws*/ {
+ const __stack = uniffiIsDebug ? new Error().stack : undefined;
+ try {
+ return await uniffiRustCallAsync(
+ /*rustCaller:*/ uniffiCaller,
+ /*rustFutureFunc:*/ () => {
+ return nativeModule().uniffi_cyclops_sdk_fn_method_cyclopsclient_create_claim(
+ uniffiTypeCyclopsClientObjectFactory.clonePointer(this),FfiConverterTypeCreateClaimRequest.lower(request, nativeModule().rustbuffer_alloc)
+ );
+ },
+ /*pollFunc:*/ nativeModule().ffi_cyclops_sdk_rust_future_poll_rust_buffer,
+ /*cancelFunc:*/ nativeModule().ffi_cyclops_sdk_rust_future_cancel_rust_buffer,
+ /*completeFunc:*/ nativeModule().ffi_cyclops_sdk_rust_future_complete_rust_buffer,
+ /*freeFunc:*/ nativeModule().ffi_cyclops_sdk_rust_future_free_rust_buffer,
+ // Async returns always go through the JS-side converter: the
+ // FFI symbol returns the future handle (u64), and the user-level
+ // RustBuffer comes back via the shared `rust_future_complete_*`
+ // export. The bytes the runtime hands back must be deserialized
+ // here using the per-callable return-type converter.
+ /*liftFunc:*/ FfiConverterTypeClaim.lift.bind(FfiConverterTypeClaim),
+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
+ /*asyncOpts:*/ asyncOpts_,
+ /*errorHandler:*/ FfiConverterTypeSdkError.lift.bind(FfiConverterTypeSdkError)
+ );
+ } catch (__error: any) {
+ if (uniffiIsDebug && __error instanceof Error) {
+ __error.stack = __stack;
+ }
+ throw __error;
+ }
+ }
+
+ async createPool(request: CreatePoolRequest, asyncOpts_?: { signal: AbortSignal }): Promise<Pool> /*throws*/ {
+ const __stack = uniffiIsDebug ? new Error().stack : undefined;
+ try {
+ return await uniffiRustCallAsync(
+ /*rustCaller:*/ uniffiCaller,
+ /*rustFutureFunc:*/ () => {
+ return nativeModule().uniffi_cyclops_sdk_fn_method_cyclopsclient_create_pool(
+ uniffiTypeCyclopsClientObjectFactory.clonePointer(this),FfiConverterTypeCreatePoolRequest.lower(request, nativeModule().rustbuffer_alloc)
+ );
+ },
+ /*pollFunc:*/ nativeModule().ffi_cyclops_sdk_rust_future_poll_rust_buffer,
+ /*cancelFunc:*/ nativeModule().ffi_cyclops_sdk_rust_future_cancel_rust_buffer,
+ /*completeFunc:*/ nativeModule().ffi_cyclops_sdk_rust_future_complete_rust_buffer,
+ /*freeFunc:*/ nativeModule().ffi_cyclops_sdk_rust_future_free_rust_buffer,
+ // Async returns always go through the JS-side converter: the
+ // FFI symbol returns the future handle (u64), and the user-level
+ // RustBuffer comes back via the shared `rust_future_complete_*`
+ // export. The bytes the runtime hands back must be deserialized
+ // here using the per-callable return-type converter.
+ /*liftFunc:*/ FfiConverterTypePool.lift.bind(FfiConverterTypePool),
+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
+ /*asyncOpts:*/ asyncOpts_,
+ /*errorHandler:*/ FfiConverterTypeSdkError.lift.bind(FfiConverterTypeSdkError)
+ );
+ } catch (__error: any) {
+ if (uniffiIsDebug && __error instanceof Error) {
+ __error.stack = __stack;
+ }
+ throw __error;
+ }
+ }
+
+ async createTemplate(request: CreateTemplateRequest, asyncOpts_?: { signal: AbortSignal }): Promise<Template> /*throws*/ {
+ const __stack = uniffiIsDebug ? new Error().stack : undefined;
+ try {
+ return await uniffiRustCallAsync(
+ /*rustCaller:*/ uniffiCaller,
+ /*rustFutureFunc:*/ () => {
+ return nativeModule().uniffi_cyclops_sdk_fn_method_cyclopsclient_create_template(
+ uniffiTypeCyclopsClientObjectFactory.clonePointer(this),FfiConverterTypeCreateTemplateRequest.lower(request, nativeModule().rustbuffer_alloc)
+ );
+ },
+ /*pollFunc:*/ nativeModule().ffi_cyclops_sdk_rust_future_poll_rust_buffer,
+ /*cancelFunc:*/ nativeModule().ffi_cyclops_sdk_rust_future_cancel_rust_buffer,
+ /*completeFunc:*/ nativeModule().ffi_cyclops_sdk_rust_future_complete_rust_buffer,
+ /*freeFunc:*/ nativeModule().ffi_cyclops_sdk_rust_future_free_rust_buffer,
+ // Async returns always go through the JS-side converter: the
+ // FFI symbol returns the future handle (u64), and the user-level
+ // RustBuffer comes back via the shared `rust_future_complete_*`
+ // export. The bytes the runtime hands back must be deserialized
+ // here using the per-callable return-type converter.
+ /*liftFunc:*/ FfiConverterTypeTemplate.lift.bind(FfiConverterTypeTemplate),
+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
+ /*asyncOpts:*/ asyncOpts_,
+ /*errorHandler:*/ FfiConverterTypeSdkError.lift.bind(FfiConverterTypeSdkError)
);
} catch (__error: any) {
if (uniffiIsDebug && __error instanceof Error) {
@@ -1504,6 +2082,33 @@ private constructor(pointer: UniffiHandle) {
}
}
+ async deleteTemplate(template: Template, asyncOpts_?: { signal: AbortSignal }): Promise<void> /*throws*/ {
+ const __stack = uniffiIsDebug ? new Error().stack : undefined;
+ try {
+ return await uniffiRustCallAsync(
+ /*rustCaller:*/ uniffiCaller,
+ /*rustFutureFunc:*/ () => {
+ return nativeModule().uniffi_cyclops_sdk_fn_method_cyclopsclient_delete_template(
+ uniffiTypeCyclopsClientObjectFactory.clonePointer(this),FfiConverterTypeTemplate.lower(template, nativeModule().rustbuffer_alloc)
+ );
+ },
+ /*pollFunc:*/ nativeModule().ffi_cyclops_sdk_rust_future_poll_void,
+ /*cancelFunc:*/ nativeModule().ffi_cyclops_sdk_rust_future_cancel_void,
+ /*completeFunc:*/ nativeModule().ffi_cyclops_sdk_rust_future_complete_void,
+ /*freeFunc:*/ nativeModule().ffi_cyclops_sdk_rust_future_free_void,
+ /*liftFunc:*/ (_v) => {},
+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
+ /*asyncOpts:*/ asyncOpts_,
+ /*errorHandler:*/ FfiConverterTypeSdkError.lift.bind(FfiConverterTypeSdkError)
+ );
+ } catch (__error: any) {
+ if (uniffiIsDebug && __error instanceof Error) {
+ __error.stack = __stack;
+ }
+ throw __error;
+ }
+ }
+
async getClaim(claim: Claim, asyncOpts_?: { signal: AbortSignal }): Promise<Claim> /*throws*/ {
const __stack = uniffiIsDebug ? new Error().stack : undefined;
try {
@@ -1568,6 +2173,38 @@ private constructor(pointer: UniffiHandle) {
}
}
+ async getTemplate(namespace: string, name: string, asyncOpts_?: { signal: AbortSignal }): Promise<Template> /*throws*/ {
+ const __stack = uniffiIsDebug ? new Error().stack : undefined;
+ try {
+ return await uniffiRustCallAsync(
+ /*rustCaller:*/ uniffiCaller,
+ /*rustFutureFunc:*/ () => {
+ return nativeModule().uniffi_cyclops_sdk_fn_method_cyclopsclient_get_template(
+ uniffiTypeCyclopsClientObjectFactory.clonePointer(this),FfiConverterString.lower(namespace, nativeModule().rustbuffer_alloc),FfiConverterString.lower(name, nativeModule().rustbuffer_alloc)
+ );
+ },
+ /*pollFunc:*/ nativeModule().ffi_cyclops_sdk_rust_future_poll_rust_buffer,
+ /*cancelFunc:*/ nativeModule().ffi_cyclops_sdk_rust_future_cancel_rust_buffer,
+ /*completeFunc:*/ nativeModule().ffi_cyclops_sdk_rust_future_complete_rust_buffer,
+ /*freeFunc:*/ nativeModule().ffi_cyclops_sdk_rust_future_free_rust_buffer,
+ // Async returns always go through the JS-side converter: the
+ // FFI symbol returns the future handle (u64), and the user-level
+ // RustBuffer comes back via the shared `rust_future_complete_*`
+ // export. The bytes the runtime hands back must be deserialized
+ // here using the per-callable return-type converter.
+ /*liftFunc:*/ FfiConverterTypeTemplate.lift.bind(FfiConverterTypeTemplate),
+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
+ /*asyncOpts:*/ asyncOpts_,
+ /*errorHandler:*/ FfiConverterTypeSdkError.lift.bind(FfiConverterTypeSdkError)
+ );
+ } catch (__error: any) {
+ if (uniffiIsDebug && __error instanceof Error) {
+ __error.stack = __stack;
+ }
+ throw __error;
+ }
+ }
+
async listClaims(namespace: string, asyncOpts_?: { signal: AbortSignal }): Promise<Array<Claim>> /*throws*/ {
const __stack = uniffiIsDebug ? new Error().stack : undefined;
try {
@@ -1632,6 +2269,102 @@ private constructor(pointer: UniffiHandle) {
}
}
+ async listTemplates(namespace: string, asyncOpts_?: { signal: AbortSignal }): Promise<Array<Template>> /*throws*/ {
+ const __stack = uniffiIsDebug ? new Error().stack : undefined;
+ try {
+ return await uniffiRustCallAsync(
+ /*rustCaller:*/ uniffiCaller,
+ /*rustFutureFunc:*/ () => {
+ return nativeModule().uniffi_cyclops_sdk_fn_method_cyclopsclient_list_templates(
+ uniffiTypeCyclopsClientObjectFactory.clonePointer(this),FfiConverterString.lower(namespace, nativeModule().rustbuffer_alloc)
+ );
+ },
+ /*pollFunc:*/ nativeModule().ffi_cyclops_sdk_rust_future_poll_rust_buffer,
+ /*cancelFunc:*/ nativeModule().ffi_cyclops_sdk_rust_future_cancel_rust_buffer,
+ /*completeFunc:*/ nativeModule().ffi_cyclops_sdk_rust_future_complete_rust_buffer,
+ /*freeFunc:*/ nativeModule().ffi_cyclops_sdk_rust_future_free_rust_buffer,
+ // Async returns always go through the JS-side converter: the
+ // FFI symbol returns the future handle (u64), and the user-level
+ // RustBuffer comes back via the shared `rust_future_complete_*`
+ // export. The bytes the runtime hands back must be deserialized
+ // here using the per-callable return-type converter.
+ /*liftFunc:*/ FfiConverterSequenceTypeTemplate.lift.bind(FfiConverterSequenceTypeTemplate),
+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
+ /*asyncOpts:*/ asyncOpts_,
+ /*errorHandler:*/ FfiConverterTypeSdkError.lift.bind(FfiConverterTypeSdkError)
+ );
+ } catch (__error: any) {
+ if (uniffiIsDebug && __error instanceof Error) {
+ __error.stack = __stack;
+ }
+ throw __error;
+ }
+ }
+
+ async reconcilePool(request: CreatePoolRequest, asyncOpts_?: { signal: AbortSignal }): Promise<Pool> /*throws*/ {
+ const __stack = uniffiIsDebug ? new Error().stack : undefined;
+ try {
+ return await uniffiRustCallAsync(
+ /*rustCaller:*/ uniffiCaller,
+ /*rustFutureFunc:*/ () => {
+ return nativeModule().uniffi_cyclops_sdk_fn_method_cyclopsclient_reconcile_pool(
+ uniffiTypeCyclopsClientObjectFactory.clonePointer(this),FfiConverterTypeCreatePoolRequest.lower(request, nativeModule().rustbuffer_alloc)
+ );
+ },
+ /*pollFunc:*/ nativeModule().ffi_cyclops_sdk_rust_future_poll_rust_buffer,
+ /*cancelFunc:*/ nativeModule().ffi_cyclops_sdk_rust_future_cancel_rust_buffer,
+ /*completeFunc:*/ nativeModule().ffi_cyclops_sdk_rust_future_complete_rust_buffer,
+ /*freeFunc:*/ nativeModule().ffi_cyclops_sdk_rust_future_free_rust_buffer,
+ // Async returns always go through the JS-side converter: the
+ // FFI symbol returns the future handle (u64), and the user-level
+ // RustBuffer comes back via the shared `rust_future_complete_*`
+ // export. The bytes the runtime hands back must be deserialized
+ // here using the per-callable return-type converter.
+ /*liftFunc:*/ FfiConverterTypePool.lift.bind(FfiConverterTypePool),
+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
+ /*asyncOpts:*/ asyncOpts_,
+ /*errorHandler:*/ FfiConverterTypeSdkError.lift.bind(FfiConverterTypeSdkError)
+ );
+ } catch (__error: any) {
+ if (uniffiIsDebug && __error instanceof Error) {
+ __error.stack = __stack;
+ }
+ throw __error;
+ }
+ }
+
+ async reconcileTemplate(request: CreateTemplateRequest, asyncOpts_?: { signal: AbortSignal }): Promise<Template> /*throws*/ {
+ const __stack = uniffiIsDebug ? new Error().stack : undefined;
+ try {
+ return await uniffiRustCallAsync(
+ /*rustCaller:*/ uniffiCaller,
+ /*rustFutureFunc:*/ () => {
+ return nativeModule().uniffi_cyclops_sdk_fn_method_cyclopsclient_reconcile_template(
+ uniffiTypeCyclopsClientObjectFactory.clonePointer(this),FfiConverterTypeCreateTemplateRequest.lower(request, nativeModule().rustbuffer_alloc)
+ );
+ },
+ /*pollFunc:*/ nativeModule().ffi_cyclops_sdk_rust_future_poll_rust_buffer,
+ /*cancelFunc:*/ nativeModule().ffi_cyclops_sdk_rust_future_cancel_rust_buffer,
+ /*completeFunc:*/ nativeModule().ffi_cyclops_sdk_rust_future_complete_rust_buffer,
+ /*freeFunc:*/ nativeModule().ffi_cyclops_sdk_rust_future_free_rust_buffer,
+ // Async returns always go through the JS-side converter: the
+ // FFI symbol returns the future handle (u64), and the user-level
+ // RustBuffer comes back via the shared `rust_future_complete_*`
+ // export. The bytes the runtime hands back must be deserialized
+ // here using the per-callable return-type converter.
+ /*liftFunc:*/ FfiConverterTypeTemplate.lift.bind(FfiConverterTypeTemplate),
+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
+ /*asyncOpts:*/ asyncOpts_,
+ /*errorHandler:*/ FfiConverterTypeSdkError.lift.bind(FfiConverterTypeSdkError)
+ );
+ } catch (__error: any) {
+ if (uniffiIsDebug && __error instanceof Error) {
+ __error.stack = __stack;
+ }
+ throw __error;
+ }
+ }
+
async serviceRequest(sandbox: Sandbox, service: string, path: string, request: HttpRequest, asyncOpts_?: { signal: AbortSignal }): Promise<HttpResponse> /*throws*/ {
const __stack = uniffiIsDebug ? new Error().stack : undefined;
try {
@@ -1696,6 +2429,38 @@ private constructor(pointer: UniffiHandle) {
}
}
+ async updateTemplate(template: Template, asyncOpts_?: { signal: AbortSignal }): Promise<Template> /*throws*/ {
+ const __stack = uniffiIsDebug ? new Error().stack : undefined;
+ try {
+ return await uniffiRustCallAsync(
+ /*rustCaller:*/ uniffiCaller,
+ /*rustFutureFunc:*/ () => {
+ return nativeModule().uniffi_cyclops_sdk_fn_method_cyclopsclient_update_template(
+ uniffiTypeCyclopsClientObjectFactory.clonePointer(this),FfiConverterTypeTemplate.lower(template, nativeModule().rustbuffer_alloc)
+ );
+ },
+ /*pollFunc:*/ nativeModule().ffi_cyclops_sdk_rust_future_poll_rust_buffer,
+ /*cancelFunc:*/ nativeModule().ffi_cyclops_sdk_rust_future_cancel_rust_buffer,
+ /*completeFunc:*/ nativeModule().ffi_cyclops_sdk_rust_future_complete_rust_buffer,
+ /*freeFunc:*/ nativeModule().ffi_cyclops_sdk_rust_future_free_rust_buffer,
+ // Async returns always go through the JS-side converter: the
+ // FFI symbol returns the future handle (u64), and the user-level
+ // RustBuffer comes back via the shared `rust_future_complete_*`
+ // export. The bytes the runtime hands back must be deserialized
+ // here using the per-callable return-type converter.
+ /*liftFunc:*/ FfiConverterTypeTemplate.lift.bind(FfiConverterTypeTemplate),
+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
+ /*asyncOpts:*/ asyncOpts_,
+ /*errorHandler:*/ FfiConverterTypeSdkError.lift.bind(FfiConverterTypeSdkError)
+ );
+ } catch (__error: any) {
+ if (uniffiIsDebug && __error instanceof Error) {
+ __error.stack = __stack;
+ }
+ throw __error;
+ }
+ }
+
async waitClaim(claim: Claim, asyncOpts_?: { signal: AbortSignal }): Promise<Sandbox> /*throws*/ {
const __stack = uniffiIsDebug ? new Error().stack : undefined;
try {
@@ -2016,8 +2781,8 @@ const FfiConverterOptionalMapStringString = new FfiConverterOptional(FfiConverte
// FfiConverter for OsGymSandboxClaimStatus | undefined
const FfiConverterOptionalTypeOSGymSandboxClaimStatus = new FfiConverterOptional(FfiConverterTypeOSGymSandboxClaimStatus);
-// FfiConverter for OsGymWorkspacePoolStatus | undefined
-const FfiConverterOptionalTypeOSGymWorkspacePoolStatus = new FfiConverterOptional(FfiConverterTypeOSGymWorkspacePoolStatus);
+// FfiConverter for OsGymSandboxWarmPoolStatus | undefined
+const FfiConverterOptionalTypeOSGymSandboxWarmPoolStatus = new FfiConverterOptional(FfiConverterTypeOSGymSandboxWarmPoolStatus);
// FfiConverter for ClaimSpec | undefined
const FfiConverterOptionalTypeClaimSpec = new FfiConverterOptional(FfiConverterTypeClaimSpec);
@@ -2037,6 +2802,9 @@ const FfiConverterSequenceTypeClaim = new FfiConverterArray(FfiConverterTypeClai
// FfiConverter for Array<Pool>
const FfiConverterSequenceTypePool = new FfiConverterArray(FfiConverterTypePool);
+// FfiConverter for Array<Template>
+const FfiConverterSequenceTypeTemplate = new FfiConverterArray(FfiConverterTypeTemplate);
+
/**
* This should be called before anything else.
@@ -2056,39 +2824,81 @@ function uniffiEnsureInitialized() {
if (bindingsContractVersion !== scaffoldingContractVersion) {
throw new UniffiInternalError.ContractVersionMismatch(scaffoldingContractVersion, bindingsContractVersion);
}
+ if (nativeModule().uniffi_cyclops_sdk_checksum_method_accesstokenprovider_get_access_token() !== 1180) {
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cyclops_sdk_checksum_method_accesstokenprovider_get_access_token");
+ }
if (nativeModule().uniffi_cyclops_sdk_checksum_constructor_cyclopsclient_connect() !== 54404) {
throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cyclops_sdk_checksum_constructor_cyclopsclient_connect");
}
+ if (nativeModule().uniffi_cyclops_sdk_checksum_constructor_cyclopsclient_connect_browser_with_access_token() !== 55589) {
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cyclops_sdk_checksum_constructor_cyclopsclient_connect_browser_with_access_token");
+ }
+ if (nativeModule().uniffi_cyclops_sdk_checksum_constructor_cyclopsclient_connect_with_access_token() !== 10148) {
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cyclops_sdk_checksum_constructor_cyclopsclient_connect_with_access_token");
+ }
+ if (nativeModule().uniffi_cyclops_sdk_checksum_constructor_cyclopsclient_connect_with_access_token_and_native_http_client() !== 42291) {
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cyclops_sdk_checksum_constructor_cyclopsclient_connect_with_access_token_and_native_http_client");
+ }
+ if (nativeModule().uniffi_cyclops_sdk_checksum_constructor_cyclopsclient_connect_with_access_token_provider() !== 58487) {
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cyclops_sdk_checksum_constructor_cyclopsclient_connect_with_access_token_provider");
+ }
+ if (nativeModule().uniffi_cyclops_sdk_checksum_constructor_cyclopsclient_connect_with_access_token_provider_and_native_http_client() !== 62005) {
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cyclops_sdk_checksum_constructor_cyclopsclient_connect_with_access_token_provider_and_native_http_client");
+ }
+ if (nativeModule().uniffi_cyclops_sdk_checksum_constructor_cyclopsclient_connect_with_native_http_client() !== 49301) {
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cyclops_sdk_checksum_constructor_cyclopsclient_connect_with_native_http_client");
+ }
if (nativeModule().uniffi_cyclops_sdk_checksum_method_cyclopsclient_create_claim() !== 23330) {
throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cyclops_sdk_checksum_method_cyclopsclient_create_claim");
}
if (nativeModule().uniffi_cyclops_sdk_checksum_method_cyclopsclient_create_pool() !== 48557) {
throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cyclops_sdk_checksum_method_cyclopsclient_create_pool");
}
+ if (nativeModule().uniffi_cyclops_sdk_checksum_method_cyclopsclient_create_template() !== 13689) {
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cyclops_sdk_checksum_method_cyclopsclient_create_template");
+ }
if (nativeModule().uniffi_cyclops_sdk_checksum_method_cyclopsclient_delete_claim() !== 20460) {
throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cyclops_sdk_checksum_method_cyclopsclient_delete_claim");
}
if (nativeModule().uniffi_cyclops_sdk_checksum_method_cyclopsclient_delete_pool() !== 31235) {
throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cyclops_sdk_checksum_method_cyclopsclient_delete_pool");
}
+ if (nativeModule().uniffi_cyclops_sdk_checksum_method_cyclopsclient_delete_template() !== 54852) {
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cyclops_sdk_checksum_method_cyclopsclient_delete_template");
+ }
if (nativeModule().uniffi_cyclops_sdk_checksum_method_cyclopsclient_get_claim() !== 17760) {
throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cyclops_sdk_checksum_method_cyclopsclient_get_claim");
}
if (nativeModule().uniffi_cyclops_sdk_checksum_method_cyclopsclient_get_pool() !== 49450) {
throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cyclops_sdk_checksum_method_cyclopsclient_get_pool");
}
+ if (nativeModule().uniffi_cyclops_sdk_checksum_method_cyclopsclient_get_template() !== 8909) {
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cyclops_sdk_checksum_method_cyclopsclient_get_template");
+ }
if (nativeModule().uniffi_cyclops_sdk_checksum_method_cyclopsclient_list_claims() !== 7802) {
throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cyclops_sdk_checksum_method_cyclopsclient_list_claims");
}
if (nativeModule().uniffi_cyclops_sdk_checksum_method_cyclopsclient_list_pools() !== 27984) {
throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cyclops_sdk_checksum_method_cyclopsclient_list_pools");
}
+ if (nativeModule().uniffi_cyclops_sdk_checksum_method_cyclopsclient_list_templates() !== 58376) {
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cyclops_sdk_checksum_method_cyclopsclient_list_templates");
+ }
+ if (nativeModule().uniffi_cyclops_sdk_checksum_method_cyclopsclient_reconcile_pool() !== 53919) {
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cyclops_sdk_checksum_method_cyclopsclient_reconcile_pool");
+ }
+ if (nativeModule().uniffi_cyclops_sdk_checksum_method_cyclopsclient_reconcile_template() !== 36469) {
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cyclops_sdk_checksum_method_cyclopsclient_reconcile_template");
+ }
if (nativeModule().uniffi_cyclops_sdk_checksum_method_cyclopsclient_service_request() !== 46699) {
throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cyclops_sdk_checksum_method_cyclopsclient_service_request");
}
if (nativeModule().uniffi_cyclops_sdk_checksum_method_cyclopsclient_update_pool() !== 17695) {
throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cyclops_sdk_checksum_method_cyclopsclient_update_pool");
}
+ if (nativeModule().uniffi_cyclops_sdk_checksum_method_cyclopsclient_update_template() !== 18704) {
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cyclops_sdk_checksum_method_cyclopsclient_update_template");
+ }
if (nativeModule().uniffi_cyclops_sdk_checksum_method_cyclopsclient_wait_claim() !== 18984) {
throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cyclops_sdk_checksum_method_cyclopsclient_wait_claim");
}
@@ -2099,18 +2909,23 @@ function uniffiEnsureInitialized() {
throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cyclops_sdk_checksum_method_httpclient_execute");
}
+ uniffiCallbackInterfaceAccessTokenProvider.register();
uniffiCallbackInterfaceHttpClient.register();
}
export default Object.freeze({
initialize: uniffiEnsureInitialized,
converters: {
+ FfiConverterTypeAccessTokenProvider,
+ FfiConverterTypeAccessTokenProviderError,
FfiConverterTypeClaim,
FfiConverterTypeCreateClaimRequest,
FfiConverterTypeCreatePoolRequest,
+ FfiConverterTypeCreateTemplateRequest,
FfiConverterTypeCyclopsClient,
FfiConverterTypeCyclopsConfiguration,
FfiConverterTypeCyclopsCredentials,
+ FfiConverterTypeCyclopsTokenProviderConfiguration,
FfiConverterTypeHttpClient,
FfiConverterTypeHttpError,
FfiConverterTypeHttpHeader,
@@ -2120,5 +2935,6 @@ export default Object.freeze({
FfiConverterTypeResourceMetadata,
FfiConverterTypeSandbox,
FfiConverterTypeSdkError,
+ FfiConverterTypeTemplate,
}
});
\ No newline at end of file
diff --git a/libs/fleet/sdk-bindings/ts-uniffi/index.ts b/libs/fleet/sdk-bindings/ts-uniffi/index.ts
index 7773ef46f8..a2164622cf 100644
--- a/libs/fleet/sdk-bindings/ts-uniffi/index.ts
+++ b/libs/fleet/sdk-bindings/ts-uniffi/index.ts
@@ -1,14 +1,14 @@
// Generated by uniffi-bindgen-react-native — do not edit.
-export * from './cyclops_sdk';
export * from './cyclops_sdk_schema';
-import * as cyclops_sdk from './cyclops_sdk';
+export * from './fleet_sdk';
import * as cyclops_sdk_schema from './cyclops_sdk_schema';
+import * as fleet_sdk from './fleet_sdk';
let initialized = false;
if (!initialized) {
- cyclops_sdk.default.initialize();
cyclops_sdk_schema.default.initialize();
+ fleet_sdk.default.initialize();
initialized = true;
}
@@ -16,6 +16,6 @@ export async function uniffiInitAsync() { /* sync flavor: no-op */ }
export default {
- cyclops_sdk,
cyclops_sdk_schema,
+ fleet_sdk,
};
\ No newline at end of file
diff --git a/libs/fleet/sdk-schema/src/generate.rs b/libs/fleet/sdk-schema/src/generate.rs
index 209406db92..3cbfe5a5c4 100644
--- a/libs/fleet/sdk-schema/src/generate.rs
+++ b/libs/fleet/sdk-schema/src/generate.rs
@@ -1,6 +1,4 @@
-use crate::{
- OSGymSandbox, OSGymSandboxClaim, OSGymSandboxTemplate, OSGymSandboxWarmPool, OSGymWorkspacePool,
-};
+use crate::{OSGymSandbox, OSGymSandboxClaim, OSGymSandboxTemplate, OSGymSandboxWarmPool};
use anyhow::{Context, Result, bail};
use kube::CustomResourceExt;
use serde::Deserialize;
@@ -13,7 +11,6 @@ pub fn render_crds() -> Result<String> {
serde_yaml::to_string(&OSGymSandboxTemplate::crd())?,
serde_yaml::to_string(&OSGymSandboxWarmPool::crd())?,
serde_yaml::to_string(&OSGymSandboxClaim::crd())?,
- serde_yaml::to_string(&OSGymWorkspacePool::crd())?,
];
Ok(resources.join("---\n"))
diff --git a/libs/fleet/sdk-schema/src/lib.rs b/libs/fleet/sdk-schema/src/lib.rs
index 5fa158be26..7755665fcd 100644
--- a/libs/fleet/sdk-schema/src/lib.rs
+++ b/libs/fleet/sdk-schema/src/lib.rs
@@ -4,7 +4,6 @@ pub mod generate;
mod json;
mod sandbox;
mod warmpool;
-mod workspace_pool;
pub use claim::{
ClaimLifecycle, ClaimSpec, OSGymSandboxClaim, OSGymSandboxClaimCondition,
@@ -22,8 +21,5 @@ pub use sandbox::{
pub use warmpool::{
OSGymSandboxWarmPool, OSGymSandboxWarmPoolSpec, OSGymSandboxWarmPoolStatus, WarmPoolAutoscaling,
};
-pub use workspace_pool::{
- OSGymWorkspacePool, OSGymWorkspacePoolStatus, PoolSpec, PoolTemplate, WorkspacePoolAutoscaling,
-};
uniffi::setup_scaffolding!("cyclops_sdk_schema");
diff --git a/libs/fleet/sdk-schema/src/workspace_pool.rs b/libs/fleet/sdk-schema/src/workspace_pool.rs
deleted file mode 100644
index 1a73d4e180..0000000000
--- a/libs/fleet/sdk-schema/src/workspace_pool.rs
+++ /dev/null
@@ -1,250 +0,0 @@
-use crate::{
- Firmware, OidcConfig, PreservedJson, RuntimeKind, SandboxService, WarmPoolAutoscaling,
- common::{
- default_cpu_cores, default_firmware, default_memory, default_runtime, firmware_schema,
- integer_schema, node_selector_schema, oidc_schema, preserved_json_schema, runtime_schema,
- string_list_schema, string_schema, tolerations_schema,
- },
-};
-use kube::CustomResource;
-use schemars::JsonSchema;
-use serde::{Deserialize, Serialize};
-use std::{
- collections::HashMap,
- hash::{Hash, Hasher},
- sync::Arc,
-};
-
-pub type WorkspacePoolAutoscaling = WarmPoolAutoscaling;
-
-#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, JsonSchema, uniffi::Record)]
-#[serde(rename_all = "camelCase")]
-pub struct PoolTemplate {
- #[schemars(
- default = "default_runtime",
- schema_with = "runtime_schema",
- description = "Pool backend. \"kubevirt\" (default) provisions a KubeVirt\nVM. \"macos\" provisions a macOS sandbox (ADMIN-ONLY\n\u{2014} the cyclops-cs backend rejects macos pool writes from\nnon-admins; the SPA hides the option). Flows verbatim\nthrough the compat shim into the OSGymSandboxTemplate\nvmTemplate, where macos_backend dispatches on it.\n"
- )]
- #[serde(skip_serializing_if = "Option::is_none")]
- pub runtime: Option<RuntimeKind>,
- #[schemars(
- default,
- schema_with = "string_schema",
- description = "runtime=macos only. Sandbox pod RuntimeClass (default cua-macos-native)."
- )]
- #[serde(skip_serializing_if = "Option::is_none")]
- pub runtime_class_name: Option<String>,
- #[schemars(
- default,
- schema_with = "node_selector_schema",
- description = "runtime=macos only. nodeSelector to pin onto macOS nodes."
- )]
- #[serde(skip_serializing_if = "Option::is_none")]
- pub node_selector: Option<HashMap<String, String>>,
- #[schemars(
- default,
- schema_with = "tolerations_schema",
- description = "runtime=macos only. Tolerations for tainted macOS nodes."
- )]
- #[serde(skip_serializing_if = "Option::is_none")]
- pub tolerations: Option<Vec<Arc<PreservedJson>>>,
- #[schemars(
- default,
- schema_with = "string_list_schema",
- description = "runtime=macos only. Sandbox container entrypoint."
- )]
- #[serde(skip_serializing_if = "Option::is_none")]
- pub command: Option<Vec<String>>,
- pub container_disk_image: String,
- #[schemars(default, schema_with = "string_schema")]
- #[serde(skip_serializing_if = "Option::is_none")]
- pub image_pull_secret: Option<String>,
- #[schemars(
- default = "default_cpu_cores",
- schema_with = "integer_schema",
- range(min = 1)
- )]
- #[serde(skip_serializing_if = "Option::is_none")]
- pub cpu_cores: Option<u32>,
- #[schemars(default = "default_memory", schema_with = "string_schema")]
- #[serde(skip_serializing_if = "Option::is_none")]
- pub memory: Option<String>,
- #[schemars(
- default = "default_firmware",
- schema_with = "firmware_schema",
- description = "VM firmware. Use \"efi\" for GPT/UEFI-only guest images\n(e.g. the dockur-built Windows desktop-workspace);\n\"bios\" is KubeVirt's default and what the Linux\nworkspace images boot with.\n"
- )]
- #[serde(skip_serializing_if = "Option::is_none")]
- pub firmware: Option<Firmware>,
- #[schemars(
- default,
- schema_with = "preserved_json_schema",
- description = "Optional KubeVirt readinessProbe/livenessProbe for the\nVMI, gating ready on the guest actually serving. (Was\npreviously sent by the dashboard but pruned by this\nschema \u{2014} adding it makes the field actually persist.)\n"
- )]
- #[serde(skip_serializing_if = "Option::is_none")]
- pub probes: Option<Arc<PreservedJson>>,
- #[schemars(
- default,
- schema_with = "oidc_schema",
- description = "Optional Keycloak workload-OIDC token injection,\npropagated verbatim by the compat shim onto the generated\nOSGymSandboxTemplate.spec.vmTemplate.oidc. When set, the\npool-operator renders a cloud-init disk that drops the\ntenant-scoped Keycloak client credentials into the guest\nand runs an in-guest refresher that mints + rotates an\nOIDC access token at /var/run/cua/oidc/token. See\ndocs/decisions/2026-06-25-osgym-pool-workload-oidc.md.\n"
- )]
- #[serde(skip_serializing_if = "Option::is_none")]
- pub oidc: Option<OidcConfig>,
-}
-
-#[allow(clippy::duplicated_attributes)]
-#[uniffi::export(Eq, Hash)]
-#[derive(
- CustomResource, Clone, Debug, PartialEq, Deserialize, Serialize, JsonSchema, uniffi::Record,
-)]
-#[kube(
- group = "cua.ai",
- version = "v1",
- kind = "OSGymWorkspacePool",
- plural = "osgymworkspacepools",
- namespaced,
- shortname = "owsp",
- status = "OSGymWorkspacePoolStatus",
- printcolumn(name = "Replicas", type_ = "integer", json_path = ".spec.replicas"),
- printcolumn(
- name = "Available",
- type_ = "integer",
- json_path = ".status.availableCount"
- ),
- printcolumn(name = "Phase", type_ = "string", json_path = ".status.phase"),
- printcolumn(
- name = "Age",
- type_ = "date",
- json_path = ".metadata.creationTimestamp"
- ),
- doc = ""
-)]
-#[serde(rename_all = "camelCase")]
-pub struct PoolSpec {
- #[schemars(schema_with = "integer_schema", range(min = 0))]
- pub replicas: u32,
- pub template: PoolTemplate,
- #[schemars(
- description = "OPTIONAL autoscaling extension. Propagated verbatim by\nthe compat shim onto the generated\nOSGymSandboxWarmPool.spec.autoscaling, which opts the\npool into KEDA autoscaling on claim demand. Absent = a\nplain pool. See\ndocs/decisions/2026-06-15-pool-claim-autoscaling.md.\n"
- )]
- #[serde(skip_serializing_if = "Option::is_none")]
- pub autoscaling: Option<WorkspacePoolAutoscaling>,
- #[schemars(description = "Extra K8s Services created per-sandbox.")]
- #[serde(skip_serializing_if = "Option::is_none")]
- pub services: Option<Vec<SandboxService>>,
-}
-
-impl Hash for PoolSpec {
- fn hash<H: Hasher>(&self, state: &mut H) {
- let value =
- serde_json::to_value(self).expect("PoolSpec serialization should be infallible");
- hash_json_value(&value, state);
- }
-}
-
-fn hash_json_value<H: Hasher>(value: &serde_json::Value, state: &mut H) {
- match value {
- serde_json::Value::Null => 0_u8.hash(state),
- serde_json::Value::Bool(value) => {
- 1_u8.hash(state);
- value.hash(state);
- }
- serde_json::Value::Number(value) => {
- 2_u8.hash(state);
- value.hash(state);
- }
- serde_json::Value::String(value) => {
- 3_u8.hash(state);
- value.hash(state);
- }
- serde_json::Value::Array(values) => {
- 4_u8.hash(state);
- values.len().hash(state);
- for value in values {
- hash_json_value(value, state);
- }
- }
- serde_json::Value::Object(values) => {
- 5_u8.hash(state);
- values.len().hash(state);
- let mut keys: Vec<_> = values.keys().collect();
- keys.sort_unstable();
- for key in keys {
- key.hash(state);
- hash_json_value(&values[key], state);
- }
- }
- }
-}
-
-#[derive(Clone, Debug, Default, PartialEq, Deserialize, Serialize, JsonSchema, uniffi::Record)]
-#[serde(rename_all = "camelCase")]
-pub struct OSGymWorkspacePoolStatus {
- #[schemars(default, schema_with = "string_schema")]
- #[serde(skip_serializing_if = "Option::is_none")]
- pub phase: Option<String>,
- #[schemars(default, schema_with = "integer_schema")]
- #[serde(skip_serializing_if = "Option::is_none")]
- pub total_count: Option<u32>,
- #[schemars(default, schema_with = "integer_schema")]
- #[serde(skip_serializing_if = "Option::is_none")]
- pub available_count: Option<u32>,
- #[schemars(default, schema_with = "integer_schema")]
- #[serde(skip_serializing_if = "Option::is_none")]
- pub claimed_count: Option<u32>,
-}
-
-#[cfg(test)]
-mod tests {
- use super::*;
- use std::{
- collections::{HashMap, hash_map::DefaultHasher},
- hash::{Hash, Hasher},
- };
-
- #[test]
- fn canonical_json_hash_matches_equal_zero_representations() {
- let positive = serde_json::json!(0.0);
- let negative = serde_json::json!(-0.0);
- assert_eq!(positive, negative);
-
- let mut positive_hasher = DefaultHasher::new();
- hash_json_value(&positive, &mut positive_hasher);
- let mut negative_hasher = DefaultHasher::new();
- hash_json_value(&negative, &mut negative_hasher);
- assert_eq!(positive_hasher.finish(), negative_hasher.finish());
- }
-
- #[test]
- fn pool_spec_hash_is_stable_across_node_selector_insertion_order() {
- let mut left: PoolSpec = serde_json::from_value(serde_json::json!({
- "replicas": 1,
- "template": { "containerDiskImage": "example.invalid/workspace:latest" }
- }))
- .expect("pool spec fixture should deserialize");
- let mut right = left.clone();
-
- left.template.node_selector = Some(HashMap::from([
- ("kubernetes.io/arch".to_string(), "amd64".to_string()),
- (
- "topology.kubernetes.io/zone".to_string(),
- "us-east-1a".to_string(),
- ),
- ]));
- right.template.node_selector = Some(HashMap::from([
- (
- "topology.kubernetes.io/zone".to_string(),
- "us-east-1a".to_string(),
- ),
- ("kubernetes.io/arch".to_string(), "amd64".to_string()),
- ]));
-
- assert_eq!(left, right);
-
- let mut left_hasher = DefaultHasher::new();
- left.hash(&mut left_hasher);
- let mut right_hasher = DefaultHasher::new();
- right.hash(&mut right_hasher);
- assert_eq!(left_hasher.finish(), right_hasher.finish());
- }
-}
diff --git a/libs/fleet/sdk-schema/tests/crd_contract.rs b/libs/fleet/sdk-schema/tests/crd_contract.rs
index 31aa427cf9..96186df609 100644
--- a/libs/fleet/sdk-schema/tests/crd_contract.rs
+++ b/libs/fleet/sdk-schema/tests/crd_contract.rs
@@ -26,79 +26,10 @@ fn generated_bundle_has_stable_resource_order() {
"osgymsandboxtemplates.osgym.cua.ai",
"osgymsandboxwarmpools.osgym.cua.ai",
"osgymsandboxclaims.osgym.cua.ai",
- "osgymworkspacepools.cua.ai",
]
);
}
-#[test]
-fn workspace_pool_preserves_fields_constraints_and_kubernetes_extensions() {
- let workspace_pool = semantic_yaml_documents(&render_crds().unwrap())
- .unwrap()
- .into_iter()
- .find(|document| {
- document.pointer("/metadata/name") == Some(&json!("osgymworkspacepools.cua.ai"))
- })
- .unwrap();
- let schema = "/spec/versions/0/schema/openAPIV3Schema";
-
- assert_eq!(
- workspace_pool.pointer(&format!("{schema}/properties/spec/required")),
- Some(&json!(["replicas", "template"]))
- );
- assert_eq!(
- workspace_pool.pointer(&format!(
- "{schema}/properties/spec/properties/replicas/minimum"
- )),
- Some(&json!(0.0))
- );
- assert_eq!(
- workspace_pool.pointer(&format!(
- "{schema}/properties/spec/properties/template/required"
- )),
- Some(&json!(["containerDiskImage"]))
- );
- assert_eq!(
- workspace_pool.pointer(&format!("{schema}/properties/spec/properties/template/properties/tolerations/items/x-kubernetes-preserve-unknown-fields")),
- Some(&json!(true))
- );
- assert_eq!(
- workspace_pool.pointer(&format!("{schema}/properties/spec/properties/template/properties/probes/x-kubernetes-preserve-unknown-fields")),
- Some(&json!(true))
- );
- assert_eq!(
- workspace_pool.pointer(&format!(
- "{schema}/properties/spec/properties/autoscaling/properties/minPoolSize/default"
- )),
- Some(&json!(0))
- );
- assert_eq!(
- workspace_pool.pointer(&format!(
- "{schema}/properties/spec/properties/autoscaling/properties/maxPoolSize/minimum"
- )),
- Some(&json!(1.0))
- );
- assert_eq!(
- workspace_pool.pointer(&format!(
- "{schema}/properties/spec/properties/services/items/properties/targetPort/maximum"
- )),
- Some(&json!(65535.0))
- );
- assert_eq!(
- workspace_pool.pointer("/spec/versions/0/subresources/status"),
- Some(&json!({}))
- );
- assert_eq!(
- workspace_pool.pointer("/spec/versions/0/additionalPrinterColumns"),
- Some(&json!([
- {"name": "Replicas", "type": "integer", "jsonPath": ".spec.replicas"},
- {"name": "Available", "type": "integer", "jsonPath": ".status.availableCount"},
- {"name": "Phase", "type": "string", "jsonPath": ".status.phase"},
- {"name": "Age", "type": "date", "jsonPath": ".metadata.creationTimestamp"},
- ]))
- );
-}
-
fn generated_documents() -> Vec<serde_json::Value> {
semantic_yaml_documents(&render_crds().unwrap()).unwrap()
}
@@ -127,76 +58,6 @@ fn assert_drift_reports(documents: &[serde_json::Value], expected_names: &[&str]
}
}
-#[test]
-fn workspace_pool_schema_allows_only_historical_template_paths() {
- let documents = generated_documents();
- let workspace_pool = documents
- .iter()
- .find(|document| {
- document.pointer("/metadata/name") == Some(&json!("osgymworkspacepools.cua.ai"))
- })
- .unwrap();
- let schema = "/spec/versions/0/schema/openAPIV3Schema/properties";
- let spec = workspace_pool
- .pointer(&format!("{schema}/spec"))
- .and_then(serde_json::Value::as_object)
- .unwrap();
- let template = workspace_pool
- .pointer(&format!("{schema}/spec/properties/template"))
- .and_then(serde_json::Value::as_object)
- .unwrap();
-
- assert_eq!(spec.get("required"), Some(&json!(["replicas", "template"])));
- assert_eq!(
- spec.get("properties")
- .and_then(serde_json::Value::as_object)
- .unwrap()
- .keys()
- .map(String::as_str)
- .collect::<std::collections::BTreeSet<_>>(),
- std::collections::BTreeSet::from(["autoscaling", "replicas", "services", "template",])
- );
- assert_eq!(
- template.get("required"),
- Some(&json!(["containerDiskImage"]))
- );
- assert_eq!(
- template
- .get("properties")
- .and_then(serde_json::Value::as_object)
- .unwrap()
- .keys()
- .map(String::as_str)
- .collect::<std::collections::BTreeSet<_>>(),
- std::collections::BTreeSet::from([
- "command",
- "containerDiskImage",
- "cpuCores",
- "firmware",
- "imagePullSecret",
- "memory",
- "nodeSelector",
- "oidc",
- "probes",
- "runtime",
- "runtimeClassName",
- "tolerations",
- ])
- );
- assert_eq!(
- workspace_pool.pointer(&format!(
- "{schema}/spec/properties/template/properties/imagePullPolicy"
- )),
- None
- );
- assert_eq!(
- workspace_pool.pointer(&format!(
- "{schema}/spec/properties/template/properties/services"
- )),
- None
- );
-}
-
#[test]
fn check_crds_reports_modified_removed_added_reordered_and_duplicate_documents() {
let documents = generated_documents();
@@ -207,7 +68,7 @@ fn check_crds_reports_modified_removed_added_reordered_and_duplicate_documents()
let mut removed = documents.clone();
removed.pop();
- assert_drift_reports(&removed, &["osgymworkspacepools.cua.ai"]);
+ assert_drift_reports(&removed, &["osgymsandboxclaims.osgym.cua.ai"]);
let mut added = documents.clone();
let mut additional = documents[0].clone();
diff --git a/libs/fleet/sdk/src/claims.rs b/libs/fleet/sdk/src/claims.rs
index 2fb2c87c68..e3a02814da 100644
--- a/libs/fleet/sdk/src/claims.rs
+++ b/libs/fleet/sdk/src/claims.rs
@@ -1,8 +1,8 @@
use crate::{
Claim, CreateClaimRequest, CyclopsClient, HttpHeader, HttpRequest, HttpResponse, Pool,
- ResourceMetadata, Sandbox, SdkError, routes,
+ ResourceMetadata, Sandbox, SdkError, Template, routes,
};
-use cyclops_sdk_schema::{ClaimSpec, SandboxTemplateRef};
+use cyclops_sdk_schema::ClaimSpec;
#[cfg(not(target_arch = "wasm32"))]
use futures_timer::Delay;
#[cfg(target_arch = "wasm32")]
@@ -36,10 +36,12 @@ impl CyclopsClient {
) -> Result<Claim, SdkError> {
self.ensure_claim_pool_identity(&request.pool)?;
let pool = request.pool;
+ // Default the template ref from the warm pool's own spec — never from
+ // a naming convention. A hand-built ref that names a nonexistent
+ // template makes the bind queue lookup miss forever and the claim
+ // times out with no useful error (the hermes-cua-pool incident).
let spec = request.spec.unwrap_or_else(|| ClaimSpec {
- sandbox_template_ref: SandboxTemplateRef {
- name: format!("{}-template", pool.metadata.name),
- },
+ sandbox_template_ref: pool.spec.sandbox_template_ref.clone(),
warmpool: None,
bind_deadline: None,
lifecycle: None,
@@ -120,7 +122,7 @@ impl CyclopsClient {
.ok_or_else(|| SdkError::Body {
reason: "bound claim omitted status.sandbox.name".into(),
})?;
- let services = service_names(&self.pool_for_claim(&current).await?);
+ let services = service_names(&self.template_for_claim(&current).await?);
return Ok(Sandbox {
namespace: current.metadata.namespace,
claim: current.metadata.name,
@@ -164,19 +166,17 @@ impl CyclopsClient {
)
}
- async fn pool_for_claim(&self, claim: &Claim) -> Result<Pool, SdkError> {
+ async fn template_for_claim(&self, claim: &Claim) -> Result<Template, SdkError> {
let template = &claim.spec.sandbox_template_ref.name;
if template.is_empty() {
return Err(SdkError::Body {
reason: "claim omitted spec.sandboxTemplateRef.name".into(),
});
}
- let pool_name = template.strip_suffix("-template").unwrap_or(template);
- let item_url =
- pool_item_for_template(self.base_url(), &claim.metadata.namespace, pool_name)?;
+ let item_url = routes::template_item(self.base_url(), &claim.metadata.namespace, template)?;
send_json(
self,
- "get pool services",
+ "get claim template",
json_request("GET", item_url, None),
&[200],
)
@@ -184,23 +184,14 @@ impl CyclopsClient {
}
}
-fn pool_item_for_template(base: &Url, namespace: &str, template: &str) -> Result<Url, SdkError> {
- let mut url = routes::pool_collection(base, namespace)?;
- url.path_segments_mut()
- .map_err(|_| SdkError::Configuration {
- reason: "base_url cannot accept path segments".into(),
- })?
- .push(template);
- Ok(url)
-}
-
fn claim_name(sequence: u64) -> String {
format!("claim-{sequence}")
}
-fn service_names(pool: &Pool) -> Vec<String> {
- let mut names: Vec<String> = pool
+fn service_names(template: &Template) -> Vec<String> {
+ let mut names: Vec<String> = template
.spec
+ .vm_template
.services
.as_deref()
.unwrap_or_default()
diff --git a/libs/fleet/sdk/src/lib.rs b/libs/fleet/sdk/src/lib.rs
index f4337aeb93..4649f1d300 100644
--- a/libs/fleet/sdk/src/lib.rs
+++ b/libs/fleet/sdk/src/lib.rs
@@ -4,6 +4,7 @@ mod error;
mod pools;
mod routes;
mod services;
+mod templates;
mod transport;
mod types;
@@ -14,9 +15,9 @@ pub use error::{
pub use routes::validate_dns_label;
pub use transport::{AccessTokenProvider, HttpClient};
pub use types::{
- Claim, CreateClaimRequest, CreatePoolRequest, CyclopsConfiguration, CyclopsCredentials,
- CyclopsTokenProviderConfiguration, HttpHeader, HttpRequest, HttpResponse, Pool,
- ResourceMetadata, Sandbox,
+ Claim, CreateClaimRequest, CreatePoolRequest, CreateTemplateRequest, CyclopsConfiguration,
+ CyclopsCredentials, CyclopsTokenProviderConfiguration, HttpHeader, HttpRequest, HttpResponse,
+ Pool, ResourceMetadata, Sandbox, Template,
};
uniffi::setup_scaffolding!("fleet_sdk");
diff --git a/libs/fleet/sdk/src/pools.rs b/libs/fleet/sdk/src/pools.rs
index 9315c416c0..2e6a1b8eea 100644
--- a/libs/fleet/sdk/src/pools.rs
+++ b/libs/fleet/sdk/src/pools.rs
@@ -28,8 +28,8 @@ impl CyclopsClient {
let namespace_item_url = routes::namespace_item(self.base_url(), &request.namespace)?;
let collection_url = routes::pool_collection(self.base_url(), &request.namespace)?;
let pool = Pool {
- api_version: "cua.ai/v1".into(),
- kind: "OSGymWorkspacePool".into(),
+ api_version: "osgym.cua.ai/v1alpha1".into(),
+ kind: "OSGymSandboxWarmPool".into(),
metadata: ResourceMetadata {
namespace: request.namespace.clone(),
name: request.namespace,
@@ -54,7 +54,7 @@ impl CyclopsClient {
NamespaceOwnership::Created
);
let result = self
- .send_json(
+ .send_json_crud(
"create pool",
json_request("POST", collection_url, Some(to_json(&pool)?)),
&[200, 201, 202],
@@ -75,7 +75,7 @@ impl CyclopsClient {
pub async fn list_pools(self: Arc<Self>, namespace: String) -> Result<Vec<Pool>, SdkError> {
let collection_url = routes::pool_collection(self.base_url(), &namespace)?;
let list: ResourceList<Pool> = self
- .send_json(
+ .send_json_crud(
"list pools",
json_request("GET", collection_url, None),
&[200],
@@ -86,7 +86,7 @@ impl CyclopsClient {
pub async fn get_pool(self: Arc<Self>, name: String) -> Result<Pool, SdkError> {
let item_url = routes::named_pool_item(self.base_url(), &name)?;
- self.send_json("get pool", json_request("GET", item_url, None), &[200])
+ self.send_json_crud("get pool", json_request("GET", item_url, None), &[200])
.await
}
@@ -109,7 +109,7 @@ impl CyclopsClient {
pub async fn update_pool(self: Arc<Self>, pool: Pool) -> Result<Pool, SdkError> {
let item_url = self.pool_item_url(&pool)?;
let body = to_json(&pool)?;
- self.send_json(
+ self.send_json_crud(
"update pool",
merge_patch_request(item_url, Some(body)),
&[200],
@@ -124,7 +124,7 @@ impl CyclopsClient {
let _lifecycle_guard = self
.namespace_lifecycle_guard(&pool.metadata.namespace)
.await;
- self.send_unit(
+ self.send_unit_crud(
"delete pool",
json_request("DELETE", item_url, None),
&[200, 202, 204, 404],
@@ -159,7 +159,7 @@ impl CyclopsClient {
}
async fn delete_namespace(&self, namespace_url: &Url) -> Result<(), SdkError> {
- self.send_unit(
+ self.send_unit_crud(
"delete namespace",
json_request("DELETE", namespace_url.clone(), None),
&[200, 202, 204, 404],
@@ -186,7 +186,7 @@ impl CyclopsClient {
)
}
- async fn send_json<T: DeserializeOwned>(
+ pub(crate) async fn send_json_crud<T: DeserializeOwned>(
&self,
operation: &str,
request: HttpRequest,
@@ -198,7 +198,7 @@ impl CyclopsClient {
})
}
- async fn send_unit(
+ pub(crate) async fn send_unit_crud(
&self,
operation: &str,
request: HttpRequest,
diff --git a/libs/fleet/sdk/src/routes.rs b/libs/fleet/sdk/src/routes.rs
index 0cd4459a7e..3635aee997 100644
--- a/libs/fleet/sdk/src/routes.rs
+++ b/libs/fleet/sdk/src/routes.rs
@@ -1,10 +1,11 @@
use crate::{Sandbox, SdkError};
use url::Url;
-const POOL_COLLECTION_PREFIX: &str = "api/k8s/apis/cua.ai/v1/namespaces/";
+const POOL_COLLECTION_PREFIX: &str = "api/k8s/apis/osgym.cua.ai/v1alpha1/namespaces/";
const CLAIM_COLLECTION_PREFIX: &str = "api/k8s/apis/osgym.cua.ai/v1alpha1/namespaces/";
const CLAIM_COLLECTION_SUFFIX: &str = "/osgymsandboxclaims";
-const POOL_COLLECTION_SUFFIX: &str = "/osgymworkspacepools";
+const POOL_COLLECTION_SUFFIX: &str = "/osgymsandboxwarmpools";
+const TEMPLATE_COLLECTION_SUFFIX: &str = "/osgymsandboxtemplates";
const NAMESPACE_COLLECTION: &str = "api/namespaces";
const NAMESPACE_PREFIX: &str = "api/namespaces/";
const SERVICE_COLLECTION_PREFIX: &str = "api/svc/";
@@ -34,6 +35,23 @@ pub fn named_pool_item(base: &Url, name: &str) -> Result<Url, SdkError> {
)
}
+pub fn template_collection(base: &Url, namespace: &str) -> Result<Url, SdkError> {
+ validate_dns_label_for("namespace", namespace)?;
+ route(
+ base,
+ format!("{POOL_COLLECTION_PREFIX}{namespace}{TEMPLATE_COLLECTION_SUFFIX}"),
+ )
+}
+
+pub fn template_item(base: &Url, namespace: &str, name: &str) -> Result<Url, SdkError> {
+ validate_dns_label_for("namespace", namespace)?;
+ validate_dns_label_for("name", name)?;
+ route(
+ base,
+ format!("{POOL_COLLECTION_PREFIX}{namespace}{TEMPLATE_COLLECTION_SUFFIX}/{name}"),
+ )
+}
+
pub fn namespace_collection(base: &Url) -> Result<Url, SdkError> {
route(base, NAMESPACE_COLLECTION.into())
}
@@ -223,7 +241,7 @@ fn hex_value(byte: u8) -> Option<u8> {
mod tests {
use super::{
claim_collection, claim_item, namespace_collection, namespace_item, pool_collection,
- pool_item,
+ pool_item, template_collection, template_item,
};
use url::Url;
@@ -233,13 +251,13 @@ mod tests {
assert_eq!(
pool_collection(&base, "example-pool").unwrap().as_str(),
- "https://cyclops.example:8443/api/k8s/apis/cua.ai/v1/namespaces/example-pool/osgymworkspacepools"
+ "https://cyclops.example:8443/api/k8s/apis/osgym.cua.ai/v1alpha1/namespaces/example-pool/osgymsandboxwarmpools"
);
assert_eq!(
pool_item(&base, "example-pool", "example-pool")
.unwrap()
.as_str(),
- "https://cyclops.example:8443/api/k8s/apis/cua.ai/v1/namespaces/example-pool/osgymworkspacepools/example-pool"
+ "https://cyclops.example:8443/api/k8s/apis/osgym.cua.ai/v1alpha1/namespaces/example-pool/osgymsandboxwarmpools/example-pool"
);
assert_eq!(
namespace_collection(&base).unwrap().as_str(),
@@ -259,6 +277,16 @@ mod tests {
.as_str(),
"https://cyclops.example:8443/api/k8s/apis/osgym.cua.ai/v1alpha1/namespaces/example-pool/osgymsandboxclaims/example-claim"
);
+ assert_eq!(
+ template_collection(&base, "example-pool").unwrap().as_str(),
+ "https://cyclops.example:8443/api/k8s/apis/osgym.cua.ai/v1alpha1/namespaces/example-pool/osgymsandboxtemplates"
+ );
+ assert_eq!(
+ template_item(&base, "example-pool", "example-template")
+ .unwrap()
+ .as_str(),
+ "https://cyclops.example:8443/api/k8s/apis/osgym.cua.ai/v1alpha1/namespaces/example-pool/osgymsandboxtemplates/example-template"
+ );
}
#[test]
@@ -267,13 +295,13 @@ mod tests {
assert_eq!(
pool_collection(&base, "example-pool").unwrap().as_str(),
- "https://gateway.example/cyclops/api/k8s/apis/cua.ai/v1/namespaces/example-pool/osgymworkspacepools"
+ "https://gateway.example/cyclops/api/k8s/apis/osgym.cua.ai/v1alpha1/namespaces/example-pool/osgymsandboxwarmpools"
);
assert_eq!(
pool_item(&base, "example-pool", "example-pool")
.unwrap()
.as_str(),
- "https://gateway.example/cyclops/api/k8s/apis/cua.ai/v1/namespaces/example-pool/osgymworkspacepools/example-pool"
+ "https://gateway.example/cyclops/api/k8s/apis/osgym.cua.ai/v1alpha1/namespaces/example-pool/osgymsandboxwarmpools/example-pool"
);
assert_eq!(
namespace_collection(&base).unwrap().as_str(),
diff --git a/libs/fleet/sdk/src/templates.rs b/libs/fleet/sdk/src/templates.rs
new file mode 100644
index 0000000000..e37ba42256
--- /dev/null
+++ b/libs/fleet/sdk/src/templates.rs
@@ -0,0 +1,152 @@
+use crate::{
+ CreateTemplateRequest, CyclopsClient, HttpHeader, HttpRequest, SdkError, Template, routes,
+ types::ResourceMetadata,
+};
+use serde::Serialize;
+use std::sync::Arc;
+use url::Url;
+
+const JSON_CONTENT_TYPE: &str = "application/json";
+
+#[derive(serde::Deserialize)]
+struct ResourceList<T> {
+ items: Vec<T>,
+}
+
+#[uniffi::export]
+impl CyclopsClient {
+ pub async fn create_template(
+ self: Arc<Self>,
+ request: CreateTemplateRequest,
+ ) -> Result<Template, SdkError> {
+ let collection_url = routes::template_collection(self.base_url(), &request.namespace)?;
+ let template = Template {
+ api_version: "osgym.cua.ai/v1alpha1".into(),
+ kind: "OSGymSandboxTemplate".into(),
+ metadata: ResourceMetadata {
+ namespace: request.namespace,
+ name: request.name,
+ labels: None,
+ },
+ spec: request.spec,
+ };
+ routes::template_item(
+ self.base_url(),
+ &template.metadata.namespace,
+ &template.metadata.name,
+ )?;
+ self.send_json_crud(
+ "create template",
+ json_request("POST", collection_url, Some(to_json(&template)?)),
+ &[200, 201, 202],
+ )
+ .await
+ }
+
+ pub async fn list_templates(
+ self: Arc<Self>,
+ namespace: String,
+ ) -> Result<Vec<Template>, SdkError> {
+ let collection_url = routes::template_collection(self.base_url(), &namespace)?;
+ let list: ResourceList<Template> = self
+ .send_json_crud(
+ "list templates",
+ json_request("GET", collection_url, None),
+ &[200],
+ )
+ .await?;
+ Ok(list.items)
+ }
+
+ pub async fn get_template(
+ self: Arc<Self>,
+ namespace: String,
+ name: String,
+ ) -> Result<Template, SdkError> {
+ let item_url = routes::template_item(self.base_url(), &namespace, &name)?;
+ self.send_json_crud("get template", json_request("GET", item_url, None), &[200])
+ .await
+ }
+
+ pub async fn reconcile_template(
+ self: Arc<Self>,
+ request: CreateTemplateRequest,
+ ) -> Result<Template, SdkError> {
+ match self
+ .clone()
+ .get_template(request.namespace.clone(), request.name.clone())
+ .await
+ {
+ Ok(mut template) => {
+ template.spec = request.spec;
+ self.update_template(template).await
+ }
+ Err(SdkError::Status {
+ status: 403 | 404, ..
+ }) => self.create_template(request).await,
+ Err(error) => Err(error),
+ }
+ }
+
+ pub async fn update_template(
+ self: Arc<Self>,
+ template: Template,
+ ) -> Result<Template, SdkError> {
+ let item_url = routes::template_item(
+ self.base_url(),
+ &template.metadata.namespace,
+ &template.metadata.name,
+ )?;
+ let body = to_json(&template)?;
+ self.send_json_crud(
+ "update template",
+ merge_patch_request(item_url, Some(body)),
+ &[200],
+ )
+ .await
+ }
+
+ pub async fn delete_template(self: Arc<Self>, template: Template) -> Result<(), SdkError> {
+ let item_url = routes::template_item(
+ self.base_url(),
+ &template.metadata.namespace,
+ &template.metadata.name,
+ )?;
+ self.send_unit_crud(
+ "delete template",
+ json_request("DELETE", item_url, None),
+ &[200, 202, 204, 404],
+ )
+ .await
+ }
+}
+
+fn merge_patch_request(url: Url, body: Option<Vec<u8>>) -> HttpRequest {
+ let mut request = json_request("PATCH", url, body);
+ request.headers[1].value = "application/merge-patch+json".into();
+ request
+}
+
+fn json_request(method: &str, url: Url, body: Option<Vec<u8>>) -> HttpRequest {
+ HttpRequest {
+ method: method.into(),
+ url: url.into(),
+ headers: vec![
+ HttpHeader {
+ name: "accept".into(),
+ value: JSON_CONTENT_TYPE.into(),
+ },
+ HttpHeader {
+ name: "content-type".into(),
+ value: JSON_CONTENT_TYPE.into(),
+ },
+ ],
+ body,
+ }
+}
+
+fn to_json<T: Serialize>(value: &T) -> Result<Vec<u8>, SdkError> {
+ serde_json::to_vec(value).map_err(|error| SdkError::Body {
+ reason: error.to_string(),
+ })
+}
diff --git a/libs/fleet/sdk/src/types.rs b/libs/fleet/sdk/src/types.rs
index 6951ef33ec..5a0664ee00 100644
--- a/libs/fleet/sdk/src/types.rs
+++ b/libs/fleet/sdk/src/types.rs
@@ -1,4 +1,7 @@
-use cyclops_sdk_schema::{ClaimSpec, OSGymSandboxClaimStatus, OSGymWorkspacePoolStatus, PoolSpec};
+use cyclops_sdk_schema::{
+ ClaimSpec, OSGymSandboxClaimStatus, OSGymSandboxTemplateSpec, OSGymSandboxWarmPoolSpec,
+ OSGymSandboxWarmPoolStatus,
+};
use serde::{Deserialize, Serialize};
use std::{collections::HashMap, fmt, sync::Arc};
@@ -84,15 +87,20 @@ pub struct ResourceMetadata {
}
/// UniFFI cannot emit aliases for external record types. Generated bindings use
-/// `OSGymWorkspacePoolStatus` and `OSGymSandboxClaimStatus` from cyclops_sdk_schema.
+/// `OSGymSandboxWarmPoolStatus` and `OSGymSandboxClaimStatus` from cyclops_sdk_schema.
+///
+/// A `Pool` is the `osgym.cua.ai/v1alpha1 OSGymSandboxWarmPool` CR verbatim —
+/// the SDK is a naive CRUD mapper over the native CRDs, with no translation
+/// layer (the legacy `cua.ai/v1 OSGymWorkspacePool` and its operator compat
+/// shim are gone).
#[derive(Clone, Debug, Serialize, Deserialize, uniffi::Record)]
#[serde(rename_all = "camelCase")]
pub struct Pool {
pub api_version: String,
pub kind: String,
pub metadata: ResourceMetadata,
- pub spec: PoolSpec,
- pub status: Option<OSGymWorkspacePoolStatus>,
+ pub spec: OSGymSandboxWarmPoolSpec,
+ pub status: Option<OSGymSandboxWarmPoolStatus>,
}
impl PartialEq for Pool {
@@ -136,7 +144,7 @@ pub struct Sandbox {
#[derive(Clone, Debug, Serialize, Deserialize, uniffi::Record)]
pub struct CreatePoolRequest {
pub namespace: String,
- pub spec: PoolSpec,
+ pub spec: OSGymSandboxWarmPoolSpec,
}
impl PartialEq for CreatePoolRequest {
@@ -145,6 +153,41 @@ impl PartialEq for CreatePoolRequest {
}
}
+/// The `osgym.cua.ai/v1alpha1 OSGymSandboxTemplate` CR verbatim. Warm pools
+/// and claims reference one by name via `spec.sandboxTemplateRef.name`.
+#[derive(Clone, Debug, Serialize, Deserialize, uniffi::Record)]
+#[serde(rename_all = "camelCase")]
+pub struct Template {
+ pub api_version: String,
+ pub kind: String,
+ pub metadata: ResourceMetadata,
+ pub spec: OSGymSandboxTemplateSpec,
+}
+
+impl PartialEq for Template {
+ fn eq(&self, other: &Self) -> bool {
+ self.api_version == other.api_version
+ && self.kind == other.kind
+ && self.metadata == other.metadata
+ && schema_values_equal(&self.spec, &other.spec)
+ }
+}
+
+#[derive(Clone, Debug, Serialize, Deserialize, uniffi::Record)]
+pub struct CreateTemplateRequest {
+ pub namespace: String,
+ pub name: String,
+ pub spec: OSGymSandboxTemplateSpec,
+}
+
+impl PartialEq for CreateTemplateRequest {
+ fn eq(&self, other: &Self) -> bool {
+ self.namespace == other.namespace
+ && self.name == other.name
+ && schema_values_equal(&self.spec, &other.spec)
+ }
+}
+
#[derive(Clone, Debug, Serialize, Deserialize, uniffi::Record)]
pub struct CreateClaimRequest {
pub pool: Pool,
diff --git a/libs/fleet/sdk/tests/claim_flow.rs b/libs/fleet/sdk/tests/claim_flow.rs
index c83fe4b896..cbecf58a9b 100644
--- a/libs/fleet/sdk/tests/claim_flow.rs
+++ b/libs/fleet/sdk/tests/claim_flow.rs
@@ -2,7 +2,7 @@ mod support;
use cyclops_sdk::{
Claim, CreateClaimRequest, CyclopsClient, CyclopsConfiguration, CyclopsCredentials, HttpHeader,
- HttpResponse, Pool, ResourceMetadata, SdkError,
+ HttpResponse, Pool, ResourceMetadata, SdkError, Template,
};
use cyclops_sdk_schema::ClaimSpec;
use std::sync::Arc;
@@ -12,13 +12,13 @@ const BASE_URL: &str = "https://cyclops.example:8443/prefix";
const TOKEN_URL: &str = "https://identity.example/oauth/token";
const NAMESPACE: &str = "example-pool";
const CLAIM_COLLECTION: &str = "https://cyclops.example:8443/prefix/api/k8s/apis/osgym.cua.ai/v1alpha1/namespaces/example-pool/osgymsandboxclaims";
-const POOL_ITEM: &str = "https://cyclops.example:8443/prefix/api/k8s/apis/cua.ai/v1/namespaces/example-pool/osgymworkspacepools/example-pool";
+const TEMPLATE_ITEM: &str = "https://cyclops.example:8443/prefix/api/k8s/apis/osgym.cua.ai/v1alpha1/namespaces/example-pool/osgymsandboxtemplates/example-pool-template";
#[tokio::test]
async fn creates_pending_demand_immediately_for_a_nonzero_unavailable_pool() {
let spec = claim_spec("explicit-template");
let created = claim("claim-1", spec.clone(), None);
- let mut unavailable_pool = pool(1, None);
+ let mut unavailable_pool = pool(1);
unavailable_pool.status = Some(
serde_json::from_value(serde_json::json!({ "availableCount": 0, "phase": "Pending" }))
.unwrap(),
@@ -60,7 +60,7 @@ async fn zero_and_nonzero_pools_post_claims_with_identical_sequencing() {
client(Arc::clone(&http), 2, 2)
.create_claim(CreateClaimRequest {
- pool: pool(replicas, None),
+ pool: pool(replicas),
spec: None,
})
.await
@@ -120,7 +120,10 @@ async fn wait_claim_returns_bound_sandbox_with_sorted_deduplicated_pool_services
let http = Arc::new(ScriptedHttpClient::new([
Ok(token()),
Ok(json_response(200, &current)),
- Ok(json_response(200, &pool(1, Some(vec!["z", "a", "z"])))),
+ Ok(json_response(
+ 200,
+ &template_named("example-pool-template", Some(vec!["z", "a", "z"])),
+ )),
]));
let client = client(Arc::clone(&http), 1, 2);
@@ -141,7 +144,7 @@ async fn wait_claim_returns_bound_sandbox_with_sorted_deduplicated_pool_services
&format!("{CLAIM_COLLECTION}/named-claim"),
None,
);
- assert_request(&requests[1], "GET", POOL_ITEM, None);
+ assert_request(&requests[1], "GET", TEMPLATE_ITEM, None);
}
#[tokio::test]
@@ -179,7 +182,7 @@ async fn wait_claim_reports_terminal_and_timeout_statuses() {
#[tokio::test]
async fn generated_claim_names_are_unique_under_concurrency_and_fit_dns_labels() {
let pool_name = "a".repeat(63);
- let pool = pool_named(&pool_name, 0, None);
+ let pool = pool_named(&pool_name, 0);
let first = claim("placeholder", claim_spec("short-template"), None);
let second = first.clone();
let http = Arc::new(ScriptedHttpClient::new([
@@ -226,9 +229,9 @@ async fn validation_and_malformed_responses_fail_without_unexpected_http() {
let invalid_pool = Pool {
metadata: ResourceMetadata {
namespace: "Uppercase".into(),
- ..pool(0, None).metadata
+ ..pool(0).metadata
},
- ..pool(0, None)
+ ..pool(0)
};
assert!(matches!(
client(Arc::clone(&invalid_http), 1, 1)
@@ -286,32 +289,50 @@ fn client(http: Arc<ScriptedHttpClient>, pool_limit: u32, claim_limit: u32) -> A
.unwrap()
}
-fn pool(replicas: u32, services: Option<Vec<&str>>) -> Pool {
- pool_named(NAMESPACE, replicas, services)
+fn pool(replicas: u32) -> Pool {
+ pool_named(NAMESPACE, replicas)
+}
+
+fn pool_named(name: &str, replicas: u32) -> Pool {
+ Pool {
+ api_version: "osgym.cua.ai/v1alpha1".into(),
+ kind: "OSGymSandboxWarmPool".into(),
+ metadata: ResourceMetadata {
+ namespace: name.into(),
+ name: name.into(),
+ labels: None,
+ },
+ spec: serde_json::from_value(serde_json::json!({
+ "replicas": replicas,
+ "sandboxTemplateRef": { "name": format!("{name}-template") },
+ }))
+ .unwrap(),
+ status: None,
+ }
}
-fn pool_named(name: &str, replicas: u32, services: Option<Vec<&str>>) -> Pool {
+fn template_named(name: &str, services: Option<Vec<&str>>) -> Template {
let services = services.map(|services| {
services
.into_iter()
.map(|name| serde_json::json!({ "name": name, "targetPort": 8080 }))
.collect::<Vec<_>>()
});
- Pool {
- api_version: "cua.ai/v1".into(),
- kind: "OSGymWorkspacePool".into(),
+ Template {
+ api_version: "osgym.cua.ai/v1alpha1".into(),
+ kind: "OSGymSandboxTemplate".into(),
metadata: ResourceMetadata {
- namespace: name.into(),
+ namespace: NAMESPACE.into(),
name: name.into(),
labels: None,
},
spec: serde_json::from_value(serde_json::json!({
- "replicas": replicas,
- "template": { "containerDiskImage": "registry.example/image:latest" },
- "services": services,
+ "vmTemplate": {
+ "containerDiskImage": "registry.example/image:latest",
+ "services": services,
+ },
}))
.unwrap(),
- status: None,
}
}
@@ -382,7 +403,7 @@ fn assert_request(
async fn default_template_ref_for_a_63_byte_pool_passes_through_without_dns_validation() {
let pool_name = "a".repeat(63);
let template_name = format!("{pool_name}-template");
- let pool = pool_named(&pool_name, 0, None);
+ let pool = pool_named(&pool_name, 0);
let http = Arc::new(ScriptedHttpClient::new([
Ok(token()),
Ok(json_response(
@@ -415,7 +436,7 @@ async fn explicit_non_dns_template_ref_passes_through_but_empty_ref_is_rejected_
]));
client(Arc::clone(&http), 1, 1)
.create_claim(CreateClaimRequest {
- pool: pool(0, None),
+ pool: pool(0),
spec: Some(claim_spec(template_name)),
})
.await
@@ -429,7 +450,7 @@ async fn explicit_non_dns_template_ref_passes_through_but_empty_ref_is_rejected_
assert!(matches!(
client(Arc::clone(&empty_http), 1, 1)
.create_claim(CreateClaimRequest {
- pool: pool(0, None),
+ pool: pool(0),
spec: Some(claim_spec("")),
})
.await,
@@ -439,7 +460,7 @@ async fn explicit_non_dns_template_ref_passes_through_but_empty_ref_is_rejected_
}
#[tokio::test]
-async fn wait_claim_uses_controller_removesuffix_behavior_for_template_refs_without_suffixes() {
+async fn wait_claim_fetches_the_template_named_by_the_claim_ref_verbatim() {
let current = claim(
"named-claim",
claim_spec("example-pool"),
@@ -451,7 +472,10 @@ async fn wait_claim_uses_controller_removesuffix_behavior_for_template_refs_with
let http = Arc::new(ScriptedHttpClient::new([
Ok(token()),
Ok(json_response(200, &current)),
- Ok(json_response(200, &pool(1, Some(vec!["shell"])))),
+ Ok(json_response(
+ 200,
+ &template_named("example-pool", Some(vec!["shell"])),
+ )),
]));
assert_eq!(
@@ -469,7 +493,12 @@ async fn wait_claim_uses_controller_removesuffix_behavior_for_template_refs_with
&format!("{CLAIM_COLLECTION}/named-claim"),
None,
);
- assert_request(&requests[1], "GET", POOL_ITEM, None);
+ assert_request(
+ &requests[1],
+ "GET",
+ "https://cyclops.example:8443/prefix/api/k8s/apis/osgym.cua.ai/v1alpha1/namespaces/example-pool/osgymsandboxtemplates/example-pool",
+ None,
+ );
}
#[tokio::test]
diff --git a/libs/fleet/sdk/tests/pool_flow.rs b/libs/fleet/sdk/tests/pool_flow.rs
index 8273c03714..0c0ff8d23e 100644
--- a/libs/fleet/sdk/tests/pool_flow.rs
+++ b/libs/fleet/sdk/tests/pool_flow.rs
@@ -4,7 +4,7 @@ use cyclops_sdk::{
CreatePoolRequest, CyclopsClient, CyclopsConfiguration, CyclopsCredentials, HttpHeader,
HttpResponse, Pool, ResourceMetadata, SdkError,
};
-use cyclops_sdk_schema::PoolSpec;
+use cyclops_sdk_schema::OSGymSandboxWarmPoolSpec;
use futures_timer::Delay;
use std::{sync::Arc, time::Duration};
use support::ScriptedHttpClient;
@@ -12,8 +12,8 @@ use support::ScriptedHttpClient;
const BASE_URL: &str = "https://cyclops.example:8443";
const TOKEN_URL: &str = "https://identity.example/oauth/token";
const NAMESPACE: &str = "example-pool";
-const COLLECTION: &str = "https://cyclops.example:8443/api/k8s/apis/cua.ai/v1/namespaces/example-pool/osgymworkspacepools";
-const ITEM: &str = "https://cyclops.example:8443/api/k8s/apis/cua.ai/v1/namespaces/example-pool/osgymworkspacepools/example-pool";
+const COLLECTION: &str = "https://cyclops.example:8443/api/k8s/apis/osgym.cua.ai/v1alpha1/namespaces/example-pool/osgymsandboxwarmpools";
+const ITEM: &str = "https://cyclops.example:8443/api/k8s/apis/osgym.cua.ai/v1alpha1/namespaces/example-pool/osgymsandboxwarmpools/example-pool";
const NAMESPACE_COLLECTION: &str = "https://cyclops.example:8443/api/namespaces";
const NAMESPACE_ITEM: &str = "https://cyclops.example:8443/api/namespaces/example-pool";
@@ -295,7 +295,7 @@ async fn creates_for_different_namespaces_proceed_concurrently() {
assert_eq!(second_pool, pool_named(OTHER_NAMESPACE));
let other_collection = format!(
- "https://cyclops.example:8443/api/k8s/apis/cua.ai/v1/namespaces/{OTHER_NAMESPACE}/osgymworkspacepools"
+ "https://cyclops.example:8443/api/k8s/apis/osgym.cua.ai/v1alpha1/namespaces/{OTHER_NAMESPACE}/osgymsandboxwarmpools"
);
let requests = resource_requests(&http).await;
assert_eq!(requests.len(), 3);
@@ -376,7 +376,7 @@ async fn gets_named_pool_and_updates_typed_pools() {
let updated = Pool {
spec: serde_json::from_value(serde_json::json!({
"replicas": 2,
- "template": { "containerDiskImage": "registry.example/updated:latest" },
+ "sandboxTemplateRef": { "name": "example-pool-template" },
}))
.unwrap(),
..pool()
@@ -408,7 +408,7 @@ async fn reconcile_updates_an_existing_named_pool() {
let updated = Pool {
spec: serde_json::from_value(serde_json::json!({
"replicas": 2,
- "template": { "containerDiskImage": "registry.example/updated:latest" },
+ "sandboxTemplateRef": { "name": "example-pool-template" },
}))
.unwrap(),
..pool()
@@ -752,8 +752,8 @@ fn pool() -> Pool {
fn pool_named(namespace: &str) -> Pool {
Pool {
- api_version: "cua.ai/v1".into(),
- kind: "OSGymWorkspacePool".into(),
+ api_version: "osgym.cua.ai/v1alpha1".into(),
+ kind: "OSGymSandboxWarmPool".into(),
metadata: ResourceMetadata {
namespace: namespace.into(),
name: namespace.into(),
@@ -764,10 +764,10 @@ fn pool_named(namespace: &str) -> Pool {
}
}
-fn pool_spec() -> PoolSpec {
+fn pool_spec() -> OSGymSandboxWarmPoolSpec {
serde_json::from_value(serde_json::json!({
"replicas": 1,
- "template": { "containerDiskImage": "registry.example/image:latest" },
+ "sandboxTemplateRef": { "name": "example-pool-template" },
}))
.unwrap()
}
diff --git a/libs/fleet/sdk/tests/public_api.rs b/libs/fleet/sdk/tests/public_api.rs
index acfc56cc62..d2fe51a72b 100644
--- a/libs/fleet/sdk/tests/public_api.rs
+++ b/libs/fleet/sdk/tests/public_api.rs
@@ -5,7 +5,9 @@ use cyclops_sdk::{
CyclopsCredentials, HttpClient, HttpError, HttpHeader, HttpRequest, HttpResponse, Pool,
ResourceMetadata, Sandbox, SdkError,
};
-use cyclops_sdk_schema::{ClaimSpec, OSGymSandboxClaimStatus, OSGymWorkspacePoolStatus, PoolSpec};
+use cyclops_sdk_schema::{
+ ClaimSpec, OSGymSandboxClaimStatus, OSGymSandboxWarmPoolSpec, OSGymSandboxWarmPoolStatus,
+};
struct RecordingHttpClient;
@@ -45,10 +47,10 @@ fn configuration() -> CyclopsConfiguration {
}
}
-fn pool_spec() -> PoolSpec {
+fn pool_spec() -> OSGymSandboxWarmPoolSpec {
serde_json::from_value(serde_json::json!({
"replicas": 1,
- "template": { "containerDiskImage": "registry.example/image:latest" },
+ "sandboxTemplateRef": { "name": "pool-template" },
}))
.unwrap()
}
@@ -62,8 +64,8 @@ fn claim_spec() -> ClaimSpec {
fn pool() -> Pool {
Pool {
- api_version: "cua.ai/v1".into(),
- kind: "OSGymWorkspacePool".into(),
+ api_version: "osgym.cua.ai/v1alpha1".into(),
+ kind: "OSGymSandboxWarmPool".into(),
metadata: ResourceMetadata {
namespace: "default".into(),
name: "pool".into(),
@@ -205,12 +207,12 @@ fn resources_use_canonical_schema_specs_and_statuses() {
};
assert_eq!(metadata.namespace, "default");
- fn pool_status(_: Option<OSGymWorkspacePoolStatus>) {}
+ fn pool_status(_: Option<OSGymSandboxWarmPoolStatus>) {}
fn claim_status(_: Option<OSGymSandboxClaimStatus>) {}
fn assert_pool_types(pool: Pool) {
let Pool { spec, status, .. } = pool;
- let _: PoolSpec = spec;
+ let _: OSGymSandboxWarmPoolSpec = spec;
pool_status(status);
}
@@ -223,7 +225,7 @@ fn resources_use_canonical_schema_specs_and_statuses() {
fn assert_create_pool_request(request: CreatePoolRequest) {
let CreatePoolRequest { namespace, spec } = request;
let _: String = namespace;
- let _: PoolSpec = spec;
+ let _: OSGymSandboxWarmPoolSpec = spec;
}
fn assert_create_claim_request(request: CreateClaimRequest) {
@@ -263,7 +265,7 @@ fn resources_support_equality_and_kubernetes_camel_case_json() {
assert_eq!(create_claim, create_claim.clone());
let pool_json = serde_json::to_value(pool).unwrap();
- assert_eq!(pool_json["apiVersion"], "cua.ai/v1");
+ assert_eq!(pool_json["apiVersion"], "osgym.cua.ai/v1alpha1");
assert!(pool_json.get("api_version").is_none());
let claim_json = serde_json::to_value(claim).unwrap();
assert_eq!(claim_json["apiVersion"], "osgym.cua.ai/v1alpha1");
diff --git a/libs/fleet/terraform-provider-fleets/MIGRATION.md b/libs/fleet/terraform-provider-fleets/MIGRATION.md
index 40c77cd40d..dc83632906 100644
--- a/libs/fleet/terraform-provider-fleets/MIGRATION.md
+++ b/libs/fleet/terraform-provider-fleets/MIGRATION.md
@@ -1,8 +1,13 @@
# Migrating from the Cyclops provider
`trycua/fleets` is the public Terraform Registry provider. The Cloud service
-APIs, OAuth environment variables, and `OSGymWorkspacePool` CRD remain
-unchanged.
+APIs and OAuth environment variables remain unchanged. `fleets_pool` now backs
+each pool with the native `osgym.cua.ai/v1alpha1` CRDs — an
+`OSGymSandboxWarmPool` and the `OSGymSandboxTemplate` it references — in place
+of the removed legacy pool CRD. The resource arguments are unchanged; the
+`phase`, `total_count`, `available_count`, and `claimed_count` attributes it
+used to export are replaced by `template_name`, `current_replicas`, and
+`ready_replicas`.
| Previous surface | Fleets surface | Migration |
| --- | --- | --- |
diff --git a/libs/fleet/terraform-provider-fleets/README.md b/libs/fleet/terraform-provider-fleets/README.md
index 61949447eb..9dd2fc43ec 100644
--- a/libs/fleet/terraform-provider-fleets/README.md
+++ b/libs/fleet/terraform-provider-fleets/README.md
@@ -1,6 +1,6 @@
# Terraform Provider for Cua Fleets
-This provider manages `OSGymWorkspacePool` resources through the Fleet API. It uses the same user-key OAuth credentials and tenant-scoped authorization as the Fleet Python SDK and dashboard.
+This provider manages `OSGymSandboxWarmPool` and `OSGymSandboxTemplate` resources through the Fleet API. It uses the same user-key OAuth credentials and tenant-scoped authorization as the Fleet Python SDK and dashboard.
## Temporary local installation (until Registry publication)
@@ -113,7 +113,7 @@ public Registry, and `terraform providers` should list
```bash
native="$(../scripts/build-sdk-bindings-native.sh)"
native_dir="$(dirname "$native")"
-export CGO_CFLAGS="-I../sdk-bindings/go-uniffi/cyclops_sdk -I../sdk-bindings/go-uniffi/cyclops_sdk_schema"
+export CGO_CFLAGS="-I../sdk-bindings/go-uniffi/fleet_sdk -I../sdk-bindings/go-uniffi/cyclops_sdk_schema"
export CGO_LDFLAGS="-L$native_dir -lcyclops_sdk -Wl,-rpath,$native_dir"
export LD_LIBRARY_PATH="$native_dir${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"
@@ -125,7 +125,7 @@ KUBEBUILDER_ASSETS="$(go run sigs.k8s.io/controller-runtime/tools/setup-envtest@
TF_ACC=1 go test -tags=acceptance ./internal/provider -run TestAccPoolLifecycle -v
```
-The provider source address is `trycua/fleets`. A pool owns the same-named Fleet namespace: create bootstraps the namespace, and destroy deletes the pool followed by that namespace.
+The provider source address is `trycua/fleets`. One `fleets_pool` is a pair of native CRs in the same namespace: an `OSGymSandboxWarmPool` named after the pool and the `OSGymSandboxTemplate` it references, named `<pool>-template`. A pool owns the same-named Fleet namespace: creating the warm pool bootstraps the namespace before the template is written into it, and destroy deletes the template, then the pool, then that namespace.
## Authentication
@@ -143,8 +143,8 @@ All provider arguments support environment variables:
The Terraform models, schema, CRD-derived descriptions, enum validators, numeric validators, and nested object types are generated deterministically from:
-- `clusters/base/osgym/crd.yaml`, the production `OSGymWorkspacePool` CRD
-- `internal/provider/generate/pool_mapping.json`, the explicit CRD-to-Terraform shape mapping
+- `clusters/base/osgym/crd.yaml`, the production CRD bundle; the generator reads the `v1alpha1` schemas of `osgymsandboxwarmpools.osgym.cua.ai` and `osgymsandboxtemplates.osgym.cua.ai`
+- `internal/provider/generate/pool_mapping.json`, the explicit CRD-to-Terraform shape mapping. Every mapped attribute names the CR it lives in with `"cr": "warmpool"` or `"cr": "template"`
Run:
diff --git a/libs/fleet/terraform-provider-fleets/cmd/generate-pool-resource/main.go b/libs/fleet/terraform-provider-fleets/cmd/generate-pool-resource/main.go
index 73da3b8014..0992dff4b4 100644
--- a/libs/fleet/terraform-provider-fleets/cmd/generate-pool-resource/main.go
+++ b/libs/fleet/terraform-provider-fleets/cmd/generate-pool-resource/main.go
@@ -20,6 +20,7 @@ type field struct {
GoName string `json:"go_name"`
ValueType string `json:"value_type"`
Mode string `json:"mode"`
+ CR string `json:"cr"`
CRDPath string `json:"crd_path"`
Description string `json:"description"`
DNSLabel bool `json:"dns_label"`
@@ -33,6 +34,7 @@ type block struct {
GoName string `json:"go_name"`
Model string `json:"model"`
Collection string `json:"collection"`
+ CR string `json:"cr"`
CRDPath string `json:"crd_path"`
Fields []field `json:"fields"`
}
@@ -51,8 +53,21 @@ type schemaInfo struct {
Maximum *int64
}
+// The flat fleets_pool resource is backed by a pair of native CRs, so every
+// mapped attribute names the one it lives in.
+const (
+ warmPoolCR = "warmpool"
+ templateCR = "template"
+ warmPoolCRDName = "osgymsandboxwarmpools.osgym.cua.ai"
+ templateCRDName = "osgymsandboxtemplates.osgym.cua.ai"
+ nativeCRDVersion = "v1alpha1"
+)
+
+// crdSchemas holds the openAPIV3Schema of each CR keyed by mapping CR name.
+type crdSchemas map[string]map[string]any
+
func main() {
- crdPath := flag.String("crd", "", "path to the OSGymWorkspacePool CRD")
+ crdPath := flag.String("crd", "", "path to the osgym.cua.ai CRD bundle")
mappingPath := flag.String("mapping", "", "path to the Terraform mapping JSON")
outputPath := flag.String("out", "", "generated Go output path")
flag.Parse()
@@ -62,12 +77,12 @@ func main() {
var config mapping
readJSON(*mappingPath, &config)
- root := readCRDSchema(*crdPath)
- validateMapping(root, config)
+ schemas := readCRDSchemas(*crdPath)
+ validateMapping(schemas, config)
- generated, err := format.Source(render(root, config))
+ generated, err := format.Source(render(schemas, config))
if err != nil {
- fatalf("format generated source: %v\n%s", err, render(root, config))
+ fatalf("format generated source: %v\n%s", err, render(schemas, config))
}
if err := os.WriteFile(*outputPath, generated, 0o644); err != nil {
fatalf("write generated source: %v", err)
@@ -84,11 +99,13 @@ func readJSON(path string, target any) {
}
}
-func readCRDSchema(path string) map[string]any {
+func readCRDSchemas(path string) crdSchemas {
data, err := os.ReadFile(path)
if err != nil {
- fatalf("read CRD: %v", err)
+ fatalf("read CRD bundle: %v", err)
}
+ wanted := map[string]string{warmPoolCRDName: warmPoolCR, templateCRDName: templateCR}
+ schemas := crdSchemas{}
decoder := yamlv3.NewDecoder(bytes.NewReader(data))
for {
var document map[string]any
@@ -96,25 +113,70 @@ func readCRDSchema(path string) map[string]any {
if err == io.EOF {
break
}
- fatalf("decode CRD: %v", err)
+ fatalf("decode CRD bundle: %v", err)
}
metadata, _ := document["metadata"].(map[string]any)
- if metadata["name"] != "osgymworkspacepools.cua.ai" {
+ name, _ := metadata["name"].(string)
+ cr, ok := wanted[name]
+ if !ok {
continue
}
versions := mustSlice(mustMap(document["spec"], "spec")["versions"], "spec.versions")
for _, rawVersion := range versions {
version := mustMap(rawVersion, "version")
- if version["name"] == "v1" {
- return mustMap(mustMap(version["schema"], "schema")["openAPIV3Schema"], "openAPIV3Schema")
+ if version["name"] == nativeCRDVersion {
+ schemas[cr] = mustMap(mustMap(version["schema"], "schema")["openAPIV3Schema"], "openAPIV3Schema")
}
}
+ if schemas[cr] == nil {
+ fatalf("%s has no %s schema", name, nativeCRDVersion)
+ }
}
- fatalf("OSGymWorkspacePool CRD has no v1 schema")
- return nil
+ for name, cr := range wanted {
+ if schemas[cr] == nil {
+ fatalf("CRD bundle has no %s", name)
+ }
+ }
+ return schemas
}
-func validateMapping(root map[string]any, config mapping) {
+// attributeSchema resolves the CRD node an attribute maps to. Attributes with
+// no crd_path (Terraform-only fields such as id) resolve to a nil node, which
+// inspect reads as "no CRD metadata".
+func (s crdSchemas) attributeSchema(item field) map[string]any {
+ if item.CRDPath == "" {
+ return nil
+ }
+ return lookup(s.root(item.CR, item.Name), item.CRDPath)
+}
+
+// nestedSchema resolves a block field against the block's own CRD node.
+func nestedSchema(blockSchema map[string]any, item field) map[string]any {
+ if item.CRDPath == "" {
+ return nil
+ }
+ return lookup(blockSchema, item.CRDPath)
+}
+
+// blockSchema resolves the CRD node holding a block's nested fields: the object
+// itself for a single block, its items for a set.
+func (s crdSchemas) blockSchema(item block) map[string]any {
+ node := lookup(s.root(item.CR, item.Name), item.CRDPath)
+ if item.Collection == "set" {
+ return mustMap(node["items"], item.CRDPath+".items")
+ }
+ return node
+}
+
+func (s crdSchemas) root(cr, name string) map[string]any {
+ root, ok := s[cr]
+ if !ok {
+ fatalf("%q maps to unsupported cr %q", name, cr)
+ }
+ return root
+}
+
+func validateMapping(schemas crdSchemas, config mapping) {
seenNames := map[string]bool{}
seenGoNames := map[string]bool{}
registerTopLevel := func(name, goName string) {
@@ -131,7 +193,7 @@ func validateMapping(root map[string]any, config mapping) {
for _, item := range config.Attributes {
validateFieldConfig(item)
registerTopLevel(item.Name, item.GoName)
- validateField(root, item, item.CRDPath)
+ validateField(schemas.attributeSchema(item), item)
}
for _, item := range config.Blocks {
registerTopLevel(item.Name, item.GoName)
@@ -139,22 +201,23 @@ func validateMapping(root map[string]any, config mapping) {
fatalf("block %q has unsupported collection %q", item.Name, item.Collection)
}
- blockSchema := lookup(root, item.CRDPath)
expectedType := "object"
if item.Collection == "set" {
expectedType = "array"
}
- if actual, _ := blockSchema["type"].(string); actual != expectedType {
+ node := lookup(schemas.root(item.CR, item.Name), item.CRDPath)
+ if actual, _ := node["type"].(string); actual != expectedType {
fatalf("block %s maps to CRD type %q, expected %q", item.Name, actual, expectedType)
}
- if item.Collection == "set" {
- blockSchema = mustMap(blockSchema["items"], item.CRDPath+".items")
- }
+ blockSchema := schemas.blockSchema(item)
seenNestedNames := map[string]bool{}
seenNestedGoNames := map[string]bool{}
for _, nested := range item.Fields {
validateFieldConfig(nested)
+ if nested.CR != "" {
+ fatalf("field %q in block %q must not set cr; it is resolved inside %q", nested.Name, item.Name, item.CR)
+ }
if seenNestedNames[nested.Name] {
fatalf("duplicate Terraform field %q in block %q", nested.Name, item.Name)
}
@@ -163,7 +226,7 @@ func validateMapping(root map[string]any, config mapping) {
fatalf("duplicate Go field %q in block %q", nested.GoName, item.Name)
}
seenNestedGoNames[nested.GoName] = true
- validateField(blockSchema, nested, nested.CRDPath)
+ validateField(nestedSchema(blockSchema, nested), nested)
}
}
}
@@ -184,11 +247,11 @@ func validateFieldConfig(item field) {
}
}
-func validateField(root map[string]any, item field, path string) {
- if path == "" {
+func validateField(node map[string]any, item field) {
+ if node == nil {
return
}
- info := inspect(lookup(root, path))
+ info := inspect(node)
expectedType := baseType(item.ValueType)
if expectedType == "int64" {
expectedType = "integer"
@@ -201,7 +264,7 @@ func validateField(root map[string]any, item field, path string) {
}
}
-func render(root map[string]any, config mapping) []byte {
+func render(schemas crdSchemas, config mapping) []byte {
var out bytes.Buffer
out.WriteString("// Code generated by cmd/generate-pool-resource; DO NOT EDIT.\n\n")
out.WriteString("package provider\n\n")
@@ -225,21 +288,18 @@ func render(root map[string]any, config mapping) []byte {
fmt.Fprintf(&out, "func poolResourceSchema() schema.Schema {\n\treturn schema.Schema{Description: %s,\n", strconv.Quote(config.ResourceDescription))
out.WriteString("\t\tAttributes: map[string]schema.Attribute{\n")
for _, item := range config.Attributes {
- renderAttribute(&out, root, item, item.CRDPath, "\t\t\t")
+ renderAttribute(&out, schemas.attributeSchema(item), item, "\t\t\t")
}
out.WriteString("\t\t},\n\t\tBlocks: map[string]schema.Block{\n")
for _, item := range config.Blocks {
- blockSchema := lookup(root, item.CRDPath)
- if item.Collection == "set" {
- blockSchema = mustMap(blockSchema["items"], item.CRDPath+".items")
- }
+ blockSchema := schemas.blockSchema(item)
fmt.Fprintf(&out, "\t\t\t%q: schema.%sNestedBlock{", item.Name, title(item.Collection))
if item.Collection == "set" {
out.WriteString("NestedObject: schema.NestedBlockObject{")
}
out.WriteString("Attributes: map[string]schema.Attribute{\n")
for _, nested := range item.Fields {
- renderAttribute(&out, blockSchema, nested, nested.CRDPath, "\t\t\t\t")
+ renderAttribute(&out, nestedSchema(blockSchema, nested), nested, "\t\t\t\t")
}
if item.Collection == "set" {
out.WriteString("\t\t\t}}},\n")
@@ -278,10 +338,10 @@ func renderModel(out *bytes.Buffer, name string, fields []field, blocks []block)
out.WriteString("}\n\n")
}
-func renderAttribute(out *bytes.Buffer, root map[string]any, item field, path, indent string) {
+func renderAttribute(out *bytes.Buffer, node map[string]any, item field, indent string) {
info := schemaInfo{}
- if path != "" {
- info = inspect(lookup(root, path))
+ if node != nil {
+ info = inspect(node)
}
if item.Minimum != nil {
info.Minimum = item.Minimum
diff --git a/libs/fleet/terraform-provider-fleets/cmd/generate-pool-resource/main_test.go b/libs/fleet/terraform-provider-fleets/cmd/generate-pool-resource/main_test.go
index b7a64bfa80..241f4e2e04 100644
--- a/libs/fleet/terraform-provider-fleets/cmd/generate-pool-resource/main_test.go
+++ b/libs/fleet/terraform-provider-fleets/cmd/generate-pool-resource/main_test.go
@@ -32,6 +32,11 @@ func TestValidateMappingRejectsInvalidMapping(t *testing.T) {
{name: "duplicate nested Go name", scenario: "duplicate_nested_go_name", wantStderr: `duplicate Go field "Name" in block "service"`},
{name: "missing CRD path", scenario: "missing_crd_path", wantStderr: `spec.missing is not an object`},
{name: "wrong CRD type", scenario: "wrong_crd_type", wantStderr: `field replicas maps to CRD type "string", expected "integer"`},
+ {name: "unknown attribute CR", scenario: "unknown_attribute_cr", wantStderr: `"replicas" maps to unsupported cr "sandbox"`},
+ {name: "missing attribute CR", scenario: "missing_attribute_cr", wantStderr: `"replicas" maps to unsupported cr ""`},
+ {name: "unknown block CR", scenario: "unknown_block_cr", wantStderr: `"service" maps to unsupported cr "sandbox"`},
+ {name: "nested CR", scenario: "nested_cr", wantStderr: `field "name" in block "service" must not set cr`},
+ {name: "path in the other CR", scenario: "path_in_other_cr", wantStderr: `spec.vmTemplate.services is not an object`},
}
for _, test := range tests {
@@ -48,21 +53,31 @@ func TestValidateMappingRejectsInvalidMapping(t *testing.T) {
}
func TestRenderIsDeterministic(t *testing.T) {
- root, config := validationFixture("valid")
- first := render(root, config)
- second := render(root, config)
+ schemas, config := validationFixture("valid")
+ first := render(schemas, config)
+ second := render(schemas, config)
if !bytes.Equal(first, second) {
t.Fatal("render() produced different output for identical input")
}
}
+func TestReadCRDSchemasFindsBothNativeCRDs(t *testing.T) {
+ schemas := readCRDSchemas("../../../../clusters/base/osgym/crd.yaml")
+ if lookup(schemas.root(warmPoolCR, "replicas"), "spec.replicas")["type"] != "integer" {
+ t.Fatal("warm pool schema does not expose spec.replicas")
+ }
+ if lookup(schemas.root(templateCR, "container_disk_image"), "spec.vmTemplate.containerDiskImage")["type"] != "string" {
+ t.Fatal("template schema does not expose spec.vmTemplate.containerDiskImage")
+ }
+}
+
func TestValidationHelperProcess(t *testing.T) {
scenario := os.Getenv("GO_GENERATOR_VALIDATION_SCENARIO")
if scenario == "" {
return
}
- root, config := validationFixture(scenario)
- validateMapping(root, config)
+ schemas, config := validationFixture(scenario)
+ validateMapping(schemas, config)
}
func runValidationHelper(t *testing.T, scenario string) (string, error) {
@@ -73,20 +88,34 @@ func runValidationHelper(t *testing.T, scenario string) (string, error) {
return string(output), err
}
-func validationFixture(scenario string) (map[string]any, mapping) {
- root := map[string]any{
+func validationFixture(scenario string) (crdSchemas, mapping) {
+ warmPool := map[string]any{
"properties": map[string]any{
"spec": map[string]any{
"type": "object",
"properties": map[string]any{
"replicas": map[string]any{"type": "integer"},
- "services": map[string]any{
- "type": "array",
- "items": map[string]any{
- "type": "object",
- "properties": map[string]any{
- "name": map[string]any{"type": "string"},
- "targetPort": map[string]any{"type": "integer"},
+ },
+ },
+ },
+ }
+ template := map[string]any{
+ "properties": map[string]any{
+ "spec": map[string]any{
+ "type": "object",
+ "properties": map[string]any{
+ "vmTemplate": map[string]any{
+ "type": "object",
+ "properties": map[string]any{
+ "services": map[string]any{
+ "type": "array",
+ "items": map[string]any{
+ "type": "object",
+ "properties": map[string]any{
+ "name": map[string]any{"type": "string"},
+ "targetPort": map[string]any{"type": "integer"},
+ },
+ },
},
},
},
@@ -94,13 +123,15 @@ func validationFixture(scenario string) (map[string]any, mapping) {
},
},
}
+ schemas := crdSchemas{warmPoolCR: warmPool, templateCR: template}
config := mapping{
Attributes: []field{
{Name: "name", GoName: "Name", ValueType: "string", Mode: "required", RequiresReplace: true},
- {Name: "replicas", GoName: "Replicas", ValueType: "int64", Mode: "required", CRDPath: "spec.replicas"},
+ {Name: "replicas", GoName: "Replicas", ValueType: "int64", Mode: "required", CR: warmPoolCR, CRDPath: "spec.replicas"},
},
Blocks: []block{{
- Name: "service", GoName: "Services", Model: "serviceModel", Collection: "set", CRDPath: "spec.services",
+ Name: "service", GoName: "Services", Model: "serviceModel", Collection: "set",
+ CR: templateCR, CRDPath: "spec.vmTemplate.services",
Fields: []field{{Name: "name", GoName: "Name", ValueType: "string", Mode: "required", CRDPath: "name"}},
}},
}
@@ -131,9 +162,23 @@ func validationFixture(scenario string) (map[string]any, mapping) {
case "missing_crd_path":
config.Attributes[1].CRDPath = "spec.missing"
case "wrong_crd_type":
- root["properties"].(map[string]any)["spec"].(map[string]any)["properties"].(map[string]any)["replicas"].(map[string]any)["type"] = "string"
+ warmPoolSpec(warmPool)["replicas"].(map[string]any)["type"] = "string"
+ case "unknown_attribute_cr":
+ config.Attributes[1].CR = "sandbox"
+ case "missing_attribute_cr":
+ config.Attributes[1].CR = ""
+ case "unknown_block_cr":
+ config.Blocks[0].CR = "sandbox"
+ case "nested_cr":
+ config.Blocks[0].Fields[0].CR = templateCR
+ case "path_in_other_cr":
+ config.Blocks[0].CR = warmPoolCR
default:
panic("unknown validation scenario: " + scenario)
}
- return root, config
+ return schemas, config
+}
+
+func warmPoolSpec(root map[string]any) map[string]any {
+ return root["properties"].(map[string]any)["spec"].(map[string]any)["properties"].(map[string]any)
}
diff --git a/libs/fleet/terraform-provider-fleets/docs/resources/pool.md b/libs/fleet/terraform-provider-fleets/docs/resources/pool.md
index aa6b21dd46..24a53512a5 100644
--- a/libs/fleet/terraform-provider-fleets/docs/resources/pool.md
+++ b/libs/fleet/terraform-provider-fleets/docs/resources/pool.md
@@ -6,7 +6,7 @@ description: |-
# fleets_pool
-Creates an `OSGymWorkspacePool` and its same-named namespace. Destroy removes both. Import IDs are pool names.
+Creates an `OSGymSandboxWarmPool`, the `OSGymSandboxTemplate` it references (named `<pool>-template`), and their same-named namespace. Destroy removes all three. Import IDs are pool names.
```terraform
resource "fleets_pool" "linux" {
@@ -46,7 +46,7 @@ resource "fleets_pool" "linux" {
## Read-only Attributes
-`namespace`, `phase`, `total_count`, `available_count`, and `claimed_count` are populated from Fleet.
+`namespace` and `template_name` identify the objects Fleet created. `current_replicas` and `ready_replicas` are the warm pool's `status.replicas` and `status.readyReplicas`.
## Import
diff --git a/libs/fleet/terraform-provider-fleets/internal/provider/generate/pool_mapping.json b/libs/fleet/terraform-provider-fleets/internal/provider/generate/pool_mapping.json
index e5a1909162..d27aee77c3 100644
--- a/libs/fleet/terraform-provider-fleets/internal/provider/generate/pool_mapping.json
+++ b/libs/fleet/terraform-provider-fleets/internal/provider/generate/pool_mapping.json
@@ -1,5 +1,5 @@
{
- "resource_description": "A Cyclops computer-use pool. The pool name also owns its same-named namespace.",
+ "resource_description": "A Cua Fleet computer-use pool: an OSGymSandboxWarmPool and its OSGymSandboxTemplate. The pool name also owns its same-named namespace.",
"attributes": [
{
"name": "id",
@@ -27,6 +27,7 @@
"go_name": "Replicas",
"value_type": "int64",
"mode": "required",
+ "cr": "warmpool",
"crd_path": "spec.replicas"
},
{
@@ -34,28 +35,32 @@
"go_name": "CPUCores",
"value_type": "int64",
"mode": "required",
- "crd_path": "spec.template.cpuCores"
+ "cr": "template",
+ "crd_path": "spec.vmTemplate.cpuCores"
},
{
"name": "memory",
"go_name": "Memory",
"value_type": "string",
"mode": "required",
- "crd_path": "spec.template.memory"
+ "cr": "template",
+ "crd_path": "spec.vmTemplate.memory"
},
{
"name": "container_disk_image",
"go_name": "ContainerDiskImage",
"value_type": "string",
"mode": "required",
- "crd_path": "spec.template.containerDiskImage"
+ "cr": "template",
+ "crd_path": "spec.vmTemplate.containerDiskImage"
},
{
"name": "image_pull_secret",
"go_name": "ImagePullSecret",
"value_type": "string",
"mode": "optional_computed",
- "crd_path": "spec.template.imagePullSecret",
+ "cr": "template",
+ "crd_path": "spec.vmTemplate.imagePullSecret",
"description": "Kubernetes image pull secret. Defaults to ecr-credentials."
},
{
@@ -63,21 +68,24 @@
"go_name": "Runtime",
"value_type": "string",
"mode": "optional_computed",
- "crd_path": "spec.template.runtime"
+ "cr": "template",
+ "crd_path": "spec.vmTemplate.runtime"
},
{
"name": "firmware",
"go_name": "Firmware",
"value_type": "string",
"mode": "optional_computed",
- "crd_path": "spec.template.firmware"
+ "cr": "template",
+ "crd_path": "spec.vmTemplate.firmware"
},
{
"name": "readiness_probe_json",
"go_name": "ReadinessProbeJSON",
"value_type": "normalized_json",
"mode": "optional",
- "crd_path": "spec.template.probes",
+ "cr": "template",
+ "crd_path": "spec.vmTemplate.probes",
"description": "JSON object for the VMI readinessProbe."
},
{
@@ -85,36 +93,36 @@
"go_name": "LivenessProbeJSON",
"value_type": "normalized_json",
"mode": "optional",
- "crd_path": "spec.template.probes",
+ "cr": "template",
+ "crd_path": "spec.vmTemplate.probes",
"description": "JSON object for the VMI livenessProbe."
},
{
- "name": "phase",
- "go_name": "Phase",
+ "name": "template_name",
+ "go_name": "TemplateName",
"value_type": "string",
"mode": "computed",
- "crd_path": "status.phase"
+ "cr": "warmpool",
+ "crd_path": "spec.sandboxTemplateRef.name",
+ "description": "Name of the OSGymSandboxTemplate backing this pool."
},
{
- "name": "total_count",
- "go_name": "TotalCount",
+ "name": "current_replicas",
+ "go_name": "CurrentReplicas",
"value_type": "int64",
"mode": "computed",
- "crd_path": "status.totalCount"
+ "cr": "warmpool",
+ "crd_path": "status.replicas",
+ "description": "Sandboxes the warm pool currently owns."
},
{
- "name": "available_count",
- "go_name": "AvailableCount",
+ "name": "ready_replicas",
+ "go_name": "ReadyReplicas",
"value_type": "int64",
"mode": "computed",
- "crd_path": "status.availableCount"
- },
- {
- "name": "claimed_count",
- "go_name": "ClaimedCount",
- "value_type": "int64",
- "mode": "computed",
- "crd_path": "status.claimedCount"
+ "cr": "warmpool",
+ "crd_path": "status.readyReplicas",
+ "description": "Sandboxes that are ready to be claimed."
}
],
"blocks": [
@@ -122,7 +130,8 @@
"name": "service",
"model": "serviceModel",
"collection": "set",
- "crd_path": "spec.services",
+ "cr": "template",
+ "crd_path": "spec.vmTemplate.services",
"fields": [
{
"name": "name",
@@ -152,6 +161,7 @@
"name": "autoscaling",
"model": "autoscalingModel",
"collection": "single",
+ "cr": "warmpool",
"crd_path": "spec.autoscaling",
"fields": [
{
diff --git a/libs/fleet/terraform-provider-fleets/internal/provider/pool_generated.go b/libs/fleet/terraform-provider-fleets/internal/provider/pool_generated.go
index 573c9d2a79..008c467f31 100644
--- a/libs/fleet/terraform-provider-fleets/internal/provider/pool_generated.go
+++ b/libs/fleet/terraform-provider-fleets/internal/provider/pool_generated.go
@@ -29,10 +29,9 @@ type poolResourceModel struct {
Firmware types.String `tfsdk:"firmware"`
ReadinessProbeJSON jsontypes.Normalized `tfsdk:"readiness_probe_json"`
LivenessProbeJSON jsontypes.Normalized `tfsdk:"liveness_probe_json"`
- Phase types.String `tfsdk:"phase"`
- TotalCount types.Int64 `tfsdk:"total_count"`
- AvailableCount types.Int64 `tfsdk:"available_count"`
- ClaimedCount types.Int64 `tfsdk:"claimed_count"`
+ TemplateName types.String `tfsdk:"template_name"`
+ CurrentReplicas types.Int64 `tfsdk:"current_replicas"`
+ ReadyReplicas types.Int64 `tfsdk:"ready_replicas"`
Services types.Set `tfsdk:"service"`
Autoscaling types.Object `tfsdk:"autoscaling"`
}
@@ -50,24 +49,23 @@ type autoscalingModel struct {
}
func poolResourceSchema() schema.Schema {
- return schema.Schema{Description: "A Cyclops computer-use pool. The pool name also owns its same-named namespace.",
+ return schema.Schema{Description: "A Cua Fleet computer-use pool: an OSGymSandboxWarmPool and its OSGymSandboxTemplate. The pool name also owns its same-named namespace.",
Attributes: map[string]schema.Attribute{
"id": schema.StringAttribute{Computed: true},
"name": schema.StringAttribute{Required: true, Description: "DNS label used for both pool and namespace.", Validators: []validator.String{stringvalidator.LengthBetween(1, 63), stringvalidator.RegexMatches(dnsLabelRegex, "must be a lowercase DNS label")}, PlanModifiers: []planmodifier.String{stringplanmodifier.RequiresReplace()}},
"namespace": schema.StringAttribute{Computed: true},
- "replicas": schema.Int64Attribute{Required: true, Validators: []validator.Int64{int64validator.AtLeast(0)}},
+ "replicas": schema.Int64Attribute{Required: true, Description: "Desired number of pre-warmed OSGymSandboxes.", Validators: []validator.Int64{int64validator.AtLeast(0)}},
"cpu_cores": schema.Int64Attribute{Required: true, Validators: []validator.Int64{int64validator.AtLeast(1)}},
"memory": schema.StringAttribute{Required: true},
- "container_disk_image": schema.StringAttribute{Required: true},
+ "container_disk_image": schema.StringAttribute{Required: true, Description: "KubeVirt containerDisk OCI image (runtime=kubevirt) or the sandbox pod image ref (runtime=macos/gvisor)."},
"image_pull_secret": schema.StringAttribute{Optional: true, Computed: true, Description: "Kubernetes image pull secret. Defaults to ecr-credentials."},
- "runtime": schema.StringAttribute{Optional: true, Computed: true, Description: "Pool backend. \"kubevirt\" (default) provisions a KubeVirt\nVM. \"macos\" provisions a macOS sandbox (ADMIN-ONLY\n— the cyclops-cs backend rejects macos pool writes from\nnon-admins; the SPA hides the option). Flows verbatim\nthrough the compat shim into the OSGymSandboxTemplate\nvmTemplate, where macos_backend dispatches on it.", Validators: []validator.String{stringvalidator.OneOf("gvisor", "kubevirt", "macos")}},
- "firmware": schema.StringAttribute{Optional: true, Computed: true, Description: "VM firmware. Use \"efi\" for GPT/UEFI-only guest images\n(e.g. the dockur-built Windows desktop-workspace);\n\"bios\" is KubeVirt's default and what the Linux\nworkspace images boot with.", Validators: []validator.String{stringvalidator.OneOf("bios", "efi")}},
+ "runtime": schema.StringAttribute{Optional: true, Computed: true, Description: "Pool backend runtime. \"kubevirt\" (default) reconciles each sandbox into a KubeVirt VM. \"macos\" reconciles it into a macOS sandbox (an agent-sandbox Sandbox on a macOS node); \"gvisor\" into a gVisor (runsc) pod on the gVisor K3s workers (also an agent-sandbox Sandbox). For the pod runtimes containerDiskImage is the pod image ref and firmware/cpuCores/memory are advisory.", Validators: []validator.String{stringvalidator.OneOf("gvisor", "kubevirt", "macos")}},
+ "firmware": schema.StringAttribute{Optional: true, Computed: true, Description: "VM firmware. Use \"efi\" for GPT/UEFI-only guest images (e.g. the dockur-built Windows desktop-workspace); \"bios\" is KubeVirt's default and what the Linux workspace images boot with.", Validators: []validator.String{stringvalidator.OneOf("bios", "efi")}},
"readiness_probe_json": schema.StringAttribute{Optional: true, CustomType: jsontypes.NormalizedType{}, Description: "JSON object for the VMI readinessProbe."},
"liveness_probe_json": schema.StringAttribute{Optional: true, CustomType: jsontypes.NormalizedType{}, Description: "JSON object for the VMI livenessProbe."},
- "phase": schema.StringAttribute{Computed: true},
- "total_count": schema.Int64Attribute{Computed: true},
- "available_count": schema.Int64Attribute{Computed: true},
- "claimed_count": schema.Int64Attribute{Computed: true},
+ "template_name": schema.StringAttribute{Computed: true, Description: "Name of the OSGymSandboxTemplate backing this pool."},
+ "current_replicas": schema.Int64Attribute{Computed: true, Description: "Sandboxes the warm pool currently owns."},
+ "ready_replicas": schema.Int64Attribute{Computed: true, Description: "Sandboxes that are ready to be claimed."},
},
Blocks: map[string]schema.Block{
"service": schema.SetNestedBlock{NestedObject: schema.NestedBlockObject{Attributes: map[string]schema.Attribute{
diff --git a/libs/fleet/terraform-provider-fleets/internal/provider/pool_resource.go b/libs/fleet/terraform-provider-fleets/internal/provider/pool_resource.go
index 5d9a9d40a7..95a55492a3 100644
--- a/libs/fleet/terraform-provider-fleets/internal/provider/pool_resource.go
+++ b/libs/fleet/terraform-provider-fleets/internal/provider/pool_resource.go
@@ -15,12 +15,16 @@ import (
"github.com/hashicorp/terraform-plugin-framework/path"
"github.com/hashicorp/terraform-plugin-framework/resource"
"github.com/hashicorp/terraform-plugin-framework/types"
- "github.com/trycua/cloud/cyclops-cs/sdk-bindings/go-uniffi/cyclops_sdk"
"github.com/trycua/cloud/cyclops-cs/sdk-bindings/go-uniffi/cyclops_sdk_schema"
+ "github.com/trycua/cloud/cyclops-cs/sdk-bindings/go-uniffi/fleet_sdk"
)
+// The flat resource is backed by an OSGymSandboxWarmPool and the
+// OSGymSandboxTemplate it references, both named after the pool.
+const templateNameSuffix = "-template"
+
type poolResource struct {
- client *cyclops_sdk.CyclopsClient
+ client *fleet_sdk.CyclopsClient
legacyType bool
}
@@ -42,9 +46,9 @@ func (r *poolResource) Configure(_ context.Context, req resource.ConfigureReques
if req.ProviderData == nil {
return
}
- apiClient, ok := req.ProviderData.(*cyclops_sdk.CyclopsClient)
+ apiClient, ok := req.ProviderData.(*fleet_sdk.CyclopsClient)
if !ok {
- resp.Diagnostics.AddError("Unexpected provider data", fmt.Sprintf("expected *cyclops_sdk.CyclopsClient, got %T", req.ProviderData))
+ resp.Diagnostics.AddError("Unexpected provider data", fmt.Sprintf("expected *fleet_sdk.CyclopsClient, got %T", req.ProviderData))
return
}
r.client = apiClient
@@ -56,21 +60,29 @@ func (r *poolResource) Create(ctx context.Context, req resource.CreateRequest, r
if resp.Diagnostics.HasError() {
return
}
- createRequest := plan.toSDKCreatePoolRequest(ctx, &resp.Diagnostics)
+ poolRequest := plan.toSDKCreatePoolRequest(ctx, &resp.Diagnostics)
+ templateRequest := plan.toSDKCreateTemplateRequest(ctx, &resp.Diagnostics)
if resp.Diagnostics.HasError() {
return
}
- created, err := r.client.CreatePool(createRequest)
+ // The warm pool owns the namespace both objects live in, so it has to exist
+ // before the template can be posted into that namespace.
+ created, err := r.client.CreatePool(poolRequest)
if err != nil {
- resp.Diagnostics.AddError("Unable to create Cyclops pool", err.Error())
+ resp.Diagnostics.AddError("Unable to create Fleet pool", err.Error())
return
}
- created, err = r.client.GetPool(created.Metadata.Name)
- if err != nil {
- resp.Diagnostics.AddError("Pool created but could not be read", err.Error())
+ if _, err := r.client.CreateTemplate(templateRequest); err != nil {
+ if deleteErr := r.client.DeletePool(created); deleteErr != nil {
+ resp.Diagnostics.AddWarning("Fleet pool was left behind", deleteErr.Error())
+ }
+ resp.Diagnostics.AddError("Unable to create Fleet sandbox template", err.Error())
+ return
+ }
+ r.refresh(ctx, &plan, "Pool created but could not be read", &resp.Diagnostics)
+ if resp.Diagnostics.HasError() {
return
}
- plan.fromSDKPool(ctx, created, &resp.Diagnostics)
resp.Diagnostics.Append(resp.State.Set(ctx, &plan)...)
}
@@ -86,34 +98,57 @@ func (r *poolResource) Read(ctx context.Context, req resource.ReadRequest, resp
return
}
if err != nil {
- resp.Diagnostics.AddError("Unable to read Cyclops pool", err.Error())
+ resp.Diagnostics.AddError("Unable to read Fleet pool", err.Error())
return
}
- state.fromSDKPool(ctx, pool, &resp.Diagnostics)
+ template, err := r.getTemplate(pool)
+ if err != nil {
+ resp.Diagnostics.AddError("Unable to read Fleet sandbox template", err.Error())
+ return
+ }
+ if template == nil {
+ resp.Diagnostics.AddWarning(
+ "Fleet sandbox template is missing",
+ fmt.Sprintf("%s/%s no longer exists; applying this resource recreates it.", pool.Metadata.Namespace, pool.Spec.SandboxTemplateRef.Name),
+ )
+ }
+ state.fromSDKPool(pool, &resp.Diagnostics)
+ state.fromSDKTemplate(ctx, template, &resp.Diagnostics)
resp.Diagnostics.Append(resp.State.Set(ctx, &state)...)
}
func (r *poolResource) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse) {
- var plan poolResourceModel
+ var plan, state poolResourceModel
resp.Diagnostics.Append(req.Plan.Get(ctx, &plan)...)
+ resp.Diagnostics.Append(req.State.Get(ctx, &state)...)
if resp.Diagnostics.HasError() {
return
}
- pool := plan.toSDKPool(ctx, &resp.Diagnostics)
- if resp.Diagnostics.HasError() {
- return
+ if !plan.warmPoolAttributesEqual(state) {
+ pool := plan.toSDKPool(ctx, &resp.Diagnostics)
+ if resp.Diagnostics.HasError() {
+ return
+ }
+ if _, err := r.client.UpdatePool(pool); err != nil {
+ resp.Diagnostics.AddError("Unable to update Fleet pool", err.Error())
+ return
+ }
}
- updated, err := r.client.UpdatePool(pool)
- if err != nil {
- resp.Diagnostics.AddError("Unable to update Cyclops pool", err.Error())
+ if !plan.templateAttributesEqual(state) {
+ // Reconcile rather than patch so a template deleted out of band is
+ // restored instead of failing the apply.
+ if _, err := r.client.ReconcileTemplate(plan.toSDKCreateTemplateRequest(ctx, &resp.Diagnostics)); err != nil {
+ resp.Diagnostics.AddError("Unable to update Fleet sandbox template", err.Error())
+ return
+ }
+ }
+ if resp.Diagnostics.HasError() {
return
}
- updated, err = r.client.GetPool(updated.Metadata.Name)
- if err != nil {
- resp.Diagnostics.AddError("Pool updated but could not be read", err.Error())
+ r.refresh(ctx, &plan, "Pool updated but could not be read", &resp.Diagnostics)
+ if resp.Diagnostics.HasError() {
return
}
- plan.fromSDKPool(ctx, updated, &resp.Diagnostics)
resp.Diagnostics.Append(resp.State.Set(ctx, &plan)...)
}
@@ -123,8 +158,14 @@ func (r *poolResource) Delete(ctx context.Context, req resource.DeleteRequest, r
if resp.Diagnostics.HasError() {
return
}
- if err := r.client.DeletePool(poolIdentity(state.Namespace.ValueString(), state.Name.ValueString())); err != nil {
- resp.Diagnostics.AddError("Unable to delete Cyclops pool", err.Error())
+ namespace := state.Namespace.ValueString()
+ if err := r.client.DeleteTemplate(templateIdentity(namespace, state.templateName())); err != nil {
+ resp.Diagnostics.AddError("Unable to delete Fleet sandbox template", err.Error())
+ return
+ }
+ // Deleting the pool also deletes the namespace the template lived in.
+ if err := r.client.DeletePool(poolIdentity(namespace, state.Name.ValueString())); err != nil {
+ resp.Diagnostics.AddError("Unable to delete Fleet pool", err.Error())
}
}
@@ -134,12 +175,72 @@ func (r *poolResource) ImportState(ctx context.Context, req resource.ImportState
resp.Diagnostics.Append(resp.State.SetAttribute(ctx, path.Root("namespace"), req.ID)...)
}
-func (m poolResourceModel) toSDKCreatePoolRequest(ctx context.Context, diagnostics *diag.Diagnostics) cyclops_sdk.CreatePoolRequest {
- pool := m.toSDKPool(ctx, diagnostics)
- return cyclops_sdk.CreatePoolRequest{Namespace: m.Name.ValueString(), Spec: pool.Spec}
+// refresh reloads both objects into the model after a write.
+func (r *poolResource) refresh(ctx context.Context, model *poolResourceModel, failure string, diagnostics *diag.Diagnostics) {
+ pool, err := r.client.GetPool(model.Name.ValueString())
+ if err != nil {
+ diagnostics.AddError(failure, err.Error())
+ return
+ }
+ template, err := r.getTemplate(pool)
+ if err != nil {
+ diagnostics.AddError(failure, err.Error())
+ return
+ }
+ model.fromSDKPool(pool, diagnostics)
+ model.fromSDKTemplate(ctx, template, diagnostics)
}
-func (m poolResourceModel) toSDKPool(ctx context.Context, diagnostics *diag.Diagnostics) cyclops_sdk.Pool {
+// getTemplate returns nil when the template a pool references is gone.
+func (r *poolResource) getTemplate(pool fleet_sdk.Pool) (*fleet_sdk.Template, error) {
+ template, err := r.client.GetTemplate(pool.Metadata.Namespace, pool.Spec.SandboxTemplateRef.Name)
+ if isNotFound(err) {
+ return nil, nil
+ }
+ if err != nil {
+ return nil, err
+ }
+ return &template, nil
+}
+
+func (m poolResourceModel) toSDKCreatePoolRequest(ctx context.Context, diagnostics *diag.Diagnostics) fleet_sdk.CreatePoolRequest {
+ return fleet_sdk.CreatePoolRequest{Namespace: m.Name.ValueString(), Spec: m.toSDKPoolSpec(ctx, diagnostics)}
+}
+
+func (m poolResourceModel) toSDKCreateTemplateRequest(ctx context.Context, diagnostics *diag.Diagnostics) fleet_sdk.CreateTemplateRequest {
+ return fleet_sdk.CreateTemplateRequest{
+ Namespace: m.Name.ValueString(), Name: m.templateName(), Spec: m.toSDKTemplateSpec(ctx, diagnostics),
+ }
+}
+
+func (m poolResourceModel) toSDKPool(ctx context.Context, diagnostics *diag.Diagnostics) fleet_sdk.Pool {
+ name := m.Name.ValueString()
+ return fleet_sdk.Pool{
+ ApiVersion: "osgym.cua.ai/v1alpha1", Kind: "OSGymSandboxWarmPool",
+ Metadata: fleet_sdk.ResourceMetadata{Namespace: name, Name: name},
+ Spec: m.toSDKPoolSpec(ctx, diagnostics),
+ }
+}
+
+func (m poolResourceModel) toSDKPoolSpec(ctx context.Context, diagnostics *diag.Diagnostics) cyclops_sdk_schema.OsGymSandboxWarmPoolSpec {
+ var autoscaling *cyclops_sdk_schema.WarmPoolAutoscaling
+ var autoscalingValue autoscalingModel
+ if objectValue(ctx, m.Autoscaling, &autoscalingValue, diagnostics) {
+ minPoolSize := uint32(autoscalingValue.MinPoolSize.ValueInt64())
+ initialPoolSize := uint32(autoscalingValue.InitialPoolSize.ValueInt64())
+ maxPoolSize := uint32(autoscalingValue.MaxPoolSize.ValueInt64())
+ autoscaling = &cyclops_sdk_schema.WarmPoolAutoscaling{
+ MinPoolSize: &minPoolSize, InitialPoolSize: &initialPoolSize, MaxPoolSize: &maxPoolSize,
+ }
+ }
+ return cyclops_sdk_schema.OsGymSandboxWarmPoolSpec{
+ Replicas: uint32(m.Replicas.ValueInt64()),
+ SandboxTemplateRef: cyclops_sdk_schema.SandboxTemplateRef{Name: m.templateName()},
+ Autoscaling: autoscaling,
+ }
+}
+
+func (m poolResourceModel) toSDKTemplateSpec(ctx context.Context, diagnostics *diag.Diagnostics) cyclops_sdk_schema.OsGymSandboxTemplateSpec {
services := []cyclops_sdk_schema.SandboxService{}
if !m.Services.IsNull() && !m.Services.IsUnknown() {
var values []serviceModel
@@ -154,16 +255,6 @@ func (m poolResourceModel) toSDKPool(ctx context.Context, diagnostics *diag.Diag
})
}
}
- var autoscaling *cyclops_sdk_schema.WarmPoolAutoscaling
- var autoscalingValue autoscalingModel
- if objectValue(ctx, m.Autoscaling, &autoscalingValue, diagnostics) {
- minPoolSize := uint32(autoscalingValue.MinPoolSize.ValueInt64())
- initialPoolSize := uint32(autoscalingValue.InitialPoolSize.ValueInt64())
- maxPoolSize := uint32(autoscalingValue.MaxPoolSize.ValueInt64())
- autoscaling = &cyclops_sdk_schema.WarmPoolAutoscaling{
- MinPoolSize: &minPoolSize, InitialPoolSize: &initialPoolSize, MaxPoolSize: &maxPoolSize,
- }
- }
var runtime *cyclops_sdk_schema.RuntimeKind
switch m.Runtime.ValueString() {
case "macos":
@@ -185,15 +276,10 @@ func (m poolResourceModel) toSDKPool(ctx context.Context, diagnostics *diag.Diag
cpuCores := uint32(m.CPUCores.ValueInt64())
memory := m.Memory.ValueString()
probes := m.toSDKProbes(diagnostics)
- return cyclops_sdk.Pool{
- ApiVersion: "cua.ai/v1", Kind: "OSGymWorkspacePool",
- Metadata: cyclops_sdk.ResourceMetadata{Namespace: m.Name.ValueString(), Name: m.Name.ValueString()},
- Spec: cyclops_sdk_schema.PoolSpec{
- Replicas: uint32(m.Replicas.ValueInt64()), Autoscaling: autoscaling, Services: &services,
- Template: cyclops_sdk_schema.PoolTemplate{
- Runtime: runtime, ContainerDiskImage: m.ContainerDiskImage.ValueString(), ImagePullSecret: &imagePullSecret,
- CpuCores: &cpuCores, Memory: &memory, Firmware: firmware, Probes: probes,
- },
+ return cyclops_sdk_schema.OsGymSandboxTemplateSpec{
+ VmTemplate: cyclops_sdk_schema.VmTemplate{
+ Runtime: runtime, ContainerDiskImage: m.ContainerDiskImage.ValueString(), ImagePullSecret: &imagePullSecret,
+ CpuCores: &cpuCores, Memory: &memory, Firmware: firmware, Probes: probes, Services: &services,
},
}
}
@@ -218,32 +304,40 @@ func (m poolResourceModel) toSDKProbes(diagnostics *diag.Diagnostics) **cyclops_
return &value
}
-func (m *poolResourceModel) fromSDKPool(ctx context.Context, pool cyclops_sdk.Pool, diagnostics *diag.Diagnostics) {
+// templateName is the OSGymSandboxTemplate the warm pool references. It is
+// computed, so a plan that has not read it back yet falls back to the name the
+// provider assigns.
+func (m poolResourceModel) templateName() string {
+ if name := m.TemplateName.ValueString(); name != "" {
+ return name
+ }
+ return m.Name.ValueString() + templateNameSuffix
+}
+
+func (m poolResourceModel) warmPoolAttributesEqual(other poolResourceModel) bool {
+ return m.Replicas.Equal(other.Replicas) &&
+ m.TemplateName.Equal(other.TemplateName) &&
+ m.Autoscaling.Equal(other.Autoscaling)
+}
+
+func (m poolResourceModel) templateAttributesEqual(other poolResourceModel) bool {
+ return m.CPUCores.Equal(other.CPUCores) &&
+ m.Memory.Equal(other.Memory) &&
+ m.ContainerDiskImage.Equal(other.ContainerDiskImage) &&
+ m.ImagePullSecret.Equal(other.ImagePullSecret) &&
+ m.Runtime.Equal(other.Runtime) &&
+ m.Firmware.Equal(other.Firmware) &&
+ m.ReadinessProbeJSON.Equal(other.ReadinessProbeJSON) &&
+ m.LivenessProbeJSON.Equal(other.LivenessProbeJSON) &&
+ m.Services.Equal(other.Services)
+}
+
+func (m *poolResourceModel) fromSDKPool(pool fleet_sdk.Pool, diagnostics *diag.Diagnostics) {
m.ID = types.StringValue(pool.Metadata.Name)
m.Name = types.StringValue(pool.Metadata.Name)
m.Namespace = types.StringValue(pool.Metadata.Namespace)
m.Replicas = types.Int64Value(int64(pool.Spec.Replicas))
- m.CPUCores = types.Int64Value(optionalUint32(pool.Spec.Template.CpuCores))
- m.Memory = types.StringValue(optionalString(pool.Spec.Template.Memory))
- m.ContainerDiskImage = types.StringValue(pool.Spec.Template.ContainerDiskImage)
- m.ImagePullSecret = types.StringValue(defaultString(pool.Spec.Template.ImagePullSecret, "ecr-credentials"))
- m.Runtime = types.StringValue(runtimeString(pool.Spec.Template.Runtime))
- m.Firmware = types.StringValue(firmwareString(pool.Spec.Template.Firmware))
- probes := sdkProbes(pool.Spec.Template.Probes, diagnostics)
- m.ReadinessProbeJSON = encodeProbe(probes["readinessProbe"], diagnostics)
- m.LivenessProbeJSON = encodeProbe(probes["livenessProbe"], diagnostics)
- serviceType := serviceObjectType()
- serviceValues := make([]attr.Value, 0, len(optionalServices(pool.Spec.Services)))
- for _, value := range optionalServices(pool.Spec.Services) {
- object, diags := types.ObjectValue(serviceType, map[string]attr.Value{
- "name": types.StringValue(value.Name), "target_port": types.Int64Value(int64(value.TargetPort)), "protocol": types.StringValue(serviceProtocolString(value.Protocol)),
- })
- diagnostics.Append(diags...)
- serviceValues = append(serviceValues, object)
- }
- services, diags := types.SetValue(types.ObjectType{AttrTypes: serviceType}, serviceValues)
- diagnostics.Append(diags...)
- m.Services = services
+ m.TemplateName = types.StringValue(pool.Spec.SandboxTemplateRef.Name)
if pool.Spec.Autoscaling == nil {
m.Autoscaling = types.ObjectNull(autoscalingObjectType())
} else {
@@ -256,24 +350,55 @@ func (m *poolResourceModel) fromSDKPool(ctx context.Context, pool cyclops_sdk.Po
m.Autoscaling = object
}
if pool.Status == nil {
- m.Phase = types.StringValue("")
- m.TotalCount = types.Int64Value(0)
- m.AvailableCount = types.Int64Value(0)
- m.ClaimedCount = types.Int64Value(0)
+ m.CurrentReplicas = types.Int64Value(0)
+ m.ReadyReplicas = types.Int64Value(0)
return
}
- m.Phase = types.StringValue(optionalString(pool.Status.Phase))
- m.TotalCount = types.Int64Value(optionalUint32(pool.Status.TotalCount))
- m.AvailableCount = types.Int64Value(optionalUint32(pool.Status.AvailableCount))
- m.ClaimedCount = types.Int64Value(optionalUint32(pool.Status.ClaimedCount))
+ m.CurrentReplicas = types.Int64Value(optionalUint32(pool.Status.Replicas))
+ m.ReadyReplicas = types.Int64Value(optionalUint32(pool.Status.ReadyReplicas))
+}
+
+// fromSDKTemplate reads the template-owned attributes. A nil template — the
+// warm pool referencing one that no longer exists — clears them so the next
+// plan restores the template.
+func (m *poolResourceModel) fromSDKTemplate(ctx context.Context, template *fleet_sdk.Template, diagnostics *diag.Diagnostics) {
+ vmTemplate := cyclops_sdk_schema.VmTemplate{}
+ if template != nil {
+ vmTemplate = template.Spec.VmTemplate
+ }
+ m.CPUCores = types.Int64Value(optionalUint32(vmTemplate.CpuCores))
+ m.Memory = types.StringValue(optionalString(vmTemplate.Memory))
+ m.ContainerDiskImage = types.StringValue(vmTemplate.ContainerDiskImage)
+ m.ImagePullSecret = types.StringValue(defaultString(vmTemplate.ImagePullSecret, "ecr-credentials"))
+ m.Runtime = types.StringValue(runtimeString(vmTemplate.Runtime))
+ m.Firmware = types.StringValue(firmwareString(vmTemplate.Firmware))
+ probes := sdkProbes(vmTemplate.Probes, diagnostics)
+ m.ReadinessProbeJSON = encodeProbe(probes["readinessProbe"], diagnostics)
+ m.LivenessProbeJSON = encodeProbe(probes["livenessProbe"], diagnostics)
+ serviceType := serviceObjectType()
+ serviceValues := make([]attr.Value, 0, len(optionalServices(vmTemplate.Services)))
+ for _, value := range optionalServices(vmTemplate.Services) {
+ object, diags := types.ObjectValue(serviceType, map[string]attr.Value{
+ "name": types.StringValue(value.Name), "target_port": types.Int64Value(int64(value.TargetPort)), "protocol": types.StringValue(serviceProtocolString(value.Protocol)),
+ })
+ diagnostics.Append(diags...)
+ serviceValues = append(serviceValues, object)
+ }
+ services, diags := types.SetValue(types.ObjectType{AttrTypes: serviceType}, serviceValues)
+ diagnostics.Append(diags...)
+ m.Services = services
+}
+
+func poolIdentity(namespace, name string) fleet_sdk.Pool {
+ return fleet_sdk.Pool{Metadata: fleet_sdk.ResourceMetadata{Namespace: namespace, Name: name}}
}
-func poolIdentity(namespace, name string) cyclops_sdk.Pool {
- return cyclops_sdk.Pool{Metadata: cyclops_sdk.ResourceMetadata{Namespace: namespace, Name: name}}
+func templateIdentity(namespace, name string) fleet_sdk.Template {
+ return fleet_sdk.Template{Metadata: fleet_sdk.ResourceMetadata{Namespace: namespace, Name: name}}
}
func isNotFound(err error) bool {
- var status *cyclops_sdk.SdkErrorStatus
+ var status *fleet_sdk.SdkErrorStatus
return errors.As(err, &status) && status.Status == http.StatusNotFound
}
diff --git a/libs/fleet/terraform-provider-fleets/internal/provider/pool_resource_acc_test.go b/libs/fleet/terraform-provider-fleets/internal/provider/pool_resource_acc_test.go
index 9d5ba3365f..68318d0d1b 100644
--- a/libs/fleet/terraform-provider-fleets/internal/provider/pool_resource_acc_test.go
+++ b/libs/fleet/terraform-provider-fleets/internal/provider/pool_resource_acc_test.go
@@ -29,7 +29,10 @@ import (
"sigs.k8s.io/controller-runtime/pkg/envtest"
)
-var poolGVR = schema.GroupVersionResource{Group: "cua.ai", Version: "v1", Resource: "osgymworkspacepools"}
+var (
+ warmPoolGVR = schema.GroupVersionResource{Group: "osgym.cua.ai", Version: "v1alpha1", Resource: "osgymsandboxwarmpools"}
+ templateGVR = schema.GroupVersionResource{Group: "osgym.cua.ai", Version: "v1alpha1", Resource: "osgymsandboxtemplates"}
+)
func TestAccPoolLifecycle(t *testing.T) {
if os.Getenv("TF_ACC") == "" {
@@ -40,7 +43,7 @@ func TestAccPoolLifecycle(t *testing.T) {
}
testEnvironment := &envtest.Environment{
- CRDDirectoryPaths: []string{"../../../rbac-e2e/testdata"},
+ CRDDirectoryPaths: []string{"../../../../clusters/base/osgym/crd.yaml"},
ErrorIfCRDPathMissing: true,
}
config, err := testEnvironment.Start()
@@ -78,9 +81,14 @@ provider "fleets" {
"fleets": providerserver.NewProtocol6WithError(fleetsprovider.New("test")()),
},
CheckDestroy: func(_ *terraform.State) error {
- _, err := dynamicClient.Resource(poolGVR).Namespace("terraform-e2e").Get(context.Background(), "terraform-e2e", metav1.GetOptions{})
- if err == nil {
- return fmt.Errorf("pool still exists after destroy")
+ for resourceName, gvr := range map[string]schema.GroupVersionResource{
+ "terraform-e2e": warmPoolGVR,
+ "terraform-e2e-template": templateGVR,
+ } {
+ _, err := dynamicClient.Resource(gvr).Namespace("terraform-e2e").Get(context.Background(), resourceName, metav1.GetOptions{})
+ if err == nil {
+ return fmt.Errorf("%s still exists after destroy", resourceName)
+ }
}
return nil
},
@@ -90,7 +98,9 @@ provider "fleets" {
Check: resource.ComposeAggregateTestCheckFunc(
resource.TestCheckResourceAttr("fleets_pool.test", "name", "terraform-e2e"),
resource.TestCheckResourceAttr("fleets_pool.test", "namespace", "terraform-e2e"),
+ resource.TestCheckResourceAttr("fleets_pool.test", "template_name", "terraform-e2e-template"),
resource.TestCheckResourceAttr("fleets_pool.test", "replicas", "1"),
+ resource.TestCheckResourceAttr("fleets_pool.test", "container_disk_image", "example.invalid/cyclops/e2e:latest"),
resource.TestCheckResourceAttr("fleets_pool.test", "service.#", "1"),
resource.TestCheckResourceAttr("fleets_pool.test", "autoscaling.max_pool_size", "5"),
),
@@ -172,18 +182,27 @@ func newCyclopsTestServer(t *testing.T, clientset *kubernetes.Clientset, dynamic
return
}
- const prefix = "/api/k8s/apis/cua.ai/v1/namespaces/"
+ const prefix = "/api/k8s/apis/osgym.cua.ai/v1alpha1/namespaces/"
if !strings.HasPrefix(r.URL.Path, prefix) {
http.NotFound(w, r)
return
}
parts := strings.Split(strings.TrimPrefix(r.URL.Path, prefix), "/")
- if len(parts) < 2 || parts[1] != "osgymworkspacepools" {
+ if len(parts) < 2 {
+ http.NotFound(w, r)
+ return
+ }
+ var gvr schema.GroupVersionResource
+ switch parts[1] {
+ case warmPoolGVR.Resource:
+ gvr = warmPoolGVR
+ case templateGVR.Resource:
+ gvr = templateGVR
+ default:
http.NotFound(w, r)
return
}
- namespace := parts[0]
- pools := dynamicClient.Resource(poolGVR).Namespace(namespace)
+ objects := dynamicClient.Resource(gvr).Namespace(parts[0])
switch {
case r.Method == http.MethodPost && len(parts) == 2:
var object unstructured.Unstructured
@@ -191,10 +210,10 @@ func newCyclopsTestServer(t *testing.T, clientset *kubernetes.Clientset, dynamic
http.Error(w, err.Error(), http.StatusBadRequest)
return
}
- created, err := pools.Create(ctx, &object, metav1.CreateOptions{})
+ created, err := objects.Create(ctx, &object, metav1.CreateOptions{})
writeKubernetesResult(w, http.StatusCreated, created, err)
case r.Method == http.MethodGet && len(parts) == 3:
- object, err := pools.Get(ctx, parts[2], metav1.GetOptions{})
+ object, err := objects.Get(ctx, parts[2], metav1.GetOptions{})
writeKubernetesResult(w, http.StatusOK, object, err)
case r.Method == http.MethodPatch && len(parts) == 3:
body, err := io.ReadAll(r.Body)
@@ -202,10 +221,10 @@ func newCyclopsTestServer(t *testing.T, clientset *kubernetes.Clientset, dynamic
http.Error(w, err.Error(), http.StatusBadRequest)
return
}
- object, err := pools.Patch(ctx, parts[2], types.MergePatchType, body, metav1.PatchOptions{})
+ object, err := objects.Patch(ctx, parts[2], types.MergePatchType, body, metav1.PatchOptions{})
writeKubernetesResult(w, http.StatusOK, object, err)
case r.Method == http.MethodDelete && len(parts) == 3:
- err := pools.Delete(ctx, parts[2], metav1.DeleteOptions{})
+ err := objects.Delete(ctx, parts[2], metav1.DeleteOptions{})
writeKubernetesResult(w, http.StatusNoContent, nil, err)
default:
http.NotFound(w, r)
diff --git a/libs/fleet/terraform-provider-fleets/internal/provider/pool_sdk_test.go b/libs/fleet/terraform-provider-fleets/internal/provider/pool_sdk_test.go
index 45952e9e65..faf2eef995 100644
--- a/libs/fleet/terraform-provider-fleets/internal/provider/pool_sdk_test.go
+++ b/libs/fleet/terraform-provider-fleets/internal/provider/pool_sdk_test.go
@@ -6,13 +6,15 @@ import (
"github.com/hashicorp/terraform-plugin-framework/diag"
"github.com/hashicorp/terraform-plugin-framework/types"
- "github.com/trycua/cloud/cyclops-cs/sdk-bindings/go-uniffi/cyclops_sdk"
+ "github.com/trycua/cloud/cyclops-cs/sdk-bindings/go-uniffi/cyclops_sdk_schema"
+ "github.com/trycua/cloud/cyclops-cs/sdk-bindings/go-uniffi/fleet_sdk"
)
-func TestPoolResourceModelToSDKCreatePoolRequest(t *testing.T) {
- model := poolResourceModel{
+func examplePoolModel() poolResourceModel {
+ return poolResourceModel{
Name: types.StringValue("example"),
Namespace: types.StringNull(),
+ TemplateName: types.StringNull(),
Replicas: types.Int64Value(2),
CPUCores: types.Int64Value(4),
Memory: types.StringValue("8Gi"),
@@ -20,7 +22,13 @@ func TestPoolResourceModelToSDKCreatePoolRequest(t *testing.T) {
ImagePullSecret: types.StringValue("pull-secret"),
Runtime: types.StringValue("kubevirt"),
Firmware: types.StringValue("bios"),
+ Services: types.SetNull(types.ObjectType{AttrTypes: serviceObjectType()}),
+ Autoscaling: types.ObjectNull(autoscalingObjectType()),
}
+}
+
+func TestPoolResourceModelToSDKCreatePoolRequest(t *testing.T) {
+ model := examplePoolModel()
var diagnostics diag.Diagnostics
request := model.toSDKCreatePoolRequest(context.Background(), &diagnostics)
@@ -28,19 +36,143 @@ func TestPoolResourceModelToSDKCreatePoolRequest(t *testing.T) {
t.Fatalf("unexpected diagnostics: %v", diagnostics)
}
- var _ cyclops_sdk.CreatePoolRequest = request
+ var _ fleet_sdk.CreatePoolRequest = request
if request.Namespace != "example" {
t.Fatalf("namespace = %q, want example", request.Namespace)
}
+ if request.Spec.Replicas != 2 {
+ t.Fatalf("replicas = %d, want 2", request.Spec.Replicas)
+ }
+ if request.Spec.SandboxTemplateRef.Name != "example-template" {
+ t.Fatalf("sandboxTemplateRef = %q, want example-template", request.Spec.SandboxTemplateRef.Name)
+ }
pool := model.toSDKPool(context.Background(), &diagnostics)
if diagnostics.HasError() {
t.Fatalf("unexpected diagnostics: %v", diagnostics)
}
- if pool.Metadata.Namespace != "example" {
- t.Fatalf("pool namespace = %q, want example", pool.Metadata.Namespace)
+ if pool.ApiVersion != "osgym.cua.ai/v1alpha1" || pool.Kind != "OSGymSandboxWarmPool" {
+ t.Fatalf("pool identity = %s %s", pool.ApiVersion, pool.Kind)
}
- if request.Spec.Replicas != 2 {
- t.Fatalf("replicas = %d, want 2", request.Spec.Replicas)
+ if pool.Metadata.Namespace != "example" || pool.Metadata.Name != "example" {
+ t.Fatalf("pool metadata = %+v, want namespace and name example", pool.Metadata)
+ }
+}
+
+func TestPoolResourceModelToSDKCreateTemplateRequest(t *testing.T) {
+ model := examplePoolModel()
+
+ var diagnostics diag.Diagnostics
+ request := model.toSDKCreateTemplateRequest(context.Background(), &diagnostics)
+ if diagnostics.HasError() {
+ t.Fatalf("unexpected diagnostics: %v", diagnostics)
+ }
+
+ var _ fleet_sdk.CreateTemplateRequest = request
+ if request.Namespace != "example" {
+ t.Fatalf("namespace = %q, want example", request.Namespace)
+ }
+ if request.Name != "example-template" {
+ t.Fatalf("name = %q, want example-template", request.Name)
+ }
+ vmTemplate := request.Spec.VmTemplate
+ if vmTemplate.ContainerDiskImage != "registry.example/image:latest" {
+ t.Fatalf("containerDiskImage = %q", vmTemplate.ContainerDiskImage)
+ }
+ if vmTemplate.CpuCores == nil || *vmTemplate.CpuCores != 4 {
+ t.Fatalf("cpuCores = %v, want 4", vmTemplate.CpuCores)
+ }
+ if vmTemplate.Memory == nil || *vmTemplate.Memory != "8Gi" {
+ t.Fatalf("memory = %v, want 8Gi", vmTemplate.Memory)
+ }
+ if vmTemplate.ImagePullSecret == nil || *vmTemplate.ImagePullSecret != "pull-secret" {
+ t.Fatalf("imagePullSecret = %v, want pull-secret", vmTemplate.ImagePullSecret)
+ }
+ if vmTemplate.Services == nil || len(*vmTemplate.Services) != 0 {
+ t.Fatalf("services = %v, want an empty slice", vmTemplate.Services)
+ }
+}
+
+func TestPoolResourceModelFromSDKObjects(t *testing.T) {
+ replicas := uint32(2)
+ readyReplicas := uint32(1)
+ cpuCores := uint32(4)
+ memory := "8Gi"
+ services := []cyclops_sdk_schema.SandboxService{{Name: "ssh", TargetPort: 22}}
+ pool := fleet_sdk.Pool{
+ Metadata: fleet_sdk.ResourceMetadata{Namespace: "example", Name: "example"},
+ Spec: cyclops_sdk_schema.OsGymSandboxWarmPoolSpec{
+ Replicas: 2,
+ SandboxTemplateRef: cyclops_sdk_schema.SandboxTemplateRef{Name: "example-template"},
+ },
+ Status: &cyclops_sdk_schema.OsGymSandboxWarmPoolStatus{Replicas: &replicas, ReadyReplicas: &readyReplicas},
+ }
+ template := fleet_sdk.Template{
+ Metadata: fleet_sdk.ResourceMetadata{Namespace: "example", Name: "example-template"},
+ Spec: cyclops_sdk_schema.OsGymSandboxTemplateSpec{VmTemplate: cyclops_sdk_schema.VmTemplate{
+ ContainerDiskImage: "registry.example/image:latest", CpuCores: &cpuCores, Memory: &memory, Services: &services,
+ }},
+ }
+
+ var model poolResourceModel
+ var diagnostics diag.Diagnostics
+ model.fromSDKPool(pool, &diagnostics)
+ model.fromSDKTemplate(context.Background(), &template, &diagnostics)
+ if diagnostics.HasError() {
+ t.Fatalf("unexpected diagnostics: %v", diagnostics)
+ }
+
+ if model.ID.ValueString() != "example" || model.Namespace.ValueString() != "example" {
+ t.Fatalf("id = %q, namespace = %q", model.ID.ValueString(), model.Namespace.ValueString())
+ }
+ if model.TemplateName.ValueString() != "example-template" {
+ t.Fatalf("template_name = %q", model.TemplateName.ValueString())
+ }
+ if model.CurrentReplicas.ValueInt64() != 2 || model.ReadyReplicas.ValueInt64() != 1 {
+ t.Fatalf("status replicas = %d, ready = %d", model.CurrentReplicas.ValueInt64(), model.ReadyReplicas.ValueInt64())
+ }
+ if model.Memory.ValueString() != "8Gi" || model.CPUCores.ValueInt64() != 4 {
+ t.Fatalf("memory = %q, cpu_cores = %d", model.Memory.ValueString(), model.CPUCores.ValueInt64())
+ }
+ if length := len(model.Services.Elements()); length != 1 {
+ t.Fatalf("service count = %d, want 1", length)
+ }
+}
+
+func TestPoolResourceModelFromSDKTemplateClearsMissingTemplate(t *testing.T) {
+ model := examplePoolModel()
+
+ var diagnostics diag.Diagnostics
+ model.fromSDKTemplate(context.Background(), nil, &diagnostics)
+ if diagnostics.HasError() {
+ t.Fatalf("unexpected diagnostics: %v", diagnostics)
+ }
+ if model.ContainerDiskImage.ValueString() != "" || model.CPUCores.ValueInt64() != 0 {
+ t.Fatalf("template attributes were not cleared: %+v", model)
+ }
+ if model.Services.IsNull() || len(model.Services.Elements()) != 0 {
+ t.Fatalf("services = %v, want an empty set", model.Services)
+ }
+}
+
+func TestPoolResourceModelUpdateRoutesByOwningObject(t *testing.T) {
+ state := examplePoolModel()
+
+ replicaChange := state
+ replicaChange.Replicas = types.Int64Value(3)
+ if replicaChange.warmPoolAttributesEqual(state) {
+ t.Fatal("replicas belongs to the warm pool but did not register as changed")
+ }
+ if !replicaChange.templateAttributesEqual(state) {
+ t.Fatal("replicas must not mark the template as changed")
+ }
+
+ memoryChange := state
+ memoryChange.Memory = types.StringValue("16Gi")
+ if memoryChange.templateAttributesEqual(state) {
+ t.Fatal("memory belongs to the template but did not register as changed")
+ }
+ if !memoryChange.warmPoolAttributesEqual(state) {
+ t.Fatal("memory must not mark the warm pool as changed")
}
}
diff --git a/libs/fleet/terraform-provider-fleets/internal/provider/provider.go b/libs/fleet/terraform-provider-fleets/internal/provider/provider.go
index 384affab84..88fc83d284 100644
--- a/libs/fleet/terraform-provider-fleets/internal/provider/provider.go
+++ b/libs/fleet/terraform-provider-fleets/internal/provider/provider.go
@@ -17,7 +17,7 @@ import (
"github.com/hashicorp/terraform-plugin-framework/resource"
"github.com/hashicorp/terraform-plugin-framework/types"
"github.com/hashicorp/terraform-plugin-framework/types/basetypes"
- "github.com/trycua/cloud/cyclops-cs/sdk-bindings/go-uniffi/cyclops_sdk"
+ "github.com/trycua/cloud/cyclops-cs/sdk-bindings/go-uniffi/fleet_sdk"
)
const (
@@ -90,14 +90,14 @@ func (p *fleetsProvider) Resources(_ context.Context) []func() resource.Resource
func (p *fleetsProvider) DataSources(_ context.Context) []func() datasource.DataSource { return nil }
-func newCyclopsClient(endpoint, accessToken, clientID, clientSecret, tokenURL string) (*cyclops_sdk.CyclopsClient, error) {
+func newCyclopsClient(endpoint, accessToken, clientID, clientSecret, tokenURL string) (*fleet_sdk.CyclopsClient, error) {
endpoint = strings.TrimRight(strings.TrimSpace(endpoint), "/")
if endpoint == "" {
return nil, fmt.Errorf("endpoint is required")
}
client := sdkHTTPClient{client: &http.Client{Timeout: 30 * time.Second}}
if accessToken != "" {
- return cyclops_sdk.CyclopsClientConnectWithAccessToken(cyclops_sdk.CyclopsTokenProviderConfiguration{
+ return fleet_sdk.CyclopsClientConnectWithAccessToken(fleet_sdk.CyclopsTokenProviderConfiguration{
BaseUrl: endpoint, PoolPollIntervalMs: sdkPollIntervalMs, PoolPollLimit: sdkPollLimit,
ClaimPollIntervalMs: sdkPollIntervalMs, ClaimPollLimit: sdkPollLimit,
}, accessToken, client)
@@ -105,8 +105,8 @@ func newCyclopsClient(endpoint, accessToken, clientID, clientSecret, tokenURL st
if clientID == "" || clientSecret == "" || tokenURL == "" {
return nil, fmt.Errorf("set access_token or client_id, client_secret, and token_url")
}
- return cyclops_sdk.CyclopsClientConnect(cyclops_sdk.CyclopsConfiguration{
- BaseUrl: endpoint, TokenUrl: tokenURL, Credentials: cyclops_sdk.NewCyclopsCredentials(clientID, clientSecret),
+ return fleet_sdk.CyclopsClientConnect(fleet_sdk.CyclopsConfiguration{
+ BaseUrl: endpoint, TokenUrl: tokenURL, Credentials: fleet_sdk.NewCyclopsCredentials(clientID, clientSecret),
PoolPollIntervalMs: sdkPollIntervalMs, PoolPollLimit: sdkPollLimit,
ClaimPollIntervalMs: sdkPollIntervalMs, ClaimPollLimit: sdkPollLimit,
}, client)
@@ -114,34 +114,34 @@ func newCyclopsClient(endpoint, accessToken, clientID, clientSecret, tokenURL st
type sdkHTTPClient struct{ client *http.Client }
-func (c sdkHTTPClient) Execute(request cyclops_sdk.HttpRequest) (cyclops_sdk.HttpResponse, error) {
+func (c sdkHTTPClient) Execute(request fleet_sdk.HttpRequest) (fleet_sdk.HttpResponse, error) {
var body io.Reader
if request.Body != nil {
body = bytes.NewReader(*request.Body)
}
nativeRequest, err := http.NewRequest(request.Method, request.Url, body)
if err != nil {
- return cyclops_sdk.HttpResponse{}, err
+ return fleet_sdk.HttpResponse{}, err
}
for _, header := range request.Headers {
nativeRequest.Header.Add(header.Name, header.Value)
}
nativeResponse, err := c.client.Do(nativeRequest)
if err != nil {
- return cyclops_sdk.HttpResponse{}, err
+ return fleet_sdk.HttpResponse{}, err
}
defer nativeResponse.Body.Close()
responseBody, err := io.ReadAll(nativeResponse.Body)
if err != nil {
- return cyclops_sdk.HttpResponse{}, err
+ return fleet_sdk.HttpResponse{}, err
}
- headers := make([]cyclops_sdk.HttpHeader, 0, len(nativeResponse.Header))
+ headers := make([]fleet_sdk.HttpHeader, 0, len(nativeResponse.Header))
for name, values := range nativeResponse.Header {
for _, value := range values {
- headers = append(headers, cyclops_sdk.HttpHeader{Name: name, Value: value})
+ headers = append(headers, fleet_sdk.HttpHeader{Name: name, Value: value})
}
}
- return cyclops_sdk.HttpResponse{Status: uint16(nativeResponse.StatusCode), Headers: headers, Body: responseBody}, nil
+ return fleet_sdk.HttpResponse{Status: uint16(nativeResponse.StatusCode), Headers: headers, Body: responseBody}, nil
}
func objectValue(ctx context.Context, object types.Object, target any, diagnostics *diag.Diagnostics) bool {
diff --git a/libs/fleet/terraform-provider-fleets/internal/provider/sdk_client_test.go b/libs/fleet/terraform-provider-fleets/internal/provider/sdk_client_test.go
index 15aa9baf15..41b4a8748b 100644
--- a/libs/fleet/terraform-provider-fleets/internal/provider/sdk_client_test.go
+++ b/libs/fleet/terraform-provider-fleets/internal/provider/sdk_client_test.go
@@ -12,7 +12,7 @@ func TestNewCyclopsClientUsesStaticAccessToken(t *testing.T) {
if got := r.Header.Get("Authorization"); got != "Bearer static-token" {
t.Fatalf("authorization = %q, want static bearer token", got)
}
- if r.URL.Path != "/api/k8s/apis/cua.ai/v1/namespaces/demo/osgymworkspacepools" {
+ if r.URL.Path != "/api/k8s/apis/osgym.cua.ai/v1alpha1/namespaces/demo/osgymsandboxwarmpools" {
t.Fatalf("path = %q", r.URL.Path)
}
_ = json.NewEncoder(w).Encode(map[string]any{"items": []any{}})
@@ -42,7 +42,7 @@ func TestNewCyclopsClientUsesOAuthCredentials(t *testing.T) {
if got := r.Header.Get("Authorization"); got != "Bearer oauth-token" {
t.Fatalf("authorization = %q, want OAuth bearer token", got)
}
- if r.URL.Path != "/api/k8s/apis/cua.ai/v1/namespaces/demo/osgymworkspacepools" {
+ if r.URL.Path != "/api/k8s/apis/osgym.cua.ai/v1alpha1/namespaces/demo/osgymsandboxwarmpools" {
t.Fatalf("path = %q", r.URL.Path)
}
_ = json.NewEncoder(w).Encode(map[string]any{"items": []any{}})