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.

Add signed service URLs for sharing sandbox services without credentials (#7241)

r33drichardsa606824d72f3
diff --git a/libs/fleet/backend/auth/authz.rego b/libs/fleet/backend/auth/authz.rego
index 366c957265..a533466759 100644
--- a/libs/fleet/backend/auth/authz.rego
+++ b/libs/fleet/backend/auth/authz.rego
@@ -75,6 +75,16 @@ is_interactive_client {
# hardcoded `namespace` claim. Their sub owns nothing on its own, so every
# surface that accepts them checks that claim against the route's parameters.
is_per_key_client {
+ key_client_prefix := object.get(input.user, "key_client_prefix", "key-")
+ key_client_prefix != ""
+ startswith(input.user.azp, key_client_prefix)
+}
+
+# A default-prefix service account must not fall through as an ordinary user
+# when the deployment has moved per-key clients to another configured prefix.
+is_legacy_per_key_client {
+ key_client_prefix := object.get(input.user, "key_client_prefix", "key-")
+ key_client_prefix != "key-"
startswith(input.user.azp, "key-")
}
diff --git a/libs/fleet/backend/auth/authz_ownership.rego b/libs/fleet/backend/auth/authz_ownership.rego
index a7c7c7904d..0edfa2b0fd 100644
--- a/libs/fleet/backend/auth/authz_ownership.rego
+++ b/libs/fleet/backend/auth/authz_ownership.rego
@@ -64,6 +64,16 @@ applies {
input.method == "GET"
}
+# Signed service URL management uses the backend service account, so it must
+# prove namespace ownership here before the handler acts.
+applies {
+ input.route == "/api/signed-service-urls/{namespace}"
+}
+
+applies {
+ input.route == "/api/signed-service-urls/{namespace}/{id}"
+}
+
# target_namespace is the namespace this request is about: /api/svc names it
# {namespace}, /api/namespaces/{name} names it {name}. Keyed
# off which parameter the route bound rather than off the route itself, so the
@@ -119,6 +129,7 @@ probe_eligible {
applies
not is_github_principal
not authz.is_per_key_client
+ not authz.is_legacy_per_key_client
target_namespace != ""
}
diff --git a/libs/fleet/backend/auth/authz_signed_service_urls.rego b/libs/fleet/backend/auth/authz_signed_service_urls.rego
new file mode 100644
index 0000000000..e80b7f86f6
--- /dev/null
+++ b/libs/fleet/backend/auth/authz_signed_service_urls.rego
@@ -0,0 +1,28 @@
+package authz_signed_service_urls
+
+import data.authz
+
+default allow = false
+
+allow {
+ authz.is_per_key_client
+ valid_params
+ input.user.namespace == input.params.namespace
+}
+
+allow {
+ not authz.is_per_key_client
+ not authz.is_legacy_per_key_client
+ valid_params
+}
+
+valid_params {
+ input.route == "/api/signed-service-urls/{namespace}"
+ authz.valid_dns_label(input.params.namespace)
+}
+
+valid_params {
+ input.route == "/api/signed-service-urls/{namespace}/{id}"
+ authz.valid_dns_label(input.params.namespace)
+ input.params.id != ""
+}
diff --git a/libs/fleet/backend/auth/authz_signed_service_urls_test.rego b/libs/fleet/backend/auth/authz_signed_service_urls_test.rego
new file mode 100644
index 0000000000..7ec3e1bc39
--- /dev/null
+++ b/libs/fleet/backend/auth/authz_signed_service_urls_test.rego
@@ -0,0 +1,32 @@
+package authz_signed_service_urls_test
+
+import rego.v1
+
+import data.authz_base
+import data.authz_signed_service_urls
+
+route_allow if {
+ authz_base.allow
+ authz_signed_service_urls.allow
+}
+
+test_signed_service_urls_spa_allowed if {
+ route_allow with input as {"route": "/api/signed-service-urls/{namespace}", "method": "POST", "path": "/api/signed-service-urls/mypool", "params": {"namespace": "mypool"}, "user": {"sub": "user-123", "azp": "cyclops-cs-spa", "namespace": "", "email": "[email protected]"}}
+}
+
+test_signed_service_urls_per_key_matching_namespace_allowed if {
+ route_allow with input as {"route": "/api/signed-service-urls/{namespace}", "method": "GET", "path": "/api/signed-service-urls/mypool", "params": {"namespace": "mypool"}, "user": {"sub": "svc-123", "azp": "key-mypool", "namespace": "mypool", "email": ""}}
+}
+
+test_signed_service_urls_per_key_wrong_namespace_denied if {
+ not route_allow with input as {"route": "/api/signed-service-urls/{namespace}", "method": "GET", "path": "/api/signed-service-urls/other", "params": {"namespace": "other"}, "user": {"sub": "svc-123", "azp": "key-mypool", "namespace": "mypool", "email": ""}}
+}
+
+test_signed_service_urls_custom_per_key_prefix_is_namespace_scoped if {
+ route_allow with input as {"route": "/api/signed-service-urls/{namespace}", "method": "GET", "path": "/api/signed-service-urls/mypool", "params": {"namespace": "mypool"}, "user": {"sub": "svc-123", "azp": "poolkey-mypool", "key_client_prefix": "poolkey-", "namespace": "mypool", "email": ""}}
+ not route_allow with input as {"route": "/api/signed-service-urls/{namespace}", "method": "GET", "path": "/api/signed-service-urls/other", "params": {"namespace": "other"}, "user": {"sub": "svc-123", "azp": "poolkey-mypool", "key_client_prefix": "poolkey-", "namespace": "mypool", "email": ""}}
+}
+
+test_signed_service_urls_delete_requires_id if {
+ not route_allow with input as {"route": "/api/signed-service-urls/{namespace}/{id}", "method": "DELETE", "path": "/api/signed-service-urls/mypool/", "params": {"namespace": "mypool", "id": ""}, "user": {"sub": "user-123", "azp": "cyclops-cs-spa", "namespace": "", "email": "[email protected]"}}
+}
diff --git a/libs/fleet/backend/auth/authz_test.rego b/libs/fleet/backend/auth/authz_test.rego
index 1f6a87d7d8..11fd66bb33 100644
--- a/libs/fleet/backend/auth/authz_test.rego
+++ b/libs/fleet/backend/auth/authz_test.rego
@@ -45,6 +45,11 @@ test_per_key_client_recognised_by_prefix if {
not authz.is_per_key_client with input as {"user": {"azp": "ukey-foo"}}
}
+test_per_key_client_uses_configured_prefix if {
+ authz.is_per_key_client with input as {"user": {"azp": "poolkey-foo", "key_client_prefix": "poolkey-"}}
+ not authz.is_per_key_client with input as {"user": {"azp": "key-foo", "key_client_prefix": "poolkey-"}}
+}
+
test_user_key_client_recognised_by_prefix if {
authz.is_user_key_client with input as {"user": {"azp": "ukey-foo"}}
not authz.is_user_key_client with input as {"user": {"azp": "key-foo"}}
diff --git a/libs/fleet/backend/auth/middlewares.go b/libs/fleet/backend/auth/middlewares.go
index 21b9776db0..c0af4ad90a 100644
--- a/libs/fleet/backend/auth/middlewares.go
+++ b/libs/fleet/backend/auth/middlewares.go
@@ -69,19 +69,20 @@ var surfacePolicySources = map[string]struct {
filename string
source string
}{
- "authz-base": {"authz_base.rego", authzBasePolicy},
- "authz-keys": {"authz_keys.rego", authzKeysPolicy},
- "authz-config": {"authz_config.rego", authzConfigPolicy},
- "authz-chat": {"authz_chat.rego", authzChatPolicy},
- "authz-billing": {"authz_billing.rego", authzBillingPolicy},
- "authz-usage": {"authz_usage.rego", authzUsagePolicy},
- "authz-namespaces": {"authz_namespaces.rego", authzNamespacesPolicy},
- "authz-github-trust": {"authz_github_trust.rego", authzGitHubTrustPolicy},
- "authz-user-keys": {"authz_user_keys.rego", authzUserKeysPolicy},
- "authz-k8s": {"authz_k8s.rego", authzK8sPolicy},
- "authz-svc": {"authz_svc.rego", authzSvcPolicy},
- "authz-state-query": {"authz_state_query.rego", authzStateQueryPolicy},
- "authz-feature-flags": {"authz_feature_flags.rego", authzFeatureFlagsPolicy},
+ "authz-base": {"authz_base.rego", authzBasePolicy},
+ "authz-keys": {"authz_keys.rego", authzKeysPolicy},
+ "authz-config": {"authz_config.rego", authzConfigPolicy},
+ "authz-chat": {"authz_chat.rego", authzChatPolicy},
+ "authz-billing": {"authz_billing.rego", authzBillingPolicy},
+ "authz-usage": {"authz_usage.rego", authzUsagePolicy},
+ "authz-namespaces": {"authz_namespaces.rego", authzNamespacesPolicy},
+ "authz-github-trust": {"authz_github_trust.rego", authzGitHubTrustPolicy},
+ "authz-user-keys": {"authz_user_keys.rego", authzUserKeysPolicy},
+ "authz-k8s": {"authz_k8s.rego", authzK8sPolicy},
+ "authz-svc": {"authz_svc.rego", authzSvcPolicy},
+ "authz-signed-service-urls": {"authz_signed_service_urls.rego", authzSignedServiceURLsPolicy},
+ "authz-state-query": {"authz_state_query.rego", authzStateQueryPolicy},
+ "authz-feature-flags": {"authz_feature_flags.rego", authzFeatureFlagsPolicy},
}
//go:embed authz_base.rego
@@ -117,6 +118,9 @@ var authzK8sPolicy string
//go:embed authz_svc.rego
var authzSvcPolicy string
+//go:embed authz_signed_service_urls.rego
+var authzSignedServiceURLsPolicy string
+
//go:embed authz_state_query.rego
var authzStateQueryPolicy string
@@ -666,6 +670,7 @@ func TokenAuthMiddleware(next http.Handler) http.Handler {
Email: proxyEmail,
EmailVerified: proxyEmail != "",
AZP: "oauth2-proxy", // distinct from SPA/key clients for OPA
+ KeyClientPfx: configuredKeyClientPfx(),
}
metrics.SetRequestUser(r.Context(), user.ID)
next.ServeHTTP(w, r.WithContext(context.WithValue(r.Context(), UserKey, user)))
@@ -687,6 +692,7 @@ func TokenAuthMiddleware(next http.Handler) http.Handler {
writeJSONErr(w, http.StatusUnauthorized, "auth token is invalid")
return
}
+ user.KeyClientPfx = configuredKeyClientPfx()
// ── User-key identity override ─────────────────────────────
// User-key tokens have azp="ukey-..." and carry hardcoded
@@ -708,6 +714,20 @@ func TokenAuthMiddleware(next http.Handler) http.Handler {
})
}
+func configuredKeyClientPfx() string {
+ if authConfig != nil && authConfig.KeyClientPfx != "" {
+ return authConfig.KeyClientPfx
+ }
+ return "key-"
+}
+
+func keyClientPfx(value string) string {
+ if value == "" {
+ return "key-"
+ }
+ return value
+}
+
func applyUserKeyIdentity(user *User, userKeyPfx string) error {
if !strings.HasPrefix(user.AZP, userKeyPfx) {
return nil
@@ -735,6 +755,7 @@ func buildUserInput(user *User) map[string]any {
return map[string]any{
"sub": user.ID,
"azp": user.AZP,
+ "key_client_prefix": keyClientPfx(user.KeyClientPfx),
"namespace": user.Namespace,
"email": user.Email,
"groups": user.Groups,
diff --git a/libs/fleet/backend/auth/policy_characterization_test.go b/libs/fleet/backend/auth/policy_characterization_test.go
index d678e3d985..4b880d0fda 100644
--- a/libs/fleet/backend/auth/policy_characterization_test.go
+++ b/libs/fleet/backend/auth/policy_characterization_test.go
@@ -257,6 +257,24 @@ func characterizationCases() map[string][]routeCase {
cases["/api/svc/{namespace}/{service}"] = proxyCases(false)
cases["/api/svc/{namespace}/{service}/{path...}"] = proxyCases(true)
+ // /api/signed-service-urls mirrors the /api/svc parameter logic: DNS-label shape,
+ // the per-key namespace binding, and the RBAC fact for everyone else —
+ // its handler acts with the pod ServiceAccount, so the ownership conjunct
+ // is the boundary and all three fact answers matter here too.
+ cases["/api/signed-service-urls/{namespace}"] = []routeCase{
+ {name: "owned-ns", params: map[string]string{"namespace": characterizationOwnedNamespace}, path: "/api/signed-service-urls/ns-a"},
+ {name: "other-ns", params: map[string]string{"namespace": characterizationUnownedNamespace}, path: "/api/signed-service-urls/ns-b"},
+ {name: "unreachable-ns", params: map[string]string{"namespace": characterizationUnreachableNamespace}, path: "/api/signed-service-urls/ns-err"},
+ {name: "invalid-ns", params: map[string]string{"namespace": "Not_A_Label"}, path: "/api/signed-service-urls/Not_A_Label"},
+ {name: "empty-ns", params: map[string]string{"namespace": ""}, path: "/api/signed-service-urls/"},
+ }
+ cases["/api/signed-service-urls/{namespace}/{id}"] = []routeCase{
+ {name: "owned-ns", params: map[string]string{"namespace": characterizationOwnedNamespace, "id": "5cd7f3e4-5390-4c0c-a93b-dd18116d367c"}, path: "/api/signed-service-urls/ns-a/5cd7f3e4-5390-4c0c-a93b-dd18116d367c"},
+ {name: "other-ns", params: map[string]string{"namespace": characterizationUnownedNamespace, "id": "5cd7f3e4-5390-4c0c-a93b-dd18116d367c"}, path: "/api/signed-service-urls/ns-b/5cd7f3e4-5390-4c0c-a93b-dd18116d367c"},
+ {name: "unreachable-ns", params: map[string]string{"namespace": characterizationUnreachableNamespace, "id": "5cd7f3e4-5390-4c0c-a93b-dd18116d367c"}, path: "/api/signed-service-urls/ns-err/5cd7f3e4-5390-4c0c-a93b-dd18116d367c"},
+ {name: "empty-id", params: map[string]string{"namespace": characterizationOwnedNamespace, "id": ""}, path: "/api/signed-service-urls/ns-a/"},
+ }
+
// /api/k8s carries the richest parameter logic in the policy: the infra-path
// list, the admin escape hatch over it, the GitHub namespace grant, and the
// pool-admission leaf reading the body.
diff --git a/libs/fleet/backend/auth/policy_routes.go b/libs/fleet/backend/auth/policy_routes.go
index 225b20cdb4..a9674e8d15 100644
--- a/libs/fleet/backend/auth/policy_routes.go
+++ b/libs/fleet/backend/auth/policy_routes.go
@@ -161,6 +161,14 @@ func SvcRoutePolicy() Node {
)
}
+func SignedServiceURLsRoutePolicy() Node {
+ return All(
+ BasePolicy(),
+ surfaceLeaf("authz-signed-service-urls", "data.authz_signed_service_urls.allow"),
+ NamespaceOwnershipPolicy(),
+ )
+}
+
// StateQueryRoutePolicy guards /api/state/query.
func StateQueryRoutePolicy() Node {
return All(BasePolicy(), surfaceLeaf("authz-state-query", "data.authz_state_query.allow"))
@@ -251,17 +259,18 @@ const featureFlagAuditBodyLimit = 64 << 10
// surfacePolicies is every surface, by name. A surface owning no route fails
// TestEveryPolicySurfaceOwnsARoute; a route naming no surface cannot start.
var surfacePolicies = map[string]surfacePolicy{
- "keys": {tree: KeysRoutePolicy},
- "config": {tree: ConfigRoutePolicy},
- "chat": {tree: ChatRoutePolicy},
- "billing": {tree: BillingRoutePolicy},
- "usage": {tree: UsageRoutePolicy},
- "namespaces": {tree: NamespacesRoutePolicy},
- "github-trust": {tree: GitHubTrustRoutePolicy},
- "user-keys": {tree: UserKeysRoutePolicy},
- "svc": {tree: SvcRoutePolicy},
- "state-query": {tree: StateQueryRoutePolicy},
- "feature-flags": {tree: FeatureFlagsRoutePolicy, options: []MiddlewareOption{WithDeniedAudit("feature_flag_admin", featureFlagAuditBodyLimit), WithAdminAPIErrorResponses(), WithFreshAdminAuthorization()}},
+ "keys": {tree: KeysRoutePolicy},
+ "config": {tree: ConfigRoutePolicy},
+ "chat": {tree: ChatRoutePolicy},
+ "billing": {tree: BillingRoutePolicy},
+ "usage": {tree: UsageRoutePolicy},
+ "namespaces": {tree: NamespacesRoutePolicy},
+ "github-trust": {tree: GitHubTrustRoutePolicy},
+ "user-keys": {tree: UserKeysRoutePolicy},
+ "svc": {tree: SvcRoutePolicy},
+ "signed-service-urls": {tree: SignedServiceURLsRoutePolicy},
+ "state-query": {tree: StateQueryRoutePolicy},
+ "feature-flags": {tree: FeatureFlagsRoutePolicy, options: []MiddlewareOption{WithDeniedAudit("feature_flag_admin", featureFlagAuditBodyLimit), WithAdminAPIErrorResponses(), WithFreshAdminAuthorization()}},
"k8s": {
tree: K8sRoutePolicy,
options: []MiddlewareOption{WithDeniedMessage("k8s request is not allowed")},
@@ -308,6 +317,9 @@ var routeSurfaces = map[string]string{
"/api/svc/{namespace}/{service}": "svc",
"/api/svc/{namespace}/{service}/{path...}": "svc",
+ "/api/signed-service-urls/{namespace}": "signed-service-urls",
+ "/api/signed-service-urls/{namespace}/{id}": "signed-service-urls",
+
"/api/k8s/{path...}": "k8s",
"/api/admin/feature-flags": "feature-flags",
"/api/admin/feature-flags/{key}": "feature-flags",
diff --git a/libs/fleet/backend/auth/policy_test.go b/libs/fleet/backend/auth/policy_test.go
index 05327850cc..033b02a810 100644
--- a/libs/fleet/backend/auth/policy_test.go
+++ b/libs/fleet/backend/auth/policy_test.go
@@ -77,6 +77,54 @@ func prepareQuery(t *testing.T, query string, modules map[string]string) rego.Pr
return pq
}
+func TestPerKeyClientUsesConfiguredPrefixFromUserInput(t *testing.T) {
+ query := prepareQuery(t, "data.authz.is_per_key_client", map[string]string{"authz.rego": authzPolicy})
+ for _, testCase := range []struct {
+ name string
+ user *User
+ want bool
+ }{
+ {name: "custom prefix client", user: &User{AZP: "poolkey-ns-a", KeyClientPfx: "poolkey-"}, want: true},
+ {name: "legacy prefix client", user: &User{AZP: "key-ns-a", KeyClientPfx: "poolkey-"}, want: false},
+ {name: "default prefix client", user: &User{AZP: "key-ns-a"}, want: true},
+ } {
+ t.Run(testCase.name, func(t *testing.T) {
+ results, err := query.Eval(context.Background(), rego.EvalInput(map[string]any{"user": buildUserInput(testCase.user)}))
+ if err != nil {
+ t.Fatalf("evaluate per-key client policy: %v", err)
+ }
+ got := len(results) > 0 && len(results[0].Expressions) > 0 && results[0].Expressions[0].Value == true
+ if got != testCase.want {
+ t.Fatalf("is_per_key_client = %t, want %t; input = %#v", got, testCase.want, buildUserInput(testCase.user))
+ }
+ })
+ }
+}
+
+func TestSignedServiceURLsCustomPerKeyPrefixIsNamespaceScoped(t *testing.T) {
+ for _, testCase := range []struct {
+ name string
+ namespace string
+ want bool
+ }{
+ {name: "matching namespace", namespace: "ns-a", want: true},
+ {name: "other namespace", namespace: "ns-b", want: false},
+ } {
+ t.Run(testCase.name, func(t *testing.T) {
+ input := map[string]any{
+ "route": "/api/signed-service-urls/{namespace}",
+ "method": http.MethodGet,
+ "params": map[string]string{"namespace": testCase.namespace},
+ "user": buildUserInput(&User{ID: "svc-1", AZP: "poolkey-ns-a", KeyClientPfx: "poolkey-", Namespace: "ns-a"}),
+ "flags": map[string]any{},
+ }
+ if got := evalAllow(t, input); got != testCase.want {
+ t.Fatalf("allow(namespace=%q) = %t, want %t", testCase.namespace, got, testCase.want)
+ }
+ })
+ }
+}
+
// evalAllow answers what the route's production policy would, over a raw input
// document. There is no single module to query any more: a route runs
// All(base, surface), so this resolves the tree main.go dispatches input.route
@@ -543,3 +591,17 @@ func TestPoolAdmissionIgnoresLookalikeResourceGroups(t *testing.T) {
t.Fatal("lookalike resource group should be outside pool admission policy scope")
}
}
+
+func TestSignedServiceURLsRejectLegacyPerKeyPrefixUnderCustomConfiguration(t *testing.T) {
+ input := map[string]any{
+ "route": "/api/signed-service-urls/{namespace}",
+ "method": http.MethodGet,
+ "params": map[string]string{"namespace": "ns-a"},
+ "user": buildUserInput(&User{ID: "svc-1", AZP: "key-ns-a", KeyClientPfx: "poolkey-", Namespace: "ns-a"}),
+ "flags": map[string]any{},
+ "facts": map[string]any{"namespace_rbac": map[string]any{"allowed": true}},
+ }
+ if evalAllow(t, input) {
+ t.Fatal("legacy key- client must not regain signed URL access through RBAC under a custom prefix")
+ }
+}
diff --git a/libs/fleet/backend/auth/testdata/route-authorization-table.txt b/libs/fleet/backend/auth/testdata/route-authorization-table.txt
index 32e3a8b403..c72b8c3074 100644
--- a/libs/fleet/backend/auth/testdata/route-authorization-table.txt
+++ b/libs/fleet/backend/auth/testdata/route-authorization-table.txt
@@ -2473,6 +2473,501 @@
/api/namespaces/{name} | unreachable-name | QUERY | spa = allow
/api/namespaces/{name} | unreachable-name | QUERY | user-key = allow
/api/namespaces/{name} | unreachable-name | QUERY | user-key-verified = allow
+/api/signed-service-urls/{namespace} | empty-ns | DELETE | admin-spa = deny
+/api/signed-service-urls/{namespace} | empty-ns | DELETE | cua-cli = deny
+/api/signed-service-urls/{namespace} | empty-ns | DELETE | dcr-client = deny
+/api/signed-service-urls/{namespace} | empty-ns | DELETE | empty-sub = deny
+/api/signed-service-urls/{namespace} | empty-ns | DELETE | github-oidc = deny
+/api/signed-service-urls/{namespace} | empty-ns | DELETE | oauth2-proxy = deny
+/api/signed-service-urls/{namespace} | empty-ns | DELETE | per-key-other-ns = deny
+/api/signed-service-urls/{namespace} | empty-ns | DELETE | per-key-owned-ns = deny
+/api/signed-service-urls/{namespace} | empty-ns | DELETE | spa = deny
+/api/signed-service-urls/{namespace} | empty-ns | DELETE | user-key = deny
+/api/signed-service-urls/{namespace} | empty-ns | DELETE | user-key-verified = deny
+/api/signed-service-urls/{namespace} | empty-ns | GET | admin-spa = deny
+/api/signed-service-urls/{namespace} | empty-ns | GET | cua-cli = deny
+/api/signed-service-urls/{namespace} | empty-ns | GET | dcr-client = deny
+/api/signed-service-urls/{namespace} | empty-ns | GET | empty-sub = deny
+/api/signed-service-urls/{namespace} | empty-ns | GET | github-oidc = deny
+/api/signed-service-urls/{namespace} | empty-ns | GET | oauth2-proxy = deny
+/api/signed-service-urls/{namespace} | empty-ns | GET | per-key-other-ns = deny
+/api/signed-service-urls/{namespace} | empty-ns | GET | per-key-owned-ns = deny
+/api/signed-service-urls/{namespace} | empty-ns | GET | spa = deny
+/api/signed-service-urls/{namespace} | empty-ns | GET | user-key = deny
+/api/signed-service-urls/{namespace} | empty-ns | GET | user-key-verified = deny
+/api/signed-service-urls/{namespace} | empty-ns | PATCH | admin-spa = deny
+/api/signed-service-urls/{namespace} | empty-ns | PATCH | cua-cli = deny
+/api/signed-service-urls/{namespace} | empty-ns | PATCH | dcr-client = deny
+/api/signed-service-urls/{namespace} | empty-ns | PATCH | empty-sub = deny
+/api/signed-service-urls/{namespace} | empty-ns | PATCH | github-oidc = deny
+/api/signed-service-urls/{namespace} | empty-ns | PATCH | oauth2-proxy = deny
+/api/signed-service-urls/{namespace} | empty-ns | PATCH | per-key-other-ns = deny
+/api/signed-service-urls/{namespace} | empty-ns | PATCH | per-key-owned-ns = deny
+/api/signed-service-urls/{namespace} | empty-ns | PATCH | spa = deny
+/api/signed-service-urls/{namespace} | empty-ns | PATCH | user-key = deny
+/api/signed-service-urls/{namespace} | empty-ns | PATCH | user-key-verified = deny
+/api/signed-service-urls/{namespace} | empty-ns | POST | admin-spa = deny
+/api/signed-service-urls/{namespace} | empty-ns | POST | cua-cli = deny
+/api/signed-service-urls/{namespace} | empty-ns | POST | dcr-client = deny
+/api/signed-service-urls/{namespace} | empty-ns | POST | empty-sub = deny
+/api/signed-service-urls/{namespace} | empty-ns | POST | github-oidc = deny
+/api/signed-service-urls/{namespace} | empty-ns | POST | oauth2-proxy = deny
+/api/signed-service-urls/{namespace} | empty-ns | POST | per-key-other-ns = deny
+/api/signed-service-urls/{namespace} | empty-ns | POST | per-key-owned-ns = deny
+/api/signed-service-urls/{namespace} | empty-ns | POST | spa = deny
+/api/signed-service-urls/{namespace} | empty-ns | POST | user-key = deny
+/api/signed-service-urls/{namespace} | empty-ns | POST | user-key-verified = deny
+/api/signed-service-urls/{namespace} | empty-ns | QUERY | admin-spa = deny
+/api/signed-service-urls/{namespace} | empty-ns | QUERY | cua-cli = deny
+/api/signed-service-urls/{namespace} | empty-ns | QUERY | dcr-client = deny
+/api/signed-service-urls/{namespace} | empty-ns | QUERY | empty-sub = deny
+/api/signed-service-urls/{namespace} | empty-ns | QUERY | github-oidc = deny
+/api/signed-service-urls/{namespace} | empty-ns | QUERY | oauth2-proxy = deny
+/api/signed-service-urls/{namespace} | empty-ns | QUERY | per-key-other-ns = deny
+/api/signed-service-urls/{namespace} | empty-ns | QUERY | per-key-owned-ns = deny
+/api/signed-service-urls/{namespace} | empty-ns | QUERY | spa = deny
+/api/signed-service-urls/{namespace} | empty-ns | QUERY | user-key = deny
+/api/signed-service-urls/{namespace} | empty-ns | QUERY | user-key-verified = deny
+/api/signed-service-urls/{namespace} | invalid-ns | DELETE | admin-spa = deny
+/api/signed-service-urls/{namespace} | invalid-ns | DELETE | cua-cli = deny
+/api/signed-service-urls/{namespace} | invalid-ns | DELETE | dcr-client = deny
+/api/signed-service-urls/{namespace} | invalid-ns | DELETE | empty-sub = deny
+/api/signed-service-urls/{namespace} | invalid-ns | DELETE | github-oidc = deny
+/api/signed-service-urls/{namespace} | invalid-ns | DELETE | oauth2-proxy = deny
+/api/signed-service-urls/{namespace} | invalid-ns | DELETE | per-key-other-ns = deny
+/api/signed-service-urls/{namespace} | invalid-ns | DELETE | per-key-owned-ns = deny
+/api/signed-service-urls/{namespace} | invalid-ns | DELETE | spa = deny
+/api/signed-service-urls/{namespace} | invalid-ns | DELETE | user-key = deny
+/api/signed-service-urls/{namespace} | invalid-ns | DELETE | user-key-verified = deny
+/api/signed-service-urls/{namespace} | invalid-ns | GET | admin-spa = deny
+/api/signed-service-urls/{namespace} | invalid-ns | GET | cua-cli = deny
+/api/signed-service-urls/{namespace} | invalid-ns | GET | dcr-client = deny
+/api/signed-service-urls/{namespace} | invalid-ns | GET | empty-sub = deny
+/api/signed-service-urls/{namespace} | invalid-ns | GET | github-oidc = deny
+/api/signed-service-urls/{namespace} | invalid-ns | GET | oauth2-proxy = deny
+/api/signed-service-urls/{namespace} | invalid-ns | GET | per-key-other-ns = deny
+/api/signed-service-urls/{namespace} | invalid-ns | GET | per-key-owned-ns = deny
+/api/signed-service-urls/{namespace} | invalid-ns | GET | spa = deny
+/api/signed-service-urls/{namespace} | invalid-ns | GET | user-key = deny
+/api/signed-service-urls/{namespace} | invalid-ns | GET | user-key-verified = deny
+/api/signed-service-urls/{namespace} | invalid-ns | PATCH | admin-spa = deny
+/api/signed-service-urls/{namespace} | invalid-ns | PATCH | cua-cli = deny
+/api/signed-service-urls/{namespace} | invalid-ns | PATCH | dcr-client = deny
+/api/signed-service-urls/{namespace} | invalid-ns | PATCH | empty-sub = deny
+/api/signed-service-urls/{namespace} | invalid-ns | PATCH | github-oidc = deny
+/api/signed-service-urls/{namespace} | invalid-ns | PATCH | oauth2-proxy = deny
+/api/signed-service-urls/{namespace} | invalid-ns | PATCH | per-key-other-ns = deny
+/api/signed-service-urls/{namespace} | invalid-ns | PATCH | per-key-owned-ns = deny
+/api/signed-service-urls/{namespace} | invalid-ns | PATCH | spa = deny
+/api/signed-service-urls/{namespace} | invalid-ns | PATCH | user-key = deny
+/api/signed-service-urls/{namespace} | invalid-ns | PATCH | user-key-verified = deny
+/api/signed-service-urls/{namespace} | invalid-ns | POST | admin-spa = deny
+/api/signed-service-urls/{namespace} | invalid-ns | POST | cua-cli = deny
+/api/signed-service-urls/{namespace} | invalid-ns | POST | dcr-client = deny
+/api/signed-service-urls/{namespace} | invalid-ns | POST | empty-sub = deny
+/api/signed-service-urls/{namespace} | invalid-ns | POST | github-oidc = deny
+/api/signed-service-urls/{namespace} | invalid-ns | POST | oauth2-proxy = deny
+/api/signed-service-urls/{namespace} | invalid-ns | POST | per-key-other-ns = deny
+/api/signed-service-urls/{namespace} | invalid-ns | POST | per-key-owned-ns = deny
+/api/signed-service-urls/{namespace} | invalid-ns | POST | spa = deny
+/api/signed-service-urls/{namespace} | invalid-ns | POST | user-key = deny
+/api/signed-service-urls/{namespace} | invalid-ns | POST | user-key-verified = deny
+/api/signed-service-urls/{namespace} | invalid-ns | QUERY | admin-spa = deny
+/api/signed-service-urls/{namespace} | invalid-ns | QUERY | cua-cli = deny
+/api/signed-service-urls/{namespace} | invalid-ns | QUERY | dcr-client = deny
+/api/signed-service-urls/{namespace} | invalid-ns | QUERY | empty-sub = deny
+/api/signed-service-urls/{namespace} | invalid-ns | QUERY | github-oidc = deny
+/api/signed-service-urls/{namespace} | invalid-ns | QUERY | oauth2-proxy = deny
+/api/signed-service-urls/{namespace} | invalid-ns | QUERY | per-key-other-ns = deny
+/api/signed-service-urls/{namespace} | invalid-ns | QUERY | per-key-owned-ns = deny
+/api/signed-service-urls/{namespace} | invalid-ns | QUERY | spa = deny
+/api/signed-service-urls/{namespace} | invalid-ns | QUERY | user-key = deny
+/api/signed-service-urls/{namespace} | invalid-ns | QUERY | user-key-verified = deny
+/api/signed-service-urls/{namespace} | other-ns | DELETE | admin-spa = deny
+/api/signed-service-urls/{namespace} | other-ns | DELETE | cua-cli = deny
+/api/signed-service-urls/{namespace} | other-ns | DELETE | dcr-client = deny
+/api/signed-service-urls/{namespace} | other-ns | DELETE | empty-sub = deny
+/api/signed-service-urls/{namespace} | other-ns | DELETE | github-oidc = deny
+/api/signed-service-urls/{namespace} | other-ns | DELETE | oauth2-proxy = deny
+/api/signed-service-urls/{namespace} | other-ns | DELETE | per-key-other-ns = deny
+/api/signed-service-urls/{namespace} | other-ns | DELETE | per-key-owned-ns = deny
+/api/signed-service-urls/{namespace} | other-ns | DELETE | spa = deny
+/api/signed-service-urls/{namespace} | other-ns | DELETE | user-key = deny
+/api/signed-service-urls/{namespace} | other-ns | DELETE | user-key-verified = deny
+/api/signed-service-urls/{namespace} | other-ns | GET | admin-spa = deny
+/api/signed-service-urls/{namespace} | other-ns | GET | cua-cli = deny
+/api/signed-service-urls/{namespace} | other-ns | GET | dcr-client = deny
+/api/signed-service-urls/{namespace} | other-ns | GET | empty-sub = deny
+/api/signed-service-urls/{namespace} | other-ns | GET | github-oidc = deny
+/api/signed-service-urls/{namespace} | other-ns | GET | oauth2-proxy = deny
+/api/signed-service-urls/{namespace} | other-ns | GET | per-key-other-ns = deny
+/api/signed-service-urls/{namespace} | other-ns | GET | per-key-owned-ns = deny
+/api/signed-service-urls/{namespace} | other-ns | GET | spa = deny
+/api/signed-service-urls/{namespace} | other-ns | GET | user-key = deny
+/api/signed-service-urls/{namespace} | other-ns | GET | user-key-verified = deny
+/api/signed-service-urls/{namespace} | other-ns | PATCH | admin-spa = deny
+/api/signed-service-urls/{namespace} | other-ns | PATCH | cua-cli = deny
+/api/signed-service-urls/{namespace} | other-ns | PATCH | dcr-client = deny
+/api/signed-service-urls/{namespace} | other-ns | PATCH | empty-sub = deny
+/api/signed-service-urls/{namespace} | other-ns | PATCH | github-oidc = deny
+/api/signed-service-urls/{namespace} | other-ns | PATCH | oauth2-proxy = deny
+/api/signed-service-urls/{namespace} | other-ns | PATCH | per-key-other-ns = deny
+/api/signed-service-urls/{namespace} | other-ns | PATCH | per-key-owned-ns = deny
+/api/signed-service-urls/{namespace} | other-ns | PATCH | spa = deny
+/api/signed-service-urls/{namespace} | other-ns | PATCH | user-key = deny
+/api/signed-service-urls/{namespace} | other-ns | PATCH | user-key-verified = deny
+/api/signed-service-urls/{namespace} | other-ns | POST | admin-spa = deny
+/api/signed-service-urls/{namespace} | other-ns | POST | cua-cli = deny
+/api/signed-service-urls/{namespace} | other-ns | POST | dcr-client = deny
+/api/signed-service-urls/{namespace} | other-ns | POST | empty-sub = deny
+/api/signed-service-urls/{namespace} | other-ns | POST | github-oidc = deny
+/api/signed-service-urls/{namespace} | other-ns | POST | oauth2-proxy = deny
+/api/signed-service-urls/{namespace} | other-ns | POST | per-key-other-ns = deny
+/api/signed-service-urls/{namespace} | other-ns | POST | per-key-owned-ns = deny
+/api/signed-service-urls/{namespace} | other-ns | POST | spa = deny
+/api/signed-service-urls/{namespace} | other-ns | POST | user-key = deny
+/api/signed-service-urls/{namespace} | other-ns | POST | user-key-verified = deny
+/api/signed-service-urls/{namespace} | other-ns | QUERY | admin-spa = deny
+/api/signed-service-urls/{namespace} | other-ns | QUERY | cua-cli = deny
+/api/signed-service-urls/{namespace} | other-ns | QUERY | dcr-client = deny
+/api/signed-service-urls/{namespace} | other-ns | QUERY | empty-sub = deny
+/api/signed-service-urls/{namespace} | other-ns | QUERY | github-oidc = deny
+/api/signed-service-urls/{namespace} | other-ns | QUERY | oauth2-proxy = deny
+/api/signed-service-urls/{namespace} | other-ns | QUERY | per-key-other-ns = deny
+/api/signed-service-urls/{namespace} | other-ns | QUERY | per-key-owned-ns = deny
+/api/signed-service-urls/{namespace} | other-ns | QUERY | spa = deny
+/api/signed-service-urls/{namespace} | other-ns | QUERY | user-key = deny
+/api/signed-service-urls/{namespace} | other-ns | QUERY | user-key-verified = deny
+/api/signed-service-urls/{namespace} | owned-ns | DELETE | admin-spa = allow
+/api/signed-service-urls/{namespace} | owned-ns | DELETE | cua-cli = allow
+/api/signed-service-urls/{namespace} | owned-ns | DELETE | dcr-client = allow
+/api/signed-service-urls/{namespace} | owned-ns | DELETE | empty-sub = deny
+/api/signed-service-urls/{namespace} | owned-ns | DELETE | github-oidc = allow
+/api/signed-service-urls/{namespace} | owned-ns | DELETE | oauth2-proxy = allow
+/api/signed-service-urls/{namespace} | owned-ns | DELETE | per-key-other-ns = deny
+/api/signed-service-urls/{namespace} | owned-ns | DELETE | per-key-owned-ns = allow
+/api/signed-service-urls/{namespace} | owned-ns | DELETE | spa = allow
+/api/signed-service-urls/{namespace} | owned-ns | DELETE | user-key = allow
+/api/signed-service-urls/{namespace} | owned-ns | DELETE | user-key-verified = allow
+/api/signed-service-urls/{namespace} | owned-ns | GET | admin-spa = allow
+/api/signed-service-urls/{namespace} | owned-ns | GET | cua-cli = allow
+/api/signed-service-urls/{namespace} | owned-ns | GET | dcr-client = allow
+/api/signed-service-urls/{namespace} | owned-ns | GET | empty-sub = deny
+/api/signed-service-urls/{namespace} | owned-ns | GET | github-oidc = allow
+/api/signed-service-urls/{namespace} | owned-ns | GET | oauth2-proxy = allow
+/api/signed-service-urls/{namespace} | owned-ns | GET | per-key-other-ns = deny
+/api/signed-service-urls/{namespace} | owned-ns | GET | per-key-owned-ns = allow
+/api/signed-service-urls/{namespace} | owned-ns | GET | spa = allow
+/api/signed-service-urls/{namespace} | owned-ns | GET | user-key = allow
+/api/signed-service-urls/{namespace} | owned-ns | GET | user-key-verified = allow
+/api/signed-service-urls/{namespace} | owned-ns | PATCH | admin-spa = allow
+/api/signed-service-urls/{namespace} | owned-ns | PATCH | cua-cli = allow
+/api/signed-service-urls/{namespace} | owned-ns | PATCH | dcr-client = allow
+/api/signed-service-urls/{namespace} | owned-ns | PATCH | empty-sub = deny
+/api/signed-service-urls/{namespace} | owned-ns | PATCH | github-oidc = allow
+/api/signed-service-urls/{namespace} | owned-ns | PATCH | oauth2-proxy = allow
+/api/signed-service-urls/{namespace} | owned-ns | PATCH | per-key-other-ns = deny
+/api/signed-service-urls/{namespace} | owned-ns | PATCH | per-key-owned-ns = allow
+/api/signed-service-urls/{namespace} | owned-ns | PATCH | spa = allow
+/api/signed-service-urls/{namespace} | owned-ns | PATCH | user-key = allow
+/api/signed-service-urls/{namespace} | owned-ns | PATCH | user-key-verified = allow
+/api/signed-service-urls/{namespace} | owned-ns | POST | admin-spa = allow
+/api/signed-service-urls/{namespace} | owned-ns | POST | cua-cli = allow
+/api/signed-service-urls/{namespace} | owned-ns | POST | dcr-client = allow
+/api/signed-service-urls/{namespace} | owned-ns | POST | empty-sub = deny
+/api/signed-service-urls/{namespace} | owned-ns | POST | github-oidc = allow
+/api/signed-service-urls/{namespace} | owned-ns | POST | oauth2-proxy = allow
+/api/signed-service-urls/{namespace} | owned-ns | POST | per-key-other-ns = deny
+/api/signed-service-urls/{namespace} | owned-ns | POST | per-key-owned-ns = allow
+/api/signed-service-urls/{namespace} | owned-ns | POST | spa = allow
+/api/signed-service-urls/{namespace} | owned-ns | POST | user-key = allow
+/api/signed-service-urls/{namespace} | owned-ns | POST | user-key-verified = allow
+/api/signed-service-urls/{namespace} | owned-ns | QUERY | admin-spa = allow
+/api/signed-service-urls/{namespace} | owned-ns | QUERY | cua-cli = allow
+/api/signed-service-urls/{namespace} | owned-ns | QUERY | dcr-client = allow
+/api/signed-service-urls/{namespace} | owned-ns | QUERY | empty-sub = deny
+/api/signed-service-urls/{namespace} | owned-ns | QUERY | github-oidc = allow
+/api/signed-service-urls/{namespace} | owned-ns | QUERY | oauth2-proxy = allow
+/api/signed-service-urls/{namespace} | owned-ns | QUERY | per-key-other-ns = deny
+/api/signed-service-urls/{namespace} | owned-ns | QUERY | per-key-owned-ns = allow
+/api/signed-service-urls/{namespace} | owned-ns | QUERY | spa = allow
+/api/signed-service-urls/{namespace} | owned-ns | QUERY | user-key = allow
+/api/signed-service-urls/{namespace} | owned-ns | QUERY | user-key-verified = allow
+/api/signed-service-urls/{namespace} | unreachable-ns | DELETE | admin-spa = error
+/api/signed-service-urls/{namespace} | unreachable-ns | DELETE | cua-cli = error
+/api/signed-service-urls/{namespace} | unreachable-ns | DELETE | dcr-client = error
+/api/signed-service-urls/{namespace} | unreachable-ns | DELETE | empty-sub = deny
+/api/signed-service-urls/{namespace} | unreachable-ns | DELETE | github-oidc = deny
+/api/signed-service-urls/{namespace} | unreachable-ns | DELETE | oauth2-proxy = error
+/api/signed-service-urls/{namespace} | unreachable-ns | DELETE | per-key-other-ns = deny
+/api/signed-service-urls/{namespace} | unreachable-ns | DELETE | per-key-owned-ns = deny
+/api/signed-service-urls/{namespace} | unreachable-ns | DELETE | spa = error
+/api/signed-service-urls/{namespace} | unreachable-ns | DELETE | user-key = error
+/api/signed-service-urls/{namespace} | unreachable-ns | DELETE | user-key-verified = error
+/api/signed-service-urls/{namespace} | unreachable-ns | GET | admin-spa = error
+/api/signed-service-urls/{namespace} | unreachable-ns | GET | cua-cli = error
+/api/signed-service-urls/{namespace} | unreachable-ns | GET | dcr-client = error
+/api/signed-service-urls/{namespace} | unreachable-ns | GET | empty-sub = deny
+/api/signed-service-urls/{namespace} | unreachable-ns | GET | github-oidc = deny
+/api/signed-service-urls/{namespace} | unreachable-ns | GET | oauth2-proxy = error
+/api/signed-service-urls/{namespace} | unreachable-ns | GET | per-key-other-ns = deny
+/api/signed-service-urls/{namespace} | unreachable-ns | GET | per-key-owned-ns = deny
+/api/signed-service-urls/{namespace} | unreachable-ns | GET | spa = error
+/api/signed-service-urls/{namespace} | unreachable-ns | GET | user-key = error
+/api/signed-service-urls/{namespace} | unreachable-ns | GET | user-key-verified = error
+/api/signed-service-urls/{namespace} | unreachable-ns | PATCH | admin-spa = error
+/api/signed-service-urls/{namespace} | unreachable-ns | PATCH | cua-cli = error
+/api/signed-service-urls/{namespace} | unreachable-ns | PATCH | dcr-client = error
+/api/signed-service-urls/{namespace} | unreachable-ns | PATCH | empty-sub = deny
+/api/signed-service-urls/{namespace} | unreachable-ns | PATCH | github-oidc = deny
+/api/signed-service-urls/{namespace} | unreachable-ns | PATCH | oauth2-proxy = error
+/api/signed-service-urls/{namespace} | unreachable-ns | PATCH | per-key-other-ns = deny
+/api/signed-service-urls/{namespace} | unreachable-ns | PATCH | per-key-owned-ns = deny
+/api/signed-service-urls/{namespace} | unreachable-ns | PATCH | spa = error
+/api/signed-service-urls/{namespace} | unreachable-ns | PATCH | user-key = error
+/api/signed-service-urls/{namespace} | unreachable-ns | PATCH | user-key-verified = error
+/api/signed-service-urls/{namespace} | unreachable-ns | POST | admin-spa = error
+/api/signed-service-urls/{namespace} | unreachable-ns | POST | cua-cli = error
+/api/signed-service-urls/{namespace} | unreachable-ns | POST | dcr-client = error
+/api/signed-service-urls/{namespace} | unreachable-ns | POST | empty-sub = deny
+/api/signed-service-urls/{namespace} | unreachable-ns | POST | github-oidc = deny
+/api/signed-service-urls/{namespace} | unreachable-ns | POST | oauth2-proxy = error
+/api/signed-service-urls/{namespace} | unreachable-ns | POST | per-key-other-ns = deny
+/api/signed-service-urls/{namespace} | unreachable-ns | POST | per-key-owned-ns = deny
+/api/signed-service-urls/{namespace} | unreachable-ns | POST | spa = error
+/api/signed-service-urls/{namespace} | unreachable-ns | POST | user-key = error
+/api/signed-service-urls/{namespace} | unreachable-ns | POST | user-key-verified = error
+/api/signed-service-urls/{namespace} | unreachable-ns | QUERY | admin-spa = error
+/api/signed-service-urls/{namespace} | unreachable-ns | QUERY | cua-cli = error
+/api/signed-service-urls/{namespace} | unreachable-ns | QUERY | dcr-client = error
+/api/signed-service-urls/{namespace} | unreachable-ns | QUERY | empty-sub = deny
+/api/signed-service-urls/{namespace} | unreachable-ns | QUERY | github-oidc = deny
+/api/signed-service-urls/{namespace} | unreachable-ns | QUERY | oauth2-proxy = error
+/api/signed-service-urls/{namespace} | unreachable-ns | QUERY | per-key-other-ns = deny
+/api/signed-service-urls/{namespace} | unreachable-ns | QUERY | per-key-owned-ns = deny
+/api/signed-service-urls/{namespace} | unreachable-ns | QUERY | spa = error
+/api/signed-service-urls/{namespace} | unreachable-ns | QUERY | user-key = error
+/api/signed-service-urls/{namespace} | unreachable-ns | QUERY | user-key-verified = error
+/api/signed-service-urls/{namespace}/{id} | empty-id | DELETE | admin-spa = deny
+/api/signed-service-urls/{namespace}/{id} | empty-id | DELETE | cua-cli = deny
+/api/signed-service-urls/{namespace}/{id} | empty-id | DELETE | dcr-client = deny
+/api/signed-service-urls/{namespace}/{id} | empty-id | DELETE | empty-sub = deny
+/api/signed-service-urls/{namespace}/{id} | empty-id | DELETE | github-oidc = deny
+/api/signed-service-urls/{namespace}/{id} | empty-id | DELETE | oauth2-proxy = deny
+/api/signed-service-urls/{namespace}/{id} | empty-id | DELETE | per-key-other-ns = deny
+/api/signed-service-urls/{namespace}/{id} | empty-id | DELETE | per-key-owned-ns = deny
+/api/signed-service-urls/{namespace}/{id} | empty-id | DELETE | spa = deny
+/api/signed-service-urls/{namespace}/{id} | empty-id | DELETE | user-key = deny
+/api/signed-service-urls/{namespace}/{id} | empty-id | DELETE | user-key-verified = deny
+/api/signed-service-urls/{namespace}/{id} | empty-id | GET | admin-spa = deny
+/api/signed-service-urls/{namespace}/{id} | empty-id | GET | cua-cli = deny
+/api/signed-service-urls/{namespace}/{id} | empty-id | GET | dcr-client = deny
+/api/signed-service-urls/{namespace}/{id} | empty-id | GET | empty-sub = deny
+/api/signed-service-urls/{namespace}/{id} | empty-id | GET | github-oidc = deny
+/api/signed-service-urls/{namespace}/{id} | empty-id | GET | oauth2-proxy = deny
+/api/signed-service-urls/{namespace}/{id} | empty-id | GET | per-key-other-ns = deny
+/api/signed-service-urls/{namespace}/{id} | empty-id | GET | per-key-owned-ns = deny
+/api/signed-service-urls/{namespace}/{id} | empty-id | GET | spa = deny
+/api/signed-service-urls/{namespace}/{id} | empty-id | GET | user-key = deny
+/api/signed-service-urls/{namespace}/{id} | empty-id | GET | user-key-verified = deny
+/api/signed-service-urls/{namespace}/{id} | empty-id | PATCH | admin-spa = deny
+/api/signed-service-urls/{namespace}/{id} | empty-id | PATCH | cua-cli = deny
+/api/signed-service-urls/{namespace}/{id} | empty-id | PATCH | dcr-client = deny
+/api/signed-service-urls/{namespace}/{id} | empty-id | PATCH | empty-sub = deny
+/api/signed-service-urls/{namespace}/{id} | empty-id | PATCH | github-oidc = deny
+/api/signed-service-urls/{namespace}/{id} | empty-id | PATCH | oauth2-proxy = deny
+/api/signed-service-urls/{namespace}/{id} | empty-id | PATCH | per-key-other-ns = deny
+/api/signed-service-urls/{namespace}/{id} | empty-id | PATCH | per-key-owned-ns = deny
+/api/signed-service-urls/{namespace}/{id} | empty-id | PATCH | spa = deny
+/api/signed-service-urls/{namespace}/{id} | empty-id | PATCH | user-key = deny
+/api/signed-service-urls/{namespace}/{id} | empty-id | PATCH | user-key-verified = deny
+/api/signed-service-urls/{namespace}/{id} | empty-id | POST | admin-spa = deny
+/api/signed-service-urls/{namespace}/{id} | empty-id | POST | cua-cli = deny
+/api/signed-service-urls/{namespace}/{id} | empty-id | POST | dcr-client = deny
+/api/signed-service-urls/{namespace}/{id} | empty-id | POST | empty-sub = deny
+/api/signed-service-urls/{namespace}/{id} | empty-id | POST | github-oidc = deny
+/api/signed-service-urls/{namespace}/{id} | empty-id | POST | oauth2-proxy = deny
+/api/signed-service-urls/{namespace}/{id} | empty-id | POST | per-key-other-ns = deny
+/api/signed-service-urls/{namespace}/{id} | empty-id | POST | per-key-owned-ns = deny
+/api/signed-service-urls/{namespace}/{id} | empty-id | POST | spa = deny
+/api/signed-service-urls/{namespace}/{id} | empty-id | POST | user-key = deny
+/api/signed-service-urls/{namespace}/{id} | empty-id | POST | user-key-verified = deny
+/api/signed-service-urls/{namespace}/{id} | empty-id | QUERY | admin-spa = deny
+/api/signed-service-urls/{namespace}/{id} | empty-id | QUERY | cua-cli = deny
+/api/signed-service-urls/{namespace}/{id} | empty-id | QUERY | dcr-client = deny
+/api/signed-service-urls/{namespace}/{id} | empty-id | QUERY | empty-sub = deny
+/api/signed-service-urls/{namespace}/{id} | empty-id | QUERY | github-oidc = deny
+/api/signed-service-urls/{namespace}/{id} | empty-id | QUERY | oauth2-proxy = deny
+/api/signed-service-urls/{namespace}/{id} | empty-id | QUERY | per-key-other-ns = deny
+/api/signed-service-urls/{namespace}/{id} | empty-id | QUERY | per-key-owned-ns = deny
+/api/signed-service-urls/{namespace}/{id} | empty-id | QUERY | spa = deny
+/api/signed-service-urls/{namespace}/{id} | empty-id | QUERY | user-key = deny
+/api/signed-service-urls/{namespace}/{id} | empty-id | QUERY | user-key-verified = deny
+/api/signed-service-urls/{namespace}/{id} | other-ns | DELETE | admin-spa = deny
+/api/signed-service-urls/{namespace}/{id} | other-ns | DELETE | cua-cli = deny
+/api/signed-service-urls/{namespace}/{id} | other-ns | DELETE | dcr-client = deny
+/api/signed-service-urls/{namespace}/{id} | other-ns | DELETE | empty-sub = deny
+/api/signed-service-urls/{namespace}/{id} | other-ns | DELETE | github-oidc = deny
+/api/signed-service-urls/{namespace}/{id} | other-ns | DELETE | oauth2-proxy = deny
+/api/signed-service-urls/{namespace}/{id} | other-ns | DELETE | per-key-other-ns = deny
+/api/signed-service-urls/{namespace}/{id} | other-ns | DELETE | per-key-owned-ns = deny
+/api/signed-service-urls/{namespace}/{id} | other-ns | DELETE | spa = deny
+/api/signed-service-urls/{namespace}/{id} | other-ns | DELETE | user-key = deny
+/api/signed-service-urls/{namespace}/{id} | other-ns | DELETE | user-key-verified = deny
+/api/signed-service-urls/{namespace}/{id} | other-ns | GET | admin-spa = deny
+/api/signed-service-urls/{namespace}/{id} | other-ns | GET | cua-cli = deny
+/api/signed-service-urls/{namespace}/{id} | other-ns | GET | dcr-client = deny
+/api/signed-service-urls/{namespace}/{id} | other-ns | GET | empty-sub = deny
+/api/signed-service-urls/{namespace}/{id} | other-ns | GET | github-oidc = deny
+/api/signed-service-urls/{namespace}/{id} | other-ns | GET | oauth2-proxy = deny
+/api/signed-service-urls/{namespace}/{id} | other-ns | GET | per-key-other-ns = deny
+/api/signed-service-urls/{namespace}/{id} | other-ns | GET | per-key-owned-ns = deny
+/api/signed-service-urls/{namespace}/{id} | other-ns | GET | spa = deny
+/api/signed-service-urls/{namespace}/{id} | other-ns | GET | user-key = deny
+/api/signed-service-urls/{namespace}/{id} | other-ns | GET | user-key-verified = deny
+/api/signed-service-urls/{namespace}/{id} | other-ns | PATCH | admin-spa = deny
+/api/signed-service-urls/{namespace}/{id} | other-ns | PATCH | cua-cli = deny
+/api/signed-service-urls/{namespace}/{id} | other-ns | PATCH | dcr-client = deny
+/api/signed-service-urls/{namespace}/{id} | other-ns | PATCH | empty-sub = deny
+/api/signed-service-urls/{namespace}/{id} | other-ns | PATCH | github-oidc = deny
+/api/signed-service-urls/{namespace}/{id} | other-ns | PATCH | oauth2-proxy = deny
+/api/signed-service-urls/{namespace}/{id} | other-ns | PATCH | per-key-other-ns = deny
+/api/signed-service-urls/{namespace}/{id} | other-ns | PATCH | per-key-owned-ns = deny
+/api/signed-service-urls/{namespace}/{id} | other-ns | PATCH | spa = deny
+/api/signed-service-urls/{namespace}/{id} | other-ns | PATCH | user-key = deny
+/api/signed-service-urls/{namespace}/{id} | other-ns | PATCH | user-key-verified = deny
+/api/signed-service-urls/{namespace}/{id} | other-ns | POST | admin-spa = deny
+/api/signed-service-urls/{namespace}/{id} | other-ns | POST | cua-cli = deny
+/api/signed-service-urls/{namespace}/{id} | other-ns | POST | dcr-client = deny
+/api/signed-service-urls/{namespace}/{id} | other-ns | POST | empty-sub = deny
+/api/signed-service-urls/{namespace}/{id} | other-ns | POST | github-oidc = deny
+/api/signed-service-urls/{namespace}/{id} | other-ns | POST | oauth2-proxy = deny
+/api/signed-service-urls/{namespace}/{id} | other-ns | POST | per-key-other-ns = deny
+/api/signed-service-urls/{namespace}/{id} | other-ns | POST | per-key-owned-ns = deny
+/api/signed-service-urls/{namespace}/{id} | other-ns | POST | spa = deny
+/api/signed-service-urls/{namespace}/{id} | other-ns | POST | user-key = deny
+/api/signed-service-urls/{namespace}/{id} | other-ns | POST | user-key-verified = deny
+/api/signed-service-urls/{namespace}/{id} | other-ns | QUERY | admin-spa = deny
+/api/signed-service-urls/{namespace}/{id} | other-ns | QUERY | cua-cli = deny
+/api/signed-service-urls/{namespace}/{id} | other-ns | QUERY | dcr-client = deny
+/api/signed-service-urls/{namespace}/{id} | other-ns | QUERY | empty-sub = deny
+/api/signed-service-urls/{namespace}/{id} | other-ns | QUERY | github-oidc = deny
+/api/signed-service-urls/{namespace}/{id} | other-ns | QUERY | oauth2-proxy = deny
+/api/signed-service-urls/{namespace}/{id} | other-ns | QUERY | per-key-other-ns = deny
+/api/signed-service-urls/{namespace}/{id} | other-ns | QUERY | per-key-owned-ns = deny
+/api/signed-service-urls/{namespace}/{id} | other-ns | QUERY | spa = deny
+/api/signed-service-urls/{namespace}/{id} | other-ns | QUERY | user-key = deny
+/api/signed-service-urls/{namespace}/{id} | other-ns | QUERY | user-key-verified = deny
+/api/signed-service-urls/{namespace}/{id} | owned-ns | DELETE | admin-spa = allow
+/api/signed-service-urls/{namespace}/{id} | owned-ns | DELETE | cua-cli = allow
+/api/signed-service-urls/{namespace}/{id} | owned-ns | DELETE | dcr-client = allow
+/api/signed-service-urls/{namespace}/{id} | owned-ns | DELETE | empty-sub = deny
+/api/signed-service-urls/{namespace}/{id} | owned-ns | DELETE | github-oidc = allow
+/api/signed-service-urls/{namespace}/{id} | owned-ns | DELETE | oauth2-proxy = allow
+/api/signed-service-urls/{namespace}/{id} | owned-ns | DELETE | per-key-other-ns = deny
+/api/signed-service-urls/{namespace}/{id} | owned-ns | DELETE | per-key-owned-ns = allow
+/api/signed-service-urls/{namespace}/{id} | owned-ns | DELETE | spa = allow
+/api/signed-service-urls/{namespace}/{id} | owned-ns | DELETE | user-key = allow
+/api/signed-service-urls/{namespace}/{id} | owned-ns | DELETE | user-key-verified = allow
+/api/signed-service-urls/{namespace}/{id} | owned-ns | GET | admin-spa = allow
+/api/signed-service-urls/{namespace}/{id} | owned-ns | GET | cua-cli = allow
+/api/signed-service-urls/{namespace}/{id} | owned-ns | GET | dcr-client = allow
+/api/signed-service-urls/{namespace}/{id} | owned-ns | GET | empty-sub = deny
+/api/signed-service-urls/{namespace}/{id} | owned-ns | GET | github-oidc = allow
+/api/signed-service-urls/{namespace}/{id} | owned-ns | GET | oauth2-proxy = allow
+/api/signed-service-urls/{namespace}/{id} | owned-ns | GET | per-key-other-ns = deny
+/api/signed-service-urls/{namespace}/{id} | owned-ns | GET | per-key-owned-ns = allow
+/api/signed-service-urls/{namespace}/{id} | owned-ns | GET | spa = allow
+/api/signed-service-urls/{namespace}/{id} | owned-ns | GET | user-key = allow
+/api/signed-service-urls/{namespace}/{id} | owned-ns | GET | user-key-verified = allow
+/api/signed-service-urls/{namespace}/{id} | owned-ns | PATCH | admin-spa = allow
+/api/signed-service-urls/{namespace}/{id} | owned-ns | PATCH | cua-cli = allow
+/api/signed-service-urls/{namespace}/{id} | owned-ns | PATCH | dcr-client = allow
+/api/signed-service-urls/{namespace}/{id} | owned-ns | PATCH | empty-sub = deny
+/api/signed-service-urls/{namespace}/{id} | owned-ns | PATCH | github-oidc = allow
+/api/signed-service-urls/{namespace}/{id} | owned-ns | PATCH | oauth2-proxy = allow
+/api/signed-service-urls/{namespace}/{id} | owned-ns | PATCH | per-key-other-ns = deny
+/api/signed-service-urls/{namespace}/{id} | owned-ns | PATCH | per-key-owned-ns = allow
+/api/signed-service-urls/{namespace}/{id} | owned-ns | PATCH | spa = allow
+/api/signed-service-urls/{namespace}/{id} | owned-ns | PATCH | user-key = allow
+/api/signed-service-urls/{namespace}/{id} | owned-ns | PATCH | user-key-verified = allow
+/api/signed-service-urls/{namespace}/{id} | owned-ns | POST | admin-spa = allow
+/api/signed-service-urls/{namespace}/{id} | owned-ns | POST | cua-cli = allow
+/api/signed-service-urls/{namespace}/{id} | owned-ns | POST | dcr-client = allow
+/api/signed-service-urls/{namespace}/{id} | owned-ns | POST | empty-sub = deny
+/api/signed-service-urls/{namespace}/{id} | owned-ns | POST | github-oidc = allow
+/api/signed-service-urls/{namespace}/{id} | owned-ns | POST | oauth2-proxy = allow
+/api/signed-service-urls/{namespace}/{id} | owned-ns | POST | per-key-other-ns = deny
+/api/signed-service-urls/{namespace}/{id} | owned-ns | POST | per-key-owned-ns = allow
+/api/signed-service-urls/{namespace}/{id} | owned-ns | POST | spa = allow
+/api/signed-service-urls/{namespace}/{id} | owned-ns | POST | user-key = allow
+/api/signed-service-urls/{namespace}/{id} | owned-ns | POST | user-key-verified = allow
+/api/signed-service-urls/{namespace}/{id} | owned-ns | QUERY | admin-spa = allow
+/api/signed-service-urls/{namespace}/{id} | owned-ns | QUERY | cua-cli = allow
+/api/signed-service-urls/{namespace}/{id} | owned-ns | QUERY | dcr-client = allow
+/api/signed-service-urls/{namespace}/{id} | owned-ns | QUERY | empty-sub = deny
+/api/signed-service-urls/{namespace}/{id} | owned-ns | QUERY | github-oidc = allow
+/api/signed-service-urls/{namespace}/{id} | owned-ns | QUERY | oauth2-proxy = allow
+/api/signed-service-urls/{namespace}/{id} | owned-ns | QUERY | per-key-other-ns = deny
+/api/signed-service-urls/{namespace}/{id} | owned-ns | QUERY | per-key-owned-ns = allow
+/api/signed-service-urls/{namespace}/{id} | owned-ns | QUERY | spa = allow
+/api/signed-service-urls/{namespace}/{id} | owned-ns | QUERY | user-key = allow
+/api/signed-service-urls/{namespace}/{id} | owned-ns | QUERY | user-key-verified = allow
+/api/signed-service-urls/{namespace}/{id} | unreachable-ns | DELETE | admin-spa = error
+/api/signed-service-urls/{namespace}/{id} | unreachable-ns | DELETE | cua-cli = error
+/api/signed-service-urls/{namespace}/{id} | unreachable-ns | DELETE | dcr-client = error
+/api/signed-service-urls/{namespace}/{id} | unreachable-ns | DELETE | empty-sub = deny
+/api/signed-service-urls/{namespace}/{id} | unreachable-ns | DELETE | github-oidc = deny
+/api/signed-service-urls/{namespace}/{id} | unreachable-ns | DELETE | oauth2-proxy = error
+/api/signed-service-urls/{namespace}/{id} | unreachable-ns | DELETE | per-key-other-ns = deny
+/api/signed-service-urls/{namespace}/{id} | unreachable-ns | DELETE | per-key-owned-ns = deny
+/api/signed-service-urls/{namespace}/{id} | unreachable-ns | DELETE | spa = error
+/api/signed-service-urls/{namespace}/{id} | unreachable-ns | DELETE | user-key = error
+/api/signed-service-urls/{namespace}/{id} | unreachable-ns | DELETE | user-key-verified = error
+/api/signed-service-urls/{namespace}/{id} | unreachable-ns | GET | admin-spa = error
+/api/signed-service-urls/{namespace}/{id} | unreachable-ns | GET | cua-cli = error
+/api/signed-service-urls/{namespace}/{id} | unreachable-ns | GET | dcr-client = error
+/api/signed-service-urls/{namespace}/{id} | unreachable-ns | GET | empty-sub = deny
+/api/signed-service-urls/{namespace}/{id} | unreachable-ns | GET | github-oidc = deny
+/api/signed-service-urls/{namespace}/{id} | unreachable-ns | GET | oauth2-proxy = error
+/api/signed-service-urls/{namespace}/{id} | unreachable-ns | GET | per-key-other-ns = deny
+/api/signed-service-urls/{namespace}/{id} | unreachable-ns | GET | per-key-owned-ns = deny
+/api/signed-service-urls/{namespace}/{id} | unreachable-ns | GET | spa = error
+/api/signed-service-urls/{namespace}/{id} | unreachable-ns | GET | user-key = error
+/api/signed-service-urls/{namespace}/{id} | unreachable-ns | GET | user-key-verified = error
+/api/signed-service-urls/{namespace}/{id} | unreachable-ns | PATCH | admin-spa = error
+/api/signed-service-urls/{namespace}/{id} | unreachable-ns | PATCH | cua-cli = error
+/api/signed-service-urls/{namespace}/{id} | unreachable-ns | PATCH | dcr-client = error
+/api/signed-service-urls/{namespace}/{id} | unreachable-ns | PATCH | empty-sub = deny
+/api/signed-service-urls/{namespace}/{id} | unreachable-ns | PATCH | github-oidc = deny
+/api/signed-service-urls/{namespace}/{id} | unreachable-ns | PATCH | oauth2-proxy = error
+/api/signed-service-urls/{namespace}/{id} | unreachable-ns | PATCH | per-key-other-ns = deny
+/api/signed-service-urls/{namespace}/{id} | unreachable-ns | PATCH | per-key-owned-ns = deny
+/api/signed-service-urls/{namespace}/{id} | unreachable-ns | PATCH | spa = error
+/api/signed-service-urls/{namespace}/{id} | unreachable-ns | PATCH | user-key = error
+/api/signed-service-urls/{namespace}/{id} | unreachable-ns | PATCH | user-key-verified = error
+/api/signed-service-urls/{namespace}/{id} | unreachable-ns | POST | admin-spa = error
+/api/signed-service-urls/{namespace}/{id} | unreachable-ns | POST | cua-cli = error
+/api/signed-service-urls/{namespace}/{id} | unreachable-ns | POST | dcr-client = error
+/api/signed-service-urls/{namespace}/{id} | unreachable-ns | POST | empty-sub = deny
+/api/signed-service-urls/{namespace}/{id} | unreachable-ns | POST | github-oidc = deny
+/api/signed-service-urls/{namespace}/{id} | unreachable-ns | POST | oauth2-proxy = error
+/api/signed-service-urls/{namespace}/{id} | unreachable-ns | POST | per-key-other-ns = deny
+/api/signed-service-urls/{namespace}/{id} | unreachable-ns | POST | per-key-owned-ns = deny
+/api/signed-service-urls/{namespace}/{id} | unreachable-ns | POST | spa = error
+/api/signed-service-urls/{namespace}/{id} | unreachable-ns | POST | user-key = error
+/api/signed-service-urls/{namespace}/{id} | unreachable-ns | POST | user-key-verified = error
+/api/signed-service-urls/{namespace}/{id} | unreachable-ns | QUERY | admin-spa = error
+/api/signed-service-urls/{namespace}/{id} | unreachable-ns | QUERY | cua-cli = error
+/api/signed-service-urls/{namespace}/{id} | unreachable-ns | QUERY | dcr-client = error
+/api/signed-service-urls/{namespace}/{id} | unreachable-ns | QUERY | empty-sub = deny
+/api/signed-service-urls/{namespace}/{id} | unreachable-ns | QUERY | github-oidc = deny
+/api/signed-service-urls/{namespace}/{id} | unreachable-ns | QUERY | oauth2-proxy = error
+/api/signed-service-urls/{namespace}/{id} | unreachable-ns | QUERY | per-key-other-ns = deny
+/api/signed-service-urls/{namespace}/{id} | unreachable-ns | QUERY | per-key-owned-ns = deny
+/api/signed-service-urls/{namespace}/{id} | unreachable-ns | QUERY | spa = error
+/api/signed-service-urls/{namespace}/{id} | unreachable-ns | QUERY | user-key = error
+/api/signed-service-urls/{namespace}/{id} | unreachable-ns | QUERY | user-key-verified = error
/api/state/query | plain | DELETE | admin-spa = deny
/api/state/query | plain | DELETE | cua-cli = deny
/api/state/query | plain | DELETE | dcr-client = deny
diff --git a/libs/fleet/backend/auth/testdata/signed-service-urls-route-plan.txt b/libs/fleet/backend/auth/testdata/signed-service-urls-route-plan.txt
new file mode 100644
index 0000000000..7af5a1d015
--- /dev/null
+++ b/libs/fleet/backend/auth/testdata/signed-service-urls-route-plan.txt
@@ -0,0 +1,8 @@
+All
+ Leaf query=data.authz_base.allow source=registered:authz-base
+ Leaf query=data.authz_signed_service_urls.allow source=multi["registered:authz","registered:authz-signed-service-urls"]
+ Any
+ Leaf query=data.authz_ownership.claim_allow source=multi["registered:authz","registered:authz-ownership"]
+ All
+ Leaf query=data.authz_ownership.probe_eligible source=multi["registered:authz","registered:authz-ownership"]
+ Leaf query=data.authz_ownership.rbac_allow source=multi["registered:authz","registered:authz-ownership"] facts=namespace_rbac@registered-facts:namespace-rbac
diff --git a/libs/fleet/backend/auth/user.go b/libs/fleet/backend/auth/user.go
index aba8aad3ba..cb9ec899e2 100644
--- a/libs/fleet/backend/auth/user.go
+++ b/libs/fleet/backend/auth/user.go
@@ -10,6 +10,7 @@ type User struct {
Email string
EmailVerified bool
AZP string // authorized party = client_id of the token issuer
+ KeyClientPfx string // configured per-key client-id prefix, passed to OPA with the request
Namespace string // hardcoded-claim mapper on per-key clients
Groups []string // groups for K8s impersonation (populated from user_groups claim for ukey- tokens)
Claims map[string]string
diff --git a/libs/fleet/backend/config/config.go b/libs/fleet/backend/config/config.go
index 73ea36df72..20749773c6 100644
--- a/libs/fleet/backend/config/config.go
+++ b/libs/fleet/backend/config/config.go
@@ -12,6 +12,7 @@
package config
import (
+ "crypto/sha256"
"fmt"
"net/url"
"regexp"
@@ -38,6 +39,7 @@ type Configuration struct {
Telemetry TelemetryConfiguration
Usage UsageConfiguration
ProductAnalytics ProductAnalyticsConfiguration
+ SignedServiceURL SignedServiceURLConfiguration
}
type WebServerConfiguration struct {
@@ -97,8 +99,8 @@ type StripeConfiguration struct {
PortalReturnURL string
}
-// DatabaseConfiguration drives the Postgres-backed stores (currently the
-// GitHub OIDC trust policies). An empty URL disables those routes (503),
+// DatabaseConfiguration drives the Postgres-backed stores, including GitHub
+// OIDC trust policies and signed service URLs. An empty URL disables those routes (503),
// keeping the backend bootable without a database — see CUA-675.
type DatabaseConfiguration struct {
URL string // DATABASE_URL — application database and GitHub trust-policy storage
@@ -112,6 +114,16 @@ type ChatConfiguration struct {
Model string
}
+// SignedServiceURLConfiguration enables database-backed signed capability
+// URLs. A base URL and HMAC secret from either the environment or SecretFile
+// are required; leaving every value empty disables only this feature so
+// deployments can roll out its Secret independently.
+type SignedServiceURLConfiguration struct {
+ BaseURL string // SIGNED_SERVICE_URL_BASE_URL — trusted external HTTPS origin
+ Secret string // SIGNED_SERVICE_URL_SECRET — HMAC key, never logged
+ SecretFile string // SIGNED_SERVICE_URL_SECRET_FILE — optional path to the HMAC key
+}
+
// UsageConfiguration enables the usage provider only when DatabaseURL is set.
// Query transport settings may be present before the usage credential arrives;
// in that state the provider remains disabled so serving readiness is unaffected.
@@ -207,6 +219,9 @@ var specs = []flagSpec{
{"stripe.checkout-success-url", "stripe-checkout-success-url", "STRIPE_CHECKOUT_SUCCESS_URL", "", "Stripe Checkout success redirect URL"},
{"stripe.checkout-cancel-url", "stripe-checkout-cancel-url", "STRIPE_CHECKOUT_CANCEL_URL", "", "Stripe Checkout cancel redirect URL"},
{"stripe.portal-return-url", "stripe-portal-return-url", "STRIPE_PORTAL_RETURN_URL", "", "Stripe Billing Portal return URL"},
+ {"signed-service-url.base-url", "signed-service-url-base-url", "SIGNED_SERVICE_URL_BASE_URL", "", "Trusted external HTTPS origin for signed sandbox service URLs"},
+ {"signed-service-url.secret", "signed-service-url-secret", "SIGNED_SERVICE_URL_SECRET", "", "HMAC secret for signed sandbox service URLs"},
+ {"signed-service-url.secret-file", "signed-service-url-secret-file", "SIGNED_SERVICE_URL_SECRET_FILE", "", "Optional path to the signed sandbox service URL HMAC secret"},
{"chat.base-url", "litellm-base-url", "LITELLM_BASE_URL", "", "LiteLLM OpenAI-compatible base URL"},
{"chat.api-key", "litellm-api-key", "LITELLM_API_KEY", "", "LiteLLM virtual key"},
{"chat.model", "litellm-model", "LITELLM_MODEL", "large", "LiteLLM model alias"},
@@ -325,6 +340,11 @@ func LoadConfig() (*Configuration, error) {
APIKey: viper.GetString("chat.api-key"),
Model: viper.GetString("chat.model"),
},
+ SignedServiceURL: SignedServiceURLConfiguration{
+ BaseURL: strings.TrimRight(strings.TrimSpace(viper.GetString("signed-service-url.base-url")), "/"),
+ Secret: viper.GetString("signed-service-url.secret"),
+ SecretFile: strings.TrimSpace(viper.GetString("signed-service-url.secret-file")),
+ },
Usage: UsageConfiguration{
DatabaseURL: strings.TrimSpace(viper.GetString("usage.database-url")),
QueryWebhookURL: strings.TrimSpace(viper.GetString("usage.query-webhook-url")),
@@ -361,12 +381,38 @@ func LoadConfig() (*Configuration, error) {
if (cfg.Chat.BaseURL == "") != (cfg.Chat.APIKey == "") {
return nil, fmt.Errorf("chat configuration requires both LITELLM_BASE_URL and LITELLM_API_KEY")
}
+ if err := validateSignedServiceURLConfiguration(cfg.SignedServiceURL); err != nil {
+ return nil, err
+ }
if err := validateUsageConfiguration(cfg.Usage); err != nil {
return nil, err
}
return cfg, nil
}
+func validateSignedServiceURLConfiguration(cfg SignedServiceURLConfiguration) error {
+ if cfg.BaseURL == "" {
+ if cfg.Secret != "" {
+ return fmt.Errorf("SIGNED_SERVICE_URL_SECRET requires SIGNED_SERVICE_URL_BASE_URL")
+ }
+ if cfg.SecretFile != "" {
+ return fmt.Errorf("SIGNED_SERVICE_URL_SECRET_FILE requires SIGNED_SERVICE_URL_BASE_URL")
+ }
+ return nil
+ }
+ parsed, err := url.Parse(cfg.BaseURL)
+ if err != nil {
+ return newSanitizedError("invalid SIGNED_SERVICE_URL_BASE_URL", err)
+ }
+ if parsed.Scheme != "https" || parsed.Host == "" || parsed.User != nil || parsed.RawQuery != "" || parsed.Fragment != "" || (parsed.Path != "" && parsed.Path != "/") || (parsed.RawPath != "" && parsed.RawPath != "/") {
+ return fmt.Errorf("SIGNED_SERVICE_URL_BASE_URL must be a bare HTTPS origin")
+ }
+ if cfg.Secret != "" && len([]byte(cfg.Secret)) < sha256.Size {
+ return fmt.Errorf("SIGNED_SERVICE_URL_SECRET must be at least %d bytes", sha256.Size)
+ }
+ return nil
+}
+
func validateUsageConfiguration(cfg UsageConfiguration) error {
if cfg.QueryTimeout < minUsageQueryTimeout || cfg.QueryTimeout > maxUsageQueryTimeout {
return fmt.Errorf("USAGE_QUERY_TIMEOUT must be between 1s and 2m")
diff --git a/libs/fleet/backend/config/config_test.go b/libs/fleet/backend/config/config_test.go
index d47fc6facf..8a9104b59e 100644
--- a/libs/fleet/backend/config/config_test.go
+++ b/libs/fleet/backend/config/config_test.go
@@ -123,6 +123,7 @@ func unsetEnv(t *testing.T, key string) {
}
_ = os.Unsetenv(key)
})
+
}
func loadGitHubOIDCTestConfig(t *testing.T) *Configuration {
@@ -347,3 +348,106 @@ func TestLoadConfig_ProductAnalyticsValues(t *testing.T) {
t.Fatalf("ExcludedSubjects = %#v, want %#v", got, want)
}
}
+func loadSignedServiceURLTestConfig(t *testing.T, env map[string]string) (*Configuration, error) {
+ t.Helper()
+ viper.Reset()
+ t.Cleanup(viper.Reset)
+ t.Setenv("KC_ADMIN_CLIENT_SECRET", "secret")
+ for _, key := range []string{"SIGNED_SERVICE_URL_BASE_URL", "SIGNED_SERVICE_URL_SECRET", "SIGNED_SERVICE_URL_SECRET_FILE"} {
+ t.Setenv(key, "")
+ }
+ for key, value := range env {
+ t.Setenv(key, value)
+ }
+ RegisterFlags(pflag.NewFlagSet("signed-service-url-test", pflag.ContinueOnError))
+ return LoadConfig()
+}
+
+func TestLoadConfig_SignedServiceURLConfiguration(t *testing.T) {
+ const secret = "12345678901234567890123456789012"
+
+ t.Run("validates and normalizes configured values", func(t *testing.T) {
+ cfg, err := loadSignedServiceURLTestConfig(t, map[string]string{
+ "SIGNED_SERVICE_URL_BASE_URL": "https://run.cua.ai/",
+ "SIGNED_SERVICE_URL_SECRET": secret,
+ })
+ if err != nil {
+ t.Fatalf("LoadConfig() error = %v", err)
+ }
+ if got, want := cfg.SignedServiceURL.BaseURL, "https://run.cua.ai"; got != want {
+ t.Fatalf("SignedServiceURL.BaseURL = %q, want %q", got, want)
+ }
+ if got, want := cfg.SignedServiceURL.Secret, secret; got != want {
+ t.Fatalf("SignedServiceURL.Secret = %q, want configured secret", got)
+ }
+ })
+
+ invalidBaseURLs := map[string]string{
+ "HTTP": "http://run.cua.ai",
+ "userinfo": "https://[email protected]",
+ "query": "https://run.cua.ai?source=test",
+ "fragment": "https://run.cua.ai#fragment",
+ "non-root path": "https://run.cua.ai/services",
+ }
+ for name, baseURL := range invalidBaseURLs {
+ t.Run("rejects "+name, func(t *testing.T) {
+ _, err := loadSignedServiceURLTestConfig(t, map[string]string{
+ "SIGNED_SERVICE_URL_BASE_URL": baseURL,
+ "SIGNED_SERVICE_URL_SECRET": secret,
+ })
+ if err == nil || !strings.Contains(err.Error(), "SIGNED_SERVICE_URL_BASE_URL") {
+ t.Fatalf("LoadConfig() error = %v, want invalid base URL error", err)
+ }
+ })
+ }
+
+ for name, env := range map[string]map[string]string{
+ "short secret": {"SIGNED_SERVICE_URL_BASE_URL": "https://run.cua.ai", "SIGNED_SERVICE_URL_SECRET": "too-short"},
+ "missing base URL": {"SIGNED_SERVICE_URL_SECRET": secret},
+ } {
+ t.Run("rejects "+name, func(t *testing.T) {
+ _, err := loadSignedServiceURLTestConfig(t, env)
+ if err == nil || !strings.Contains(err.Error(), "SIGNED_SERVICE_URL") {
+ t.Fatalf("LoadConfig() error = %v, want signed URL configuration error", err)
+ }
+ })
+ }
+
+ t.Run("base URL without secret keeps the feature disabled during rollout", func(t *testing.T) {
+ cfg, err := loadSignedServiceURLTestConfig(t, map[string]string{
+ "SIGNED_SERVICE_URL_BASE_URL": "https://run.cua.ai",
+ })
+ if err != nil {
+ t.Fatalf("LoadConfig() error = %v, want disabled configuration", err)
+ }
+ if got, want := cfg.SignedServiceURL.BaseURL, "https://run.cua.ai"; got != want {
+ t.Fatalf("SignedServiceURL.BaseURL = %q, want %q", got, want)
+ }
+ if cfg.SignedServiceURL.Secret != "" {
+ t.Fatalf("SignedServiceURL.Secret = %q, want empty optional secret", cfg.SignedServiceURL.Secret)
+ }
+ })
+
+ t.Run("accepts a non-sensitive secret file path", func(t *testing.T) {
+ cfg, err := loadSignedServiceURLTestConfig(t, map[string]string{
+ "SIGNED_SERVICE_URL_BASE_URL": "https://run.cua.ai",
+ "SIGNED_SERVICE_URL_SECRET_FILE": "/var/run/signed-service-url/hmac_secret",
+ })
+ if err != nil {
+ t.Fatalf("LoadConfig() error = %v", err)
+ }
+ if got, want := cfg.SignedServiceURL.SecretFile, "/var/run/signed-service-url/hmac_secret"; got != want {
+ t.Fatalf("SignedServiceURL.SecretFile = %q, want %q", got, want)
+ }
+ })
+
+ t.Run("both values absent disables feature", func(t *testing.T) {
+ cfg, err := loadSignedServiceURLTestConfig(t, nil)
+ if err != nil {
+ t.Fatalf("LoadConfig() error = %v, want disabled configuration", err)
+ }
+ if cfg.SignedServiceURL != (SignedServiceURLConfiguration{}) {
+ t.Fatalf("SignedServiceURL = %#v, want zero configuration", cfg.SignedServiceURL)
+ }
+ })
+}
diff --git a/libs/fleet/backend/database/migrations/000011_signed_service_urls.sql b/libs/fleet/backend/database/migrations/000011_signed_service_urls.sql
new file mode 100644
index 0000000000..8aa5fa65dd
--- /dev/null
+++ b/libs/fleet/backend/database/migrations/000011_signed_service_urls.sql
@@ -0,0 +1,25 @@
+CREATE TABLE public.signed_service_urls (
+ id uuid PRIMARY KEY,
+ namespace text NOT NULL CHECK (namespace <> ''),
+ claim_name text NOT NULL CHECK (claim_name <> ''),
+ sandbox_name text NOT NULL CHECK (sandbox_name <> ''),
+ service_name text NOT NULL CHECK (service_name <> ''),
+ logical_service text NOT NULL CHECK (logical_service <> ''),
+ label text CHECK (label IS NULL OR (label <> '' AND octet_length(label) <= 120)),
+ creator_sub text NOT NULL CHECK (creator_sub <> ''),
+ created_at timestamptz NOT NULL,
+ expires_at timestamptz NOT NULL,
+ revoked_at timestamptz,
+ CHECK (expires_at >= created_at + interval '1 minute'),
+ CHECK (expires_at <= created_at + interval '24 hours'),
+ CHECK (revoked_at IS NULL OR revoked_at >= created_at)
+);
+
+CREATE INDEX signed_service_urls_claim_created_idx
+ ON public.signed_service_urls (namespace, claim_name, created_at DESC, id);
+CREATE INDEX signed_service_urls_expiry_idx
+ ON public.signed_service_urls (expires_at)
+ WHERE revoked_at IS NULL;
+
+REVOKE ALL ON TABLE public.signed_service_urls FROM PUBLIC;
+GRANT SELECT, INSERT, UPDATE ON TABLE public.signed_service_urls TO cyclops_app;
diff --git a/libs/fleet/backend/database/migrator_pg_test.go b/libs/fleet/backend/database/migrator_pg_test.go
index 01824f505d..42e1e4b9c9 100644
--- a/libs/fleet/backend/database/migrator_pg_test.go
+++ b/libs/fleet/backend/database/migrator_pg_test.go
@@ -6,6 +6,7 @@ import (
"crypto/rand"
"encoding/hex"
"encoding/json"
+ "errors"
"log/slog"
"net/url"
"os"
@@ -16,6 +17,7 @@ import (
"cyclops-cs-backend/chat"
"github.com/jackc/pgx/v5"
+ "github.com/jackc/pgx/v5/pgconn"
)
const migratorIntegrationOptIn = "CYCLOPS_TEST_DATABASE_MIGRATOR_ISOLATED_CLUSTER"
@@ -86,12 +88,18 @@ func TestInitialMigrationBuildsCompleteDatabase(t *testing.T) {
inspectionURL := maintenanceURLForDatabase(t, maintenanceURL, migrationURL)
assertMigrationOwnerFixture(t, ctx, migrationURL)
assertInitialMigrationRejectsPublicSecurityDefiner(t, ctx, migrationURL, credentials)
- if err := Run(ctx, Config{MigrationURL: migrationURL, Credentials: credentials}); err != nil {
- t.Fatal(err)
+ firstSummary := captureRunSummary(t, func() error {
+ return Run(ctx, Config{MigrationURL: migrationURL, Credentials: credentials})
+ })
+ if firstSummary.Pending != 11 || firstSummary.Applied != 11 {
+ t.Fatalf("initial migration summary = %+v, want pending=11 applied=11", firstSummary)
}
before := migrationLedgerRows(t, ctx, migrationURL)
- if err := Run(ctx, Config{MigrationURL: migrationURL, Credentials: credentials}); err != nil {
- t.Fatalf("second migration run must be a no-op: %v", err)
+ secondSummary := captureRunSummary(t, func() error {
+ return Run(ctx, Config{MigrationURL: migrationURL, Credentials: credentials})
+ })
+ if secondSummary.Pending != 0 || secondSummary.Applied != 0 {
+ t.Fatalf("second migration summary = %+v, want pending=0 applied=0", secondSummary)
}
if after := migrationLedgerRows(t, ctx, migrationURL); !reflect.DeepEqual(after, before) {
t.Fatalf("second migration run changed migration ledger: before=%+v after=%+v", before, after)
@@ -105,6 +113,7 @@ func TestInitialMigrationBuildsCompleteDatabase(t *testing.T) {
assertImplicitCreatorAdminMembership(t, ctx, migrationURL, "billing_meter_owner", bootstrapGrantor)
assertNoQueryBroker(t, ctx, migrationURL)
assertOwnershipAndPublicACLs(t, ctx, inspectionURL, currentRole(t, ctx, migrationURL))
+ assertSignedServiceURLContract(t, ctx, inspectionURL, credentials.Application, currentRole(t, ctx, migrationURL))
assertMetabaseBillingMeterAccess(t, ctx, migrationURL, credentials.Metabase)
assertRLSContract(t, ctx, inspectionURL)
assertSecurityDefinerContract(t, ctx, inspectionURL)
@@ -191,14 +200,14 @@ func TestRunUpgradesVersionOneAndThenNoOps(t *testing.T) {
upgrade := captureRunSummary(t, func() error {
return Run(ctx, Config{MigrationURL: migrationURL, Credentials: credentials})
})
- if upgrade.Current != 1 || upgrade.Target != 10 || upgrade.Pending != 9 || upgrade.Applied != 9 || upgrade.Skipped != 1 || upgrade.Result != "success" {
+ if upgrade.Current != 1 || upgrade.Target != 11 || upgrade.Pending != 10 || upgrade.Applied != 10 || upgrade.Skipped != 1 || upgrade.Result != "success" {
t.Fatalf("version-one upgrade summary = %+v", upgrade)
}
noOp := captureRunSummary(t, func() error {
return Run(ctx, Config{MigrationURL: migrationURL, Credentials: credentials})
})
- if noOp.Current != 10 || noOp.Target != 10 || noOp.Pending != 0 || noOp.Applied != 0 || noOp.Skipped != 10 || noOp.Result != "success" {
+ if noOp.Current != 11 || noOp.Target != 11 || noOp.Pending != 0 || noOp.Applied != 0 || noOp.Skipped != 11 || noOp.Result != "success" {
t.Fatalf("post-upgrade no-op summary = %+v", noOp)
}
}
@@ -1594,8 +1603,8 @@ func migrationLedgerRows(t *testing.T, ctx context.Context, adminURL string) []l
if err := rows.Err(); err != nil {
t.Fatal("iterate migration ledger")
}
- if len(ledger) != 10 {
- t.Fatalf("migration ledger row count = %d, want 10", len(ledger))
+ if len(ledger) != 11 {
+ t.Fatalf("migration ledger row count = %d, want 11", len(ledger))
}
for index, want := range []struct {
version int64
@@ -1611,6 +1620,7 @@ func migrationLedgerRows(t *testing.T, ctx context.Context, adminURL string) []l
{8, "000008_metabase_hourly_reservation_usage_excluding_tenants.sql"},
{9, "000009_extend_metabase_revenue_tenant_exclusions.sql"},
{10, "000010_grant_metabase_billing_meter_access.sql"},
+ {11, "000011_signed_service_urls.sql"},
} {
if ledger[index].Version != want.version || ledger[index].ApplicationOrder != int64(index+1) || ledger[index].Filename != want.filename {
t.Fatalf("migration ledger row %d = version:%d order:%d filename:%q", index, ledger[index].Version, ledger[index].ApplicationOrder, ledger[index].Filename)
@@ -1850,6 +1860,7 @@ func assertOwnershipAndPublicACLs(t *testing.T, ctx context.Context, adminURL, m
for _, want := range []struct{ schema, name, owner string }{
{"public", "github_trust_policies", migrationOwner},
{"public", "chat_conversations", migrationOwner},
+ {"public", "signed_service_urls", migrationOwner},
{"k8s_state", "resource_state", "k8s_state_owner"},
{"k8s_state", "resource_event_outbox", "k8s_state_owner"},
{"k8s_state", "resource_event_outbox_usage_lookup_idx", "k8s_state_owner"},
@@ -1884,11 +1895,88 @@ func assertOwnershipAndPublicACLs(t *testing.T, ctx context.Context, adminURL, m
for _, schema := range []string{"k8s_state", "k8s_api", "k8s_reporting", "cyclops_migrations"} {
assertNoPublicSchemaPrivilege(t, ctx, connection, schema, "USAGE")
}
- for _, relation := range []string{"public.github_trust_policies", "public.chat_conversations", "k8s_state.resource_state", "k8s_state.resource_event_outbox", "k8s_api.current_resources", "k8s_reporting.current_resources", "k8s_reporting.hourly_reservation_usage", "k8s_reporting.hourly_reservation_usage_excluding_tenants", "cyclops_migrations.applied_migrations"} {
+ for _, relation := range []string{"public.github_trust_policies", "public.chat_conversations", "public.signed_service_urls", "k8s_state.resource_state", "k8s_state.resource_event_outbox", "k8s_api.current_resources", "k8s_reporting.current_resources", "k8s_reporting.hourly_reservation_usage", "k8s_reporting.hourly_reservation_usage_excluding_tenants", "cyclops_migrations.applied_migrations"} {
assertNoPublicTablePrivilege(t, ctx, connection, relation)
}
}
+func assertSignedServiceURLContract(t *testing.T, ctx context.Context, inspectionURL, applicationURL, migrationOwner string) {
+ t.Helper()
+ inspection := connect(t, ctx, inspectionURL)
+ defer inspection.Close(ctx)
+ assertRelationOwner(t, inspection, "public", "signed_service_urls", migrationOwner)
+ assertTablePrivileges(t, inspection, "cyclops_app", "public", "signed_service_urls", []string{"SELECT", "INSERT", "UPDATE"})
+
+ application := connect(t, ctx, applicationURL)
+ defer application.Close(ctx)
+ createdAt := time.Date(2026, time.August, 31, 0, 0, 0, 0, time.UTC)
+ insert := func(id string, expiresAt time.Time) error {
+ _, err := application.Exec(ctx, `
+ insert into public.signed_service_urls
+ (id, namespace, claim_name, sandbox_name, service_name, logical_service, label, creator_sub, created_at, expires_at)
+ values ($1, 'tenant-a', 'claim-a', 'sandbox-a', 'service-a', 'desktop', 'Desktop', 'user-a', $2, $3)`,
+ id, createdAt, expiresAt)
+ return err
+ }
+ if err := insert("00000000-0000-0000-0000-000000000001", createdAt.Add(time.Minute)); err != nil {
+ t.Fatalf("insert one-minute signed URL: %v", err)
+ }
+ if err := insert("00000000-0000-0000-0000-000000000002", createdAt.Add(24*time.Hour)); err != nil {
+ t.Fatalf("insert 24-hour signed URL: %v", err)
+ }
+ assertCheckViolation(t, insert("00000000-0000-0000-0000-000000000003", createdAt.Add(59*time.Second)))
+ assertCheckViolation(t, insert("00000000-0000-0000-0000-000000000004", createdAt.Add(24*time.Hour+time.Second)))
+
+ var count int
+ if err := application.QueryRow(ctx, `select count(*) from public.signed_service_urls`).Scan(&count); err != nil || count != 2 {
+ t.Fatalf("signed URL row count = %d, err=%v, want 2", count, err)
+ }
+ if _, err := application.Exec(ctx, `update public.signed_service_urls set revoked_at = $1 where id = $2`, createdAt, "00000000-0000-0000-0000-000000000001"); err != nil {
+ t.Fatalf("revoke signed URL: %v", err)
+ }
+}
+
+func assertRelationOwner(t *testing.T, connection *pgx.Conn, schema, relation, wantOwner string) {
+ t.Helper()
+ var owner string
+ if err := connection.QueryRow(context.Background(), `
+ select relation.relowner::regrole::text
+ from pg_class relation
+ join pg_namespace namespace on namespace.oid = relation.relnamespace
+ where namespace.nspname = $1 and relation.relname = $2`, schema, relation).Scan(&owner); err != nil {
+ t.Fatalf("read owner for %s.%s: %v", schema, relation, err)
+ }
+ if owner != wantOwner {
+ t.Fatalf("owner for %s.%s = %s, want %s", schema, relation, owner, wantOwner)
+ }
+}
+
+func assertTablePrivileges(t *testing.T, connection *pgx.Conn, role, schema, table string, want []string) {
+ t.Helper()
+ qualified := pgx.Identifier{schema, table}.Sanitize()
+ var got []string
+ for _, privilege := range []string{"SELECT", "INSERT", "UPDATE", "DELETE", "TRUNCATE", "REFERENCES", "TRIGGER"} {
+ var allowed bool
+ if err := connection.QueryRow(context.Background(), `select has_table_privilege($1, $2, $3)`, role, qualified, privilege).Scan(&allowed); err != nil {
+ t.Fatalf("read %s privilege for %s on %s: %v", privilege, role, qualified, err)
+ }
+ if allowed {
+ got = append(got, privilege)
+ }
+ }
+ if !reflect.DeepEqual(got, want) {
+ t.Fatalf("table privileges for %s on %s = %v, want %v", role, qualified, got, want)
+ }
+}
+
+func assertCheckViolation(t *testing.T, err error) {
+ t.Helper()
+ var pgError *pgconn.PgError
+ if !errors.As(err, &pgError) || pgError.Code != "23514" {
+ t.Fatalf("insert error = %v, want PostgreSQL check violation", err)
+ }
+}
+
func assertMetabaseBillingMeterAccess(t *testing.T, ctx context.Context, adminURL, metabaseURL string) {
t.Helper()
admin := connect(t, ctx, adminURL)
@@ -2004,7 +2092,7 @@ func assertRuntimeLedgerAccess(t *testing.T, ctx context.Context, credentials Cr
var count int
err := connection.QueryRow(ctx, `select count(*) from cyclops_migrations.applied_migrations`).Scan(&count)
connection.Close(ctx)
- if err != nil || count != 10 {
+ if err != nil || count != 11 {
t.Errorf("%s ledger select = count:%d err:%v", role, count, err)
}
assertStatementFails(t, ctx, databaseURL, `insert into cyclops_migrations.applied_migrations (version, filename, sha256) values (99, 'invalid.sql', 'invalid')`)
diff --git a/libs/fleet/backend/database/migrator_test.go b/libs/fleet/backend/database/migrator_test.go
index c3c431d365..f64925734f 100644
--- a/libs/fleet/backend/database/migrator_test.go
+++ b/libs/fleet/backend/database/migrator_test.go
@@ -521,8 +521,36 @@ func TestEmbeddedMigrationsAreOrderedAndImmutable(t *testing.T) {
if err != nil {
t.Fatal(err)
}
- if len(files) != 10 {
- t.Fatalf("expected exactly ten migrations, got %d", len(files))
+ if len(files) != 11 {
+ t.Fatalf("expected exactly eleven migrations, got %d", len(files))
+ }
+ manifest := make([]struct {
+ Version int64
+ Name string
+ }, 0, len(files))
+ for _, file := range files {
+ manifest = append(manifest, struct {
+ Version int64
+ Name string
+ }{file.Version, file.Name})
+ }
+ if !reflect.DeepEqual(manifest, []struct {
+ Version int64
+ Name string
+ }{
+ {1, "000001_initial_schema.sql"},
+ {2, "000002_usage_sandbox_events.sql"},
+ {3, "000003_usage_claimed_sandbox_pool.sql"},
+ {4, "000004_filter_invalid_usage_sandbox_events.sql"},
+ {5, "000005_hourly_reservation_meter.sql"},
+ {6, "000006_chat_conversations.sql"},
+ {7, "000007_metabase_hourly_reservation_usage.sql"},
+ {8, "000008_metabase_hourly_reservation_usage_excluding_tenants.sql"},
+ {9, "000009_extend_metabase_revenue_tenant_exclusions.sql"},
+ {10, "000010_grant_metabase_billing_meter_access.sql"},
+ {11, "000011_signed_service_urls.sql"},
+ }) {
+ t.Fatalf("migration manifest = %#v", manifest)
}
initial := files[0]
if initial.Version != 1 || initial.Name != "000001_initial_schema.sql" {
@@ -725,6 +753,19 @@ func TestEmbeddedMigrationsAreOrderedAndImmutable(t *testing.T) {
}
}
+ signedServiceURLs := files[10]
+ for _, fragment := range []string{
+ "CREATE TABLE public.signed_service_urls",
+ "signed_service_urls_claim_created_idx",
+ "CHECK (expires_at >= created_at + interval '1 minute')",
+ "CHECK (expires_at <= created_at + interval '24 hours')",
+ "GRANT SELECT, INSERT, UPDATE ON TABLE public.signed_service_urls TO cyclops_app",
+ } {
+ if !strings.Contains(signedServiceURLs.SQL, fragment) {
+ t.Fatalf("migration 11 missing %q", fragment)
+ }
+ }
+
}
func TestReservationMeterMigrationRetainsRecordedChecksum(t *testing.T) {
diff --git a/libs/fleet/backend/docs/docs.go b/libs/fleet/backend/docs/docs.go
index 4e18391c75..1a290dd244 100644
--- a/libs/fleet/backend/docs/docs.go
+++ b/libs/fleet/backend/docs/docs.go
@@ -1417,6 +1417,211 @@ const docTemplate = `{
}
}
},
+ "/api/signed-service-urls/{namespace}": {
+ "get": {
+ "security": [
+ {
+ "BearerAuth": []
+ }
+ ],
+ "produces": [
+ "application/json"
+ ],
+ "tags": [
+ "signed-service-urls"
+ ],
+ "summary": "List signed URLs for a sandbox claim",
+ "parameters": [
+ {
+ "type": "string",
+ "description": "K8s namespace",
+ "name": "namespace",
+ "in": "path",
+ "required": true
+ },
+ {
+ "type": "string",
+ "description": "Claim name",
+ "name": "claim",
+ "in": "query",
+ "required": true
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "OK",
+ "schema": {
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/handlers.SignedServiceURLResponse"
+ }
+ }
+ },
+ "400": {
+ "description": "Bad Request",
+ "schema": {
+ "$ref": "#/definitions/handlers.ErrorResponse"
+ }
+ },
+ "401": {
+ "description": "Unauthorized",
+ "schema": {
+ "$ref": "#/definitions/handlers.ErrorResponse"
+ }
+ },
+ "500": {
+ "description": "Internal Server Error",
+ "schema": {
+ "$ref": "#/definitions/handlers.ErrorResponse"
+ }
+ },
+ "503": {
+ "description": "Service Unavailable",
+ "schema": {
+ "$ref": "#/definitions/handlers.ErrorResponse"
+ }
+ }
+ }
+ },
+ "post": {
+ "security": [
+ {
+ "BearerAuth": []
+ }
+ ],
+ "description": "Creates a temporary bearer link for one logical sandbox service.",
+ "consumes": [
+ "application/json"
+ ],
+ "produces": [
+ "application/json"
+ ],
+ "tags": [
+ "signed-service-urls"
+ ],
+ "summary": "Create a signed URL for a sandbox service",
+ "parameters": [
+ {
+ "type": "string",
+ "description": "K8s namespace",
+ "name": "namespace",
+ "in": "path",
+ "required": true
+ },
+ {
+ "description": "Signed service URL details",
+ "name": "body",
+ "in": "body",
+ "required": true,
+ "schema": {
+ "$ref": "#/definitions/handlers.CreateSignedServiceURLRequest"
+ }
+ }
+ ],
+ "responses": {
+ "201": {
+ "description": "Created",
+ "schema": {
+ "$ref": "#/definitions/handlers.SignedServiceURLResponse"
+ }
+ },
+ "400": {
+ "description": "Bad Request",
+ "schema": {
+ "$ref": "#/definitions/handlers.ErrorResponse"
+ }
+ },
+ "401": {
+ "description": "Unauthorized",
+ "schema": {
+ "$ref": "#/definitions/handlers.ErrorResponse"
+ }
+ },
+ "404": {
+ "description": "Not Found",
+ "schema": {
+ "$ref": "#/definitions/handlers.ErrorResponse"
+ }
+ },
+ "500": {
+ "description": "Internal Server Error",
+ "schema": {
+ "$ref": "#/definitions/handlers.ErrorResponse"
+ }
+ },
+ "503": {
+ "description": "Service Unavailable",
+ "schema": {
+ "$ref": "#/definitions/handlers.ErrorResponse"
+ }
+ }
+ }
+ }
+ },
+ "/api/signed-service-urls/{namespace}/{id}": {
+ "delete": {
+ "security": [
+ {
+ "BearerAuth": []
+ }
+ ],
+ "tags": [
+ "signed-service-urls"
+ ],
+ "summary": "Revoke a signed URL",
+ "parameters": [
+ {
+ "type": "string",
+ "description": "K8s namespace",
+ "name": "namespace",
+ "in": "path",
+ "required": true
+ },
+ {
+ "type": "string",
+ "description": "Signed URL ID",
+ "name": "id",
+ "in": "path",
+ "required": true
+ }
+ ],
+ "responses": {
+ "204": {
+ "description": "No Content"
+ },
+ "400": {
+ "description": "Bad Request",
+ "schema": {
+ "$ref": "#/definitions/handlers.ErrorResponse"
+ }
+ },
+ "401": {
+ "description": "Unauthorized",
+ "schema": {
+ "$ref": "#/definitions/handlers.ErrorResponse"
+ }
+ },
+ "404": {
+ "description": "Not Found",
+ "schema": {
+ "$ref": "#/definitions/handlers.ErrorResponse"
+ }
+ },
+ "500": {
+ "description": "Internal Server Error",
+ "schema": {
+ "$ref": "#/definitions/handlers.ErrorResponse"
+ }
+ },
+ "503": {
+ "description": "Service Unavailable",
+ "schema": {
+ "$ref": "#/definitions/handlers.ErrorResponse"
+ }
+ }
+ }
+ }
+ },
"/api/svc/{namespace}/{service}/{path}": {
"get": {
"security": [
@@ -2035,6 +2240,40 @@ const docTemplate = `{
}
}
},
+ "handlers.CreateSignedServiceURLRequest": {
+ "type": "object",
+ "required": [
+ "claim",
+ "expiresInSeconds",
+ "logicalService",
+ "sandbox",
+ "service"
+ ],
+ "properties": {
+ "claim": {
+ "type": "string"
+ },
+ "expiresInSeconds": {
+ "type": "integer",
+ "maximum": 86400,
+ "minimum": 60
+ },
+ "label": {
+ "description": "Label is optional and limited to 120 UTF-8 bytes. OpenAPI maxLength is a\ncharacter upper bound; backend byte validation remains authoritative.",
+ "type": "string",
+ "maxLength": 120
+ },
+ "logicalService": {
+ "type": "string"
+ },
+ "sandbox": {
+ "type": "string"
+ },
+ "service": {
+ "type": "string"
+ }
+ }
+ },
"handlers.CreateUserKeyRequest": {
"type": "object",
"properties": {
@@ -2143,6 +2382,44 @@ const docTemplate = `{
}
}
},
+ "handlers.SignedServiceURLResponse": {
+ "type": "object",
+ "properties": {
+ "claim": {
+ "type": "string"
+ },
+ "createdAt": {
+ "type": "string"
+ },
+ "expiresAt": {
+ "type": "string"
+ },
+ "id": {
+ "type": "string"
+ },
+ "label": {
+ "type": "string"
+ },
+ "logicalService": {
+ "type": "string"
+ },
+ "namespace": {
+ "type": "string"
+ },
+ "revokedAt": {
+ "type": "string"
+ },
+ "sandbox": {
+ "type": "string"
+ },
+ "service": {
+ "type": "string"
+ },
+ "url": {
+ "type": "string"
+ }
+ }
+ },
"handlers.TurnRequest": {
"type": "object",
"properties": {
diff --git a/libs/fleet/backend/docs/swagger.json b/libs/fleet/backend/docs/swagger.json
index e44e61234b..28c23d65a2 100644
--- a/libs/fleet/backend/docs/swagger.json
+++ b/libs/fleet/backend/docs/swagger.json
@@ -1410,6 +1410,211 @@
}
}
},
+ "/api/signed-service-urls/{namespace}": {
+ "get": {
+ "security": [
+ {
+ "BearerAuth": []
+ }
+ ],
+ "produces": [
+ "application/json"
+ ],
+ "tags": [
+ "signed-service-urls"
+ ],
+ "summary": "List signed URLs for a sandbox claim",
+ "parameters": [
+ {
+ "type": "string",
+ "description": "K8s namespace",
+ "name": "namespace",
+ "in": "path",
+ "required": true
+ },
+ {
+ "type": "string",
+ "description": "Claim name",
+ "name": "claim",
+ "in": "query",
+ "required": true
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "OK",
+ "schema": {
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/handlers.SignedServiceURLResponse"
+ }
+ }
+ },
+ "400": {
+ "description": "Bad Request",
+ "schema": {
+ "$ref": "#/definitions/handlers.ErrorResponse"
+ }
+ },
+ "401": {
+ "description": "Unauthorized",
+ "schema": {
+ "$ref": "#/definitions/handlers.ErrorResponse"
+ }
+ },
+ "500": {
+ "description": "Internal Server Error",
+ "schema": {
+ "$ref": "#/definitions/handlers.ErrorResponse"
+ }
+ },
+ "503": {
+ "description": "Service Unavailable",
+ "schema": {
+ "$ref": "#/definitions/handlers.ErrorResponse"
+ }
+ }
+ }
+ },
+ "post": {
+ "security": [
+ {
+ "BearerAuth": []
+ }
+ ],
+ "description": "Creates a temporary bearer link for one logical sandbox service.",
+ "consumes": [
+ "application/json"
+ ],
+ "produces": [
+ "application/json"
+ ],
+ "tags": [
+ "signed-service-urls"
+ ],
+ "summary": "Create a signed URL for a sandbox service",
+ "parameters": [
+ {
+ "type": "string",
+ "description": "K8s namespace",
+ "name": "namespace",
+ "in": "path",
+ "required": true
+ },
+ {
+ "description": "Signed service URL details",
+ "name": "body",
+ "in": "body",
+ "required": true,
+ "schema": {
+ "$ref": "#/definitions/handlers.CreateSignedServiceURLRequest"
+ }
+ }
+ ],
+ "responses": {
+ "201": {
+ "description": "Created",
+ "schema": {
+ "$ref": "#/definitions/handlers.SignedServiceURLResponse"
+ }
+ },
+ "400": {
+ "description": "Bad Request",
+ "schema": {
+ "$ref": "#/definitions/handlers.ErrorResponse"
+ }
+ },
+ "401": {
+ "description": "Unauthorized",
+ "schema": {
+ "$ref": "#/definitions/handlers.ErrorResponse"
+ }
+ },
+ "404": {
+ "description": "Not Found",
+ "schema": {
+ "$ref": "#/definitions/handlers.ErrorResponse"
+ }
+ },
+ "500": {
+ "description": "Internal Server Error",
+ "schema": {
+ "$ref": "#/definitions/handlers.ErrorResponse"
+ }
+ },
+ "503": {
+ "description": "Service Unavailable",
+ "schema": {
+ "$ref": "#/definitions/handlers.ErrorResponse"
+ }
+ }
+ }
+ }
+ },
+ "/api/signed-service-urls/{namespace}/{id}": {
+ "delete": {
+ "security": [
+ {
+ "BearerAuth": []
+ }
+ ],
+ "tags": [
+ "signed-service-urls"
+ ],
+ "summary": "Revoke a signed URL",
+ "parameters": [
+ {
+ "type": "string",
+ "description": "K8s namespace",
+ "name": "namespace",
+ "in": "path",
+ "required": true
+ },
+ {
+ "type": "string",
+ "description": "Signed URL ID",
+ "name": "id",
+ "in": "path",
+ "required": true
+ }
+ ],
+ "responses": {
+ "204": {
+ "description": "No Content"
+ },
+ "400": {
+ "description": "Bad Request",
+ "schema": {
+ "$ref": "#/definitions/handlers.ErrorResponse"
+ }
+ },
+ "401": {
+ "description": "Unauthorized",
+ "schema": {
+ "$ref": "#/definitions/handlers.ErrorResponse"
+ }
+ },
+ "404": {
+ "description": "Not Found",
+ "schema": {
+ "$ref": "#/definitions/handlers.ErrorResponse"
+ }
+ },
+ "500": {
+ "description": "Internal Server Error",
+ "schema": {
+ "$ref": "#/definitions/handlers.ErrorResponse"
+ }
+ },
+ "503": {
+ "description": "Service Unavailable",
+ "schema": {
+ "$ref": "#/definitions/handlers.ErrorResponse"
+ }
+ }
+ }
+ }
+ },
"/api/svc/{namespace}/{service}/{path}": {
"get": {
"security": [
@@ -2028,6 +2233,40 @@
}
}
},
+ "handlers.CreateSignedServiceURLRequest": {
+ "type": "object",
+ "required": [
+ "claim",
+ "expiresInSeconds",
+ "logicalService",
+ "sandbox",
+ "service"
+ ],
+ "properties": {
+ "claim": {
+ "type": "string"
+ },
+ "expiresInSeconds": {
+ "type": "integer",
+ "maximum": 86400,
+ "minimum": 60
+ },
+ "label": {
+ "description": "Label is optional and limited to 120 UTF-8 bytes. OpenAPI maxLength is a\ncharacter upper bound; backend byte validation remains authoritative.",
+ "type": "string",
+ "maxLength": 120
+ },
+ "logicalService": {
+ "type": "string"
+ },
+ "sandbox": {
+ "type": "string"
+ },
+ "service": {
+ "type": "string"
+ }
+ }
+ },
"handlers.CreateUserKeyRequest": {
"type": "object",
"properties": {
@@ -2136,6 +2375,44 @@
}
}
},
+ "handlers.SignedServiceURLResponse": {
+ "type": "object",
+ "properties": {
+ "claim": {
+ "type": "string"
+ },
+ "createdAt": {
+ "type": "string"
+ },
+ "expiresAt": {
+ "type": "string"
+ },
+ "id": {
+ "type": "string"
+ },
+ "label": {
+ "type": "string"
+ },
+ "logicalService": {
+ "type": "string"
+ },
+ "namespace": {
+ "type": "string"
+ },
+ "revokedAt": {
+ "type": "string"
+ },
+ "sandbox": {
+ "type": "string"
+ },
+ "service": {
+ "type": "string"
+ },
+ "url": {
+ "type": "string"
+ }
+ }
+ },
"handlers.TurnRequest": {
"type": "object",
"properties": {
diff --git a/libs/fleet/backend/docs/swagger.yaml b/libs/fleet/backend/docs/swagger.yaml
index 8843b6082a..4b994587ed 100644
--- a/libs/fleet/backend/docs/swagger.yaml
+++ b/libs/fleet/backend/docs/swagger.yaml
@@ -281,6 +281,33 @@ definitions:
example: my-workspace
type: string
type: object
+ handlers.CreateSignedServiceURLRequest:
+ properties:
+ claim:
+ type: string
+ expiresInSeconds:
+ maximum: 86400
+ minimum: 60
+ type: integer
+ label:
+ description: |-
+ Label is optional and limited to 120 UTF-8 bytes. OpenAPI maxLength is a
+ character upper bound; backend byte validation remains authoritative.
+ maxLength: 120
+ type: string
+ logicalService:
+ type: string
+ sandbox:
+ type: string
+ service:
+ type: string
+ required:
+ - claim
+ - expiresInSeconds
+ - logicalService
+ - sandbox
+ - service
+ type: object
handlers.CreateUserKeyRequest:
properties:
name:
@@ -351,6 +378,31 @@ definitions:
status:
type: string
type: object
+ handlers.SignedServiceURLResponse:
+ properties:
+ claim:
+ type: string
+ createdAt:
+ type: string
+ expiresAt:
+ type: string
+ id:
+ type: string
+ label:
+ type: string
+ logicalService:
+ type: string
+ namespace:
+ type: string
+ revokedAt:
+ type: string
+ sandbox:
+ type: string
+ service:
+ type: string
+ url:
+ type: string
+ type: object
handlers.TurnRequest:
properties:
messages:
@@ -1337,6 +1389,138 @@ paths:
summary: Get a namespace owned by the calling user
tags:
- namespaces
+ /api/signed-service-urls/{namespace}:
+ get:
+ parameters:
+ - description: K8s namespace
+ in: path
+ name: namespace
+ required: true
+ type: string
+ - description: Claim name
+ in: query
+ name: claim
+ required: true
+ type: string
+ produces:
+ - application/json
+ responses:
+ "200":
+ description: OK
+ schema:
+ items:
+ $ref: '#/definitions/handlers.SignedServiceURLResponse'
+ type: array
+ "400":
+ description: Bad Request
+ schema:
+ $ref: '#/definitions/handlers.ErrorResponse'
+ "401":
+ description: Unauthorized
+ schema:
+ $ref: '#/definitions/handlers.ErrorResponse'
+ "500":
+ description: Internal Server Error
+ schema:
+ $ref: '#/definitions/handlers.ErrorResponse'
+ "503":
+ description: Service Unavailable
+ schema:
+ $ref: '#/definitions/handlers.ErrorResponse'
+ security:
+ - BearerAuth: []
+ summary: List signed URLs for a sandbox claim
+ tags:
+ - signed-service-urls
+ post:
+ consumes:
+ - application/json
+ description: Creates a temporary bearer link for one logical sandbox service.
+ parameters:
+ - description: K8s namespace
+ in: path
+ name: namespace
+ required: true
+ type: string
+ - description: Signed service URL details
+ in: body
+ name: body
+ required: true
+ schema:
+ $ref: '#/definitions/handlers.CreateSignedServiceURLRequest'
+ produces:
+ - application/json
+ responses:
+ "201":
+ description: Created
+ schema:
+ $ref: '#/definitions/handlers.SignedServiceURLResponse'
+ "400":
+ description: Bad Request
+ schema:
+ $ref: '#/definitions/handlers.ErrorResponse'
+ "401":
+ description: Unauthorized
+ schema:
+ $ref: '#/definitions/handlers.ErrorResponse'
+ "404":
+ description: Not Found
+ schema:
+ $ref: '#/definitions/handlers.ErrorResponse'
+ "500":
+ description: Internal Server Error
+ schema:
+ $ref: '#/definitions/handlers.ErrorResponse'
+ "503":
+ description: Service Unavailable
+ schema:
+ $ref: '#/definitions/handlers.ErrorResponse'
+ security:
+ - BearerAuth: []
+ summary: Create a signed URL for a sandbox service
+ tags:
+ - signed-service-urls
+ /api/signed-service-urls/{namespace}/{id}:
+ delete:
+ parameters:
+ - description: K8s namespace
+ in: path
+ name: namespace
+ required: true
+ type: string
+ - description: Signed URL ID
+ in: path
+ name: id
+ required: true
+ type: string
+ responses:
+ "204":
+ description: No Content
+ "400":
+ description: Bad Request
+ schema:
+ $ref: '#/definitions/handlers.ErrorResponse'
+ "401":
+ description: Unauthorized
+ schema:
+ $ref: '#/definitions/handlers.ErrorResponse'
+ "404":
+ description: Not Found
+ schema:
+ $ref: '#/definitions/handlers.ErrorResponse'
+ "500":
+ description: Internal Server Error
+ schema:
+ $ref: '#/definitions/handlers.ErrorResponse'
+ "503":
+ description: Service Unavailable
+ schema:
+ $ref: '#/definitions/handlers.ErrorResponse'
+ security:
+ - BearerAuth: []
+ summary: Revoke a signed URL
+ tags:
+ - signed-service-urls
/api/svc/{namespace}/{service}/{path}:
get:
description: Proxies to {service}.{namespace}.svc.cluster.local:80. Per-key
diff --git a/libs/fleet/backend/handlers/handlers.go b/libs/fleet/backend/handlers/handlers.go
index 42a7e62323..e4b04d15eb 100644
--- a/libs/fleet/backend/handlers/handlers.go
+++ b/libs/fleet/backend/handlers/handlers.go
@@ -18,7 +18,10 @@ import (
"cyclops-cs-backend/featureflagadmin"
"cyclops-cs-backend/keycloak"
"cyclops-cs-backend/productanalytics"
+ "cyclops-cs-backend/signedurls"
"cyclops-cs-backend/usage"
+
+ "github.com/google/uuid"
"go.opentelemetry.io/otel"
"go.opentelemetry.io/otel/trace"
)
@@ -27,16 +30,27 @@ type UserAccountService interface {
UserCreatedAt(ctx context.Context, subject string) (time.Time, error)
}
+type SignedServiceURLService interface {
+ Create(context.Context, signedurls.CreateInput) (signedurls.Record, error)
+ List(context.Context, string, string) ([]signedurls.Record, error)
+ Revoke(context.Context, string, uuid.UUID) (signedurls.Record, error)
+}
+
type Handlers struct {
- Admin *keycloak.Admin
- GatewayCfg config.GatewayConfiguration
- AuthCfg config.AuthConfiguration
- KC config.KeycloakConfiguration
- Stripe config.StripeConfiguration
- Billing BillingService
- UserAccounts UserAccountService
- WebhookVerifier WebhookVerifier
- Analytics productanalytics.Capturer
+ Admin *keycloak.Admin
+ GatewayCfg config.GatewayConfiguration
+ AuthCfg config.AuthConfiguration
+ KC config.KeycloakConfiguration
+ Stripe config.StripeConfiguration
+ Billing BillingService
+ UserAccounts UserAccountService
+ WebhookVerifier WebhookVerifier
+ Analytics productanalytics.Capturer
+ SignedServiceURLs *signedurls.Service
+ SignedServiceURLProvider func() *signedurls.Service
+ signedServiceURLs SignedServiceURLService
+ signedServiceExists func(context.Context, string, string, string) (bool, error)
+ checkSignedServiceExists bool
// Features carries the database-backed dependencies (the state query
// executor and the GitHub trust policy store). It is a pointer because
@@ -78,6 +92,18 @@ func New(admin *keycloak.Admin, cfg *config.Configuration) Handlers {
}
}
+func (h Handlers) signedServiceURLService() SignedServiceURLService {
+ if h.SignedServiceURLProvider != nil {
+ if service := h.SignedServiceURLProvider(); service != nil {
+ return service
+ }
+ }
+ if h.SignedServiceURLs != nil {
+ return h.SignedServiceURLs
+ }
+ return h.signedServiceURLs
+}
+
func (h Handlers) usagePricing(ctx context.Context, user *auth.User) (auth.UsagePricing, error) {
evaluator := h.usagePricingEvaluator
if evaluator == nil {
diff --git a/libs/fleet/backend/handlers/namespaces.go b/libs/fleet/backend/handlers/namespaces.go
index d77d15e5ba..4686d89ab9 100644
--- a/libs/fleet/backend/handlers/namespaces.go
+++ b/libs/fleet/backend/handlers/namespaces.go
@@ -134,8 +134,10 @@ func (h Handlers) k8sImpersonate(
// on users and groups (granted by cyclops-cs-impersonator ClusterRole).
// Prefixes resolve from OpenFeature (see package identity) so the backend,
// standalone Tenant controller, and apiserver flags stay aligned.
- req.Header.Set("Impersonate-User", identity.ImpersonateUser(ctx, userSub))
- req.Header.Set("Impersonate-Group", identity.ImpersonateGroup(ctx, userSub))
+ if userSub != "" {
+ req.Header.Set("Impersonate-User", identity.ImpersonateUser(ctx, userSub))
+ req.Header.Set("Impersonate-Group", identity.ImpersonateGroup(ctx, userSub))
+ }
return k8sClient.Do(req)
}
diff --git a/libs/fleet/backend/handlers/ownership_test.go b/libs/fleet/backend/handlers/ownership_test.go
index 550b75d849..44247d325b 100644
--- a/libs/fleet/backend/handlers/ownership_test.go
+++ b/libs/fleet/backend/handlers/ownership_test.go
@@ -61,9 +61,10 @@ func authorizationStage(t *testing.T, route string) (http.Handler, *bool) {
}
const (
- svcRoute = "/api/svc/{namespace}/{service}/{path...}"
- namespacesRoute = "/api/namespaces/{name}"
- namespaceList = "/api/namespaces"
+ svcRoute = "/api/svc/{namespace}/{service}/{path...}"
+ signedServiceURLsRoute = "/api/signed-service-urls/{namespace}"
+ namespacesRoute = "/api/namespaces/{name}"
+ namespaceList = "/api/namespaces"
)
// svcRequest builds a /api/svc request with path values + user stamped.
@@ -78,6 +79,15 @@ func svcRequest(u *auth.User, ns, service string) *http.Request {
return r
}
+func signedServiceURLsRequest(u *auth.User, namespace string) *http.Request {
+ r := httptest.NewRequest(http.MethodPost, "/api/signed-service-urls/"+namespace, nil)
+ r.SetPathValue("namespace", namespace)
+ if u != nil {
+ r = withUser(r, u)
+ }
+ return r
+}
+
// factRequest builds the request a FactProvider is handed on a route: the user,
// and the route's parameters stamped by the production RouteContext rather than
// by a second copy of what it does.
@@ -371,6 +381,24 @@ func TestSvcRoute_PerKey_NamespaceMismatch_Forbidden_NoProbe(t *testing.T) {
}
}
+func TestSignedServiceURLsRoute_PerKey_NamespaceMismatch_ForbiddenBeforeHandler(t *testing.T) {
+ resetOwnershipCache()
+ fk := newFakeK8s(http.StatusOK, `{"items":[]}`)
+ defer fk.server.Close()
+ overrideK8sClient(fk.server.Client(), fk.server.URL, "fake-sa-token")
+
+ stage, reached := authorizationStage(t, signedServiceURLsRoute)
+ w := httptest.NewRecorder()
+ stage.ServeHTTP(w, signedServiceURLsRequest(&auth.User{ID: "svc-acct", AZP: "key-mypool", Namespace: "mypool"}, "other-ns"))
+
+ if w.Code != http.StatusForbidden || *reached {
+ t.Fatalf("status = %d, reached = %v; want 403 and no handler; body = %s", w.Code, *reached, w.Body.String())
+ }
+ if len(fk.requests) != 0 {
+ t.Fatalf("expected no Kubernetes probe for denied per-key request, got %d request(s)", len(fk.requests))
+ }
+}
+
func TestSvcRoute_GitHubPrincipal_ClaimAllows_NoProbe(t *testing.T) {
resetOwnershipCache()
fk := newFakeK8s(http.StatusForbidden, `{"kind":"Status"}`)
diff --git a/libs/fleet/backend/handlers/signedserviceurls.go b/libs/fleet/backend/handlers/signedserviceurls.go
new file mode 100644
index 0000000000..39fad7baa0
--- /dev/null
+++ b/libs/fleet/backend/handlers/signedserviceurls.go
@@ -0,0 +1,318 @@
+package handlers
+
+import (
+ "context"
+ "encoding/json"
+ "errors"
+ "fmt"
+ "io"
+ "net/http"
+ "net/url"
+ "strings"
+ "time"
+
+ "cyclops-cs-backend/auth"
+ "cyclops-cs-backend/signedurls"
+
+ "github.com/google/uuid"
+)
+
+type CreateSignedServiceURLRequest struct {
+ Claim string `json:"claim" binding:"required"`
+ Sandbox string `json:"sandbox" binding:"required"`
+ Service string `json:"service" binding:"required"`
+ LogicalService string `json:"logicalService" binding:"required"`
+ // Label is optional and limited to 120 UTF-8 bytes. OpenAPI maxLength is a
+ // character upper bound; backend byte validation remains authoritative.
+ Label *string `json:"label" maxLength:"120"`
+ ExpiresInSeconds uint32 `json:"expiresInSeconds" binding:"required" minimum:"60" maximum:"86400"`
+}
+
+type SignedServiceURLResponse struct {
+ ID string `json:"id"`
+ Namespace string `json:"namespace"`
+ Claim string `json:"claim"`
+ Sandbox string `json:"sandbox"`
+ Service string `json:"service"`
+ LogicalService string `json:"logicalService"`
+ Label *string `json:"label"`
+ URL string `json:"url"`
+ CreatedAt string `json:"createdAt"`
+ ExpiresAt string `json:"expiresAt"`
+ RevokedAt *string `json:"revokedAt"`
+}
+
+// CreateSignedServiceURL godoc
+//
+// @Summary Create a signed URL for a sandbox service
+// @Description Creates a temporary bearer link for one logical sandbox service.
+// @Tags signed-service-urls
+// @Accept json
+// @Produce json
+// @Param namespace path string true "K8s namespace"
+// @Param body body CreateSignedServiceURLRequest true "Signed service URL details"
+// @Success 201 {object} SignedServiceURLResponse
+// @Failure 400,401,404,500,503 {object} ErrorResponse
+// @Security BearerAuth
+// @Router /api/signed-service-urls/{namespace} [post]
+func (h Handlers) CreateSignedServiceURL(w http.ResponseWriter, r *http.Request) {
+ user := currentUser(r)
+ if user == nil || user.ID == "" {
+ writeErr(w, http.StatusUnauthorized, "missing user")
+ return
+ }
+ service := h.signedServiceURLService()
+ if service == nil {
+ writeErr(w, http.StatusServiceUnavailable, "signed service URLs are unavailable")
+ return
+ }
+
+ var request CreateSignedServiceURLRequest
+ if err := json.NewDecoder(r.Body).Decode(&request); err != nil {
+ writeErr(w, http.StatusBadRequest, "invalid request body")
+ return
+ }
+ namespace := r.PathValue("namespace")
+ if !validSignedServiceURLIdentifier(namespace) || !validSignedServiceURLIdentifier(request.Claim) || !validSignedServiceURLIdentifier(request.Sandbox) || !validSignedServiceURLIdentifier(request.LogicalService) {
+ writeErr(w, http.StatusBadRequest, "invalid signed service URL request")
+ return
+ }
+ expectedServiceName := request.Sandbox + "-" + request.LogicalService
+ if !validSignedServiceURLIdentifier(expectedServiceName) || request.Service != expectedServiceName {
+ writeErr(w, http.StatusBadRequest, "invalid signed service URL request")
+ return
+ }
+ validationSubject := signedServiceURLValidationSubject(user, h.AuthCfg.KeyClientPfx)
+ serviceName, found, err := h.authorizedSignedService(r.Context(), namespace, request.Claim, request.Sandbox, request.LogicalService, validationSubject)
+ if err != nil {
+ writeErr(w, http.StatusServiceUnavailable, "signed service URLs are unavailable")
+ return
+ }
+ if !found || request.Service != serviceName {
+ writeErr(w, http.StatusNotFound, "sandbox service not found")
+ return
+ }
+ exists, err := h.signedServiceExistsFor(r.Context(), namespace, serviceName, validationSubject)
+ if err != nil {
+ writeErr(w, http.StatusServiceUnavailable, "signed service URLs are unavailable")
+ return
+ }
+ if !exists {
+ writeErr(w, http.StatusNotFound, "sandbox service not found")
+ return
+ }
+ record, err := service.Create(r.Context(), signedurls.CreateInput{Namespace: namespace, ClaimName: request.Claim, SandboxName: request.Sandbox, ServiceName: serviceName, LogicalService: request.LogicalService, Label: request.Label, CreatorSub: user.ID, ExpiresIn: time.Duration(request.ExpiresInSeconds) * time.Second})
+ if err != nil {
+ writeSignedServiceURLError(w, err, "create")
+ return
+ }
+ writeJSON(w, http.StatusCreated, signedServiceURLResponse(record))
+}
+
+const signedServiceURLServiceCheckTimeout = 5 * time.Second
+
+func signedServiceURLValidationSubject(user *auth.User, keyClientPfx string) string {
+ if strings.HasPrefix(user.AZP, keyClientPrefix(keyClientPfx)) && user.Namespace != "" {
+ return ""
+ }
+ return user.ID
+}
+
+func keyClientPrefix(value string) string {
+ if value == "" {
+ return "key-"
+ }
+ return value
+}
+
+func (h Handlers) authorizedSignedService(ctx context.Context, namespace, claim, sandbox, logicalService, subject string) (string, bool, error) {
+ if h.signedServiceURLs != nil && h.SignedServiceURLProvider == nil {
+ return sandbox + "-" + logicalService, true, nil
+ }
+ claimResponse, err := h.k8sImpersonate(ctx, http.MethodGet, "/apis/osgym.cua.ai/v1alpha1/namespaces/"+url.PathEscape(namespace)+"/osgymsandboxclaims/"+url.PathEscape(claim), nil, subject)
+ if err != nil {
+ return "", false, err
+ }
+ defer claimResponse.Body.Close()
+ if claimResponse.StatusCode == http.StatusNotFound {
+ return "", false, nil
+ }
+ if claimResponse.StatusCode != http.StatusOK {
+ return "", false, fmt.Errorf("signed service claim lookup returned HTTP %d", claimResponse.StatusCode)
+ }
+ var claimPayload struct {
+ Metadata struct {
+ Name string `json:"name"`
+ } `json:"metadata"`
+ Spec struct {
+ SandboxTemplateRef struct {
+ Name string `json:"name"`
+ } `json:"sandboxTemplateRef"`
+ } `json:"spec"`
+ Status struct {
+ Phase string `json:"phase"`
+ Sandbox struct {
+ Name string `json:"name"`
+ } `json:"sandbox"`
+ } `json:"status"`
+ }
+ if err := json.NewDecoder(io.LimitReader(claimResponse.Body, k8sResponseBodyLimit)).Decode(&claimPayload); err != nil {
+ return "", false, err
+ }
+ if claimPayload.Metadata.Name != claim || claimPayload.Status.Phase != "Bound" || claimPayload.Status.Sandbox.Name != sandbox || !validSignedServiceURLIdentifier(claimPayload.Spec.SandboxTemplateRef.Name) {
+ return "", false, nil
+ }
+ templateResponse, err := h.k8sImpersonate(ctx, http.MethodGet, "/apis/osgym.cua.ai/v1alpha1/namespaces/"+url.PathEscape(namespace)+"/osgymsandboxtemplates/"+url.PathEscape(claimPayload.Spec.SandboxTemplateRef.Name), nil, subject)
+ if err != nil {
+ return "", false, err
+ }
+ defer templateResponse.Body.Close()
+ if templateResponse.StatusCode == http.StatusNotFound {
+ return "", false, nil
+ }
+ if templateResponse.StatusCode != http.StatusOK {
+ return "", false, fmt.Errorf("signed service template lookup returned HTTP %d", templateResponse.StatusCode)
+ }
+ var templatePayload struct {
+ Spec struct {
+ VMTemplate struct {
+ Services []struct {
+ Name string `json:"name"`
+ } `json:"services"`
+ } `json:"vmTemplate"`
+ } `json:"spec"`
+ }
+ if err := json.NewDecoder(io.LimitReader(templateResponse.Body, k8sResponseBodyLimit)).Decode(&templatePayload); err != nil {
+ return "", false, err
+ }
+ for _, service := range templatePayload.Spec.VMTemplate.Services {
+ if service.Name == logicalService {
+ serviceName := sandbox + "-" + logicalService
+ return serviceName, validSignedServiceURLIdentifier(serviceName), nil
+ }
+ }
+ return "", false, nil
+}
+
+func validSignedServiceURLIdentifier(value string) bool {
+ return len(value) <= 63 && dnsLabel.MatchString(value)
+}
+
+func (h Handlers) signedServiceExistsFor(ctx context.Context, namespace, serviceName, subject string) (bool, error) {
+ if h.signedServiceExists != nil {
+ return h.signedServiceExists(ctx, namespace, serviceName, subject)
+ }
+ if h.SignedServiceURLs == nil && h.SignedServiceURLProvider == nil && !h.checkSignedServiceExists {
+ return true, nil
+ }
+ ctx, cancel := context.WithTimeout(ctx, signedServiceURLServiceCheckTimeout)
+ defer cancel()
+ response, err := h.k8sImpersonate(ctx, http.MethodGet, "/api/v1/namespaces/"+url.PathEscape(namespace)+"/services/"+url.PathEscape(serviceName), nil, subject)
+ if err != nil {
+ return false, fmt.Errorf("check signed service URL service: %w", err)
+ }
+ defer response.Body.Close()
+ _, _ = io.Copy(io.Discard, io.LimitReader(response.Body, k8sResponseBodyLimit))
+ switch response.StatusCode {
+ case http.StatusOK:
+ return true, nil
+ case http.StatusNotFound:
+ return false, nil
+ default:
+ return false, fmt.Errorf("check signed service URL service: unexpected Kubernetes status %d", response.StatusCode)
+ }
+}
+
+// ListSignedServiceURLs godoc
+//
+// @Summary List signed URLs for a sandbox claim
+// @Tags signed-service-urls
+// @Produce json
+// @Param namespace path string true "K8s namespace"
+// @Param claim query string true "Claim name"
+// @Success 200 {array} SignedServiceURLResponse
+// @Failure 400,401,500,503 {object} ErrorResponse
+// @Security BearerAuth
+// @Router /api/signed-service-urls/{namespace} [get]
+func (h Handlers) ListSignedServiceURLs(w http.ResponseWriter, r *http.Request) {
+ user := currentUser(r)
+ if user == nil || user.ID == "" {
+ writeErr(w, http.StatusUnauthorized, "missing user")
+ return
+ }
+ service := h.signedServiceURLService()
+ if service == nil {
+ writeErr(w, http.StatusServiceUnavailable, "signed service URLs are unavailable")
+ return
+ }
+ claims := r.URL.Query()["claim"]
+ if len(claims) != 1 || !validSignedServiceURLIdentifier(claims[0]) {
+ writeErr(w, http.StatusBadRequest, "invalid claim")
+ return
+ }
+ records, err := service.List(r.Context(), r.PathValue("namespace"), claims[0])
+ if err != nil {
+ writeSignedServiceURLError(w, err, "list")
+ return
+ }
+ response := make([]SignedServiceURLResponse, 0, len(records))
+ for _, record := range records {
+ response = append(response, signedServiceURLResponse(record))
+ }
+ writeJSON(w, http.StatusOK, response)
+}
+
+// RevokeSignedServiceURL godoc
+//
+// @Summary Revoke a signed URL
+// @Tags signed-service-urls
+// @Param namespace path string true "K8s namespace"
+// @Param id path string true "Signed URL ID"
+// @Success 204
+// @Failure 400,401,404,500,503 {object} ErrorResponse
+// @Security BearerAuth
+// @Router /api/signed-service-urls/{namespace}/{id} [delete]
+func (h Handlers) RevokeSignedServiceURL(w http.ResponseWriter, r *http.Request) {
+ user := currentUser(r)
+ if user == nil || user.ID == "" {
+ writeErr(w, http.StatusUnauthorized, "missing user")
+ return
+ }
+ service := h.signedServiceURLService()
+ if service == nil {
+ writeErr(w, http.StatusServiceUnavailable, "signed service URLs are unavailable")
+ return
+ }
+ id, err := uuid.Parse(r.PathValue("id"))
+ if err != nil {
+ writeErr(w, http.StatusBadRequest, "invalid signed service URL ID")
+ return
+ }
+ if _, err := service.Revoke(r.Context(), r.PathValue("namespace"), id); err != nil {
+ writeSignedServiceURLError(w, err, "revoke")
+ return
+ }
+ w.WriteHeader(http.StatusNoContent)
+}
+
+func signedServiceURLResponse(record signedurls.Record) SignedServiceURLResponse {
+ response := SignedServiceURLResponse{ID: record.ID.String(), Namespace: record.Namespace, Claim: record.ClaimName, Sandbox: record.SandboxName, Service: record.ServiceName, LogicalService: record.LogicalService, Label: record.Label, URL: record.URL, CreatedAt: record.CreatedAt.UTC().Format(time.RFC3339), ExpiresAt: record.ExpiresAt.UTC().Format(time.RFC3339)}
+ if record.RevokedAt != nil {
+ revokedAt := record.RevokedAt.UTC().Format(time.RFC3339)
+ response.RevokedAt = &revokedAt
+ }
+ return response
+}
+
+func writeSignedServiceURLError(w http.ResponseWriter, err error, operation string) {
+ switch {
+ case errors.Is(err, signedurls.ErrUnavailable):
+ writeErr(w, http.StatusServiceUnavailable, "signed service URLs are unavailable")
+ case errors.Is(err, signedurls.ErrInvalidInput):
+ writeErr(w, http.StatusBadRequest, "invalid signed service URL request")
+ case errors.Is(err, signedurls.ErrNotFound):
+ writeErr(w, http.StatusNotFound, "signed service URL not found")
+ default:
+ writeErr(w, http.StatusInternalServerError, "failed to "+operation+" signed service URL")
+ }
+}
diff --git a/libs/fleet/backend/handlers/signedserviceurls_test.go b/libs/fleet/backend/handlers/signedserviceurls_test.go
new file mode 100644
index 0000000000..c9d2d92864
--- /dev/null
+++ b/libs/fleet/backend/handlers/signedserviceurls_test.go
@@ -0,0 +1,552 @@
+package handlers
+
+import (
+ "bytes"
+ "context"
+ "encoding/json"
+ "errors"
+ "io"
+ "log/slog"
+ "net/http"
+ "net/http/httptest"
+ "strings"
+ "testing"
+ "time"
+
+ "cyclops-cs-backend/auth"
+ "cyclops-cs-backend/config"
+ "cyclops-cs-backend/signedurls"
+
+ "github.com/google/uuid"
+)
+
+const capabilityToken = "sensitive-capability-token"
+
+type fakeSignedServiceURLService struct {
+ createCalls int
+ createInput signedurls.CreateInput
+ createRecord signedurls.Record
+ createErr error
+ listNamespace string
+ listClaim string
+ listRecords []signedurls.Record
+ listErr error
+ revokeNamespace string
+ revokeID uuid.UUID
+ revokeRecord signedurls.Record
+ revokeCalls int
+ revokeErr error
+}
+
+func (service *fakeSignedServiceURLService) Create(_ context.Context, input signedurls.CreateInput) (signedurls.Record, error) {
+ service.createCalls++
+ service.createInput = input
+ return service.createRecord, service.createErr
+}
+
+func (service *fakeSignedServiceURLService) List(_ context.Context, namespace, claim string) ([]signedurls.Record, error) {
+ service.listNamespace, service.listClaim = namespace, claim
+ return service.listRecords, service.listErr
+}
+
+func (service *fakeSignedServiceURLService) Revoke(_ context.Context, namespace string, id uuid.UUID) (signedurls.Record, error) {
+ service.revokeNamespace, service.revokeID = namespace, id
+ service.revokeCalls++
+ return service.revokeRecord, service.revokeErr
+}
+
+func withTestUser(ctx context.Context, user *auth.User) context.Context {
+ return context.WithValue(ctx, auth.UserKey, user)
+}
+
+func TestCreateSignedServiceURLPassesCallerSubject(t *testing.T) {
+ service := &fakeSignedServiceURLService{createRecord: signedServiceURLRecord()}
+ handlers := Handlers{signedServiceURLs: service, signedServiceExists: func(context.Context, string, string, string) (bool, error) { return true, nil }}
+ request := httptest.NewRequest(http.MethodPost, "/api/signed-service-urls/ns-a", strings.NewReader(`{
+ "claim":"claim-a","sandbox":"sandbox-a","service":"sandbox-a-mcp",
+ "logicalService":"mcp","label":"Customer demo","expiresInSeconds":3600
+}`))
+ request.SetPathValue("namespace", "ns-a")
+ request = request.WithContext(withTestUser(request.Context(), &auth.User{ID: "user-a"}))
+ response := httptest.NewRecorder()
+
+ handlers.CreateSignedServiceURL(response, request)
+
+ if response.Code != http.StatusCreated {
+ t.Fatalf("status = %d, want 201; body = %s", response.Code, response.Body.String())
+ }
+ if service.createInput.CreatorSub != "user-a" {
+ t.Fatalf("creator subject = %q, want user-a", service.createInput.CreatorSub)
+ }
+ if got, want := service.createInput.ExpiresIn, time.Hour; got != want {
+ t.Fatalf("expires in = %s, want %s", got, want)
+ }
+ if got, want := service.createInput.ServiceName, "sandbox-a-mcp"; got != want {
+ t.Fatalf("service name = %q, want derived %q", got, want)
+ }
+ var body SignedServiceURLResponse
+ if err := json.NewDecoder(response.Body).Decode(&body); err != nil {
+ t.Fatalf("decode response: %v", err)
+ }
+ if body.URL != signedServiceURLRecord().URL {
+ t.Fatalf("URL = %q, want %q", body.URL, signedServiceURLRecord().URL)
+ }
+}
+
+func TestCreateSignedServiceURLValidatesAndBindsPhysicalService(t *testing.T) {
+ for name, body := range map[string]string{
+ "invalid namespace": `{"claim":"claim-a","sandbox":"sandbox-a","service":"sandbox-a-mcp","logicalService":"mcp","expiresInSeconds":3600}`,
+ "invalid claim": `{"claim":"claim/a","sandbox":"sandbox-a","service":"sandbox-a-mcp","logicalService":"mcp","expiresInSeconds":3600}`,
+ "invalid sandbox": `{"claim":"claim-a","sandbox":"Sandbox-A","service":"Sandbox-A-mcp","logicalService":"mcp","expiresInSeconds":3600}`,
+ "invalid logical": `{"claim":"claim-a","sandbox":"sandbox-a","service":"sandbox-a-../mcp","logicalService":"../mcp","expiresInSeconds":3600}`,
+ "mismatched service": `{"claim":"claim-a","sandbox":"sandbox-a","service":"other-service","logicalService":"mcp","expiresInSeconds":3600}`,
+ } {
+ t.Run(name, func(t *testing.T) {
+ service := &fakeSignedServiceURLService{createRecord: signedServiceURLRecord()}
+ handler := Handlers{signedServiceURLs: service, signedServiceExists: func(context.Context, string, string, string) (bool, error) { return true, nil }}
+ request := signedServiceURLRequest(http.MethodPost, "ns-a", "", &auth.User{ID: "user-a"})
+ if name == "invalid namespace" {
+ request.SetPathValue("namespace", "ns/../other")
+ }
+ request.Body = io.NopCloser(strings.NewReader(body))
+ response := httptest.NewRecorder()
+ handler.CreateSignedServiceURL(response, request)
+ if response.Code != http.StatusBadRequest {
+ t.Fatalf("status = %d, want 400; body = %s", response.Code, response.Body.String())
+ }
+ if service.createCalls != 0 {
+ t.Fatalf("Create calls = %d, want 0", service.createCalls)
+ }
+ })
+ }
+}
+
+func TestCreateSignedServiceURLChecksKubernetesServiceBeforePersisting(t *testing.T) {
+ fakeK8s := newFakeK8s(http.StatusNotFound, `{"kind":"Status"}`)
+ t.Cleanup(fakeK8s.server.Close)
+ overrideK8sClient(fakeK8s.server.Client(), fakeK8s.server.URL, "fake-sa-token")
+ service := &fakeSignedServiceURLService{createRecord: signedServiceURLRecord()}
+ handler := Handlers{signedServiceURLs: service, checkSignedServiceExists: true}
+ request := signedServiceURLRequest(http.MethodPost, "ns-a", "", &auth.User{ID: "user-a"})
+ request.Body = io.NopCloser(strings.NewReader(signedServiceURLBody))
+ response := httptest.NewRecorder()
+ handler.CreateSignedServiceURL(response, request)
+ if response.Code != http.StatusNotFound {
+ t.Fatalf("status = %d, want 404; body = %s", response.Code, response.Body.String())
+ }
+ if service.createCalls != 0 {
+ t.Fatalf("Create calls = %d, want 0", service.createCalls)
+ }
+ if len(fakeK8s.requests) != 1 || fakeK8s.requests[0].method != http.MethodGet || fakeK8s.requests[0].path != "/api/v1/namespaces/ns-a/services/sandbox-a-mcp" {
+ t.Fatalf("Kubernetes requests = %#v, want GET service existence check", fakeK8s.requests)
+ }
+}
+
+func TestCreateSignedServiceURLReturnsUnavailableWhenKubernetesCannotValidate(t *testing.T) {
+ fakeK8s := newFakeK8s(http.StatusInternalServerError, "boom")
+ t.Cleanup(fakeK8s.server.Close)
+ overrideK8sClient(fakeK8s.server.Client(), fakeK8s.server.URL, "fake-sa-token")
+ handler := Handlers{signedServiceURLs: &fakeSignedServiceURLService{createRecord: signedServiceURLRecord()}, checkSignedServiceExists: true}
+ request := signedServiceURLRequest(http.MethodPost, "ns-a", "", &auth.User{ID: "user-a"})
+ request.Body = io.NopCloser(strings.NewReader(signedServiceURLBody))
+ response := httptest.NewRecorder()
+ handler.CreateSignedServiceURL(response, request)
+ if response.Code != http.StatusServiceUnavailable {
+ t.Fatalf("status = %d, want 503; body = %s", response.Code, response.Body.String())
+ }
+}
+
+func TestListSignedServiceURLsScopesToCallerAndNamespace(t *testing.T) {
+ service := &fakeSignedServiceURLService{listRecords: []signedurls.Record{signedServiceURLRecord(), secondSignedServiceURLRecord()}}
+ request := httptest.NewRequest(http.MethodGet, "/api/signed-service-urls/ns-a?claim=claim-a", nil)
+ request.SetPathValue("namespace", "ns-a")
+ request = request.WithContext(withTestUser(request.Context(), &auth.User{ID: "user-a"}))
+ response := httptest.NewRecorder()
+
+ Handlers{signedServiceURLs: service}.ListSignedServiceURLs(response, request)
+
+ if response.Code != http.StatusOK {
+ t.Fatalf("status = %d, want 200; body = %s", response.Code, response.Body.String())
+ }
+ if service.listNamespace != "ns-a" || service.listClaim != "claim-a" {
+ t.Fatalf("list scope = (%q, %q), want (ns-a, claim-a)", service.listNamespace, service.listClaim)
+ }
+ var body []SignedServiceURLResponse
+ if err := json.NewDecoder(response.Body).Decode(&body); err != nil {
+ t.Fatalf("decode response: %v", err)
+ }
+ if len(body) != 2 || body[0].Service != "sandbox-a-mcp" || body[1].Service != "sandbox-a-mcp" || body[0].ID == body[1].ID || body[0].Label == nil || body[1].Label == nil || *body[0].Label == *body[1].Label {
+ t.Fatalf("response = %+v, want two distinct records for one service", body)
+ }
+}
+
+func TestListSignedServiceURLsRequiresValidClaim(t *testing.T) {
+ for _, target := range []string{"/api/signed-service-urls/ns-a", "/api/signed-service-urls/ns-a?claim=invalid/claim"} {
+ request := httptest.NewRequest(http.MethodGet, target, nil)
+ request.SetPathValue("namespace", "ns-a")
+ request = request.WithContext(withTestUser(request.Context(), &auth.User{ID: "user-a"}))
+ response := httptest.NewRecorder()
+
+ Handlers{signedServiceURLs: &fakeSignedServiceURLService{}}.ListSignedServiceURLs(response, request)
+
+ if response.Code != http.StatusBadRequest {
+ t.Fatalf("target %q status = %d, want 400", target, response.Code)
+ }
+ }
+}
+
+func TestRevokeSignedServiceURLIsIdempotent(t *testing.T) {
+ record := signedServiceURLRecord()
+ service := &fakeSignedServiceURLService{revokeRecord: record}
+ request := signedServiceURLRequest(http.MethodDelete, "ns-a", record.ID.String(), &auth.User{ID: "user-a"})
+ for attempt := 1; attempt <= 2; attempt++ {
+ response := httptest.NewRecorder()
+ Handlers{signedServiceURLs: service}.RevokeSignedServiceURL(response, request)
+ if response.Code != http.StatusNoContent {
+ t.Fatalf("attempt %d status = %d, want 204; body = %s", attempt, response.Code, response.Body.String())
+ }
+ }
+ if service.revokeCalls != 2 || service.revokeNamespace != "ns-a" || service.revokeID != record.ID {
+ t.Fatalf("revoke scope = (%q, %s)", service.revokeNamespace, service.revokeID)
+ }
+}
+
+func TestSignedServiceURLStoreFailuresReturnInternalServerError(t *testing.T) {
+ cases := map[string]struct {
+ service *fakeSignedServiceURLService
+ handle func(Handlers, http.ResponseWriter, *http.Request)
+ request func() *http.Request
+ }{
+ "create": {
+ service: &fakeSignedServiceURLService{createErr: errors.New("store failed")},
+ handle: func(h Handlers, w http.ResponseWriter, r *http.Request) { h.CreateSignedServiceURL(w, r) },
+ request: func() *http.Request {
+ request := signedServiceURLRequest(http.MethodPost, "ns-a", "", &auth.User{ID: "user-a"})
+ request.Body = io.NopCloser(strings.NewReader(signedServiceURLBody))
+ return request
+ },
+ },
+ "list": {
+ service: &fakeSignedServiceURLService{listErr: errors.New("store failed")},
+ handle: func(h Handlers, w http.ResponseWriter, r *http.Request) { h.ListSignedServiceURLs(w, r) },
+ request: func() *http.Request {
+ request := signedServiceURLRequest(http.MethodGet, "ns-a", "", &auth.User{ID: "user-a"})
+ query := request.URL.Query()
+ query.Set("claim", "claim-a")
+ request.URL.RawQuery = query.Encode()
+ return request
+ },
+ },
+ "revoke": {
+ service: &fakeSignedServiceURLService{revokeErr: errors.New("store failed")},
+ handle: func(h Handlers, w http.ResponseWriter, r *http.Request) { h.RevokeSignedServiceURL(w, r) },
+ request: func() *http.Request {
+ return signedServiceURLRequest(http.MethodDelete, "ns-a", signedServiceURLRecord().ID.String(), &auth.User{ID: "user-a"})
+ },
+ },
+ }
+
+ for name, testCase := range cases {
+ t.Run(name, func(t *testing.T) {
+ response := httptest.NewRecorder()
+ testCase.handle(Handlers{signedServiceURLs: testCase.service}, response, testCase.request())
+ if response.Code != http.StatusInternalServerError {
+ t.Fatalf("status = %d, want %d", response.Code, http.StatusInternalServerError)
+ }
+ })
+ }
+}
+
+func TestSignedServiceURLHandlerErrors(t *testing.T) {
+ var logs bytes.Buffer
+ previousLogger := slog.Default()
+ slog.SetDefault(slog.New(slog.NewTextHandler(&logs, nil)))
+ t.Cleanup(func() { slog.SetDefault(previousLogger) })
+ for name, testCase := range map[string]struct {
+ method string
+ body string
+ id string
+ user *auth.User
+ service *fakeSignedServiceURLService
+ want int
+ }{
+ "malformed UUID": {method: http.MethodDelete, id: "not-a-uuid", user: &auth.User{ID: "user-a"}, service: &fakeSignedServiceURLService{}, want: http.StatusBadRequest},
+ "invalid body": {method: http.MethodPost, body: `{`, user: &auth.User{ID: "user-a"}, service: &fakeSignedServiceURLService{}, want: http.StatusBadRequest},
+ "missing user": {method: http.MethodPost, body: signedServiceURLBody, service: &fakeSignedServiceURLService{}, want: http.StatusUnauthorized},
+ "unavailable feature": {method: http.MethodPost, body: signedServiceURLBody, user: &auth.User{ID: "user-a"}, service: nil, want: http.StatusServiceUnavailable},
+ "invalid TTL": {method: http.MethodPost, body: signedServiceURLBody, user: &auth.User{ID: "user-a"}, service: &fakeSignedServiceURLService{createErr: signedurls.ErrInvalidInput}, want: http.StatusBadRequest},
+ "store failure": {method: http.MethodPost, body: signedServiceURLBody, user: &auth.User{ID: "user-a"}, service: &fakeSignedServiceURLService{createErr: errors.New("store failed " + capabilityToken)}, want: http.StatusInternalServerError},
+ "store unavailable": {method: http.MethodPost, body: signedServiceURLBody, user: &auth.User{ID: "user-a"}, service: &fakeSignedServiceURLService{createErr: signedurls.ErrUnavailable}, want: http.StatusServiceUnavailable},
+ "missing record": {method: http.MethodDelete, id: signedServiceURLRecord().ID.String(), user: &auth.User{ID: "user-a"}, service: &fakeSignedServiceURLService{revokeErr: signedurls.ErrNotFound}, want: http.StatusNotFound},
+ } {
+ t.Run(name, func(t *testing.T) {
+ request := signedServiceURLRequest(testCase.method, "ns-a", testCase.id, testCase.user)
+ if testCase.body != "" {
+ request.Body = io.NopCloser(strings.NewReader(testCase.body))
+ }
+ response := httptest.NewRecorder()
+ handlers := Handlers{signedServiceURLs: testCase.service, signedServiceExists: func(context.Context, string, string, string) (bool, error) { return true, nil }}
+ if testCase.service == nil {
+ handlers = Handlers{}
+ }
+ if testCase.method == http.MethodPost {
+ handlers.CreateSignedServiceURL(response, request)
+ } else {
+ handlers.RevokeSignedServiceURL(response, request)
+ }
+ if response.Code != testCase.want {
+ t.Fatalf("status = %d, want %d; body = %s", response.Code, testCase.want, response.Body.String())
+ }
+ if strings.Contains(response.Body.String(), capabilityToken) {
+ t.Fatalf("response leaked capability token: %s", response.Body.String())
+ }
+ if strings.Contains(logs.String(), capabilityToken) {
+ t.Fatalf("logs leaked capability token: %s", logs.String())
+ }
+ })
+ }
+}
+
+const signedServiceURLBody = `{"claim":"claim-a","sandbox":"sandbox-a","service":"sandbox-a-mcp","logicalService":"mcp","expiresInSeconds":3600}`
+
+func signedServiceURLRequest(method, namespace, id string, user *auth.User) *http.Request {
+ request := httptest.NewRequest(method, "/api/signed-service-urls/"+namespace, nil)
+ request.SetPathValue("namespace", namespace)
+ if id != "" {
+ request.SetPathValue("id", id)
+ }
+ if user != nil {
+ request = request.WithContext(withTestUser(request.Context(), user))
+ }
+ return request
+}
+
+func signedServiceURLRecord() signedurls.Record {
+ label := "Customer demo"
+ return signedurls.Record{ID: uuid.MustParse("5cd7f3e4-5390-4c0c-a93b-dd18116d367c"), Namespace: "ns-a", ClaimName: "claim-a", SandboxName: "sandbox-a", ServiceName: "sandbox-a-mcp", LogicalService: "mcp", Label: &label, CreatedAt: time.Date(2026, time.August, 31, 10, 0, 0, 0, time.UTC), ExpiresAt: time.Date(2026, time.August, 31, 11, 0, 0, 0, time.UTC), URL: "https://api.example.test/api/signed-svc/" + capabilityToken}
+}
+
+func secondSignedServiceURLRecord() signedurls.Record {
+ record := signedServiceURLRecord()
+ record.ID = uuid.MustParse("2a8cc1f2-33c9-40e1-8de6-8de4c615ef9a")
+ record.ServiceName = "sandbox-a-mcp"
+ label := "Support session"
+ record.Label = &label
+ return record
+}
+
+func TestSignedServiceURLValidationSubject(t *testing.T) {
+ for _, testCase := range []struct {
+ name string
+ user *auth.User
+ keyClientPfx string
+ want string
+ }{
+ {name: "normal user", user: &auth.User{ID: "user-a", AZP: "cyclops-cs-spa"}, want: "user-a"},
+ {name: "user key", user: &auth.User{ID: "user-a", AZP: "ukey-user-a"}, want: "user-a"},
+ {name: "GitHub OIDC", user: &auth.User{ID: "user-a", PrincipalType: auth.PrincipalTypeGitHubOIDC}, want: "user-a"},
+ {name: "per-key namespace claim", user: &auth.User{ID: "service-account", AZP: "key-ns-a", Namespace: "ns-a"}, want: ""},
+ {name: "per-key missing namespace claim", user: &auth.User{ID: "service-account", AZP: "key-ns-a"}, want: "service-account"},
+ {name: "custom per-key namespace claim", user: &auth.User{ID: "service-account", AZP: "poolkey-ns-a", Namespace: "ns-a"}, keyClientPfx: "poolkey-", want: ""},
+ {name: "legacy per-key prefix under custom configuration", user: &auth.User{ID: "service-account", AZP: "key-ns-a", Namespace: "ns-a"}, keyClientPfx: "poolkey-", want: "service-account"},
+ } {
+ t.Run(testCase.name, func(t *testing.T) {
+ if got := signedServiceURLValidationSubject(testCase.user, testCase.keyClientPfx); got != testCase.want {
+ t.Fatalf("subject = %q, want %q", got, testCase.want)
+ }
+ })
+ }
+}
+
+func TestCreateSignedServiceURLAuthorizesClaimTemplateAndService(t *testing.T) {
+ fakeK8s := newFakeK8sSequence(
+ fakeK8sResponse{status: http.StatusOK, body: `{"metadata":{"name":"claim-a"},"spec":{"sandboxTemplateRef":{"name":"template-a"}},"status":{"phase":"Bound","sandbox":{"name":"sandbox-a"}}}`},
+ fakeK8sResponse{status: http.StatusOK, body: `{"spec":{"vmTemplate":{"services":[{"name":"mcp"},{"name":"vnc"}]}}}`},
+ fakeK8sResponse{status: http.StatusOK, body: `{"metadata":{"name":"sandbox-a-mcp"}}`},
+ )
+ t.Cleanup(fakeK8s.server.Close)
+ overrideK8sClient(fakeK8s.server.Client(), fakeK8s.server.URL, "fake-sa-token")
+ service := &fakeSignedServiceURLService{createRecord: signedServiceURLRecord()}
+ handler := Handlers{
+ signedServiceURLs: service,
+ SignedServiceURLProvider: func() *signedurls.Service { return nil },
+ checkSignedServiceExists: true,
+ }
+ request := signedServiceURLRequest(http.MethodPost, "ns-a", "", &auth.User{ID: "user-a"})
+ request.Body = io.NopCloser(strings.NewReader(signedServiceURLBody))
+ response := httptest.NewRecorder()
+
+ handler.CreateSignedServiceURL(response, request)
+
+ if response.Code != http.StatusCreated {
+ t.Fatalf("status = %d, want 201; body = %s", response.Code, response.Body.String())
+ }
+ wantPaths := []string{
+ "/apis/osgym.cua.ai/v1alpha1/namespaces/ns-a/osgymsandboxclaims/claim-a",
+ "/apis/osgym.cua.ai/v1alpha1/namespaces/ns-a/osgymsandboxtemplates/template-a",
+ "/api/v1/namespaces/ns-a/services/sandbox-a-mcp",
+ }
+ if len(fakeK8s.requests) != len(wantPaths) {
+ t.Fatalf("Kubernetes request count = %d, want %d: %#v", len(fakeK8s.requests), len(wantPaths), fakeK8s.requests)
+ }
+ for index, wantPath := range wantPaths {
+ got := fakeK8s.requests[index]
+ if got.method != http.MethodGet || got.path != wantPath {
+ t.Fatalf("request %d = %s %s, want GET %s", index, got.method, got.path, wantPath)
+ }
+ if got.headers.Get("Impersonate-User") != "oidc:user-a" || got.headers.Get("Impersonate-Group") == "" {
+ t.Fatalf("request %d impersonation headers = %#v", index, got.headers)
+ }
+ }
+ if service.createCalls != 1 || service.createInput.ServiceName != "sandbox-a-mcp" {
+ t.Fatalf("create calls/input = %d/%+v", service.createCalls, service.createInput)
+ }
+}
+
+func TestCreateSignedServiceURLPerKeyUsesBackendServiceAccountForValidation(t *testing.T) {
+ fakeK8s := newFakeK8sSequence(
+ fakeK8sResponse{status: http.StatusOK, body: `{"metadata":{"name":"claim-a"},"spec":{"sandboxTemplateRef":{"name":"template-a"}},"status":{"phase":"Bound","sandbox":{"name":"sandbox-a"}}}`},
+ fakeK8sResponse{status: http.StatusOK, body: `{"spec":{"vmTemplate":{"services":[{"name":"mcp"}]}}}`},
+ fakeK8sResponse{status: http.StatusOK, body: `{"metadata":{"name":"sandbox-a-mcp"}}`},
+ )
+ t.Cleanup(fakeK8s.server.Close)
+ overrideK8sClient(fakeK8s.server.Client(), fakeK8s.server.URL, "fake-sa-token")
+ service := &fakeSignedServiceURLService{createRecord: signedServiceURLRecord()}
+ handler := Handlers{
+ signedServiceURLs: service,
+ SignedServiceURLProvider: func() *signedurls.Service { return nil },
+ checkSignedServiceExists: true,
+ }
+ request := signedServiceURLRequest(http.MethodPost, "ns-a", "", &auth.User{ID: "service-account", AZP: "key-ns-a", Namespace: "ns-a"})
+ request.Body = io.NopCloser(strings.NewReader(signedServiceURLBody))
+ response := httptest.NewRecorder()
+
+ handler.CreateSignedServiceURL(response, request)
+
+ if response.Code != http.StatusCreated {
+ t.Fatalf("status = %d, want 201; body = %s", response.Code, response.Body.String())
+ }
+ if len(fakeK8s.requests) != 3 {
+ t.Fatalf("Kubernetes request count = %d, want 3: %#v", len(fakeK8s.requests), fakeK8s.requests)
+ }
+ for index, request := range fakeK8s.requests {
+ if request.headers.Get("Authorization") != "Bearer fake-sa-token" {
+ t.Fatalf("request %d authorization = %q, want backend ServiceAccount token", index, request.headers.Get("Authorization"))
+ }
+ if request.headers.Get("Impersonate-User") != "" || request.headers.Get("Impersonate-Group") != "" {
+ t.Fatalf("request %d must not impersonate per-key caller: %#v", index, request.headers)
+ }
+ }
+ if service.createCalls != 1 || service.createInput.CreatorSub != "service-account" {
+ t.Fatalf("create calls/input = %d/%+v", service.createCalls, service.createInput)
+ }
+}
+
+func TestCreateSignedServiceURLCustomPerKeyPrefixUsesBackendServiceAccount(t *testing.T) {
+ fakeK8s := newFakeK8sSequence(
+ fakeK8sResponse{status: http.StatusOK, body: `{"metadata":{"name":"claim-a"},"spec":{"sandboxTemplateRef":{"name":"template-a"}},"status":{"phase":"Bound","sandbox":{"name":"sandbox-a"}}}`},
+ fakeK8sResponse{status: http.StatusOK, body: `{"spec":{"vmTemplate":{"services":[{"name":"mcp"}]}}}`},
+ fakeK8sResponse{status: http.StatusOK, body: `{"metadata":{"name":"sandbox-a-mcp"}}`},
+ )
+ t.Cleanup(fakeK8s.server.Close)
+ overrideK8sClient(fakeK8s.server.Client(), fakeK8s.server.URL, "fake-sa-token")
+ service := &fakeSignedServiceURLService{createRecord: signedServiceURLRecord()}
+ handler := Handlers{
+ AuthCfg: config.AuthConfiguration{KeyClientPfx: "poolkey-"},
+ signedServiceURLs: service,
+ SignedServiceURLProvider: func() *signedurls.Service { return nil },
+ checkSignedServiceExists: true,
+ }
+ request := signedServiceURLRequest(http.MethodPost, "ns-a", "", &auth.User{ID: "service-account", AZP: "poolkey-ns-a", Namespace: "ns-a"})
+ request.Body = io.NopCloser(strings.NewReader(signedServiceURLBody))
+ response := httptest.NewRecorder()
+
+ handler.CreateSignedServiceURL(response, request)
+
+ if response.Code != http.StatusCreated {
+ t.Fatalf("status = %d, want %d; body = %s", response.Code, http.StatusCreated, response.Body.String())
+ }
+ if len(fakeK8s.requests) != 3 {
+ t.Fatalf("Kubernetes request count = %d, want 3: %#v", len(fakeK8s.requests), fakeK8s.requests)
+ }
+ for index, request := range fakeK8s.requests {
+ if request.headers.Get("Authorization") != "Bearer fake-sa-token" {
+ t.Fatalf("request %d authorization = %q, want backend ServiceAccount token", index, request.headers.Get("Authorization"))
+ }
+ if request.headers.Get("Impersonate-User") != "" || request.headers.Get("Impersonate-Group") != "" {
+ t.Fatalf("request %d must not impersonate configured per-key caller: %#v", index, request.headers)
+ }
+ }
+}
+
+func TestCreateSignedServiceURLLegacyPerKeyPrefixUsesCallerIdentityWithCustomConfiguration(t *testing.T) {
+ fakeK8s := newFakeK8sSequence(
+ fakeK8sResponse{status: http.StatusOK, body: `{"metadata":{"name":"claim-a"},"spec":{"sandboxTemplateRef":{"name":"template-a"}},"status":{"phase":"Bound","sandbox":{"name":"sandbox-a"}}}`},
+ fakeK8sResponse{status: http.StatusOK, body: `{"spec":{"vmTemplate":{"services":[{"name":"mcp"}]}}}`},
+ fakeK8sResponse{status: http.StatusOK, body: `{"metadata":{"name":"sandbox-a-mcp"}}`},
+ )
+ t.Cleanup(fakeK8s.server.Close)
+ overrideK8sClient(fakeK8s.server.Client(), fakeK8s.server.URL, "fake-sa-token")
+ service := &fakeSignedServiceURLService{createRecord: signedServiceURLRecord()}
+ handler := Handlers{
+ AuthCfg: config.AuthConfiguration{KeyClientPfx: "poolkey-"},
+ signedServiceURLs: service,
+ SignedServiceURLProvider: func() *signedurls.Service { return nil },
+ checkSignedServiceExists: true,
+ }
+ request := signedServiceURLRequest(http.MethodPost, "ns-a", "", &auth.User{ID: "service-account", AZP: "key-ns-a", Namespace: "ns-a"})
+ request.Body = io.NopCloser(strings.NewReader(signedServiceURLBody))
+ response := httptest.NewRecorder()
+
+ handler.CreateSignedServiceURL(response, request)
+
+ if response.Code != http.StatusCreated {
+ t.Fatalf("status = %d, want %d; body = %s", response.Code, http.StatusCreated, response.Body.String())
+ }
+ if len(fakeK8s.requests) != 3 {
+ t.Fatalf("Kubernetes request count = %d, want 3: %#v", len(fakeK8s.requests), fakeK8s.requests)
+ }
+ for index, request := range fakeK8s.requests {
+ if request.headers.Get("Impersonate-User") != "oidc:service-account" || request.headers.Get("Impersonate-Group") == "" {
+ t.Fatalf("request %d impersonation headers = %#v, want caller identity", index, request.headers)
+ }
+ }
+}
+
+func TestCreateSignedServiceURLRejectsUnauthorizedClaimRelationships(t *testing.T) {
+ boundClaim := `{"metadata":{"name":"claim-a"},"spec":{"sandboxTemplateRef":{"name":"template-a"}},"status":{"phase":"Bound","sandbox":{"name":"sandbox-a"}}}`
+ for _, testCase := range []struct {
+ name string
+ responses []fakeK8sResponse
+ }{
+ {name: "missing claim", responses: []fakeK8sResponse{{status: http.StatusNotFound, body: `{"kind":"Status"}`}}},
+ {name: "claim not bound", responses: []fakeK8sResponse{{status: http.StatusOK, body: `{"metadata":{"name":"claim-a"},"spec":{"sandboxTemplateRef":{"name":"template-a"}},"status":{"phase":"Pending","sandbox":{"name":"sandbox-a"}}}`}}},
+ {name: "claim bound to another sandbox", responses: []fakeK8sResponse{{status: http.StatusOK, body: `{"metadata":{"name":"claim-a"},"spec":{"sandboxTemplateRef":{"name":"template-a"}},"status":{"phase":"Bound","sandbox":{"name":"sandbox-b"}}}`}}},
+ {name: "logical service absent from template", responses: []fakeK8sResponse{{status: http.StatusOK, body: boundClaim}, {status: http.StatusOK, body: `{"spec":{"vmTemplate":{"services":[{"name":"vnc"}]}}}`}}},
+ {name: "top-level services do not authorize", responses: []fakeK8sResponse{{status: http.StatusOK, body: boundClaim}, {status: http.StatusOK, body: `{"spec":{"services":[{"name":"mcp"}]}}`}}},
+ } {
+ t.Run(testCase.name, func(t *testing.T) {
+ fakeK8s := newFakeK8sSequence(testCase.responses...)
+ t.Cleanup(fakeK8s.server.Close)
+ overrideK8sClient(fakeK8s.server.Client(), fakeK8s.server.URL, "fake-sa-token")
+ service := &fakeSignedServiceURLService{createRecord: signedServiceURLRecord()}
+ handler := Handlers{
+ signedServiceURLs: service,
+ SignedServiceURLProvider: func() *signedurls.Service { return nil },
+ checkSignedServiceExists: true,
+ }
+ request := signedServiceURLRequest(http.MethodPost, "ns-a", "", &auth.User{ID: "user-a"})
+ request.Body = io.NopCloser(strings.NewReader(signedServiceURLBody))
+ response := httptest.NewRecorder()
+
+ handler.CreateSignedServiceURL(response, request)
+
+ if response.Code != http.StatusNotFound {
+ t.Fatalf("status = %d, want 404; body = %s", response.Code, response.Body.String())
+ }
+ if service.createCalls != 0 {
+ t.Fatalf("Create calls = %d, want 0", service.createCalls)
+ }
+ })
+ }
+}
diff --git a/libs/fleet/backend/handlers/signedsvc.go b/libs/fleet/backend/handlers/signedsvc.go
new file mode 100644
index 0000000000..f74c151e3c
--- /dev/null
+++ b/libs/fleet/backend/handlers/signedsvc.go
@@ -0,0 +1,70 @@
+package handlers
+
+import (
+ "context"
+ "errors"
+ "log/slog"
+ "net/http"
+ "strings"
+ "time"
+
+ "cyclops-cs-backend/signedurls"
+)
+
+type signedSvcResolver interface {
+ Resolve(context.Context, string, time.Time) (signedurls.Record, error)
+}
+
+func (h Handlers) HandleSignedSvc(w http.ResponseWriter, r *http.Request) {
+ token := r.PathValue("token")
+ resolver, ok := h.signedServiceURLService().(signedSvcResolver)
+ if !ok || token == "" {
+ http.NotFound(w, r)
+ return
+ }
+
+ record, err := resolver.Resolve(r.Context(), token, time.Now().UTC())
+ if errors.Is(err, signedurls.ErrInvalidCapability) {
+ http.NotFound(w, r)
+ return
+ }
+ if errors.Is(err, signedurls.ErrUnavailable) {
+ http.Error(w, "signed service unavailable", http.StatusServiceUnavailable)
+ return
+ }
+ if err != nil {
+ http.Error(w, "signed service resolution failed", http.StatusInternalServerError)
+ return
+ }
+ if !validSignedServiceURLIdentifier(record.Namespace) || !validSignedServiceURLIdentifier(record.ServiceName) {
+ http.NotFound(w, r)
+ return
+ }
+ exists, err := h.signedServiceExistsFor(r.Context(), record.Namespace, record.ServiceName, "")
+ if err != nil {
+ http.Error(w, "signed service lookup unavailable", http.StatusBadGateway)
+ return
+ }
+ if !exists {
+ http.NotFound(w, r)
+ return
+ }
+ slog.Info("signed service capability resolved", "url_id", record.ID)
+
+ upstreamPath := r.PathValue("path")
+ if upstreamPath == "" {
+ upstreamPath = "/"
+ } else if !strings.HasPrefix(upstreamPath, "/") {
+ upstreamPath = "/" + upstreamPath
+ }
+
+ h.proxyService(
+ w,
+ r,
+ record.Namespace,
+ record.ServiceName,
+ upstreamPath,
+ "/api/signed-svc/"+token,
+ "signed-svc",
+ )
+}
diff --git a/libs/fleet/backend/handlers/signedsvc_test.go b/libs/fleet/backend/handlers/signedsvc_test.go
new file mode 100644
index 0000000000..68e5c24be5
--- /dev/null
+++ b/libs/fleet/backend/handlers/signedsvc_test.go
@@ -0,0 +1,562 @@
+package handlers
+
+import (
+ "bytes"
+ "context"
+ "errors"
+ "fmt"
+ "io"
+ "log"
+ "log/slog"
+ "net/http"
+ "net/http/httptest"
+ "strings"
+ "testing"
+ "time"
+
+ "cyclops-cs-backend/config"
+ "cyclops-cs-backend/middlewares"
+ "cyclops-cs-backend/signedurls"
+
+ "github.com/google/uuid"
+ "go.opentelemetry.io/otel"
+ sdktrace "go.opentelemetry.io/otel/sdk/trace"
+ "go.opentelemetry.io/otel/sdk/trace/tracetest"
+)
+
+type fakeSignedSvcService struct {
+ record signedurls.Record
+ errors map[string]error
+}
+
+func (service fakeSignedSvcService) Create(context.Context, signedurls.CreateInput) (signedurls.Record, error) {
+ return signedurls.Record{}, errors.New("unexpected Create call")
+}
+
+func (service fakeSignedSvcService) List(context.Context, string, string) ([]signedurls.Record, error) {
+ return nil, errors.New("unexpected List call")
+}
+
+func (service fakeSignedSvcService) Revoke(context.Context, string, uuid.UUID) (signedurls.Record, error) {
+ return signedurls.Record{}, errors.New("unexpected Revoke call")
+}
+
+func (service fakeSignedSvcService) Resolve(_ context.Context, token string, _ time.Time) (signedurls.Record, error) {
+ if err := service.errors[token]; err != nil {
+ return signedurls.Record{}, err
+ }
+ return service.record, nil
+}
+
+type errorReadCloser struct {
+ err error
+}
+
+func (body errorReadCloser) Read([]byte) (int, error) {
+ return 0, body.err
+}
+
+func (errorReadCloser) Close() error {
+ return nil
+}
+
+type roundTripperFunc func(*http.Request) (*http.Response, error)
+
+func (function roundTripperFunc) RoundTrip(request *http.Request) (*http.Response, error) {
+ return function(request)
+}
+
+func TestHandleSignedSvc(t *testing.T) {
+ const validToken = "valid-capability-token"
+ record := signedurls.Record{
+ ID: uuid.MustParse("c8bc94ca-9514-47f2-97a6-8a84e8fc3a60"),
+ Namespace: "ns-a",
+ ServiceName: "sandbox-a-mcp",
+ }
+ service := fakeSignedSvcService{
+ record: record,
+ errors: map[string]error{
+ "malformed": signedurls.ErrInvalidCapability,
+ strings.Repeat("a", 4097): signedurls.ErrInvalidCapability,
+ "tampered": signedurls.ErrInvalidCapability,
+ "expired": signedurls.ErrInvalidCapability,
+ "unknown": signedurls.ErrInvalidCapability,
+ "row-mismatched": signedurls.ErrInvalidCapability,
+ "missing-service": signedurls.ErrInvalidCapability,
+ "revoked": signedurls.ErrInvalidCapability,
+ },
+ }
+
+ var (
+ upstreamCalls int
+ upstreamURL string
+ upstreamHdr http.Header
+ )
+ previousTransport := http.DefaultTransport
+ http.DefaultTransport = roundTripperFunc(func(request *http.Request) (*http.Response, error) {
+ upstreamCalls++
+ upstreamURL = request.URL.String()
+ upstreamHdr = request.Header.Clone()
+ return &http.Response{
+ StatusCode: http.StatusOK,
+ Header: http.Header{"Content-Type": {"application/octet-stream"}},
+ Body: io.NopCloser(bytes.NewReader([]byte{0x00, 0xff, 0x42})),
+ Request: request,
+ }, nil
+ })
+ t.Cleanup(func() { http.DefaultTransport = previousTransport })
+
+ var logs bytes.Buffer
+ previousLogger := slog.Default()
+ slog.SetDefault(slog.New(slog.NewTextHandler(&logs, nil)))
+ t.Cleanup(func() { slog.SetDefault(previousLogger) })
+
+ spanRecorder := tracetest.NewSpanRecorder()
+ tracerProvider := sdktrace.NewTracerProvider(sdktrace.WithSpanProcessor(spanRecorder))
+ previousTracerProvider := otel.GetTracerProvider()
+ otel.SetTracerProvider(tracerProvider)
+ t.Cleanup(func() {
+ otel.SetTracerProvider(previousTracerProvider)
+ _ = tracerProvider.Shutdown(context.Background())
+ })
+
+ handler := Handlers{
+ GatewayCfg: config.GatewayConfiguration{Scheme: "http", Port: "80", ClusterDomain: "svc.cluster.local"},
+ signedServiceURLs: service,
+ signedServiceExists: func(context.Context, string, string, string) (bool, error) { return true, nil },
+ }
+ invalidBody := ""
+ for _, testCase := range []struct {
+ name string
+ token string
+ path string
+ wantUpstream string
+ wantStatus int
+ }{
+ {
+ name: "valid capability proxies binary response",
+ token: validToken,
+ path: "/api/signed-svc/" + validToken + "/tools?cursor=next",
+ wantUpstream: "http://sandbox-a-mcp.ns-a.svc.cluster.local:80/tools?cursor=next",
+ wantStatus: http.StatusOK,
+ },
+ {name: "malformed capability is indistinguishable", token: "malformed", wantStatus: http.StatusNotFound},
+ {name: "oversized capability is indistinguishable", token: strings.Repeat("a", 4097), wantStatus: http.StatusNotFound},
+ {name: "tampered capability is indistinguishable", token: "tampered", wantStatus: http.StatusNotFound},
+ {name: "expired capability is indistinguishable", token: "expired", wantStatus: http.StatusNotFound},
+ {name: "unknown capability is indistinguishable", token: "unknown", wantStatus: http.StatusNotFound},
+ {name: "row-mismatched capability is indistinguishable", token: "row-mismatched", wantStatus: http.StatusNotFound},
+ {name: "revoked capability is indistinguishable", token: "revoked", wantStatus: http.StatusNotFound},
+ } {
+ t.Run(testCase.name, func(t *testing.T) {
+ path := testCase.path
+ if path == "" {
+ path = "/api/signed-svc/" + testCase.token
+ }
+ request := httptest.NewRequest(http.MethodGet, path, nil)
+ request.Header.Set("Authorization", "Bearer must-not-reach-sandbox")
+ request.Header.Set("Proxy-Authorization", "Basic must-not-reach-sandbox")
+ request.Header.Set("Connection", "X-Private-Hop")
+ request.Header.Set("X-Private-Hop", "must-not-reach-sandbox")
+ request.Header.Set("Cookie", "app_session=keep; _oauth2_proxy_svc=must-not-reach-sandbox")
+ request.Header.Set("X-Auth-Request-User", "must-not-reach-sandbox")
+ request.Header.Set("X-Auth-Request-Email", "must-not-reach-sandbox")
+ request.Header.Set("X-Auth-Request-Access-Token", "must-not-reach-sandbox")
+ request.Header.Set("X-Auth-Request-Groups", "must-not-reach-sandbox")
+ request.SetPathValue("token", testCase.token)
+ if strings.Contains(testCase.path, "/tools") {
+ request.SetPathValue("path", "tools")
+ }
+ response := httptest.NewRecorder()
+
+ handler.HandleSignedSvc(response, request)
+
+ if response.Code != testCase.wantStatus {
+ t.Fatalf("status = %d, want %d; body = %q", response.Code, testCase.wantStatus, response.Body.String())
+ }
+ if testCase.wantUpstream != "" {
+ if upstreamURL != testCase.wantUpstream {
+ t.Fatalf("upstream URL = %q, want %q", upstreamURL, testCase.wantUpstream)
+ }
+ if got := response.Body.Bytes(); !bytes.Equal(got, []byte{0x00, 0xff, 0x42}) {
+ t.Fatalf("body = %x, want 00ff42", got)
+ }
+ for _, header := range []string{"Authorization", "Proxy-Authorization", "Connection", "X-Private-Hop", "X-Auth-Request-User", "X-Auth-Request-Email", "X-Auth-Request-Access-Token", "X-Auth-Request-Groups"} {
+ if got := upstreamHdr.Get(header); got != "" {
+ t.Fatalf("upstream %s = %q, want empty", header, got)
+ }
+ }
+ if got, want := upstreamHdr.Get("Cookie"), "app_session=keep"; got != want {
+ t.Fatalf("upstream Cookie = %q, want %q", got, want)
+ }
+ return
+ }
+ if invalidBody == "" {
+ invalidBody = response.Body.String()
+ } else if response.Body.String() != invalidBody {
+ t.Fatalf("body = %q, want indistinguishable %q", response.Body.String(), invalidBody)
+ }
+ })
+ }
+
+ if upstreamCalls != 1 {
+ t.Fatalf("upstream calls = %d, want 1", upstreamCalls)
+ }
+ if !strings.Contains(logs.String(), record.ID.String()) {
+ t.Fatalf("logs do not contain resolved URL record ID %q: %s", record.ID, logs.String())
+ }
+ for _, token := range []string{validToken, "malformed", "tampered", "expired", "unknown", "row-mismatched", "revoked"} {
+ if strings.Contains(logs.String(), token) {
+ t.Fatalf("logs contain capability token %q: %s", token, logs.String())
+ }
+ for _, span := range spanRecorder.Ended() {
+ if strings.Contains(fmt.Sprint(span.Attributes()), token) {
+ t.Fatalf("span %q attributes contain capability token %q: %v", span.Name(), token, span.Attributes())
+ }
+ }
+ }
+}
+
+func TestHandleSignedSvcInvalidatesCapabilityWhenKubernetesServiceIsGone(t *testing.T) {
+ fakeK8s := newFakeK8s(http.StatusNotFound, `{"kind":"Status"}`)
+ t.Cleanup(fakeK8s.server.Close)
+ overrideK8sClient(fakeK8s.server.Client(), fakeK8s.server.URL, "fake-sa-token")
+ previousTransport := http.DefaultTransport
+ http.DefaultTransport = roundTripperFunc(func(*http.Request) (*http.Response, error) {
+ t.Fatal("missing Kubernetes Service reached upstream proxy")
+ return nil, nil
+ })
+ t.Cleanup(func() { http.DefaultTransport = previousTransport })
+ const token = "valid-capability-token"
+ handler := Handlers{GatewayCfg: config.GatewayConfiguration{Scheme: "http", Port: "80", ClusterDomain: "svc.cluster.local"}, signedServiceURLs: fakeSignedSvcService{record: signedurls.Record{ID: uuid.MustParse("c8bc94ca-9514-47f2-97a6-8a84e8fc3a60"), Namespace: "ns-a", ServiceName: "sandbox-a-mcp"}}, checkSignedServiceExists: true}
+ request := httptest.NewRequest(http.MethodGet, "/api/signed-svc/"+token, nil)
+ request.SetPathValue("token", token)
+ response := httptest.NewRecorder()
+ handler.HandleSignedSvc(response, request)
+ if response.Code != http.StatusNotFound {
+ t.Fatalf("status = %d, want 404; body = %q", response.Code, response.Body.String())
+ }
+ if len(fakeK8s.requests) != 1 || fakeK8s.requests[0].method != http.MethodGet || fakeK8s.requests[0].path != "/api/v1/namespaces/ns-a/services/sandbox-a-mcp" {
+ t.Fatalf("Kubernetes requests = %#v, want GET service existence check", fakeK8s.requests)
+ }
+}
+
+func TestHandleSignedSvcRewritesRedirects(t *testing.T) {
+ const token = "redirect-capability-token"
+ previousTransport := http.DefaultTransport
+ http.DefaultTransport = roundTripperFunc(func(request *http.Request) (*http.Response, error) {
+ return &http.Response{
+ StatusCode: http.StatusFound,
+ Header: http.Header{"Location": {"/login"}},
+ Body: io.NopCloser(strings.NewReader("")),
+ Request: request,
+ }, nil
+ })
+ t.Cleanup(func() { http.DefaultTransport = previousTransport })
+
+ handler := Handlers{
+ GatewayCfg: config.GatewayConfiguration{Scheme: "http", Port: "80", ClusterDomain: "svc.cluster.local"},
+ signedServiceURLs: fakeSignedSvcService{record: signedurls.Record{
+ ID: uuid.MustParse("c8bc94ca-9514-47f2-97a6-8a84e8fc3a60"), Namespace: "ns-a", ServiceName: "sandbox-a-mcp",
+ }},
+ }
+ request := httptest.NewRequest(http.MethodGet, "/api/signed-svc/"+token+"/tools", nil)
+ request.SetPathValue("token", token)
+ request.SetPathValue("path", "tools")
+ response := httptest.NewRecorder()
+
+ handler.HandleSignedSvc(response, request)
+
+ if response.Code != http.StatusFound {
+ t.Fatalf("status = %d, want %d", response.Code, http.StatusFound)
+ }
+ if got, want := response.Header().Get("Location"), "/api/signed-svc/"+token+"/login"; got != want {
+ t.Fatalf("Location = %q, want %q", got, want)
+ }
+}
+
+func TestRewriteLocationUsesCurrentProxiedPath(t *testing.T) {
+ const basePath = "/api/signed-svc/signed-capability-token"
+ for _, testCase := range []struct {
+ name string
+ upstreamPath string
+ location string
+ want string
+ }{
+ {name: "path-relative", upstreamPath: "/tools/current", location: "next", want: basePath + "/tools/next"},
+ {name: "query-only", upstreamPath: "/tools/current", location: "?cursor=next", want: basePath + "/tools/current?cursor=next"},
+ {name: "dot-segment remains under signed base", upstreamPath: "/tools/current", location: "../../../escape", want: basePath + "/escape"},
+ {name: "encoded relative dot-segment remains under signed base", upstreamPath: "/tools/current", location: "%2e%2e/escape", want: basePath + "/escape"},
+ {name: "encoded absolute dot-segment remains under signed base", upstreamPath: "/tools/current", location: "/%2e%2e/escape", want: basePath + "/escape"},
+ {name: "absolute upstream path", upstreamPath: "/tools/current", location: "/login", want: basePath + "/login"},
+ {name: "external URL", upstreamPath: "/tools/current", location: "https://example.com/login", want: "https://example.com/login"},
+ } {
+ t.Run(testCase.name, func(t *testing.T) {
+ if got := rewriteLocation(testCase.location, basePath, testCase.upstreamPath); got != testCase.want {
+ t.Fatalf("rewriteLocation(%q, %q, %q) = %q, want %q", testCase.location, basePath, testCase.upstreamPath, got, testCase.want)
+ }
+ })
+ }
+}
+
+func TestHandleSignedSvcPreservesEscapedPath(t *testing.T) {
+ const token = "encoded-path-capability-token"
+ var escapedPath string
+ previousTransport := http.DefaultTransport
+ http.DefaultTransport = roundTripperFunc(func(request *http.Request) (*http.Response, error) {
+ escapedPath = request.URL.EscapedPath()
+ return &http.Response{StatusCode: http.StatusNoContent, Body: io.NopCloser(strings.NewReader("")), Request: request}, nil
+ })
+ t.Cleanup(func() { http.DefaultTransport = previousTransport })
+
+ handler := Handlers{
+ GatewayCfg: config.GatewayConfiguration{Scheme: "http", Port: "80", ClusterDomain: "svc.cluster.local"},
+ signedServiceURLs: fakeSignedSvcService{record: signedurls.Record{
+ ID: uuid.MustParse("c8bc94ca-9514-47f2-97a6-8a84e8fc3a60"), Namespace: "ns-a", ServiceName: "sandbox-a-mcp",
+ }},
+ }
+ request := httptest.NewRequest(http.MethodGet, "/api/signed-svc/"+token+"/files/a%2Fb", nil)
+ request.SetPathValue("token", token)
+ request.SetPathValue("path", "files/a/b")
+ response := httptest.NewRecorder()
+
+ handler.HandleSignedSvc(response, request)
+
+ if response.Code != http.StatusNoContent {
+ t.Fatalf("status = %d, want %d", response.Code, http.StatusNoContent)
+ }
+ if escapedPath != "/files/a%2Fb" {
+ t.Fatalf("upstream escaped path = %q, want %q", escapedPath, "/files/a%2Fb")
+ }
+}
+
+func TestHandleSignedSvcUsesMatchedTelemetryRoute(t *testing.T) {
+ const token = "telemetry-route-capability-token"
+ previousTransport := http.DefaultTransport
+ http.DefaultTransport = roundTripperFunc(func(request *http.Request) (*http.Response, error) {
+ return &http.Response{StatusCode: http.StatusNoContent, Body: io.NopCloser(strings.NewReader("")), Request: request}, nil
+ })
+ t.Cleanup(func() { http.DefaultTransport = previousTransport })
+
+ handler := Handlers{
+ GatewayCfg: config.GatewayConfiguration{Scheme: "http", Port: "80", ClusterDomain: "svc.cluster.local"},
+ signedServiceURLs: fakeSignedSvcService{record: signedurls.Record{
+ ID: uuid.MustParse("c8bc94ca-9514-47f2-97a6-8a84e8fc3a60"), Namespace: "ns-a", ServiceName: "sandbox-a-mcp",
+ }},
+ }
+ for _, testCase := range []struct {
+ name string
+ path string
+ value string
+ route string
+ want string
+ }{
+ {name: "root", path: "/api/signed-svc/" + token, want: "/api/signed-svc/{token}"},
+ {name: "wildcard", path: "/api/signed-svc/" + token + "/tools", value: "tools", want: "/api/signed-svc/{token}/{path...}"},
+ {name: "wildcard empty", path: "/api/signed-svc/" + token + "/", route: "/api/signed-svc/{token}/{path...}", want: "/api/signed-svc/{token}/{path...}"},
+ } {
+ t.Run(testCase.name, func(t *testing.T) {
+ spanRecorder := tracetest.NewSpanRecorder()
+ tracerProvider := sdktrace.NewTracerProvider(sdktrace.WithSpanProcessor(spanRecorder))
+ previousTracerProvider := otel.GetTracerProvider()
+ otel.SetTracerProvider(tracerProvider)
+ t.Cleanup(func() {
+ otel.SetTracerProvider(previousTracerProvider)
+ _ = tracerProvider.Shutdown(context.Background())
+ })
+
+ request := httptest.NewRequest(http.MethodGet, testCase.path, nil)
+ if testCase.route != "" {
+ request = request.WithContext(context.WithValue(request.Context(), middlewares.ContextKey("route"), testCase.route))
+ }
+ request.SetPathValue("token", token)
+ if testCase.value != "" {
+ request.SetPathValue("path", testCase.value)
+ }
+ handler.HandleSignedSvc(httptest.NewRecorder(), request)
+
+ spans := spanRecorder.Ended()
+ if len(spans) != 1 {
+ t.Fatalf("ended spans = %d, want 1", len(spans))
+ }
+ for _, attribute := range spans[0].Attributes() {
+ if attribute.Key == "http.route" && attribute.Value.AsString() == testCase.want {
+ return
+ }
+ }
+ t.Fatalf("http.route attribute = %v, want %q", spans[0].Attributes(), testCase.want)
+ })
+ }
+}
+
+func TestHandleSignedSvcDoesNotExposeCapabilitySuffixOnProxyFailure(t *testing.T) {
+ const token = "capability-token-repeated-in-suffix"
+ record := signedurls.Record{
+ ID: uuid.MustParse("c8bc94ca-9514-47f2-97a6-8a84e8fc3a60"),
+ Namespace: "ns-a",
+ ServiceName: "sandbox-a-mcp",
+ }
+ for _, testCase := range []struct {
+ name string
+ err error
+ want int
+ }{
+ {name: "proxy error", err: errors.New("upstream failed for " + token), want: http.StatusBadGateway},
+ {name: "client cancellation", err: context.Canceled, want: statusClientClosedRequest},
+ } {
+ t.Run(testCase.name, func(t *testing.T) {
+ previousTransport := http.DefaultTransport
+ http.DefaultTransport = roundTripperFunc(func(*http.Request) (*http.Response, error) {
+ return nil, testCase.err
+ })
+ t.Cleanup(func() { http.DefaultTransport = previousTransport })
+
+ var logs bytes.Buffer
+ previousLogger := slog.Default()
+ slog.SetDefault(slog.New(slog.NewTextHandler(&logs, nil)))
+ t.Cleanup(func() { slog.SetDefault(previousLogger) })
+
+ spanRecorder := tracetest.NewSpanRecorder()
+ tracerProvider := sdktrace.NewTracerProvider(sdktrace.WithSpanProcessor(spanRecorder))
+ previousTracerProvider := otel.GetTracerProvider()
+ otel.SetTracerProvider(tracerProvider)
+ t.Cleanup(func() {
+ otel.SetTracerProvider(previousTracerProvider)
+ _ = tracerProvider.Shutdown(context.Background())
+ })
+
+ handler := Handlers{
+ GatewayCfg: config.GatewayConfiguration{Scheme: "http", Port: "80", ClusterDomain: "svc.cluster.local"},
+ signedServiceURLs: fakeSignedSvcService{record: record},
+ }
+ request := httptest.NewRequest(http.MethodGet, "/api/signed-svc/"+token+"/"+token, nil)
+ request.SetPathValue("token", token)
+ request.SetPathValue("path", token)
+ response := httptest.NewRecorder()
+
+ handler.HandleSignedSvc(response, request)
+
+ if response.Code != testCase.want {
+ t.Fatalf("status = %d, want %d", response.Code, testCase.want)
+ }
+ if strings.Contains(logs.String(), token) {
+ t.Fatalf("logs leaked capability suffix: %s", logs.String())
+ }
+ if !strings.Contains(logs.String(), record.ID.String()) {
+ t.Fatalf("logs do not contain signed URL record ID %q: %s", record.ID, logs.String())
+ }
+ for _, span := range spanRecorder.Ended() {
+ if strings.Contains(fmt.Sprint(span.Attributes()), token) || strings.Contains(fmt.Sprint(span.Events()), token) {
+ t.Fatalf("span leaked capability suffix: attributes=%v events=%v", span.Attributes(), span.Events())
+ }
+ }
+ })
+ }
+}
+
+func TestHandleSignedSvcPreservesEscapedPathAfterEscapedToken(t *testing.T) {
+ const token = "capability~token"
+ var escapedPath string
+ previousTransport := http.DefaultTransport
+ http.DefaultTransport = roundTripperFunc(func(request *http.Request) (*http.Response, error) {
+ escapedPath = request.URL.EscapedPath()
+ return &http.Response{StatusCode: http.StatusNoContent, Body: io.NopCloser(strings.NewReader("")), Request: request}, nil
+ })
+ t.Cleanup(func() { http.DefaultTransport = previousTransport })
+
+ handler := Handlers{
+ GatewayCfg: config.GatewayConfiguration{Scheme: "http", Port: "80", ClusterDomain: "svc.cluster.local"},
+ signedServiceURLs: fakeSignedSvcService{record: signedurls.Record{
+ ID: uuid.MustParse("c8bc94ca-9514-47f2-97a6-8a84e8fc3a60"), Namespace: "ns-a", ServiceName: "sandbox-a-mcp",
+ }},
+ }
+ request := httptest.NewRequest(http.MethodGet, "/api/signed-svc/capability%7Etoken/files/a%2Fb", nil)
+ request.SetPathValue("token", token)
+ request.SetPathValue("path", "files/a/b")
+ response := httptest.NewRecorder()
+
+ handler.HandleSignedSvc(response, request)
+
+ if response.Code != http.StatusNoContent {
+ t.Fatalf("status = %d, want %d", response.Code, http.StatusNoContent)
+ }
+ if escapedPath != "/files/a%2Fb" {
+ t.Fatalf("upstream escaped path = %q, want %q", escapedPath, "/files/a%2Fb")
+ }
+}
+
+func TestHandleSignedSvcDiscardsBodyCopyErrorLog(t *testing.T) {
+ const token = "capability-token-repeated-in-malformed-body"
+ previousTransport := http.DefaultTransport
+ http.DefaultTransport = roundTripperFunc(func(request *http.Request) (*http.Response, error) {
+ return &http.Response{
+ StatusCode: http.StatusOK,
+ Header: make(http.Header),
+ Body: errorReadCloser{err: errors.New("malformed chunked body contains " + token)},
+ Request: request,
+ }, nil
+ })
+ t.Cleanup(func() { http.DefaultTransport = previousTransport })
+
+ var logs bytes.Buffer
+ previousOutput := log.Writer()
+ previousFlags := log.Flags()
+ previousPrefix := log.Prefix()
+ log.SetOutput(&logs)
+ log.SetFlags(0)
+ log.SetPrefix("")
+ t.Cleanup(func() {
+ log.SetOutput(previousOutput)
+ log.SetFlags(previousFlags)
+ log.SetPrefix(previousPrefix)
+ })
+
+ handler := Handlers{
+ GatewayCfg: config.GatewayConfiguration{Scheme: "http", Port: "80", ClusterDomain: "svc.cluster.local"},
+ signedServiceURLs: fakeSignedSvcService{record: signedurls.Record{
+ ID: uuid.MustParse("c8bc94ca-9514-47f2-97a6-8a84e8fc3a60"), Namespace: "ns-a", ServiceName: "sandbox-a-mcp",
+ }},
+ }
+ request := httptest.NewRequest(http.MethodGet, "/api/signed-svc/"+token+"/"+token, nil)
+ request.SetPathValue("token", token)
+ request.SetPathValue("path", token)
+ response := httptest.NewRecorder()
+
+ handler.HandleSignedSvc(response, request)
+
+ if response.Code != http.StatusOK {
+ t.Fatalf("status = %d, want %d", response.Code, http.StatusOK)
+ }
+ if strings.Contains(logs.String(), token) {
+ t.Fatalf("copy error log leaked capability token: %s", logs.String())
+ }
+}
+
+func TestHandleSignedSvcMapsResolverErrorsWithoutLeakingDetails(t *testing.T) {
+ for _, testCase := range []struct {
+ name string
+ err error
+ wantStatus int
+ }{
+ {name: "invalid capability", err: signedurls.ErrInvalidCapability, wantStatus: http.StatusNotFound},
+ {name: "dependency unavailable", err: signedurls.ErrUnavailable, wantStatus: http.StatusServiceUnavailable},
+ {name: "unexpected internal failure", err: errors.New("secret database detail"), wantStatus: http.StatusInternalServerError},
+ } {
+ t.Run(testCase.name, func(t *testing.T) {
+ token := "sensitive-capability-token"
+ handler := Handlers{signedServiceURLs: fakeSignedSvcService{errors: map[string]error{token: testCase.err}}}
+ request := httptest.NewRequest(http.MethodGet, "/api/signed-svc/"+token, nil)
+ request.SetPathValue("token", token)
+ response := httptest.NewRecorder()
+
+ handler.HandleSignedSvc(response, request)
+
+ if response.Code != testCase.wantStatus {
+ t.Fatalf("status = %d, want %d; body = %q", response.Code, testCase.wantStatus, response.Body.String())
+ }
+ if strings.Contains(response.Body.String(), token) || strings.Contains(response.Body.String(), "secret database detail") {
+ t.Fatalf("response leaked sensitive detail: %q", response.Body.String())
+ }
+ })
+ }
+}
diff --git a/libs/fleet/backend/handlers/svc.go b/libs/fleet/backend/handlers/svc.go
index ab7ea6a0b8..6a0ffc8e58 100644
--- a/libs/fleet/backend/handlers/svc.go
+++ b/libs/fleet/backend/handlers/svc.go
@@ -4,14 +4,18 @@ import (
"context"
"errors"
"fmt"
+ "io"
+ "log"
"log/slog"
"net/http"
"net/http/httputil"
"net/url"
+ "path"
"strings"
"time"
"cyclops-cs-backend/metrics"
+ "cyclops-cs-backend/middlewares"
"go.opentelemetry.io/otel/attribute"
"go.opentelemetry.io/otel/codes"
"go.opentelemetry.io/otel/trace"
@@ -19,6 +23,33 @@ import (
const statusClientClosedRequest = 499
+const oauth2ProxySvcCookieName = "_oauth2_proxy_svc"
+
+func stripOAuth2ProxyIdentityHeaders(header http.Header) {
+ for name := range header {
+ if strings.HasPrefix(strings.ToLower(name), "x-auth-request-") {
+ header.Del(name)
+ }
+ }
+}
+
+func stripOAuth2ProxySvcCookie(header http.Header) {
+ var cookies []string
+ for _, line := range header.Values("Cookie") {
+ for _, cookie := range strings.Split(line, ";") {
+ name, _, _ := strings.Cut(strings.TrimSpace(cookie), "=")
+ if name != oauth2ProxySvcCookieName {
+ cookies = append(cookies, strings.TrimSpace(cookie))
+ }
+ }
+ }
+ if len(cookies) == 0 {
+ header.Del("Cookie")
+ return
+ }
+ header.Set("Cookie", strings.Join(cookies, "; "))
+}
+
func svcProxyErrorStatus(err error) int {
if errors.Is(err, context.Canceled) {
return statusClientClosedRequest
@@ -26,39 +57,58 @@ func svcProxyErrorStatus(err error) int {
return http.StatusBadGateway
}
-// rewriteLocation prepends basePath to upstream Location header values
-// so browsers stay within the /api/svc proxy prefix. External URLs
-// (with a host) are returned unchanged.
-func rewriteLocation(loc, basePath string) string {
+// rewriteLocation resolves same-origin upstream Location values against the
+// current upstream path, then prefixes the proxy base path. External URLs are
+// returned unchanged so redirects cannot escape the proxy base.
+func rewriteLocation(loc, basePath, upstreamPath string) string {
if loc == "" {
return ""
}
- // Absolute path: /foo → /api/svc/{ns}/{svc}/foo
- if strings.HasPrefix(loc, "/") {
- return basePath + loc
- }
- // Full URL with host — leave as-is (external redirect)
- parsed, err := url.Parse(loc)
- if err != nil || parsed.Host != "" {
+ location, err := url.Parse(loc)
+ if err != nil || location.IsAbs() || location.Host != "" {
return loc
}
- // Relative path: foo → /api/svc/{ns}/{svc}/foo
- return basePath + "/" + loc
+ resolved := (&url.URL{Path: upstreamPath}).ResolveReference(location)
+ if hasDotPathSegment(resolved.Path) {
+ resolved.Path = path.Clean(resolved.Path)
+ resolved.RawPath = ""
+ }
+ resolved.Path = basePath + resolved.Path
+ if resolved.RawPath != "" {
+ resolved.RawPath = basePath + resolved.RawPath
+ }
+ return resolved.String()
+}
+
+func hasDotPathSegment(value string) bool {
+ for _, segment := range strings.Split(value, "/") {
+ if segment == "." || segment == ".." {
+ return true
+ }
+ }
+ return false
}
func newSvcReverseProxy(target *url.URL, upstreamPath, basePath string) *httputil.ReverseProxy {
+ return newSvcReverseProxyWithRawPath(target, upstreamPath, "", basePath)
+}
+
+func newSvcReverseProxyWithRawPath(target *url.URL, upstreamPath, upstreamRawPath, basePath string) *httputil.ReverseProxy {
rp := httputil.NewSingleHostReverseProxy(target)
origDirector := rp.Director
rp.Director = func(req *http.Request) {
origDirector(req)
req.URL.Path = upstreamPath
- req.URL.RawPath = ""
+ req.URL.RawPath = upstreamRawPath
req.Header.Del("Authorization")
+ req.Header.Del("Proxy-Authorization")
+ stripOAuth2ProxyIdentityHeaders(req.Header)
+ stripOAuth2ProxySvcCookie(req.Header)
req.Host = target.Host
}
rp.ModifyResponse = func(resp *http.Response) error {
loc := resp.Header.Get("Location")
- if rewritten := rewriteLocation(loc, basePath); rewritten != loc {
+ if rewritten := rewriteLocation(loc, basePath, upstreamPath); rewritten != loc {
resp.Header.Set("Location", rewritten)
}
return nil
@@ -66,6 +116,109 @@ func newSvcReverseProxy(target *url.URL, upstreamPath, basePath string) *httputi
return rp
}
+func upstreamRawPath(r *http.Request, basePath, fallback string) string {
+ rawPath := r.URL.EscapedPath()
+ if strings.HasPrefix(rawPath, "/api/signed-svc/") {
+ _, suffix, found := strings.Cut(strings.TrimPrefix(rawPath, "/api/signed-svc/"), "/")
+ if !found {
+ return "/"
+ }
+ rawPath = "/" + suffix
+ } else {
+ if !strings.HasPrefix(rawPath, basePath) {
+ return fallback
+ }
+ rawPath = strings.TrimPrefix(rawPath, basePath)
+ }
+ if rawPath == "" {
+ return "/"
+ }
+ if !strings.HasPrefix(rawPath, "/") {
+ return fallback
+ }
+ if rawPath == fallback {
+ return ""
+ }
+ return rawPath
+}
+
+func (h Handlers) proxyService(w http.ResponseWriter, r *http.Request, namespace, service, upstreamPath, basePath, telemetryKind string) {
+ host := fmt.Sprintf("%s.%s.%s", service, namespace, h.GatewayCfg.ClusterDomain)
+ target := &url.URL{Scheme: h.GatewayCfg.Scheme, Host: host + ":" + h.GatewayCfg.Port}
+ route, _ := r.Context().Value(middlewares.ContextKey("route")).(string)
+ if route == "" {
+ route = "/api/svc/{namespace}/{service}"
+ if r.PathValue("path") != "" {
+ route += "/{path...}"
+ }
+ if telemetryKind == "signed-svc" {
+ route = "/api/signed-svc/{token}"
+ if r.PathValue("path") != "" {
+ route += "/{path...}"
+ }
+ }
+ }
+ spanAttrs := []attribute.KeyValue{
+ attribute.String("proxy.target", telemetryKind),
+ attribute.String("http.route", route),
+ }
+ if telemetryKind != "signed-svc" {
+ spanAttrs = append(spanAttrs,
+ attribute.String("k8s.namespace", namespace),
+ attribute.String("k8s.service", service),
+ attribute.String("http.target_path", upstreamPath),
+ )
+ }
+ ctx, span := handlerTracer().Start(r.Context(), telemetryKind+".proxy", trace.WithAttributes(spanAttrs...))
+ defer span.End()
+
+ upstreamRawPath := upstreamRawPath(r, basePath, upstreamPath)
+ rp := newSvcReverseProxyWithRawPath(target, upstreamPath, upstreamRawPath, basePath)
+ if telemetryKind == "signed-svc" {
+ rp.ErrorLog = log.New(io.Discard, "", 0)
+ }
+ origDirector := rp.Director
+ rp.Director = func(req *http.Request) {
+ origDirector(req)
+ req.URL.RawQuery = r.URL.RawQuery
+ }
+
+ rw := &statusCapture{ResponseWriter: w}
+ rp.ErrorHandler = func(rw http.ResponseWriter, _ *http.Request, err error) {
+ status := svcProxyErrorStatus(err)
+ if status == statusClientClosedRequest {
+ span.SetStatus(codes.Unset, "client canceled")
+ if telemetryKind == "signed-svc" {
+ slog.Info("signed-svc proxy canceled")
+ } else {
+ slog.Info(telemetryKind+" proxy canceled", "host", host, "path", upstreamPath, "err", err)
+ }
+ rw.WriteHeader(status)
+ return
+ }
+ span.SetStatus(codes.Error, "upstream unavailable")
+ if telemetryKind == "signed-svc" {
+ slog.Warn("signed-svc proxy error")
+ } else {
+ span.RecordError(err)
+ slog.Warn(telemetryKind+" proxy error", "host", host, "path", upstreamPath, "err", err)
+ }
+ http.Error(rw, "upstream unavailable", status)
+ }
+
+ start := time.Now()
+ if telemetryKind == "svc" {
+ logAttrs := []any{"namespace", namespace, "service", service, "path", upstreamPath}
+ if user := currentUser(r); user != nil {
+ logAttrs = append([]any{"client", user.AZP}, logAttrs...)
+ }
+ slog.Info("svc proxy", logAttrs...)
+ }
+ rp.ServeHTTP(rw, r.WithContext(ctx))
+ span.SetAttributes(attribute.Int("http.status_code", rw.statusCode))
+ metrics.RecordUpstreamProxy(telemetryKind, rw.statusCode, time.Since(start))
+}
+
// Svc godoc
//
// @Summary Authenticated reverse proxy to a K8s Service in a namespace the caller owns
@@ -103,55 +256,21 @@ func (h Handlers) Svc(w http.ResponseWriter, r *http.Request) {
// of SvcRoutePolicy, which has already run by the time this handler is
// reached — see auth/authz_ownership.rego.
- host := fmt.Sprintf("%s.%s.%s", service, ns, h.GatewayCfg.ClusterDomain)
- target := &url.URL{Scheme: h.GatewayCfg.Scheme, Host: host + ":" + h.GatewayCfg.Port}
-
upstreamPath := r.PathValue("path")
if upstreamPath == "" {
upstreamPath = "/"
} else if !strings.HasPrefix(upstreamPath, "/") {
upstreamPath = "/" + upstreamPath
}
- ctx, span := handlerTracer().Start(r.Context(), "svc.proxy", trace.WithAttributes(
- attribute.String("proxy.target", "svc"),
- attribute.String("http.route", "/api/svc/{namespace}/{service}/{path...}"),
- attribute.String("k8s.namespace", ns),
- attribute.String("k8s.service", service),
- attribute.String("http.target_path", upstreamPath),
- ))
- defer span.End()
-
- // The base path prefix that the upstream doesn't know about.
- // Upstream redirects (Location headers) must be rewritten to
- // prepend this prefix so the browser stays within /api/svc.
- basePath := fmt.Sprintf("/api/svc/%s/%s", ns, service)
- rp := newSvcReverseProxy(target, upstreamPath, basePath)
- origDirector := rp.Director
- rp.Director = func(req *http.Request) {
- origDirector(req)
- req.URL.RawQuery = r.URL.RawQuery
- }
-
- rw := &statusCapture{ResponseWriter: w}
- rp.ErrorHandler = func(rw http.ResponseWriter, _ *http.Request, err error) {
- status := svcProxyErrorStatus(err)
- if status == statusClientClosedRequest {
- span.SetStatus(codes.Unset, "client canceled")
- slog.Info("svc proxy canceled", "host", host, "path", upstreamPath, "err", err)
- rw.WriteHeader(status)
- return
- }
- span.RecordError(err)
- span.SetStatus(codes.Error, "upstream unavailable")
- slog.Warn("svc proxy error", "host", host, "path", upstreamPath, "err", err)
- http.Error(rw, "upstream unavailable", status)
- }
+ h.proxyService(
+ w,
+ r,
+ ns,
+ service,
+ upstreamPath,
+ fmt.Sprintf("/api/svc/%s/%s", ns, service),
+ "svc",
+ )
- start := time.Now()
- slog.Info("svc proxy",
- "client", user.AZP, "namespace", ns, "service", service, "path", upstreamPath)
- rp.ServeHTTP(rw, r.WithContext(ctx))
- span.SetAttributes(attribute.Int("http.status_code", rw.statusCode))
- metrics.RecordUpstreamProxy("svc", rw.statusCode, time.Since(start))
}
diff --git a/libs/fleet/backend/handlers/svc_test.go b/libs/fleet/backend/handlers/svc_test.go
index 12accdfc59..365e65cda0 100644
--- a/libs/fleet/backend/handlers/svc_test.go
+++ b/libs/fleet/backend/handlers/svc_test.go
@@ -37,7 +37,7 @@ func TestRewriteLocation(t *testing.T) {
for _, tc := range tests {
t.Run(tc.name, func(t *testing.T) {
- got := rewriteLocation(tc.location, tc.basePath)
+ got := rewriteLocation(tc.location, tc.basePath, "/")
if got != tc.want {
t.Errorf("rewriteLocation(%q, %q) = %q, want %q", tc.location, tc.basePath, got, tc.want)
}
diff --git a/libs/fleet/backend/main.go b/libs/fleet/backend/main.go
index b2e603ee20..05ab7e6ba2 100644
--- a/libs/fleet/backend/main.go
+++ b/libs/fleet/backend/main.go
@@ -21,12 +21,15 @@ package main
import (
"context"
+ "crypto/sha256"
"errors"
"fmt"
"log/slog"
"net/http"
"os"
"os/signal"
+ "strings"
+ "sync"
"syscall"
"time"
@@ -45,6 +48,7 @@ import (
"cyclops-cs-backend/metrics"
"cyclops-cs-backend/middlewares"
"cyclops-cs-backend/productanalytics"
+ "cyclops-cs-backend/signedurls"
"cyclops-cs-backend/statequery"
"cyclops-cs-backend/telemetry"
"cyclops-cs-backend/usage"
@@ -228,6 +232,9 @@ func setupRouter(c handlers.Handlers) http.Handler {
// namespace ownership are all the policy's: per-key and GitHub tokens by
// their claims, everyone else by an impersonated RoleBinding probe the
// policy reads as a fact — see auth/authz_ownership.rego.
+ r.Handle("/api/signed-svc/{token}", onlyLog("/api/signed-svc/{token}", c.HandleSignedSvc))
+ r.Handle("/api/signed-svc/{token}/{path...}", onlyLog("/api/signed-svc/{token}/{path...}", c.HandleSignedSvc))
+
r.Handle("/api/svc/{namespace}/{service}",
withAuthenticatedMiddlewares("/api/svc/{namespace}/{service}", c.Svc,
productanalytics.RouteObserverWithQualification("/api/svc/{namespace}/{service}", c.Analytics, c.AuthCfg.SPAClientID, svcQualifier)))
@@ -235,6 +242,13 @@ func setupRouter(c handlers.Handlers) http.Handler {
withAuthenticatedMiddlewares("/api/svc/{namespace}/{service}/{path...}", c.Svc,
productanalytics.RouteObserverWithQualification("/api/svc/{namespace}/{service}/{path...}", c.Analytics, c.AuthCfg.SPAClientID, svcQualifier)))
+ r.Handle("POST /api/signed-service-urls/{namespace}",
+ withAuthenticatedMiddlewares("/api/signed-service-urls/{namespace}", c.CreateSignedServiceURL))
+ r.Handle("GET /api/signed-service-urls/{namespace}",
+ withAuthenticatedMiddlewares("/api/signed-service-urls/{namespace}", c.ListSignedServiceURLs))
+ r.Handle("DELETE /api/signed-service-urls/{namespace}/{id}",
+ withAuthenticatedMiddlewares("/api/signed-service-urls/{namespace}/{id}", c.RevokeSignedServiceURL))
+
// K8s API access replaces the unauthenticated /k8s-api nginx location.
r.Handle("/api/k8s/{path...}",
withAuthenticatedMiddlewares("/api/k8s/{path...}", c.K8s,
@@ -378,6 +392,25 @@ func run() error {
h := handlers.New(admin, cfg)
h.Analytics = analyticsClient
+ signedServiceURLsContext, cancelSignedServiceURLs := context.WithCancel(ctx)
+ defer cancelSignedServiceURLs()
+ var signedServiceURLsRetry sync.WaitGroup
+ var signedServiceURLsMu sync.RWMutex
+ var signedServiceURLs *signedurls.Service
+ closeSignedServiceURLs := func() {}
+ h.SignedServiceURLProvider = func() *signedurls.Service {
+ signedServiceURLsMu.RLock()
+ defer signedServiceURLsMu.RUnlock()
+ return signedServiceURLs
+ }
+ installSignedServiceURLs := func(service *signedurls.Service, close func()) {
+ signedServiceURLsMu.Lock()
+ signedServiceURLs = service
+ closeSignedServiceURLs = close
+ signedServiceURLsMu.Unlock()
+ }
+ startupErrors = errors.Join(startupErrors, startSignedServiceURLs(ctx, signedServiceURLsContext, cfg.Database.URL, cfg.SignedServiceURL, &signedServiceURLsRetry, installSignedServiceURLs))
+ defer shutdownSignedServiceURLs(cancelSignedServiceURLs, &signedServiceURLsRetry, &signedServiceURLsMu, &closeSignedServiceURLs)
usageProvider, closeUsageProvider, err := initializeUsageProvider(ctx, cfg.Usage)
if err != nil {
return errors.Join(fmt.Errorf("initialize usage provider: %w", err), startupErrors, telemetryErr)
@@ -446,6 +479,107 @@ func run() error {
return errors.Join(serveUntilCanceled(ctx, srv), startupErrors, telemetryErr)
}
+// startSignedServiceURLs installs the signed service URL dependency on first
+// try, or arms the background retry loop and reports the degradation so run()
+// can fold it into the startup error set. Serving stays up either way; the
+// routes answer 503 until a retry succeeds.
+func startSignedServiceURLs(ctx, retryCtx context.Context, databaseURL string, cfg config.SignedServiceURLConfiguration, retry *sync.WaitGroup, install func(*signedurls.Service, func())) error {
+ service, close, err := initializeSignedServiceURLs(ctx, databaseURL, cfg)
+ if err == nil {
+ install(service, close)
+ return nil
+ }
+ slog.Error("signed service URLs: initialization unavailable; routes will return 503", "class", "dependency_unavailable", "retryable", true)
+ retry.Add(1)
+ go func() {
+ defer retry.Done()
+ ticker := time.NewTicker(databaseRetryInterval)
+ defer ticker.Stop()
+ for {
+ select {
+ case <-retryCtx.Done():
+ return
+ case <-ticker.C:
+ service, close, err := initializeSignedServiceURLs(retryCtx, databaseURL, cfg)
+ if err == nil {
+ install(service, close)
+ slog.Info("signed service URLs: recovered without a restart")
+ return
+ }
+ }
+ }
+ }()
+ return fmt.Errorf("initialize signed service URLs: %w", err)
+}
+
+func shutdownSignedServiceURLs(cancel context.CancelFunc, retry *sync.WaitGroup, mu *sync.RWMutex, closeStore *func()) {
+ cancel()
+ retry.Wait()
+ mu.Lock()
+ close := *closeStore
+ *closeStore = func() {}
+ mu.Unlock()
+ close()
+}
+
+func initializeSignedServiceURLs(ctx context.Context, databaseURL string, cfg config.SignedServiceURLConfiguration) (*signedurls.Service, func(), error) {
+ secret, err := signedServiceURLSecret(cfg)
+ if err != nil {
+ return nil, func() {}, err
+ }
+
+ missing := make([]string, 0, 3)
+ if databaseURL == "" {
+ missing = append(missing, "DATABASE_URL")
+ }
+ if cfg.BaseURL == "" {
+ missing = append(missing, "SIGNED_SERVICE_URL_BASE_URL")
+ }
+ if secret == "" {
+ missing = append(missing, "SIGNED_SERVICE_URL_SECRET")
+ }
+ if len(missing) > 0 {
+ slog.Info("signed service URLs: disabled", "missing_configuration_keys", missing)
+ return nil, func() {}, nil
+ }
+
+ store, err := signedurls.NewPostgresStore(ctx, databaseURL)
+ if err != nil {
+ return nil, func() {}, fmt.Errorf("initialize signed URL store: %w", err)
+ }
+ signer, err := signedurls.NewSigner(cfg.BaseURL, []byte(secret))
+ if err != nil {
+ store.Close()
+ return nil, func() {}, fmt.Errorf("initialize signed URL signer: %w", err)
+ }
+ return signedurls.NewService(store, signer), store.Close, nil
+}
+
+func signedServiceURLSecret(cfg config.SignedServiceURLConfiguration) (string, error) {
+ if cfg.Secret != "" {
+ return validateSignedServiceURLSecret("SIGNED_SERVICE_URL_SECRET", cfg.Secret)
+ }
+ if cfg.SecretFile == "" {
+ return "", nil
+ }
+
+ contents, err := os.ReadFile(cfg.SecretFile)
+ if err != nil {
+ return "", fmt.Errorf("read SIGNED_SERVICE_URL_SECRET_FILE: %w", err)
+ }
+ return validateSignedServiceURLSecret("SIGNED_SERVICE_URL_SECRET_FILE", strings.TrimSpace(string(contents)))
+}
+
+func validateSignedServiceURLSecret(name, secret string) (string, error) {
+ if secret == "" {
+ return "", fmt.Errorf("%s must not be empty", name)
+ }
+ if len([]byte(secret)) < sha256.Size {
+ return "", fmt.Errorf("%s must be at least %d bytes", name, sha256.Size)
+ }
+ return secret, nil
+}
+
func serveUntilCanceled(ctx context.Context, server *http.Server) error {
serverErrors := make(chan error, 1)
go func() {
diff --git a/libs/fleet/backend/main_test.go b/libs/fleet/backend/main_test.go
index de282a80f1..d640624665 100644
--- a/libs/fleet/backend/main_test.go
+++ b/libs/fleet/backend/main_test.go
@@ -21,6 +21,7 @@ import (
"reflect"
"slices"
"strings"
+ "sync"
"testing"
"time"
@@ -734,6 +735,110 @@ func TestK8sRouteRejectsCustomResourceCreateWithoutCardBeforeProxy(t *testing.T)
}
}
+func TestInitializeSignedServiceURLs_BaseOnlyConfigurationDisablesFeature(t *testing.T) {
+ const baseURL = "https://run.cua.ai"
+
+ var logged bytes.Buffer
+ restore := slog.Default()
+ slog.SetDefault(slog.New(slog.NewJSONHandler(&logged, nil)))
+ t.Cleanup(func() { slog.SetDefault(restore) })
+
+ service, closeStore, err := initializeSignedServiceURLs(context.Background(), "postgres://[email protected]/cyclops", config.SignedServiceURLConfiguration{BaseURL: baseURL})
+ defer closeStore()
+ if err != nil {
+ t.Fatalf("initializeSignedServiceURLs() error = %v, want disabled feature", err)
+ }
+ if service != nil {
+ t.Fatal("initializeSignedServiceURLs() service = non-nil, want disabled feature")
+ }
+ if got := logged.String(); !strings.Contains(got, "SIGNED_SERVICE_URL_SECRET") || strings.Contains(got, baseURL) || strings.Contains(got, "DATABASE_URL") {
+ t.Fatalf("signed URL disabled log = %s, want only the missing secret key name", got)
+ }
+}
+
+func TestInitializeSignedServiceURLs_RecoversWhenSecretFileMaterializes(t *testing.T) {
+ const secret = "12345678901234567890123456789012"
+
+ secretFile := t.TempDir() + "/hmac_secret"
+ cfg := config.SignedServiceURLConfiguration{
+ BaseURL: "https://run.cua.ai",
+ SecretFile: secretFile,
+ }
+
+ service, closeStore, err := initializeSignedServiceURLs(context.Background(), "", cfg)
+ defer closeStore()
+ if err == nil || !strings.Contains(err.Error(), "SIGNED_SERVICE_URL_SECRET_FILE") {
+ t.Fatalf("initializeSignedServiceURLs() error = %v, want retryable missing secret file error", err)
+ }
+ if service != nil {
+ t.Fatal("initializeSignedServiceURLs() service = non-nil with missing secret file")
+ }
+ if strings.Contains(err.Error(), secret) {
+ t.Fatalf("missing secret file error exposed secret: %v", err)
+ }
+
+ if err := os.WriteFile(secretFile, []byte(secret), 0o600); err != nil {
+ t.Fatal(err)
+ }
+ service, closeStore, err = initializeSignedServiceURLs(context.Background(), "", cfg)
+ defer closeStore()
+ if err != nil {
+ t.Fatalf("initializeSignedServiceURLs() error after secret file materialized = %v", err)
+ }
+ if service != nil {
+ t.Fatal("initializeSignedServiceURLs() service = non-nil without database configuration")
+ }
+}
+
+func TestInitializeSignedServiceURLs_SecretFileValidation(t *testing.T) {
+ const secret = "12345678901234567890123456789012"
+
+ tests := []struct {
+ name string
+ contents string
+ secret string
+ wantError string
+ }{
+ {name: "empty file", wantError: "SIGNED_SERVICE_URL_SECRET_FILE must not be empty"},
+ {name: "whitespace-only file", contents: "\n \t\n", wantError: "SIGNED_SERVICE_URL_SECRET_FILE must not be empty"},
+ {name: "short file", contents: "too-short\n", wantError: "SIGNED_SERVICE_URL_SECRET_FILE must be at least 32 bytes"},
+ {name: "valid file trims trailing newline", contents: secret + "\n"},
+ {name: "environment secret takes precedence over file", contents: "too-short", secret: secret},
+ }
+
+ for _, test := range tests {
+ t.Run(test.name, func(t *testing.T) {
+ secretFile := t.TempDir() + "/hmac_secret"
+ if err := os.WriteFile(secretFile, []byte(test.contents), 0o600); err != nil {
+ t.Fatal(err)
+ }
+
+ service, closeStore, err := initializeSignedServiceURLs(context.Background(), "", config.SignedServiceURLConfiguration{
+ BaseURL: "https://run.cua.ai",
+ Secret: test.secret,
+ SecretFile: secretFile,
+ })
+ defer closeStore()
+
+ if test.wantError != "" {
+ if err == nil || !strings.Contains(err.Error(), test.wantError) {
+ t.Fatalf("initializeSignedServiceURLs() error = %v, want containing %q", err, test.wantError)
+ }
+ if service != nil {
+ t.Fatal("initializeSignedServiceURLs() service = non-nil with invalid secret file")
+ }
+ return
+ }
+ if err != nil {
+ t.Fatalf("initializeSignedServiceURLs() error = %v", err)
+ }
+ if service != nil {
+ t.Fatal("initializeSignedServiceURLs() service = non-nil without database configuration")
+ }
+ })
+ }
+}
+
func TestInitializeDatabaseFeatures(t *testing.T) {
tests := []struct {
name string
@@ -1304,3 +1409,35 @@ func TestServeUntilCanceledShutsDownServer(t *testing.T) {
t.Fatalf("serveUntilCanceled() error = %v", err)
}
}
+
+func TestShutdownSignedServiceURLsCancelsAndJoinsBeforeClosingOnce(t *testing.T) {
+ ctx, cancel := context.WithCancel(context.Background())
+ var retry sync.WaitGroup
+ var mu sync.RWMutex
+ retryStarted := make(chan struct{})
+ retryStopped := make(chan struct{})
+ retry.Add(1)
+ go func() {
+ defer retry.Done()
+ close(retryStarted)
+ <-ctx.Done()
+ close(retryStopped)
+ }()
+ <-retryStarted
+ closeCalls := 0
+ closeStore := func() {
+ select {
+ case <-retryStopped:
+ default:
+ t.Fatal("store closed before retry goroutine stopped")
+ }
+ closeCalls++
+ }
+
+ shutdownSignedServiceURLs(cancel, &retry, &mu, &closeStore)
+ shutdownSignedServiceURLs(cancel, &retry, &mu, &closeStore)
+
+ if closeCalls != 1 {
+ t.Fatalf("close calls = %d, want 1", closeCalls)
+ }
+}
diff --git a/libs/fleet/backend/metrics/metrics.go b/libs/fleet/backend/metrics/metrics.go
index 3e30b66223..8201d3a94b 100644
--- a/libs/fleet/backend/metrics/metrics.go
+++ b/libs/fleet/backend/metrics/metrics.go
@@ -21,6 +21,7 @@ import (
"net"
"net/http"
"strconv"
+ "strings"
"time"
"github.com/prometheus/client_golang/prometheus"
@@ -235,6 +236,11 @@ func normalizePath(p string) string {
return "/api/keys/:id"
case len(p) > 13 && p[:13] == "/api/gateway/":
return "/api/gateway/:name/:path"
+ case len(p) > 16 && p[:16] == "/api/signed-svc/":
+ if strings.Contains(p[16:], "/") {
+ return "/api/signed-svc/:token/:path"
+ }
+ return "/api/signed-svc/:token"
case len(p) > 9 && p[:9] == "/api/svc/":
return "/api/svc/:namespace/:service/:path"
case len(p) > 9 && p[:9] == "/api/k8s/":
diff --git a/libs/fleet/backend/metrics/metrics_test.go b/libs/fleet/backend/metrics/metrics_test.go
index 9ba75951f3..25a3f3caa5 100644
--- a/libs/fleet/backend/metrics/metrics_test.go
+++ b/libs/fleet/backend/metrics/metrics_test.go
@@ -41,6 +41,43 @@ func TestMiddlewareRecordsUnknownUserByDefault(t *testing.T) {
}
}
+func TestMiddlewareNormalizesSignedServicePaths(t *testing.T) {
+ const (
+ token = "signed-capability-token-must-not-leak"
+ suffix = "arbitrary-suffix-must-not-leak"
+ )
+
+ handler := Middleware(http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) {
+ w.WriteHeader(http.StatusOK)
+ }))
+ for _, testCase := range []struct {
+ path string
+ want string
+ }{
+ {"/api/signed-svc/" + token, "/api/signed-svc/:token"},
+ {"/api/signed-svc/" + token + "/tools/" + suffix, "/api/signed-svc/:token/:path"},
+ } {
+ handler.ServeHTTP(httptest.NewRecorder(), httptest.NewRequest(http.MethodGet, testCase.path, nil))
+
+ if count := histogramCount(t, map[string]string{
+ "method": "GET",
+ "path": testCase.want,
+ "status_code": "200",
+ "user": "unknown",
+ }); count != 1 {
+ t.Fatalf("normalized signed service path %q count = %d, want 1", testCase.want, count)
+ }
+ if count := histogramCount(t, map[string]string{
+ "method": "GET",
+ "path": testCase.path,
+ "status_code": "200",
+ "user": "unknown",
+ }); count != 0 {
+ t.Fatalf("signed service request leaked raw path label %q", testCase.path)
+ }
+ }
+}
+
func histogramCount(t *testing.T, labels map[string]string) uint64 {
t.Helper()
families, err := prometheus.DefaultGatherer.Gather()
diff --git a/libs/fleet/backend/middlewares/log.go b/libs/fleet/backend/middlewares/log.go
index ee6c9e2674..d1538788d6 100644
--- a/libs/fleet/backend/middlewares/log.go
+++ b/libs/fleet/backend/middlewares/log.go
@@ -66,7 +66,7 @@ func LogMiddlewareWithLogger(logger *slog.Logger) func(http.Handler) http.Handle
"service_namespace", envOrDefault("OTEL_SERVICE_NAMESPACE", "cyclops-cs"),
"deployment_environment", envOrDefault("OTEL_ENVIRONMENT", "production"),
"method", r.Method,
- "url", r.URL.Path,
+ "url", route,
"route", route,
"duration", time.Since(start),
"status", lw.statusCode,
diff --git a/libs/fleet/backend/middlewares/log_test.go b/libs/fleet/backend/middlewares/log_test.go
index 6c061a63c4..465cfb22ef 100644
--- a/libs/fleet/backend/middlewares/log_test.go
+++ b/libs/fleet/backend/middlewares/log_test.go
@@ -11,6 +11,7 @@ import (
"go.opentelemetry.io/otel"
sdktrace "go.opentelemetry.io/otel/sdk/trace"
+ "go.opentelemetry.io/otel/sdk/trace/tracetest"
"go.opentelemetry.io/otel/trace"
)
@@ -78,3 +79,59 @@ func TestTraceMiddleware_StartsSpanAndStoresRoute(t *testing.T) {
t.Fatal("expected valid span context")
}
}
+
+func TestSignedServiceTraceAndLogUseRouteTemplate(t *testing.T) {
+ const (
+ token = "signed-capability-token-must-not-leak"
+ route = "/api/signed-svc/{token}/{path...}"
+ )
+ spanRecorder := tracetest.NewSpanRecorder()
+ tracerProvider := sdktrace.NewTracerProvider(sdktrace.WithSpanProcessor(spanRecorder))
+ previousTracerProvider := otel.GetTracerProvider()
+ otel.SetTracerProvider(tracerProvider)
+ t.Cleanup(func() {
+ otel.SetTracerProvider(previousTracerProvider)
+ _ = tracerProvider.Shutdown(context.Background())
+ })
+
+ var logs bytes.Buffer
+ var gotToken string
+ handler := TraceMiddleware(route, LogMiddlewareWithLogger(slog.New(slog.NewJSONHandler(&logs, nil)))(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
+ gotToken = r.PathValue("token")
+ w.WriteHeader(http.StatusNoContent)
+ })))
+ request := httptest.NewRequest(http.MethodGet, "/api/signed-svc/"+token+"/"+token+"?cursor=next", nil)
+ request.SetPathValue("token", token)
+ request.SetPathValue("path", token)
+
+ handler.ServeHTTP(httptest.NewRecorder(), request)
+
+ if gotToken != token {
+ t.Fatalf("handler PathValue(token) = %q, want %q", gotToken, token)
+ }
+ if strings.Contains(logs.String(), token) {
+ t.Fatalf("logs leaked signed capability token: %s", logs.String())
+ }
+ if !strings.Contains(logs.String(), `"url":"`+route+`"`) {
+ t.Fatalf("logs did not use route template: %s", logs.String())
+ }
+ spans := spanRecorder.Ended()
+ if len(spans) != 1 {
+ t.Fatalf("ended spans = %d, want 1", len(spans))
+ }
+ foundTarget := false
+ for _, attribute := range spans[0].Attributes() {
+ if attribute.Key == "http.target" {
+ foundTarget = true
+ if attribute.Value.AsString() != route {
+ t.Fatalf("http.target = %q, want %q", attribute.Value.AsString(), route)
+ }
+ }
+ if strings.Contains(attribute.Value.Emit(), token) {
+ t.Fatalf("span attribute %s leaked signed capability token: %s", attribute.Key, attribute.Value.Emit())
+ }
+ }
+ if !foundTarget {
+ t.Fatalf("span attributes missing http.target: %v", spans[0].Attributes())
+ }
+}
diff --git a/libs/fleet/backend/middlewares/trace.go b/libs/fleet/backend/middlewares/trace.go
index badd945f9a..1200620da2 100644
--- a/libs/fleet/backend/middlewares/trace.go
+++ b/libs/fleet/backend/middlewares/trace.go
@@ -11,17 +11,32 @@ import (
type ContextKey string
+type originalRequestKey struct{}
+
func TraceMiddleware(route string, next http.Handler) http.Handler {
handler := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
+ if original, ok := r.Context().Value(originalRequestKey{}).(*http.Request); ok {
+ r = original.WithContext(r.Context())
+ }
ctx := context.WithValue(r.Context(), ContextKey("route"), route)
next.ServeHTTP(w, r.WithContext(ctx))
})
-
- return otelhttp.NewHandler(
+ traced := otelhttp.NewHandler(
handler,
route,
otelhttp.WithSpanNameFormatter(func(_ string, _ *http.Request) string {
return route
}),
)
+ return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
+ traceRequest := r.Clone(r.Context())
+ traceURL := *r.URL
+ traceURL.Path = route
+ traceURL.RawPath = ""
+ traceURL.RawQuery = ""
+ traceRequest.URL = &traceURL
+ traceRequest.RequestURI = route
+ traceRequest = traceRequest.WithContext(context.WithValue(traceRequest.Context(), originalRequestKey{}, r))
+ traced.ServeHTTP(w, traceRequest)
+ })
}
diff --git a/libs/fleet/backend/signedurls/postgres_store.go b/libs/fleet/backend/signedurls/postgres_store.go
new file mode 100644
index 0000000000..29743afafc
--- /dev/null
+++ b/libs/fleet/backend/signedurls/postgres_store.go
@@ -0,0 +1,111 @@
+package signedurls
+
+import (
+ "context"
+ "errors"
+ "fmt"
+ "time"
+
+ "github.com/google/uuid"
+ "github.com/jackc/pgx/v5"
+ "github.com/jackc/pgx/v5/pgconn"
+ "github.com/jackc/pgx/v5/pgxpool"
+)
+
+const recordColumns = "id, namespace, claim_name, sandbox_name, service_name, logical_service, label, creator_sub, created_at, expires_at, revoked_at"
+
+type PostgresStore struct{ pool *pgxpool.Pool }
+
+func NewPostgresStore(ctx context.Context, databaseURL string) (*PostgresStore, error) {
+ config, err := pgxpool.ParseConfig(databaseURL)
+ if err != nil {
+ return nil, fmt.Errorf("parse signed service URL database URL: %w", err)
+ }
+ pool, err := pgxpool.NewWithConfig(ctx, config)
+ if err != nil {
+ return nil, signedServiceURLDatabaseError("connect signed service URL database", err)
+ }
+ pingCtx, cancel := context.WithTimeout(ctx, 10*time.Second)
+ defer cancel()
+ if err := pool.Ping(pingCtx); err != nil {
+ pool.Close()
+ return nil, signedServiceURLDatabaseError("ping signed service URL database", err)
+ }
+ return &PostgresStore{pool: pool}, nil
+}
+
+func (store *PostgresStore) Close() {
+ if store != nil && store.pool != nil {
+ store.pool.Close()
+ }
+}
+
+func (store *PostgresStore) Create(ctx context.Context, record Record) error {
+ _, err := store.pool.Exec(ctx, `INSERT INTO signed_service_urls (`+recordColumns+`) VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11)`, record.ID, record.Namespace, record.ClaimName, record.SandboxName, record.ServiceName, record.LogicalService, record.Label, record.CreatorSub, record.CreatedAt, record.ExpiresAt, record.RevokedAt)
+ if err != nil {
+ return signedServiceURLDatabaseError("create signed service URL", err)
+ }
+ return nil
+}
+
+func (store *PostgresStore) List(ctx context.Context, namespace, claimName string) ([]Record, error) {
+ rows, err := store.pool.Query(ctx, `SELECT `+recordColumns+` FROM signed_service_urls WHERE namespace = $1 AND claim_name = $2 ORDER BY created_at DESC, id`, namespace, claimName)
+ if err != nil {
+ return nil, signedServiceURLDatabaseError("list signed service URLs", err)
+ }
+ defer rows.Close()
+ records := make([]Record, 0)
+ for rows.Next() {
+ record, err := scanRecord(rows)
+ if err != nil {
+ return nil, signedServiceURLDatabaseError("scan signed service URL", err)
+ }
+ records = append(records, record)
+ }
+ if err := rows.Err(); err != nil {
+ return nil, signedServiceURLDatabaseError("iterate signed service URLs", err)
+ }
+ return records, nil
+}
+
+func (store *PostgresStore) Get(ctx context.Context, id uuid.UUID) (Record, error) {
+ record, err := scanRecord(store.pool.QueryRow(ctx, `SELECT `+recordColumns+` FROM signed_service_urls WHERE id = $1`, id))
+ if errors.Is(err, pgx.ErrNoRows) {
+ return Record{}, ErrNotFound
+ }
+ if err != nil {
+ return Record{}, signedServiceURLDatabaseError("get signed service URL", err)
+ }
+ return record, nil
+}
+
+func (store *PostgresStore) Revoke(ctx context.Context, namespace string, id uuid.UUID, revokedAt time.Time) (Record, error) {
+ record, err := scanRecord(store.pool.QueryRow(ctx, `UPDATE signed_service_urls SET revoked_at = COALESCE(revoked_at, $3) WHERE namespace = $1 AND id = $2 RETURNING `+recordColumns, namespace, id, revokedAt))
+ if errors.Is(err, pgx.ErrNoRows) {
+ return Record{}, ErrNotFound
+ }
+ if err != nil {
+ return Record{}, signedServiceURLDatabaseError("revoke signed service URL", err)
+ }
+ return record, nil
+}
+
+type rowScanner interface{ Scan(...any) error }
+
+func scanRecord(row rowScanner) (Record, error) {
+ var record Record
+ err := row.Scan(&record.ID, &record.Namespace, &record.ClaimName, &record.SandboxName, &record.ServiceName, &record.LogicalService, &record.Label, &record.CreatorSub, &record.CreatedAt, &record.ExpiresAt, &record.RevokedAt)
+ return record, err
+}
+
+func signedServiceURLDatabaseError(operation string, err error) error {
+ var postgresError *pgconn.PgError
+ if errors.As(err, &postgresError) && !signedServiceURLUnavailableSQLState(postgresError.Code) {
+ return fmt.Errorf("%s: %w", operation, err)
+ }
+ return fmt.Errorf("%w: %s: %w", ErrUnavailable, operation, err)
+}
+
+func signedServiceURLUnavailableSQLState(code string) bool {
+ return code == "42P01" || len(code) >= 2 && (code[:2] == "08" || code[:2] == "28" || code[:2] == "53") || code == "57P01" || code == "57P02" || code == "57P03"
+}
diff --git a/libs/fleet/backend/signedurls/postgres_store_test.go b/libs/fleet/backend/signedurls/postgres_store_test.go
new file mode 100644
index 0000000000..da40c175d7
--- /dev/null
+++ b/libs/fleet/backend/signedurls/postgres_store_test.go
@@ -0,0 +1,89 @@
+package signedurls
+
+import (
+ "context"
+ "errors"
+ "os"
+ "testing"
+ "time"
+
+ "cyclops-cs-backend/database"
+ "github.com/google/uuid"
+ "github.com/jackc/pgx/v5"
+ "github.com/jackc/pgx/v5/pgconn"
+)
+
+func TestSignedServiceURLDatabaseErrorClassifiesUnavailablePostgresStates(t *testing.T) {
+ for _, code := range []string{"42P01", "08006", "28000", "53300", "57P01", "57P02", "57P03"} {
+ t.Run(code, func(t *testing.T) {
+ err := signedServiceURLDatabaseError("query", &pgconn.PgError{Code: code})
+ if !errors.Is(err, ErrUnavailable) {
+ t.Fatalf("error %v does not classify SQLSTATE %s as unavailable", err, code)
+ }
+ })
+ }
+ if errors.Is(signedServiceURLDatabaseError("query", &pgconn.PgError{Code: "23505"}), ErrUnavailable) {
+ t.Fatal("integrity violation classified as unavailable")
+ }
+}
+
+func TestPostgresStoreRoundTrip(t *testing.T) {
+ databaseURL := os.Getenv("CYCLOPS_TEST_RUNTIME_DATABASE_URL")
+ if databaseURL == "" {
+ t.Skip("set CYCLOPS_TEST_RUNTIME_DATABASE_URL to run the Postgres store test")
+ }
+ if err := database.RequireVersion(context.Background(), databaseURL, 11); err != nil {
+ t.Fatalf("database must be migrated to version 11: %v", err)
+ }
+ store, err := NewPostgresStore(context.Background(), databaseURL)
+ if err != nil {
+ t.Fatalf("NewPostgresStore() error = %v", err)
+ }
+ t.Cleanup(store.Close)
+
+ record := signedURLFixture()
+ record.ID = uuid.New()
+ record.ClaimName = "claim-roundtrip-" + record.ID.String()
+ record.SandboxName = "sandbox-roundtrip"
+ record.LogicalService = "mcp"
+ record.CreatorSub = "user-roundtrip"
+ // The application role deliberately has no DELETE grant on
+ // signed_service_urls, so cleanup runs as the migration owner.
+ t.Cleanup(func() {
+ maintenanceURL := os.Getenv("CYCLOPS_TEST_MIGRATION_DATABASE_URL")
+ if maintenanceURL == "" {
+ return
+ }
+ connection, err := pgx.Connect(context.Background(), maintenanceURL)
+ if err != nil {
+ t.Errorf("connect for signed service URL cleanup: %v", err)
+ return
+ }
+ defer connection.Close(context.Background())
+ if _, err := connection.Exec(context.Background(), "DELETE FROM signed_service_urls WHERE id = $1", record.ID); err != nil {
+ t.Errorf("cleanup signed service URL %s: %v", record.ID, err)
+ }
+ })
+ if err := store.Create(context.Background(), record); err != nil {
+ t.Fatalf("Create() error = %v", err)
+ }
+
+ listed, err := store.List(context.Background(), record.Namespace, record.ClaimName)
+ if err != nil || len(listed) == 0 {
+ t.Fatalf("List() = %#v, %v", listed, err)
+ }
+ got, err := store.Get(context.Background(), record.ID)
+ if err != nil || got.ID != record.ID {
+ t.Fatalf("Get() = %#v, %v", got, err)
+ }
+
+ revokedAt := time.Now().UTC().Add(time.Second)
+ first, err := store.Revoke(context.Background(), record.Namespace, record.ID, revokedAt)
+ if err != nil || first.RevokedAt == nil {
+ t.Fatalf("first Revoke() = %#v, %v", first, err)
+ }
+ second, err := store.Revoke(context.Background(), record.Namespace, record.ID, revokedAt.Add(time.Minute))
+ if err != nil || !second.RevokedAt.Equal(*first.RevokedAt) {
+ t.Fatalf("second Revoke() = %#v, %v", second, err)
+ }
+}
diff --git a/libs/fleet/backend/signedurls/service.go b/libs/fleet/backend/signedurls/service.go
new file mode 100644
index 0000000000..6ba97488fd
--- /dev/null
+++ b/libs/fleet/backend/signedurls/service.go
@@ -0,0 +1,129 @@
+package signedurls
+
+import (
+ "context"
+ "errors"
+ "fmt"
+ "strings"
+ "time"
+ "unicode/utf8"
+
+ "github.com/google/uuid"
+)
+
+type Service struct {
+ store Store
+ signer *Signer
+ now func() time.Time
+ newID func() (uuid.UUID, error)
+}
+
+func NewService(store Store, signer *Signer) *Service {
+ return &Service{store: store, signer: signer, now: func() time.Time { return time.Now().UTC() }, newID: uuid.NewRandom}
+}
+
+func (service *Service) Create(ctx context.Context, input CreateInput) (Record, error) {
+ if err := service.available(); err != nil {
+ return Record{}, err
+ }
+ input, err := normalizeInput(input)
+ if err != nil {
+ return Record{}, err
+ }
+ id, err := service.newID()
+ if err != nil {
+ return Record{}, fmt.Errorf("generate signed service URL ID: %w", err)
+ }
+ createdAt := service.now().UTC().Truncate(time.Second)
+ record := Record{ID: id, Namespace: input.Namespace, ClaimName: input.ClaimName, SandboxName: input.SandboxName, ServiceName: input.ServiceName, LogicalService: input.LogicalService, Label: input.Label, CreatorSub: input.CreatorSub, CreatedAt: createdAt, ExpiresAt: createdAt.Add(input.ExpiresIn)}
+ if err := service.store.Create(ctx, record); err != nil {
+ return Record{}, fmt.Errorf("store signed service URL: %w", err)
+ }
+ return service.withURL(record)
+}
+
+func (service *Service) List(ctx context.Context, namespace, claimName string) ([]Record, error) {
+ if err := service.available(); err != nil {
+ return nil, err
+ }
+ records, err := service.store.List(ctx, namespace, claimName)
+ if err != nil {
+ return nil, fmt.Errorf("list signed service URLs: %w", err)
+ }
+ for index := range records {
+ if records[index], err = service.withURL(records[index]); err != nil {
+ return nil, err
+ }
+ }
+ return records, nil
+}
+
+func (service *Service) Revoke(ctx context.Context, namespace string, id uuid.UUID) (Record, error) {
+ if err := service.available(); err != nil {
+ return Record{}, err
+ }
+ record, err := service.store.Revoke(ctx, namespace, id, service.now().UTC())
+ if err != nil {
+ return Record{}, err
+ }
+ return service.withURL(record)
+}
+
+func (service *Service) Resolve(ctx context.Context, token string, now time.Time) (Record, error) {
+ if err := service.available(); err != nil {
+ return Record{}, err
+ }
+ capability, err := service.signer.Verify(token, now)
+ if err != nil {
+ return Record{}, err
+ }
+ record, err := service.store.Get(ctx, capability.ID)
+ if errors.Is(err, ErrNotFound) {
+ return Record{}, ErrInvalidCapability
+ }
+ if err != nil {
+ return Record{}, fmt.Errorf("get signed service URL: %w", err)
+ }
+ if record.Namespace != capability.Namespace || record.ServiceName != capability.ServiceName || !record.ExpiresAt.Equal(capability.ExpiresAt) || record.RevokedAt != nil || !now.Before(record.ExpiresAt) {
+ return Record{}, ErrInvalidCapability
+ }
+ return record, nil
+}
+
+func (service *Service) available() error {
+ if service == nil || service.store == nil || service.signer == nil {
+ return ErrUnavailable
+ }
+ return nil
+}
+func (service *Service) withURL(record Record) (Record, error) {
+ capabilityURL, err := service.signer.URL(record)
+ if err != nil {
+ return Record{}, err
+ }
+ record.URL = capabilityURL
+ return record, nil
+}
+func normalizeInput(input CreateInput) (CreateInput, error) {
+ fields := []*string{&input.Namespace, &input.ClaimName, &input.SandboxName, &input.ServiceName, &input.LogicalService, &input.CreatorSub}
+ for _, field := range fields {
+ *field = strings.TrimSpace(*field)
+ if *field == "" {
+ return CreateInput{}, ErrInvalidInput
+ }
+ }
+ if input.ExpiresIn < minTTL || input.ExpiresIn > maxTTL || input.ExpiresIn%time.Second != 0 {
+ return CreateInput{}, ErrInvalidInput
+ }
+ if input.Label != nil {
+ label := strings.TrimSpace(*input.Label)
+ if label == "" {
+ input.Label = nil
+ } else if !utf8.ValidString(label) || len(label) > maxLabelLen {
+ return CreateInput{}, ErrInvalidInput
+ } else {
+ input.Label = &label
+ }
+ }
+ return input, nil
+}
diff --git a/libs/fleet/backend/signedurls/service_test.go b/libs/fleet/backend/signedurls/service_test.go
new file mode 100644
index 0000000000..d81216b6a4
--- /dev/null
+++ b/libs/fleet/backend/signedurls/service_test.go
@@ -0,0 +1,266 @@
+package signedurls
+
+import (
+ "context"
+ "errors"
+ "sort"
+ "strings"
+ "testing"
+ "time"
+
+ "github.com/google/uuid"
+)
+
+func TestServiceCreateNormalizesAndSignsRecord(t *testing.T) {
+ store := &fakeStore{}
+ service := newTestService(store)
+ service.now = func() time.Time { return time.Date(2026, time.August, 31, 12, 0, 0, 123, time.UTC) }
+
+ created, err := service.Create(context.Background(), CreateInput{
+ Namespace: "tenant-a", ClaimName: "claim-a", SandboxName: "sandbox-a",
+ ServiceName: "sandbox-a-mcp", LogicalService: "mcp",
+ Label: ptr(" Customer demo "), CreatorSub: "user-a", ExpiresIn: time.Hour,
+ })
+ if err != nil {
+ t.Fatalf("Create() error = %v", err)
+ }
+ if created.Label == nil || *created.Label != "Customer demo" {
+ t.Fatalf("Create() label = %#v, want trimmed Customer demo", created.Label)
+ }
+ if created.URL == "" || !strings.Contains(created.URL, "/api/signed-svc/v1.") {
+ t.Fatalf("Create() URL = %q, want signed capability URL", created.URL)
+ }
+ if created.CreatedAt.Nanosecond() != 0 || !created.ExpiresAt.Equal(created.CreatedAt.Add(time.Hour)) {
+ t.Fatalf("Create() times = %s, %s", created.CreatedAt, created.ExpiresAt)
+ }
+}
+
+func TestServiceCreateValidation(t *testing.T) {
+ service := newTestService(&fakeStore{})
+ base := CreateInput{Namespace: "tenant-a", ClaimName: "claim-a", SandboxName: "sandbox-a", ServiceName: "sandbox-a-mcp", LogicalService: "mcp", CreatorSub: "user-a", ExpiresIn: time.Hour}
+ cases := []struct {
+ name string
+ input CreateInput
+ }{
+ {"empty identifier", func() CreateInput { input := base; input.ServiceName = " "; return input }()},
+ {"short ttl", func() CreateInput { input := base; input.ExpiresIn = 59 * time.Second; return input }()},
+ {"long ttl", func() CreateInput { input := base; input.ExpiresIn = 86401 * time.Second; return input }()},
+ {"long label", func() CreateInput { input := base; input.Label = ptr(strings.Repeat("a", 121)); return input }()},
+ }
+ for _, testCase := range cases {
+ t.Run(testCase.name, func(t *testing.T) {
+ if _, err := service.Create(context.Background(), testCase.input); err == nil {
+ t.Fatal("Create() succeeded")
+ }
+ })
+ }
+
+ base.Label = ptr(" \t ")
+ created, err := service.Create(context.Background(), base)
+ if err != nil {
+ t.Fatalf("Create() empty label error = %v", err)
+ }
+ if created.Label != nil {
+ t.Fatalf("Create() empty label = %q, want nil", *created.Label)
+ }
+}
+
+func TestServiceListsNewestFirstAndSignsEveryRecord(t *testing.T) {
+ now := time.Date(2026, time.August, 31, 12, 0, 0, 0, time.UTC)
+ older := signedURLFixture()
+ older.ID = uuid.MustParse("00000000-0000-4000-8000-000000000001")
+ older.ClaimName = "claim-a"
+ older.CreatedAt = now.Add(-time.Minute)
+ newer := older
+ newer.ID = uuid.MustParse("00000000-0000-4000-8000-000000000002")
+ newer.CreatedAt = now
+ store := &fakeStore{records: map[uuid.UUID]Record{older.ID: older, newer.ID: newer}}
+ service := newTestService(store)
+
+ listed, err := service.List(context.Background(), "tenant-a", "claim-a")
+ if err != nil {
+ t.Fatalf("List() error = %v", err)
+ }
+ if len(listed) != 2 || listed[0].ID != newer.ID || listed[0].URL == "" || listed[1].URL == "" {
+ t.Fatalf("List() = %#v", listed)
+ }
+}
+
+func TestServiceRevokeIsIdempotent(t *testing.T) {
+ record := signedURLFixture()
+ record.ClaimName = "claim-a"
+ store := &fakeStore{records: map[uuid.UUID]Record{record.ID: record}}
+ service := newTestService(store)
+ now := time.Date(2026, time.August, 31, 12, 15, 0, 0, time.UTC)
+ service.now = func() time.Time { return now }
+
+ first, err := service.Revoke(context.Background(), "tenant-a", record.ID)
+ if err != nil || first.RevokedAt == nil || !first.RevokedAt.Equal(now) {
+ t.Fatalf("first Revoke() = %#v, %v", first, err)
+ }
+ now = now.Add(time.Minute)
+ second, err := service.Revoke(context.Background(), "tenant-a", record.ID)
+ if err != nil || second.RevokedAt == nil || !second.RevokedAt.Equal(*first.RevokedAt) {
+ t.Fatalf("second Revoke() = %#v, %v", second, err)
+ }
+}
+
+func TestServiceResolveRejectsInvalidLifecycleAndMismatches(t *testing.T) {
+ record := signedURLFixture()
+ store := &fakeStore{records: map[uuid.UUID]Record{record.ID: record}}
+ service := newTestService(store)
+ url, err := service.signer.URL(record)
+ if err != nil {
+ t.Fatalf("URL() error = %v", err)
+ }
+ token := url[len("https://run.cua.ai/api/signed-svc/") : len(url)-1]
+
+ resolved, err := service.Resolve(context.Background(), token, record.CreatedAt)
+ if err != nil || resolved.ID != record.ID {
+ t.Fatalf("Resolve() = %#v, %v", resolved, err)
+ }
+
+ for name, mutateRecord := range map[string]func(*Record){
+ "expired": func(record *Record) { record.ExpiresAt = record.CreatedAt },
+ "revoked": func(record *Record) { revokedAt := record.CreatedAt; record.RevokedAt = &revokedAt },
+ "payload mismatch": func(record *Record) { record.ServiceName = "other-service" },
+ } {
+ t.Run(name, func(t *testing.T) {
+ invalidStore := &fakeStore{records: map[uuid.UUID]Record{record.ID: record}}
+ candidate := invalidStore.records[record.ID]
+ mutateRecord(&candidate)
+ invalidStore.records[record.ID] = candidate
+ invalidService := newTestService(invalidStore)
+ if _, err := invalidService.Resolve(context.Background(), token, record.CreatedAt); !errors.Is(err, ErrInvalidCapability) {
+ t.Fatalf("Resolve() error = %v, want ErrInvalidCapability", err)
+ }
+ })
+ }
+}
+
+func TestServiceUnavailableStore(t *testing.T) {
+ service := newTestService(nil)
+ if _, err := service.List(context.Background(), "tenant-a", "claim-a"); !errors.Is(err, ErrUnavailable) {
+ t.Fatalf("List() error = %v, want ErrUnavailable", err)
+ }
+}
+
+type fakeStore struct {
+ records map[uuid.UUID]Record
+ err error
+}
+
+func (store *fakeStore) Create(_ context.Context, record Record) error {
+ if err := store.err; err != nil {
+ return err
+ }
+ if store.records == nil {
+ store.records = make(map[uuid.UUID]Record)
+ }
+ store.records[record.ID] = record
+ return nil
+}
+
+func (store *fakeStore) List(_ context.Context, namespace, claimName string) ([]Record, error) {
+ if err := store.err; err != nil {
+ return nil, err
+ }
+ var records []Record
+ for _, record := range store.records {
+ if record.Namespace == namespace && record.ClaimName == claimName {
+ records = append(records, record)
+ }
+ }
+ sort.Slice(records, func(left, right int) bool {
+ if records[left].CreatedAt.Equal(records[right].CreatedAt) {
+ return records[left].ID.String() < records[right].ID.String()
+ }
+ return records[left].CreatedAt.After(records[right].CreatedAt)
+ })
+ return records, nil
+}
+
+func (store *fakeStore) Get(_ context.Context, id uuid.UUID) (Record, error) {
+ if err := store.err; err != nil {
+ return Record{}, err
+ }
+ record, ok := store.records[id]
+ if !ok {
+ return Record{}, ErrNotFound
+ }
+ return record, nil
+}
+
+func (store *fakeStore) Revoke(_ context.Context, namespace string, id uuid.UUID, revokedAt time.Time) (Record, error) {
+ if err := store.err; err != nil {
+ return Record{}, err
+ }
+ record, ok := store.records[id]
+ if !ok || record.Namespace != namespace {
+ return Record{}, ErrNotFound
+ }
+ if record.RevokedAt == nil {
+ record.RevokedAt = &revokedAt
+ store.records[id] = record
+ }
+ return record, nil
+}
+
+func newTestService(store Store) *Service {
+ signer, err := NewSigner("https://run.cua.ai", []byte("01234567890123456789012345678901"))
+ if err != nil {
+ panic(err)
+ }
+ return NewService(store, signer)
+}
+
+func ptr(value string) *string { return &value }
+
+func TestServiceCreateRejectsFractionalSecondTTL(t *testing.T) {
+ service := newTestService(&fakeStore{})
+ _, err := service.Create(context.Background(), CreateInput{
+ Namespace: "tenant-a", ClaimName: "claim-a", SandboxName: "sandbox-a",
+ ServiceName: "sandbox-a-mcp", LogicalService: "mcp", CreatorSub: "user-a",
+ ExpiresIn: 90*time.Second + time.Millisecond,
+ })
+ if !errors.Is(err, ErrInvalidInput) {
+ t.Fatalf("Create() error = %v, want ErrInvalidInput", err)
+ }
+}
+
+func TestServiceResolveReturnsGenericInvalidCapabilityError(t *testing.T) {
+ record := signedURLFixture()
+ signer := newTestService(&fakeStore{}).signer
+ url, err := signer.URL(record)
+ if err != nil {
+ t.Fatalf("URL() error = %v", err)
+ }
+ validToken := url[len("https://run.cua.ai/api/signed-svc/") : len(url)-1]
+
+ revoked := record
+ revokedAt := record.CreatedAt
+ revoked.RevokedAt = &revokedAt
+ mismatched := record
+ mismatched.ServiceName = "other-service"
+
+ tests := []struct {
+ name string
+ token string
+ now time.Time
+ records map[uuid.UUID]Record
+ }{
+ {name: "malformed", token: "not-a-token", now: record.CreatedAt, records: map[uuid.UUID]Record{record.ID: record}},
+ {name: "expired", token: validToken, now: record.ExpiresAt, records: map[uuid.UUID]Record{record.ID: record}},
+ {name: "revoked", token: validToken, now: record.CreatedAt, records: map[uuid.UUID]Record{record.ID: revoked}},
+ {name: "unknown ID", token: validToken, now: record.CreatedAt, records: map[uuid.UUID]Record{}},
+ {name: "payload mismatch", token: validToken, now: record.CreatedAt, records: map[uuid.UUID]Record{record.ID: mismatched}},
+ }
+ for _, test := range tests {
+ t.Run(test.name, func(t *testing.T) {
+ service := newTestService(&fakeStore{records: test.records})
+ if _, err := service.Resolve(context.Background(), test.token, test.now); !errors.Is(err, ErrInvalidCapability) {
+ t.Fatalf("Resolve() error = %v, want ErrInvalidCapability", err)
+ }
+ })
+ }
+}
diff --git a/libs/fleet/backend/signedurls/token.go b/libs/fleet/backend/signedurls/token.go
new file mode 100644
index 0000000000..244c29aef2
--- /dev/null
+++ b/libs/fleet/backend/signedurls/token.go
@@ -0,0 +1,114 @@
+package signedurls
+
+import (
+ "crypto/hmac"
+ "crypto/sha256"
+ "encoding/base64"
+ "encoding/json"
+ "fmt"
+ "net/url"
+ "strings"
+ "time"
+
+ "github.com/google/uuid"
+)
+
+const (
+ tokenVersion = "v1"
+ maxTokenLength = 4096
+)
+
+type Capability struct {
+ ID uuid.UUID `json:"i"`
+ Namespace string `json:"n"`
+ ServiceName string `json:"s"`
+ ExpiresAt time.Time `json:"e"`
+}
+
+type Signer struct {
+ baseURL *url.URL
+ secret []byte
+}
+
+type tokenPayload struct {
+ ID uuid.UUID `json:"i"`
+ Namespace string `json:"n"`
+ ServiceName string `json:"s"`
+ ExpiresAt int64 `json:"e"`
+}
+
+func NewSigner(baseURL string, secret []byte) (*Signer, error) {
+ if len(secret) < sha256.Size {
+ return nil, fmt.Errorf("signed service URL secret must be at least %d bytes", sha256.Size)
+ }
+ parsed, err := url.Parse(baseURL)
+ if err != nil {
+ return nil, fmt.Errorf("parse signed service URL base URL: %w", err)
+ }
+ if parsed.Scheme != "https" || parsed.Host == "" || parsed.User != nil || parsed.RawQuery != "" || parsed.Fragment != "" || (parsed.Path != "" && parsed.Path != "/") || (parsed.RawPath != "" && parsed.RawPath != "/") {
+ return nil, fmt.Errorf("signed service URL base URL must be a bare HTTPS origin")
+ }
+ return &Signer{baseURL: parsed, secret: append([]byte(nil), secret...)}, nil
+}
+
+func (signer *Signer) URL(record Record) (string, error) {
+ if signer == nil || signer.baseURL == nil || len(signer.secret) < sha256.Size {
+ return "", ErrUnavailable
+ }
+ payload, err := json.Marshal(tokenPayload{
+ ID: record.ID, Namespace: record.Namespace, ServiceName: record.ServiceName, ExpiresAt: record.ExpiresAt.Unix(),
+ })
+ if err != nil {
+ return "", fmt.Errorf("marshal signed service capability: %w", err)
+ }
+ encodedPayload := base64.RawURLEncoding.EncodeToString(payload)
+ signed := tokenVersion + "." + encodedPayload
+ mac := hmac.New(sha256.New, signer.secret)
+ _, _ = mac.Write([]byte(signed))
+ token := signed + "." + base64.RawURLEncoding.EncodeToString(mac.Sum(nil))
+ publicURL := *signer.baseURL
+ publicURL.Path = "/api/signed-svc/" + token + "/"
+ publicURL.RawPath = ""
+ return publicURL.String(), nil
+}
+
+func (signer *Signer) Verify(token string, now time.Time) (Capability, error) {
+ if signer == nil || len(signer.secret) < sha256.Size || len(token) == 0 || len(token) > maxTokenLength {
+ return Capability{}, ErrInvalidCapability
+ }
+ parts := strings.Split(token, ".")
+ if len(parts) != 3 || parts[0] != tokenVersion || len(parts[1]) == 0 || len(parts[2]) == 0 {
+ return Capability{}, ErrInvalidCapability
+ }
+ providedMAC, err := base64.RawURLEncoding.DecodeString(parts[2])
+ if err != nil {
+ return Capability{}, fmt.Errorf("%w: decode capability signature: %w", ErrInvalidCapability, err)
+ }
+ if len(providedMAC) != sha256.Size {
+ return Capability{}, ErrInvalidCapability
+ }
+ mac := hmac.New(sha256.New, signer.secret)
+ _, _ = mac.Write([]byte(parts[0] + "." + parts[1]))
+ if !hmac.Equal(providedMAC, mac.Sum(nil)) {
+ return Capability{}, ErrInvalidCapability
+ }
+ payloadBytes, err := base64.RawURLEncoding.DecodeString(parts[1])
+ if err != nil {
+ return Capability{}, fmt.Errorf("%w: decode capability payload: %w", ErrInvalidCapability, err)
+ }
+ if len(payloadBytes) == 0 {
+ return Capability{}, ErrInvalidCapability
+ }
+ var payload tokenPayload
+ if err := json.Unmarshal(payloadBytes, &payload); err != nil {
+ return Capability{}, fmt.Errorf("%w: decode capability payload: %w", ErrInvalidCapability, err)
+ }
+ if payload.ID == uuid.Nil || payload.Namespace == "" || payload.ServiceName == "" {
+ return Capability{}, ErrInvalidCapability
+ }
+ capability := Capability{ID: payload.ID, Namespace: payload.Namespace, ServiceName: payload.ServiceName, ExpiresAt: time.Unix(payload.ExpiresAt, 0).UTC()}
+ if !now.Before(capability.ExpiresAt) {
+ return Capability{}, ErrInvalidCapability
+ }
+ return capability, nil
+}
diff --git a/libs/fleet/backend/signedurls/token_test.go b/libs/fleet/backend/signedurls/token_test.go
new file mode 100644
index 0000000000..13c7b6369f
--- /dev/null
+++ b/libs/fleet/backend/signedurls/token_test.go
@@ -0,0 +1,119 @@
+package signedurls
+
+import (
+ "strings"
+ "testing"
+ "time"
+
+ "github.com/google/uuid"
+)
+
+func TestSignerRoundTripAndDeterminism(t *testing.T) {
+ signer := mustSigner(t)
+ record := signedURLFixture()
+ first, err := signer.URL(record)
+ if err != nil {
+ t.Fatalf("URL() error = %v", err)
+ }
+ second, err := signer.URL(record)
+ if err != nil {
+ t.Fatalf("URL() second error = %v", err)
+ }
+ if first != second {
+ t.Fatalf("URL() was non-deterministic: first %q, second %q", first, second)
+ }
+
+ token := strings.TrimSuffix(strings.TrimPrefix(first, "https://run.cua.ai/api/signed-svc/"), "/")
+ capability, err := signer.Verify(token, record.CreatedAt.Add(time.Minute))
+ if err != nil {
+ t.Fatalf("Verify() error = %v", err)
+ }
+ if capability.ID != record.ID || capability.Namespace != record.Namespace || capability.ServiceName != record.ServiceName || !capability.ExpiresAt.Equal(record.ExpiresAt) {
+ t.Fatalf("Verify() = %#v, want record capability", capability)
+ }
+}
+
+func TestSignerRejectsInvalidTokens(t *testing.T) {
+ signer := mustSigner(t)
+ record := signedURLFixture()
+ url, err := signer.URL(record)
+ if err != nil {
+ t.Fatalf("URL() error = %v", err)
+ }
+ token := strings.TrimSuffix(strings.TrimPrefix(url, "https://run.cua.ai/api/signed-svc/"), "/")
+ parts := strings.Split(token, ".")
+
+ cases := map[string]string{
+ "changed payload": "v1." + mutate(parts[1]) + "." + parts[2],
+ "changed signature": "v1." + parts[1] + "." + mutate(parts[2]),
+ "unknown version": "v2." + parts[1] + "." + parts[2],
+ "oversized": strings.Repeat("a", maxTokenLength+1),
+ "bad base64url": "v1.%%%." + parts[2],
+ }
+ for name, invalid := range cases {
+ t.Run(name, func(t *testing.T) {
+ if _, err := signer.Verify(invalid, record.CreatedAt); err == nil {
+ t.Fatalf("Verify(%q) succeeded", invalid)
+ }
+ })
+ }
+}
+
+func TestSignerRejectsExpiredCapabilities(t *testing.T) {
+ signer := mustSigner(t)
+ record := signedURLFixture()
+ url, err := signer.URL(record)
+ if err != nil {
+ t.Fatalf("URL() error = %v", err)
+ }
+ token := strings.TrimSuffix(strings.TrimPrefix(url, "https://run.cua.ai/api/signed-svc/"), "/")
+ if _, err := signer.Verify(token, record.ExpiresAt); err == nil {
+ t.Fatal("Verify() accepted token at expiration")
+ }
+}
+
+func TestNewSignerRejectsUnsafeConfiguration(t *testing.T) {
+ secret := make([]byte, 32)
+ for _, baseURL := range []string{
+ "http://run.cua.ai",
+ "https://[email protected]",
+ "https://run.cua.ai?query=value",
+ "https://run.cua.ai#fragment",
+ "https://run.cua.ai/prefix",
+ } {
+ t.Run(baseURL, func(t *testing.T) {
+ if _, err := NewSigner(baseURL, secret); err == nil {
+ t.Fatalf("NewSigner(%q) succeeded", baseURL)
+ }
+ })
+ }
+ if _, err := NewSigner("https://run.cua.ai", make([]byte, 31)); err == nil {
+ t.Fatal("NewSigner() accepted a short secret")
+ }
+}
+
+func mustSigner(t *testing.T) *Signer {
+ t.Helper()
+ signer, err := NewSigner("https://run.cua.ai", []byte("01234567890123456789012345678901"))
+ if err != nil {
+ t.Fatalf("NewSigner() error = %v", err)
+ }
+ return signer
+}
+
+func signedURLFixture() Record {
+ return Record{
+ ID: uuid.MustParse("8b8867c0-6b6f-4dde-921e-e541d506bc35"),
+ Namespace: "tenant-a",
+ ServiceName: "sandbox-a-mcp",
+ CreatedAt: time.Date(2026, time.August, 31, 12, 0, 0, 0, time.UTC),
+ ExpiresAt: time.Date(2026, time.August, 31, 13, 0, 0, 0, time.UTC),
+ }
+}
+
+func mutate(value string) string {
+ if value[0] == 'a' {
+ return "b" + value[1:]
+ }
+ return "a" + value[1:]
+}
diff --git a/libs/fleet/backend/signedurls/types.go b/libs/fleet/backend/signedurls/types.go
new file mode 100644
index 0000000000..09e6da702c
--- /dev/null
+++ b/libs/fleet/backend/signedurls/types.go
@@ -0,0 +1,55 @@
+package signedurls
+
+import (
+ "context"
+ "errors"
+ "time"
+
+ "github.com/google/uuid"
+)
+
+const (
+ minTTL = time.Minute
+ maxTTL = 24 * time.Hour
+ maxLabelLen = 120
+)
+
+var (
+ ErrNotFound = errors.New("signed service URL not found")
+ ErrInvalidCapability = errors.New("invalid signed service capability")
+ ErrInvalidInput = errors.New("invalid signed service URL input")
+ ErrUnavailable = errors.New("signed service URLs unavailable")
+)
+
+type Record struct {
+ ID uuid.UUID
+ Namespace string
+ ClaimName string
+ SandboxName string
+ ServiceName string
+ LogicalService string
+ Label *string
+ CreatorSub string
+ CreatedAt time.Time
+ ExpiresAt time.Time
+ RevokedAt *time.Time
+ URL string
+}
+
+type CreateInput struct {
+ Namespace string
+ ClaimName string
+ SandboxName string
+ ServiceName string
+ LogicalService string
+ Label *string
+ CreatorSub string
+ ExpiresIn time.Duration
+}
+
+type Store interface {
+ Create(context.Context, Record) error
+ List(context.Context, string, string) ([]Record, error)
+ Get(context.Context, uuid.UUID) (Record, error)
+ Revoke(context.Context, string, uuid.UUID, time.Time) (Record, error)
+}
diff --git a/libs/fleet/e2e/detail-shell.spec.ts b/libs/fleet/e2e/detail-shell.spec.ts
index 830779047d..1bec7f948b 100644
--- a/libs/fleet/e2e/detail-shell.spec.ts
+++ b/libs/fleet/e2e/detail-shell.spec.ts
@@ -5,15 +5,23 @@ import {
mockInstancesApi,
mockNamespacesApi,
mockPoolsApi,
+ mockSignedServiceUrlsApi,
} from "./fixtures/mock-api"
import { expectSharedPageShell } from "./fixtures/shell-geometry"
-async function mockFleet(page: Parameters<typeof mockAuth>[0]) {
+async function mockFleet(
+ page: Parameters<typeof mockAuth>[0],
+ initialSignedUrls: Parameters<typeof mockSignedServiceUrlsApi>[1] = [],
+ signedUrlOptions: Parameters<typeof mockSignedServiceUrlsApi>[2] = {},
+ claimOptions: Parameters<typeof mockClaimsApi>[1] = {},
+) {
await mockAuth(page)
await mockNamespacesApi(page)
await mockPoolsApi(page)
await mockInstancesApi(page)
- await mockClaimsApi(page)
+ const claims = await mockClaimsApi(page, claimOptions)
+ const signedUrls = await mockSignedServiceUrlsApi(page, initialSignedUrls, signedUrlOptions)
+ return { ...signedUrls, claims }
}
for (const viewport of [
@@ -43,3 +51,347 @@ for (const viewport of [
await expectSharedPageShell(page)
})
}
+
+test("claim detail manages multiple signed URLs through the shared SDK", async ({ page }) => {
+ const signedUrls = await mockFleet(page, [
+ {
+ id: "11111111-1111-4111-8111-111111111111",
+ namespace: "demo-pool",
+ claim: "claim-abc123",
+ sandbox: "vm-xyz789",
+ service: "vm-xyz789-mcp",
+ logicalService: "mcp",
+ label: "Customer demo",
+ url: "https://run.cua.ai/api/signed/11111111-1111-4111-8111-111111111111",
+ createdAt: "2099-01-01T00:00:00Z",
+ expiresAt: "2099-01-01T01:00:00Z",
+ },
+ {
+ id: "22222222-2222-4222-8222-222222222222",
+ namespace: "demo-pool",
+ claim: "claim-abc123",
+ sandbox: "vm-xyz789",
+ service: "vm-xyz789-mcp",
+ logicalService: "mcp",
+ label: "QA session",
+ url: "https://run.cua.ai/api/signed/22222222-2222-4222-8222-222222222222",
+ createdAt: "2099-01-01T00:00:00Z",
+ expiresAt: "2099-01-01T01:00:00Z",
+ },
+ ])
+ await page.goto("/pools/demo-pool/demo-pool/claims/claim-abc123")
+
+ await expect(page.getByRole("heading", { name: "Signed URLs (2)" })).toBeVisible()
+ await expect(page.getByRole("cell", { name: "Customer demo" })).toBeVisible()
+ await expect(page.getByRole("cell", { name: "QA session" })).toBeVisible()
+ await expect(page.getByRole("link", { name: "/api/svc/demo-pool/vm-xyz789-mcp/" })).toBeVisible()
+
+ await page.getByRole("button", { name: "Create signed URL" }).click()
+ await page.getByRole("button", { name: "Choose a service" }).click()
+ await page.getByRole("option", { name: "mcp" }).click()
+ await page.getByLabel("Label (optional)").fill("Partner preview")
+ await page.getByLabel("1 hour").check()
+ await page.getByRole("button", { name: "Create signed URL" }).first().click()
+
+ await expect.poll(() => signedUrls.requests.findLast(request => request.method === "POST")?.body).toMatchObject({
+ logicalService: "mcp",
+ service: "vm-xyz789-mcp",
+ expiresInSeconds: 3600,
+ label: "Partner preview",
+ })
+ await expect(page.getByRole("cell", { name: "Partner preview" })).toBeVisible()
+ expect(signedUrls.urls.find((item) => item.label === "Partner preview")?.expiresAt).toBe("2099-01-01T01:00:00.000Z")
+ await expect(page.getByRole("button", { name: "Copy signed URL 11111111-1111-4111-8111-111111111111" })).toBeVisible()
+ await expect(page.getByRole("button", { name: "Copy signed URL 22222222-2222-4222-8222-222222222222" })).toBeVisible()
+
+ await page.getByRole("button", { name: "Create signed URL" }).click()
+ await page.getByRole("button", { name: "Choose a service" }).click()
+ await page.getByRole("option", { name: "mcp" }).click()
+ await page.getByLabel("24 hours").check()
+ await page.getByRole("button", { name: "Create signed URL" }).first().click()
+ await expect.poll(() => signedUrls.urls.at(-1)?.expiresAt).toBe("2099-01-02T00:00:00.000Z")
+
+ await page.getByRole("button", { name: "Revoke signed URL 11111111-1111-4111-8111-111111111111" }).click()
+ await expect.poll(() => signedUrls.requests.findLast(request => request.method === "DELETE")).toMatchObject({
+ method: "DELETE",
+ id: "11111111-1111-4111-8111-111111111111",
+ })
+ await expect(page.getByText("Revoked", { exact: true })).toBeVisible()
+ await expect(page.getByRole("cell", { name: "QA session" })).toBeVisible()
+})
+
+test("claim detail renders signed URL lifecycle and empty states", async ({ page }) => {
+ await mockFleet(page, [
+ {
+ id: "33333333-3333-4333-8333-333333333333",
+ namespace: "demo-pool",
+ claim: "claim-abc123",
+ sandbox: "vm-xyz789",
+ service: "vm-xyz789-mcp",
+ logicalService: "mcp",
+ url: "https://run.cua.ai/api/signed/33333333-3333-4333-8333-333333333333",
+ createdAt: "2026-08-30T12:00:00Z",
+ expiresAt: "2026-08-30T13:00:00Z",
+ },
+ {
+ id: "44444444-4444-4444-8444-444444444444",
+ namespace: "demo-pool",
+ claim: "claim-abc123",
+ sandbox: "vm-xyz789",
+ service: "vm-xyz789-mcp",
+ logicalService: "mcp",
+ url: "https://run.cua.ai/api/signed/44444444-4444-4444-8444-444444444444",
+ createdAt: "2099-01-01T00:00:00Z",
+ expiresAt: "2099-01-02T00:00:00Z",
+ revokedAt: "2099-01-01T00:30:00Z",
+ },
+ ])
+ await page.goto("/pools/demo-pool/demo-pool/claims/claim-abc123")
+
+ await expect(page.getByText("Expired", { exact: true })).toBeVisible()
+ await expect(page.getByText("Revoked", { exact: true })).toBeVisible()
+
+ await page.getByRole("button", { name: "Refresh signed URLs" }).click()
+})
+
+test("claim detail offers an actionable signed URL empty state", async ({ page }) => {
+ await mockFleet(page)
+ await page.goto("/pools/demo-pool/demo-pool/claims/claim-abc123")
+
+ await expect(page.getByText("No signed URLs yet.")).toBeVisible()
+ await page.getByRole("button", { name: "Create signed URL" }).first().click()
+ await expect(page.getByText("Anyone with this bearer link can access the selected service until it expires or is revoked.")).toBeVisible()
+})
+
+
+test("claim detail ignores a late signed URL list after sandbox navigation", async ({ page }) => {
+ const signedUrls = await mockFleet(
+ page,
+ [
+ {
+ id: "aaaaaaaa-aaaa-4aaa-8aaa-aaaaaaaaaaaa",
+ namespace: "demo-pool",
+ claim: "claim-abc123",
+ sandbox: "vm-xyz789",
+ service: "vm-xyz789-mcp",
+ logicalService: "mcp",
+ label: "Stale claim A URL",
+ url: "https://run.cua.ai/api/signed/aaaaaaaa-aaaa-4aaa-8aaa-aaaaaaaaaaaa",
+ createdAt: "2099-01-01T00:00:00Z",
+ expiresAt: "2099-01-01T01:00:00Z",
+ },
+ {
+ id: "bbbbbbbb-bbbb-4bbb-8bbb-bbbbbbbbbbbb",
+ namespace: "demo-pool",
+ claim: "claim-next",
+ sandbox: "vm-next",
+ service: "vm-next-mcp",
+ logicalService: "mcp",
+ label: "Current claim B URL",
+ url: "https://run.cua.ai/api/signed/bbbbbbbb-bbbb-4bbb-8bbb-bbbbbbbbbbbb",
+ createdAt: "2099-01-01T00:00:00Z",
+ expiresAt: "2099-01-01T01:00:00Z",
+ },
+ ],
+ { holdListClaims: ["claim-abc123"] },
+ {
+ claims: [
+ { name: "claim-abc123", sandboxName: "vm-xyz789", sandboxService: "vm-xyz789-svc" },
+ { name: "claim-next", sandboxName: "vm-next", sandboxService: "vm-next-svc" },
+ ],
+ },
+ )
+ await page.goto("/pools/demo-pool/demo-pool/claims/claim-abc123")
+ await expect.poll(() => signedUrls.requests.filter((request) => request.method === "GET").length).toBeGreaterThanOrEqual(1)
+
+ signedUrls.claims.holdNextLists(2)
+ await page.evaluate(() => {
+ window.history.pushState({}, "", "/pools/demo-pool/demo-pool/claims/claim-next")
+ window.dispatchEvent(new PopStateEvent("popstate"))
+ })
+ await expect(page.getByText("Loading claim…", { exact: true })).toBeVisible()
+
+ signedUrls.releaseList("claim-abc123")
+ await page.waitForTimeout(100)
+ await expect(page.getByText("Loading claim…", { exact: true })).toBeVisible()
+ await expect(page.getByRole("cell", { name: "Stale claim A URL" })).toHaveCount(0)
+ await expect(page.getByText("Signed URLs are unavailable for this deployment. Other claim details remain available.")).toHaveCount(0)
+
+ signedUrls.claims.releaseLists()
+ await expect(page.getByRole("heading", { name: "claim-next", level: 1 })).toBeVisible()
+ await expect(page.getByRole("cell", { name: "Current claim B URL" })).toBeVisible()
+ await expect(page.getByRole("cell", { name: "Stale claim A URL" })).toHaveCount(0)
+})
+
+test("claim detail hides signed URL controls when creation is unavailable", async ({ page }) => {
+ await mockFleet(page, [], { unavailable: { create: true } })
+ await page.goto("/pools/demo-pool/demo-pool/claims/claim-abc123")
+
+ await page.getByRole("button", { name: "Create signed URL" }).click()
+ await page.getByRole("button", { name: "Choose a service" }).click()
+ await page.getByRole("option", { name: "mcp" }).click()
+ await page.getByRole("button", { name: "Create signed URL" }).first().click()
+
+ await expect(page.getByText("Signed URLs are unavailable for this deployment. Other claim details remain available.")).toBeVisible()
+ await expect(page.getByRole("button", { name: "Create signed URL" })).toHaveCount(0)
+ await expect(page.getByRole("button", { name: "Refresh signed URLs" })).toHaveCount(0)
+ await expect(page.getByRole("heading", { name: "Overview" })).toBeVisible()
+})
+
+test("claim detail hides signed URL controls when revocation is unavailable", async ({ page }) => {
+ await mockFleet(page, [
+ {
+ id: "cccccccc-cccc-4ccc-8ccc-cccccccccccc",
+ namespace: "demo-pool",
+ claim: "claim-abc123",
+ sandbox: "vm-xyz789",
+ service: "vm-xyz789-mcp",
+ logicalService: "mcp",
+ label: "Revoke unavailable",
+ url: "https://run.cua.ai/api/signed/cccccccc-cccc-4ccc-8ccc-cccccccccccc",
+ createdAt: "2099-01-01T00:00:00Z",
+ expiresAt: "2099-01-01T01:00:00Z",
+ },
+ ], { unavailable: { revoke: true } })
+ await page.goto("/pools/demo-pool/demo-pool/claims/claim-abc123")
+
+ await page.getByRole("button", { name: "Revoke signed URL cccccccc-cccc-4ccc-8ccc-cccccccccccc" }).click()
+
+ await expect(page.getByText("Signed URLs are unavailable for this deployment. Other claim details remain available.")).toBeVisible()
+ await expect(page.getByRole("button", { name: "Revoke signed URL cccccccc-cccc-4ccc-8ccc-cccccccccccc" })).toHaveCount(0)
+ await expect(page.getByRole("heading", { name: "Overview" })).toBeVisible()
+})
+
+test("mobile claim detail creates and revokes a signed URL", async ({ page }) => {
+ await page.setViewportSize({ width: 375, height: 900 })
+ const signedUrls = await mockFleet(page)
+ await page.goto("/pools/demo-pool/demo-pool/claims/claim-abc123")
+
+ await page.getByRole("button", { name: "Create signed URL" }).first().click()
+ await page.getByRole("button", { name: "Choose a service" }).click()
+ await page.getByRole("option", { name: "mcp" }).click()
+ await page.getByLabel("15 minutes").check()
+ await page.getByRole("button", { name: "Create signed URL" }).first().click()
+
+ await expect.poll(() => signedUrls.urls[0]?.expiresAt).toBe("2099-01-01T00:15:00.000Z")
+ const created = signedUrls.urls[0]
+ await expect(page.getByRole("button", { name: `Revoke signed URL ${created.id}` })).toBeVisible()
+ await page.getByRole("button", { name: `Revoke signed URL ${created.id}` }).click()
+ await expect(page.getByText("Revoked", { exact: true })).toBeVisible()
+})
+
+test("claim navigation ignores a delayed signed URL creation from the prior sandbox identity", async ({ page }) => {
+ const signedUrls = await mockFleet(
+ page,
+ [
+ {
+ id: "dddddddd-dddd-4ddd-8ddd-dddddddddddd",
+ namespace: "demo-pool",
+ claim: "claim-next",
+ sandbox: "vm-xyz789",
+ service: "vm-xyz789-mcp",
+ logicalService: "mcp",
+ label: "Current claim URL",
+ url: "https://run.cua.ai/api/signed/dddddddd-dddd-4ddd-8ddd-dddddddddddd",
+ createdAt: "2099-01-01T00:00:00Z",
+ expiresAt: "2099-01-01T01:00:00Z",
+ },
+ ],
+ { holdCreateClaims: ["claim-abc123"] },
+ {
+ claims: [
+ { name: "claim-abc123", sandboxName: "vm-xyz789", sandboxService: "vm-xyz789-svc" },
+ { name: "claim-next", sandboxName: "vm-xyz789", sandboxService: "vm-xyz789-svc" },
+ ],
+ },
+ )
+ await page.goto("/pools/demo-pool/demo-pool/claims/claim-abc123")
+
+ await page.getByRole("button", { name: "Create signed URL" }).first().click()
+ await page.getByRole("button", { name: "Choose a service" }).click()
+ await page.getByRole("option", { name: "mcp" }).click()
+ await page.getByLabel("Label (optional)").fill("Prior claim bearer URL")
+ await page.getByRole("button", { name: "Create signed URL" }).first().click()
+ await expect.poll(() => signedUrls.requests.some((request) => request.method === "POST")).toBe(true)
+
+ signedUrls.claims.holdNextLists(2)
+ await page.evaluate(() => {
+ window.history.pushState({}, "", "/pools/demo-pool/demo-pool/claims/claim-next")
+ window.dispatchEvent(new PopStateEvent("popstate"))
+ })
+ await expect(page.getByText("Loading claim…", { exact: true })).toBeVisible()
+
+ signedUrls.releaseCreate("claim-abc123")
+ await expect.poll(() => signedUrls.urls.some((item) => item.label === "Prior claim bearer URL")).toBe(true)
+ await page.waitForTimeout(100)
+ await expect(page.getByText("Loading claim…", { exact: true })).toBeVisible()
+ await expect(page.getByRole("cell", { name: "Prior claim bearer URL" })).toHaveCount(0)
+ await expect(page.getByText("Signed URL created", { exact: true })).toHaveCount(0)
+ await expect(page.getByText("Signed URLs are unavailable for this deployment. Other claim details remain available.")).toHaveCount(0)
+
+ signedUrls.claims.releaseLists()
+ await expect(page.getByRole("heading", { name: "claim-next", level: 1 })).toBeVisible()
+ await expect(page.getByRole("cell", { name: "Current claim URL" })).toBeVisible()
+ await expect(page.getByRole("cell", { name: "Prior claim bearer URL" })).toHaveCount(0)
+})
+
+test("claim navigation ignores delayed signed URL revocation unavailability from the prior sandbox identity", async ({ page }) => {
+ const oldUrlId = "eeeeeeee-eeee-4eee-8eee-eeeeeeeeeeee"
+ const signedUrls = await mockFleet(
+ page,
+ [
+ {
+ id: oldUrlId,
+ namespace: "demo-pool",
+ claim: "claim-abc123",
+ sandbox: "vm-xyz789",
+ service: "vm-xyz789-mcp",
+ logicalService: "mcp",
+ label: "Prior claim URL",
+ url: `https://run.cua.ai/api/signed/${oldUrlId}`,
+ createdAt: "2099-01-01T00:00:00Z",
+ expiresAt: "2099-01-01T01:00:00Z",
+ },
+ {
+ id: "ffffffff-ffff-4fff-8fff-ffffffffffff",
+ namespace: "demo-pool",
+ claim: "claim-next",
+ sandbox: "vm-xyz789",
+ service: "vm-xyz789-mcp",
+ logicalService: "mcp",
+ label: "Current claim URL",
+ url: "https://run.cua.ai/api/signed/ffffffff-ffff-4fff-8fff-ffffffffffff",
+ createdAt: "2099-01-01T00:00:00Z",
+ expiresAt: "2099-01-01T01:00:00Z",
+ },
+ ],
+ { holdRevokeIds: [oldUrlId], unavailable: { revoke: true } },
+ {
+ claims: [
+ { name: "claim-abc123", sandboxName: "vm-xyz789", sandboxService: "vm-xyz789-svc" },
+ { name: "claim-next", sandboxName: "vm-xyz789", sandboxService: "vm-xyz789-svc" },
+ ],
+ },
+ )
+ await page.goto("/pools/demo-pool/demo-pool/claims/claim-abc123")
+ await page.getByRole("button", { name: `Revoke signed URL ${oldUrlId}` }).click()
+ await expect.poll(() => signedUrls.requests.some((request) => request.method === "DELETE" && request.id === oldUrlId)).toBe(true)
+
+ signedUrls.claims.holdNextLists(2)
+ await page.evaluate(() => {
+ window.history.pushState({}, "", "/pools/demo-pool/demo-pool/claims/claim-next")
+ window.dispatchEvent(new PopStateEvent("popstate"))
+ })
+ await expect(page.getByText("Loading claim…", { exact: true })).toBeVisible()
+
+ signedUrls.releaseRevoke(oldUrlId)
+ await page.waitForTimeout(100)
+ await expect(page.getByText("Loading claim…", { exact: true })).toBeVisible()
+ await expect(page.getByRole("cell", { name: "Prior claim URL" })).toHaveCount(0)
+ await expect(page.getByText("Signed URLs are unavailable for this deployment. Other claim details remain available.")).toHaveCount(0)
+
+ signedUrls.claims.releaseLists()
+ await expect(page.getByRole("heading", { name: "claim-next", level: 1 })).toBeVisible()
+ await expect(page.getByRole("cell", { name: "Current claim URL" })).toBeVisible()
+ await expect(page.getByRole("cell", { name: "Prior claim URL" })).toHaveCount(0)
+})
diff --git a/libs/fleet/e2e/fixtures/mock-api.ts b/libs/fleet/e2e/fixtures/mock-api.ts
index a740e80349..a2179bc09f 100644
--- a/libs/fleet/e2e/fixtures/mock-api.ts
+++ b/libs/fleet/e2e/fixtures/mock-api.ts
@@ -655,7 +655,7 @@ export async function mockPoolsApi(page: Page): Promise<void> {
containerDiskImage: "test-image:latest",
cpuCores: 4,
memory: "4Gi",
- services: [],
+ services: [{ name: "mcp", targetPort: 8080, protocol: "TCP" }],
},
},
};
@@ -882,37 +882,74 @@ export async function mockInstanceDetailApi(page: Page): Promise<void> {
// Claims API mocking (OSGymSandboxClaim CRD)
// ---------------------------------------------------------------------------
-export async function mockClaimsApi(page: Page): Promise<void> {
+export interface MockClaim {
+ name: string;
+ namespace?: string;
+ phase?: "Bound" | "Pending" | "Failed";
+ sandboxName?: string;
+ sandboxService?: string;
+}
+
+export interface MockClaimsApiOptions {
+ claims?: MockClaim[];
+}
+
+export interface MockClaimsApiControl {
+ holdNextLists(count?: number): void;
+ releaseLists(): void;
+}
+
+export async function mockClaimsApi(
+ page: Page,
+ options: MockClaimsApiOptions = {},
+): Promise<MockClaimsApiControl> {
+ const claims = options.claims ?? [
+ {
+ name: "claim-abc123",
+ namespace: "demo-pool",
+ phase: "Bound",
+ sandboxName: "vm-xyz789",
+ sandboxService: "vm-xyz789-svc",
+ },
+ ];
+ const heldLists: Array<ReturnType<typeof deferred>> = [];
+ const activeLists = new Set<ReturnType<typeof deferred>>();
+ const items = claims.map((claim) => ({
+ apiVersion: "osgym.cua.ai/v1alpha1",
+ kind: "OSGymSandboxClaim",
+ metadata: {
+ name: claim.name,
+ namespace: claim.namespace ?? "demo-pool",
+ creationTimestamp: "2026-05-28T10:00:00Z",
+ },
+ spec: {
+ sandboxTemplateRef: { name: "demo-pool-template" },
+ warmpool: "demo-pool",
+ },
+ status: {
+ phase: claim.phase ?? "Bound",
+ ...(claim.phase === "Pending" ? {} : {
+ sandbox: {
+ name: claim.sandboxName ?? `${claim.name}-sandbox`,
+ service: claim.sandboxService ?? `${claim.name}-svc`,
+ },
+ }),
+ },
+ }));
+
await page.route(
"**/api/k8s/apis/osgym.cua.ai/v1alpha1/namespaces/*/osgymsandboxclaims",
async (route) => {
if (route.request().method() === "GET") {
+ const heldList = heldLists.shift();
+ if (heldList) {
+ activeLists.add(heldList);
+ await heldList.promise;
+ activeLists.delete(heldList);
+ }
await route.fulfill({
contentType: "application/json",
- body: JSON.stringify({
- items: [
- {
- apiVersion: "osgym.cua.ai/v1alpha1",
- kind: "OSGymSandboxClaim",
- metadata: {
- name: "claim-abc123",
- namespace: "demo-pool",
- creationTimestamp: "2026-05-28T10:00:00Z",
- },
- spec: {
- sandboxTemplateRef: { name: "demo-pool-template" },
- warmpool: "demo-pool",
- },
- status: {
- phase: "Bound",
- sandbox: {
- name: "vm-xyz789",
- service: "vm-xyz789-svc",
- },
- },
- },
- ],
- }),
+ body: JSON.stringify({ items }),
});
} else if (route.request().method() === "POST") {
const body = route.request().postDataJSON();
@@ -948,6 +985,15 @@ export async function mockClaimsApi(page: Page): Promise<void> {
}
},
);
+
+ return {
+ holdNextLists(count = 1) {
+ for (let index = 0; index < count; index += 1) heldLists.push(deferred());
+ },
+ releaseLists() {
+ for (const list of [...heldLists.splice(0), ...activeLists]) list.resolve();
+ },
+ };
}
// ---------------------------------------------------------------------------
@@ -1384,3 +1430,155 @@ export async function mockChatApi(
releaseCreate: create.resolve,
};
}
+
+// ---------------------------------------------------------------------------
+// Signed service URLs API mocking
+// ---------------------------------------------------------------------------
+
+export interface MockSignedServiceUrl {
+ id: string;
+ namespace: string;
+ claim: string;
+ sandbox: string;
+ service: string;
+ logicalService: string;
+ label?: string;
+ url: string;
+ createdAt: string;
+ expiresAt: string;
+ revokedAt?: string;
+}
+
+export interface MockSignedServiceUrlsApiOptions {
+ holdListClaims?: string[];
+ holdCreateClaims?: string[];
+ holdRevokeIds?: string[];
+ unavailable?: { list?: boolean; create?: boolean; revoke?: boolean };
+}
+
+export async function mockSignedServiceUrlsApi(
+ page: Page,
+ initial: MockSignedServiceUrl[] = [],
+ options: MockSignedServiceUrlsApiOptions = {},
+): Promise<{
+ urls: MockSignedServiceUrl[];
+ requests: Array<{ method: string; id?: string; body?: Record<string, unknown> }>;
+ releaseList(claim: string): void;
+ releaseCreate(claim: string): void;
+ releaseRevoke(id: string): void;
+}> {
+ const urls = [...initial];
+ const requests: Array<{ method: string; id?: string; body?: Record<string, unknown> }> = [];
+ const heldLists = new Map<string, ReturnType<typeof deferred>>(
+ (options.holdListClaims ?? []).map((claim) => [claim, deferred()]),
+ );
+ const heldCreates = new Map<string, ReturnType<typeof deferred>>(
+ (options.holdCreateClaims ?? []).map((claim) => [claim, deferred()]),
+ );
+ const heldRevokes = new Map<string, ReturnType<typeof deferred>>(
+ (options.holdRevokeIds ?? []).map((id) => [id, deferred()]),
+ );
+
+ await page.route(/\/api\/signed-service-urls\/[^/?]+(?:\/[^/?]+)?(?:\?.*)?$/, async (route) => {
+ const request = route.request();
+ const url = new URL(request.url());
+ const parts = url.pathname.split("/").filter(Boolean);
+ const namespace = decodeURIComponent(parts[2] ?? "");
+ const id = parts.length > 3 ? decodeURIComponent(parts[3]) : undefined;
+ const body = request.postData()
+ ? request.postDataJSON() as Record<string, unknown>
+ : undefined;
+ requests.push({ method: request.method(), id, body });
+
+ if (request.method() === "GET" && !id) {
+ const claim = url.searchParams.get("claim") ?? "";
+ await heldLists.get(claim)?.promise;
+ if (options.unavailable?.list) {
+ await route.fulfill({
+ status: 503,
+ contentType: "application/json",
+ body: JSON.stringify({ error: "signed service URLs are unavailable" }),
+ });
+ return;
+ }
+ await route.fulfill({
+ contentType: "application/json",
+ body: JSON.stringify(urls.filter((item) => item.namespace === namespace && item.claim === claim)),
+ });
+ return;
+ }
+
+ if (request.method() === "POST" && !id && body) {
+ await heldCreates.get(String(body.claim))?.promise;
+ if (options.unavailable?.create) {
+ await route.fulfill({
+ status: 503,
+ contentType: "application/json",
+ body: JSON.stringify({ error: "signed service URLs are unavailable" }),
+ });
+ return;
+ }
+ const signedUrlId = `00000000-0000-4000-8000-${String(urls.length + 1).padStart(12, "0")}`;
+ const createdAt = "2099-01-01T00:00:00Z";
+ const created: MockSignedServiceUrl = {
+ id: signedUrlId,
+ namespace,
+ claim: String(body.claim),
+ sandbox: String(body.sandbox),
+ service: String(body.service),
+ logicalService: String(body.logicalService),
+ ...(typeof body.label === "string" ? { label: body.label } : {}),
+ url: `https://run.cua.ai/api/signed/${signedUrlId}`,
+ createdAt,
+ expiresAt: new Date(Date.parse(createdAt) + Number(body.expiresInSeconds) * 1000).toISOString(),
+ };
+ urls.push(created);
+ await route.fulfill({
+ status: 201,
+ contentType: "application/json",
+ body: JSON.stringify(created),
+ });
+ return;
+ }
+
+ if (request.method() === "DELETE" && id) {
+ await heldRevokes.get(id)?.promise;
+ if (options.unavailable?.revoke) {
+ await route.fulfill({
+ status: 503,
+ contentType: "application/json",
+ body: JSON.stringify({ error: "signed service URLs are unavailable" }),
+ });
+ return;
+ }
+ const index = urls.findIndex((item) => item.namespace === namespace && item.id === id);
+ if (index < 0) {
+ await route.fulfill({
+ status: 404,
+ contentType: "application/json",
+ body: JSON.stringify({ error: "signed URL not found" }),
+ });
+ return;
+ }
+ urls[index].revokedAt = "2026-08-31T12:30:00Z";
+ await route.fulfill({ status: 204, body: "" });
+ return;
+ }
+
+ await route.continue();
+ });
+
+ return {
+ urls,
+ requests,
+ releaseList(claim: string) {
+ heldLists.get(claim)?.resolve();
+ },
+ releaseCreate(claim: string) {
+ heldCreates.get(claim)?.resolve();
+ },
+ releaseRevoke(id: string) {
+ heldRevokes.get(id)?.resolve();
+ },
+ };
+}
diff --git a/libs/fleet/nginx.conf b/libs/fleet/nginx.conf
index cd0029b97e..c5d01ef368 100644
--- a/libs/fleet/nginx.conf
+++ b/libs/fleet/nginx.conf
@@ -63,17 +63,39 @@ server {
}
# cyclops-cs backend — Keycloak-authenticated handlers for:
- # /api/keys — per-user API key (service-account client) management
- # /api/gateway — token-authenticated proxy to per-pool orchestrators
- # /api/k8s — SPA-authenticated proxy to the kubectl-proxy sidecar
- # (replaces the old /k8s-api/ nginx block)
- # /api/batch — OSGym batch driver (submit/poll/results/cancel)
- # /api/label — same, label-scoped streaming variant
+ # /api/keys — per-user API key (service-account client) management
+ # /api/gateway — token-authenticated proxy to per-pool orchestrators
+ # /api/k8s — SPA-authenticated proxy to the kubectl-proxy sidecar
+ # (replaces the old /k8s-api/ nginx block)
+ # /api/batch — OSGym batch driver (submit/poll/results/cancel)
+ # /api/label — same, label-scoped streaming variant
+ # /api/signed-service-urls — signed sandbox service URL management
#
# Backend runs as a standalone Deployment in the same namespace; nginx
# reaches it via the cyclops-cs-backend Service (envsubst substitutes
# the cluster DNS URL at container start). Matched before the /api/
# 404 guard below.
+ # Public capability proxy. The capability itself authorizes access, so this
+ # route deliberately bypasses oauth2-proxy and suppresses token-bearing
+ # request URLs from nginx access logs.
+ location ^~ /api/signed-svc/ {
+ access_log off;
+ error_log /dev/null crit;
+ proxy_pass ${CYCLOPS_CS_BACKEND};
+ proxy_http_version 1.1;
+ proxy_set_header Upgrade $http_upgrade;
+ proxy_set_header Connection $connection_upgrade;
+ proxy_set_header Host $host;
+ proxy_set_header X-Real-IP $remote_addr;
+ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
+ proxy_set_header X-Forwarded-Proto $scheme;
+ client_max_body_size 0;
+ proxy_request_buffering off;
+ proxy_buffering off;
+ proxy_read_timeout 1h;
+ proxy_send_timeout 1h;
+ }
+
# /api/svc — sandbox service proxy.
#
# Two auth paths:
@@ -161,7 +183,7 @@ server {
proxy_set_header X-Forwarded-Proto $scheme;
}
- location ~ ^/api/(keys|user-keys|github-trust-policies|gateway|k8s|swagger|batch|label|namespaces|config|analytics|chat|billing|state|usage|admin)(/|$) {
+ location ~ ^/api/(keys|user-keys|github-trust-policies|gateway|k8s|swagger|batch|label|namespaces|config|analytics|chat|billing|state|usage|admin|signed-service-urls)(/|$) {
proxy_pass ${CYCLOPS_CS_BACKEND};
proxy_http_version 1.1;
proxy_set_header Host $host;
diff --git a/libs/fleet/scripts/cleanup-live-sdk-example.sh b/libs/fleet/scripts/cleanup-live-sdk-example.sh
index 5330a2bf84..3ab8f5f0db 100755
--- a/libs/fleet/scripts/cleanup-live-sdk-example.sh
+++ b/libs/fleet/scripts/cleanup-live-sdk-example.sh
@@ -11,11 +11,26 @@ token="$($curl_bin --fail-with-body --silent --show-error -X POST "$CUA_TOKEN_UR
--data-urlencode "client_id=$CUA_CLIENT_ID" \
--data-urlencode "client_secret=$CUA_CLIENT_SECRET" | jq -er .access_token)"
cleanup_failed=0
+retry_attempts=5
+retry_delay="${CLEANUP_RETRY_DELAY_SECONDS:-5}"
+
+transient_status() {
+ case "$1" in
+ 000|5??) return 0 ;;
+ *) return 1 ;;
+ esac
+}
delete_url() {
- local url="$1" status
- status="$($curl_bin --silent --show-error -o /dev/null --write-out '%{http_code}' \
- -H "Authorization: Bearer $token" -X DELETE "$url")" || status=000
+ local url="$1" status attempt
+ for attempt in $(seq 1 "$retry_attempts"); do
+ status="$($curl_bin --silent --show-error -o /dev/null --write-out '%{http_code}' \
+ -H "Authorization: Bearer $token" -X DELETE "$url")" || status=000
+ if ! transient_status "$status" || (( attempt >= retry_attempts )); then
+ break
+ fi
+ sleep "$retry_delay"
+ done
case "$status" in
200|202|204|404) ;;
*) echo "Failed to delete $url: HTTP $status" >&2; cleanup_failed=1 ;;
@@ -23,10 +38,16 @@ delete_url() {
}
delete_collection() {
- local collection="$1" body_file status
+ local collection="$1" body_file status attempt
body_file="$(mktemp)"
- status="$($curl_bin --silent --show-error -o "$body_file" --write-out '%{http_code}' \
- -H "Authorization: Bearer $token" "$collection")" || status=000
+ for attempt in $(seq 1 "$retry_attempts"); do
+ status="$($curl_bin --silent --show-error -o "$body_file" --write-out '%{http_code}' \
+ -H "Authorization: Bearer $token" "$collection")" || status=000
+ if ! transient_status "$status" || (( attempt >= retry_attempts )); then
+ break
+ fi
+ sleep "$retry_delay"
+ done
case "$status" in
200)
while IFS= read -r name; do
diff --git a/libs/fleet/scripts/generate-sdk-bindings.sh b/libs/fleet/scripts/generate-sdk-bindings.sh
index 44937b8e0e..8a7bd1e2a0 100755
--- a/libs/fleet/scripts/generate-sdk-bindings.sh
+++ b/libs/fleet/scripts/generate-sdk-bindings.sh
@@ -842,10 +842,10 @@ def replace_buffer(match):
f"{indent})"
)
text, buffer_replacements = re.subn(buffer_pattern, replace_buffer, text)
-if buffer_replacements != 23:
- raise SystemExit(f"expected 23 Ruby Rust-buffer future wrappers, found {buffer_replacements}")
-if len(re.findall(r"result = FleetSdk\.rust_call_with_error\(SdkBuildError,:uniffi_[a-z0-9_]*builder_build,", text)) != 7:
- raise SystemExit("expected seven synchronous Ruby SDK builder build calls")
+if buffer_replacements != 25:
+ raise SystemExit(f"expected 25 Ruby Rust-buffer future wrappers, found {buffer_replacements}")
+if len(re.findall(r"result = FleetSdk\.rust_call_with_error\(SdkBuildError,:uniffi_[a-z0-9_]*builder_build,", text)) != 8:
+ raise SystemExit("expected eight synchronous Ruby SDK builder build calls")
void_pattern = r"(?m)^(\s*)FleetSdk\.rust_call_with_error\(([^,]+),:([a-z0-9_]+),(.*)\)$"
def replace_void(match):
@@ -858,8 +858,8 @@ def replace_void(match):
f"{indent})"
)
text, void_replacements = re.subn(void_pattern, replace_void, text)
-if void_replacements != 5:
- raise SystemExit(f"expected 5 Ruby void future wrappers, found {void_replacements}")
+if void_replacements != 6:
+ raise SystemExit(f"expected 6 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-cleanup-live-sdk-example.sh b/libs/fleet/scripts/test-cleanup-live-sdk-example.sh
index 2afedabab4..b1ab167739 100755
--- a/libs/fleet/scripts/test-cleanup-live-sdk-example.sh
+++ b/libs/fleet/scripts/test-cleanup-live-sdk-example.sh
@@ -29,6 +29,15 @@ if [[ "$url" == *'/protocol/openid-connect/token' ]]; then
exit 0
fi
if [[ "$method" == DELETE ]]; then
+ if [[ "$url" == */api/namespaces/* && -n "${CLEANUP_NAMESPACE_DELETE_FAILURES:-}" ]]; then
+ counter_file="$log.namespace-delete-attempts"
+ attempts=$(( $(cat "$counter_file" 2>/dev/null || echo 0) + 1 ))
+ printf '%s' "$attempts" > "$counter_file"
+ if (( attempts <= CLEANUP_NAMESPACE_DELETE_FAILURES )); then
+ printf '502'
+ exit 0
+ fi
+ fi
printf '204'
exit 0
fi
@@ -85,3 +94,32 @@ GET https://run.example/api/k8s/apis/cua.ai/v1/namespaces/sdk-example-python-1-1
DELETE https://run.example/api/namespaces/sdk-example-python-1-1
FORBIDDEN_EXPECTED
diff -u "$temporary/forbidden-expected.log" "$CLEANUP_TEST_LOG"
+
+: > "$CLEANUP_TEST_LOG"
+rm -f "$CLEANUP_TEST_LOG.namespace-delete-attempts"
+export CLEANUP_RETRY_DELAY_SECONDS=0
+export CLEANUP_NAMESPACE_DELETE_FAILURES=2
+"$repo_root/cyclops-cs/scripts/cleanup-live-sdk-example.sh"
+cat > "$temporary/retry-expected.log" <<'RETRY_EXPECTED'
+POST https://auth.example/protocol/openid-connect/token
+GET https://run.example/api/k8s/apis/osgym.cua.ai/v1alpha1/namespaces/sdk-example-python-1-1/osgymsandboxclaims
+DELETE https://run.example/api/k8s/apis/osgym.cua.ai/v1alpha1/namespaces/sdk-example-python-1-1/osgymsandboxclaims/claim-a
+GET https://run.example/api/k8s/apis/cua.ai/v1/namespaces/sdk-example-python-1-1/osgymworkspacepools
+DELETE https://run.example/api/k8s/apis/cua.ai/v1/namespaces/sdk-example-python-1-1/osgymworkspacepools/pool-a
+DELETE https://run.example/api/namespaces/sdk-example-python-1-1
+DELETE https://run.example/api/namespaces/sdk-example-python-1-1
+DELETE https://run.example/api/namespaces/sdk-example-python-1-1
+RETRY_EXPECTED
+diff -u "$temporary/retry-expected.log" "$CLEANUP_TEST_LOG"
+
+: > "$CLEANUP_TEST_LOG"
+rm -f "$CLEANUP_TEST_LOG.namespace-delete-attempts"
+export CLEANUP_NAMESPACE_DELETE_FAILURES=10
+if "$repo_root/cyclops-cs/scripts/cleanup-live-sdk-example.sh" 2> "$temporary/persistent-stderr.log"; then
+ echo "expected cleanup to fail when the namespace delete keeps returning 502" >&2
+ exit 1
+fi
+grep -q 'Failed to delete https://run.example/api/namespaces/sdk-example-python-1-1: HTTP 502' "$temporary/persistent-stderr.log"
+[[ "$(grep -c '^DELETE https://run.example/api/namespaces/sdk-example-python-1-1$' "$CLEANUP_TEST_LOG")" == 5 ]]
+unset CLEANUP_NAMESPACE_DELETE_FAILURES CLEANUP_RETRY_DELAY_SECONDS
+printf 'live SDK cleanup retry checks passed.\n'
diff --git a/libs/fleet/scripts/test-generate-sdk-bindings.sh b/libs/fleet/scripts/test-generate-sdk-bindings.sh
index df9ce5a4ad..8a5e4b7935 100755
--- a/libs/fleet/scripts/test-generate-sdk-bindings.sh
+++ b/libs/fleet/scripts/test-generate-sdk-bindings.sh
@@ -577,6 +577,7 @@ for browser_builder in \
CreatePoolRequestBuilder \
CyclopsTokenProviderConfigurationBuilder \
CreateClaimRequestBuilder \
+ CreateSignedServiceUrlRequestBuilder \
CreateUserApiKeyRequestBuilder \
TemplateBuilder; do
if ! grep -Fq -- "class $browser_builder" "$browser_schema_source" && \
@@ -586,12 +587,16 @@ for browser_builder in \
done
grep -Fq -- "class VmTemplateBuilder" "$python_schema_source" || fail "Python bindings omit VmTemplateBuilder"
grep -Fq -- "class CreatePoolRequestBuilder" "$python_sdk_source" || fail "Python bindings omit CreatePoolRequestBuilder"
+grep -Fq -- "class CreateSignedServiceUrlRequestBuilder" "$python_sdk_source" || fail "Python bindings omit CreateSignedServiceUrlRequestBuilder"
grep -Fq -- "open class VmTemplateBuilder" "$kotlin_schema_source" || fail "Kotlin bindings omit VmTemplateBuilder"
grep -Fq -- "open class CreatePoolRequestBuilder" "$kotlin_sdk_source" || fail "Kotlin bindings omit CreatePoolRequestBuilder"
+grep -Fq -- "open class CreateSignedServiceUrlRequestBuilder" "$kotlin_sdk_source" || fail "Kotlin bindings omit CreateSignedServiceUrlRequestBuilder"
grep -Fq -- "open class VmTemplateBuilder" "$swift_schema_source" || fail "Swift bindings omit VmTemplateBuilder"
grep -Fq -- "open class CreatePoolRequestBuilder" "$swift_sdk_source" || fail "Swift bindings omit CreatePoolRequestBuilder"
+grep -Fq -- "open class CreateSignedServiceUrlRequestBuilder" "$swift_sdk_source" || fail "Swift bindings omit CreateSignedServiceUrlRequestBuilder"
grep -Fq -- "class VmTemplateBuilder" "$ruby_schema_source" || fail "Ruby bindings omit VmTemplateBuilder"
grep -Fq -- "class CreatePoolRequestBuilder" "$ruby_sdk_source" || fail "Ruby bindings omit CreatePoolRequestBuilder"
+grep -Fq -- "class CreateSignedServiceUrlRequestBuilder" "$ruby_sdk_source" || fail "Ruby bindings omit CreateSignedServiceUrlRequestBuilder"
grep -Fq -- "alloc_from_TypeOSGymSandboxTemplateSpec" "$bindings_dir/ruby/cyclops_sdk.rb" || \
fail "Ruby facade omits cross-component record allocation adapter"
if grep -Fq -- "execute_authenticated" "$python_sdk_source"; then fail "Python bindings export execute_authenticated"; fi
@@ -622,6 +627,214 @@ grep -Fq -- "public var creationTimestamp: String?" "$swift_sdk_source" || fail
grep -Fq -- "attr_reader :namespace, :name, :labels, :creation_timestamp" "$ruby_sdk_source" || fail "Ruby bindings omit creation_timestamp"
grep -Fq -- "creationTimestamp?: string" "$node_sdk_source" || fail "Node bindings omit creationTimestamp"
grep -Fq -- "CreationTimestamp *string" "$go_sdk_source" || fail "Go bindings omit CreationTimestamp"
+for symbol in SignedServiceUrl SignedServiceUrlsUnavailable; do
+ grep -Fq -- "$symbol" "$browser_sdk_source" || fail "Browser/WASM bindings omit $symbol"
+ grep -Fq -- "$symbol" "$python_sdk_source" || fail "Python bindings omit $symbol"
+ grep -Fq -- "$symbol" "$kotlin_sdk_source" || fail "Kotlin bindings omit $symbol"
+ grep -Fq -- "$symbol" "$swift_sdk_source" || fail "Swift bindings omit $symbol"
+ grep -Fq -- "$symbol" "$ruby_sdk_source" || fail "Ruby bindings omit $symbol"
+done
+for method in createSignedServiceUrl listSignedServiceUrls revokeSignedServiceUrl; do
+ grep -Fq -- "$method(" "$browser_sdk_source" || fail "Browser/WASM bindings omit $method"
+ grep -Fq -- "suspend fun \`$method\`" "$kotlin_sdk_source" || fail "Kotlin bindings omit $method"
+ grep -Fq -- "func $method" "$swift_sdk_source" || fail "Swift bindings omit $method"
+done
+for method in create_signed_service_url list_signed_service_urls revoke_signed_service_url; do
+ grep -Fq -- "async def $method" "$python_sdk_source" || fail "Python bindings omit $method"
+ grep -Fq -- "def $method" "$ruby_sdk_source" || fail "Ruby bindings omit $method"
+done
+for legacy_symbol in PublicUrl public_url publicUrl; do
+ for binding in "$browser_sdk_source" "$python_sdk_source" "$kotlin_sdk_source" "$swift_sdk_source" "$ruby_sdk_source"; do
+ if grep -Fq -- "$legacy_symbol" "$binding"; then
+ fail "authoritative binding exports legacy public URL symbol $legacy_symbol: $binding"
+ fi
+ done
+done
+
+node - "$python_sdk_source" "$kotlin_sdk_source" "$swift_sdk_source" "$ruby_sdk_source" "$browser_sdk_source" <<'NODE'
+const fs = require("node:fs");
+
+const [pythonPath, kotlinPath, swiftPath, rubyPath, browserPath] = process.argv.slice(2);
+const sources = Object.fromEntries(
+ Object.entries({ python: pythonPath, kotlin: kotlinPath, swift: swiftPath, ruby: rubyPath, browser: browserPath })
+ .map(([language, path]) => [language, fs.readFileSync(path, "utf8")]),
+);
+const signedFields = ["id", "namespace", "claim", "sandbox", "service", "label", "url", "created_at", "expires_at", "revoked_at"];
+const camelFields = ["id", "namespace", "claim", "sandbox", "service", "label", "url", "createdAt", "expiresAt", "revokedAt"];
+
+function fail(message) { throw new Error(`signed service URL structural guard: ${message}`); }
+function text(source, value, label) { if (!source.includes(value)) fail(`${label}: missing ${value}`); }
+function regex(source, value, label) { if (!value.test(source)) fail(`${label}: pattern is missing`); }
+function all(source, values, label) { values.forEach((value) => text(source, value, label)); }
+function after(source, marker, label) { const index = source.indexOf(marker); if (index < 0) fail(`${label}: start is missing`); return index; }
+function nextIndex(source, from, patterns) {
+ const positions = patterns.map((pattern) => source.indexOf(pattern, from)).filter((index) => index >= 0);
+ return positions.length ? Math.min(...positions) : source.length;
+}
+function pythonClass(source, marker, label) {
+ const start = after(source, marker, label);
+ return source.slice(start, nextIndex(source, start + marker.length, ["\nclass ", "\n# "]));
+}
+function rubyClass(source, marker, label) {
+ const start = after(source, marker, label);
+ return source.slice(start, nextIndex(source, start + marker.length, ["\nclass ", "\n class "]));
+}
+function braceBlock(source, marker, label) {
+ const start = after(source, marker, label);
+ const open = source.indexOf("{", start + marker.length);
+ if (open < 0) fail(`${label}: opening brace is missing`);
+ let depth = 0;
+ for (let index = open; index < source.length; index += 1) {
+ if (source[index] === "{") depth += 1;
+ if (source[index] === "}") depth -= 1;
+ if (depth === 0) return source.slice(start, index + 1);
+ }
+ fail(`${label}: closing brace is missing`);
+}
+function member(source, marker, nextPatterns, label) {
+ const start = after(source, marker, label);
+ return source.slice(start, nextIndex(source, start + marker.length, nextPatterns));
+}
+function braceMember(source, marker, openingMarker, label) {
+ const start = after(source, marker, label);
+ const opening = source.indexOf(openingMarker, start);
+ if (opening < 0) fail(`${label}: method opening is missing`);
+ const open = opening + openingMarker.lastIndexOf("{");
+ let depth = 0;
+ for (let index = open; index < source.length; index += 1) {
+ if (source[index] === "{") depth += 1;
+ if (source[index] === "}") depth -= 1;
+ if (depth === 0) return source.slice(start, index + 1);
+ }
+ fail(`${label}: method closing brace is missing`);
+}
+function identifiers(source) { return source.match(/[A-Za-z_][A-Za-z0-9_]*/g) ?? []; }
+function noLegacy(source, label) {
+ const legacy = identifiers(source).filter((identifier) => /PublicUrl|public_url|publicUrl/.test(identifier));
+ if (legacy.length) fail(`${label}: legacy identifier ${legacy[0]} is present`);
+}
+
+function assertPython(source) {
+ const record = pythonClass(source, "class SignedServiceUrl:", "Python SignedServiceUrl record");
+ signedFields.forEach((field) => text(record, `self.${field}`, "Python SignedServiceUrl fields"));
+ const converter = pythonClass(source, "class _UniffiFfiConverterTypeSignedServiceUrl(", "Python SignedServiceUrl converter");
+ all(converter, ["def read(buf):", "return SignedServiceUrl(", "def write(value, buf):"], "Python SignedServiceUrl converter");
+ signedFields.forEach((field) => { text(converter, `${field}=`, "Python SignedServiceUrl decoder"); text(converter, `value.${field}`, "Python SignedServiceUrl encoder"); });
+ const client = pythonClass(source, "class CyclopsClient(CyclopsClientProtocol):", "Python CyclopsClient");
+ const starts = [" async def create_signed_service_url", " async def list_signed_service_urls", " async def revoke_signed_service_url"];
+ const create = member(client, starts[0], ["\n async def "], "Python create");
+ all(create, ["-> SignedServiceUrl:", "_UniffiFfiConverterTypeCreateSignedServiceUrlRequest.lower", "_UniffiFfiConverterTypeSignedServiceUrl.lift", "uniffi_cyclops_sdk_fn_method_cyclopsclient_create_signed_service_url", "_UniffiFfiConverterTypeSdkError"], "Python concrete create");
+ const list = member(client, starts[1], ["\n async def "], "Python list");
+ all(list, ["-> typing.List[SignedServiceUrl]:", "_UniffiFfiConverterTypeSandbox.lower", "_UniffiFfiConverterSequenceTypeSignedServiceUrl.lift", "uniffi_cyclops_sdk_fn_method_cyclopsclient_list_signed_service_urls", "_UniffiFfiConverterTypeSdkError"], "Python concrete list");
+ const revoke = member(client, starts[2], ["\n async def "], "Python revoke");
+ all(revoke, ["-> None:", "_UniffiFfiConverterTypeSignedServiceUrl.check_lower", "uniffi_cyclops_sdk_fn_method_cyclopsclient_revoke_signed_service_url", "ffi_cyclops_sdk_rust_future_poll_void", "_UniffiFfiConverterTypeSdkError"], "Python concrete revoke");
+ const builder = pythonClass(source, "class CreateSignedServiceUrlRequestBuilder(", "Python signed URL builder");
+ const setterFfi = [["sandbox", "createsignedserviceurlrequestbuilder_sandbox"], ["service", "createsignedserviceurlrequestbuilder_service"], ["expires_in_seconds", "createsignedserviceurlrequestbuilder_expires_in_seconds"], ["label", "createsignedserviceurlrequestbuilder_label"]];
+ setterFfi.forEach(([name, ffi]) => text(member(builder, ` def ${name}(`, ["\n def "], `Python builder ${name}`), ffi, `Python builder ${name}`));
+ all(member(builder, " def build(", ["\n def "], "Python builder build"), ["-> CreateSignedServiceUrlRequest:", "uniffi_cyclops_sdk_fn_method_createsignedserviceurlrequestbuilder_build", "_UniffiFfiConverterTypeCreateSignedServiceUrlRequest.lift", "_UniffiFfiConverterTypeSdkBuildError"], "Python builder build");
+ const errors = pythonClass(source, "class _UniffiFfiConverterTypeSdkError(", "Python SdkError converter");
+ regex(errors, /if variant == 7:\s+return SdkError\.SignedServiceUrlsUnavailable\(/m, "Python SignedServiceUrlsUnavailable decoder ordinal");
+ regex(errors, /if isinstance\(value, SdkError\.SignedServiceUrlsUnavailable\):\s+buf\.write_i32\(7\)/m, "Python SignedServiceUrlsUnavailable encoder ordinal");
+ const buildErrors = pythonClass(source, "class _UniffiFfiConverterTypeSdkBuildError(", "Python SdkBuildError converter");
+ regex(buildErrors, /if variant == 1:\s+return SdkBuildError\.MissingRequiredField\(/m, "Python SdkBuildError decoder");
+ noLegacy(source, "Python");
+}
+
+function assertKotlin(source) {
+ const record = source.slice(after(source, "data class SignedServiceUrl", "Kotlin SignedServiceUrl record"), after(source, "public object FfiConverterTypeSignedServiceUrl", "Kotlin SignedServiceUrl converter"));
+ camelFields.forEach((field) => text(record, `\`${field}\``, "Kotlin SignedServiceUrl fields"));
+ const converter = braceBlock(source, "public object FfiConverterTypeSignedServiceUrl", "Kotlin SignedServiceUrl converter");
+ all(converter, ["override fun read", "return SignedServiceUrl(", "override fun write"], "Kotlin SignedServiceUrl converter");
+ camelFields.forEach((field) => text(converter, `value.\`${field}\``, "Kotlin SignedServiceUrl encoder"));
+ const client = braceBlock(source, "open class CyclopsClient:", "Kotlin CyclopsClient");
+ const methods = [["override suspend fun `createSignedServiceUrl`", ") : SignedServiceUrl {", "create_signed_service_url", "FfiConverterTypeCreateSignedServiceUrlRequest.lower", "FfiConverterTypeSignedServiceUrl.lift"], ["override suspend fun `listSignedServiceUrls`", ") : List<SignedServiceUrl> {", "list_signed_service_urls", "FfiConverterTypeSandbox.lower", "FfiConverterSequenceTypeSignedServiceUrl.lift"], ["override suspend fun `revokeSignedServiceUrl`", ") {", "revoke_signed_service_url", "FfiConverterTypeSignedServiceUrl.lower", "ffi_cyclops_sdk_rust_future_poll_void"]];
+ methods.forEach(([start, opening, ffi, lowering, lifting]) => all(braceMember(client, start, opening, `Kotlin ${start}`), [`uniffi_cyclops_sdk_fn_method_cyclopsclient_${ffi}`, lowering, lifting, "SdkException.ErrorHandler"], `Kotlin concrete ${start}`));
+ const builder = braceBlock(source, "open class CreateSignedServiceUrlRequestBuilder:", "Kotlin signed URL builder");
+ [["sandbox", "sandbox"], ["service", "service"], ["expiresInSeconds", "expires_in_seconds"], ["label", "label"]].forEach(([name, ffi]) => text(member(builder, ` override fun \`${name}\``, ["\n override fun "], `Kotlin builder ${name}`), `createsignedserviceurlrequestbuilder_${ffi}`, `Kotlin builder ${name}`));
+ all(member(builder, " @Throws(SdkBuildException::class)override fun `build`", ["\n override fun "], "Kotlin builder build"), ["CreateSignedServiceUrlRequest", "createsignedserviceurlrequestbuilder_build", "uniffiRustCallWithError(SdkBuildException)"], "Kotlin builder build");
+ regex(source, /7 -> SdkException\.SignedServiceUrlsUnavailable\(\)/, "Kotlin SignedServiceUrlsUnavailable decoder");
+ noLegacy(source, "Kotlin");
+}
+
+function assertSwift(source) {
+ const record = braceBlock(source, "public struct SignedServiceUrl:", "Swift SignedServiceUrl record");
+ camelFields.forEach((field) => text(record, `public var ${field}:`, "Swift SignedServiceUrl fields"));
+ const converter = braceBlock(source, "public struct FfiConverterTypeSignedServiceUrl", "Swift SignedServiceUrl converter");
+ all(converter, ["try SignedServiceUrl(", "static func write"], "Swift SignedServiceUrl converter");
+ camelFields.forEach((field) => text(converter, `value.${field}`, "Swift SignedServiceUrl encoder"));
+ const client = braceBlock(source, "open class CyclopsClient:", "Swift CyclopsClient");
+ const methods = [["open func createSignedServiceUrl", " {", "create_signed_service_url", "FfiConverterTypeCreateSignedServiceUrlRequest_lower", "FfiConverterTypeSignedServiceUrl_lift"], ["open func listSignedServiceUrls", " {", "list_signed_service_urls", "FfiConverterTypeSandbox_lower", "FfiConverterSequenceTypeSignedServiceUrl.lift"], ["open func revokeSignedServiceUrl", " {", "revoke_signed_service_url", "FfiConverterTypeSignedServiceUrl_lower", "ffi_cyclops_sdk_rust_future_poll_void"]];
+ methods.forEach(([start, opening, ffi, lowering, lifting]) => all(braceMember(client, start, opening, `Swift ${start}`), [`uniffi_cyclops_sdk_fn_method_cyclopsclient_${ffi}`, lowering, lifting, "FfiConverterTypeSdkError_lift"], `Swift concrete ${start}`));
+ const builder = braceBlock(source, "open class CreateSignedServiceUrlRequestBuilder:", "Swift signed URL builder");
+ [["sandbox", "sandbox"], ["service", "service"], ["expiresInSeconds", "expires_in_seconds"], ["label", "label"]].forEach(([name, ffi]) => text(member(builder, `open func ${name}`, ["\nopen func "], `Swift builder ${name}`), `createsignedserviceurlrequestbuilder_${ffi}`, `Swift builder ${name}`));
+ all(member(builder, "open func build", ["\nopen func "], "Swift builder build"), ["CreateSignedServiceUrlRequest", "createsignedserviceurlrequestbuilder_build", "FfiConverterTypeSdkBuildError_lift"], "Swift builder build");
+ regex(source, /case 7: return \.SignedServiceUrlsUnavailable/, "Swift SignedServiceUrlsUnavailable decoder");
+ noLegacy(source, "Swift");
+}
+
+function assertRuby(source) {
+ const record = rubyClass(source, "\nclass SignedServiceUrl\n", "Ruby SignedServiceUrl record");
+ text(record, `attr_reader :${signedFields.join(", :")}`, "Ruby SignedServiceUrl fields");
+ const stream = rubyClass(source, "class RustBufferStream", "Ruby RustBufferStream");
+ const bufferBuilder = rubyClass(source, "class RustBufferBuilder", "Ruby RustBufferBuilder");
+ const read = member(stream, " def readTypeSignedServiceUrl", ["\n def "], "Ruby SignedServiceUrl decoder");
+ const write = member(bufferBuilder, " def write_TypeSignedServiceUrl", ["\n def "], "Ruby SignedServiceUrl encoder");
+ all(read, ["SignedServiceUrl.new("], "Ruby SignedServiceUrl decoder"); signedFields.forEach((field) => { text(read, `${field}:`, "Ruby SignedServiceUrl decoder"); text(write, `v.${field}`, "Ruby SignedServiceUrl encoder"); });
+ const client = rubyClass(source, " class CyclopsClient", "Ruby CyclopsClient");
+ const methods = [[" def create_signed_service_url", "create_signed_service_url", "TypeCreateSignedServiceUrlRequest(request)", "consumeIntoTypeSignedServiceUrl"], [" def list_signed_service_urls", "list_signed_service_urls", "TypeSandbox(sandbox)", "consumeIntoSequenceTypeSignedServiceUrl"], [" def revoke_signed_service_url", "revoke_signed_service_url", "TypeSignedServiceUrl(signed_service_url)", "uniffi_rust_future_void"]];
+ methods.forEach(([start, ffi, input, output]) => all(member(client, start, ["\n def "], `Ruby ${start}`), [`cyclopsclient_${ffi}`, input, output, "SdkError"], `Ruby concrete ${start}`));
+ const builder = rubyClass(source, " class CreateSignedServiceUrlRequestBuilder", "Ruby signed URL builder");
+ [["sandbox", "sandbox"], ["service", "service"], ["expires_in_seconds", "expires_in_seconds"], ["label", "label"]].forEach(([name, ffi]) => text(member(builder, ` def ${name}(`, ["\n def "], `Ruby builder ${name}`), `createsignedserviceurlrequestbuilder_${ffi}`, `Ruby builder ${name}`));
+ all(member(builder, " def build()", ["\n def "], "Ruby builder build"), ["consumeIntoTypeCreateSignedServiceUrlRequest", "createsignedserviceurlrequestbuilder_build", "rust_call_with_error(SdkBuildError"], "Ruby builder build");
+ const errorRead = member(stream, " def readTypeSdkError", ["\n def "], "Ruby SdkError decoder");
+ regex(errorRead, /if variant == 7\s+return SdkError::SignedServiceUrlsUnavailable\.new/m, "Ruby SignedServiceUrlsUnavailable decoder ordinal");
+ noLegacy(source, "Ruby");
+}
+
+function assertBrowser(source) {
+ const record = braceBlock(source, "export type SignedServiceUrl", "browser SignedServiceUrl record");
+ camelFields.forEach((field) => regex(record, new RegExp(`\\b${field}\\??:`), "browser SignedServiceUrl fields"));
+ const converter = braceBlock(source, "const FfiConverterTypeSignedServiceUrl", "browser SignedServiceUrl converter");
+ all(converter, ["read(from: RustBuffer)", "write(value: TypeName"], "browser SignedServiceUrl converter");
+ camelFields.forEach((field) => { text(converter, `${field}: FfiConverter`, "browser SignedServiceUrl decoder"); text(converter, `value.${field}`, "browser SignedServiceUrl encoder"); });
+ const client = braceBlock(source, "export class CyclopsClient", "browser CyclopsClient");
+ const methods = [[" async createSignedServiceUrl(", "): Promise<SignedServiceUrl> /*throws*/ {", "create_signed_service_url", "FfiConverterTypeCreateSignedServiceUrlRequest.lower", "FfiConverterTypeSignedServiceUrl.lift.bind"], [" async listSignedServiceUrls(", "): Promise<Array<SignedServiceUrl>> /*throws*/ {", "list_signed_service_urls", "FfiConverterTypeSandbox.lower", "FfiConverterSequenceTypeSignedServiceUrl.lift.bind"], [" async revokeSignedServiceUrl(", "): Promise<void> /*throws*/ {", "revoke_signed_service_url", "FfiConverterTypeSignedServiceUrl.lower", "ffi_cyclops_sdk_rust_future_poll_void"]];
+ methods.forEach(([start, opening, ffi, lowering, lifting]) => all(braceMember(client, start, opening, `browser ${start}`), [`ubrn_uniffi_cyclops_sdk_fn_method_cyclopsclient_${ffi}`, lowering, lifting, "FfiConverterTypeSdkError.lift.bind"], `browser concrete ${start}`));
+ const builder = braceBlock(source, "export class CreateSignedServiceUrlRequestBuilder", "browser signed URL builder");
+ [["sandbox", "sandbox"], ["service", "service"], ["expiresInSeconds", "expires_in_seconds"], ["label", "label"]].forEach(([name, ffi]) => text(braceMember(builder, ` ${name}(`, "): CreateSignedServiceUrlRequestBuilderLike {", `browser builder ${name}`), `createsignedserviceurlrequestbuilder_${ffi}`, `browser builder ${name}`));
+ all(braceMember(builder, " build()", "build(): CreateSignedServiceUrlRequest /*throws*/ {", "browser builder build"), ["createsignedserviceurlrequestbuilder_build", "FfiConverterTypeSdkBuildError.lift.bind"], "browser builder build");
+ const error = braceBlock(source, "const FfiConverterTypeSdkError", "browser SdkError converter");
+ regex(error, /case 7:\s+return new SdkError\.SignedServiceUrlsUnavailable\(\)/m, "browser SignedServiceUrlsUnavailable decoder ordinal");
+ regex(error, /case SdkError_Tags\.SignedServiceUrlsUnavailable: \{\s+ordinalConverter\.write\(7, into\)/m, "browser SignedServiceUrlsUnavailable encoder ordinal");
+ noLegacy(source, "browser");
+}
+
+function expectRejected(label, assertion, source) {
+ try { assertion(source); } catch (_error) { console.log(`signed service URL structural mutation fixture rejected ${label}`); return; }
+ fail(`mutation fixture unexpectedly passed: ${label}`);
+}
+function replaceOnce(source, from, to, label) { const result = source.replace(from, to); if (result === source) fail(`mutation fixture could not apply: ${label}`); return result; }
+function within(source, start, endMarker, from, to, label) { const offset = after(source, start, label); const end = source.indexOf(endMarker, offset + start.length); if (end < 0) fail(`mutation fixture boundary is missing: ${label}`); return source.slice(0, offset) + replaceOnce(source.slice(offset, end), from, to, label) + source.slice(end); }
+function withinAfter(source, parent, start, endMarker, from, to, label) {
+ const parentOffset = after(source, parent, label);
+ const offset = after(source.slice(parentOffset), start, label) + parentOffset;
+ const end = source.indexOf(endMarker, offset + start.length);
+ if (end < 0) fail(`mutation fixture boundary is missing: ${label}`);
+ return source.slice(0, offset) + replaceOnce(source.slice(offset, end), from, to, label) + source.slice(end);
+}
+
+assertPython(sources.python); assertKotlin(sources.kotlin); assertSwift(sources.swift); assertRuby(sources.ruby); assertBrowser(sources.browser);
+expectRejected("Python class SignedServiceUrl: pass", assertPython, replaceOnce(sources.python, /class SignedServiceUrl:[\s\S]*?\nclass _UniffiFfiConverterTypeSignedServiceUrl/m, "class SignedServiceUrl:\n pass\n\nclass _UniffiFfiConverterTypeSignedServiceUrl", "Python record pass"));
+expectRejected("renamed Python SignedServiceUrl converter", assertPython, replaceOnce(sources.python, "class _UniffiFfiConverterTypeSignedServiceUrl(", "class _UniffiFfiConverterTypeRenamedSignedServiceUrl(", "Python converter rename"));
+expectRejected("Python CreatePoolRequest lowering", assertPython, withinAfter(sources.python, "class CyclopsClient(CyclopsClientProtocol):", " async def create_signed_service_url", "\n async def ", "_UniffiFfiConverterTypeCreateSignedServiceUrlRequest.lower", "_UniffiFfiConverterTypeCreatePoolRequest.lower", "Python create lowering"));
+expectRejected("Swift FFI moved to EOF", assertSwift, `${within(sources.swift, "open func createSignedServiceUrl", "\nopen func ", "uniffi_cyclops_sdk_fn_method_cyclopsclient_create_signed_service_url", "uniffi_cyclops_sdk_fn_method_cyclopsclient_create_wrong", "Swift create FFI")}\n// uniffi_cyclops_sdk_fn_method_cyclopsclient_create_signed_service_url`);
+expectRejected("browser service setter FFI", assertBrowser, within(sources.browser, " service(value: string)", "\n uniffiDestroy", "createsignedserviceurlrequestbuilder_service", "createsignedserviceurlrequestbuilder_label", "browser setter FFI"));
+expectRejected("Python concrete SdkError", assertPython, withinAfter(sources.python, "class CyclopsClient(CyclopsClientProtocol):", " async def create_signed_service_url", "\n async def ", "_UniffiFfiConverterTypeSdkError", "_UniffiFfiConverterTypeSdkBuildError", "Python create error"));
+expectRejected("Python swapped SignedServiceUrlsUnavailable ordinal", assertPython, replaceOnce(sources.python, "if variant == 7:\n return SdkError.SignedServiceUrlsUnavailable(", "if variant == 8:\n return SdkError.SignedServiceUrlsUnavailable(", "Python ordinal"));
+expectRejected("Ruby swapped SignedServiceUrlsUnavailable ordinal", assertRuby, replaceOnce(sources.ruby, "if variant == 7\n return SdkError::SignedServiceUrlsUnavailable.new", "if variant == 8\n return SdkError::SignedServiceUrlsUnavailable.new", "Ruby ordinal"));
+expectRejected("browser swapped SignedServiceUrlsUnavailable ordinal", assertBrowser, replaceOnce(sources.browser, "case 7:\n return new SdkError.SignedServiceUrlsUnavailable();", "case 8:\n return new SdkError.SignedServiceUrlsUnavailable();", "browser ordinal"));
+
+NODE
for typescript_binding in "$node_schema_source" "$browser_schema_source"; do
grep -Fq -- "ttlSecondsAfterCreated?: number" "$typescript_binding" || fail "TypeScript bindings omit ttlSecondsAfterCreated: $typescript_binding"
diff --git a/libs/fleet/sdk-bindings/go-uniffi/fleet_sdk/fleet_sdk.go b/libs/fleet/sdk-bindings/go-uniffi/fleet_sdk/fleet_sdk.go
index 8ff268d293..b6bf906928 100644
--- a/libs/fleet/sdk-bindings/go-uniffi/fleet_sdk/fleet_sdk.go
+++ b/libs/fleet/sdk-bindings/go-uniffi/fleet_sdk/fleet_sdk.go
@@ -376,6 +376,51 @@ func uniffiCheckChecksums() {
// If this happens try cleaning and rebuilding your project
panic("fleet_sdk: UniFFI contract version mismatch")
}
+ {
+ checksum := rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint16_t {
+ return C.uniffi_cyclops_sdk_checksum_func_healthy_pool_display_status()
+ })
+ if checksum != 3094 {
+ // If this happens try cleaning and rebuilding your project
+ panic("fleet_sdk: uniffi_cyclops_sdk_checksum_func_healthy_pool_display_status: UniFFI API checksum mismatch")
+ }
+ }
+ {
+ checksum := rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint16_t {
+ return C.uniffi_cyclops_sdk_checksum_func_pool_display_status()
+ })
+ if checksum != 8587 {
+ // If this happens try cleaning and rebuilding your project
+ panic("fleet_sdk: uniffi_cyclops_sdk_checksum_func_pool_display_status: UniFFI API checksum mismatch")
+ }
+ }
+ {
+ checksum := rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint16_t {
+ return C.uniffi_cyclops_sdk_checksum_func_removed_pool_display_status()
+ })
+ if checksum != 48761 {
+ // If this happens try cleaning and rebuilding your project
+ panic("fleet_sdk: uniffi_cyclops_sdk_checksum_func_removed_pool_display_status: UniFFI API checksum mismatch")
+ }
+ }
+ {
+ checksum := rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint16_t {
+ return C.uniffi_cyclops_sdk_checksum_func_terminating_pool_display_status()
+ })
+ if checksum != 41320 {
+ // If this happens try cleaning and rebuilding your project
+ panic("fleet_sdk: uniffi_cyclops_sdk_checksum_func_terminating_pool_display_status: UniFFI API checksum mismatch")
+ }
+ }
+ {
+ checksum := rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint16_t {
+ return C.uniffi_cyclops_sdk_checksum_func_unknown_pool_display_status()
+ })
+ if checksum != 39929 {
+ // If this happens try cleaning and rebuilding your project
+ panic("fleet_sdk: uniffi_cyclops_sdk_checksum_func_unknown_pool_display_status: UniFFI API checksum mismatch")
+ }
+ }
{
checksum := rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint16_t {
return C.uniffi_cyclops_sdk_checksum_method_cyclopsclient_create_claim()
@@ -430,6 +475,33 @@ func uniffiCheckChecksums() {
panic("fleet_sdk: uniffi_cyclops_sdk_checksum_method_cyclopsclient_wait_claim: UniFFI API checksum mismatch")
}
}
+ {
+ checksum := rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint16_t {
+ return C.uniffi_cyclops_sdk_checksum_method_cyclopsclient_create_namespace()
+ })
+ if checksum != 38049 {
+ // If this happens try cleaning and rebuilding your project
+ panic("fleet_sdk: uniffi_cyclops_sdk_checksum_method_cyclopsclient_create_namespace: UniFFI API checksum mismatch")
+ }
+ }
+ {
+ checksum := rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint16_t {
+ return C.uniffi_cyclops_sdk_checksum_method_cyclopsclient_delete_namespace()
+ })
+ if checksum != 4545 {
+ // If this happens try cleaning and rebuilding your project
+ panic("fleet_sdk: uniffi_cyclops_sdk_checksum_method_cyclopsclient_delete_namespace: UniFFI API checksum mismatch")
+ }
+ }
+ {
+ checksum := rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint16_t {
+ return C.uniffi_cyclops_sdk_checksum_method_cyclopsclient_get_namespace()
+ })
+ if checksum != 184 {
+ // If this happens try cleaning and rebuilding your project
+ panic("fleet_sdk: uniffi_cyclops_sdk_checksum_method_cyclopsclient_get_namespace: UniFFI API checksum mismatch")
+ }
+ }
{
checksum := rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint16_t {
return C.uniffi_cyclops_sdk_checksum_method_cyclopsclient_list_namespaces()
@@ -502,6 +574,33 @@ func uniffiCheckChecksums() {
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_signed_service_url()
+ })
+ if checksum != 17810 {
+ // If this happens try cleaning and rebuilding your project
+ panic("fleet_sdk: uniffi_cyclops_sdk_checksum_method_cyclopsclient_create_signed_service_url: UniFFI API checksum mismatch")
+ }
+ }
+ {
+ checksum := rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint16_t {
+ return C.uniffi_cyclops_sdk_checksum_method_cyclopsclient_list_signed_service_urls()
+ })
+ if checksum != 31479 {
+ // If this happens try cleaning and rebuilding your project
+ panic("fleet_sdk: uniffi_cyclops_sdk_checksum_method_cyclopsclient_list_signed_service_urls: UniFFI API checksum mismatch")
+ }
+ }
+ {
+ checksum := rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint16_t {
+ return C.uniffi_cyclops_sdk_checksum_method_cyclopsclient_revoke_signed_service_url()
+ })
+ if checksum != 59989 {
+ // If this happens try cleaning and rebuilding your project
+ panic("fleet_sdk: uniffi_cyclops_sdk_checksum_method_cyclopsclient_revoke_signed_service_url: UniFFI API checksum mismatch")
+ }
+ }
{
checksum := rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint16_t {
return C.uniffi_cyclops_sdk_checksum_method_cyclopsclient_create_template()
@@ -601,6 +700,7 @@ func uniffiCheckChecksums() {
panic("fleet_sdk: uniffi_cyclops_sdk_checksum_method_httpclient_execute: UniFFI API checksum mismatch")
}
}
+
{
checksum := rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint16_t {
return C.uniffi_cyclops_sdk_checksum_constructor_cyclopsclient_connect()
@@ -664,6 +764,7 @@ func uniffiCheckChecksums() {
panic("fleet_sdk: uniffi_cyclops_sdk_checksum_constructor_cyclopsclient_connect_with_native_http_client: UniFFI API checksum mismatch")
}
}
+
{
checksum := rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint16_t {
return C.uniffi_cyclops_sdk_checksum_constructor_cyclopscredentials_new()
@@ -673,6 +774,7 @@ func uniffiCheckChecksums() {
panic("fleet_sdk: uniffi_cyclops_sdk_checksum_constructor_cyclopscredentials_new: UniFFI API checksum mismatch")
}
}
+
}
type FfiConverterUint16 struct{}
@@ -1209,6 +1311,9 @@ type CyclopsClientInterface interface {
// can be mutated through the SDK.
RenewClaim(claim Claim, shutdownTime string) (Claim, error)
WaitClaim(claim Claim) (Sandbox, error)
+ CreateNamespace(name string) (Namespace, error)
+ DeleteNamespace(name string) error
+ GetNamespace(name string) (Namespace, error)
ListNamespaces() ([]Namespace, error)
CreatePool(request CreatePoolRequest) (Pool, error)
DeletePool(pool Pool) error
@@ -1217,6 +1322,9 @@ type CyclopsClientInterface interface {
ReconcilePool(request CreatePoolRequest) (Pool, error)
UpdatePool(pool Pool) (Pool, error)
ServiceRequest(sandbox Sandbox, service string, path string, request HttpRequest) (HttpResponse, error)
+ CreateSignedServiceUrl(request CreateSignedServiceUrlRequest) (SignedServiceUrl, error)
+ ListSignedServiceUrls(sandbox Sandbox) ([]SignedServiceUrl, error)
+ RevokeSignedServiceUrl(signedServiceUrl SignedServiceUrl) error
CreateTemplate(request CreateTemplateRequest) (Template, error)
DeleteTemplate(template Template) error
GetTemplate(namespace string, name string) (Template, error)
@@ -1527,6 +1635,107 @@ func (_self *CyclopsClient) WaitClaim(claim Claim) (Sandbox, error) {
return res, err
}
+func (_self *CyclopsClient) CreateNamespace(name string) (Namespace, 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) Namespace {
+ return FfiConverterNamespaceINSTANCE.Lift(ffi)
+ },
+ C.uniffi_cyclops_sdk_fn_method_cyclopsclient_create_namespace(
+ _pointer, 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) DeleteNamespace(name string) 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_namespace(
+ _pointer, FfiConverterStringINSTANCE.Lower(name)),
+ // 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) GetNamespace(name string) (Namespace, 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) Namespace {
+ return FfiConverterNamespaceINSTANCE.Lift(ffi)
+ },
+ C.uniffi_cyclops_sdk_fn_method_cyclopsclient_get_namespace(
+ _pointer, 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) ListNamespaces() ([]Namespace, error) {
_pointer := _self.ffiObject.incrementPointer("*CyclopsClient")
defer _self.ffiObject.decrementPointer()
@@ -1803,6 +2012,107 @@ func (_self *CyclopsClient) ServiceRequest(sandbox Sandbox, service string, path
return res, err
}
+func (_self *CyclopsClient) CreateSignedServiceUrl(request CreateSignedServiceUrlRequest) (SignedServiceUrl, 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) SignedServiceUrl {
+ return FfiConverterSignedServiceUrlINSTANCE.Lift(ffi)
+ },
+ C.uniffi_cyclops_sdk_fn_method_cyclopsclient_create_signed_service_url(
+ _pointer, FfiConverterCreateSignedServiceUrlRequestINSTANCE.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) ListSignedServiceUrls(sandbox Sandbox) ([]SignedServiceUrl, 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) []SignedServiceUrl {
+ return FfiConverterSequenceSignedServiceUrlINSTANCE.Lift(ffi)
+ },
+ C.uniffi_cyclops_sdk_fn_method_cyclopsclient_list_signed_service_urls(
+ _pointer, FfiConverterSandboxINSTANCE.Lower(sandbox)),
+ // 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) RevokeSignedServiceUrl(signedServiceUrl SignedServiceUrl) 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_revoke_signed_service_url(
+ _pointer, FfiConverterSignedServiceUrlINSTANCE.Lower(signedServiceUrl)),
+ // 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) CreateTemplate(request CreateTemplateRequest) (Template, error) {
_pointer := _self.ffiObject.incrementPointer("*CyclopsClient")
defer _self.ffiObject.decrementPointer()
@@ -2588,16 +2898,68 @@ func (_ FfiDestroyerCreatePoolRequest) Destroy(value CreatePoolRequest) {
value.Destroy()
}
-type CreateTemplateRequest struct {
- Namespace string
- Name string
- Spec cyclops_sdk_schema.OsGymSandboxTemplateSpec
+type CreateSignedServiceUrlRequest struct {
+ Sandbox Sandbox
+ Service string
+ Label *string
+ ExpiresInSeconds uint32
}
-func (r *CreateTemplateRequest) Destroy() {
- FfiDestroyerString{}.Destroy(r.Namespace)
- FfiDestroyerString{}.Destroy(r.Name)
- cyclops_sdk_schema.FfiDestroyerOsGymSandboxTemplateSpec{}.Destroy(r.Spec)
+func (r *CreateSignedServiceUrlRequest) Destroy() {
+ FfiDestroyerSandbox{}.Destroy(r.Sandbox)
+ FfiDestroyerString{}.Destroy(r.Service)
+ FfiDestroyerOptionalString{}.Destroy(r.Label)
+ FfiDestroyerUint32{}.Destroy(r.ExpiresInSeconds)
+}
+
+type FfiConverterCreateSignedServiceUrlRequest struct{}
+
+var FfiConverterCreateSignedServiceUrlRequestINSTANCE = FfiConverterCreateSignedServiceUrlRequest{}
+
+func (c FfiConverterCreateSignedServiceUrlRequest) Lift(rb RustBufferI) CreateSignedServiceUrlRequest {
+ return LiftFromRustBuffer[CreateSignedServiceUrlRequest](c, rb)
+}
+
+func (c FfiConverterCreateSignedServiceUrlRequest) Read(reader io.Reader) CreateSignedServiceUrlRequest {
+ return CreateSignedServiceUrlRequest{
+ FfiConverterSandboxINSTANCE.Read(reader),
+ FfiConverterStringINSTANCE.Read(reader),
+ FfiConverterOptionalStringINSTANCE.Read(reader),
+ FfiConverterUint32INSTANCE.Read(reader),
+ }
+}
+
+func (c FfiConverterCreateSignedServiceUrlRequest) Lower(value CreateSignedServiceUrlRequest) C.RustBuffer {
+ return LowerIntoRustBuffer[CreateSignedServiceUrlRequest](c, value)
+}
+
+func (c FfiConverterCreateSignedServiceUrlRequest) LowerExternal(value CreateSignedServiceUrlRequest) ExternalCRustBuffer {
+ return RustBufferFromC(LowerIntoRustBuffer[CreateSignedServiceUrlRequest](c, value))
+}
+
+func (c FfiConverterCreateSignedServiceUrlRequest) Write(writer io.Writer, value CreateSignedServiceUrlRequest) {
+ FfiConverterSandboxINSTANCE.Write(writer, value.Sandbox)
+ FfiConverterStringINSTANCE.Write(writer, value.Service)
+ FfiConverterOptionalStringINSTANCE.Write(writer, value.Label)
+ FfiConverterUint32INSTANCE.Write(writer, value.ExpiresInSeconds)
+}
+
+type FfiDestroyerCreateSignedServiceUrlRequest struct{}
+
+func (_ FfiDestroyerCreateSignedServiceUrlRequest) Destroy(value CreateSignedServiceUrlRequest) {
+ 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{}
@@ -2845,10 +3207,13 @@ func (_ FfiDestroyerHttpHeader) Destroy(value HttpHeader) {
}
type HttpRequest struct {
- Method string
- Url string
- Headers []HttpHeader
- Body *[]byte
+ Method string
+ Url string
+ Headers []HttpHeader
+ Body *[]byte
+ // Per-request timeout. Defaults to absent so callers written against the
+ // pre-timeout record shape keep constructing requests unchanged; absent
+ // falls back to the native client's 30-second default.
TimeoutSecs *uint64
}
@@ -3119,6 +3484,54 @@ func (_ FfiDestroyerPool) Destroy(value Pool) {
value.Destroy()
}
+type PoolDisplayStatus struct {
+ Kind PoolDisplayStatusKind
+ Label string
+ Indicator string
+}
+
+func (r *PoolDisplayStatus) Destroy() {
+ FfiDestroyerPoolDisplayStatusKind{}.Destroy(r.Kind)
+ FfiDestroyerString{}.Destroy(r.Label)
+ FfiDestroyerString{}.Destroy(r.Indicator)
+}
+
+type FfiConverterPoolDisplayStatus struct{}
+
+var FfiConverterPoolDisplayStatusINSTANCE = FfiConverterPoolDisplayStatus{}
+
+func (c FfiConverterPoolDisplayStatus) Lift(rb RustBufferI) PoolDisplayStatus {
+ return LiftFromRustBuffer[PoolDisplayStatus](c, rb)
+}
+
+func (c FfiConverterPoolDisplayStatus) Read(reader io.Reader) PoolDisplayStatus {
+ return PoolDisplayStatus{
+ FfiConverterPoolDisplayStatusKindINSTANCE.Read(reader),
+ FfiConverterStringINSTANCE.Read(reader),
+ FfiConverterStringINSTANCE.Read(reader),
+ }
+}
+
+func (c FfiConverterPoolDisplayStatus) Lower(value PoolDisplayStatus) C.RustBuffer {
+ return LowerIntoRustBuffer[PoolDisplayStatus](c, value)
+}
+
+func (c FfiConverterPoolDisplayStatus) LowerExternal(value PoolDisplayStatus) ExternalCRustBuffer {
+ return RustBufferFromC(LowerIntoRustBuffer[PoolDisplayStatus](c, value))
+}
+
+func (c FfiConverterPoolDisplayStatus) Write(writer io.Writer, value PoolDisplayStatus) {
+ FfiConverterPoolDisplayStatusKindINSTANCE.Write(writer, value.Kind)
+ FfiConverterStringINSTANCE.Write(writer, value.Label)
+ FfiConverterStringINSTANCE.Write(writer, value.Indicator)
+}
+
+type FfiDestroyerPoolDisplayStatus struct{}
+
+func (_ FfiDestroyerPoolDisplayStatus) Destroy(value PoolDisplayStatus) {
+ value.Destroy()
+}
+
type ResourceMetadata struct {
Namespace string
Name string
@@ -3223,6 +3636,82 @@ func (_ FfiDestroyerSandbox) Destroy(value Sandbox) {
value.Destroy()
}
+type SignedServiceUrl struct {
+ Id string
+ Namespace string
+ Claim string
+ Sandbox string
+ Service string
+ Label *string
+ Url string
+ CreatedAt string
+ ExpiresAt string
+ RevokedAt *string
+}
+
+func (r *SignedServiceUrl) Destroy() {
+ FfiDestroyerString{}.Destroy(r.Id)
+ FfiDestroyerString{}.Destroy(r.Namespace)
+ FfiDestroyerString{}.Destroy(r.Claim)
+ FfiDestroyerString{}.Destroy(r.Sandbox)
+ FfiDestroyerString{}.Destroy(r.Service)
+ FfiDestroyerOptionalString{}.Destroy(r.Label)
+ FfiDestroyerString{}.Destroy(r.Url)
+ FfiDestroyerString{}.Destroy(r.CreatedAt)
+ FfiDestroyerString{}.Destroy(r.ExpiresAt)
+ FfiDestroyerOptionalString{}.Destroy(r.RevokedAt)
+}
+
+type FfiConverterSignedServiceUrl struct{}
+
+var FfiConverterSignedServiceUrlINSTANCE = FfiConverterSignedServiceUrl{}
+
+func (c FfiConverterSignedServiceUrl) Lift(rb RustBufferI) SignedServiceUrl {
+ return LiftFromRustBuffer[SignedServiceUrl](c, rb)
+}
+
+func (c FfiConverterSignedServiceUrl) Read(reader io.Reader) SignedServiceUrl {
+ return SignedServiceUrl{
+ FfiConverterStringINSTANCE.Read(reader),
+ FfiConverterStringINSTANCE.Read(reader),
+ FfiConverterStringINSTANCE.Read(reader),
+ FfiConverterStringINSTANCE.Read(reader),
+ FfiConverterStringINSTANCE.Read(reader),
+ FfiConverterOptionalStringINSTANCE.Read(reader),
+ FfiConverterStringINSTANCE.Read(reader),
+ FfiConverterStringINSTANCE.Read(reader),
+ FfiConverterStringINSTANCE.Read(reader),
+ FfiConverterOptionalStringINSTANCE.Read(reader),
+ }
+}
+
+func (c FfiConverterSignedServiceUrl) Lower(value SignedServiceUrl) C.RustBuffer {
+ return LowerIntoRustBuffer[SignedServiceUrl](c, value)
+}
+
+func (c FfiConverterSignedServiceUrl) LowerExternal(value SignedServiceUrl) ExternalCRustBuffer {
+ return RustBufferFromC(LowerIntoRustBuffer[SignedServiceUrl](c, value))
+}
+
+func (c FfiConverterSignedServiceUrl) Write(writer io.Writer, value SignedServiceUrl) {
+ FfiConverterStringINSTANCE.Write(writer, value.Id)
+ FfiConverterStringINSTANCE.Write(writer, value.Namespace)
+ FfiConverterStringINSTANCE.Write(writer, value.Claim)
+ FfiConverterStringINSTANCE.Write(writer, value.Sandbox)
+ FfiConverterStringINSTANCE.Write(writer, value.Service)
+ FfiConverterOptionalStringINSTANCE.Write(writer, value.Label)
+ FfiConverterStringINSTANCE.Write(writer, value.Url)
+ FfiConverterStringINSTANCE.Write(writer, value.CreatedAt)
+ FfiConverterStringINSTANCE.Write(writer, value.ExpiresAt)
+ FfiConverterOptionalStringINSTANCE.Write(writer, value.RevokedAt)
+}
+
+type FfiDestroyerSignedServiceUrl struct{}
+
+func (_ FfiDestroyerSignedServiceUrl) Destroy(value SignedServiceUrl) {
+ 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 {
@@ -3541,6 +4030,160 @@ func (_ FfiDestroyerHttpError) Destroy(value *HttpError) {
}
}
+type PoolDisplayStatusKind uint
+
+const (
+ PoolDisplayStatusKindHealthy PoolDisplayStatusKind = 1
+ PoolDisplayStatusKindScaledToZero PoolDisplayStatusKind = 2
+ PoolDisplayStatusKindRemoved PoolDisplayStatusKind = 3
+ PoolDisplayStatusKindTerminating PoolDisplayStatusKind = 4
+ PoolDisplayStatusKindUnknown PoolDisplayStatusKind = 5
+)
+
+type FfiConverterPoolDisplayStatusKind struct{}
+
+var FfiConverterPoolDisplayStatusKindINSTANCE = FfiConverterPoolDisplayStatusKind{}
+
+func (c FfiConverterPoolDisplayStatusKind) Lift(rb RustBufferI) PoolDisplayStatusKind {
+ return LiftFromRustBuffer[PoolDisplayStatusKind](c, rb)
+}
+
+func (c FfiConverterPoolDisplayStatusKind) Lower(value PoolDisplayStatusKind) C.RustBuffer {
+ return LowerIntoRustBuffer[PoolDisplayStatusKind](c, value)
+}
+
+func (c FfiConverterPoolDisplayStatusKind) LowerExternal(value PoolDisplayStatusKind) ExternalCRustBuffer {
+ return RustBufferFromC(LowerIntoRustBuffer[PoolDisplayStatusKind](c, value))
+}
+func (FfiConverterPoolDisplayStatusKind) Read(reader io.Reader) PoolDisplayStatusKind {
+ id := readInt32(reader)
+ return PoolDisplayStatusKind(id)
+}
+
+func (FfiConverterPoolDisplayStatusKind) Write(writer io.Writer, value PoolDisplayStatusKind) {
+ writeInt32(writer, int32(value))
+}
+
+type FfiDestroyerPoolDisplayStatusKind struct{}
+
+func (_ FfiDestroyerPoolDisplayStatusKind) Destroy(value PoolDisplayStatusKind) {
+}
+
+type SdkBuildError struct {
+ err error
+}
+
+// Convenience method to turn *SdkBuildError into error
+// Avoiding treating nil pointer as non nil error interface
+func (err *SdkBuildError) AsError() error {
+ if err == nil {
+ return nil
+ } else {
+ return err
+ }
+}
+
+func (err SdkBuildError) Error() string {
+ return fmt.Sprintf("SdkBuildError: %s", err.err.Error())
+}
+
+func (err SdkBuildError) Unwrap() error {
+ return err.err
+}
+
+// Err* are used for checking error type with `errors.Is`
+var ErrSdkBuildErrorMissingRequiredField = fmt.Errorf("SdkBuildErrorMissingRequiredField")
+
+// Variant structs
+type SdkBuildErrorMissingRequiredField struct {
+ RecordType string
+ Field string
+}
+
+func NewSdkBuildErrorMissingRequiredField(
+ recordType string,
+ field string,
+) *SdkBuildError {
+ return &SdkBuildError{err: &SdkBuildErrorMissingRequiredField{
+ RecordType: recordType,
+ Field: field}}
+}
+
+func (e SdkBuildErrorMissingRequiredField) destroy() {
+ FfiDestroyerString{}.Destroy(e.RecordType)
+ FfiDestroyerString{}.Destroy(e.Field)
+}
+
+func (err SdkBuildErrorMissingRequiredField) Error() string {
+ return fmt.Sprint("MissingRequiredField",
+ ": ",
+
+ "RecordType=",
+ err.RecordType,
+ ", ",
+ "Field=",
+ err.Field,
+ )
+}
+
+func (self SdkBuildErrorMissingRequiredField) Is(target error) bool {
+ return target == ErrSdkBuildErrorMissingRequiredField
+}
+
+type FfiConverterSdkBuildError struct{}
+
+var FfiConverterSdkBuildErrorINSTANCE = FfiConverterSdkBuildError{}
+
+func (c FfiConverterSdkBuildError) Lift(eb RustBufferI) *SdkBuildError {
+ return LiftFromRustBuffer[*SdkBuildError](c, eb)
+}
+
+func (c FfiConverterSdkBuildError) Lower(value *SdkBuildError) C.RustBuffer {
+ return LowerIntoRustBuffer[*SdkBuildError](c, value)
+}
+
+func (c FfiConverterSdkBuildError) LowerExternal(value *SdkBuildError) ExternalCRustBuffer {
+ return RustBufferFromC(LowerIntoRustBuffer[*SdkBuildError](c, value))
+}
+
+func (c FfiConverterSdkBuildError) Read(reader io.Reader) *SdkBuildError {
+ errorID := readUint32(reader)
+
+ switch errorID {
+ case 1:
+ return &SdkBuildError{&SdkBuildErrorMissingRequiredField{
+ RecordType: FfiConverterStringINSTANCE.Read(reader),
+ Field: FfiConverterStringINSTANCE.Read(reader),
+ }}
+ default:
+ panic(fmt.Sprintf("Unknown error code %d in FfiConverterSdkBuildError.Read()", errorID))
+ }
+}
+
+func (c FfiConverterSdkBuildError) Write(writer io.Writer, value *SdkBuildError) {
+ switch variantValue := value.err.(type) {
+ case *SdkBuildErrorMissingRequiredField:
+ writeInt32(writer, 1)
+ FfiConverterStringINSTANCE.Write(writer, variantValue.RecordType)
+ FfiConverterStringINSTANCE.Write(writer, variantValue.Field)
+ default:
+ _ = variantValue
+ panic(fmt.Sprintf("invalid error value `%v` in FfiConverterSdkBuildError.Write", value))
+ }
+}
+
+type FfiDestroyerSdkBuildError struct{}
+
+func (_ FfiDestroyerSdkBuildError) Destroy(value *SdkBuildError) {
+ switch variantValue := value.err.(type) {
+ case SdkBuildErrorMissingRequiredField:
+ variantValue.destroy()
+ default:
+ _ = variantValue
+ panic(fmt.Sprintf("invalid error value `%v` in FfiDestroyerSdkBuildError.Destroy", value))
+ }
+}
+
type SdkError struct {
err error
}
@@ -3570,10 +4213,12 @@ var ErrSdkErrorTransport = fmt.Errorf("SdkErrorTransport")
var ErrSdkErrorToken = fmt.Errorf("SdkErrorToken")
var ErrSdkErrorBody = fmt.Errorf("SdkErrorBody")
var ErrSdkErrorStatus = fmt.Errorf("SdkErrorStatus")
+var ErrSdkErrorSignedServiceUrlsUnavailable = fmt.Errorf("SdkErrorSignedServiceUrlsUnavailable")
var ErrSdkErrorUnknownService = fmt.Errorf("SdkErrorUnknownService")
var ErrSdkErrorInvalidServicePath = fmt.Errorf("SdkErrorInvalidServicePath")
var ErrSdkErrorClaimFailed = fmt.Errorf("SdkErrorClaimFailed")
var ErrSdkErrorClaimTimeout = fmt.Errorf("SdkErrorClaimTimeout")
+var ErrSdkErrorPoolAccessDenied = fmt.Errorf("SdkErrorPoolAccessDenied")
// Variant structs
type SdkErrorConfiguration struct {
@@ -3772,6 +4417,24 @@ func (self SdkErrorStatus) Is(target error) bool {
return target == ErrSdkErrorStatus
}
+type SdkErrorSignedServiceUrlsUnavailable struct {
+}
+
+func NewSdkErrorSignedServiceUrlsUnavailable() *SdkError {
+ return &SdkError{err: &SdkErrorSignedServiceUrlsUnavailable{}}
+}
+
+func (e SdkErrorSignedServiceUrlsUnavailable) destroy() {
+}
+
+func (err SdkErrorSignedServiceUrlsUnavailable) Error() string {
+ return fmt.Sprint("SignedServiceUrlsUnavailable")
+}
+
+func (self SdkErrorSignedServiceUrlsUnavailable) Is(target error) bool {
+ return target == ErrSdkErrorSignedServiceUrlsUnavailable
+}
+
type SdkErrorUnknownService struct {
Requested string
Available []string
@@ -3888,6 +4551,55 @@ func (self SdkErrorClaimTimeout) Is(target error) bool {
return target == ErrSdkErrorClaimTimeout
}
+type SdkErrorPoolAccessDenied struct {
+ Operation string
+ Namespace string
+ Status uint16
+ Body string
+}
+
+func NewSdkErrorPoolAccessDenied(
+ operation string,
+ namespace string,
+ status uint16,
+ body string,
+) *SdkError {
+ return &SdkError{err: &SdkErrorPoolAccessDenied{
+ Operation: operation,
+ Namespace: namespace,
+ Status: status,
+ Body: body}}
+}
+
+func (e SdkErrorPoolAccessDenied) destroy() {
+ FfiDestroyerString{}.Destroy(e.Operation)
+ FfiDestroyerString{}.Destroy(e.Namespace)
+ FfiDestroyerUint16{}.Destroy(e.Status)
+ FfiDestroyerString{}.Destroy(e.Body)
+}
+
+func (err SdkErrorPoolAccessDenied) Error() string {
+ return fmt.Sprint("PoolAccessDenied",
+ ": ",
+
+ "Operation=",
+ err.Operation,
+ ", ",
+ "Namespace=",
+ err.Namespace,
+ ", ",
+ "Status=",
+ err.Status,
+ ", ",
+ "Body=",
+ err.Body,
+ )
+}
+
+func (self SdkErrorPoolAccessDenied) Is(target error) bool {
+ return target == ErrSdkErrorPoolAccessDenied
+}
+
type FfiConverterSdkError struct{}
var FfiConverterSdkErrorINSTANCE = FfiConverterSdkError{}
@@ -3937,21 +4649,30 @@ func (c FfiConverterSdkError) Read(reader io.Reader) *SdkError {
Body: FfiConverterStringINSTANCE.Read(reader),
}}
case 7:
+ return &SdkError{&SdkErrorSignedServiceUrlsUnavailable{}}
+ case 8:
return &SdkError{&SdkErrorUnknownService{
Requested: FfiConverterStringINSTANCE.Read(reader),
Available: FfiConverterSequenceStringINSTANCE.Read(reader),
}}
- case 8:
+ case 9:
return &SdkError{&SdkErrorInvalidServicePath{
Path: FfiConverterStringINSTANCE.Read(reader),
}}
- case 9:
+ case 10:
return &SdkError{&SdkErrorClaimFailed{
Phase: FfiConverterStringINSTANCE.Read(reader),
Status: FfiConverterStringINSTANCE.Read(reader),
}}
- case 10:
+ case 11:
return &SdkError{&SdkErrorClaimTimeout{}}
+ case 12:
+ return &SdkError{&SdkErrorPoolAccessDenied{
+ Operation: FfiConverterStringINSTANCE.Read(reader),
+ Namespace: FfiConverterStringINSTANCE.Read(reader),
+ Status: FfiConverterUint16INSTANCE.Read(reader),
+ Body: FfiConverterStringINSTANCE.Read(reader),
+ }}
default:
panic(fmt.Sprintf("Unknown error code %d in FfiConverterSdkError.Read()", errorID))
}
@@ -3981,19 +4702,27 @@ func (c FfiConverterSdkError) Write(writer io.Writer, value *SdkError) {
FfiConverterStringINSTANCE.Write(writer, variantValue.Operation)
FfiConverterUint16INSTANCE.Write(writer, variantValue.Status)
FfiConverterStringINSTANCE.Write(writer, variantValue.Body)
- case *SdkErrorUnknownService:
+ case *SdkErrorSignedServiceUrlsUnavailable:
writeInt32(writer, 7)
+ case *SdkErrorUnknownService:
+ writeInt32(writer, 8)
FfiConverterStringINSTANCE.Write(writer, variantValue.Requested)
FfiConverterSequenceStringINSTANCE.Write(writer, variantValue.Available)
case *SdkErrorInvalidServicePath:
- writeInt32(writer, 8)
+ writeInt32(writer, 9)
FfiConverterStringINSTANCE.Write(writer, variantValue.Path)
case *SdkErrorClaimFailed:
- writeInt32(writer, 9)
+ writeInt32(writer, 10)
FfiConverterStringINSTANCE.Write(writer, variantValue.Phase)
FfiConverterStringINSTANCE.Write(writer, variantValue.Status)
case *SdkErrorClaimTimeout:
- writeInt32(writer, 10)
+ writeInt32(writer, 11)
+ case *SdkErrorPoolAccessDenied:
+ writeInt32(writer, 12)
+ FfiConverterStringINSTANCE.Write(writer, variantValue.Operation)
+ FfiConverterStringINSTANCE.Write(writer, variantValue.Namespace)
+ FfiConverterUint16INSTANCE.Write(writer, variantValue.Status)
+ FfiConverterStringINSTANCE.Write(writer, variantValue.Body)
default:
_ = variantValue
panic(fmt.Sprintf("invalid error value `%v` in FfiConverterSdkError.Write", value))
@@ -4016,6 +4745,8 @@ func (_ FfiDestroyerSdkError) Destroy(value *SdkError) {
variantValue.destroy()
case SdkErrorStatus:
variantValue.destroy()
+ case SdkErrorSignedServiceUrlsUnavailable:
+ variantValue.destroy()
case SdkErrorUnknownService:
variantValue.destroy()
case SdkErrorInvalidServicePath:
@@ -4024,12 +4755,55 @@ func (_ FfiDestroyerSdkError) Destroy(value *SdkError) {
variantValue.destroy()
case SdkErrorClaimTimeout:
variantValue.destroy()
+ case SdkErrorPoolAccessDenied:
+ variantValue.destroy()
default:
_ = variantValue
panic(fmt.Sprintf("invalid error value `%v` in FfiDestroyerSdkError.Destroy", value))
}
}
+type FfiConverterOptionalUint64 struct{}
+
+var FfiConverterOptionalUint64INSTANCE = FfiConverterOptionalUint64{}
+
+func (c FfiConverterOptionalUint64) Lift(rb RustBufferI) *uint64 {
+ return LiftFromRustBuffer[*uint64](c, rb)
+}
+
+func (_ FfiConverterOptionalUint64) Read(reader io.Reader) *uint64 {
+ if readInt8(reader) == 0 {
+ return nil
+ }
+ temp := FfiConverterUint64INSTANCE.Read(reader)
+ return &temp
+}
+
+func (c FfiConverterOptionalUint64) Lower(value *uint64) C.RustBuffer {
+ return LowerIntoRustBuffer[*uint64](c, value)
+}
+
+func (c FfiConverterOptionalUint64) LowerExternal(value *uint64) ExternalCRustBuffer {
+ return RustBufferFromC(LowerIntoRustBuffer[*uint64](c, value))
+}
+
+func (_ FfiConverterOptionalUint64) Write(writer io.Writer, value *uint64) {
+ if value == nil {
+ writeInt8(writer, 0)
+ } else {
+ writeInt8(writer, 1)
+ FfiConverterUint64INSTANCE.Write(writer, *value)
+ }
+}
+
+type FfiDestroyerOptionalUint64 struct{}
+
+func (_ FfiDestroyerOptionalUint64) Destroy(value *uint64) {
+ if value != nil {
+ FfiDestroyerUint64{}.Destroy(*value)
+ }
+}
+
type FfiConverterOptionalString struct{}
var FfiConverterOptionalStringINSTANCE = FfiConverterOptionalString{}
@@ -4112,47 +4886,6 @@ func (_ FfiDestroyerOptionalBytes) Destroy(value *[]byte) {
}
}
-type FfiConverterOptionalUint64 struct{}
-
-var FfiConverterOptionalUint64INSTANCE = FfiConverterOptionalUint64{}
-
-func (c FfiConverterOptionalUint64) Lift(rb RustBufferI) *uint64 {
- return LiftFromRustBuffer[*uint64](c, rb)
-}
-
-func (_ FfiConverterOptionalUint64) Read(reader io.Reader) *uint64 {
- if readInt8(reader) == 0 {
- return nil
- }
- temp := FfiConverterUint64INSTANCE.Read(reader)
- return &temp
-}
-
-func (c FfiConverterOptionalUint64) Lower(value *uint64) C.RustBuffer {
- return LowerIntoRustBuffer[*uint64](c, value)
-}
-
-func (c FfiConverterOptionalUint64) LowerExternal(value *uint64) ExternalCRustBuffer {
- return RustBufferFromC(LowerIntoRustBuffer[*uint64](c, value))
-}
-
-func (_ FfiConverterOptionalUint64) Write(writer io.Writer, value *uint64) {
- if value == nil {
- writeInt8(writer, 0)
- } else {
- writeInt8(writer, 1)
- FfiConverterUint64INSTANCE.Write(writer, *value)
- }
-}
-
-type FfiDestroyerOptionalUint64 struct{}
-
-func (_ FfiDestroyerOptionalUint64) Destroy(value *uint64) {
- if value != nil {
- FfiDestroyerUint64{}.Destroy(*value)
- }
-}
-
type FfiConverterOptionalClaimSpec struct{}
var FfiConverterOptionalClaimSpecINSTANCE = FfiConverterOptionalClaimSpec{}
@@ -4552,6 +5285,53 @@ func (FfiDestroyerSequencePool) Destroy(sequence []Pool) {
}
}
+type FfiConverterSequenceSignedServiceUrl struct{}
+
+var FfiConverterSequenceSignedServiceUrlINSTANCE = FfiConverterSequenceSignedServiceUrl{}
+
+func (c FfiConverterSequenceSignedServiceUrl) Lift(rb RustBufferI) []SignedServiceUrl {
+ return LiftFromRustBuffer[[]SignedServiceUrl](c, rb)
+}
+
+func (c FfiConverterSequenceSignedServiceUrl) Read(reader io.Reader) []SignedServiceUrl {
+ length := readInt32(reader)
+ if length == 0 {
+ return nil
+ }
+ result := make([]SignedServiceUrl, 0, length)
+ for i := int32(0); i < length; i++ {
+ result = append(result, FfiConverterSignedServiceUrlINSTANCE.Read(reader))
+ }
+ return result
+}
+
+func (c FfiConverterSequenceSignedServiceUrl) Lower(value []SignedServiceUrl) C.RustBuffer {
+ return LowerIntoRustBuffer[[]SignedServiceUrl](c, value)
+}
+
+func (c FfiConverterSequenceSignedServiceUrl) LowerExternal(value []SignedServiceUrl) ExternalCRustBuffer {
+ return RustBufferFromC(LowerIntoRustBuffer[[]SignedServiceUrl](c, value))
+}
+
+func (c FfiConverterSequenceSignedServiceUrl) Write(writer io.Writer, value []SignedServiceUrl) {
+ if len(value) > math.MaxInt32 {
+ panic("[]SignedServiceUrl is too large to fit into Int32")
+ }
+
+ writeInt32(writer, int32(len(value)))
+ for _, item := range value {
+ FfiConverterSignedServiceUrlINSTANCE.Write(writer, item)
+ }
+}
+
+type FfiDestroyerSequenceSignedServiceUrl struct{}
+
+func (FfiDestroyerSequenceSignedServiceUrl) Destroy(sequence []SignedServiceUrl) {
+ for _, value := range sequence {
+ FfiDestroyerSignedServiceUrl{}.Destroy(value)
+ }
+}
+
type FfiConverterSequenceTemplate struct{}
var FfiConverterSequenceTemplateINSTANCE = FfiConverterSequenceTemplate{}
@@ -4753,3 +5533,35 @@ func fleet_sdk_uniffiFreeGorutine(data C.uint64_t) {
guard := handle.Value().(chan struct{})
guard <- struct{}{}
}
+
+func HealthyPoolDisplayStatus() PoolDisplayStatus {
+ return FfiConverterPoolDisplayStatusINSTANCE.Lift(rustCall(func(_uniffiStatus *C.RustCallStatus) RustBufferI {
+ return GoRustBuffer{
+ inner: C.uniffi_cyclops_sdk_fn_func_healthy_pool_display_status(_uniffiStatus),
+ }
+ }))
+}
+
+func RemovedPoolDisplayStatus() PoolDisplayStatus {
+ return FfiConverterPoolDisplayStatusINSTANCE.Lift(rustCall(func(_uniffiStatus *C.RustCallStatus) RustBufferI {
+ return GoRustBuffer{
+ inner: C.uniffi_cyclops_sdk_fn_func_removed_pool_display_status(_uniffiStatus),
+ }
+ }))
+}
+
+func TerminatingPoolDisplayStatus() PoolDisplayStatus {
+ return FfiConverterPoolDisplayStatusINSTANCE.Lift(rustCall(func(_uniffiStatus *C.RustCallStatus) RustBufferI {
+ return GoRustBuffer{
+ inner: C.uniffi_cyclops_sdk_fn_func_terminating_pool_display_status(_uniffiStatus),
+ }
+ }))
+}
+
+func UnknownPoolDisplayStatus() PoolDisplayStatus {
+ return FfiConverterPoolDisplayStatusINSTANCE.Lift(rustCall(func(_uniffiStatus *C.RustCallStatus) RustBufferI {
+ return GoRustBuffer{
+ inner: C.uniffi_cyclops_sdk_fn_func_unknown_pool_display_status(_uniffiStatus),
+ }
+ }))
+}
diff --git a/libs/fleet/sdk-bindings/go-uniffi/fleet_sdk/fleet_sdk.h b/libs/fleet/sdk-bindings/go-uniffi/fleet_sdk/fleet_sdk.h
index a5c7f9ff63..3d9e701201 100644
--- a/libs/fleet/sdk-bindings/go-uniffi/fleet_sdk/fleet_sdk.h
+++ b/libs/fleet/sdk-bindings/go-uniffi/fleet_sdk/fleet_sdk.h
@@ -491,6 +491,21 @@ uint64_t uniffi_cyclops_sdk_fn_method_cyclopsclient_renew_claim(uint64_t ptr, Ru
uint64_t uniffi_cyclops_sdk_fn_method_cyclopsclient_wait_claim(uint64_t ptr, RustBuffer claim
);
#endif
+#ifndef UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_FN_METHOD_CYCLOPSCLIENT_CREATE_NAMESPACE
+#define UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_FN_METHOD_CYCLOPSCLIENT_CREATE_NAMESPACE
+uint64_t uniffi_cyclops_sdk_fn_method_cyclopsclient_create_namespace(uint64_t ptr, RustBuffer name
+);
+#endif
+#ifndef UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_FN_METHOD_CYCLOPSCLIENT_DELETE_NAMESPACE
+#define UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_FN_METHOD_CYCLOPSCLIENT_DELETE_NAMESPACE
+uint64_t uniffi_cyclops_sdk_fn_method_cyclopsclient_delete_namespace(uint64_t ptr, RustBuffer name
+);
+#endif
+#ifndef UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_FN_METHOD_CYCLOPSCLIENT_GET_NAMESPACE
+#define UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_FN_METHOD_CYCLOPSCLIENT_GET_NAMESPACE
+uint64_t uniffi_cyclops_sdk_fn_method_cyclopsclient_get_namespace(uint64_t ptr, RustBuffer name
+);
+#endif
#ifndef UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_FN_METHOD_CYCLOPSCLIENT_LIST_NAMESPACES
#define UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_FN_METHOD_CYCLOPSCLIENT_LIST_NAMESPACES
uint64_t uniffi_cyclops_sdk_fn_method_cyclopsclient_list_namespaces(uint64_t ptr
@@ -531,6 +546,21 @@ 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_SIGNED_SERVICE_URL
+#define UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_FN_METHOD_CYCLOPSCLIENT_CREATE_SIGNED_SERVICE_URL
+uint64_t uniffi_cyclops_sdk_fn_method_cyclopsclient_create_signed_service_url(uint64_t ptr, RustBuffer request
+);
+#endif
+#ifndef UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_FN_METHOD_CYCLOPSCLIENT_LIST_SIGNED_SERVICE_URLS
+#define UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_FN_METHOD_CYCLOPSCLIENT_LIST_SIGNED_SERVICE_URLS
+uint64_t uniffi_cyclops_sdk_fn_method_cyclopsclient_list_signed_service_urls(uint64_t ptr, RustBuffer sandbox
+);
+#endif
+#ifndef UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_FN_METHOD_CYCLOPSCLIENT_REVOKE_SIGNED_SERVICE_URL
+#define UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_FN_METHOD_CYCLOPSCLIENT_REVOKE_SIGNED_SERVICE_URL
+uint64_t uniffi_cyclops_sdk_fn_method_cyclopsclient_revoke_signed_service_url(uint64_t ptr, RustBuffer signed_service_url
+);
+#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
@@ -629,6 +659,35 @@ void uniffi_cyclops_sdk_fn_free_cyclopscredentials(uint64_t handle, RustCallStat
#ifndef UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_FN_CONSTRUCTOR_CYCLOPSCREDENTIALS_NEW
#define UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_FN_CONSTRUCTOR_CYCLOPSCREDENTIALS_NEW
uint64_t uniffi_cyclops_sdk_fn_constructor_cyclopscredentials_new(RustBuffer client_id, RustBuffer client_secret, RustCallStatus *out_status
+);
+#endif
+#ifndef UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_FN_FUNC_HEALTHY_POOL_DISPLAY_STATUS
+#define UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_FN_FUNC_HEALTHY_POOL_DISPLAY_STATUS
+RustBuffer uniffi_cyclops_sdk_fn_func_healthy_pool_display_status(RustCallStatus *out_status
+
+);
+#endif
+#ifndef UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_FN_FUNC_POOL_DISPLAY_STATUS
+#define UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_FN_FUNC_POOL_DISPLAY_STATUS
+RustBuffer uniffi_cyclops_sdk_fn_func_pool_display_status(RustBuffer pool, RustCallStatus *out_status
+);
+#endif
+#ifndef UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_FN_FUNC_REMOVED_POOL_DISPLAY_STATUS
+#define UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_FN_FUNC_REMOVED_POOL_DISPLAY_STATUS
+RustBuffer uniffi_cyclops_sdk_fn_func_removed_pool_display_status(RustCallStatus *out_status
+
+);
+#endif
+#ifndef UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_FN_FUNC_TERMINATING_POOL_DISPLAY_STATUS
+#define UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_FN_FUNC_TERMINATING_POOL_DISPLAY_STATUS
+RustBuffer uniffi_cyclops_sdk_fn_func_terminating_pool_display_status(RustCallStatus *out_status
+
+);
+#endif
+#ifndef UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_FN_FUNC_UNKNOWN_POOL_DISPLAY_STATUS
+#define UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_FN_FUNC_UNKNOWN_POOL_DISPLAY_STATUS
+RustBuffer uniffi_cyclops_sdk_fn_func_unknown_pool_display_status(RustCallStatus *out_status
+
);
#endif
#ifndef UNIFFI_FFIDEF_FFI_CYCLOPS_SDK_RUSTBUFFER_ALLOC
@@ -889,6 +948,36 @@ void ffi_cyclops_sdk_rust_future_free_void(uint64_t handle
#ifndef UNIFFI_FFIDEF_FFI_CYCLOPS_SDK_RUST_FUTURE_COMPLETE_VOID
#define UNIFFI_FFIDEF_FFI_CYCLOPS_SDK_RUST_FUTURE_COMPLETE_VOID
void ffi_cyclops_sdk_rust_future_complete_void(uint64_t handle, RustCallStatus *out_status
+);
+#endif
+#ifndef UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_CHECKSUM_FUNC_HEALTHY_POOL_DISPLAY_STATUS
+#define UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_CHECKSUM_FUNC_HEALTHY_POOL_DISPLAY_STATUS
+uint16_t uniffi_cyclops_sdk_checksum_func_healthy_pool_display_status(void
+
+);
+#endif
+#ifndef UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_CHECKSUM_FUNC_POOL_DISPLAY_STATUS
+#define UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_CHECKSUM_FUNC_POOL_DISPLAY_STATUS
+uint16_t uniffi_cyclops_sdk_checksum_func_pool_display_status(void
+
+);
+#endif
+#ifndef UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_CHECKSUM_FUNC_REMOVED_POOL_DISPLAY_STATUS
+#define UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_CHECKSUM_FUNC_REMOVED_POOL_DISPLAY_STATUS
+uint16_t uniffi_cyclops_sdk_checksum_func_removed_pool_display_status(void
+
+);
+#endif
+#ifndef UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_CHECKSUM_FUNC_TERMINATING_POOL_DISPLAY_STATUS
+#define UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_CHECKSUM_FUNC_TERMINATING_POOL_DISPLAY_STATUS
+uint16_t uniffi_cyclops_sdk_checksum_func_terminating_pool_display_status(void
+
+);
+#endif
+#ifndef UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_CHECKSUM_FUNC_UNKNOWN_POOL_DISPLAY_STATUS
+#define UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_CHECKSUM_FUNC_UNKNOWN_POOL_DISPLAY_STATUS
+uint16_t uniffi_cyclops_sdk_checksum_func_unknown_pool_display_status(void
+
);
#endif
#ifndef UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_CHECKSUM_METHOD_CYCLOPSCLIENT_CREATE_CLAIM
@@ -925,6 +1014,24 @@ uint16_t uniffi_cyclops_sdk_checksum_method_cyclopsclient_renew_claim(void
#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_NAMESPACE
+#define UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_CHECKSUM_METHOD_CYCLOPSCLIENT_CREATE_NAMESPACE
+uint16_t uniffi_cyclops_sdk_checksum_method_cyclopsclient_create_namespace(void
+
+);
+#endif
+#ifndef UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_CHECKSUM_METHOD_CYCLOPSCLIENT_DELETE_NAMESPACE
+#define UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_CHECKSUM_METHOD_CYCLOPSCLIENT_DELETE_NAMESPACE
+uint16_t uniffi_cyclops_sdk_checksum_method_cyclopsclient_delete_namespace(void
+
+);
+#endif
+#ifndef UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_CHECKSUM_METHOD_CYCLOPSCLIENT_GET_NAMESPACE
+#define UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_CHECKSUM_METHOD_CYCLOPSCLIENT_GET_NAMESPACE
+uint16_t uniffi_cyclops_sdk_checksum_method_cyclopsclient_get_namespace(void
+
);
#endif
#ifndef UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_CHECKSUM_METHOD_CYCLOPSCLIENT_LIST_NAMESPACES
@@ -973,6 +1080,24 @@ 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_SIGNED_SERVICE_URL
+#define UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_CHECKSUM_METHOD_CYCLOPSCLIENT_CREATE_SIGNED_SERVICE_URL
+uint16_t uniffi_cyclops_sdk_checksum_method_cyclopsclient_create_signed_service_url(void
+
+);
+#endif
+#ifndef UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_CHECKSUM_METHOD_CYCLOPSCLIENT_LIST_SIGNED_SERVICE_URLS
+#define UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_CHECKSUM_METHOD_CYCLOPSCLIENT_LIST_SIGNED_SERVICE_URLS
+uint16_t uniffi_cyclops_sdk_checksum_method_cyclopsclient_list_signed_service_urls(void
+
+);
+#endif
+#ifndef UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_CHECKSUM_METHOD_CYCLOPSCLIENT_REVOKE_SIGNED_SERVICE_URL
+#define UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_CHECKSUM_METHOD_CYCLOPSCLIENT_REVOKE_SIGNED_SERVICE_URL
+uint16_t uniffi_cyclops_sdk_checksum_method_cyclopsclient_revoke_signed_service_url(void
+
);
#endif
#ifndef UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_CHECKSUM_METHOD_CYCLOPSCLIENT_CREATE_TEMPLATE
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 aa04099468..ca6bc67af7 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
@@ -746,6 +746,12 @@ internal object IntegrityCheckingUniffiLib {
): Short
external fun uniffi_cyclops_sdk_checksum_method_cyclopsclient_service_request(
): Short
+ external fun uniffi_cyclops_sdk_checksum_method_cyclopsclient_create_signed_service_url(
+ ): Short
+ external fun uniffi_cyclops_sdk_checksum_method_cyclopsclient_list_signed_service_urls(
+ ): Short
+ external fun uniffi_cyclops_sdk_checksum_method_cyclopsclient_revoke_signed_service_url(
+ ): Short
external fun uniffi_cyclops_sdk_checksum_method_cyclopsclient_create_template(
): Short
external fun uniffi_cyclops_sdk_checksum_method_cyclopsclient_delete_template(
@@ -782,6 +788,16 @@ internal object IntegrityCheckingUniffiLib {
): Short
external fun uniffi_cyclops_sdk_checksum_method_createpoolrequestbuilder_spec(
): Short
+ external fun uniffi_cyclops_sdk_checksum_method_createsignedserviceurlrequestbuilder_build(
+ ): Short
+ external fun uniffi_cyclops_sdk_checksum_method_createsignedserviceurlrequestbuilder_expires_in_seconds(
+ ): Short
+ external fun uniffi_cyclops_sdk_checksum_method_createsignedserviceurlrequestbuilder_label(
+ ): Short
+ external fun uniffi_cyclops_sdk_checksum_method_createsignedserviceurlrequestbuilder_sandbox(
+ ): Short
+ external fun uniffi_cyclops_sdk_checksum_method_createsignedserviceurlrequestbuilder_service(
+ ): Short
external fun uniffi_cyclops_sdk_checksum_method_createtemplaterequestbuilder_build(
): Short
external fun uniffi_cyclops_sdk_checksum_method_createtemplaterequestbuilder_name(
@@ -848,6 +864,8 @@ internal object IntegrityCheckingUniffiLib {
): Short
external fun uniffi_cyclops_sdk_checksum_constructor_createpoolrequestbuilder_new(
): Short
+ external fun uniffi_cyclops_sdk_checksum_constructor_createsignedserviceurlrequestbuilder_new(
+ ): Short
external fun uniffi_cyclops_sdk_checksum_constructor_createtemplaterequestbuilder_new(
): Short
external fun uniffi_cyclops_sdk_checksum_constructor_createuserapikeyrequestbuilder_new(
@@ -933,6 +951,12 @@ 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_signed_service_url(`ptr`: Long,`request`: RustBuffer.ByValue,
+): Long
+external fun uniffi_cyclops_sdk_fn_method_cyclopsclient_list_signed_service_urls(`ptr`: Long,`sandbox`: RustBuffer.ByValue,
+): Long
+external fun uniffi_cyclops_sdk_fn_method_cyclopsclient_revoke_signed_service_url(`ptr`: Long,`signedServiceUrl`: 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,
@@ -993,6 +1017,22 @@ external fun uniffi_cyclops_sdk_fn_method_createpoolrequestbuilder_namespace(`pt
): Long
external fun uniffi_cyclops_sdk_fn_method_createpoolrequestbuilder_spec(`ptr`: Long,`value`: RustBufferOSGymSandboxWarmPoolSpec.ByValue,uniffi_out_err: UniffiRustCallStatus,
): Long
+external fun uniffi_cyclops_sdk_fn_clone_createsignedserviceurlrequestbuilder(`handle`: Long,uniffi_out_err: UniffiRustCallStatus,
+): Long
+external fun uniffi_cyclops_sdk_fn_free_createsignedserviceurlrequestbuilder(`handle`: Long,uniffi_out_err: UniffiRustCallStatus,
+): Unit
+external fun uniffi_cyclops_sdk_fn_constructor_createsignedserviceurlrequestbuilder_new(uniffi_out_err: UniffiRustCallStatus,
+): Long
+external fun uniffi_cyclops_sdk_fn_method_createsignedserviceurlrequestbuilder_build(`ptr`: Long,uniffi_out_err: UniffiRustCallStatus,
+): RustBuffer.ByValue
+external fun uniffi_cyclops_sdk_fn_method_createsignedserviceurlrequestbuilder_expires_in_seconds(`ptr`: Long,`value`: Int,uniffi_out_err: UniffiRustCallStatus,
+): Long
+external fun uniffi_cyclops_sdk_fn_method_createsignedserviceurlrequestbuilder_label(`ptr`: Long,`value`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus,
+): Long
+external fun uniffi_cyclops_sdk_fn_method_createsignedserviceurlrequestbuilder_sandbox(`ptr`: Long,`value`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus,
+): Long
+external fun uniffi_cyclops_sdk_fn_method_createsignedserviceurlrequestbuilder_service(`ptr`: Long,`value`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus,
+): Long
external fun uniffi_cyclops_sdk_fn_clone_createtemplaterequestbuilder(`handle`: Long,uniffi_out_err: UniffiRustCallStatus,
): Long
external fun uniffi_cyclops_sdk_fn_free_createtemplaterequestbuilder(`handle`: Long,uniffi_out_err: UniffiRustCallStatus,
@@ -1272,6 +1312,15 @@ 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_signed_service_url() != 17810.toShort()) {
+ throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
+ }
+ if (lib.uniffi_cyclops_sdk_checksum_method_cyclopsclient_list_signed_service_urls() != 31479.toShort()) {
+ throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
+ }
+ if (lib.uniffi_cyclops_sdk_checksum_method_cyclopsclient_revoke_signed_service_url() != 59989.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")
}
@@ -1326,6 +1375,21 @@ private fun uniffiCheckApiChecksums(lib: IntegrityCheckingUniffiLib) {
if (lib.uniffi_cyclops_sdk_checksum_method_createpoolrequestbuilder_spec() != 7566.toShort()) {
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
}
+ if (lib.uniffi_cyclops_sdk_checksum_method_createsignedserviceurlrequestbuilder_build() != 4255.toShort()) {
+ throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
+ }
+ if (lib.uniffi_cyclops_sdk_checksum_method_createsignedserviceurlrequestbuilder_expires_in_seconds() != 30769.toShort()) {
+ throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
+ }
+ if (lib.uniffi_cyclops_sdk_checksum_method_createsignedserviceurlrequestbuilder_label() != 1753.toShort()) {
+ throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
+ }
+ if (lib.uniffi_cyclops_sdk_checksum_method_createsignedserviceurlrequestbuilder_sandbox() != 1132.toShort()) {
+ throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
+ }
+ if (lib.uniffi_cyclops_sdk_checksum_method_createsignedserviceurlrequestbuilder_service() != 62938.toShort()) {
+ throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
+ }
if (lib.uniffi_cyclops_sdk_checksum_method_createtemplaterequestbuilder_build() != 46749.toShort()) {
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
}
@@ -1425,6 +1489,9 @@ private fun uniffiCheckApiChecksums(lib: IntegrityCheckingUniffiLib) {
if (lib.uniffi_cyclops_sdk_checksum_constructor_createpoolrequestbuilder_new() != 33658.toShort()) {
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
}
+ if (lib.uniffi_cyclops_sdk_checksum_constructor_createsignedserviceurlrequestbuilder_new() != 16004.toShort()) {
+ throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
+ }
if (lib.uniffi_cyclops_sdk_checksum_constructor_createtemplaterequestbuilder_new() != 6787.toShort()) {
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
}
@@ -2953,6 +3020,325 @@ public object FfiConverterTypeCreatePoolRequestBuilder: FfiConverter<CreatePoolR
//
+public interface CreateSignedServiceUrlRequestBuilderInterface {
+
+ fun `build`(): CreateSignedServiceUrlRequest
+
+ fun `expiresInSeconds`(`value`: kotlin.UInt): CreateSignedServiceUrlRequestBuilder
+
+ fun `label`(`value`: kotlin.String): CreateSignedServiceUrlRequestBuilder
+
+ fun `sandbox`(`value`: Sandbox): CreateSignedServiceUrlRequestBuilder
+
+ fun `service`(`value`: kotlin.String): CreateSignedServiceUrlRequestBuilder
+
+ companion object
+}
+
+open class CreateSignedServiceUrlRequestBuilder: Disposable, AutoCloseable, CreateSignedServiceUrlRequestBuilderInterface
+{
+
+ @Suppress("UNUSED_PARAMETER")
+ /**
+ * @suppress
+ */
+ constructor(withHandle: UniffiWithHandle, handle: Long) {
+ this.handle = handle
+ this.cleanable = UniffiLib.CLEANER.register(this, UniffiCleanAction(handle))
+ }
+
+ /**
+ * @suppress
+ *
+ * This constructor can be used to instantiate a fake object. Only used for tests. Any
+ * attempt to actually use an object constructed this way will fail as there is no
+ * connected Rust object.
+ */
+ @Suppress("UNUSED_PARAMETER")
+ constructor(noHandle: NoHandle) {
+ this.handle = 0
+ this.cleanable = null
+ }
+ constructor() :
+ this(UniffiWithHandle,
+ uniffiRustCall() { _status ->
+ UniffiLib.uniffi_cyclops_sdk_fn_constructor_createsignedserviceurlrequestbuilder_new(
+
+ _status)
+}
+ )
+
+ protected val handle: Long
+ protected val cleanable: UniffiCleaner.Cleanable?
+
+ private val wasDestroyed = AtomicBoolean(false)
+ private val callCounter = AtomicLong(1)
+
+ override fun destroy() {
+ // Only allow a single call to this method.
+ // TODO: maybe we should log a warning if called more than once?
+ if (this.wasDestroyed.compareAndSet(false, true)) {
+ // This decrement always matches the initial count of 1 given at creation time.
+ if (this.callCounter.decrementAndGet() == 0L) {
+ cleanable?.clean()
+ }
+ }
+ }
+
+ @Synchronized
+ override fun close() {
+ this.destroy()
+ }
+
+ internal inline fun <R> callWithHandle(block: (handle: Long) -> R): R {
+ // Check and increment the call counter, to keep the object alive.
+ // This needs a compare-and-set retry loop in case of concurrent updates.
+ do {
+ val c = this.callCounter.get()
+ if (c == 0L) {
+ throw IllegalStateException("${this.javaClass.simpleName} object has already been destroyed")
+ }
+ if (c == Long.MAX_VALUE) {
+ throw IllegalStateException("${this.javaClass.simpleName} call counter would overflow")
+ }
+ } while (! this.callCounter.compareAndSet(c, c + 1L))
+ // Now we can safely do the method call without the handle being freed concurrently.
+ try {
+ return block(this.uniffiCloneHandle())
+ } finally {
+ // This decrement always matches the increment we performed above.
+ if (this.callCounter.decrementAndGet() == 0L) {
+ cleanable?.clean()
+ }
+ }
+ }
+
+ // Use a static inner class instead of a closure so as not to accidentally
+ // capture `this` as part of the cleanable's action.
+ private class UniffiCleanAction(private val handle: Long) : Runnable {
+ override fun run() {
+ if (handle == 0.toLong()) {
+ // Fake object created with `NoHandle`, don't try to free.
+ return;
+ }
+ uniffiRustCall { status ->
+ UniffiLib.uniffi_cyclops_sdk_fn_free_createsignedserviceurlrequestbuilder(handle, status)
+ }
+ }
+ }
+
+ /**
+ * @suppress
+ */
+ fun uniffiCloneHandle(): Long {
+ if (handle == 0.toLong()) {
+ throw InternalException("uniffiCloneHandle() called on NoHandle object");
+ }
+ return uniffiRustCall() { status ->
+ UniffiLib.uniffi_cyclops_sdk_fn_clone_createsignedserviceurlrequestbuilder(handle, status)
+ }
+ }
+
+
+ @Throws(SdkBuildException::class)override fun `build`(): CreateSignedServiceUrlRequest {
+ return FfiConverterTypeCreateSignedServiceUrlRequest.lift(
+ callWithHandle {
+ uniffiRustCallWithError(SdkBuildException) { _status ->
+ UniffiLib.uniffi_cyclops_sdk_fn_method_createsignedserviceurlrequestbuilder_build(
+ it,
+ _status)
+}
+ }
+ )
+ }
+
+
+ override fun `expiresInSeconds`(`value`: kotlin.UInt): CreateSignedServiceUrlRequestBuilder {
+ return FfiConverterTypeCreateSignedServiceUrlRequestBuilder.lift(
+ callWithHandle {
+ uniffiRustCall() { _status ->
+ UniffiLib.uniffi_cyclops_sdk_fn_method_createsignedserviceurlrequestbuilder_expires_in_seconds(
+ it,
+ FfiConverterUInt.lower(`value`),_status)
+}
+ }
+ )
+ }
+
+
+ override fun `label`(`value`: kotlin.String): CreateSignedServiceUrlRequestBuilder {
+ return FfiConverterTypeCreateSignedServiceUrlRequestBuilder.lift(
+ callWithHandle {
+ uniffiRustCall() { _status ->
+ UniffiLib.uniffi_cyclops_sdk_fn_method_createsignedserviceurlrequestbuilder_label(
+ it,
+ FfiConverterString.lower(`value`),_status)
+}
+ }
+ )
+ }
+
+
+ override fun `sandbox`(`value`: Sandbox): CreateSignedServiceUrlRequestBuilder {
+ return FfiConverterTypeCreateSignedServiceUrlRequestBuilder.lift(
+ callWithHandle {
+ uniffiRustCall() { _status ->
+ UniffiLib.uniffi_cyclops_sdk_fn_method_createsignedserviceurlrequestbuilder_sandbox(
+ it,
+ FfiConverterTypeSandbox.lower(`value`),_status)
+}
+ }
+ )
+ }
+
+
+ override fun `service`(`value`: kotlin.String): CreateSignedServiceUrlRequestBuilder {
+ return FfiConverterTypeCreateSignedServiceUrlRequestBuilder.lift(
+ callWithHandle {
+ uniffiRustCall() { _status ->
+ UniffiLib.uniffi_cyclops_sdk_fn_method_createsignedserviceurlrequestbuilder_service(
+ it,
+ FfiConverterString.lower(`value`),_status)
+}
+ }
+ )
+ }
+
+
+
+
+
+
+
+
+
+ /**
+ * @suppress
+ */
+ companion object
+
+}
+
+
+/**
+ * @suppress
+ */
+public object FfiConverterTypeCreateSignedServiceUrlRequestBuilder: FfiConverter<CreateSignedServiceUrlRequestBuilder, Long> {
+ override fun lower(value: CreateSignedServiceUrlRequestBuilder): Long {
+ return value.uniffiCloneHandle()
+ }
+
+ override fun lift(value: Long): CreateSignedServiceUrlRequestBuilder {
+ return CreateSignedServiceUrlRequestBuilder(UniffiWithHandle, value)
+ }
+
+ override fun read(buf: ByteBuffer): CreateSignedServiceUrlRequestBuilder {
+ return lift(buf.getLong())
+ }
+
+ override fun allocationSize(value: CreateSignedServiceUrlRequestBuilder) = 8UL
+
+ override fun write(value: CreateSignedServiceUrlRequestBuilder, buf: ByteBuffer) {
+ buf.putLong(lower(value))
+ }
+}
+
+
+// This template implements a class for working with a Rust struct via a handle
+// to the live Rust struct on the other side of the FFI.
+//
+// There's some subtlety here, because we have to be careful not to operate on a Rust
+// struct after it has been dropped, and because we must expose a public API for freeing
+// theq Kotlin wrapper object in lieu of reliable finalizers. The core requirements are:
+//
+// * Each instance holds an opaque handle to the underlying Rust struct.
+// Method calls need to read this handle from the object's state and pass it in to
+// the Rust FFI.
+//
+// * When an instance is no longer needed, its handle should be passed to a
+// special destructor function provided by the Rust FFI, which will drop the
+// underlying Rust struct.
+//
+// * Given an instance, calling code is expected to call the special
+// `destroy` method in order to free it after use, either by calling it explicitly
+// or by using a higher-level helper like the `use` method. Failing to do so risks
+// leaking the underlying Rust struct.
+//
+// * We can't assume that calling code will do the right thing, and must be prepared
+// to handle Kotlin method calls executing concurrently with or even after a call to
+// `destroy`, and to handle multiple (possibly concurrent!) calls to `destroy`.
+//
+// * We must never allow Rust code to operate on the underlying Rust struct after
+// the destructor has been called, and must never call the destructor more than once.
+// Doing so may trigger memory unsafety.
+//
+// * To mitigate many of the risks of leaking memory and use-after-free unsafety, a `Cleaner`
+// is implemented to call the destructor when the Kotlin object becomes unreachable.
+// This is done in a background thread. This is not a panacea, and client code should be aware that
+// 1. the thread may starve if some there are objects that have poorly performing
+// `drop` methods or do significant work in their `drop` methods.
+// 2. the thread is shared across the whole library. This can be tuned by using `android_cleaner = true`,
+// or `android = true` in the [`kotlin` section of the `uniffi.toml` file](https://mozilla.github.io/uniffi-rs/kotlin/configuration.html).
+//
+// If we try to implement this with mutual exclusion on access to the handle, there is the
+// possibility of a race between a method call and a concurrent call to `destroy`:
+//
+// * Thread A starts a method call, reads the value of the handle, but is interrupted
+// before it can pass the handle over the FFI to Rust.
+// * Thread B calls `destroy` and frees the underlying Rust struct.
+// * Thread A resumes, passing the already-read handle value to Rust and triggering
+// a use-after-free.
+//
+// One possible solution would be to use a `ReadWriteLock`, with each method call taking
+// a read lock (and thus allowed to run concurrently) and the special `destroy` method
+// taking a write lock (and thus blocking on live method calls). However, we aim not to
+// generate methods with any hidden blocking semantics, and a `destroy` method that might
+// block if called incorrectly seems to meet that bar.
+//
+// So, we achieve our goals by giving each instance an associated `AtomicLong` counter to track
+// the number of in-flight method calls, and an `AtomicBoolean` flag to indicate whether `destroy`
+// has been called. These are updated according to the following rules:
+//
+// * The initial value of the counter is 1, indicating a live object with no in-flight calls.
+// The initial value for the flag is false.
+//
+// * At the start of each method call, we atomically check the counter.
+// If it is 0 then the underlying Rust struct has already been destroyed and the call is aborted.
+// If it is nonzero them we atomically increment it by 1 and proceed with the method call.
+//
+// * At the end of each method call, we atomically decrement and check the counter.
+// If it has reached zero then we destroy the underlying Rust struct.
+//
+// * When `destroy` is called, we atomically flip the flag from false to true.
+// If the flag was already true we silently fail.
+// Otherwise we atomically decrement and check the counter.
+// If it has reached zero then we destroy the underlying Rust struct.
+//
+// Astute readers may observe that this all sounds very similar to the way that Rust's `Arc<T>` works,
+// and indeed it is, with the addition of a flag to guard against multiple calls to `destroy`.
+//
+// The overall effect is that the underlying Rust struct is destroyed only when `destroy` has been
+// called *and* all in-flight method calls have completed, avoiding violating any of the expectations
+// of the underlying Rust code.
+//
+// This makes a cleaner a better alternative to _not_ calling `destroy()` as
+// and when the object is finished with, but the abstraction is not perfect: if the Rust object's `drop`
+// method is slow, and/or there are many objects to cleanup, and it's on a low end Android device, then the cleaner
+// thread may be starved, and the app will leak memory.
+//
+// In this case, `destroy`ing manually may be a better solution.
+//
+// The cleaner can live side by side with the manual calling of `destroy`. In the order of responsiveness, uniffi objects
+// with Rust peers are reclaimed:
+//
+// 1. By calling the `destroy` method of the object, which calls `rustObject.free()`. If that doesn't happen:
+// 2. When the object becomes unreachable, AND the Cleaner thread gets to call `rustObject.free()`. If the thread is starved then:
+// 3. The memory is reclaimed when the process terminates.
+//
+// [1] https://stackoverflow.com/questions/24376768/can-java-finalize-an-object-when-it-is-still-in-scope/24380219
+//
+
+
public interface CreateTemplateRequestBuilderInterface {
fun `build`(): CreateTemplateRequest
@@ -3590,6 +3976,12 @@ public interface CyclopsClientInterface {
suspend fun `serviceRequest`(`sandbox`: Sandbox, `service`: kotlin.String, `path`: kotlin.String, `request`: HttpRequest): HttpResponse
+ suspend fun `createSignedServiceUrl`(`request`: CreateSignedServiceUrlRequest): SignedServiceUrl
+
+ suspend fun `listSignedServiceUrls`(`sandbox`: Sandbox): List<SignedServiceUrl>
+
+ suspend fun `revokeSignedServiceUrl`(`signedServiceUrl`: SignedServiceUrl)
+
suspend fun `createTemplate`(`request`: CreateTemplateRequest): Template
suspend fun `deleteTemplate`(`template`: Template)
@@ -4076,6 +4468,70 @@ open class CyclopsClient: Disposable, AutoCloseable, CyclopsClientInterface
}
+ @Throws(SdkException::class)
+ @Suppress("ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE")
+ override suspend fun `createSignedServiceUrl`(`request`: CreateSignedServiceUrlRequest) : SignedServiceUrl {
+ return uniffiRustCallAsync(
+ callWithHandle { uniffiHandle ->
+ UniffiLib.uniffi_cyclops_sdk_fn_method_cyclopsclient_create_signed_service_url(
+ uniffiHandle,
+ FfiConverterTypeCreateSignedServiceUrlRequest.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
+ { FfiConverterTypeSignedServiceUrl.lift(it) },
+ // Error FFI converter
+ SdkException.ErrorHandler,
+ )
+ }
+
+
+ @Throws(SdkException::class)
+ @Suppress("ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE")
+ override suspend fun `listSignedServiceUrls`(`sandbox`: Sandbox) : List<SignedServiceUrl> {
+ return uniffiRustCallAsync(
+ callWithHandle { uniffiHandle ->
+ UniffiLib.uniffi_cyclops_sdk_fn_method_cyclopsclient_list_signed_service_urls(
+ uniffiHandle,
+ FfiConverterTypeSandbox.lower(`sandbox`),
+ )
+ },
+ { 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
+ { FfiConverterSequenceTypeSignedServiceUrl.lift(it) },
+ // Error FFI converter
+ SdkException.ErrorHandler,
+ )
+ }
+
+
+ @Throws(SdkException::class)
+ @Suppress("ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE")
+ override suspend fun `revokeSignedServiceUrl`(`signedServiceUrl`: SignedServiceUrl) {
+ return uniffiRustCallAsync(
+ callWithHandle { uniffiHandle ->
+ UniffiLib.uniffi_cyclops_sdk_fn_method_cyclopsclient_revoke_signed_service_url(
+ uniffiHandle,
+ FfiConverterTypeSignedServiceUrl.lower(`signedServiceUrl`),
+ )
+ },
+ { 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 `createTemplate`(`request`: CreateTemplateRequest) : Template {
@@ -6093,6 +6549,54 @@ public object FfiConverterTypeCreatePoolRequest: FfiConverterRustBuffer<CreatePo
+data class CreateSignedServiceUrlRequest (
+ var `sandbox`: Sandbox
+ ,
+ var `service`: kotlin.String
+ ,
+ var `label`: kotlin.String?
+ ,
+ var `expiresInSeconds`: kotlin.UInt
+
+){
+
+
+
+
+
+ companion object
+}
+
+/**
+ * @suppress
+ */
+public object FfiConverterTypeCreateSignedServiceUrlRequest: FfiConverterRustBuffer<CreateSignedServiceUrlRequest> {
+ override fun read(buf: ByteBuffer): CreateSignedServiceUrlRequest {
+ return CreateSignedServiceUrlRequest(
+ FfiConverterTypeSandbox.read(buf),
+ FfiConverterString.read(buf),
+ FfiConverterOptionalString.read(buf),
+ FfiConverterUInt.read(buf),
+ )
+ }
+
+ override fun allocationSize(value: CreateSignedServiceUrlRequest) = (
+ FfiConverterTypeSandbox.allocationSize(value.`sandbox`) +
+ FfiConverterString.allocationSize(value.`service`) +
+ FfiConverterOptionalString.allocationSize(value.`label`) +
+ FfiConverterUInt.allocationSize(value.`expiresInSeconds`)
+ )
+
+ override fun write(value: CreateSignedServiceUrlRequest, buf: ByteBuffer) {
+ FfiConverterTypeSandbox.write(value.`sandbox`, buf)
+ FfiConverterString.write(value.`service`, buf)
+ FfiConverterOptionalString.write(value.`label`, buf)
+ FfiConverterUInt.write(value.`expiresInSeconds`, buf)
+ }
+}
+
+
+
data class CreateTemplateRequest (
var `namespace`: kotlin.String
,
@@ -6745,6 +7249,84 @@ public object FfiConverterTypeSandbox: FfiConverterRustBuffer<Sandbox> {
+data class SignedServiceUrl (
+ var `id`: kotlin.String
+ ,
+ var `namespace`: kotlin.String
+ ,
+ var `claim`: kotlin.String
+ ,
+ var `sandbox`: kotlin.String
+ ,
+ var `service`: kotlin.String
+ ,
+ var `label`: kotlin.String?
+ ,
+ var `url`: kotlin.String
+ ,
+ var `createdAt`: kotlin.String
+ ,
+ var `expiresAt`: kotlin.String
+ ,
+ var `revokedAt`: kotlin.String?
+
+){
+
+
+
+
+
+ companion object
+}
+
+/**
+ * @suppress
+ */
+public object FfiConverterTypeSignedServiceUrl: FfiConverterRustBuffer<SignedServiceUrl> {
+ override fun read(buf: ByteBuffer): SignedServiceUrl {
+ return SignedServiceUrl(
+ FfiConverterString.read(buf),
+ FfiConverterString.read(buf),
+ FfiConverterString.read(buf),
+ FfiConverterString.read(buf),
+ FfiConverterString.read(buf),
+ FfiConverterOptionalString.read(buf),
+ FfiConverterString.read(buf),
+ FfiConverterString.read(buf),
+ FfiConverterString.read(buf),
+ FfiConverterOptionalString.read(buf),
+ )
+ }
+
+ override fun allocationSize(value: SignedServiceUrl) = (
+ FfiConverterString.allocationSize(value.`id`) +
+ FfiConverterString.allocationSize(value.`namespace`) +
+ FfiConverterString.allocationSize(value.`claim`) +
+ FfiConverterString.allocationSize(value.`sandbox`) +
+ FfiConverterString.allocationSize(value.`service`) +
+ FfiConverterOptionalString.allocationSize(value.`label`) +
+ FfiConverterString.allocationSize(value.`url`) +
+ FfiConverterString.allocationSize(value.`createdAt`) +
+ FfiConverterString.allocationSize(value.`expiresAt`) +
+ FfiConverterOptionalString.allocationSize(value.`revokedAt`)
+ )
+
+ override fun write(value: SignedServiceUrl, buf: ByteBuffer) {
+ FfiConverterString.write(value.`id`, buf)
+ FfiConverterString.write(value.`namespace`, buf)
+ FfiConverterString.write(value.`claim`, buf)
+ FfiConverterString.write(value.`sandbox`, buf)
+ FfiConverterString.write(value.`service`, buf)
+ FfiConverterOptionalString.write(value.`label`, buf)
+ FfiConverterString.write(value.`url`, buf)
+ FfiConverterString.write(value.`createdAt`, buf)
+ FfiConverterString.write(value.`expiresAt`, buf)
+ FfiConverterOptionalString.write(value.`revokedAt`, buf)
+ }
+}
+
+
+
/**
* The `osgym.cua.ai/v1alpha1 OSGymSandboxTemplate` CR verbatim. Warm pools
* and claims reference one by name via `spec.sandboxTemplateRef.name`.
@@ -7133,6 +7715,12 @@ sealed class SdkException: kotlin.Exception() {
get() = "operation=${ `operation` }, status=${ `status` }, body=${ `body` }"
}
+ class SignedServiceUrlsUnavailable(
+ ) : SdkException() {
+ override val message
+ get() = ""
+ }
+
class UnknownService(
val `requested`: kotlin.String,
@@ -7222,19 +7810,20 @@ public object FfiConverterTypeSdkError : FfiConverterRustBuffer<SdkException> {
FfiConverterUShort.read(buf),
FfiConverterString.read(buf),
)
- 7 -> SdkException.UnknownService(
+ 7 -> SdkException.SignedServiceUrlsUnavailable()
+ 8 -> SdkException.UnknownService(
FfiConverterString.read(buf),
FfiConverterSequenceString.read(buf),
)
- 8 -> SdkException.InvalidServicePath(
+ 9 -> SdkException.InvalidServicePath(
FfiConverterString.read(buf),
)
- 9 -> SdkException.ClaimFailed(
+ 10 -> SdkException.ClaimFailed(
FfiConverterString.read(buf),
FfiConverterString.read(buf),
)
- 10 -> SdkException.ClaimTimeout()
- 11 -> SdkException.PoolAccessDenied(
+ 11 -> SdkException.ClaimTimeout()
+ 12 -> SdkException.PoolAccessDenied(
FfiConverterString.read(buf),
FfiConverterString.read(buf),
FfiConverterUShort.read(buf),
@@ -7280,6 +7869,10 @@ public object FfiConverterTypeSdkError : FfiConverterRustBuffer<SdkException> {
+ FfiConverterUShort.allocationSize(value.`status`)
+ FfiConverterString.allocationSize(value.`body`)
)
+ is SdkException.SignedServiceUrlsUnavailable -> (
+ // Add the size for the Int that specifies the variant plus the size needed for all fields
+ 4UL
+ )
is SdkException.UnknownService -> (
// Add the size for the Int that specifies the variant plus the size needed for all fields
4UL
@@ -7348,29 +7941,33 @@ public object FfiConverterTypeSdkError : FfiConverterRustBuffer<SdkException> {
FfiConverterString.write(value.`body`, buf)
Unit
}
- is SdkException.UnknownService -> {
+ is SdkException.SignedServiceUrlsUnavailable -> {
buf.putInt(7)
+ Unit
+ }
+ is SdkException.UnknownService -> {
+ buf.putInt(8)
FfiConverterString.write(value.`requested`, buf)
FfiConverterSequenceString.write(value.`available`, buf)
Unit
}
is SdkException.InvalidServicePath -> {
- buf.putInt(8)
+ buf.putInt(9)
FfiConverterString.write(value.`path`, buf)
Unit
}
is SdkException.ClaimFailed -> {
- buf.putInt(9)
+ buf.putInt(10)
FfiConverterString.write(value.`phase`, buf)
FfiConverterString.write(value.`status`, buf)
Unit
}
is SdkException.ClaimTimeout -> {
- buf.putInt(10)
+ buf.putInt(11)
Unit
}
is SdkException.PoolAccessDenied -> {
- buf.putInt(11)
+ buf.putInt(12)
FfiConverterString.write(value.`operation`, buf)
FfiConverterString.write(value.`namespace`, buf)
FfiConverterUShort.write(value.`status`, buf)
@@ -7749,6 +8346,34 @@ public object FfiConverterSequenceTypePool: FfiConverterRustBuffer<List<Pool>> {
+/**
+ * @suppress
+ */
+public object FfiConverterSequenceTypeSignedServiceUrl: FfiConverterRustBuffer<List<SignedServiceUrl>> {
+ override fun read(buf: ByteBuffer): List<SignedServiceUrl> {
+ val len = buf.getInt()
+ return List<SignedServiceUrl>(len) {
+ FfiConverterTypeSignedServiceUrl.read(buf)
+ }
+ }
+
+ override fun allocationSize(value: List<SignedServiceUrl>): ULong {
+ val sizeForLength = 4UL
+ val sizeForItems = value.map { FfiConverterTypeSignedServiceUrl.allocationSize(it) }.sum()
+ return sizeForLength + sizeForItems
+ }
+
+ override fun write(value: List<SignedServiceUrl>, buf: ByteBuffer) {
+ buf.putInt(value.size)
+ value.iterator().forEach {
+ FfiConverterTypeSignedServiceUrl.write(it, buf)
+ }
+ }
+}
+
+
+
+
/**
* @suppress
*/
diff --git a/libs/fleet/sdk-bindings/python/fleet_sdk/_sdk.py b/libs/fleet/sdk-bindings/python/fleet_sdk/_sdk.py
index ccc751d9ef..fc60ea630c 100644
--- a/libs/fleet/sdk-bindings/python/fleet_sdk/_sdk.py
+++ b/libs/fleet/sdk-bindings/python/fleet_sdk/_sdk.py
@@ -510,6 +510,18 @@ 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_createpoolrequestbuilder_spec() != 7566:
raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
+ if lib.uniffi_cyclops_sdk_checksum_constructor_createsignedserviceurlrequestbuilder_new() != 16004:
+ raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
+ if lib.uniffi_cyclops_sdk_checksum_method_createsignedserviceurlrequestbuilder_build() != 4255:
+ raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
+ if lib.uniffi_cyclops_sdk_checksum_method_createsignedserviceurlrequestbuilder_expires_in_seconds() != 30769:
+ raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
+ if lib.uniffi_cyclops_sdk_checksum_method_createsignedserviceurlrequestbuilder_label() != 1753:
+ raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
+ if lib.uniffi_cyclops_sdk_checksum_method_createsignedserviceurlrequestbuilder_sandbox() != 1132:
+ raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
+ if lib.uniffi_cyclops_sdk_checksum_method_createsignedserviceurlrequestbuilder_service() != 62938:
+ raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
if lib.uniffi_cyclops_sdk_checksum_constructor_createtemplaterequestbuilder_new() != 6787:
raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
if lib.uniffi_cyclops_sdk_checksum_method_createtemplaterequestbuilder_build() != 46749:
@@ -548,6 +560,8 @@ 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_signed_service_url() != 17810:
+ 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_create_user_api_key() != 9174:
@@ -576,6 +590,8 @@ 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_list_pools() != 27984:
raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
+ if lib.uniffi_cyclops_sdk_checksum_method_cyclopsclient_list_signed_service_urls() != 31479:
+ 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_list_user_api_keys() != 5949:
@@ -586,6 +602,8 @@ 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_renew_claim() != 17505:
raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
+ if lib.uniffi_cyclops_sdk_checksum_method_cyclopsclient_revoke_signed_service_url() != 59989:
+ 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:
@@ -931,6 +949,16 @@ _UniffiLib.uniffi_cyclops_sdk_fn_free_createpoolrequestbuilder.argtypes = (
ctypes.POINTER(_UniffiRustCallStatus),
)
_UniffiLib.uniffi_cyclops_sdk_fn_free_createpoolrequestbuilder.restype = None
+_UniffiLib.uniffi_cyclops_sdk_fn_clone_createsignedserviceurlrequestbuilder.argtypes = (
+ ctypes.c_uint64,
+ ctypes.POINTER(_UniffiRustCallStatus),
+)
+_UniffiLib.uniffi_cyclops_sdk_fn_clone_createsignedserviceurlrequestbuilder.restype = ctypes.c_uint64
+_UniffiLib.uniffi_cyclops_sdk_fn_free_createsignedserviceurlrequestbuilder.argtypes = (
+ ctypes.c_uint64,
+ ctypes.POINTER(_UniffiRustCallStatus),
+)
+_UniffiLib.uniffi_cyclops_sdk_fn_free_createsignedserviceurlrequestbuilder.restype = None
_UniffiLib.uniffi_cyclops_sdk_fn_clone_createtemplaterequestbuilder.argtypes = (
ctypes.c_uint64,
ctypes.POINTER(_UniffiRustCallStatus),
@@ -1124,6 +1152,39 @@ _UniffiLib.uniffi_cyclops_sdk_fn_method_createpoolrequestbuilder_spec.argtypes =
ctypes.POINTER(_UniffiRustCallStatus),
)
_UniffiLib.uniffi_cyclops_sdk_fn_method_createpoolrequestbuilder_spec.restype = ctypes.c_uint64
+_UniffiLib.uniffi_cyclops_sdk_fn_constructor_createsignedserviceurlrequestbuilder_new.argtypes = (
+ ctypes.POINTER(_UniffiRustCallStatus),
+)
+_UniffiLib.uniffi_cyclops_sdk_fn_constructor_createsignedserviceurlrequestbuilder_new.restype = ctypes.c_uint64
+_UniffiLib.uniffi_cyclops_sdk_fn_method_createsignedserviceurlrequestbuilder_build.argtypes = (
+ ctypes.c_uint64,
+ ctypes.POINTER(_UniffiRustCallStatus),
+)
+_UniffiLib.uniffi_cyclops_sdk_fn_method_createsignedserviceurlrequestbuilder_build.restype = _UniffiRustBuffer
+_UniffiLib.uniffi_cyclops_sdk_fn_method_createsignedserviceurlrequestbuilder_expires_in_seconds.argtypes = (
+ ctypes.c_uint64,
+ ctypes.c_uint32,
+ ctypes.POINTER(_UniffiRustCallStatus),
+)
+_UniffiLib.uniffi_cyclops_sdk_fn_method_createsignedserviceurlrequestbuilder_expires_in_seconds.restype = ctypes.c_uint64
+_UniffiLib.uniffi_cyclops_sdk_fn_method_createsignedserviceurlrequestbuilder_label.argtypes = (
+ ctypes.c_uint64,
+ _UniffiRustBuffer,
+ ctypes.POINTER(_UniffiRustCallStatus),
+)
+_UniffiLib.uniffi_cyclops_sdk_fn_method_createsignedserviceurlrequestbuilder_label.restype = ctypes.c_uint64
+_UniffiLib.uniffi_cyclops_sdk_fn_method_createsignedserviceurlrequestbuilder_sandbox.argtypes = (
+ ctypes.c_uint64,
+ _UniffiRustBuffer,
+ ctypes.POINTER(_UniffiRustCallStatus),
+)
+_UniffiLib.uniffi_cyclops_sdk_fn_method_createsignedserviceurlrequestbuilder_sandbox.restype = ctypes.c_uint64
+_UniffiLib.uniffi_cyclops_sdk_fn_method_createsignedserviceurlrequestbuilder_service.argtypes = (
+ ctypes.c_uint64,
+ _UniffiRustBuffer,
+ ctypes.POINTER(_UniffiRustCallStatus),
+)
+_UniffiLib.uniffi_cyclops_sdk_fn_method_createsignedserviceurlrequestbuilder_service.restype = ctypes.c_uint64
_UniffiLib.uniffi_cyclops_sdk_fn_constructor_createtemplaterequestbuilder_new.argtypes = (
ctypes.POINTER(_UniffiRustCallStatus),
)
@@ -1230,6 +1291,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_signed_service_url.argtypes = (
+ ctypes.c_uint64,
+ _UniffiRustBuffer,
+)
+_UniffiLib.uniffi_cyclops_sdk_fn_method_cyclopsclient_create_signed_service_url.restype = ctypes.c_uint64
_UniffiLib.uniffi_cyclops_sdk_fn_method_cyclopsclient_create_template.argtypes = (
ctypes.c_uint64,
_UniffiRustBuffer,
@@ -1300,6 +1366,11 @@ _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_signed_service_urls.argtypes = (
+ ctypes.c_uint64,
+ _UniffiRustBuffer,
+)
+_UniffiLib.uniffi_cyclops_sdk_fn_method_cyclopsclient_list_signed_service_urls.restype = ctypes.c_uint64
_UniffiLib.uniffi_cyclops_sdk_fn_method_cyclopsclient_list_templates.argtypes = (
ctypes.c_uint64,
_UniffiRustBuffer,
@@ -1325,6 +1396,11 @@ _UniffiLib.uniffi_cyclops_sdk_fn_method_cyclopsclient_renew_claim.argtypes = (
_UniffiRustBuffer,
)
_UniffiLib.uniffi_cyclops_sdk_fn_method_cyclopsclient_renew_claim.restype = ctypes.c_uint64
+_UniffiLib.uniffi_cyclops_sdk_fn_method_cyclopsclient_revoke_signed_service_url.argtypes = (
+ ctypes.c_uint64,
+ _UniffiRustBuffer,
+)
+_UniffiLib.uniffi_cyclops_sdk_fn_method_cyclopsclient_revoke_signed_service_url.restype = ctypes.c_uint64
_UniffiLib.uniffi_cyclops_sdk_fn_method_cyclopsclient_service_request.argtypes = (
ctypes.c_uint64,
_UniffiRustBuffer,
@@ -1518,6 +1594,24 @@ _UniffiLib.uniffi_cyclops_sdk_checksum_method_createpoolrequestbuilder_namespace
_UniffiLib.uniffi_cyclops_sdk_checksum_method_createpoolrequestbuilder_spec.argtypes = (
)
_UniffiLib.uniffi_cyclops_sdk_checksum_method_createpoolrequestbuilder_spec.restype = ctypes.c_uint16
+_UniffiLib.uniffi_cyclops_sdk_checksum_constructor_createsignedserviceurlrequestbuilder_new.argtypes = (
+)
+_UniffiLib.uniffi_cyclops_sdk_checksum_constructor_createsignedserviceurlrequestbuilder_new.restype = ctypes.c_uint16
+_UniffiLib.uniffi_cyclops_sdk_checksum_method_createsignedserviceurlrequestbuilder_build.argtypes = (
+)
+_UniffiLib.uniffi_cyclops_sdk_checksum_method_createsignedserviceurlrequestbuilder_build.restype = ctypes.c_uint16
+_UniffiLib.uniffi_cyclops_sdk_checksum_method_createsignedserviceurlrequestbuilder_expires_in_seconds.argtypes = (
+)
+_UniffiLib.uniffi_cyclops_sdk_checksum_method_createsignedserviceurlrequestbuilder_expires_in_seconds.restype = ctypes.c_uint16
+_UniffiLib.uniffi_cyclops_sdk_checksum_method_createsignedserviceurlrequestbuilder_label.argtypes = (
+)
+_UniffiLib.uniffi_cyclops_sdk_checksum_method_createsignedserviceurlrequestbuilder_label.restype = ctypes.c_uint16
+_UniffiLib.uniffi_cyclops_sdk_checksum_method_createsignedserviceurlrequestbuilder_sandbox.argtypes = (
+)
+_UniffiLib.uniffi_cyclops_sdk_checksum_method_createsignedserviceurlrequestbuilder_sandbox.restype = ctypes.c_uint16
+_UniffiLib.uniffi_cyclops_sdk_checksum_method_createsignedserviceurlrequestbuilder_service.argtypes = (
+)
+_UniffiLib.uniffi_cyclops_sdk_checksum_method_createsignedserviceurlrequestbuilder_service.restype = ctypes.c_uint16
_UniffiLib.uniffi_cyclops_sdk_checksum_constructor_createtemplaterequestbuilder_new.argtypes = (
)
_UniffiLib.uniffi_cyclops_sdk_checksum_constructor_createtemplaterequestbuilder_new.restype = ctypes.c_uint16
@@ -1575,6 +1669,9 @@ _UniffiLib.uniffi_cyclops_sdk_checksum_method_cyclopsclient_create_namespace.res
_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_signed_service_url.argtypes = (
+)
+_UniffiLib.uniffi_cyclops_sdk_checksum_method_cyclopsclient_create_signed_service_url.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
@@ -1617,6 +1714,9 @@ _UniffiLib.uniffi_cyclops_sdk_checksum_method_cyclopsclient_list_namespaces.rest
_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_signed_service_urls.argtypes = (
+)
+_UniffiLib.uniffi_cyclops_sdk_checksum_method_cyclopsclient_list_signed_service_urls.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
@@ -1632,6 +1732,9 @@ _UniffiLib.uniffi_cyclops_sdk_checksum_method_cyclopsclient_reconcile_template.r
_UniffiLib.uniffi_cyclops_sdk_checksum_method_cyclopsclient_renew_claim.argtypes = (
)
_UniffiLib.uniffi_cyclops_sdk_checksum_method_cyclopsclient_renew_claim.restype = ctypes.c_uint16
+_UniffiLib.uniffi_cyclops_sdk_checksum_method_cyclopsclient_revoke_signed_service_url.argtypes = (
+)
+_UniffiLib.uniffi_cyclops_sdk_checksum_method_cyclopsclient_revoke_signed_service_url.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
@@ -2285,6 +2388,138 @@ class _UniffiFfiConverterTypeCreatePoolRequest(_UniffiConverterRustBuffer):
_UniffiFfiConverterString.write(value.namespace, buf)
fleet_sdk._UniffiFfiConverterTypeOSGymSandboxWarmPoolSpec.write(value.spec, buf)
+class _UniffiFfiConverterSequenceString(_UniffiConverterRustBuffer):
+ @classmethod
+ def check_lower(cls, value):
+ for item in value:
+ _UniffiFfiConverterString.check_lower(item)
+
+ @classmethod
+ def write(cls, value, buf):
+ items = len(value)
+ buf.write_i32(items)
+ for item in value:
+ _UniffiFfiConverterString.write(item, buf)
+
+ @classmethod
+ def read(cls, buf):
+ count = buf.read_i32()
+ if count < 0:
+ raise InternalError("Unexpected negative sequence length")
+
+ return [
+ _UniffiFfiConverterString.read(buf) for i in range(count)
+ ]
+
+@dataclass
+class Sandbox:
+ def __init__(self, *, namespace:str, claim:str, name:str, services:typing.List[str]):
+ self.namespace = namespace
+ self.claim = claim
+ self.name = name
+ self.services = services
+
+
+
+
+ def __str__(self):
+ return "Sandbox(namespace={}, claim={}, name={}, services={})".format(self.namespace, self.claim, self.name, self.services)
+ def __eq__(self, other):
+ if self.namespace != other.namespace:
+ return False
+ if self.claim != other.claim:
+ return False
+ if self.name != other.name:
+ return False
+ if self.services != other.services:
+ return False
+ return True
+
+class _UniffiFfiConverterTypeSandbox(_UniffiConverterRustBuffer):
+ @staticmethod
+ def read(buf):
+ return Sandbox(
+ namespace=_UniffiFfiConverterString.read(buf),
+ claim=_UniffiFfiConverterString.read(buf),
+ name=_UniffiFfiConverterString.read(buf),
+ services=_UniffiFfiConverterSequenceString.read(buf),
+ )
+
+ @staticmethod
+ def check_lower(value):
+ _UniffiFfiConverterString.check_lower(value.namespace)
+ _UniffiFfiConverterString.check_lower(value.claim)
+ _UniffiFfiConverterString.check_lower(value.name)
+ _UniffiFfiConverterSequenceString.check_lower(value.services)
+
+ @staticmethod
+ def write(value, buf):
+ _UniffiFfiConverterString.write(value.namespace, buf)
+ _UniffiFfiConverterString.write(value.claim, buf)
+ _UniffiFfiConverterString.write(value.name, buf)
+ _UniffiFfiConverterSequenceString.write(value.services, buf)
+
+class _UniffiFfiConverterUInt32(_UniffiConverterPrimitiveInt):
+ CLASS_NAME = "u32"
+ VALUE_MIN = 0
+ VALUE_MAX = 2**32
+
+ @staticmethod
+ def read(buf):
+ return buf.read_u32()
+
+ @staticmethod
+ def write(value, buf):
+ buf.write_u32(value)
+
+@dataclass
+class CreateSignedServiceUrlRequest:
+ def __init__(self, *, sandbox:Sandbox, service:str, label:typing.Optional[str], expires_in_seconds:int):
+ self.sandbox = sandbox
+ self.service = service
+ self.label = label
+ self.expires_in_seconds = expires_in_seconds
+
+
+
+
+ def __str__(self):
+ return "CreateSignedServiceUrlRequest(sandbox={}, service={}, label={}, expires_in_seconds={})".format(self.sandbox, self.service, self.label, self.expires_in_seconds)
+ def __eq__(self, other):
+ if self.sandbox != other.sandbox:
+ return False
+ if self.service != other.service:
+ return False
+ if self.label != other.label:
+ return False
+ if self.expires_in_seconds != other.expires_in_seconds:
+ return False
+ return True
+
+class _UniffiFfiConverterTypeCreateSignedServiceUrlRequest(_UniffiConverterRustBuffer):
+ @staticmethod
+ def read(buf):
+ return CreateSignedServiceUrlRequest(
+ sandbox=_UniffiFfiConverterTypeSandbox.read(buf),
+ service=_UniffiFfiConverterString.read(buf),
+ label=_UniffiFfiConverterOptionalString.read(buf),
+ expires_in_seconds=_UniffiFfiConverterUInt32.read(buf),
+ )
+
+ @staticmethod
+ def check_lower(value):
+ _UniffiFfiConverterTypeSandbox.check_lower(value.sandbox)
+ _UniffiFfiConverterString.check_lower(value.service)
+ _UniffiFfiConverterOptionalString.check_lower(value.label)
+ _UniffiFfiConverterUInt32.check_lower(value.expires_in_seconds)
+
+ @staticmethod
+ def write(value, buf):
+ _UniffiFfiConverterTypeSandbox.write(value.sandbox, buf)
+ _UniffiFfiConverterString.write(value.service, buf)
+ _UniffiFfiConverterOptionalString.write(value.label, buf)
+ _UniffiFfiConverterUInt32.write(value.expires_in_seconds, buf)
+
@dataclass
@@ -2329,29 +2564,6 @@ class _UniffiFfiConverterTypeCreateTemplateRequest(_UniffiConverterRustBuffer):
_UniffiFfiConverterString.write(value.name, buf)
fleet_sdk._UniffiFfiConverterTypeOSGymSandboxTemplateSpec.write(value.spec, buf)
-class _UniffiFfiConverterSequenceString(_UniffiConverterRustBuffer):
- @classmethod
- def check_lower(cls, value):
- for item in value:
- _UniffiFfiConverterString.check_lower(item)
-
- @classmethod
- def write(cls, value, buf):
- items = len(value)
- buf.write_i32(items)
- for item in value:
- _UniffiFfiConverterString.write(item, buf)
-
- @classmethod
- def read(cls, buf):
- count = buf.read_i32()
- if count < 0:
- raise InternalError("Unexpected negative sequence length")
-
- return [
- _UniffiFfiConverterString.read(buf) for i in range(count)
- ]
-
@dataclass
class CreateUserApiKeyRequest:
def __init__(self, *, name:str, scope:typing.List[str]):
@@ -2474,19 +2686,6 @@ class _UniffiFfiConverterUInt64(_UniffiConverterPrimitiveInt):
def write(value, buf):
buf.write_u64(value)
-class _UniffiFfiConverterUInt32(_UniffiConverterPrimitiveInt):
- CLASS_NAME = "u32"
- VALUE_MIN = 0
- VALUE_MAX = 2**32
-
- @staticmethod
- def read(buf):
- return buf.read_u32()
-
- @staticmethod
- def write(value, buf):
- buf.write_u32(value)
-
@dataclass
class CyclopsConfiguration:
def __init__(self, *, base_url:str, token_url:str, credentials:CyclopsCredentials, pool_poll_interval_ms:int, pool_poll_limit:int, claim_poll_interval_ms:int, claim_poll_limit:int):
@@ -3057,52 +3256,88 @@ class _UniffiFfiConverterTypePoolDisplayStatus(_UniffiConverterRustBuffer):
_UniffiFfiConverterString.write(value.indicator, buf)
@dataclass
-class Sandbox:
- def __init__(self, *, namespace:str, claim:str, name:str, services:typing.List[str]):
+class SignedServiceUrl:
+ def __init__(self, *, id:str, namespace:str, claim:str, sandbox:str, service:str, label:typing.Optional[str], url:str, created_at:str, expires_at:str, revoked_at:typing.Optional[str]):
+ self.id = id
self.namespace = namespace
self.claim = claim
- self.name = name
- self.services = services
+ self.sandbox = sandbox
+ self.service = service
+ self.label = label
+ self.url = url
+ self.created_at = created_at
+ self.expires_at = expires_at
+ self.revoked_at = revoked_at
def __str__(self):
- return "Sandbox(namespace={}, claim={}, name={}, services={})".format(self.namespace, self.claim, self.name, self.services)
+ return "SignedServiceUrl(id={}, namespace={}, claim={}, sandbox={}, service={}, label={}, url={}, created_at={}, expires_at={}, revoked_at={})".format(self.id, self.namespace, self.claim, self.sandbox, self.service, self.label, self.url, self.created_at, self.expires_at, self.revoked_at)
def __eq__(self, other):
+ if self.id != other.id:
+ return False
if self.namespace != other.namespace:
return False
if self.claim != other.claim:
return False
- if self.name != other.name:
+ if self.sandbox != other.sandbox:
return False
- if self.services != other.services:
+ if self.service != other.service:
+ return False
+ if self.label != other.label:
+ return False
+ if self.url != other.url:
+ return False
+ if self.created_at != other.created_at:
+ return False
+ if self.expires_at != other.expires_at:
+ return False
+ if self.revoked_at != other.revoked_at:
return False
return True
-class _UniffiFfiConverterTypeSandbox(_UniffiConverterRustBuffer):
+class _UniffiFfiConverterTypeSignedServiceUrl(_UniffiConverterRustBuffer):
@staticmethod
def read(buf):
- return Sandbox(
+ return SignedServiceUrl(
+ id=_UniffiFfiConverterString.read(buf),
namespace=_UniffiFfiConverterString.read(buf),
claim=_UniffiFfiConverterString.read(buf),
- name=_UniffiFfiConverterString.read(buf),
- services=_UniffiFfiConverterSequenceString.read(buf),
+ sandbox=_UniffiFfiConverterString.read(buf),
+ service=_UniffiFfiConverterString.read(buf),
+ label=_UniffiFfiConverterOptionalString.read(buf),
+ url=_UniffiFfiConverterString.read(buf),
+ created_at=_UniffiFfiConverterString.read(buf),
+ expires_at=_UniffiFfiConverterString.read(buf),
+ revoked_at=_UniffiFfiConverterOptionalString.read(buf),
)
@staticmethod
def check_lower(value):
+ _UniffiFfiConverterString.check_lower(value.id)
_UniffiFfiConverterString.check_lower(value.namespace)
_UniffiFfiConverterString.check_lower(value.claim)
- _UniffiFfiConverterString.check_lower(value.name)
- _UniffiFfiConverterSequenceString.check_lower(value.services)
+ _UniffiFfiConverterString.check_lower(value.sandbox)
+ _UniffiFfiConverterString.check_lower(value.service)
+ _UniffiFfiConverterOptionalString.check_lower(value.label)
+ _UniffiFfiConverterString.check_lower(value.url)
+ _UniffiFfiConverterString.check_lower(value.created_at)
+ _UniffiFfiConverterString.check_lower(value.expires_at)
+ _UniffiFfiConverterOptionalString.check_lower(value.revoked_at)
@staticmethod
def write(value, buf):
+ _UniffiFfiConverterString.write(value.id, buf)
_UniffiFfiConverterString.write(value.namespace, buf)
_UniffiFfiConverterString.write(value.claim, buf)
- _UniffiFfiConverterString.write(value.name, buf)
- _UniffiFfiConverterSequenceString.write(value.services, buf)
+ _UniffiFfiConverterString.write(value.sandbox, buf)
+ _UniffiFfiConverterString.write(value.service, buf)
+ _UniffiFfiConverterOptionalString.write(value.label, buf)
+ _UniffiFfiConverterString.write(value.url, buf)
+ _UniffiFfiConverterString.write(value.created_at, buf)
+ _UniffiFfiConverterString.write(value.expires_at, buf)
+ _UniffiFfiConverterOptionalString.write(value.revoked_at, buf)
@dataclass
class Template:
@@ -3457,6 +3692,14 @@ class SdkError: # type: ignore
def __repr__(self):
return "SdkError.Status({})".format(str(self))
_UniffiTempSdkError.Status = Status # type: ignore
+ class SignedServiceUrlsUnavailable(_UniffiTempSdkError):
+
+ def __init__(self):
+ pass
+
+ def __repr__(self):
+ return "SdkError.SignedServiceUrlsUnavailable({})".format(str(self))
+ _UniffiTempSdkError.SignedServiceUrlsUnavailable = SignedServiceUrlsUnavailable # type: ignore
class UnknownService(_UniffiTempSdkError):
def __init__(self, requested, available):
@@ -3557,23 +3800,26 @@ class _UniffiFfiConverterTypeSdkError(_UniffiConverterRustBuffer):
_UniffiFfiConverterString.read(buf),
)
if variant == 7:
+ return SdkError.SignedServiceUrlsUnavailable(
+ )
+ if variant == 8:
return SdkError.UnknownService(
_UniffiFfiConverterString.read(buf),
_UniffiFfiConverterSequenceString.read(buf),
)
- if variant == 8:
+ if variant == 9:
return SdkError.InvalidServicePath(
_UniffiFfiConverterString.read(buf),
)
- if variant == 9:
+ if variant == 10:
return SdkError.ClaimFailed(
_UniffiFfiConverterString.read(buf),
_UniffiFfiConverterString.read(buf),
)
- if variant == 10:
+ if variant == 11:
return SdkError.ClaimTimeout(
)
- if variant == 11:
+ if variant == 12:
return SdkError.PoolAccessDenied(
_UniffiFfiConverterString.read(buf),
_UniffiFfiConverterString.read(buf),
@@ -3606,6 +3852,8 @@ class _UniffiFfiConverterTypeSdkError(_UniffiConverterRustBuffer):
_UniffiFfiConverterUInt16.check_lower(value.status)
_UniffiFfiConverterString.check_lower(value.body)
return
+ if isinstance(value, SdkError.SignedServiceUrlsUnavailable):
+ return
if isinstance(value, SdkError.UnknownService):
_UniffiFfiConverterString.check_lower(value.requested)
_UniffiFfiConverterSequenceString.check_lower(value.available)
@@ -3650,21 +3898,23 @@ class _UniffiFfiConverterTypeSdkError(_UniffiConverterRustBuffer):
_UniffiFfiConverterString.write(value.operation, buf)
_UniffiFfiConverterUInt16.write(value.status, buf)
_UniffiFfiConverterString.write(value.body, buf)
- if isinstance(value, SdkError.UnknownService):
+ if isinstance(value, SdkError.SignedServiceUrlsUnavailable):
buf.write_i32(7)
+ if isinstance(value, SdkError.UnknownService):
+ buf.write_i32(8)
_UniffiFfiConverterString.write(value.requested, buf)
_UniffiFfiConverterSequenceString.write(value.available, buf)
if isinstance(value, SdkError.InvalidServicePath):
- buf.write_i32(8)
+ buf.write_i32(9)
_UniffiFfiConverterString.write(value.path, buf)
if isinstance(value, SdkError.ClaimFailed):
- buf.write_i32(9)
+ buf.write_i32(10)
_UniffiFfiConverterString.write(value.phase, buf)
_UniffiFfiConverterString.write(value.status, buf)
if isinstance(value, SdkError.ClaimTimeout):
- buf.write_i32(10)
- if isinstance(value, SdkError.PoolAccessDenied):
buf.write_i32(11)
+ if isinstance(value, SdkError.PoolAccessDenied):
+ buf.write_i32(12)
_UniffiFfiConverterString.write(value.operation, buf)
_UniffiFfiConverterString.write(value.namespace, buf)
_UniffiFfiConverterUInt16.write(value.status, buf)
@@ -4087,6 +4337,154 @@ class _UniffiFfiConverterTypeCreatePoolRequestBuilder:
buf.write_u64(cls.lower(value))
+class CreateSignedServiceUrlRequestBuilderProtocol(typing.Protocol):
+
+ def build(self, ) -> CreateSignedServiceUrlRequest:
+ raise NotImplementedError
+ def expires_in_seconds(self, value: int) -> CreateSignedServiceUrlRequestBuilder:
+ raise NotImplementedError
+ def label(self, value: str) -> CreateSignedServiceUrlRequestBuilder:
+ raise NotImplementedError
+ def sandbox(self, value: Sandbox) -> CreateSignedServiceUrlRequestBuilder:
+ raise NotImplementedError
+ def service(self, value: str) -> CreateSignedServiceUrlRequestBuilder:
+ raise NotImplementedError
+
+class CreateSignedServiceUrlRequestBuilder(CreateSignedServiceUrlRequestBuilderProtocol):
+
+ _handle: ctypes.c_uint64
+ def __init__(self, ):
+ _uniffi_lowered_args = (
+ )
+ _uniffi_lift_return = _UniffiFfiConverterTypeCreateSignedServiceUrlRequestBuilder.lift
+ _uniffi_error_converter = None
+ _uniffi_ffi_result = _uniffi_rust_call_with_error(
+ _uniffi_error_converter,
+ _UniffiLib.uniffi_cyclops_sdk_fn_constructor_createsignedserviceurlrequestbuilder_new,
+ *_uniffi_lowered_args,
+ )
+ self._handle = _uniffi_ffi_result
+
+ def __del__(self):
+ # In case of partial initialization of instances.
+ handle = getattr(self, "_handle", None)
+ if handle is not None:
+ _uniffi_rust_call(_UniffiLib.uniffi_cyclops_sdk_fn_free_createsignedserviceurlrequestbuilder, handle)
+
+ def _uniffi_clone_handle(self):
+ return _uniffi_rust_call(_UniffiLib.uniffi_cyclops_sdk_fn_clone_createsignedserviceurlrequestbuilder, self._handle)
+
+ # Used by alternative constructors or any methods which return this type.
+ @classmethod
+ def _uniffi_make_instance(cls, handle):
+ # Lightly yucky way to bypass the usual __init__ logic
+ # and just create a new instance with the required handle.
+ inst = cls.__new__(cls)
+ inst._handle = handle
+ return inst
+ def build(self, ) -> CreateSignedServiceUrlRequest:
+ _uniffi_lowered_args = (
+ self._uniffi_clone_handle(),
+ )
+ _uniffi_lift_return = _UniffiFfiConverterTypeCreateSignedServiceUrlRequest.lift
+ _uniffi_error_converter = _UniffiFfiConverterTypeSdkBuildError
+ _uniffi_ffi_result = _uniffi_rust_call_with_error(
+ _uniffi_error_converter,
+ _UniffiLib.uniffi_cyclops_sdk_fn_method_createsignedserviceurlrequestbuilder_build,
+ *_uniffi_lowered_args,
+ )
+ return _uniffi_lift_return(_uniffi_ffi_result)
+ def expires_in_seconds(self, value: int) -> CreateSignedServiceUrlRequestBuilder:
+
+ _UniffiFfiConverterUInt32.check_lower(value)
+ _uniffi_lowered_args = (
+ self._uniffi_clone_handle(),
+ _UniffiFfiConverterUInt32.lower(value),
+ )
+ _uniffi_lift_return = _UniffiFfiConverterTypeCreateSignedServiceUrlRequestBuilder.lift
+ _uniffi_error_converter = None
+ _uniffi_ffi_result = _uniffi_rust_call_with_error(
+ _uniffi_error_converter,
+ _UniffiLib.uniffi_cyclops_sdk_fn_method_createsignedserviceurlrequestbuilder_expires_in_seconds,
+ *_uniffi_lowered_args,
+ )
+ return _uniffi_lift_return(_uniffi_ffi_result)
+ def label(self, value: str) -> CreateSignedServiceUrlRequestBuilder:
+
+ _UniffiFfiConverterString.check_lower(value)
+ _uniffi_lowered_args = (
+ self._uniffi_clone_handle(),
+ _UniffiFfiConverterString.lower(value),
+ )
+ _uniffi_lift_return = _UniffiFfiConverterTypeCreateSignedServiceUrlRequestBuilder.lift
+ _uniffi_error_converter = None
+ _uniffi_ffi_result = _uniffi_rust_call_with_error(
+ _uniffi_error_converter,
+ _UniffiLib.uniffi_cyclops_sdk_fn_method_createsignedserviceurlrequestbuilder_label,
+ *_uniffi_lowered_args,
+ )
+ return _uniffi_lift_return(_uniffi_ffi_result)
+ def sandbox(self, value: Sandbox) -> CreateSignedServiceUrlRequestBuilder:
+
+ _UniffiFfiConverterTypeSandbox.check_lower(value)
+ _uniffi_lowered_args = (
+ self._uniffi_clone_handle(),
+ _UniffiFfiConverterTypeSandbox.lower(value),
+ )
+ _uniffi_lift_return = _UniffiFfiConverterTypeCreateSignedServiceUrlRequestBuilder.lift
+ _uniffi_error_converter = None
+ _uniffi_ffi_result = _uniffi_rust_call_with_error(
+ _uniffi_error_converter,
+ _UniffiLib.uniffi_cyclops_sdk_fn_method_createsignedserviceurlrequestbuilder_sandbox,
+ *_uniffi_lowered_args,
+ )
+ return _uniffi_lift_return(_uniffi_ffi_result)
+ def service(self, value: str) -> CreateSignedServiceUrlRequestBuilder:
+
+ _UniffiFfiConverterString.check_lower(value)
+ _uniffi_lowered_args = (
+ self._uniffi_clone_handle(),
+ _UniffiFfiConverterString.lower(value),
+ )
+ _uniffi_lift_return = _UniffiFfiConverterTypeCreateSignedServiceUrlRequestBuilder.lift
+ _uniffi_error_converter = None
+ _uniffi_ffi_result = _uniffi_rust_call_with_error(
+ _uniffi_error_converter,
+ _UniffiLib.uniffi_cyclops_sdk_fn_method_createsignedserviceurlrequestbuilder_service,
+ *_uniffi_lowered_args,
+ )
+ return _uniffi_lift_return(_uniffi_ffi_result)
+
+
+
+
+
+class _UniffiFfiConverterTypeCreateSignedServiceUrlRequestBuilder:
+ @staticmethod
+ def lift(value: int) -> CreateSignedServiceUrlRequestBuilder:
+ return CreateSignedServiceUrlRequestBuilder._uniffi_make_instance(value)
+
+ @staticmethod
+ def check_lower(value: CreateSignedServiceUrlRequestBuilder):
+ if not isinstance(value, CreateSignedServiceUrlRequestBuilder):
+ raise TypeError("Expected CreateSignedServiceUrlRequestBuilder instance, {} found".format(type(value).__name__))
+
+ @staticmethod
+ def lower(value: CreateSignedServiceUrlRequestBuilder) -> ctypes.c_uint64:
+ return value._uniffi_clone_handle()
+
+ @classmethod
+ def read(cls, buf: _UniffiRustBuffer) -> CreateSignedServiceUrlRequestBuilder:
+ ptr = buf.read_u64()
+ if ptr == 0:
+ raise InternalError("Raw handle value was null")
+ return cls.lift(ptr)
+
+ @classmethod
+ def write(cls, value: CreateSignedServiceUrlRequestBuilder, buf: _UniffiRustBuffer):
+ buf.write_u64(cls.lower(value))
+
+
class CreateTemplateRequestBuilderProtocol(typing.Protocol):
def build(self, ) -> CreateTemplateRequest:
@@ -4400,6 +4798,29 @@ class _UniffiFfiConverterSequenceTypePool(_UniffiConverterRustBuffer):
_UniffiFfiConverterTypePool.read(buf) for i in range(count)
]
+class _UniffiFfiConverterSequenceTypeSignedServiceUrl(_UniffiConverterRustBuffer):
+ @classmethod
+ def check_lower(cls, value):
+ for item in value:
+ _UniffiFfiConverterTypeSignedServiceUrl.check_lower(item)
+
+ @classmethod
+ def write(cls, value, buf):
+ items = len(value)
+ buf.write_i32(items)
+ for item in value:
+ _UniffiFfiConverterTypeSignedServiceUrl.write(item, buf)
+
+ @classmethod
+ def read(cls, buf):
+ count = buf.read_i32()
+ if count < 0:
+ raise InternalError("Unexpected negative sequence length")
+
+ return [
+ _UniffiFfiConverterTypeSignedServiceUrl.read(buf) for i in range(count)
+ ]
+
class _UniffiFfiConverterSequenceTypeTemplate(_UniffiConverterRustBuffer):
@classmethod
def check_lower(cls, value):
@@ -4455,6 +4876,8 @@ class CyclopsClientProtocol(typing.Protocol):
raise NotImplementedError
async def create_pool(self, request: CreatePoolRequest) -> Pool:
raise NotImplementedError
+ async def create_signed_service_url(self, request: CreateSignedServiceUrlRequest) -> SignedServiceUrl:
+ raise NotImplementedError
async def create_template(self, request: CreateTemplateRequest) -> Template:
raise NotImplementedError
async def create_user_api_key(self, request: CreateUserApiKeyRequest) -> NewUserApiKey:
@@ -4483,6 +4906,8 @@ class CyclopsClientProtocol(typing.Protocol):
raise NotImplementedError
async def list_pools(self, namespace: str) -> typing.List[Pool]:
raise NotImplementedError
+ async def list_signed_service_urls(self, sandbox: Sandbox) -> typing.List[SignedServiceUrl]:
+ raise NotImplementedError
async def list_templates(self, namespace: str) -> typing.List[Template]:
raise NotImplementedError
async def list_user_api_keys(self, ) -> typing.List[UserApiKey]:
@@ -4501,6 +4926,8 @@ class CyclopsClientProtocol(typing.Protocol):
can be mutated through the SDK.
"""
raise NotImplementedError
+ async def revoke_signed_service_url(self, signed_service_url: SignedServiceUrl) -> None:
+ 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:
@@ -4714,6 +5141,23 @@ class CyclopsClient(CyclopsClientProtocol):
_uniffi_lift_return,
_uniffi_error_converter,
)
+ async def create_signed_service_url(self, request: CreateSignedServiceUrlRequest) -> SignedServiceUrl:
+
+ _UniffiFfiConverterTypeCreateSignedServiceUrlRequest.check_lower(request)
+ _uniffi_lowered_args = (
+ self._uniffi_clone_handle(),
+ _UniffiFfiConverterTypeCreateSignedServiceUrlRequest.lower(request),
+ )
+ _uniffi_lift_return = _UniffiFfiConverterTypeSignedServiceUrl.lift
+ _uniffi_error_converter = _UniffiFfiConverterTypeSdkError
+ return await _uniffi_rust_call_async(
+ _UniffiLib.uniffi_cyclops_sdk_fn_method_cyclopsclient_create_signed_service_url(*_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 create_template(self, request: CreateTemplateRequest) -> Template:
_UniffiFfiConverterTypeCreateTemplateRequest.check_lower(request)
@@ -4952,6 +5396,23 @@ class CyclopsClient(CyclopsClientProtocol):
_uniffi_lift_return,
_uniffi_error_converter,
)
+ async def list_signed_service_urls(self, sandbox: Sandbox) -> typing.List[SignedServiceUrl]:
+
+ _UniffiFfiConverterTypeSandbox.check_lower(sandbox)
+ _uniffi_lowered_args = (
+ self._uniffi_clone_handle(),
+ _UniffiFfiConverterTypeSandbox.lower(sandbox),
+ )
+ _uniffi_lift_return = _UniffiFfiConverterSequenceTypeSignedServiceUrl.lift
+ _uniffi_error_converter = _UniffiFfiConverterTypeSdkError
+ return await _uniffi_rust_call_async(
+ _UniffiLib.uniffi_cyclops_sdk_fn_method_cyclopsclient_list_signed_service_urls(*_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_templates(self, namespace: str) -> typing.List[Template]:
_UniffiFfiConverterString.check_lower(namespace)
@@ -5045,6 +5506,23 @@ class CyclopsClient(CyclopsClientProtocol):
_uniffi_lift_return,
_uniffi_error_converter,
)
+ async def revoke_signed_service_url(self, signed_service_url: SignedServiceUrl) -> None:
+
+ _UniffiFfiConverterTypeSignedServiceUrl.check_lower(signed_service_url)
+ _uniffi_lowered_args = (
+ self._uniffi_clone_handle(),
+ _UniffiFfiConverterTypeSignedServiceUrl.lower(signed_service_url),
+ )
+ _uniffi_lift_return = lambda val: None
+ _uniffi_error_converter = _UniffiFfiConverterTypeSdkError
+ return await _uniffi_rust_call_async(
+ _UniffiLib.uniffi_cyclops_sdk_fn_method_cyclopsclient_revoke_signed_service_url(*_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 service_request(self, sandbox: Sandbox,service: str,path: str,request: HttpRequest) -> HttpResponse:
_UniffiFfiConverterTypeSandbox.check_lower(sandbox)
@@ -5863,6 +6341,8 @@ __all__ = [
"Pool",
"CreateClaimRequest",
"CreatePoolRequest",
+ "Sandbox",
+ "CreateSignedServiceUrlRequest",
"CreateTemplateRequest",
"CreateUserApiKeyRequest",
"CyclopsConfiguration",
@@ -5873,7 +6353,7 @@ __all__ = [
"Namespace",
"NewUserApiKey",
"PoolDisplayStatus",
- "Sandbox",
+ "SignedServiceUrl",
"Template",
"UserApiKey",
"healthy_pool_display_status",
@@ -5889,6 +6369,8 @@ __all__ = [
"CreateClaimRequestBuilderProtocol",
"CreatePoolRequestBuilder",
"CreatePoolRequestBuilderProtocol",
+ "CreateSignedServiceUrlRequestBuilder",
+ "CreateSignedServiceUrlRequestBuilderProtocol",
"CreateTemplateRequestBuilder",
"CreateTemplateRequestBuilderProtocol",
"CreateUserApiKeyRequestBuilder",
diff --git a/libs/fleet/sdk-bindings/ruby/cyclops_sdk/sdk.rb b/libs/fleet/sdk-bindings/ruby/cyclops_sdk/sdk.rb
index 77b6431628..682a13a05c 100644
--- a/libs/fleet/sdk-bindings/ruby/cyclops_sdk/sdk.rb
+++ b/libs/fleet/sdk-bindings/ruby/cyclops_sdk/sdk.rb
@@ -233,6 +233,28 @@ private_constant :UniffiHandleMap
end
end
+ # The Record type CreateSignedServiceUrlRequest.
+
+ def self.check_lower_TypeCreateSignedServiceUrlRequest(v)
+ RustBuffer.check_lower_TypeSandbox(v.sandbox)
+
+ RustBuffer.check_lower_Optionalstring(v.label)
+
+ end
+
+ def self.alloc_from_TypeCreateSignedServiceUrlRequest(v)
+ RustBuffer.allocWithBuilder do |builder|
+ builder.write_TypeCreateSignedServiceUrlRequest(v)
+ return builder.finalize
+ end
+ end
+
+ def consumeIntoTypeCreateSignedServiceUrlRequest
+ consumeWithStream do |stream|
+ return stream.readTypeCreateSignedServiceUrlRequest
+ end
+ end
+
# The Record type CreateTemplateRequest.
def self.check_lower_TypeCreateTemplateRequest(v)
@@ -519,6 +541,34 @@ private_constant :UniffiHandleMap
end
end
+ # The Record type SignedServiceUrl.
+
+ def self.check_lower_TypeSignedServiceUrl(v)
+
+
+
+
+
+ RustBuffer.check_lower_Optionalstring(v.label)
+
+
+
+ RustBuffer.check_lower_Optionalstring(v.revoked_at)
+ end
+
+ def self.alloc_from_TypeSignedServiceUrl(v)
+ RustBuffer.allocWithBuilder do |builder|
+ builder.write_TypeSignedServiceUrl(v)
+ return builder.finalize
+ end
+ end
+
+ def consumeIntoTypeSignedServiceUrl
+ consumeWithStream do |stream|
+ return stream.readTypeSignedServiceUrl
+ end
+ end
+
# The Record type Template.
def self.check_lower_TypeTemplate(v)
@@ -842,6 +892,27 @@ private_constant :UniffiHandleMap
end
end
+ # The Sequence<T> type for TypeSignedServiceUrl.
+
+ def self.check_lower_SequenceTypeSignedServiceUrl(v)
+ v.each do |item|
+ RustBuffer.check_lower_TypeSignedServiceUrl(item)
+ end
+ end
+
+ def self.alloc_from_SequenceTypeSignedServiceUrl(v)
+ RustBuffer.allocWithBuilder do |builder|
+ builder.write_SequenceTypeSignedServiceUrl(v)
+ return builder.finalize()
+ end
+ end
+
+ def consumeIntoSequenceTypeSignedServiceUrl
+ consumeWithStream do |stream|
+ return stream.readSequenceTypeSignedServiceUrl
+ end
+ end
+
# The Sequence<T> type for TypeTemplate.
def self.check_lower_SequenceTypeTemplate(v)
@@ -1008,6 +1079,13 @@ class RustBufferStream
return CreatePoolRequestBuilder.uniffi_allocate(handle)
end
+ # The Object type CreateSignedServiceUrlRequestBuilder.
+
+ def readTypeCreateSignedServiceUrlRequestBuilder
+ handle = unpack_from 8, 'Q>'
+ return CreateSignedServiceUrlRequestBuilder.uniffi_allocate(handle)
+ end
+
# The Object type CreateTemplateRequestBuilder.
def readTypeCreateTemplateRequestBuilder
@@ -1095,6 +1173,17 @@ class RustBufferStream
)
end
+ # The Record type CreateSignedServiceUrlRequest.
+
+ def readTypeCreateSignedServiceUrlRequest
+ CreateSignedServiceUrlRequest.new(
+ sandbox: readTypeSandbox,
+ service: readString,
+ label: readOptionalstring,
+ expires_in_seconds: readU32
+ )
+ end
+
# The Record type CreateTemplateRequest.
def readTypeCreateTemplateRequest
@@ -1238,6 +1327,23 @@ class RustBufferStream
)
end
+ # The Record type SignedServiceUrl.
+
+ def readTypeSignedServiceUrl
+ SignedServiceUrl.new(
+ id: readString,
+ namespace: readString,
+ claim: readString,
+ sandbox: readString,
+ service: readString,
+ label: readOptionalstring,
+ url: readString,
+ created_at: readString,
+ expires_at: readString,
+ revoked_at: readOptionalstring
+ )
+ end
+
# The Record type Template.
def readTypeTemplate
@@ -1390,26 +1496,29 @@ class RustBufferStream
)
end
if variant == 7
+ return SdkError::SignedServiceUrlsUnavailable.new
+ end
+ if variant == 8
return SdkError::UnknownService.new(
readString(),
readSequencestring()
)
end
- if variant == 8
+ if variant == 9
return SdkError::InvalidServicePath.new(
readString()
)
end
- if variant == 9
+ if variant == 10
return SdkError::ClaimFailed.new(
readString(),
readString()
)
end
- if variant == 10
+ if variant == 11
return SdkError::ClaimTimeout.new
end
- if variant == 11
+ if variant == 12
return SdkError::PoolAccessDenied.new(
readString(),
readString(),
@@ -1600,6 +1709,22 @@ class RustBufferStream
items
end
+ # The Sequence<T> type for TypeSignedServiceUrl.
+
+ def readSequenceTypeSignedServiceUrl
+ count = unpack_from 4, 'l>'
+
+ raise InternalError, 'Unexpected negative sequence length' if count.negative?
+
+ items = []
+
+ count.times do
+ items.append readTypeSignedServiceUrl
+ end
+
+ items
+ end
+
# The Sequence<T> type for TypeTemplate.
def readSequenceTypeTemplate
@@ -1743,6 +1868,13 @@ class RustBufferBuilder
pack_into(8, 'Q>', handle)
end
+ # The Object type CreateSignedServiceUrlRequestBuilder.
+
+ def write_TypeCreateSignedServiceUrlRequestBuilder(obj)
+ handle = CreateSignedServiceUrlRequestBuilder.uniffi_lower obj
+ pack_into(8, 'Q>', handle)
+ end
+
# The Object type CreateTemplateRequestBuilder.
def write_TypeCreateTemplateRequestBuilder(obj)
@@ -1824,6 +1956,15 @@ class RustBufferBuilder
self.write_TypeOSGymSandboxWarmPoolSpec(v.spec)
end
+ # The Record type CreateSignedServiceUrlRequest.
+
+ def write_TypeCreateSignedServiceUrlRequest(v)
+ self.write_TypeSandbox(v.sandbox)
+ self.write_String(v.service)
+ self.write_Optionalstring(v.label)
+ self.write_U32(v.expires_in_seconds)
+ end
+
# The Record type CreateTemplateRequest.
def write_TypeCreateTemplateRequest(v)
@@ -1941,6 +2082,21 @@ class RustBufferBuilder
self.write_Sequencestring(v.services)
end
+ # The Record type SignedServiceUrl.
+
+ def write_TypeSignedServiceUrl(v)
+ self.write_String(v.id)
+ self.write_String(v.namespace)
+ self.write_String(v.claim)
+ self.write_String(v.sandbox)
+ self.write_String(v.service)
+ self.write_Optionalstring(v.label)
+ self.write_String(v.url)
+ self.write_String(v.created_at)
+ self.write_String(v.expires_at)
+ self.write_Optionalstring(v.revoked_at)
+ end
+
# The Record type Template.
def write_TypeTemplate(v)
@@ -2101,6 +2257,16 @@ class RustBufferBuilder
end
end
+ # The Sequence<T> type for TypeSignedServiceUrl.
+
+ def write_SequenceTypeSignedServiceUrl(items)
+ pack_into(4, 'l>', items.size)
+
+ items.each do |item|
+ self.write_TypeSignedServiceUrl(item)
+ end
+ end
+
# The Sequence<T> type for TypeTemplate.
def write_SequenceTypeTemplate(items)
@@ -2318,6 +2484,15 @@ module SdkError
"#{self.class.name}(operation=#{@operation.inspect}, status=#{@status.inspect}, body=#{@body.inspect})"
end
end
+ class SignedServiceUrlsUnavailable < StandardError
+ def initialize()
+ super()
+ end
+
+ def to_s
+ "#{self.class.name}()"
+ end
+ end
class UnknownService < StandardError
def initialize(requested, available)
@requested = requested
@@ -2690,6 +2865,15 @@ 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_signed_service_url,
+ [:uint64, RustBuffer.by_value, RustCallStatus.by_ref],
+ :uint64
+ attach_function :uniffi_cyclops_sdk_fn_method_cyclopsclient_list_signed_service_urls,
+ [:uint64, RustBuffer.by_value, RustCallStatus.by_ref],
+ :uint64
+ attach_function :uniffi_cyclops_sdk_fn_method_cyclopsclient_revoke_signed_service_url,
+ [:uint64, 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
@@ -2808,6 +2992,30 @@ module UniFFILib
attach_function :uniffi_cyclops_sdk_fn_method_createpoolrequestbuilder_spec,
[:uint64, RustBuffer.by_value, RustCallStatus.by_ref],
:uint64
+ attach_function :uniffi_cyclops_sdk_fn_clone_createsignedserviceurlrequestbuilder,
+ [:uint64, RustCallStatus.by_ref],
+ :uint64
+ attach_function :uniffi_cyclops_sdk_fn_free_createsignedserviceurlrequestbuilder,
+ [:uint64, RustCallStatus.by_ref],
+ :void
+ attach_function :uniffi_cyclops_sdk_fn_constructor_createsignedserviceurlrequestbuilder_new,
+ [RustCallStatus.by_ref],
+ :uint64
+ attach_function :uniffi_cyclops_sdk_fn_method_createsignedserviceurlrequestbuilder_build,
+ [:uint64, RustCallStatus.by_ref],
+ RustBuffer.by_value
+ attach_function :uniffi_cyclops_sdk_fn_method_createsignedserviceurlrequestbuilder_expires_in_seconds,
+ [:uint64, :uint32, RustCallStatus.by_ref],
+ :uint64
+ attach_function :uniffi_cyclops_sdk_fn_method_createsignedserviceurlrequestbuilder_label,
+ [:uint64, RustBuffer.by_value, RustCallStatus.by_ref],
+ :uint64
+ attach_function :uniffi_cyclops_sdk_fn_method_createsignedserviceurlrequestbuilder_sandbox,
+ [:uint64, RustBuffer.by_value, RustCallStatus.by_ref],
+ :uint64
+ attach_function :uniffi_cyclops_sdk_fn_method_createsignedserviceurlrequestbuilder_service,
+ [:uint64, RustBuffer.by_value, RustCallStatus.by_ref],
+ :uint64
attach_function :uniffi_cyclops_sdk_fn_clone_createtemplaterequestbuilder,
[:uint64, RustCallStatus.by_ref],
:uint64
@@ -3027,6 +3235,15 @@ 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_signed_service_url,
+ [RustCallStatus.by_ref],
+ :uint16
+ attach_function :uniffi_cyclops_sdk_checksum_method_cyclopsclient_list_signed_service_urls,
+ [RustCallStatus.by_ref],
+ :uint16
+ attach_function :uniffi_cyclops_sdk_checksum_method_cyclopsclient_revoke_signed_service_url,
+ [RustCallStatus.by_ref],
+ :uint16
attach_function :uniffi_cyclops_sdk_checksum_method_cyclopsclient_create_template,
[RustCallStatus.by_ref],
:uint16
@@ -3081,6 +3298,21 @@ module UniFFILib
attach_function :uniffi_cyclops_sdk_checksum_method_createpoolrequestbuilder_spec,
[RustCallStatus.by_ref],
:uint16
+ attach_function :uniffi_cyclops_sdk_checksum_method_createsignedserviceurlrequestbuilder_build,
+ [RustCallStatus.by_ref],
+ :uint16
+ attach_function :uniffi_cyclops_sdk_checksum_method_createsignedserviceurlrequestbuilder_expires_in_seconds,
+ [RustCallStatus.by_ref],
+ :uint16
+ attach_function :uniffi_cyclops_sdk_checksum_method_createsignedserviceurlrequestbuilder_label,
+ [RustCallStatus.by_ref],
+ :uint16
+ attach_function :uniffi_cyclops_sdk_checksum_method_createsignedserviceurlrequestbuilder_sandbox,
+ [RustCallStatus.by_ref],
+ :uint16
+ attach_function :uniffi_cyclops_sdk_checksum_method_createsignedserviceurlrequestbuilder_service,
+ [RustCallStatus.by_ref],
+ :uint16
attach_function :uniffi_cyclops_sdk_checksum_method_createtemplaterequestbuilder_build,
[RustCallStatus.by_ref],
:uint16
@@ -3180,6 +3412,9 @@ module UniFFILib
attach_function :uniffi_cyclops_sdk_checksum_constructor_createpoolrequestbuilder_new,
[RustCallStatus.by_ref],
:uint16
+ attach_function :uniffi_cyclops_sdk_checksum_constructor_createsignedserviceurlrequestbuilder_new,
+ [RustCallStatus.by_ref],
+ :uint16
attach_function :uniffi_cyclops_sdk_checksum_constructor_createtemplaterequestbuilder_new,
[RustCallStatus.by_ref],
:uint16
@@ -3329,6 +3564,35 @@ class CreatePoolRequest
end
end
+ # Record type CreateSignedServiceUrlRequest
+class CreateSignedServiceUrlRequest
+ attr_reader :sandbox, :service, :label, :expires_in_seconds
+
+ def initialize(sandbox:, service:, label:, expires_in_seconds:)
+ @sandbox = sandbox
+ @service = service
+ @label = label
+ @expires_in_seconds = expires_in_seconds
+ end
+
+ def ==(other)
+ if @sandbox != other.sandbox
+ return false
+ end
+ if @service != other.service
+ return false
+ end
+ if @label != other.label
+ return false
+ end
+ if @expires_in_seconds != other.expires_in_seconds
+ return false
+ end
+
+ true
+ end
+end
+
# Record type CreateTemplateRequest
class CreateTemplateRequest
attr_reader :namespace, :name, :spec
@@ -3681,6 +3945,59 @@ class Sandbox
end
end
+ # Record type SignedServiceUrl
+class SignedServiceUrl
+ attr_reader :id, :namespace, :claim, :sandbox, :service, :label, :url, :created_at, :expires_at, :revoked_at
+
+ def initialize(id:, namespace:, claim:, sandbox:, service:, label:, url:, created_at:, expires_at:, revoked_at:)
+ @id = id
+ @namespace = namespace
+ @claim = claim
+ @sandbox = sandbox
+ @service = service
+ @label = label
+ @url = url
+ @created_at = created_at
+ @expires_at = expires_at
+ @revoked_at = revoked_at
+ end
+
+ def ==(other)
+ if @id != other.id
+ return false
+ end
+ if @namespace != other.namespace
+ return false
+ end
+ if @claim != other.claim
+ return false
+ end
+ if @sandbox != other.sandbox
+ return false
+ end
+ if @service != other.service
+ return false
+ end
+ if @label != other.label
+ return false
+ end
+ if @url != other.url
+ return false
+ end
+ if @created_at != other.created_at
+ return false
+ end
+ if @expires_at != other.expires_at
+ return false
+ end
+ if @revoked_at != other.revoked_at
+ return false
+ end
+
+ true
+ end
+end
+
# Record type Template
class Template
attr_reader :api_version, :kind, :metadata, :spec
@@ -4088,6 +4405,33 @@ end
)
return result.consumeIntoTypeHttpResponse
end
+ def create_signed_service_url(request)
+ request = request
+ RustBuffer.check_lower_TypeCreateSignedServiceUrlRequest(request)
+ result = FleetSdk.uniffi_rust_future_rust_buffer(
+ SdkError,
+ UniFFILib.uniffi_cyclops_sdk_fn_method_cyclopsclient_create_signed_service_url(uniffi_clone_handle(),RustBuffer.alloc_from_TypeCreateSignedServiceUrlRequest(request),RustCallStatus.new),
+ )
+ return result.consumeIntoTypeSignedServiceUrl
+ end
+ def list_signed_service_urls(sandbox)
+ sandbox = sandbox
+ RustBuffer.check_lower_TypeSandbox(sandbox)
+ result = FleetSdk.uniffi_rust_future_rust_buffer(
+ SdkError,
+ UniFFILib.uniffi_cyclops_sdk_fn_method_cyclopsclient_list_signed_service_urls(uniffi_clone_handle(),RustBuffer.alloc_from_TypeSandbox(sandbox),RustCallStatus.new),
+ )
+ return result.consumeIntoSequenceTypeSignedServiceUrl
+ end
+ def revoke_signed_service_url(signed_service_url)
+ signed_service_url = signed_service_url
+ RustBuffer.check_lower_TypeSignedServiceUrl(signed_service_url)
+ FleetSdk.uniffi_rust_future_void(
+ SdkError,
+ UniFFILib.uniffi_cyclops_sdk_fn_method_cyclopsclient_revoke_signed_service_url(uniffi_clone_handle(),RustBuffer.alloc_from_TypeSignedServiceUrl(signed_service_url),RustCallStatus.new),
+ )
+ end
+
def create_template(request)
request = request
RustBuffer.check_lower_TypeCreateTemplateRequest(request)
@@ -4447,6 +4791,87 @@ end
return CreatePoolRequestBuilder.uniffi_allocate(result)
end
+end
+
+ class CreateSignedServiceUrlRequestBuilder
+
+ # A private helper for initializing instances of the class from a raw handle,
+ # bypassing any initialization logic and ensuring they are GC'd properly.
+ def self.uniffi_allocate(handle)
+ inst = allocate
+ inst.instance_variable_set :@handle, handle
+ ObjectSpace.define_finalizer(inst, uniffi_define_finalizer_by_handle(handle, inst.object_id))
+ return inst
+ end
+
+ # A private helper for registering an object finalizer.
+ # N.B. it's important that this does not capture a reference
+ # to the actual instance, only its underlying handle.
+ def self.uniffi_define_finalizer_by_handle(handle, object_id)
+ Proc.new do |_id|
+ FleetSdk.rust_call(
+ :uniffi_cyclops_sdk_fn_free_createsignedserviceurlrequestbuilder,
+ handle
+ )
+ end
+ end
+
+ # A private helper for lowering instances into a raw handle.
+ # This does an explicit typecheck, because accidentally lowering a different type of
+ # object in a place where this type is expected, could lead to memory unsafety.
+ def self.uniffi_check_lower(inst)
+ if not inst.is_a? self
+ raise TypeError.new "Expected a CreateSignedServiceUrlRequestBuilder instance, got #{inst}"
+ end
+ end
+
+ def uniffi_clone_handle()
+ return FleetSdk.rust_call(
+ :uniffi_cyclops_sdk_fn_clone_createsignedserviceurlrequestbuilder,
+ @handle
+ )
+ end
+
+ def self.uniffi_lower(inst)
+ return inst.uniffi_clone_handle()
+ end
+ def initialize()
+ handle = FleetSdk.rust_call(:uniffi_cyclops_sdk_fn_constructor_createsignedserviceurlrequestbuilder_new,)
+ @handle = handle
+ ObjectSpace.define_finalizer(self, self.class.uniffi_define_finalizer_by_handle(handle, self.object_id))
+ end
+
+
+
+ def build()
+ result = FleetSdk.rust_call_with_error(SdkBuildError,:uniffi_cyclops_sdk_fn_method_createsignedserviceurlrequestbuilder_build,uniffi_clone_handle(),)
+ return result.consumeIntoTypeCreateSignedServiceUrlRequest
+ end
+ def expires_in_seconds(value)
+ value = FleetSdk::uniffi_in_range(value, "u32", 0, 2**32)
+
+ result = FleetSdk.rust_call(:uniffi_cyclops_sdk_fn_method_createsignedserviceurlrequestbuilder_expires_in_seconds,uniffi_clone_handle(),value)
+ return CreateSignedServiceUrlRequestBuilder.uniffi_allocate(result)
+ end
+ def label(value)
+ value = FleetSdk::uniffi_utf8(value)
+
+ result = FleetSdk.rust_call(:uniffi_cyclops_sdk_fn_method_createsignedserviceurlrequestbuilder_label,uniffi_clone_handle(),RustBuffer.allocFromString(value))
+ return CreateSignedServiceUrlRequestBuilder.uniffi_allocate(result)
+ end
+ def sandbox(value)
+ value = value
+ RustBuffer.check_lower_TypeSandbox(value)
+ result = FleetSdk.rust_call(:uniffi_cyclops_sdk_fn_method_createsignedserviceurlrequestbuilder_sandbox,uniffi_clone_handle(),RustBuffer.alloc_from_TypeSandbox(value))
+ return CreateSignedServiceUrlRequestBuilder.uniffi_allocate(result)
+ end
+ def service(value)
+ value = FleetSdk::uniffi_utf8(value)
+
+ result = FleetSdk.rust_call(:uniffi_cyclops_sdk_fn_method_createsignedserviceurlrequestbuilder_service,uniffi_clone_handle(),RustBuffer.allocFromString(value))
+ return CreateSignedServiceUrlRequestBuilder.uniffi_allocate(result)
+ end
+
end
class CreateTemplateRequestBuilder
diff --git a/libs/fleet/sdk-bindings/swift/CyclopsSdk.swift b/libs/fleet/sdk-bindings/swift/CyclopsSdk.swift
index 7b4b16cad7..c9ace835a4 100644
--- a/libs/fleet/sdk-bindings/swift/CyclopsSdk.swift
+++ b/libs/fleet/sdk-bindings/swift/CyclopsSdk.swift
@@ -1071,6 +1071,173 @@ public func FfiConverterTypeCreatePoolRequestBuilder_lower(_ value: CreatePoolRe
+public protocol CreateSignedServiceUrlRequestBuilderProtocol: AnyObject, Sendable {
+
+ func build() throws -> CreateSignedServiceUrlRequest
+
+ func expiresInSeconds(value: UInt32) -> CreateSignedServiceUrlRequestBuilder
+
+ func label(value: String) -> CreateSignedServiceUrlRequestBuilder
+
+ func sandbox(value: Sandbox) -> CreateSignedServiceUrlRequestBuilder
+
+ func service(value: String) -> CreateSignedServiceUrlRequestBuilder
+
+}
+open class CreateSignedServiceUrlRequestBuilder: CreateSignedServiceUrlRequestBuilderProtocol, @unchecked Sendable {
+ fileprivate let handle: UInt64
+
+ /// Used to instantiate a [FFIObject] without an actual handle, for fakes in tests, mostly.
+#if swift(>=5.8)
+ @_documentation(visibility: private)
+#endif
+ public struct NoHandle {
+ public init() {}
+ }
+
+ // TODO: We'd like this to be `private` but for Swifty reasons,
+ // we can't implement `FfiConverter` without making this `required` and we can't
+ // make it `required` without making it `public`.
+#if swift(>=5.8)
+ @_documentation(visibility: private)
+#endif
+ required public init(unsafeFromHandle handle: UInt64) {
+ self.handle = handle
+ }
+
+ // This constructor can be used to instantiate a fake object.
+ // - Parameter noHandle: Placeholder value so we can have a constructor separate from the default empty one that may be implemented for classes extending [FFIObject].
+ //
+ // - Warning:
+ // Any object instantiated with this constructor cannot be passed to an actual Rust-backed object. Since there isn't a backing handle the FFI lower functions will crash.
+#if swift(>=5.8)
+ @_documentation(visibility: private)
+#endif
+ public init(noHandle: NoHandle) {
+ self.handle = 0
+ }
+
+#if swift(>=5.8)
+ @_documentation(visibility: private)
+#endif
+ public func uniffiCloneHandle() -> UInt64 {
+ return try! rustCall { uniffi_cyclops_sdk_fn_clone_createsignedserviceurlrequestbuilder(self.handle, $0) }
+ }
+public convenience init() {
+ let handle =
+ try! rustCall() {
+ uniffi_cyclops_sdk_fn_constructor_createsignedserviceurlrequestbuilder_new($0
+ )
+}
+ self.init(unsafeFromHandle: handle)
+}
+
+ deinit {
+ if handle == 0 {
+ // Mock objects have handle=0 don't try to free them
+ return
+ }
+
+ try! rustCall { uniffi_cyclops_sdk_fn_free_createsignedserviceurlrequestbuilder(handle, $0) }
+ }
+
+
+
+
+open func build()throws -> CreateSignedServiceUrlRequest {
+ return try FfiConverterTypeCreateSignedServiceUrlRequest_lift(try rustCallWithError(FfiConverterTypeSdkBuildError_lift) {
+ uniffi_cyclops_sdk_fn_method_createsignedserviceurlrequestbuilder_build(
+ self.uniffiCloneHandle(),$0
+ )
+})
+}
+
+open func expiresInSeconds(value: UInt32) -> CreateSignedServiceUrlRequestBuilder {
+ return try! FfiConverterTypeCreateSignedServiceUrlRequestBuilder_lift(try! rustCall() {
+ uniffi_cyclops_sdk_fn_method_createsignedserviceurlrequestbuilder_expires_in_seconds(
+ self.uniffiCloneHandle(),
+ FfiConverterUInt32.lower(value),$0
+ )
+})
+}
+
+open func label(value: String) -> CreateSignedServiceUrlRequestBuilder {
+ return try! FfiConverterTypeCreateSignedServiceUrlRequestBuilder_lift(try! rustCall() {
+ uniffi_cyclops_sdk_fn_method_createsignedserviceurlrequestbuilder_label(
+ self.uniffiCloneHandle(),
+ FfiConverterString.lower(value),$0
+ )
+})
+}
+
+open func sandbox(value: Sandbox) -> CreateSignedServiceUrlRequestBuilder {
+ return try! FfiConverterTypeCreateSignedServiceUrlRequestBuilder_lift(try! rustCall() {
+ uniffi_cyclops_sdk_fn_method_createsignedserviceurlrequestbuilder_sandbox(
+ self.uniffiCloneHandle(),
+ FfiConverterTypeSandbox_lower(value),$0
+ )
+})
+}
+
+open func service(value: String) -> CreateSignedServiceUrlRequestBuilder {
+ return try! FfiConverterTypeCreateSignedServiceUrlRequestBuilder_lift(try! rustCall() {
+ uniffi_cyclops_sdk_fn_method_createsignedserviceurlrequestbuilder_service(
+ self.uniffiCloneHandle(),
+ FfiConverterString.lower(value),$0
+ )
+})
+}
+
+
+
+}
+
+
+#if swift(>=5.8)
+@_documentation(visibility: private)
+#endif
+public struct FfiConverterTypeCreateSignedServiceUrlRequestBuilder: FfiConverter {
+ typealias FfiType = UInt64
+ typealias SwiftType = CreateSignedServiceUrlRequestBuilder
+
+ public static func lift(_ handle: UInt64) throws -> CreateSignedServiceUrlRequestBuilder {
+ return CreateSignedServiceUrlRequestBuilder(unsafeFromHandle: handle)
+ }
+
+ public static func lower(_ value: CreateSignedServiceUrlRequestBuilder) -> UInt64 {
+ return value.uniffiCloneHandle()
+ }
+
+ public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> CreateSignedServiceUrlRequestBuilder {
+ let handle: UInt64 = try readInt(&buf)
+ return try lift(handle)
+ }
+
+ public static func write(_ value: CreateSignedServiceUrlRequestBuilder, into buf: inout [UInt8]) {
+ writeInt(&buf, lower(value))
+ }
+}
+
+
+#if swift(>=5.8)
+@_documentation(visibility: private)
+#endif
+public func FfiConverterTypeCreateSignedServiceUrlRequestBuilder_lift(_ handle: UInt64) throws -> CreateSignedServiceUrlRequestBuilder {
+ return try FfiConverterTypeCreateSignedServiceUrlRequestBuilder.lift(handle)
+}
+
+#if swift(>=5.8)
+@_documentation(visibility: private)
+#endif
+public func FfiConverterTypeCreateSignedServiceUrlRequestBuilder_lower(_ value: CreateSignedServiceUrlRequestBuilder) -> UInt64 {
+ return FfiConverterTypeCreateSignedServiceUrlRequestBuilder.lower(value)
+}
+
+
+
+
+
+
public protocol CreateTemplateRequestBuilderProtocol: AnyObject, Sendable {
func build() throws -> CreateTemplateRequest
@@ -1416,6 +1583,12 @@ public protocol CyclopsClientProtocol: AnyObject, Sendable {
func serviceRequest(sandbox: Sandbox, service: String, path: String, request: HttpRequest) async throws -> HttpResponse
+ func createSignedServiceUrl(request: CreateSignedServiceUrlRequest) async throws -> SignedServiceUrl
+
+ func listSignedServiceUrls(sandbox: Sandbox) async throws -> [SignedServiceUrl]
+
+ func revokeSignedServiceUrl(signedServiceUrl: SignedServiceUrl) async throws
+
func createTemplate(request: CreateTemplateRequest) async throws -> Template
func deleteTemplate(template: Template) async throws
@@ -1849,6 +2022,57 @@ open func serviceRequest(sandbox: Sandbox, service: String, path: String, reques
)
}
+open func createSignedServiceUrl(request: CreateSignedServiceUrlRequest)async throws -> SignedServiceUrl {
+ return
+ try await uniffiRustCallAsync(
+ rustFutureFunc: {
+ uniffi_cyclops_sdk_fn_method_cyclopsclient_create_signed_service_url(
+ self.uniffiCloneHandle(),
+ FfiConverterTypeCreateSignedServiceUrlRequest_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: FfiConverterTypeSignedServiceUrl_lift,
+ errorHandler: FfiConverterTypeSdkError_lift
+ )
+}
+
+open func listSignedServiceUrls(sandbox: Sandbox)async throws -> [SignedServiceUrl] {
+ return
+ try await uniffiRustCallAsync(
+ rustFutureFunc: {
+ uniffi_cyclops_sdk_fn_method_cyclopsclient_list_signed_service_urls(
+ self.uniffiCloneHandle(),
+ FfiConverterTypeSandbox_lower(sandbox)
+ )
+ },
+ 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: FfiConverterSequenceTypeSignedServiceUrl.lift,
+ errorHandler: FfiConverterTypeSdkError_lift
+ )
+}
+
+open func revokeSignedServiceUrl(signedServiceUrl: SignedServiceUrl)async throws {
+ return
+ try await uniffiRustCallAsync(
+ rustFutureFunc: {
+ uniffi_cyclops_sdk_fn_method_cyclopsclient_revoke_signed_service_url(
+ self.uniffiCloneHandle(),
+ FfiConverterTypeSignedServiceUrl_lower(signedServiceUrl)
+ )
+ },
+ 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 createTemplate(request: CreateTemplateRequest)async throws -> Template {
return
try await uniffiRustCallAsync(
@@ -3090,6 +3314,68 @@ public func FfiConverterTypeCreatePoolRequest_lower(_ value: CreatePoolRequest)
}
+public struct CreateSignedServiceUrlRequest: Equatable, Hashable {
+ public var sandbox: Sandbox
+ public var service: String
+ public var label: String?
+ public var expiresInSeconds: UInt32
+
+ // Default memberwise initializers are never public by default, so we
+ // declare one manually.
+ public init(sandbox: Sandbox, service: String, label: String?, expiresInSeconds: UInt32) {
+ self.sandbox = sandbox
+ self.service = service
+ self.label = label
+ self.expiresInSeconds = expiresInSeconds
+ }
+
+
+
+
+}
+
+#if compiler(>=6)
+extension CreateSignedServiceUrlRequest: Sendable {}
+#endif
+
+#if swift(>=5.8)
+@_documentation(visibility: private)
+#endif
+public struct FfiConverterTypeCreateSignedServiceUrlRequest: FfiConverterRustBuffer {
+ public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> CreateSignedServiceUrlRequest {
+ return
+ try CreateSignedServiceUrlRequest(
+ sandbox: FfiConverterTypeSandbox.read(from: &buf),
+ service: FfiConverterString.read(from: &buf),
+ label: FfiConverterOptionString.read(from: &buf),
+ expiresInSeconds: FfiConverterUInt32.read(from: &buf)
+ )
+ }
+
+ public static func write(_ value: CreateSignedServiceUrlRequest, into buf: inout [UInt8]) {
+ FfiConverterTypeSandbox.write(value.sandbox, into: &buf)
+ FfiConverterString.write(value.service, into: &buf)
+ FfiConverterOptionString.write(value.label, into: &buf)
+ FfiConverterUInt32.write(value.expiresInSeconds, into: &buf)
+ }
+}
+
+
+#if swift(>=5.8)
+@_documentation(visibility: private)
+#endif
+public func FfiConverterTypeCreateSignedServiceUrlRequest_lift(_ buf: RustBuffer) throws -> CreateSignedServiceUrlRequest {
+ return try FfiConverterTypeCreateSignedServiceUrlRequest.lift(buf)
+}
+
+#if swift(>=5.8)
+@_documentation(visibility: private)
+#endif
+public func FfiConverterTypeCreateSignedServiceUrlRequest_lower(_ value: CreateSignedServiceUrlRequest) -> RustBuffer {
+ return FfiConverterTypeCreateSignedServiceUrlRequest.lower(value)
+}
+
+
public struct CreateTemplateRequest {
public var namespace: String
public var name: String
@@ -3915,6 +4201,92 @@ public func FfiConverterTypeSandbox_lower(_ value: Sandbox) -> RustBuffer {
}
+public struct SignedServiceUrl: Equatable, Hashable {
+ public var id: String
+ public var namespace: String
+ public var claim: String
+ public var sandbox: String
+ public var service: String
+ public var label: String?
+ public var url: String
+ public var createdAt: String
+ public var expiresAt: String
+ public var revokedAt: String?
+
+ // Default memberwise initializers are never public by default, so we
+ // declare one manually.
+ public init(id: String, namespace: String, claim: String, sandbox: String, service: String, label: String?, url: String, createdAt: String, expiresAt: String, revokedAt: String?) {
+ self.id = id
+ self.namespace = namespace
+ self.claim = claim
+ self.sandbox = sandbox
+ self.service = service
+ self.label = label
+ self.url = url
+ self.createdAt = createdAt
+ self.expiresAt = expiresAt
+ self.revokedAt = revokedAt
+ }
+
+
+
+
+}
+
+#if compiler(>=6)
+extension SignedServiceUrl: Sendable {}
+#endif
+
+#if swift(>=5.8)
+@_documentation(visibility: private)
+#endif
+public struct FfiConverterTypeSignedServiceUrl: FfiConverterRustBuffer {
+ public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SignedServiceUrl {
+ return
+ try SignedServiceUrl(
+ id: FfiConverterString.read(from: &buf),
+ namespace: FfiConverterString.read(from: &buf),
+ claim: FfiConverterString.read(from: &buf),
+ sandbox: FfiConverterString.read(from: &buf),
+ service: FfiConverterString.read(from: &buf),
+ label: FfiConverterOptionString.read(from: &buf),
+ url: FfiConverterString.read(from: &buf),
+ createdAt: FfiConverterString.read(from: &buf),
+ expiresAt: FfiConverterString.read(from: &buf),
+ revokedAt: FfiConverterOptionString.read(from: &buf)
+ )
+ }
+
+ public static func write(_ value: SignedServiceUrl, into buf: inout [UInt8]) {
+ FfiConverterString.write(value.id, into: &buf)
+ FfiConverterString.write(value.namespace, into: &buf)
+ FfiConverterString.write(value.claim, into: &buf)
+ FfiConverterString.write(value.sandbox, into: &buf)
+ FfiConverterString.write(value.service, into: &buf)
+ FfiConverterOptionString.write(value.label, into: &buf)
+ FfiConverterString.write(value.url, into: &buf)
+ FfiConverterString.write(value.createdAt, into: &buf)
+ FfiConverterString.write(value.expiresAt, into: &buf)
+ FfiConverterOptionString.write(value.revokedAt, into: &buf)
+ }
+}
+
+
+#if swift(>=5.8)
+@_documentation(visibility: private)
+#endif
+public func FfiConverterTypeSignedServiceUrl_lift(_ buf: RustBuffer) throws -> SignedServiceUrl {
+ return try FfiConverterTypeSignedServiceUrl.lift(buf)
+}
+
+#if swift(>=5.8)
+@_documentation(visibility: private)
+#endif
+public func FfiConverterTypeSignedServiceUrl_lower(_ value: SignedServiceUrl) -> RustBuffer {
+ return FfiConverterTypeSignedServiceUrl.lower(value)
+}
+
+
/**
* The `osgym.cua.ai/v1alpha1 OSGymSandboxTemplate` CR verbatim. Warm pools
* and claims reference one by name via `spec.sandboxTemplateRef.name`.
@@ -4371,6 +4743,7 @@ public enum SdkError: Swift.Error, Equatable, Hashable, Foundation.LocalizedErro
)
case Status(operation: String, status: UInt16, body: String
)
+ case SignedServiceUrlsUnavailable
case UnknownService(requested: String, available: [String]
)
case InvalidServicePath(path: String
@@ -4431,19 +4804,20 @@ public struct FfiConverterTypeSdkError: FfiConverterRustBuffer {
status: try FfiConverterUInt16.read(from: &buf),
body: try FfiConverterString.read(from: &buf)
)
- case 7: return .UnknownService(
+ case 7: return .SignedServiceUrlsUnavailable
+ case 8: return .UnknownService(
requested: try FfiConverterString.read(from: &buf),
available: try FfiConverterSequenceString.read(from: &buf)
)
- case 8: return .InvalidServicePath(
+ case 9: return .InvalidServicePath(
path: try FfiConverterString.read(from: &buf)
)
- case 9: return .ClaimFailed(
+ case 10: return .ClaimFailed(
phase: try FfiConverterString.read(from: &buf),
status: try FfiConverterString.read(from: &buf)
)
- case 10: return .ClaimTimeout
- case 11: return .PoolAccessDenied(
+ case 11: return .ClaimTimeout
+ case 12: return .PoolAccessDenied(
operation: try FfiConverterString.read(from: &buf),
namespace: try FfiConverterString.read(from: &buf),
status: try FfiConverterUInt16.read(from: &buf),
@@ -4495,29 +4869,33 @@ public struct FfiConverterTypeSdkError: FfiConverterRustBuffer {
FfiConverterString.write(body, into: &buf)
- case let .UnknownService(requested,available):
+ case .SignedServiceUrlsUnavailable:
writeInt(&buf, Int32(7))
+
+
+ case let .UnknownService(requested,available):
+ writeInt(&buf, Int32(8))
FfiConverterString.write(requested, into: &buf)
FfiConverterSequenceString.write(available, into: &buf)
case let .InvalidServicePath(path):
- writeInt(&buf, Int32(8))
+ writeInt(&buf, Int32(9))
FfiConverterString.write(path, into: &buf)
case let .ClaimFailed(phase,status):
- writeInt(&buf, Int32(9))
+ writeInt(&buf, Int32(10))
FfiConverterString.write(phase, into: &buf)
FfiConverterString.write(status, into: &buf)
case .ClaimTimeout:
- writeInt(&buf, Int32(10))
+ writeInt(&buf, Int32(11))
case let .PoolAccessDenied(operation,namespace,status,body):
- writeInt(&buf, Int32(11))
+ writeInt(&buf, Int32(12))
FfiConverterString.write(operation, into: &buf)
FfiConverterString.write(namespace, into: &buf)
FfiConverterUInt16.write(status, into: &buf)
@@ -4835,6 +5213,31 @@ fileprivate struct FfiConverterSequenceTypePool: FfiConverterRustBuffer {
}
}
+#if swift(>=5.8)
+@_documentation(visibility: private)
+#endif
+fileprivate struct FfiConverterSequenceTypeSignedServiceUrl: FfiConverterRustBuffer {
+ typealias SwiftType = [SignedServiceUrl]
+
+ public static func write(_ value: [SignedServiceUrl], into buf: inout [UInt8]) {
+ let len = Int32(value.count)
+ writeInt(&buf, len)
+ for item in value {
+ FfiConverterTypeSignedServiceUrl.write(item, into: &buf)
+ }
+ }
+
+ public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> [SignedServiceUrl] {
+ let len: Int32 = try readInt(&buf)
+ var seq = [SignedServiceUrl]()
+ seq.reserveCapacity(Int(len))
+ for _ in 0 ..< len {
+ seq.append(try FfiConverterTypeSignedServiceUrl.read(from: &buf))
+ }
+ return seq
+ }
+}
+
#if swift(>=5.8)
@_documentation(visibility: private)
#endif
@@ -5161,6 +5564,15 @@ 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_signed_service_url() != 17810) {
+ return InitializationResult.apiChecksumMismatch
+ }
+ if (uniffi_cyclops_sdk_checksum_method_cyclopsclient_list_signed_service_urls() != 31479) {
+ return InitializationResult.apiChecksumMismatch
+ }
+ if (uniffi_cyclops_sdk_checksum_method_cyclopsclient_revoke_signed_service_url() != 59989) {
+ return InitializationResult.apiChecksumMismatch
+ }
if (uniffi_cyclops_sdk_checksum_method_cyclopsclient_create_template() != 13689) {
return InitializationResult.apiChecksumMismatch
}
@@ -5215,6 +5627,21 @@ private let initializationResult: InitializationResult = {
if (uniffi_cyclops_sdk_checksum_method_createpoolrequestbuilder_spec() != 7566) {
return InitializationResult.apiChecksumMismatch
}
+ if (uniffi_cyclops_sdk_checksum_method_createsignedserviceurlrequestbuilder_build() != 4255) {
+ return InitializationResult.apiChecksumMismatch
+ }
+ if (uniffi_cyclops_sdk_checksum_method_createsignedserviceurlrequestbuilder_expires_in_seconds() != 30769) {
+ return InitializationResult.apiChecksumMismatch
+ }
+ if (uniffi_cyclops_sdk_checksum_method_createsignedserviceurlrequestbuilder_label() != 1753) {
+ return InitializationResult.apiChecksumMismatch
+ }
+ if (uniffi_cyclops_sdk_checksum_method_createsignedserviceurlrequestbuilder_sandbox() != 1132) {
+ return InitializationResult.apiChecksumMismatch
+ }
+ if (uniffi_cyclops_sdk_checksum_method_createsignedserviceurlrequestbuilder_service() != 62938) {
+ return InitializationResult.apiChecksumMismatch
+ }
if (uniffi_cyclops_sdk_checksum_method_createtemplaterequestbuilder_build() != 46749) {
return InitializationResult.apiChecksumMismatch
}
@@ -5314,6 +5741,9 @@ private let initializationResult: InitializationResult = {
if (uniffi_cyclops_sdk_checksum_constructor_createpoolrequestbuilder_new() != 33658) {
return InitializationResult.apiChecksumMismatch
}
+ if (uniffi_cyclops_sdk_checksum_constructor_createsignedserviceurlrequestbuilder_new() != 16004) {
+ return InitializationResult.apiChecksumMismatch
+ }
if (uniffi_cyclops_sdk_checksum_constructor_createtemplaterequestbuilder_new() != 6787) {
return InitializationResult.apiChecksumMismatch
}
diff --git a/libs/fleet/sdk-bindings/swift/CyclopsSdkFFI.h b/libs/fleet/sdk-bindings/swift/CyclopsSdkFFI.h
index a6ecba18e1..5606f32ef9 100644
--- a/libs/fleet/sdk-bindings/swift/CyclopsSdkFFI.h
+++ b/libs/fleet/sdk-bindings/swift/CyclopsSdkFFI.h
@@ -403,6 +403,21 @@ 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_SIGNED_SERVICE_URL
+#define UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_FN_METHOD_CYCLOPSCLIENT_CREATE_SIGNED_SERVICE_URL
+uint64_t uniffi_cyclops_sdk_fn_method_cyclopsclient_create_signed_service_url(uint64_t ptr, RustBuffer request
+);
+#endif
+#ifndef UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_FN_METHOD_CYCLOPSCLIENT_LIST_SIGNED_SERVICE_URLS
+#define UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_FN_METHOD_CYCLOPSCLIENT_LIST_SIGNED_SERVICE_URLS
+uint64_t uniffi_cyclops_sdk_fn_method_cyclopsclient_list_signed_service_urls(uint64_t ptr, RustBuffer sandbox
+);
+#endif
+#ifndef UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_FN_METHOD_CYCLOPSCLIENT_REVOKE_SIGNED_SERVICE_URL
+#define UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_FN_METHOD_CYCLOPSCLIENT_REVOKE_SIGNED_SERVICE_URL
+uint64_t uniffi_cyclops_sdk_fn_method_cyclopsclient_revoke_signed_service_url(uint64_t ptr, RustBuffer signed_service_url
+);
+#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
@@ -555,6 +570,47 @@ uint64_t uniffi_cyclops_sdk_fn_method_createpoolrequestbuilder_namespace(uint64_
uint64_t uniffi_cyclops_sdk_fn_method_createpoolrequestbuilder_spec(uint64_t ptr, RustBuffer value, RustCallStatus *_Nonnull out_status
);
#endif
+#ifndef UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_FN_CLONE_CREATESIGNEDSERVICEURLREQUESTBUILDER
+#define UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_FN_CLONE_CREATESIGNEDSERVICEURLREQUESTBUILDER
+uint64_t uniffi_cyclops_sdk_fn_clone_createsignedserviceurlrequestbuilder(uint64_t handle, RustCallStatus *_Nonnull out_status
+);
+#endif
+#ifndef UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_FN_FREE_CREATESIGNEDSERVICEURLREQUESTBUILDER
+#define UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_FN_FREE_CREATESIGNEDSERVICEURLREQUESTBUILDER
+void uniffi_cyclops_sdk_fn_free_createsignedserviceurlrequestbuilder(uint64_t handle, RustCallStatus *_Nonnull out_status
+);
+#endif
+#ifndef UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_FN_CONSTRUCTOR_CREATESIGNEDSERVICEURLREQUESTBUILDER_NEW
+#define UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_FN_CONSTRUCTOR_CREATESIGNEDSERVICEURLREQUESTBUILDER_NEW
+uint64_t uniffi_cyclops_sdk_fn_constructor_createsignedserviceurlrequestbuilder_new(RustCallStatus *_Nonnull out_status
+
+);
+#endif
+#ifndef UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_FN_METHOD_CREATESIGNEDSERVICEURLREQUESTBUILDER_BUILD
+#define UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_FN_METHOD_CREATESIGNEDSERVICEURLREQUESTBUILDER_BUILD
+RustBuffer uniffi_cyclops_sdk_fn_method_createsignedserviceurlrequestbuilder_build(uint64_t ptr, RustCallStatus *_Nonnull out_status
+);
+#endif
+#ifndef UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_FN_METHOD_CREATESIGNEDSERVICEURLREQUESTBUILDER_EXPIRES_IN_SECONDS
+#define UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_FN_METHOD_CREATESIGNEDSERVICEURLREQUESTBUILDER_EXPIRES_IN_SECONDS
+uint64_t uniffi_cyclops_sdk_fn_method_createsignedserviceurlrequestbuilder_expires_in_seconds(uint64_t ptr, uint32_t value, RustCallStatus *_Nonnull out_status
+);
+#endif
+#ifndef UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_FN_METHOD_CREATESIGNEDSERVICEURLREQUESTBUILDER_LABEL
+#define UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_FN_METHOD_CREATESIGNEDSERVICEURLREQUESTBUILDER_LABEL
+uint64_t uniffi_cyclops_sdk_fn_method_createsignedserviceurlrequestbuilder_label(uint64_t ptr, RustBuffer value, RustCallStatus *_Nonnull out_status
+);
+#endif
+#ifndef UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_FN_METHOD_CREATESIGNEDSERVICEURLREQUESTBUILDER_SANDBOX
+#define UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_FN_METHOD_CREATESIGNEDSERVICEURLREQUESTBUILDER_SANDBOX
+uint64_t uniffi_cyclops_sdk_fn_method_createsignedserviceurlrequestbuilder_sandbox(uint64_t ptr, RustBuffer value, RustCallStatus *_Nonnull out_status
+);
+#endif
+#ifndef UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_FN_METHOD_CREATESIGNEDSERVICEURLREQUESTBUILDER_SERVICE
+#define UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_FN_METHOD_CREATESIGNEDSERVICEURLREQUESTBUILDER_SERVICE
+uint64_t uniffi_cyclops_sdk_fn_method_createsignedserviceurlrequestbuilder_service(uint64_t ptr, RustBuffer value, RustCallStatus *_Nonnull out_status
+);
+#endif
#ifndef UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_FN_CLONE_CREATETEMPLATEREQUESTBUILDER
#define UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_FN_CLONE_CREATETEMPLATEREQUESTBUILDER
uint64_t uniffi_cyclops_sdk_fn_clone_createtemplaterequestbuilder(uint64_t handle, RustCallStatus *_Nonnull out_status
@@ -1189,6 +1245,24 @@ 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_SIGNED_SERVICE_URL
+#define UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_CHECKSUM_METHOD_CYCLOPSCLIENT_CREATE_SIGNED_SERVICE_URL
+uint16_t uniffi_cyclops_sdk_checksum_method_cyclopsclient_create_signed_service_url(void
+
+);
+#endif
+#ifndef UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_CHECKSUM_METHOD_CYCLOPSCLIENT_LIST_SIGNED_SERVICE_URLS
+#define UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_CHECKSUM_METHOD_CYCLOPSCLIENT_LIST_SIGNED_SERVICE_URLS
+uint16_t uniffi_cyclops_sdk_checksum_method_cyclopsclient_list_signed_service_urls(void
+
+);
+#endif
+#ifndef UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_CHECKSUM_METHOD_CYCLOPSCLIENT_REVOKE_SIGNED_SERVICE_URL
+#define UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_CHECKSUM_METHOD_CYCLOPSCLIENT_REVOKE_SIGNED_SERVICE_URL
+uint16_t uniffi_cyclops_sdk_checksum_method_cyclopsclient_revoke_signed_service_url(void
+
);
#endif
#ifndef UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_CHECKSUM_METHOD_CYCLOPSCLIENT_CREATE_TEMPLATE
@@ -1297,6 +1371,36 @@ uint16_t uniffi_cyclops_sdk_checksum_method_createpoolrequestbuilder_namespace(v
#define UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_CHECKSUM_METHOD_CREATEPOOLREQUESTBUILDER_SPEC
uint16_t uniffi_cyclops_sdk_checksum_method_createpoolrequestbuilder_spec(void
+);
+#endif
+#ifndef UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_CHECKSUM_METHOD_CREATESIGNEDSERVICEURLREQUESTBUILDER_BUILD
+#define UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_CHECKSUM_METHOD_CREATESIGNEDSERVICEURLREQUESTBUILDER_BUILD
+uint16_t uniffi_cyclops_sdk_checksum_method_createsignedserviceurlrequestbuilder_build(void
+
+);
+#endif
+#ifndef UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_CHECKSUM_METHOD_CREATESIGNEDSERVICEURLREQUESTBUILDER_EXPIRES_IN_SECONDS
+#define UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_CHECKSUM_METHOD_CREATESIGNEDSERVICEURLREQUESTBUILDER_EXPIRES_IN_SECONDS
+uint16_t uniffi_cyclops_sdk_checksum_method_createsignedserviceurlrequestbuilder_expires_in_seconds(void
+
+);
+#endif
+#ifndef UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_CHECKSUM_METHOD_CREATESIGNEDSERVICEURLREQUESTBUILDER_LABEL
+#define UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_CHECKSUM_METHOD_CREATESIGNEDSERVICEURLREQUESTBUILDER_LABEL
+uint16_t uniffi_cyclops_sdk_checksum_method_createsignedserviceurlrequestbuilder_label(void
+
+);
+#endif
+#ifndef UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_CHECKSUM_METHOD_CREATESIGNEDSERVICEURLREQUESTBUILDER_SANDBOX
+#define UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_CHECKSUM_METHOD_CREATESIGNEDSERVICEURLREQUESTBUILDER_SANDBOX
+uint16_t uniffi_cyclops_sdk_checksum_method_createsignedserviceurlrequestbuilder_sandbox(void
+
+);
+#endif
+#ifndef UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_CHECKSUM_METHOD_CREATESIGNEDSERVICEURLREQUESTBUILDER_SERVICE
+#define UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_CHECKSUM_METHOD_CREATESIGNEDSERVICEURLREQUESTBUILDER_SERVICE
+uint16_t uniffi_cyclops_sdk_checksum_method_createsignedserviceurlrequestbuilder_service(void
+
);
#endif
#ifndef UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_CHECKSUM_METHOD_CREATETEMPLATEREQUESTBUILDER_BUILD
@@ -1495,6 +1599,12 @@ uint16_t uniffi_cyclops_sdk_checksum_constructor_createclaimrequestbuilder_new(v
#define UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_CHECKSUM_CONSTRUCTOR_CREATEPOOLREQUESTBUILDER_NEW
uint16_t uniffi_cyclops_sdk_checksum_constructor_createpoolrequestbuilder_new(void
+);
+#endif
+#ifndef UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_CHECKSUM_CONSTRUCTOR_CREATESIGNEDSERVICEURLREQUESTBUILDER_NEW
+#define UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_CHECKSUM_CONSTRUCTOR_CREATESIGNEDSERVICEURLREQUESTBUILDER_NEW
+uint16_t uniffi_cyclops_sdk_checksum_constructor_createsignedserviceurlrequestbuilder_new(void
+
);
#endif
#ifndef UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_CHECKSUM_CONSTRUCTOR_CREATETEMPLATEREQUESTBUILDER_NEW
diff --git a/libs/fleet/sdk-bindings/ts-uniffi-browser/ts/fleet_sdk.ts b/libs/fleet/sdk-bindings/ts-uniffi-browser/ts/fleet_sdk.ts
index 2b102d910a..97030194fe 100644
--- a/libs/fleet/sdk-bindings/ts-uniffi-browser/ts/fleet_sdk.ts
+++ b/libs/fleet/sdk-bindings/ts-uniffi-browser/ts/fleet_sdk.ts
@@ -484,6 +484,112 @@ const FfiConverterTypeCreatePoolRequest = (() => {
return new FFIConverter();
})();
+export type Sandbox = {
+ namespace: string;
+ claim: string;
+ name: string;
+ services: Array<string>;
+};
+
+/**
+ * Generated factory for {@link Sandbox} record objects.
+ */
+export const Sandbox = (() => {
+ const defaults = () => ({});
+ const create = (() => {
+ return uniffiCreateRecord<Sandbox, ReturnType<typeof defaults>>(defaults);
+ })();
+ return Object.freeze({
+ create,
+ new: create,
+ defaults: () => Object.freeze(defaults()) as Partial<Sandbox>,
+ });
+})();
+
+const FfiConverterTypeSandbox = (() => {
+ type TypeName = Sandbox;
+ class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
+ read(from: RustBuffer): TypeName {
+ return {
+ namespace: FfiConverterString.read(from),
+ claim: FfiConverterString.read(from),
+ name: FfiConverterString.read(from),
+ services: FfiConverterSequenceString.read(from),
+ };
+ }
+ write(value: TypeName, into: RustBuffer): void {
+ FfiConverterString.write(value.namespace, into);
+ FfiConverterString.write(value.claim, into);
+ FfiConverterString.write(value.name, into);
+ FfiConverterSequenceString.write(value.services, into);
+ }
+ allocationSize(value: TypeName): number {
+ return (
+ FfiConverterString.allocationSize(value.namespace) +
+ FfiConverterString.allocationSize(value.claim) +
+ FfiConverterString.allocationSize(value.name) +
+ FfiConverterSequenceString.allocationSize(value.services)
+ );
+ }
+ }
+ return new FFIConverter();
+})();
+
+export type CreateSignedServiceUrlRequest = {
+ sandbox: Sandbox;
+ service: string;
+ label?: string;
+ expiresInSeconds: number;
+};
+
+/**
+ * Generated factory for {@link CreateSignedServiceUrlRequest} record objects.
+ */
+export const CreateSignedServiceUrlRequest = (() => {
+ const defaults = () => ({});
+ const create = (() => {
+ return uniffiCreateRecord<
+ CreateSignedServiceUrlRequest,
+ ReturnType<typeof defaults>
+ >(defaults);
+ })();
+ return Object.freeze({
+ create,
+ new: create,
+ defaults: () =>
+ Object.freeze(defaults()) as Partial<CreateSignedServiceUrlRequest>,
+ });
+})();
+
+const FfiConverterTypeCreateSignedServiceUrlRequest = (() => {
+ type TypeName = CreateSignedServiceUrlRequest;
+ class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
+ read(from: RustBuffer): TypeName {
+ return {
+ sandbox: FfiConverterTypeSandbox.read(from),
+ service: FfiConverterString.read(from),
+ label: FfiConverterOptionalString.read(from),
+ expiresInSeconds: FfiConverterUInt32.read(from),
+ };
+ }
+ write(value: TypeName, into: RustBuffer): void {
+ FfiConverterTypeSandbox.write(value.sandbox, into);
+ FfiConverterString.write(value.service, into);
+ FfiConverterOptionalString.write(value.label, into);
+ FfiConverterUInt32.write(value.expiresInSeconds, into);
+ }
+ allocationSize(value: TypeName): number {
+ return (
+ FfiConverterTypeSandbox.allocationSize(value.sandbox) +
+ FfiConverterString.allocationSize(value.service) +
+ FfiConverterOptionalString.allocationSize(value.label) +
+ FfiConverterUInt32.allocationSize(value.expiresInSeconds)
+ );
+ }
+ }
+ return new FFIConverter();
+})();
+
export type CreateTemplateRequest = {
namespace: string;
name: string;
@@ -1196,51 +1302,77 @@ const FfiConverterTypePoolDisplayStatus = (() => {
return new FFIConverter();
})();
-export type Sandbox = {
+export type SignedServiceUrl = {
+ id: string;
namespace: string;
claim: string;
- name: string;
- services: Array<string>;
+ sandbox: string;
+ service: string;
+ label?: string;
+ url: string;
+ createdAt: string;
+ expiresAt: string;
+ revokedAt?: string;
};
/**
- * Generated factory for {@link Sandbox} record objects.
+ * Generated factory for {@link SignedServiceUrl} record objects.
*/
-export const Sandbox = (() => {
+export const SignedServiceUrl = (() => {
const defaults = () => ({});
const create = (() => {
- return uniffiCreateRecord<Sandbox, ReturnType<typeof defaults>>(defaults);
+ return uniffiCreateRecord<SignedServiceUrl, ReturnType<typeof defaults>>(
+ defaults,
+ );
})();
return Object.freeze({
create,
new: create,
- defaults: () => Object.freeze(defaults()) as Partial<Sandbox>,
+ defaults: () => Object.freeze(defaults()) as Partial<SignedServiceUrl>,
});
})();
-const FfiConverterTypeSandbox = (() => {
- type TypeName = Sandbox;
+const FfiConverterTypeSignedServiceUrl = (() => {
+ type TypeName = SignedServiceUrl;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
+ id: FfiConverterString.read(from),
namespace: FfiConverterString.read(from),
claim: FfiConverterString.read(from),
- name: FfiConverterString.read(from),
- services: FfiConverterSequenceString.read(from),
+ sandbox: FfiConverterString.read(from),
+ service: FfiConverterString.read(from),
+ label: FfiConverterOptionalString.read(from),
+ url: FfiConverterString.read(from),
+ createdAt: FfiConverterString.read(from),
+ expiresAt: FfiConverterString.read(from),
+ revokedAt: FfiConverterOptionalString.read(from),
};
}
write(value: TypeName, into: RustBuffer): void {
+ FfiConverterString.write(value.id, into);
FfiConverterString.write(value.namespace, into);
FfiConverterString.write(value.claim, into);
- FfiConverterString.write(value.name, into);
- FfiConverterSequenceString.write(value.services, into);
+ FfiConverterString.write(value.sandbox, into);
+ FfiConverterString.write(value.service, into);
+ FfiConverterOptionalString.write(value.label, into);
+ FfiConverterString.write(value.url, into);
+ FfiConverterString.write(value.createdAt, into);
+ FfiConverterString.write(value.expiresAt, into);
+ FfiConverterOptionalString.write(value.revokedAt, into);
}
allocationSize(value: TypeName): number {
return (
+ FfiConverterString.allocationSize(value.id) +
FfiConverterString.allocationSize(value.namespace) +
FfiConverterString.allocationSize(value.claim) +
- FfiConverterString.allocationSize(value.name) +
- FfiConverterSequenceString.allocationSize(value.services)
+ FfiConverterString.allocationSize(value.sandbox) +
+ FfiConverterString.allocationSize(value.service) +
+ FfiConverterOptionalString.allocationSize(value.label) +
+ FfiConverterString.allocationSize(value.url) +
+ FfiConverterString.allocationSize(value.createdAt) +
+ FfiConverterString.allocationSize(value.expiresAt) +
+ FfiConverterOptionalString.allocationSize(value.revokedAt)
);
}
}
@@ -1657,6 +1789,7 @@ export enum SdkError_Tags {
Token = "Token",
Body = "Body",
Status = "Status",
+ SignedServiceUrlsUnavailable = "SignedServiceUrlsUnavailable",
UnknownService = "UnknownService",
InvalidServicePath = "InvalidServicePath",
ClaimFailed = "ClaimFailed",
@@ -1881,6 +2014,35 @@ export const SdkError = (() => {
}
}
+ type SignedServiceUrlsUnavailable__interface = {
+ tag: SdkError_Tags.SignedServiceUrlsUnavailable;
+ };
+ class SignedServiceUrlsUnavailable_
+ extends UniffiError
+ implements SignedServiceUrlsUnavailable__interface
+ {
+ /**
+ * @private
+ * This field is private and should not be used, use `tag` instead.
+ */
+ readonly [uniffiTypeNameSymbol] = "SdkError";
+ readonly tag = SdkError_Tags.SignedServiceUrlsUnavailable;
+ constructor() {
+ super("SdkError", "SignedServiceUrlsUnavailable");
+ }
+
+ static new(): SignedServiceUrlsUnavailable_ {
+ return new SignedServiceUrlsUnavailable_();
+ }
+
+ static instanceOf(obj: any): obj is SignedServiceUrlsUnavailable_ {
+ return obj.tag === SdkError_Tags.SignedServiceUrlsUnavailable;
+ }
+ static hasInner(obj: any): obj is SignedServiceUrlsUnavailable_ {
+ return false;
+ }
+ }
+
type UnknownService__interface = {
tag: SdkError_Tags.UnknownService;
inner: Readonly<{ requested: string; available: Array<string> }>;
@@ -2094,6 +2256,7 @@ export const SdkError = (() => {
Token: Token_,
Body: Body_,
Status: Status_,
+ SignedServiceUrlsUnavailable: SignedServiceUrlsUnavailable_,
UnknownService: UnknownService_,
InvalidServicePath: InvalidServicePath_,
ClaimFailed: ClaimFailed_,
@@ -2109,6 +2272,7 @@ export type SdkError = InstanceType<
| "Token"
| "Body"
| "Status"
+ | "SignedServiceUrlsUnavailable"
| "UnknownService"
| "InvalidServicePath"
| "ClaimFailed"
@@ -2148,22 +2312,24 @@ const FfiConverterTypeSdkError = (() => {
body: FfiConverterString.read(from),
});
case 7:
+ return new SdkError.SignedServiceUrlsUnavailable();
+ case 8:
return new SdkError.UnknownService({
requested: FfiConverterString.read(from),
available: FfiConverterSequenceString.read(from),
});
- case 8:
+ case 9:
return new SdkError.InvalidServicePath({
path: FfiConverterString.read(from),
});
- case 9:
+ case 10:
return new SdkError.ClaimFailed({
phase: FfiConverterString.read(from),
status: FfiConverterString.read(from),
});
- case 10:
- return new SdkError.ClaimTimeout();
case 11:
+ return new SdkError.ClaimTimeout();
+ case 12:
return new SdkError.PoolAccessDenied({
operation: FfiConverterString.read(from),
namespace: FfiConverterString.read(from),
@@ -2216,32 +2382,36 @@ const FfiConverterTypeSdkError = (() => {
FfiConverterString.write(inner.body, into);
return;
}
- case SdkError_Tags.UnknownService: {
+ case SdkError_Tags.SignedServiceUrlsUnavailable: {
ordinalConverter.write(7, into);
+ return;
+ }
+ case SdkError_Tags.UnknownService: {
+ ordinalConverter.write(8, into);
const inner = value.inner;
FfiConverterString.write(inner.requested, into);
FfiConverterSequenceString.write(inner.available, into);
return;
}
case SdkError_Tags.InvalidServicePath: {
- ordinalConverter.write(8, into);
+ ordinalConverter.write(9, into);
const inner = value.inner;
FfiConverterString.write(inner.path, into);
return;
}
case SdkError_Tags.ClaimFailed: {
- ordinalConverter.write(9, into);
+ ordinalConverter.write(10, into);
const inner = value.inner;
FfiConverterString.write(inner.phase, into);
FfiConverterString.write(inner.status, into);
return;
}
case SdkError_Tags.ClaimTimeout: {
- ordinalConverter.write(10, into);
+ ordinalConverter.write(11, into);
return;
}
case SdkError_Tags.PoolAccessDenied: {
- ordinalConverter.write(11, into);
+ ordinalConverter.write(12, into);
const inner = value.inner;
FfiConverterString.write(inner.operation, into);
FfiConverterString.write(inner.namespace, into);
@@ -2296,32 +2466,35 @@ const FfiConverterTypeSdkError = (() => {
size += FfiConverterString.allocationSize(inner.body);
return size;
}
+ case SdkError_Tags.SignedServiceUrlsUnavailable: {
+ return ordinalConverter.allocationSize(7);
+ }
case SdkError_Tags.UnknownService: {
const inner = value.inner;
- let size = ordinalConverter.allocationSize(7);
+ let size = ordinalConverter.allocationSize(8);
size += FfiConverterString.allocationSize(inner.requested);
size += FfiConverterSequenceString.allocationSize(inner.available);
return size;
}
case SdkError_Tags.InvalidServicePath: {
const inner = value.inner;
- let size = ordinalConverter.allocationSize(8);
+ let size = ordinalConverter.allocationSize(9);
size += FfiConverterString.allocationSize(inner.path);
return size;
}
case SdkError_Tags.ClaimFailed: {
const inner = value.inner;
- let size = ordinalConverter.allocationSize(9);
+ let size = ordinalConverter.allocationSize(10);
size += FfiConverterString.allocationSize(inner.phase);
size += FfiConverterString.allocationSize(inner.status);
return size;
}
case SdkError_Tags.ClaimTimeout: {
- return ordinalConverter.allocationSize(10);
+ return ordinalConverter.allocationSize(11);
}
case SdkError_Tags.PoolAccessDenied: {
const inner = value.inner;
- let size = ordinalConverter.allocationSize(11);
+ let size = ordinalConverter.allocationSize(12);
size += FfiConverterString.allocationSize(inner.operation);
size += FfiConverterString.allocationSize(inner.namespace);
size += FfiConverterUInt16.allocationSize(inner.status);
@@ -2950,6 +3123,248 @@ const FfiConverterTypeCreatePoolRequestBuilder = new FfiConverterObject(
uniffiTypeCreatePoolRequestBuilderObjectFactory,
);
+export interface CreateSignedServiceUrlRequestBuilderLike {
+ build() /*throws*/ : CreateSignedServiceUrlRequest;
+ expiresInSeconds(value: number): CreateSignedServiceUrlRequestBuilderLike;
+ label(value: string): CreateSignedServiceUrlRequestBuilderLike;
+ sandbox(value: Sandbox): CreateSignedServiceUrlRequestBuilderLike;
+ service(value: string): CreateSignedServiceUrlRequestBuilderLike;
+}
+/**
+ * @deprecated Use `CreateSignedServiceUrlRequestBuilderLike` instead.
+ */
+export type CreateSignedServiceUrlRequestBuilderInterface =
+ CreateSignedServiceUrlRequestBuilderLike;
+
+export class CreateSignedServiceUrlRequestBuilder
+ extends UniffiAbstractObject
+ implements CreateSignedServiceUrlRequestBuilderLike
+{
+ readonly [uniffiTypeNameSymbol] = "CreateSignedServiceUrlRequestBuilder";
+ readonly [destructorGuardSymbol]: UniffiGcObject;
+ readonly [pointerLiteralSymbol]: UniffiHandle;
+ constructor() {
+ super();
+ const pointer = uniffiCaller.rustCall(
+ /*caller:*/ (callStatus) => {
+ return nativeModule().ubrn_uniffi_cyclops_sdk_fn_constructor_createsignedserviceurlrequestbuilder_new(
+ callStatus,
+ );
+ },
+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
+ );
+ this[pointerLiteralSymbol] = pointer;
+ this[destructorGuardSymbol] =
+ uniffiTypeCreateSignedServiceUrlRequestBuilderObjectFactory.bless(
+ pointer,
+ );
+ }
+
+ build(): CreateSignedServiceUrlRequest /*throws*/ {
+ return ((__rb: Uint8Array) => {
+ try {
+ return FfiConverterTypeCreateSignedServiceUrlRequest.lift(__rb);
+ } finally {
+ nativeModule().rustbuffer_free(__rb);
+ }
+ })(
+ uniffiCaller.rustCallWithError(
+ /*liftError:*/ FfiConverterTypeSdkBuildError.lift.bind(
+ FfiConverterTypeSdkBuildError,
+ ),
+ /*caller:*/ (callStatus) => {
+ return nativeModule().ubrn_uniffi_cyclops_sdk_fn_method_createsignedserviceurlrequestbuilder_build(
+ uniffiTypeCreateSignedServiceUrlRequestBuilderObjectFactory.clonePointer(
+ this,
+ ),
+ callStatus,
+ );
+ },
+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
+ ),
+ );
+ }
+
+ expiresInSeconds(value: number): CreateSignedServiceUrlRequestBuilderLike {
+ return FfiConverterTypeCreateSignedServiceUrlRequestBuilder.lift(
+ uniffiCaller.rustCall(
+ /*caller:*/ (callStatus) => {
+ return nativeModule().ubrn_uniffi_cyclops_sdk_fn_method_createsignedserviceurlrequestbuilder_expires_in_seconds(
+ uniffiTypeCreateSignedServiceUrlRequestBuilderObjectFactory.clonePointer(
+ this,
+ ),
+ FfiConverterUInt32.lower(value, nativeModule().rustbuffer_alloc),
+ callStatus,
+ );
+ },
+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
+ ),
+ );
+ }
+
+ label(value: string): CreateSignedServiceUrlRequestBuilderLike {
+ return FfiConverterTypeCreateSignedServiceUrlRequestBuilder.lift(
+ uniffiCaller.rustCall(
+ /*caller:*/ (callStatus) => {
+ return nativeModule().ubrn_uniffi_cyclops_sdk_fn_method_createsignedserviceurlrequestbuilder_label(
+ uniffiTypeCreateSignedServiceUrlRequestBuilderObjectFactory.clonePointer(
+ this,
+ ),
+ FfiConverterString.lower(value, nativeModule().rustbuffer_alloc),
+ callStatus,
+ );
+ },
+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
+ ),
+ );
+ }
+
+ sandbox(value: Sandbox): CreateSignedServiceUrlRequestBuilderLike {
+ return FfiConverterTypeCreateSignedServiceUrlRequestBuilder.lift(
+ uniffiCaller.rustCall(
+ /*caller:*/ (callStatus) => {
+ return nativeModule().ubrn_uniffi_cyclops_sdk_fn_method_createsignedserviceurlrequestbuilder_sandbox(
+ uniffiTypeCreateSignedServiceUrlRequestBuilderObjectFactory.clonePointer(
+ this,
+ ),
+ FfiConverterTypeSandbox.lower(
+ value,
+ nativeModule().rustbuffer_alloc,
+ ),
+ callStatus,
+ );
+ },
+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
+ ),
+ );
+ }
+
+ service(value: string): CreateSignedServiceUrlRequestBuilderLike {
+ return FfiConverterTypeCreateSignedServiceUrlRequestBuilder.lift(
+ uniffiCaller.rustCall(
+ /*caller:*/ (callStatus) => {
+ return nativeModule().ubrn_uniffi_cyclops_sdk_fn_method_createsignedserviceurlrequestbuilder_service(
+ uniffiTypeCreateSignedServiceUrlRequestBuilderObjectFactory.clonePointer(
+ this,
+ ),
+ FfiConverterString.lower(value, nativeModule().rustbuffer_alloc),
+ callStatus,
+ );
+ },
+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
+ ),
+ );
+ }
+
+ uniffiDestroy(): void {
+ const ptr = (this as any)[destructorGuardSymbol];
+ if (ptr !== undefined) {
+ const pointer =
+ uniffiTypeCreateSignedServiceUrlRequestBuilderObjectFactory.pointer(
+ this,
+ );
+ uniffiTypeCreateSignedServiceUrlRequestBuilderObjectFactory.freePointer(
+ pointer,
+ );
+ uniffiTypeCreateSignedServiceUrlRequestBuilderObjectFactory.unbless(ptr);
+ delete (this as any)[destructorGuardSymbol];
+ }
+ }
+
+ static instanceOf(obj_: any): obj_ is CreateSignedServiceUrlRequestBuilder {
+ return uniffiTypeCreateSignedServiceUrlRequestBuilderObjectFactory.isConcreteType(
+ obj_,
+ );
+ }
+}
+
+const uniffiTypeCreateSignedServiceUrlRequestBuilderObjectFactory: UniffiObjectFactory<CreateSignedServiceUrlRequestBuilderLike> =
+ (() => {
+ /// <reference lib="es2021" />
+ const registry =
+ typeof FinalizationRegistry !== "undefined"
+ ? new FinalizationRegistry<UniffiHandle>((heldValue: UniffiHandle) => {
+ uniffiTypeCreateSignedServiceUrlRequestBuilderObjectFactory.freePointer(
+ heldValue,
+ );
+ })
+ : null;
+
+ return {
+ create(pointer: UniffiHandle): CreateSignedServiceUrlRequestBuilderLike {
+ const instance = Object.create(
+ CreateSignedServiceUrlRequestBuilder.prototype,
+ );
+ instance[pointerLiteralSymbol] = pointer;
+ instance[destructorGuardSymbol] = this.bless(pointer);
+ instance[uniffiTypeNameSymbol] = "CreateSignedServiceUrlRequestBuilder";
+ 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_: CreateSignedServiceUrlRequestBuilderLike): UniffiHandle {
+ if ((obj_ as any)[destructorGuardSymbol] === undefined) {
+ throw new UniffiInternalError.UnexpectedNullPointer();
+ }
+ return (obj_ as any)[pointerLiteralSymbol];
+ },
+
+ clonePointer(
+ obj_: CreateSignedServiceUrlRequestBuilderLike,
+ ): UniffiHandle {
+ const pointer = this.pointer(obj_);
+ return uniffiCaller.rustCall(
+ /*caller:*/ (callStatus) =>
+ nativeModule().ubrn_uniffi_cyclops_sdk_fn_clone_createsignedserviceurlrequestbuilder(
+ pointer,
+ callStatus,
+ ),
+ /*liftString:*/ FfiConverterString.lift,
+ );
+ },
+
+ freePointer(pointer: UniffiHandle): void {
+ uniffiCaller.rustCall(
+ /*caller:*/ (callStatus) =>
+ nativeModule().ubrn_uniffi_cyclops_sdk_fn_free_createsignedserviceurlrequestbuilder(
+ pointer,
+ callStatus,
+ ),
+ /*liftString:*/ FfiConverterString.lift,
+ );
+ },
+
+ isConcreteType(
+ obj_: any,
+ ): obj_ is CreateSignedServiceUrlRequestBuilderLike {
+ return (
+ obj_[destructorGuardSymbol] &&
+ obj_[uniffiTypeNameSymbol] === "CreateSignedServiceUrlRequestBuilder"
+ );
+ },
+ };
+ })();
+const FfiConverterTypeCreateSignedServiceUrlRequestBuilder =
+ new FfiConverterObject(
+ uniffiTypeCreateSignedServiceUrlRequestBuilderObjectFactory,
+ );
+
export interface CreateTemplateRequestBuilderLike {
build() /*throws*/ : CreateTemplateRequest;
name(value: string): CreateTemplateRequestBuilderLike;
@@ -3371,6 +3786,10 @@ export interface CyclopsClientLike {
request: CreatePoolRequest,
asyncOpts_?: { signal: AbortSignal },
) /*throws*/ : Promise<Pool>;
+ createSignedServiceUrl(
+ request: CreateSignedServiceUrlRequest,
+ asyncOpts_?: { signal: AbortSignal },
+ ) /*throws*/ : Promise<SignedServiceUrl>;
createTemplate(
request: CreateTemplateRequest,
asyncOpts_?: { signal: AbortSignal },
@@ -3427,6 +3846,10 @@ export interface CyclopsClientLike {
namespace: string,
asyncOpts_?: { signal: AbortSignal },
) /*throws*/ : Promise<Array<Pool>>;
+ listSignedServiceUrls(
+ sandbox: Sandbox,
+ asyncOpts_?: { signal: AbortSignal },
+ ) /*throws*/ : Promise<Array<SignedServiceUrl>>;
listTemplates(
namespace: string,
asyncOpts_?: { signal: AbortSignal },
@@ -3455,6 +3878,10 @@ export interface CyclopsClientLike {
shutdownTime: string,
asyncOpts_?: { signal: AbortSignal },
) /*throws*/ : Promise<Claim>;
+ revokeSignedServiceUrl(
+ signedServiceUrl: SignedServiceUrl,
+ asyncOpts_?: { signal: AbortSignal },
+ ) /*throws*/ : Promise<void>;
serviceRequest(
sandbox: Sandbox,
service: string,
@@ -3799,6 +4226,45 @@ export class CyclopsClient
);
}
+ async createSignedServiceUrl(
+ request: CreateSignedServiceUrlRequest,
+ asyncOpts_?: { signal: AbortSignal },
+ ): Promise<SignedServiceUrl> /*throws*/ {
+ return await uniffiRustCallAsync(
+ /*rustCaller:*/ uniffiCaller,
+ /*rustFutureFunc:*/ () => {
+ return nativeModule().ubrn_uniffi_cyclops_sdk_fn_method_cyclopsclient_create_signed_service_url(
+ uniffiTypeCyclopsClientObjectFactory.clonePointer(this),
+ FfiConverterTypeCreateSignedServiceUrlRequest.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:*/ FfiConverterTypeSignedServiceUrl.lift.bind(
+ FfiConverterTypeSignedServiceUrl,
+ ),
+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
+ /*asyncOpts:*/ asyncOpts_,
+ /*errorHandler:*/ FfiConverterTypeSdkError.lift.bind(
+ FfiConverterTypeSdkError,
+ ),
+ );
+ }
+
async createTemplate(
request: CreateTemplateRequest,
asyncOpts_?: { signal: AbortSignal },
@@ -4263,6 +4729,45 @@ export class CyclopsClient
);
}
+ async listSignedServiceUrls(
+ sandbox: Sandbox,
+ asyncOpts_?: { signal: AbortSignal },
+ ): Promise<Array<SignedServiceUrl>> /*throws*/ {
+ return await uniffiRustCallAsync(
+ /*rustCaller:*/ uniffiCaller,
+ /*rustFutureFunc:*/ () => {
+ return nativeModule().ubrn_uniffi_cyclops_sdk_fn_method_cyclopsclient_list_signed_service_urls(
+ uniffiTypeCyclopsClientObjectFactory.clonePointer(this),
+ FfiConverterTypeSandbox.lower(
+ sandbox,
+ 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:*/ FfiConverterSequenceTypeSignedServiceUrl.lift.bind(
+ FfiConverterSequenceTypeSignedServiceUrl,
+ ),
+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
+ /*asyncOpts:*/ asyncOpts_,
+ /*errorHandler:*/ FfiConverterTypeSdkError.lift.bind(
+ FfiConverterTypeSdkError,
+ ),
+ );
+ }
+
async listTemplates(
namespace: string,
asyncOpts_?: { signal: AbortSignal },
@@ -4456,6 +4961,36 @@ export class CyclopsClient
);
}
+ async revokeSignedServiceUrl(
+ signedServiceUrl: SignedServiceUrl,
+ asyncOpts_?: { signal: AbortSignal },
+ ): Promise<void> /*throws*/ {
+ return await uniffiRustCallAsync(
+ /*rustCaller:*/ uniffiCaller,
+ /*rustFutureFunc:*/ () => {
+ return nativeModule().ubrn_uniffi_cyclops_sdk_fn_method_cyclopsclient_revoke_signed_service_url(
+ uniffiTypeCyclopsClientObjectFactory.clonePointer(this),
+ FfiConverterTypeSignedServiceUrl.lower(
+ signedServiceUrl,
+ 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 serviceRequest(
sandbox: Sandbox,
service: string,
@@ -5711,6 +6246,11 @@ const FfiConverterSequenceTypePool = new FfiConverterArray(
FfiConverterTypePool,
);
+// FfiConverter for Array<SignedServiceUrl>
+const FfiConverterSequenceTypeSignedServiceUrl = new FfiConverterArray(
+ FfiConverterTypeSignedServiceUrl,
+);
+
// FfiConverter for Array<Template>
const FfiConverterSequenceTypeTemplate = new FfiConverterArray(
FfiConverterTypeTemplate,
@@ -5863,6 +6403,54 @@ function uniffiEnsureInitialized() {
"uniffi_cyclops_sdk_checksum_method_createpoolrequestbuilder_spec",
);
}
+ if (
+ nativeModule().ubrn_uniffi_cyclops_sdk_checksum_constructor_createsignedserviceurlrequestbuilder_new() !==
+ 16004
+ ) {
+ throw new UniffiInternalError.ApiChecksumMismatch(
+ "uniffi_cyclops_sdk_checksum_constructor_createsignedserviceurlrequestbuilder_new",
+ );
+ }
+ if (
+ nativeModule().ubrn_uniffi_cyclops_sdk_checksum_method_createsignedserviceurlrequestbuilder_build() !==
+ 4255
+ ) {
+ throw new UniffiInternalError.ApiChecksumMismatch(
+ "uniffi_cyclops_sdk_checksum_method_createsignedserviceurlrequestbuilder_build",
+ );
+ }
+ if (
+ nativeModule().ubrn_uniffi_cyclops_sdk_checksum_method_createsignedserviceurlrequestbuilder_expires_in_seconds() !==
+ 30769
+ ) {
+ throw new UniffiInternalError.ApiChecksumMismatch(
+ "uniffi_cyclops_sdk_checksum_method_createsignedserviceurlrequestbuilder_expires_in_seconds",
+ );
+ }
+ if (
+ nativeModule().ubrn_uniffi_cyclops_sdk_checksum_method_createsignedserviceurlrequestbuilder_label() !==
+ 1753
+ ) {
+ throw new UniffiInternalError.ApiChecksumMismatch(
+ "uniffi_cyclops_sdk_checksum_method_createsignedserviceurlrequestbuilder_label",
+ );
+ }
+ if (
+ nativeModule().ubrn_uniffi_cyclops_sdk_checksum_method_createsignedserviceurlrequestbuilder_sandbox() !==
+ 1132
+ ) {
+ throw new UniffiInternalError.ApiChecksumMismatch(
+ "uniffi_cyclops_sdk_checksum_method_createsignedserviceurlrequestbuilder_sandbox",
+ );
+ }
+ if (
+ nativeModule().ubrn_uniffi_cyclops_sdk_checksum_method_createsignedserviceurlrequestbuilder_service() !==
+ 62938
+ ) {
+ throw new UniffiInternalError.ApiChecksumMismatch(
+ "uniffi_cyclops_sdk_checksum_method_createsignedserviceurlrequestbuilder_service",
+ );
+ }
if (
nativeModule().ubrn_uniffi_cyclops_sdk_checksum_constructor_createtemplaterequestbuilder_new() !==
6787
@@ -6015,6 +6603,14 @@ function uniffiEnsureInitialized() {
"uniffi_cyclops_sdk_checksum_method_cyclopsclient_create_pool",
);
}
+ if (
+ nativeModule().ubrn_uniffi_cyclops_sdk_checksum_method_cyclopsclient_create_signed_service_url() !==
+ 17810
+ ) {
+ throw new UniffiInternalError.ApiChecksumMismatch(
+ "uniffi_cyclops_sdk_checksum_method_cyclopsclient_create_signed_service_url",
+ );
+ }
if (
nativeModule().ubrn_uniffi_cyclops_sdk_checksum_method_cyclopsclient_create_template() !==
13689
@@ -6127,6 +6723,14 @@ function uniffiEnsureInitialized() {
"uniffi_cyclops_sdk_checksum_method_cyclopsclient_list_pools",
);
}
+ if (
+ nativeModule().ubrn_uniffi_cyclops_sdk_checksum_method_cyclopsclient_list_signed_service_urls() !==
+ 31479
+ ) {
+ throw new UniffiInternalError.ApiChecksumMismatch(
+ "uniffi_cyclops_sdk_checksum_method_cyclopsclient_list_signed_service_urls",
+ );
+ }
if (
nativeModule().ubrn_uniffi_cyclops_sdk_checksum_method_cyclopsclient_list_templates() !==
58376
@@ -6167,6 +6771,14 @@ function uniffiEnsureInitialized() {
"uniffi_cyclops_sdk_checksum_method_cyclopsclient_renew_claim",
);
}
+ if (
+ nativeModule().ubrn_uniffi_cyclops_sdk_checksum_method_cyclopsclient_revoke_signed_service_url() !==
+ 59989
+ ) {
+ throw new UniffiInternalError.ApiChecksumMismatch(
+ "uniffi_cyclops_sdk_checksum_method_cyclopsclient_revoke_signed_service_url",
+ );
+ }
if (
nativeModule().ubrn_uniffi_cyclops_sdk_checksum_method_cyclopsclient_service_request() !==
46699
@@ -6390,6 +7002,8 @@ export default Object.freeze({
FfiConverterTypeCreateClaimRequestBuilder,
FfiConverterTypeCreatePoolRequest,
FfiConverterTypeCreatePoolRequestBuilder,
+ FfiConverterTypeCreateSignedServiceUrlRequest,
+ FfiConverterTypeCreateSignedServiceUrlRequestBuilder,
FfiConverterTypeCreateTemplateRequest,
FfiConverterTypeCreateTemplateRequestBuilder,
FfiConverterTypeCreateUserApiKeyRequest,
@@ -6414,6 +7028,7 @@ export default Object.freeze({
FfiConverterTypeSandbox,
FfiConverterTypeSdkBuildError,
FfiConverterTypeSdkError,
+ FfiConverterTypeSignedServiceUrl,
FfiConverterTypeTemplate,
FfiConverterTypeTemplateBuilder,
FfiConverterTypeUserApiKey,
diff --git a/libs/fleet/sdk-bindings/ts-uniffi/fleet_sdk-ffi.ts b/libs/fleet/sdk-bindings/ts-uniffi/fleet_sdk-ffi.ts
index f074e4c33d..cbbd34335b 100644
--- a/libs/fleet/sdk-bindings/ts-uniffi/fleet_sdk-ffi.ts
+++ b/libs/fleet/sdk-bindings/ts-uniffi/fleet_sdk-ffi.ts
@@ -313,6 +313,31 @@ const DEFINITIONS = {
ret: FfiType.Void,
hasRustCallStatus: false,
},
+ "uniffi_cyclops_sdk_fn_func_healthy_pool_display_status": {
+ args: [],
+ ret: FfiType.RustBuffer,
+ hasRustCallStatus: true,
+ },
+ "uniffi_cyclops_sdk_fn_func_pool_display_status": {
+ args: [FfiType.RustBuffer],
+ ret: FfiType.RustBuffer,
+ hasRustCallStatus: true,
+ },
+ "uniffi_cyclops_sdk_fn_func_removed_pool_display_status": {
+ args: [],
+ ret: FfiType.RustBuffer,
+ hasRustCallStatus: true,
+ },
+ "uniffi_cyclops_sdk_fn_func_terminating_pool_display_status": {
+ args: [],
+ ret: FfiType.RustBuffer,
+ hasRustCallStatus: true,
+ },
+ "uniffi_cyclops_sdk_fn_func_unknown_pool_display_status": {
+ args: [],
+ ret: FfiType.RustBuffer,
+ hasRustCallStatus: true,
+ },
"uniffi_cyclops_sdk_fn_method_accesstokenprovider_get_access_token": {
args: [FfiType.Handle, FfiType.Int8],
ret: FfiType.Handle,
@@ -358,11 +383,21 @@ const DEFINITIONS = {
ret: FfiType.Handle,
hasRustCallStatus: false,
},
+ "uniffi_cyclops_sdk_fn_method_cyclopsclient_create_namespace": {
+ args: [FfiType.Handle, FfiType.RustBuffer],
+ ret: FfiType.Handle,
+ hasRustCallStatus: false,
+ },
"uniffi_cyclops_sdk_fn_method_cyclopsclient_create_pool": {
args: [FfiType.Handle, FfiType.RustBuffer],
ret: FfiType.Handle,
hasRustCallStatus: false,
},
+ "uniffi_cyclops_sdk_fn_method_cyclopsclient_create_signed_service_url": {
+ args: [FfiType.Handle, FfiType.RustBuffer],
+ ret: FfiType.Handle,
+ hasRustCallStatus: false,
+ },
"uniffi_cyclops_sdk_fn_method_cyclopsclient_create_template": {
args: [FfiType.Handle, FfiType.RustBuffer],
ret: FfiType.Handle,
@@ -378,6 +413,11 @@ const DEFINITIONS = {
ret: FfiType.Handle,
hasRustCallStatus: false,
},
+ "uniffi_cyclops_sdk_fn_method_cyclopsclient_delete_namespace": {
+ args: [FfiType.Handle, FfiType.RustBuffer],
+ ret: FfiType.Handle,
+ hasRustCallStatus: false,
+ },
"uniffi_cyclops_sdk_fn_method_cyclopsclient_delete_pool": {
args: [FfiType.Handle, FfiType.RustBuffer],
ret: FfiType.Handle,
@@ -398,6 +438,11 @@ const DEFINITIONS = {
ret: FfiType.Handle,
hasRustCallStatus: false,
},
+ "uniffi_cyclops_sdk_fn_method_cyclopsclient_get_namespace": {
+ args: [FfiType.Handle, FfiType.RustBuffer],
+ ret: FfiType.Handle,
+ hasRustCallStatus: false,
+ },
"uniffi_cyclops_sdk_fn_method_cyclopsclient_get_pool": {
args: [FfiType.Handle, FfiType.RustBuffer],
ret: FfiType.Handle,
@@ -423,6 +468,11 @@ const DEFINITIONS = {
ret: FfiType.Handle,
hasRustCallStatus: false,
},
+ "uniffi_cyclops_sdk_fn_method_cyclopsclient_list_signed_service_urls": {
+ args: [FfiType.Handle, FfiType.RustBuffer],
+ ret: FfiType.Handle,
+ hasRustCallStatus: false,
+ },
"uniffi_cyclops_sdk_fn_method_cyclopsclient_list_templates": {
args: [FfiType.Handle, FfiType.RustBuffer],
ret: FfiType.Handle,
@@ -448,6 +498,11 @@ const DEFINITIONS = {
ret: FfiType.Handle,
hasRustCallStatus: false,
},
+ "uniffi_cyclops_sdk_fn_method_cyclopsclient_revoke_signed_service_url": {
+ 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,
@@ -483,6 +538,31 @@ const DEFINITIONS = {
ret: FfiType.UInt32,
hasRustCallStatus: false,
},
+ "uniffi_cyclops_sdk_checksum_func_healthy_pool_display_status": {
+ args: [],
+ ret: FfiType.UInt16,
+ hasRustCallStatus: false,
+ },
+ "uniffi_cyclops_sdk_checksum_func_pool_display_status": {
+ args: [],
+ ret: FfiType.UInt16,
+ hasRustCallStatus: false,
+ },
+ "uniffi_cyclops_sdk_checksum_func_removed_pool_display_status": {
+ args: [],
+ ret: FfiType.UInt16,
+ hasRustCallStatus: false,
+ },
+ "uniffi_cyclops_sdk_checksum_func_terminating_pool_display_status": {
+ args: [],
+ ret: FfiType.UInt16,
+ hasRustCallStatus: false,
+ },
+ "uniffi_cyclops_sdk_checksum_func_unknown_pool_display_status": {
+ args: [],
+ ret: FfiType.UInt16,
+ hasRustCallStatus: false,
+ },
"uniffi_cyclops_sdk_checksum_method_accesstokenprovider_get_access_token": {
args: [],
ret: FfiType.UInt16,
@@ -528,11 +608,21 @@ const DEFINITIONS = {
ret: FfiType.UInt16,
hasRustCallStatus: false,
},
+ "uniffi_cyclops_sdk_checksum_method_cyclopsclient_create_namespace": {
+ args: [],
+ ret: FfiType.UInt16,
+ hasRustCallStatus: false,
+ },
"uniffi_cyclops_sdk_checksum_method_cyclopsclient_create_pool": {
args: [],
ret: FfiType.UInt16,
hasRustCallStatus: false,
},
+ "uniffi_cyclops_sdk_checksum_method_cyclopsclient_create_signed_service_url": {
+ args: [],
+ ret: FfiType.UInt16,
+ hasRustCallStatus: false,
+ },
"uniffi_cyclops_sdk_checksum_method_cyclopsclient_create_template": {
args: [],
ret: FfiType.UInt16,
@@ -548,6 +638,11 @@ const DEFINITIONS = {
ret: FfiType.UInt16,
hasRustCallStatus: false,
},
+ "uniffi_cyclops_sdk_checksum_method_cyclopsclient_delete_namespace": {
+ args: [],
+ ret: FfiType.UInt16,
+ hasRustCallStatus: false,
+ },
"uniffi_cyclops_sdk_checksum_method_cyclopsclient_delete_pool": {
args: [],
ret: FfiType.UInt16,
@@ -568,6 +663,11 @@ const DEFINITIONS = {
ret: FfiType.UInt16,
hasRustCallStatus: false,
},
+ "uniffi_cyclops_sdk_checksum_method_cyclopsclient_get_namespace": {
+ args: [],
+ ret: FfiType.UInt16,
+ hasRustCallStatus: false,
+ },
"uniffi_cyclops_sdk_checksum_method_cyclopsclient_get_pool": {
args: [],
ret: FfiType.UInt16,
@@ -593,6 +693,11 @@ const DEFINITIONS = {
ret: FfiType.UInt16,
hasRustCallStatus: false,
},
+ "uniffi_cyclops_sdk_checksum_method_cyclopsclient_list_signed_service_urls": {
+ args: [],
+ ret: FfiType.UInt16,
+ hasRustCallStatus: false,
+ },
"uniffi_cyclops_sdk_checksum_method_cyclopsclient_list_templates": {
args: [],
ret: FfiType.UInt16,
@@ -618,6 +723,11 @@ const DEFINITIONS = {
ret: FfiType.UInt16,
hasRustCallStatus: false,
},
+ "uniffi_cyclops_sdk_checksum_method_cyclopsclient_revoke_signed_service_url": {
+ args: [],
+ ret: FfiType.UInt16,
+ hasRustCallStatus: false,
+ },
"uniffi_cyclops_sdk_checksum_method_cyclopsclient_service_request": {
args: [],
ret: FfiType.UInt16,
@@ -779,6 +889,11 @@ interface NativeModuleInterface {
uniffi_cyclops_sdk_fn_free_httpclient(ptr: bigint, uniffi_out_err: UniffiRustCallStatus): 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_func_healthy_pool_display_status(uniffi_out_err: UniffiRustCallStatus): Uint8Array;
+ uniffi_cyclops_sdk_fn_func_pool_display_status(pool: Uint8Array, uniffi_out_err: UniffiRustCallStatus): Uint8Array;
+ uniffi_cyclops_sdk_fn_func_removed_pool_display_status(uniffi_out_err: UniffiRustCallStatus): Uint8Array;
+ uniffi_cyclops_sdk_fn_func_terminating_pool_display_status(uniffi_out_err: UniffiRustCallStatus): Uint8Array;
+ uniffi_cyclops_sdk_fn_func_unknown_pool_display_status(uniffi_out_err: UniffiRustCallStatus): Uint8Array;
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;
@@ -788,24 +903,30 @@ interface NativeModuleInterface {
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_namespace(uniffiSelf: bigint, name: Uint8Array): bigint;
uniffi_cyclops_sdk_fn_method_cyclopsclient_create_pool(uniffiSelf: bigint, request: Uint8Array): bigint;
+ uniffi_cyclops_sdk_fn_method_cyclopsclient_create_signed_service_url(uniffiSelf: bigint, request: Uint8Array): bigint;
uniffi_cyclops_sdk_fn_method_cyclopsclient_create_template(uniffiSelf: bigint, request: Uint8Array): bigint;
uniffi_cyclops_sdk_fn_method_cyclopsclient_create_user_api_key(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_namespace(uniffiSelf: bigint, name: 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_delete_user_api_key(uniffiSelf: bigint, id: Uint8Array): bigint;
uniffi_cyclops_sdk_fn_method_cyclopsclient_get_claim(uniffiSelf: bigint, claim: Uint8Array): bigint;
+ uniffi_cyclops_sdk_fn_method_cyclopsclient_get_namespace(uniffiSelf: bigint, name: 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_namespaces(uniffiSelf: bigint): bigint;
uniffi_cyclops_sdk_fn_method_cyclopsclient_list_pools(uniffiSelf: bigint, namespace: Uint8Array): bigint;
+ uniffi_cyclops_sdk_fn_method_cyclopsclient_list_signed_service_urls(uniffiSelf: bigint, sandbox: Uint8Array): bigint;
uniffi_cyclops_sdk_fn_method_cyclopsclient_list_templates(uniffiSelf: bigint, namespace: Uint8Array): bigint;
uniffi_cyclops_sdk_fn_method_cyclopsclient_list_user_api_keys(uniffiSelf: bigint): 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_renew_claim(uniffiSelf: bigint, claim: Uint8Array, shutdownTime: Uint8Array): bigint;
+ uniffi_cyclops_sdk_fn_method_cyclopsclient_revoke_signed_service_url(uniffiSelf: bigint, signedServiceUrl: 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;
@@ -813,6 +934,11 @@ interface NativeModuleInterface {
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_func_healthy_pool_display_status(): number;
+ uniffi_cyclops_sdk_checksum_func_pool_display_status(): number;
+ uniffi_cyclops_sdk_checksum_func_removed_pool_display_status(): number;
+ uniffi_cyclops_sdk_checksum_func_terminating_pool_display_status(): number;
+ uniffi_cyclops_sdk_checksum_func_unknown_pool_display_status(): 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;
@@ -822,24 +948,30 @@ interface NativeModuleInterface {
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_namespace(): number;
uniffi_cyclops_sdk_checksum_method_cyclopsclient_create_pool(): number;
+ uniffi_cyclops_sdk_checksum_method_cyclopsclient_create_signed_service_url(): number;
uniffi_cyclops_sdk_checksum_method_cyclopsclient_create_template(): number;
uniffi_cyclops_sdk_checksum_method_cyclopsclient_create_user_api_key(): number;
uniffi_cyclops_sdk_checksum_method_cyclopsclient_delete_claim(): number;
+ uniffi_cyclops_sdk_checksum_method_cyclopsclient_delete_namespace(): 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_delete_user_api_key(): number;
uniffi_cyclops_sdk_checksum_method_cyclopsclient_get_claim(): number;
+ uniffi_cyclops_sdk_checksum_method_cyclopsclient_get_namespace(): 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_namespaces(): number;
uniffi_cyclops_sdk_checksum_method_cyclopsclient_list_pools(): number;
+ uniffi_cyclops_sdk_checksum_method_cyclopsclient_list_signed_service_urls(): number;
uniffi_cyclops_sdk_checksum_method_cyclopsclient_list_templates(): number;
uniffi_cyclops_sdk_checksum_method_cyclopsclient_list_user_api_keys(): 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_renew_claim(): number;
+ uniffi_cyclops_sdk_checksum_method_cyclopsclient_revoke_signed_service_url(): 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;
diff --git a/libs/fleet/sdk-bindings/ts-uniffi/fleet_sdk.ts b/libs/fleet/sdk-bindings/ts-uniffi/fleet_sdk.ts
index 6fad0e7393..4c1ded3b16 100644
--- a/libs/fleet/sdk-bindings/ts-uniffi/fleet_sdk.ts
+++ b/libs/fleet/sdk-bindings/ts-uniffi/fleet_sdk.ts
@@ -8,7 +8,7 @@ import { type UniffiRustFutureContinuationCallback, type UniffiForeignFutureDrop
} 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, FfiConverterBool, 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, UniffiEnum, UniffiError, UniffiInternalError, UniffiResult, UniffiRustCaller, destructorGuardSymbol, pointerLiteralSymbol, uniffiCreateFfiConverterString, uniffiCreateRecord, uniffiRustCallAsync, uniffiTraitInterfaceCallAsyncWithError, uniffiTypeNameSymbol, variantOrdinalSymbol,
} from "@ubjs/core";
import uniffiCyclopsSdkSchemaModule from "./cyclops_sdk_schema";
const { FfiConverterTypeClaimSpec, FfiConverterTypeOSGymSandboxClaimStatus, FfiConverterTypeOSGymSandboxTemplateSpec, FfiConverterTypeOSGymSandboxWarmPoolSpec, FfiConverterTypeOSGymSandboxWarmPoolStatus } = uniffiCyclopsSdkSchemaModule.converters;
@@ -23,6 +23,87 @@ const uniffiIsDebug =
// Public interface members begin here.
+export function healthyPoolDisplayStatus(): PoolDisplayStatus {
+ return ((__rb: Uint8Array) => {
+ try {
+ return FfiConverterTypePoolDisplayStatus.lift(__rb);
+ } finally {
+ nativeModule().rustbuffer_free(__rb);
+ }
+ })(uniffiCaller.rustCall(
+ /*caller:*/ (callStatus) => {
+ return nativeModule().uniffi_cyclops_sdk_fn_func_healthy_pool_display_status(
+ callStatus);
+ },
+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
+ ));
+ }
+
+export function poolDisplayStatus(pool: Pool): PoolDisplayStatus {
+ return ((__rb: Uint8Array) => {
+ try {
+ return FfiConverterTypePoolDisplayStatus.lift(__rb);
+ } finally {
+ nativeModule().rustbuffer_free(__rb);
+ }
+ })(uniffiCaller.rustCall(
+ /*caller:*/ (callStatus) => {
+ return nativeModule().uniffi_cyclops_sdk_fn_func_pool_display_status(
+ FfiConverterTypePool.lower(pool, nativeModule().rustbuffer_alloc),
+ callStatus);
+ },
+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
+ ));
+ }
+
+export function removedPoolDisplayStatus(): PoolDisplayStatus {
+ return ((__rb: Uint8Array) => {
+ try {
+ return FfiConverterTypePoolDisplayStatus.lift(__rb);
+ } finally {
+ nativeModule().rustbuffer_free(__rb);
+ }
+ })(uniffiCaller.rustCall(
+ /*caller:*/ (callStatus) => {
+ return nativeModule().uniffi_cyclops_sdk_fn_func_removed_pool_display_status(
+ callStatus);
+ },
+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
+ ));
+ }
+
+export function terminatingPoolDisplayStatus(): PoolDisplayStatus {
+ return ((__rb: Uint8Array) => {
+ try {
+ return FfiConverterTypePoolDisplayStatus.lift(__rb);
+ } finally {
+ nativeModule().rustbuffer_free(__rb);
+ }
+ })(uniffiCaller.rustCall(
+ /*caller:*/ (callStatus) => {
+ return nativeModule().uniffi_cyclops_sdk_fn_func_terminating_pool_display_status(
+ callStatus);
+ },
+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
+ ));
+ }
+
+export function unknownPoolDisplayStatus(): PoolDisplayStatus {
+ return ((__rb: Uint8Array) => {
+ try {
+ return FfiConverterTypePoolDisplayStatus.lift(__rb);
+ } finally {
+ nativeModule().rustbuffer_free(__rb);
+ }
+ })(uniffiCaller.rustCall(
+ /*caller:*/ (callStatus) => {
+ return nativeModule().uniffi_cyclops_sdk_fn_func_unknown_pool_display_status(
+ callStatus);
+ },
+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
+ ));
+ }
+
const stringConverter = (() => {
const encoder = new TextEncoder();
const decoder = new TextDecoder();
@@ -72,8 +153,8 @@ const FfiConverterTypeResourceMetadata = (() => {
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
- namespace: FfiConverterString.read(from),
- name: FfiConverterString.read(from),
+ namespace: FfiConverterString.read(from),
+ name: FfiConverterString.read(from),
labels: FfiConverterOptionalMapStringString.read(from),
creationTimestamp: FfiConverterOptionalString.read(from)
};
@@ -89,7 +170,7 @@ const FfiConverterTypeResourceMetadata = (() => {
FfiConverterString.allocationSize(value.name) +
FfiConverterOptionalMapStringString.allocationSize(value.labels) +
FfiConverterOptionalString.allocationSize(value.creationTimestamp);
-
+
}
};
return new FFIConverter();
@@ -124,10 +205,10 @@ const FfiConverterTypeClaim = (() => {
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
- apiVersion: FfiConverterString.read(from),
- kind: FfiConverterString.read(from),
- metadata: FfiConverterTypeResourceMetadata.read(from),
- spec: FfiConverterTypeClaimSpec.read(from),
+ apiVersion: FfiConverterString.read(from),
+ kind: FfiConverterString.read(from),
+ metadata: FfiConverterTypeResourceMetadata.read(from),
+ spec: FfiConverterTypeClaimSpec.read(from),
status: FfiConverterOptionalTypeOSGymSandboxClaimStatus.read(from)
};
}
@@ -144,7 +225,7 @@ const FfiConverterTypeClaim = (() => {
FfiConverterTypeResourceMetadata.allocationSize(value.metadata) +
FfiConverterTypeClaimSpec.allocationSize(value.spec) +
FfiConverterOptionalTypeOSGymSandboxClaimStatus.allocationSize(value.status);
-
+
}
};
return new FFIConverter();
@@ -188,10 +269,10 @@ const FfiConverterTypePool = (() => {
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
- apiVersion: FfiConverterString.read(from),
- kind: FfiConverterString.read(from),
- metadata: FfiConverterTypeResourceMetadata.read(from),
- spec: FfiConverterTypeOSGymSandboxWarmPoolSpec.read(from),
+ apiVersion: FfiConverterString.read(from),
+ kind: FfiConverterString.read(from),
+ metadata: FfiConverterTypeResourceMetadata.read(from),
+ spec: FfiConverterTypeOSGymSandboxWarmPoolSpec.read(from),
status: FfiConverterOptionalTypeOSGymSandboxWarmPoolStatus.read(from)
};
}
@@ -208,7 +289,7 @@ const FfiConverterTypePool = (() => {
FfiConverterTypeResourceMetadata.allocationSize(value.metadata) +
FfiConverterTypeOSGymSandboxWarmPoolSpec.allocationSize(value.spec) +
FfiConverterOptionalTypeOSGymSandboxWarmPoolStatus.allocationSize(value.status);
-
+
}
};
return new FFIConverter();
@@ -230,7 +311,7 @@ export type CreateClaimRequest = {
*/
export const CreateClaimRequest = (() => {
const defaults = () => ({
- name: undefined,
+ name: undefined
});
const create = (() => {
return uniffiCreateRecord<CreateClaimRequest, ReturnType<typeof defaults>>(defaults);
@@ -247,8 +328,8 @@ const FfiConverterTypeCreateClaimRequest = (() => {
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
- pool: FfiConverterTypePool.read(from),
- spec: FfiConverterOptionalTypeClaimSpec.read(from),
+ pool: FfiConverterTypePool.read(from),
+ spec: FfiConverterOptionalTypeClaimSpec.read(from),
name: FfiConverterOptionalString.read(from)
};
}
@@ -261,7 +342,7 @@ const FfiConverterTypeCreateClaimRequest = (() => {
return FfiConverterTypePool.allocationSize(value.pool) +
FfiConverterOptionalTypeClaimSpec.allocationSize(value.spec) +
FfiConverterOptionalString.allocationSize(value.name);
-
+
}
};
return new FFIConverter();
@@ -293,7 +374,7 @@ const FfiConverterTypeCreatePoolRequest = (() => {
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
- namespace: FfiConverterString.read(from),
+ namespace: FfiConverterString.read(from),
spec: FfiConverterTypeOSGymSandboxWarmPoolSpec.read(from)
};
}
@@ -304,7 +385,109 @@ const FfiConverterTypeCreatePoolRequest = (() => {
allocationSize(value: TypeName): number {
return FfiConverterString.allocationSize(value.namespace) +
FfiConverterTypeOSGymSandboxWarmPoolSpec.allocationSize(value.spec);
-
+
+ }
+ };
+ return new FFIConverter();
+})();
+
+export type Sandbox = {
+ namespace: string,
+ claim: string,
+ name: string,
+ services: Array<string>
+}
+
+/**
+ * Generated factory for {@link Sandbox} record objects.
+ */
+export const Sandbox = (() => {
+ const defaults = () => ({
+ });
+ const create = (() => {
+ return uniffiCreateRecord<Sandbox, ReturnType<typeof defaults>>(defaults);
+ })();
+ return Object.freeze({
+ create,
+ new: create,
+ defaults: () => Object.freeze(defaults()) as Partial<Sandbox>,
+ });
+})();
+
+const FfiConverterTypeSandbox = (() => {
+ type TypeName = Sandbox;
+ class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
+ read(from: RustBuffer): TypeName {
+ return {
+ namespace: FfiConverterString.read(from),
+ claim: FfiConverterString.read(from),
+ name: FfiConverterString.read(from),
+ services: FfiConverterSequenceString.read(from)
+ };
+ }
+ write(value: TypeName, into: RustBuffer): void {
+ FfiConverterString.write(value.namespace, into);
+ FfiConverterString.write(value.claim, into);
+ FfiConverterString.write(value.name, into);
+ FfiConverterSequenceString.write(value.services, into);
+ }
+ allocationSize(value: TypeName): number {
+ return FfiConverterString.allocationSize(value.namespace) +
+ FfiConverterString.allocationSize(value.claim) +
+ FfiConverterString.allocationSize(value.name) +
+ FfiConverterSequenceString.allocationSize(value.services);
+
+ }
+ };
+ return new FFIConverter();
+})();
+
+export type CreateSignedServiceUrlRequest = {
+ sandbox: Sandbox,
+ service: string,
+ label?: string,
+ expiresInSeconds: number
+}
+
+/**
+ * Generated factory for {@link CreateSignedServiceUrlRequest} record objects.
+ */
+export const CreateSignedServiceUrlRequest = (() => {
+ const defaults = () => ({
+ });
+ const create = (() => {
+ return uniffiCreateRecord<CreateSignedServiceUrlRequest, ReturnType<typeof defaults>>(defaults);
+ })();
+ return Object.freeze({
+ create,
+ new: create,
+ defaults: () => Object.freeze(defaults()) as Partial<CreateSignedServiceUrlRequest>,
+ });
+})();
+
+const FfiConverterTypeCreateSignedServiceUrlRequest = (() => {
+ type TypeName = CreateSignedServiceUrlRequest;
+ class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
+ read(from: RustBuffer): TypeName {
+ return {
+ sandbox: FfiConverterTypeSandbox.read(from),
+ service: FfiConverterString.read(from),
+ label: FfiConverterOptionalString.read(from),
+ expiresInSeconds: FfiConverterUInt32.read(from)
+ };
+ }
+ write(value: TypeName, into: RustBuffer): void {
+ FfiConverterTypeSandbox.write(value.sandbox, into);
+ FfiConverterString.write(value.service, into);
+ FfiConverterOptionalString.write(value.label, into);
+ FfiConverterUInt32.write(value.expiresInSeconds, into);
+ }
+ allocationSize(value: TypeName): number {
+ return FfiConverterTypeSandbox.allocationSize(value.sandbox) +
+ FfiConverterString.allocationSize(value.service) +
+ FfiConverterOptionalString.allocationSize(value.label) +
+ FfiConverterUInt32.allocationSize(value.expiresInSeconds);
+
}
};
return new FFIConverter();
@@ -337,8 +520,8 @@ const FfiConverterTypeCreateTemplateRequest = (() => {
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
- namespace: FfiConverterString.read(from),
- name: FfiConverterString.read(from),
+ namespace: FfiConverterString.read(from),
+ name: FfiConverterString.read(from),
spec: FfiConverterTypeOSGymSandboxTemplateSpec.read(from)
};
}
@@ -351,7 +534,7 @@ const FfiConverterTypeCreateTemplateRequest = (() => {
return FfiConverterString.allocationSize(value.namespace) +
FfiConverterString.allocationSize(value.name) +
FfiConverterTypeOSGymSandboxTemplateSpec.allocationSize(value.spec);
-
+
}
};
return new FFIConverter();
@@ -401,7 +584,7 @@ const FfiConverterTypeCreateUserApiKeyRequest = (() => {
})();
export interface CyclopsCredentialsLike {
-
+
}
/**
* @deprecated Use `CyclopsCredentialsLike` instead.
@@ -430,9 +613,9 @@ export class CyclopsCredentials extends UniffiAbstractObject implements CyclopsC
this[destructorGuardSymbol] = uniffiTypeCyclopsCredentialsObjectFactory.bless(pointer);
}
-
-
+
+
uniffiDestroy(): void {
const ptr = (this as any)[destructorGuardSymbol];
@@ -448,16 +631,16 @@ export class CyclopsCredentials extends UniffiAbstractObject implements CyclopsC
return uniffiTypeCyclopsCredentialsObjectFactory.isConcreteType(obj_);
}
-
+
}
const uniffiTypeCyclopsCredentialsObjectFactory: UniffiObjectFactory<CyclopsCredentialsLike> = (() => {
-
+
/// <reference lib="es2021" />
const registry = typeof FinalizationRegistry !== 'undefined' ? new FinalizationRegistry<UniffiHandle>((heldValue: UniffiHandle) => {
uniffiTypeCyclopsCredentialsObjectFactory.freePointer(heldValue);
}) : null;
-
+
return {
create(pointer: UniffiHandle): CyclopsCredentialsLike {
const instance = Object.create(CyclopsCredentials.prototype);
@@ -467,7 +650,7 @@ const uniffiTypeCyclopsCredentialsObjectFactory: UniffiObjectFactory<CyclopsCred
return instance;
},
-
+
bless(p: UniffiHandle): UniffiGcObject {
const ptr = {
p, // make sure this object doesn't get optimized away.
@@ -544,12 +727,12 @@ const FfiConverterTypeCyclopsConfiguration = (() => {
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
- baseUrl: FfiConverterString.read(from),
- tokenUrl: FfiConverterString.read(from),
- credentials: FfiConverterTypeCyclopsCredentials.read(from),
- poolPollIntervalMs: FfiConverterUInt64.read(from),
- poolPollLimit: FfiConverterUInt32.read(from),
- claimPollIntervalMs: FfiConverterUInt64.read(from),
+ baseUrl: FfiConverterString.read(from),
+ tokenUrl: FfiConverterString.read(from),
+ credentials: FfiConverterTypeCyclopsCredentials.read(from),
+ poolPollIntervalMs: FfiConverterUInt64.read(from),
+ poolPollLimit: FfiConverterUInt32.read(from),
+ claimPollIntervalMs: FfiConverterUInt64.read(from),
claimPollLimit: FfiConverterUInt32.read(from)
};
}
@@ -570,7 +753,7 @@ const FfiConverterTypeCyclopsConfiguration = (() => {
FfiConverterUInt32.allocationSize(value.poolPollLimit) +
FfiConverterUInt64.allocationSize(value.claimPollIntervalMs) +
FfiConverterUInt32.allocationSize(value.claimPollLimit);
-
+
}
};
return new FFIConverter();
@@ -605,10 +788,10 @@ const FfiConverterTypeCyclopsTokenProviderConfiguration = (() => {
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),
+ baseUrl: FfiConverterString.read(from),
+ poolPollIntervalMs: FfiConverterUInt64.read(from),
+ poolPollLimit: FfiConverterUInt32.read(from),
+ claimPollIntervalMs: FfiConverterUInt64.read(from),
claimPollLimit: FfiConverterUInt32.read(from)
};
}
@@ -625,7 +808,7 @@ const FfiConverterTypeCyclopsTokenProviderConfiguration = (() => {
FfiConverterUInt32.allocationSize(value.poolPollLimit) +
FfiConverterUInt64.allocationSize(value.claimPollIntervalMs) +
FfiConverterUInt32.allocationSize(value.claimPollLimit);
-
+
}
};
return new FFIConverter();
@@ -657,7 +840,7 @@ const FfiConverterTypeHttpHeader = (() => {
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
- name: FfiConverterString.read(from),
+ name: FfiConverterString.read(from),
value: FfiConverterString.read(from)
};
}
@@ -668,7 +851,7 @@ const FfiConverterTypeHttpHeader = (() => {
allocationSize(value: TypeName): number {
return FfiConverterString.allocationSize(value.name) +
FfiConverterString.allocationSize(value.value);
-
+
}
};
return new FFIConverter();
@@ -679,6 +862,11 @@ export type HttpRequest = {
url: string,
headers: Array<HttpHeader>,
body?: ArrayBuffer,
+ /**
+ * Per-request timeout. Defaults to absent so callers written against the
+ * pre-timeout record shape keep constructing requests unchanged; absent
+ * falls back to the native client's 30-second default.
+ */
timeoutSecs?: bigint
}
@@ -687,6 +875,7 @@ export type HttpRequest = {
*/
export const HttpRequest = (() => {
const defaults = () => ({
+ timeoutSecs: undefined
});
const create = (() => {
return uniffiCreateRecord<HttpRequest, ReturnType<typeof defaults>>(defaults);
@@ -703,9 +892,9 @@ const FfiConverterTypeHttpRequest = (() => {
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
- method: FfiConverterString.read(from),
- url: FfiConverterString.read(from),
- headers: FfiConverterSequenceTypeHttpHeader.read(from),
+ method: FfiConverterString.read(from),
+ url: FfiConverterString.read(from),
+ headers: FfiConverterSequenceTypeHttpHeader.read(from),
body: FfiConverterOptionalBytes.read(from),
timeoutSecs: FfiConverterOptionalUInt64.read(from)
};
@@ -723,7 +912,7 @@ const FfiConverterTypeHttpRequest = (() => {
FfiConverterSequenceTypeHttpHeader.allocationSize(value.headers) +
FfiConverterOptionalBytes.allocationSize(value.body) +
FfiConverterOptionalUInt64.allocationSize(value.timeoutSecs);
-
+
}
};
return new FFIConverter();
@@ -756,8 +945,8 @@ const FfiConverterTypeHttpResponse = (() => {
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
- status: FfiConverterUInt16.read(from),
- headers: FfiConverterSequenceTypeHttpHeader.read(from),
+ status: FfiConverterUInt16.read(from),
+ headers: FfiConverterSequenceTypeHttpHeader.read(from),
body: FfiConverterArrayBuffer.read(from)
};
}
@@ -770,7 +959,7 @@ const FfiConverterTypeHttpResponse = (() => {
return FfiConverterUInt16.allocationSize(value.status) +
FfiConverterSequenceTypeHttpHeader.allocationSize(value.headers) +
FfiConverterArrayBuffer.allocationSize(value.body);
-
+
}
};
return new FFIConverter();
@@ -882,52 +1071,161 @@ const FfiConverterTypeNewUserApiKey = (() => {
return new FFIConverter();
})();
-export type Sandbox = {
+export enum PoolDisplayStatusKind {
+ Healthy,
+ ScaledToZero,
+ Removed,
+ Terminating,
+ Unknown
+}
+
+const FfiConverterTypePoolDisplayStatusKind = (() => {
+ const ordinalConverter = FfiConverterInt32;
+ type TypeName = PoolDisplayStatusKind;
+ class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
+ read(from: RustBuffer): TypeName {
+ switch (ordinalConverter.read(from)) {
+ case 1: return PoolDisplayStatusKind.Healthy;
+ case 2: return PoolDisplayStatusKind.ScaledToZero;
+ case 3: return PoolDisplayStatusKind.Removed;
+ case 4: return PoolDisplayStatusKind.Terminating;
+ case 5: return PoolDisplayStatusKind.Unknown;
+ default: throw new UniffiInternalError.UnexpectedEnumCase();
+ }
+ }
+ write(value: TypeName, into: RustBuffer): void {
+ switch (value) {
+ case PoolDisplayStatusKind.Healthy: return ordinalConverter.write(1, into);
+ case PoolDisplayStatusKind.ScaledToZero: return ordinalConverter.write(2, into);
+ case PoolDisplayStatusKind.Removed: return ordinalConverter.write(3, into);
+ case PoolDisplayStatusKind.Terminating: return ordinalConverter.write(4, into);
+ case PoolDisplayStatusKind.Unknown: return ordinalConverter.write(5, into);
+ }
+ }
+ allocationSize(value: TypeName): number {
+ return ordinalConverter.allocationSize(0);
+ }
+ }
+ return new FFIConverter();
+})();
+
+export type PoolDisplayStatus = {
+ kind: PoolDisplayStatusKind,
+ label: string,
+ indicator: string
+}
+
+/**
+ * Generated factory for {@link PoolDisplayStatus} record objects.
+ */
+export const PoolDisplayStatus = (() => {
+ const defaults = () => ({
+ });
+ const create = (() => {
+ return uniffiCreateRecord<PoolDisplayStatus, ReturnType<typeof defaults>>(defaults);
+ })();
+ return Object.freeze({
+ create,
+ new: create,
+ defaults: () => Object.freeze(defaults()) as Partial<PoolDisplayStatus>,
+ });
+})();
+
+const FfiConverterTypePoolDisplayStatus = (() => {
+ type TypeName = PoolDisplayStatus;
+ class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
+ read(from: RustBuffer): TypeName {
+ return {
+ kind: FfiConverterTypePoolDisplayStatusKind.read(from),
+ label: FfiConverterString.read(from),
+ indicator: FfiConverterString.read(from)
+ };
+ }
+ write(value: TypeName, into: RustBuffer): void {
+ FfiConverterTypePoolDisplayStatusKind.write(value.kind, into);
+ FfiConverterString.write(value.label, into);
+ FfiConverterString.write(value.indicator, into);
+ }
+ allocationSize(value: TypeName): number {
+ return FfiConverterTypePoolDisplayStatusKind.allocationSize(value.kind) +
+ FfiConverterString.allocationSize(value.label) +
+ FfiConverterString.allocationSize(value.indicator);
+
+ }
+ };
+ return new FFIConverter();
+})();
+
+export type SignedServiceUrl = {
+ id: string,
namespace: string,
claim: string,
- name: string,
- services: Array<string>
+ sandbox: string,
+ service: string,
+ label?: string,
+ url: string,
+ createdAt: string,
+ expiresAt: string,
+ revokedAt?: string
}
/**
- * Generated factory for {@link Sandbox} record objects.
+ * Generated factory for {@link SignedServiceUrl} record objects.
*/
-export const Sandbox = (() => {
+export const SignedServiceUrl = (() => {
const defaults = () => ({
});
const create = (() => {
- return uniffiCreateRecord<Sandbox, ReturnType<typeof defaults>>(defaults);
+ return uniffiCreateRecord<SignedServiceUrl, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
- defaults: () => Object.freeze(defaults()) as Partial<Sandbox>,
+ defaults: () => Object.freeze(defaults()) as Partial<SignedServiceUrl>,
});
})();
-const FfiConverterTypeSandbox = (() => {
- type TypeName = Sandbox;
+const FfiConverterTypeSignedServiceUrl = (() => {
+ type TypeName = SignedServiceUrl;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
- namespace: FfiConverterString.read(from),
- claim: FfiConverterString.read(from),
- name: FfiConverterString.read(from),
- services: FfiConverterSequenceString.read(from)
+ id: FfiConverterString.read(from),
+ namespace: FfiConverterString.read(from),
+ claim: FfiConverterString.read(from),
+ sandbox: FfiConverterString.read(from),
+ service: FfiConverterString.read(from),
+ label: FfiConverterOptionalString.read(from),
+ url: FfiConverterString.read(from),
+ createdAt: FfiConverterString.read(from),
+ expiresAt: FfiConverterString.read(from),
+ revokedAt: FfiConverterOptionalString.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
+ FfiConverterString.write(value.id, into);
FfiConverterString.write(value.namespace, into);
FfiConverterString.write(value.claim, into);
- FfiConverterString.write(value.name, into);
- FfiConverterSequenceString.write(value.services, into);
+ FfiConverterString.write(value.sandbox, into);
+ FfiConverterString.write(value.service, into);
+ FfiConverterOptionalString.write(value.label, into);
+ FfiConverterString.write(value.url, into);
+ FfiConverterString.write(value.createdAt, into);
+ FfiConverterString.write(value.expiresAt, into);
+ FfiConverterOptionalString.write(value.revokedAt, into);
}
allocationSize(value: TypeName): number {
- return FfiConverterString.allocationSize(value.namespace) +
+ return FfiConverterString.allocationSize(value.id) +
+ FfiConverterString.allocationSize(value.namespace) +
FfiConverterString.allocationSize(value.claim) +
- FfiConverterString.allocationSize(value.name) +
- FfiConverterSequenceString.allocationSize(value.services);
-
+ FfiConverterString.allocationSize(value.sandbox) +
+ FfiConverterString.allocationSize(value.service) +
+ FfiConverterOptionalString.allocationSize(value.label) +
+ FfiConverterString.allocationSize(value.url) +
+ FfiConverterString.allocationSize(value.createdAt) +
+ FfiConverterString.allocationSize(value.expiresAt) +
+ FfiConverterOptionalString.allocationSize(value.revokedAt);
+
}
};
return new FFIConverter();
@@ -965,9 +1263,9 @@ const FfiConverterTypeTemplate = (() => {
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
- apiVersion: FfiConverterString.read(from),
- kind: FfiConverterString.read(from),
- metadata: FfiConverterTypeResourceMetadata.read(from),
+ apiVersion: FfiConverterString.read(from),
+ kind: FfiConverterString.read(from),
+ metadata: FfiConverterTypeResourceMetadata.read(from),
spec: FfiConverterTypeOSGymSandboxTemplateSpec.read(from)
};
}
@@ -982,7 +1280,7 @@ const FfiConverterTypeTemplate = (() => {
FfiConverterString.allocationSize(value.kind) +
FfiConverterTypeResourceMetadata.allocationSize(value.metadata) +
FfiConverterTypeOSGymSandboxTemplateSpec.allocationSize(value.spec);
-
+
}
};
return new FFIConverter();
@@ -1048,7 +1346,7 @@ export const AccessTokenProviderError = (() => {
type Failed__interface = {
tag: AccessTokenProviderError_Tags.Failed;
- inner:
+ inner:
Readonly<{reason: string}>
};
class Failed_ extends UniffiError implements Failed__interface {
@@ -1058,7 +1356,7 @@ Readonly<{reason: string}>
*/
readonly [uniffiTypeNameSymbol] = "AccessTokenProviderError";
readonly tag = AccessTokenProviderError_Tags.Failed;
- readonly inner:
+ readonly inner:
Readonly<{reason: string}>;
constructor(
inner: {reason: string }) {
@@ -1078,7 +1376,7 @@ inner: {reason: string }): Failed_ {
return Failed_.instanceOf(obj);
}
- static getInner(obj: Failed_):
+ static getInner(obj: Failed_):
Readonly<{reason: string}> {
return obj.inner;
}
@@ -1147,7 +1445,7 @@ export const HttpError = (() => {
type Transport__interface = {
tag: HttpError_Tags.Transport;
- inner:
+ inner:
Readonly<{reason: string}>
};
class Transport_ extends UniffiError implements Transport__interface {
@@ -1157,7 +1455,7 @@ Readonly<{reason: string}>
*/
readonly [uniffiTypeNameSymbol] = "HttpError";
readonly tag = HttpError_Tags.Transport;
- readonly inner:
+ readonly inner:
Readonly<{reason: string}>;
constructor(
inner: {reason: string }) {
@@ -1177,7 +1475,7 @@ inner: {reason: string }): Transport_ {
return Transport_.instanceOf(obj);
}
- static getInner(obj: Transport_):
+ static getInner(obj: Transport_):
Readonly<{reason: string}> {
return obj.inner;
}
@@ -1238,6 +1536,107 @@ const FfiConverterTypeHttpError = (() => {
})();
+// Error type: SdkBuildError
+export enum SdkBuildError_Tags {
+ MissingRequiredField = "MissingRequiredField"
+}
+export const SdkBuildError = (() => {
+
+ type MissingRequiredField__interface = {
+ tag: SdkBuildError_Tags.MissingRequiredField;
+ inner:
+Readonly<{recordType: string; field: string}>
+ };
+ class MissingRequiredField_ extends UniffiError implements MissingRequiredField__interface {
+ /**
+ * @private
+ * This field is private and should not be used, use `tag` instead.
+ */
+ readonly [uniffiTypeNameSymbol] = "SdkBuildError";
+ readonly tag = SdkBuildError_Tags.MissingRequiredField;
+ readonly inner:
+Readonly<{recordType: string; field: string}>;
+ constructor(
+inner: {recordType: string; field: string }) {
+ super("SdkBuildError", "MissingRequiredField");
+
+ this.inner = Object.freeze(inner);
+ }
+ static new(
+inner: {recordType: string; field: string }): MissingRequiredField_ {
+ return new MissingRequiredField_(inner);
+ }
+
+ static instanceOf(obj: any): obj is MissingRequiredField_ {
+ return obj.tag === SdkBuildError_Tags.MissingRequiredField;
+ }
+ static hasInner(obj: any): obj is MissingRequiredField_ {
+ return MissingRequiredField_.instanceOf(obj);
+ }
+
+ static getInner(obj: MissingRequiredField_):
+Readonly<{recordType: string; field: string}> {
+ return obj.inner;
+ }
+
+ }
+
+ function instanceOf(obj: any): obj is SdkBuildError {
+ return obj[uniffiTypeNameSymbol] === "SdkBuildError";
+ }
+
+ return Object.freeze({
+ instanceOf,
+ MissingRequiredField: MissingRequiredField_
+ });
+
+})();
+export type SdkBuildError = InstanceType<
+ typeof SdkBuildError['MissingRequiredField']
+>;
+
+// FfiConverter for enum SdkBuildError
+const FfiConverterTypeSdkBuildError = (() => {
+ const ordinalConverter = FfiConverterInt32;
+ type TypeName = SdkBuildError;
+ class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
+ read(from: RustBuffer): TypeName {
+ switch (ordinalConverter.read(from)) {
+ case 1: return new SdkBuildError.MissingRequiredField({recordType: FfiConverterString.read(from), field: FfiConverterString.read(from) });
+ default: throw new UniffiInternalError.UnexpectedEnumCase();
+ }
+ }
+ write(value: TypeName, into: RustBuffer): void {
+ switch (value.tag) {
+ case SdkBuildError_Tags.MissingRequiredField: {
+ ordinalConverter.write(1, into);
+ const inner = value.inner;
+ FfiConverterString.write(inner.recordType, into);
+ FfiConverterString.write(inner.field, into);
+ return;
+ }
+ default:
+ // Throwing from here means that SdkBuildError_Tags hasn't matched an ordinal.
+ throw new UniffiInternalError.UnexpectedEnumCase();
+ }
+ }
+ allocationSize(value: TypeName): number {
+ switch (value.tag) {
+ case SdkBuildError_Tags.MissingRequiredField: {
+ const inner = value.inner;
+ let size = ordinalConverter.allocationSize(1);
+ size += FfiConverterString.allocationSize(inner.recordType);
+ size += FfiConverterString.allocationSize(inner.field);
+ return size;
+ }
+ default: throw new UniffiInternalError.UnexpectedEnumCase();
+ }
+ }
+ }
+ return new FFIConverter();
+})();
+
+
// Error type: SdkError
export enum SdkError_Tags {
Configuration = "Configuration",
@@ -1246,16 +1645,18 @@ export enum SdkError_Tags {
Token = "Token",
Body = "Body",
Status = "Status",
+ SignedServiceUrlsUnavailable = "SignedServiceUrlsUnavailable",
UnknownService = "UnknownService",
InvalidServicePath = "InvalidServicePath",
ClaimFailed = "ClaimFailed",
- ClaimTimeout = "ClaimTimeout"
+ ClaimTimeout = "ClaimTimeout",
+ PoolAccessDenied = "PoolAccessDenied"
}
export const SdkError = (() => {
type Configuration__interface = {
tag: SdkError_Tags.Configuration;
- inner:
+ inner:
Readonly<{reason: string}>
};
class Configuration_ extends UniffiError implements Configuration__interface {
@@ -1265,7 +1666,7 @@ Readonly<{reason: string}>
*/
readonly [uniffiTypeNameSymbol] = "SdkError";
readonly tag = SdkError_Tags.Configuration;
- readonly inner:
+ readonly inner:
Readonly<{reason: string}>;
constructor(
inner: {reason: string }) {
@@ -1285,7 +1686,7 @@ inner: {reason: string }): Configuration_ {
return Configuration_.instanceOf(obj);
}
- static getInner(obj: Configuration_):
+ static getInner(obj: Configuration_):
Readonly<{reason: string}> {
return obj.inner;
}
@@ -1294,7 +1695,7 @@ Readonly<{reason: string}> {
type InvalidResourceName__interface = {
tag: SdkError_Tags.InvalidResourceName;
- inner:
+ inner:
Readonly<{field: string; value: string; reason: string}>
};
class InvalidResourceName_ extends UniffiError implements InvalidResourceName__interface {
@@ -1304,7 +1705,7 @@ Readonly<{field: string; value: string; reason: string}>
*/
readonly [uniffiTypeNameSymbol] = "SdkError";
readonly tag = SdkError_Tags.InvalidResourceName;
- readonly inner:
+ readonly inner:
Readonly<{field: string; value: string; reason: string}>;
constructor(
inner: {field: string; value: string; reason: string }) {
@@ -1324,7 +1725,7 @@ inner: {field: string; value: string; reason: string }): InvalidResourceName_ {
return InvalidResourceName_.instanceOf(obj);
}
- static getInner(obj: InvalidResourceName_):
+ static getInner(obj: InvalidResourceName_):
Readonly<{field: string; value: string; reason: string}> {
return obj.inner;
}
@@ -1333,7 +1734,7 @@ Readonly<{field: string; value: string; reason: string}> {
type Transport__interface = {
tag: SdkError_Tags.Transport;
- inner:
+ inner:
Readonly<{reason: string}>
};
class Transport_ extends UniffiError implements Transport__interface {
@@ -1343,7 +1744,7 @@ Readonly<{reason: string}>
*/
readonly [uniffiTypeNameSymbol] = "SdkError";
readonly tag = SdkError_Tags.Transport;
- readonly inner:
+ readonly inner:
Readonly<{reason: string}>;
constructor(
inner: {reason: string }) {
@@ -1363,7 +1764,7 @@ inner: {reason: string }): Transport_ {
return Transport_.instanceOf(obj);
}
- static getInner(obj: Transport_):
+ static getInner(obj: Transport_):
Readonly<{reason: string}> {
return obj.inner;
}
@@ -1372,7 +1773,7 @@ Readonly<{reason: string}> {
type Token__interface = {
tag: SdkError_Tags.Token;
- inner:
+ inner:
Readonly<{reason: string}>
};
class Token_ extends UniffiError implements Token__interface {
@@ -1382,7 +1783,7 @@ Readonly<{reason: string}>
*/
readonly [uniffiTypeNameSymbol] = "SdkError";
readonly tag = SdkError_Tags.Token;
- readonly inner:
+ readonly inner:
Readonly<{reason: string}>;
constructor(
inner: {reason: string }) {
@@ -1402,7 +1803,7 @@ inner: {reason: string }): Token_ {
return Token_.instanceOf(obj);
}
- static getInner(obj: Token_):
+ static getInner(obj: Token_):
Readonly<{reason: string}> {
return obj.inner;
}
@@ -1411,7 +1812,7 @@ Readonly<{reason: string}> {
type Body__interface = {
tag: SdkError_Tags.Body;
- inner:
+ inner:
Readonly<{reason: string}>
};
class Body_ extends UniffiError implements Body__interface {
@@ -1421,7 +1822,7 @@ Readonly<{reason: string}>
*/
readonly [uniffiTypeNameSymbol] = "SdkError";
readonly tag = SdkError_Tags.Body;
- readonly inner:
+ readonly inner:
Readonly<{reason: string}>;
constructor(
inner: {reason: string }) {
@@ -1441,7 +1842,7 @@ inner: {reason: string }): Body_ {
return Body_.instanceOf(obj);
}
- static getInner(obj: Body_):
+ static getInner(obj: Body_):
Readonly<{reason: string}> {
return obj.inner;
}
@@ -1450,7 +1851,7 @@ Readonly<{reason: string}> {
type Status__interface = {
tag: SdkError_Tags.Status;
- inner:
+ inner:
Readonly<{operation: string; status: number; body: string}>
};
class Status_ extends UniffiError implements Status__interface {
@@ -1460,7 +1861,7 @@ Readonly<{operation: string; status: number; body: string}>
*/
readonly [uniffiTypeNameSymbol] = "SdkError";
readonly tag = SdkError_Tags.Status;
- readonly inner:
+ readonly inner:
Readonly<{operation: string; status: number; body: string}>;
constructor(
inner: {operation: string; status: number; body: string }) {
@@ -1480,16 +1881,43 @@ inner: {operation: string; status: number; body: string }): Status_ {
return Status_.instanceOf(obj);
}
- static getInner(obj: Status_):
+ static getInner(obj: Status_):
Readonly<{operation: string; status: number; body: string}> {
return obj.inner;
}
}
+ type SignedServiceUrlsUnavailable__interface = {
+ tag: SdkError_Tags.SignedServiceUrlsUnavailable
+ };
+ class SignedServiceUrlsUnavailable_ extends UniffiError implements SignedServiceUrlsUnavailable__interface {
+ /**
+ * @private
+ * This field is private and should not be used, use `tag` instead.
+ */
+ readonly [uniffiTypeNameSymbol] = "SdkError";
+ readonly tag = SdkError_Tags.SignedServiceUrlsUnavailable;
+ constructor() {
+ super("SdkError", "SignedServiceUrlsUnavailable");
+ }
+
+ static new(): SignedServiceUrlsUnavailable_ {
+ return new SignedServiceUrlsUnavailable_();
+ }
+
+ static instanceOf(obj: any): obj is SignedServiceUrlsUnavailable_ {
+ return obj.tag === SdkError_Tags.SignedServiceUrlsUnavailable;
+ }
+ static hasInner(obj: any): obj is SignedServiceUrlsUnavailable_ {
+ return false;
+ }
+
+ }
+
type UnknownService__interface = {
tag: SdkError_Tags.UnknownService;
- inner:
+ inner:
Readonly<{requested: string; available: Array<string>}>
};
class UnknownService_ extends UniffiError implements UnknownService__interface {
@@ -1499,7 +1927,7 @@ Readonly<{requested: string; available: Array<string>}>
*/
readonly [uniffiTypeNameSymbol] = "SdkError";
readonly tag = SdkError_Tags.UnknownService;
- readonly inner:
+ readonly inner:
Readonly<{requested: string; available: Array<string>}>;
constructor(
inner: {requested: string; available: Array<string> }) {
@@ -1519,7 +1947,7 @@ inner: {requested: string; available: Array<string> }): UnknownService_ {
return UnknownService_.instanceOf(obj);
}
- static getInner(obj: UnknownService_):
+ static getInner(obj: UnknownService_):
Readonly<{requested: string; available: Array<string>}> {
return obj.inner;
}
@@ -1528,7 +1956,7 @@ Readonly<{requested: string; available: Array<string>}> {
type InvalidServicePath__interface = {
tag: SdkError_Tags.InvalidServicePath;
- inner:
+ inner:
Readonly<{path: string}>
};
class InvalidServicePath_ extends UniffiError implements InvalidServicePath__interface {
@@ -1538,7 +1966,7 @@ Readonly<{path: string}>
*/
readonly [uniffiTypeNameSymbol] = "SdkError";
readonly tag = SdkError_Tags.InvalidServicePath;
- readonly inner:
+ readonly inner:
Readonly<{path: string}>;
constructor(
inner: {path: string }) {
@@ -1558,7 +1986,7 @@ inner: {path: string }): InvalidServicePath_ {
return InvalidServicePath_.instanceOf(obj);
}
- static getInner(obj: InvalidServicePath_):
+ static getInner(obj: InvalidServicePath_):
Readonly<{path: string}> {
return obj.inner;
}
@@ -1567,7 +1995,7 @@ Readonly<{path: string}> {
type ClaimFailed__interface = {
tag: SdkError_Tags.ClaimFailed;
- inner:
+ inner:
Readonly<{phase: string; status: string}>
};
class ClaimFailed_ extends UniffiError implements ClaimFailed__interface {
@@ -1577,7 +2005,7 @@ Readonly<{phase: string; status: string}>
*/
readonly [uniffiTypeNameSymbol] = "SdkError";
readonly tag = SdkError_Tags.ClaimFailed;
- readonly inner:
+ readonly inner:
Readonly<{phase: string; status: string}>;
constructor(
inner: {phase: string; status: string }) {
@@ -1597,7 +2025,7 @@ inner: {phase: string; status: string }): ClaimFailed_ {
return ClaimFailed_.instanceOf(obj);
}
- static getInner(obj: ClaimFailed_):
+ static getInner(obj: ClaimFailed_):
Readonly<{phase: string; status: string}> {
return obj.inner;
}
@@ -1631,27 +2059,68 @@ Readonly<{phase: string; status: string}> {
}
+ type PoolAccessDenied__interface = {
+ tag: SdkError_Tags.PoolAccessDenied;
+ inner:
+Readonly<{operation: string; namespace: string; status: number; body: string}>
+ };
+ class PoolAccessDenied_ extends UniffiError implements PoolAccessDenied__interface {
+ /**
+ * @private
+ * This field is private and should not be used, use `tag` instead.
+ */
+ readonly [uniffiTypeNameSymbol] = "SdkError";
+ readonly tag = SdkError_Tags.PoolAccessDenied;
+ readonly inner:
+Readonly<{operation: string; namespace: string; status: number; body: string}>;
+ constructor(
+inner: {operation: string; namespace: string; status: number; body: string }) {
+ super("SdkError", "PoolAccessDenied");
+
+ this.inner = Object.freeze(inner);
+ }
+ static new(
+inner: {operation: string; namespace: string; status: number; body: string }): PoolAccessDenied_ {
+ return new PoolAccessDenied_(inner);
+ }
+
+ static instanceOf(obj: any): obj is PoolAccessDenied_ {
+ return obj.tag === SdkError_Tags.PoolAccessDenied;
+ }
+ static hasInner(obj: any): obj is PoolAccessDenied_ {
+ return PoolAccessDenied_.instanceOf(obj);
+ }
+
+ static getInner(obj: PoolAccessDenied_):
+Readonly<{operation: string; namespace: string; status: number; body: string}> {
+ return obj.inner;
+ }
+
+ }
+
function instanceOf(obj: any): obj is SdkError {
return obj[uniffiTypeNameSymbol] === "SdkError";
}
return Object.freeze({
instanceOf,
- Configuration: Configuration_,
- InvalidResourceName: InvalidResourceName_,
- Transport: Transport_,
- Token: Token_,
- Body: Body_,
- Status: Status_,
- UnknownService: UnknownService_,
- InvalidServicePath: InvalidServicePath_,
- ClaimFailed: ClaimFailed_,
- ClaimTimeout: ClaimTimeout_
+ Configuration: Configuration_,
+ InvalidResourceName: InvalidResourceName_,
+ Transport: Transport_,
+ Token: Token_,
+ Body: Body_,
+ Status: Status_,
+ SignedServiceUrlsUnavailable: SignedServiceUrlsUnavailable_,
+ UnknownService: UnknownService_,
+ InvalidServicePath: InvalidServicePath_,
+ ClaimFailed: ClaimFailed_,
+ ClaimTimeout: ClaimTimeout_,
+ PoolAccessDenied: PoolAccessDenied_
});
})();
export type SdkError = InstanceType<
- typeof SdkError['Configuration' | 'InvalidResourceName' | 'Transport' | 'Token' | 'Body' | 'Status' | 'UnknownService' | 'InvalidServicePath' | 'ClaimFailed' | 'ClaimTimeout']
+ typeof SdkError['Configuration' | 'InvalidResourceName' | 'Transport' | 'Token' | 'Body' | 'Status' | 'SignedServiceUrlsUnavailable' | 'UnknownService' | 'InvalidServicePath' | 'ClaimFailed' | 'ClaimTimeout' | 'PoolAccessDenied']
>;
// FfiConverter for enum SdkError
@@ -1667,10 +2136,12 @@ const FfiConverterTypeSdkError = (() => {
case 4: return new SdkError.Token({reason: FfiConverterString.read(from) });
case 5: return new SdkError.Body({reason: FfiConverterString.read(from) });
case 6: return new SdkError.Status({operation: FfiConverterString.read(from), status: FfiConverterUInt16.read(from), body: FfiConverterString.read(from) });
- case 7: return new SdkError.UnknownService({requested: FfiConverterString.read(from), available: FfiConverterSequenceString.read(from) });
- case 8: return new SdkError.InvalidServicePath({path: FfiConverterString.read(from) });
- case 9: return new SdkError.ClaimFailed({phase: FfiConverterString.read(from), status: FfiConverterString.read(from) });
- case 10: return new SdkError.ClaimTimeout();
+ case 7: return new SdkError.SignedServiceUrlsUnavailable();
+ case 8: return new SdkError.UnknownService({requested: FfiConverterString.read(from), available: FfiConverterSequenceString.read(from) });
+ case 9: return new SdkError.InvalidServicePath({path: FfiConverterString.read(from) });
+ case 10: return new SdkError.ClaimFailed({phase: FfiConverterString.read(from), status: FfiConverterString.read(from) });
+ case 11: return new SdkError.ClaimTimeout();
+ case 12: return new SdkError.PoolAccessDenied({operation: FfiConverterString.read(from), namespace: FfiConverterString.read(from), status: FfiConverterUInt16.read(from), body: FfiConverterString.read(from) });
default: throw new UniffiInternalError.UnexpectedEnumCase();
}
}
@@ -1716,28 +2187,41 @@ const FfiConverterTypeSdkError = (() => {
FfiConverterString.write(inner.body, into);
return;
}
+ case SdkError_Tags.SignedServiceUrlsUnavailable: {
+ ordinalConverter.write(7, into);
+ return;
+ }
case SdkError_Tags.UnknownService: {
- ordinalConverter.write(7, into);
+ ordinalConverter.write(8, into);
const inner = value.inner;
FfiConverterString.write(inner.requested, into);
FfiConverterSequenceString.write(inner.available, into);
return;
}
case SdkError_Tags.InvalidServicePath: {
- ordinalConverter.write(8, into);
+ ordinalConverter.write(9, into);
const inner = value.inner;
FfiConverterString.write(inner.path, into);
return;
}
case SdkError_Tags.ClaimFailed: {
- ordinalConverter.write(9, into);
+ ordinalConverter.write(10, into);
const inner = value.inner;
FfiConverterString.write(inner.phase, into);
FfiConverterString.write(inner.status, into);
return;
}
case SdkError_Tags.ClaimTimeout: {
- ordinalConverter.write(10, into);
+ ordinalConverter.write(11, into);
+ return;
+ }
+ case SdkError_Tags.PoolAccessDenied: {
+ ordinalConverter.write(12, into);
+ const inner = value.inner;
+ FfiConverterString.write(inner.operation, into);
+ FfiConverterString.write(inner.namespace, into);
+ FfiConverterUInt16.write(inner.status, into);
+ FfiConverterString.write(inner.body, into);
return;
}
default:
@@ -1787,28 +2271,40 @@ const FfiConverterTypeSdkError = (() => {
size += FfiConverterString.allocationSize(inner.body);
return size;
}
+ case SdkError_Tags.SignedServiceUrlsUnavailable: {
+ return ordinalConverter.allocationSize(7);
+ }
case SdkError_Tags.UnknownService: {
const inner = value.inner;
- let size = ordinalConverter.allocationSize(7);
+ let size = ordinalConverter.allocationSize(8);
size += FfiConverterString.allocationSize(inner.requested);
size += FfiConverterSequenceString.allocationSize(inner.available);
return size;
}
case SdkError_Tags.InvalidServicePath: {
const inner = value.inner;
- let size = ordinalConverter.allocationSize(8);
+ let size = ordinalConverter.allocationSize(9);
size += FfiConverterString.allocationSize(inner.path);
return size;
}
case SdkError_Tags.ClaimFailed: {
const inner = value.inner;
- let size = ordinalConverter.allocationSize(9);
+ let size = ordinalConverter.allocationSize(10);
size += FfiConverterString.allocationSize(inner.phase);
size += FfiConverterString.allocationSize(inner.status);
return size;
}
case SdkError_Tags.ClaimTimeout: {
- return ordinalConverter.allocationSize(10);
+ return ordinalConverter.allocationSize(11);
+ }
+ case SdkError_Tags.PoolAccessDenied: {
+ const inner = value.inner;
+ let size = ordinalConverter.allocationSize(12);
+ size += FfiConverterString.allocationSize(inner.operation);
+ size += FfiConverterString.allocationSize(inner.namespace);
+ size += FfiConverterUInt16.allocationSize(inner.status);
+ size += FfiConverterString.allocationSize(inner.body);
+ return size;
}
default: throw new UniffiInternalError.UnexpectedEnumCase();
}
@@ -1818,7 +2314,7 @@ const FfiConverterTypeSdkError = (() => {
})();
export interface AccessTokenProvider {
-
+
getAccessToken(forceRefresh: boolean, asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<string>;
}
@@ -1835,9 +2331,9 @@ private constructor(pointer: UniffiHandle) {
this[destructorGuardSymbol] = uniffiTypeAccessTokenProviderImplObjectFactory.bless(pointer);
}
-
-
+
+
async getAccessToken(forceRefresh: boolean, asyncOpts_?: { signal: AbortSignal }): Promise<string> /*throws*/ {
const __stack = uniffiIsDebug ? new Error().stack : undefined;
try {
@@ -1869,7 +2365,7 @@ private constructor(pointer: UniffiHandle) {
throw __error;
}
}
-
+
uniffiDestroy(): void {
const ptr = (this as any)[destructorGuardSymbol];
@@ -1885,16 +2381,16 @@ private constructor(pointer: UniffiHandle) {
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);
@@ -1904,7 +2400,7 @@ const uniffiTypeAccessTokenProviderImplObjectFactory: UniffiObjectFactory<Access
return instance;
},
-
+
bless(p: UniffiHandle): UniffiGcObject {
const ptr = {
p, // make sure this object doesn't get optimized away.
@@ -1962,7 +2458,7 @@ const uniffiCallbackInterfaceAccessTokenProvider: { vtable: any; register: () =>
forceRefresh: number,
uniffiFutureCallback: UniffiForeignFutureCompleterustBuffer,
uniffiCallbackData: bigint) => {
- const uniffiMakeCall =
+ const uniffiMakeCall =
async (signal: AbortSignal)
: Promise<string> => {
const jsCallback = FfiConverterTypeAccessTokenProvider.lift(uniffiHandle);
@@ -2017,34 +2513,40 @@ const uniffiCallbackInterfaceAccessTokenProvider: { vtable: any; register: () =>
};
export interface CyclopsClientLike {
-
+
createClaim(request: CreateClaimRequest, asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<Claim>;
+ createNamespace(name: string, asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<Namespace>;
createPool(request: CreatePoolRequest, asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<Pool>;
+ createSignedServiceUrl(request: CreateSignedServiceUrlRequest, asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<SignedServiceUrl>;
createTemplate(request: CreateTemplateRequest, asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<Template>;
createUserApiKey(request: CreateUserApiKeyRequest, asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<NewUserApiKey>;
deleteClaim(claim: Claim, asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<void>;
+ deleteNamespace(name: string, asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<void>;
deletePool(pool: Pool, asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<void>;
deleteTemplate(template: Template, asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<void>;
deleteUserApiKey(id: string, asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<void>;
getClaim(claim: Claim, asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<Claim>;
+ getNamespace(name: string, asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<Namespace>;
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>>;
listNamespaces(asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<Array<Namespace>>;
listPools(namespace: string, asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<Array<Pool>>;
+ listSignedServiceUrls(sandbox: Sandbox, asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<Array<SignedServiceUrl>>;
listTemplates(namespace: string, asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<Array<Template>>;
listUserApiKeys(asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<Array<UserApiKey>>;
reconcilePool(request: CreatePoolRequest, asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<Pool>;
reconcileTemplate(request: CreateTemplateRequest, asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<Template>;
- /**
- * Push the claim's `spec.lifecycle.shutdownTime` forward. That absolute
- * expiry is the only liveness input the pool operator's claim reaper
- * honors, so a holder that outlives its current lease must renew before
- * the deadline passes or the bound sandbox is deleted underneath it.
- * Deliberately narrower than a claim update: nothing else on the claim
- * can be mutated through the SDK.
- */
+/**
+ * Push the claim's `spec.lifecycle.shutdownTime` forward. That absolute
+ * expiry is the only liveness input the pool operator's claim reaper
+ * honors, so a holder that outlives its current lease must renew before
+ * the deadline passes or the bound sandbox is deleted underneath it.
+ * Deliberately narrower than a claim update: nothing else on the claim
+ * can be mutated through the SDK.
+ */
renewClaim(claim: Claim, shutdownTime: string, asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<Claim>;
+ revokeSignedServiceUrl(signedServiceUrl: SignedServiceUrl, asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<void>;
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>;
@@ -2068,7 +2570,7 @@ private constructor(pointer: UniffiHandle) {
this[destructorGuardSymbol] = uniffiTypeCyclopsClientObjectFactory.bless(pointer);
}
-
+
static connect(configuration: CyclopsConfiguration, httpClient: HttpClient): CyclopsClientLike /*throws*/ {
return FfiConverterTypeCyclopsClient.lift(uniffiCaller.rustCallWithError(
/*liftError:*/ FfiConverterTypeSdkError.lift.bind(FfiConverterTypeSdkError),
@@ -2081,7 +2583,7 @@ private constructor(pointer: UniffiHandle) {
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
));
}
-
+
static connectBrowserWithAccessToken(configuration: CyclopsTokenProviderConfiguration, accessToken: string): CyclopsClientLike /*throws*/ {
return FfiConverterTypeCyclopsClient.lift(uniffiCaller.rustCallWithError(
/*liftError:*/ FfiConverterTypeSdkError.lift.bind(FfiConverterTypeSdkError),
@@ -2094,7 +2596,7 @@ private constructor(pointer: UniffiHandle) {
/*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),
@@ -2108,7 +2610,7 @@ private constructor(pointer: UniffiHandle) {
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
));
}
-
+
static connectWithAccessTokenAndNativeHttpClient(configuration: CyclopsTokenProviderConfiguration, accessToken: string): CyclopsClientLike /*throws*/ {
return FfiConverterTypeCyclopsClient.lift(uniffiCaller.rustCallWithError(
/*liftError:*/ FfiConverterTypeSdkError.lift.bind(FfiConverterTypeSdkError),
@@ -2121,7 +2623,7 @@ private constructor(pointer: UniffiHandle) {
/*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),
@@ -2135,7 +2637,7 @@ private constructor(pointer: UniffiHandle) {
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
));
}
-
+
static connectWithAccessTokenProviderAndNativeHttpClient(configuration: CyclopsTokenProviderConfiguration, tokenProvider: AccessTokenProvider): CyclopsClientLike /*throws*/ {
return FfiConverterTypeCyclopsClient.lift(uniffiCaller.rustCallWithError(
/*liftError:*/ FfiConverterTypeSdkError.lift.bind(FfiConverterTypeSdkError),
@@ -2148,7 +2650,7 @@ private constructor(pointer: UniffiHandle) {
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
));
}
-
+
static connectWithNativeHttpClient(configuration: CyclopsConfiguration): CyclopsClientLike /*throws*/ {
return FfiConverterTypeCyclopsClient.lift(uniffiCaller.rustCallWithError(
/*liftError:*/ FfiConverterTypeSdkError.lift.bind(FfiConverterTypeSdkError),
@@ -2160,9 +2662,9 @@ private constructor(pointer: UniffiHandle) {
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
));
}
-
-
+
+
async createClaim(request: CreateClaimRequest, asyncOpts_?: { signal: AbortSignal }): Promise<Claim> /*throws*/ {
const __stack = uniffiIsDebug ? new Error().stack : undefined;
try {
@@ -2194,7 +2696,39 @@ private constructor(pointer: UniffiHandle) {
throw __error;
}
}
-
+
+ async createNamespace(name: string, asyncOpts_?: { signal: AbortSignal }): Promise<Namespace> /*throws*/ {
+ const __stack = uniffiIsDebug ? new Error().stack : undefined;
+ try {
+ return await uniffiRustCallAsync(
+ /*rustCaller:*/ uniffiCaller,
+ /*rustFutureFunc:*/ () => {
+ return nativeModule().uniffi_cyclops_sdk_fn_method_cyclopsclient_create_namespace(
+ uniffiTypeCyclopsClientObjectFactory.clonePointer(this),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:*/ FfiConverterTypeNamespace.lift.bind(FfiConverterTypeNamespace),
+ /*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 {
@@ -2226,7 +2760,39 @@ private constructor(pointer: UniffiHandle) {
throw __error;
}
}
-
+
+ async createSignedServiceUrl(request: CreateSignedServiceUrlRequest, asyncOpts_?: { signal: AbortSignal }): Promise<SignedServiceUrl> /*throws*/ {
+ const __stack = uniffiIsDebug ? new Error().stack : undefined;
+ try {
+ return await uniffiRustCallAsync(
+ /*rustCaller:*/ uniffiCaller,
+ /*rustFutureFunc:*/ () => {
+ return nativeModule().uniffi_cyclops_sdk_fn_method_cyclopsclient_create_signed_service_url(
+ uniffiTypeCyclopsClientObjectFactory.clonePointer(this),FfiConverterTypeCreateSignedServiceUrlRequest.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:*/ FfiConverterTypeSignedServiceUrl.lift.bind(FfiConverterTypeSignedServiceUrl),
+ /*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 {
@@ -2258,7 +2824,7 @@ private constructor(pointer: UniffiHandle) {
throw __error;
}
}
-
+
async createUserApiKey(request: CreateUserApiKeyRequest, asyncOpts_?: { signal: AbortSignal }): Promise<NewUserApiKey> /*throws*/ {
const __stack = uniffiIsDebug ? new Error().stack : undefined;
try {
@@ -2317,7 +2883,34 @@ private constructor(pointer: UniffiHandle) {
throw __error;
}
}
-
+
+ async deleteNamespace(name: string, 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_namespace(
+ uniffiTypeCyclopsClientObjectFactory.clonePointer(this),FfiConverterString.lower(name, 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 deletePool(pool: Pool, asyncOpts_?: { signal: AbortSignal }): Promise<void> /*throws*/ {
const __stack = uniffiIsDebug ? new Error().stack : undefined;
try {
@@ -2344,7 +2937,7 @@ private constructor(pointer: UniffiHandle) {
throw __error;
}
}
-
+
async deleteTemplate(template: Template, asyncOpts_?: { signal: AbortSignal }): Promise<void> /*throws*/ {
const __stack = uniffiIsDebug ? new Error().stack : undefined;
try {
@@ -2371,7 +2964,7 @@ private constructor(pointer: UniffiHandle) {
throw __error;
}
}
-
+
async deleteUserApiKey(id: string, asyncOpts_?: { signal: AbortSignal }): Promise<void> /*throws*/ {
const __stack = uniffiIsDebug ? new Error().stack : undefined;
try {
@@ -2430,7 +3023,39 @@ private constructor(pointer: UniffiHandle) {
throw __error;
}
}
-
+
+ async getNamespace(name: string, asyncOpts_?: { signal: AbortSignal }): Promise<Namespace> /*throws*/ {
+ const __stack = uniffiIsDebug ? new Error().stack : undefined;
+ try {
+ return await uniffiRustCallAsync(
+ /*rustCaller:*/ uniffiCaller,
+ /*rustFutureFunc:*/ () => {
+ return nativeModule().uniffi_cyclops_sdk_fn_method_cyclopsclient_get_namespace(
+ uniffiTypeCyclopsClientObjectFactory.clonePointer(this),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:*/ FfiConverterTypeNamespace.lift.bind(FfiConverterTypeNamespace),
+ /*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 getPool(name: string, asyncOpts_?: { signal: AbortSignal }): Promise<Pool> /*throws*/ {
const __stack = uniffiIsDebug ? new Error().stack : undefined;
try {
@@ -2462,7 +3087,7 @@ private constructor(pointer: UniffiHandle) {
throw __error;
}
}
-
+
async getTemplate(namespace: string, name: string, asyncOpts_?: { signal: AbortSignal }): Promise<Template> /*throws*/ {
const __stack = uniffiIsDebug ? new Error().stack : undefined;
try {
@@ -2494,7 +3119,7 @@ private constructor(pointer: UniffiHandle) {
throw __error;
}
}
-
+
async listClaims(namespace: string, asyncOpts_?: { signal: AbortSignal }): Promise<Array<Claim>> /*throws*/ {
const __stack = uniffiIsDebug ? new Error().stack : undefined;
try {
@@ -2526,7 +3151,7 @@ private constructor(pointer: UniffiHandle) {
throw __error;
}
}
-
+
async listNamespaces(asyncOpts_?: { signal: AbortSignal }): Promise<Array<Namespace>> /*throws*/ {
const __stack = uniffiIsDebug ? new Error().stack : undefined;
try {
@@ -2590,7 +3215,39 @@ private constructor(pointer: UniffiHandle) {
throw __error;
}
}
-
+
+ async listSignedServiceUrls(sandbox: Sandbox, asyncOpts_?: { signal: AbortSignal }): Promise<Array<SignedServiceUrl>> /*throws*/ {
+ const __stack = uniffiIsDebug ? new Error().stack : undefined;
+ try {
+ return await uniffiRustCallAsync(
+ /*rustCaller:*/ uniffiCaller,
+ /*rustFutureFunc:*/ () => {
+ return nativeModule().uniffi_cyclops_sdk_fn_method_cyclopsclient_list_signed_service_urls(
+ uniffiTypeCyclopsClientObjectFactory.clonePointer(this),FfiConverterTypeSandbox.lower(sandbox, 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:*/ FfiConverterSequenceTypeSignedServiceUrl.lift.bind(FfiConverterSequenceTypeSignedServiceUrl),
+ /*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 listTemplates(namespace: string, asyncOpts_?: { signal: AbortSignal }): Promise<Array<Template>> /*throws*/ {
const __stack = uniffiIsDebug ? new Error().stack : undefined;
try {
@@ -2622,7 +3279,7 @@ private constructor(pointer: UniffiHandle) {
throw __error;
}
}
-
+
async listUserApiKeys(asyncOpts_?: { signal: AbortSignal }): Promise<Array<UserApiKey>> /*throws*/ {
const __stack = uniffiIsDebug ? new Error().stack : undefined;
try {
@@ -2686,7 +3343,7 @@ private constructor(pointer: UniffiHandle) {
throw __error;
}
}
-
+
async reconcileTemplate(request: CreateTemplateRequest, asyncOpts_?: { signal: AbortSignal }): Promise<Template> /*throws*/ {
const __stack = uniffiIsDebug ? new Error().stack : undefined;
try {
@@ -2718,15 +3375,15 @@ private constructor(pointer: UniffiHandle) {
throw __error;
}
}
-
- /**
- * Push the claim's `spec.lifecycle.shutdownTime` forward. That absolute
- * expiry is the only liveness input the pool operator's claim reaper
- * honors, so a holder that outlives its current lease must renew before
- * the deadline passes or the bound sandbox is deleted underneath it.
- * Deliberately narrower than a claim update: nothing else on the claim
- * can be mutated through the SDK.
- */
+
+/**
+ * Push the claim's `spec.lifecycle.shutdownTime` forward. That absolute
+ * expiry is the only liveness input the pool operator's claim reaper
+ * honors, so a holder that outlives its current lease must renew before
+ * the deadline passes or the bound sandbox is deleted underneath it.
+ * Deliberately narrower than a claim update: nothing else on the claim
+ * can be mutated through the SDK.
+ */
async renewClaim(claim: Claim, shutdownTime: string, asyncOpts_?: { signal: AbortSignal }): Promise<Claim> /*throws*/ {
const __stack = uniffiIsDebug ? new Error().stack : undefined;
try {
@@ -2758,7 +3415,34 @@ private constructor(pointer: UniffiHandle) {
throw __error;
}
}
-
+
+ async revokeSignedServiceUrl(signedServiceUrl: SignedServiceUrl, 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_revoke_signed_service_url(
+ uniffiTypeCyclopsClientObjectFactory.clonePointer(this),FfiConverterTypeSignedServiceUrl.lower(signedServiceUrl, 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 serviceRequest(sandbox: Sandbox, service: string, path: string, request: HttpRequest, asyncOpts_?: { signal: AbortSignal }): Promise<HttpResponse> /*throws*/ {
const __stack = uniffiIsDebug ? new Error().stack : undefined;
try {
@@ -2790,7 +3474,7 @@ private constructor(pointer: UniffiHandle) {
throw __error;
}
}
-
+
async updatePool(pool: Pool, asyncOpts_?: { signal: AbortSignal }): Promise<Pool> /*throws*/ {
const __stack = uniffiIsDebug ? new Error().stack : undefined;
try {
@@ -2822,7 +3506,7 @@ private constructor(pointer: UniffiHandle) {
throw __error;
}
}
-
+
async updateTemplate(template: Template, asyncOpts_?: { signal: AbortSignal }): Promise<Template> /*throws*/ {
const __stack = uniffiIsDebug ? new Error().stack : undefined;
try {
@@ -2854,7 +3538,7 @@ private constructor(pointer: UniffiHandle) {
throw __error;
}
}
-
+
async waitClaim(claim: Claim, asyncOpts_?: { signal: AbortSignal }): Promise<Sandbox> /*throws*/ {
const __stack = uniffiIsDebug ? new Error().stack : undefined;
try {
@@ -2886,7 +3570,7 @@ private constructor(pointer: UniffiHandle) {
throw __error;
}
}
-
+
uniffiDestroy(): void {
const ptr = (this as any)[destructorGuardSymbol];
@@ -2902,16 +3586,16 @@ private constructor(pointer: UniffiHandle) {
return uniffiTypeCyclopsClientObjectFactory.isConcreteType(obj_);
}
-
+
}
const uniffiTypeCyclopsClientObjectFactory: UniffiObjectFactory<CyclopsClientLike> = (() => {
-
+
/// <reference lib="es2021" />
const registry = typeof FinalizationRegistry !== 'undefined' ? new FinalizationRegistry<UniffiHandle>((heldValue: UniffiHandle) => {
uniffiTypeCyclopsClientObjectFactory.freePointer(heldValue);
}) : null;
-
+
return {
create(pointer: UniffiHandle): CyclopsClientLike {
const instance = Object.create(CyclopsClient.prototype);
@@ -2921,7 +3605,7 @@ const uniffiTypeCyclopsClientObjectFactory: UniffiObjectFactory<CyclopsClientLik
return instance;
},
-
+
bless(p: UniffiHandle): UniffiGcObject {
const ptr = {
p, // make sure this object doesn't get optimized away.
@@ -2968,7 +3652,7 @@ const uniffiTypeCyclopsClientObjectFactory: UniffiObjectFactory<CyclopsClientLik
const FfiConverterTypeCyclopsClient = new FfiConverterObject(uniffiTypeCyclopsClientObjectFactory);
export interface HttpClient {
-
+
execute(request: HttpRequest, asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<HttpResponse>;
}
@@ -2985,9 +3669,9 @@ private constructor(pointer: UniffiHandle) {
this[destructorGuardSymbol] = uniffiTypeHttpClientImplObjectFactory.bless(pointer);
}
-
-
+
+
async execute(request: HttpRequest, asyncOpts_?: { signal: AbortSignal }): Promise<HttpResponse> /*throws*/ {
const __stack = uniffiIsDebug ? new Error().stack : undefined;
try {
@@ -3019,7 +3703,7 @@ private constructor(pointer: UniffiHandle) {
throw __error;
}
}
-
+
uniffiDestroy(): void {
const ptr = (this as any)[destructorGuardSymbol];
@@ -3035,16 +3719,16 @@ private constructor(pointer: UniffiHandle) {
return uniffiTypeHttpClientImplObjectFactory.isConcreteType(obj_);
}
-
+
}
const uniffiTypeHttpClientImplObjectFactory: UniffiObjectFactory<HttpClient> = (() => {
-
+
/// <reference lib="es2021" />
const registry = typeof FinalizationRegistry !== 'undefined' ? new FinalizationRegistry<UniffiHandle>((heldValue: UniffiHandle) => {
uniffiTypeHttpClientImplObjectFactory.freePointer(heldValue);
}) : null;
-
+
return {
create(pointer: UniffiHandle): HttpClient {
const instance = Object.create(HttpClientImpl.prototype);
@@ -3054,7 +3738,7 @@ const uniffiTypeHttpClientImplObjectFactory: UniffiObjectFactory<HttpClient> = (
return instance;
},
-
+
bless(p: UniffiHandle): UniffiGcObject {
const ptr = {
p, // make sure this object doesn't get optimized away.
@@ -3112,7 +3796,7 @@ const uniffiCallbackInterfaceHttpClient: { vtable: any; register: () => void; }
request: Uint8Array,
uniffiFutureCallback: UniffiForeignFutureCompleterustBuffer,
uniffiCallbackData: bigint) => {
- const uniffiMakeCall =
+ const uniffiMakeCall =
async (signal: AbortSignal)
: Promise<HttpResponse> => {
const jsCallback = FfiConverterTypeHttpClient.lift(uniffiHandle);
@@ -3166,7 +3850,6 @@ const uniffiCallbackInterfaceHttpClient: { vtable: any; register: () => void; }
},
};
-// FfiConverter for Map<string, string>
const FfiConverterMapStringString = new FfiConverterMap(FfiConverterString, FfiConverterString);
// FfiConverter for Map<string, string> | undefined
@@ -3205,6 +3888,9 @@ const FfiConverterSequenceTypeNamespace = new FfiConverterArray(FfiConverterType
// FfiConverter for Array<Pool>
const FfiConverterSequenceTypePool = new FfiConverterArray(FfiConverterTypePool);
+// FfiConverter for Array<SignedServiceUrl>
+const FfiConverterSequenceTypeSignedServiceUrl = new FfiConverterArray(FfiConverterTypeSignedServiceUrl);
+
// FfiConverter for Array<Template>
const FfiConverterSequenceTypeTemplate = new FfiConverterArray(FfiConverterTypeTemplate);
@@ -3230,6 +3916,21 @@ function uniffiEnsureInitialized() {
if (bindingsContractVersion !== scaffoldingContractVersion) {
throw new UniffiInternalError.ContractVersionMismatch(scaffoldingContractVersion, bindingsContractVersion);
}
+ if (nativeModule().uniffi_cyclops_sdk_checksum_func_healthy_pool_display_status() !== 3094) {
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cyclops_sdk_checksum_func_healthy_pool_display_status");
+ }
+ if (nativeModule().uniffi_cyclops_sdk_checksum_func_pool_display_status() !== 8587) {
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cyclops_sdk_checksum_func_pool_display_status");
+ }
+ if (nativeModule().uniffi_cyclops_sdk_checksum_func_removed_pool_display_status() !== 48761) {
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cyclops_sdk_checksum_func_removed_pool_display_status");
+ }
+ if (nativeModule().uniffi_cyclops_sdk_checksum_func_terminating_pool_display_status() !== 41320) {
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cyclops_sdk_checksum_func_terminating_pool_display_status");
+ }
+ if (nativeModule().uniffi_cyclops_sdk_checksum_func_unknown_pool_display_status() !== 39929) {
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cyclops_sdk_checksum_func_unknown_pool_display_status");
+ }
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");
}
@@ -3257,9 +3958,15 @@ function uniffiEnsureInitialized() {
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_namespace() !== 38049) {
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cyclops_sdk_checksum_method_cyclopsclient_create_namespace");
+ }
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_signed_service_url() !== 17810) {
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cyclops_sdk_checksum_method_cyclopsclient_create_signed_service_url");
+ }
if (nativeModule().uniffi_cyclops_sdk_checksum_method_cyclopsclient_create_template() !== 13689) {
throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cyclops_sdk_checksum_method_cyclopsclient_create_template");
}
@@ -3269,6 +3976,9 @@ function uniffiEnsureInitialized() {
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_namespace() !== 4545) {
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cyclops_sdk_checksum_method_cyclopsclient_delete_namespace");
+ }
if (nativeModule().uniffi_cyclops_sdk_checksum_method_cyclopsclient_delete_pool() !== 31235) {
throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cyclops_sdk_checksum_method_cyclopsclient_delete_pool");
}
@@ -3281,6 +3991,9 @@ function uniffiEnsureInitialized() {
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_namespace() !== 184) {
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cyclops_sdk_checksum_method_cyclopsclient_get_namespace");
+ }
if (nativeModule().uniffi_cyclops_sdk_checksum_method_cyclopsclient_get_pool() !== 49450) {
throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cyclops_sdk_checksum_method_cyclopsclient_get_pool");
}
@@ -3296,6 +4009,9 @@ function uniffiEnsureInitialized() {
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_signed_service_urls() !== 31479) {
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cyclops_sdk_checksum_method_cyclopsclient_list_signed_service_urls");
+ }
if (nativeModule().uniffi_cyclops_sdk_checksum_method_cyclopsclient_list_templates() !== 58376) {
throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cyclops_sdk_checksum_method_cyclopsclient_list_templates");
}
@@ -3311,6 +4027,9 @@ function uniffiEnsureInitialized() {
if (nativeModule().uniffi_cyclops_sdk_checksum_method_cyclopsclient_renew_claim() !== 17505) {
throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cyclops_sdk_checksum_method_cyclopsclient_renew_claim");
}
+ if (nativeModule().uniffi_cyclops_sdk_checksum_method_cyclopsclient_revoke_signed_service_url() !== 59989) {
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cyclops_sdk_checksum_method_cyclopsclient_revoke_signed_service_url");
+ }
if (nativeModule().uniffi_cyclops_sdk_checksum_method_cyclopsclient_service_request() !== 46699) {
throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cyclops_sdk_checksum_method_cyclopsclient_service_request");
}
@@ -3342,6 +4061,7 @@ export default Object.freeze({
FfiConverterTypeClaim,
FfiConverterTypeCreateClaimRequest,
FfiConverterTypeCreatePoolRequest,
+ FfiConverterTypeCreateSignedServiceUrlRequest,
FfiConverterTypeCreateTemplateRequest,
FfiConverterTypeCreateUserApiKeyRequest,
FfiConverterTypeCyclopsClient,
@@ -3356,10 +4076,14 @@ export default Object.freeze({
FfiConverterTypeNamespace,
FfiConverterTypeNewUserApiKey,
FfiConverterTypePool,
+ FfiConverterTypePoolDisplayStatus,
+ FfiConverterTypePoolDisplayStatusKind,
FfiConverterTypeResourceMetadata,
FfiConverterTypeSandbox,
+ FfiConverterTypeSdkBuildError,
FfiConverterTypeSdkError,
+ FfiConverterTypeSignedServiceUrl,
FfiConverterTypeTemplate,
FfiConverterTypeUserApiKey,
}
-});
\ No newline at end of file
+});
diff --git a/libs/fleet/sdk/src/error.rs b/libs/fleet/sdk/src/error.rs
index 08ddde56e5..275f7b60f1 100644
--- a/libs/fleet/sdk/src/error.rs
+++ b/libs/fleet/sdk/src/error.rs
@@ -36,6 +36,8 @@ pub enum SdkError {
status: u16,
body: String,
},
+ #[error("signed service URLs are not configured in this environment")]
+ SignedServiceUrlsUnavailable,
#[error("unknown sandbox service {requested}; available services: {available:?}")]
UnknownService {
requested: String,
diff --git a/libs/fleet/sdk/src/lib.rs b/libs/fleet/sdk/src/lib.rs
index 86aee8a493..7aba53ba5d 100644
--- a/libs/fleet/sdk/src/lib.rs
+++ b/libs/fleet/sdk/src/lib.rs
@@ -5,6 +5,7 @@ mod namespaces;
mod pools;
mod routes;
mod services;
+mod signed_service_urls;
mod status;
mod templates;
mod transport;
@@ -24,12 +25,12 @@ pub use status::{
pub use transport::{AccessTokenProvider, HttpClient};
pub use types::{
Claim, CreateClaimRequest, CreateClaimRequestBuilder, CreatePoolRequest,
- CreatePoolRequestBuilder, CreateTemplateRequest, CreateTemplateRequestBuilder,
- CreateUserApiKeyRequest, CreateUserApiKeyRequestBuilder, CyclopsConfiguration,
- CyclopsCredentials, CyclopsTokenProviderConfiguration,
- CyclopsTokenProviderConfigurationBuilder, HttpHeader, HttpRequest, HttpRequestBuilder,
- HttpResponse, Namespace, NewUserApiKey, Pool, ResourceMetadata, Sandbox, Template,
- TemplateBuilder, UserApiKey,
+ CreatePoolRequestBuilder, CreateSignedServiceUrlRequest, CreateSignedServiceUrlRequestBuilder,
+ CreateTemplateRequest, CreateTemplateRequestBuilder, CreateUserApiKeyRequest,
+ CreateUserApiKeyRequestBuilder, CyclopsConfiguration, CyclopsCredentials,
+ CyclopsTokenProviderConfiguration, CyclopsTokenProviderConfigurationBuilder, HttpHeader,
+ HttpRequest, HttpRequestBuilder, HttpResponse, Namespace, NewUserApiKey, Pool,
+ ResourceMetadata, Sandbox, SignedServiceUrl, Template, TemplateBuilder, UserApiKey,
};
uniffi::setup_scaffolding!("fleet_sdk");
diff --git a/libs/fleet/sdk/src/routes.rs b/libs/fleet/sdk/src/routes.rs
index af4f9c00ff..9e02b8ecb9 100644
--- a/libs/fleet/sdk/src/routes.rs
+++ b/libs/fleet/sdk/src/routes.rs
@@ -1,4 +1,4 @@
-use crate::{Sandbox, SdkError};
+use crate::SdkError;
use url::Url;
const POOL_COLLECTION_PREFIX: &str = "api/k8s/apis/osgym.cua.ai/v1alpha1/namespaces/";
@@ -9,6 +9,7 @@ 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/";
+const SIGNED_SERVICE_URL_COLLECTION_PREFIX: &str = "api/signed-service-urls/";
const USER_KEY_COLLECTION: &str = "api/user-keys";
pub fn pool_collection(base: &Url, namespace: &str) -> Result<Url, SdkError> {
@@ -62,6 +63,71 @@ pub fn namespace_item(base: &Url, namespace: &str) -> Result<Url, SdkError> {
route(base, format!("{NAMESPACE_PREFIX}{namespace}"))
}
+pub fn signed_service_url_collection(base: &Url, namespace: &str) -> Result<Url, SdkError> {
+ validate_dns_label_for("namespace", namespace)?;
+ route(
+ base,
+ format!("{SIGNED_SERVICE_URL_COLLECTION_PREFIX}{namespace}"),
+ )
+}
+
+pub fn signed_service_url_list(base: &Url, namespace: &str, claim: &str) -> Result<Url, SdkError> {
+ validate_signed_service_url_claim(claim)?;
+ let mut url = signed_service_url_collection(base, namespace)?;
+ url.query_pairs_mut().append_pair("claim", claim);
+ Ok(url)
+}
+
+pub fn signed_service_url_item(base: &Url, namespace: &str, id: &str) -> Result<Url, SdkError> {
+ validate_dns_label_for("namespace", namespace)?;
+ validate_signed_service_url_id(id)?;
+ route(
+ base,
+ format!("{SIGNED_SERVICE_URL_COLLECTION_PREFIX}{namespace}/{id}"),
+ )
+}
+
+pub(crate) fn validate_signed_service_url_claim(claim: &str) -> Result<(), SdkError> {
+ let reason = if claim.is_empty() {
+ Some("must not be empty")
+ } else if claim.len() > 128 {
+ Some("must be at most 128 bytes")
+ } else if !claim
+ .bytes()
+ .all(|byte| byte.is_ascii_alphanumeric() || b"._~-".contains(&byte))
+ {
+ Some("must contain only ASCII letters, digits, periods, underscores, tildes, and hyphens")
+ } else {
+ None
+ };
+
+ match reason {
+ Some(reason) => Err(SdkError::InvalidResourceName {
+ field: "claim".into(),
+ value: claim.into(),
+ reason: reason.into(),
+ }),
+ None => Ok(()),
+ }
+}
+
+fn validate_signed_service_url_id(id: &str) -> Result<(), SdkError> {
+ let is_uuid = id.len() == 36
+ && id.bytes().enumerate().all(|(index, byte)| {
+ matches!(index, 8 | 13 | 18 | 23) && byte == b'-'
+ || !matches!(index, 8 | 13 | 18 | 23) && byte.is_ascii_hexdigit()
+ });
+ if is_uuid {
+ return Ok(());
+ }
+
+ Err(SdkError::InvalidResourceName {
+ field: "id".into(),
+ value: id.into(),
+ reason: "must be a UUID".into(),
+ })
+}
+
pub fn user_key_collection(base: &Url) -> Result<Url, SdkError> {
route(base, USER_KEY_COLLECTION.into())
}
@@ -141,21 +207,17 @@ pub fn claim_item(base: &Url, namespace: &str, name: &str) -> Result<Url, SdkErr
pub fn service_url(
base: &Url,
- sandbox: &Sandbox,
- service: &str,
+ namespace: &str,
+ service_name: &str,
path: &str,
) -> Result<Url, SdkError> {
- validate_dns_label_for("namespace", &sandbox.namespace)?;
- validate_dns_label_for("sandbox", &sandbox.name)?;
- validate_dns_label_for("service", service)?;
+ validate_dns_label_for("namespace", namespace)?;
+ validate_dns_label_for("service", service_name)?;
let (path, query) = validate_service_path(path)?;
let mut url = route(
base,
- format!(
- "{SERVICE_COLLECTION_PREFIX}{}/{}-{}{}",
- sandbox.namespace, sandbox.name, service, path
- ),
+ format!("{SERVICE_COLLECTION_PREFIX}{namespace}/{service_name}{path}"),
)?;
url.set_query(query);
Ok(url)
@@ -256,10 +318,39 @@ fn hex_value(byte: u8) -> Option<u8> {
mod tests {
use super::{
claim_collection, claim_item, namespace_collection, namespace_item, pool_collection,
- pool_item, template_collection, template_item,
+ pool_item, signed_service_url_collection, signed_service_url_item, signed_service_url_list,
+ template_collection, template_item,
};
use url::Url;
+ #[test]
+ fn signed_service_url_routes_validate_and_append_paths() {
+ let base = Url::parse("https://cyclops.example:8443/").unwrap();
+ let id = "31e1c9bb-8cc9-4c50-9cf4-51798b6978e4";
+
+ assert_eq!(
+ signed_service_url_collection(&base, "tenant-a")
+ .unwrap()
+ .as_str(),
+ "https://cyclops.example:8443/api/signed-service-urls/tenant-a"
+ );
+ assert_eq!(
+ signed_service_url_list(&base, "tenant-a", "claim-a")
+ .unwrap()
+ .as_str(),
+ "https://cyclops.example:8443/api/signed-service-urls/tenant-a?claim=claim-a"
+ );
+ assert_eq!(
+ signed_service_url_item(&base, "tenant-a", id)
+ .unwrap()
+ .as_str(),
+ format!("https://cyclops.example:8443/api/signed-service-urls/tenant-a/{id}")
+ );
+ assert!(signed_service_url_collection(&base, "Tenant-A").is_err());
+ assert!(signed_service_url_list(&base, "tenant-a", "bad claim").is_err());
+ assert!(signed_service_url_item(&base, "tenant-a", "bad-id").is_err());
+ }
+
#[test]
fn routes_append_to_root_base_without_double_slashes() {
let base = Url::parse("https://cyclops.example:8443/").unwrap();
diff --git a/libs/fleet/sdk/src/services.rs b/libs/fleet/sdk/src/services.rs
index 596578eb45..d23efb6afa 100644
--- a/libs/fleet/sdk/src/services.rs
+++ b/libs/fleet/sdk/src/services.rs
@@ -1,6 +1,7 @@
use crate::{
- HttpHeader, HttpRequest, HttpResponse, Sandbox, SdkError, client::CyclopsClient,
- routes::service_url,
+ HttpHeader, HttpRequest, HttpResponse, Sandbox, SdkError,
+ client::CyclopsClient,
+ routes::{service_url, validate_dns_label_for},
};
use std::{collections::HashSet, sync::Arc};
@@ -13,17 +14,8 @@ impl CyclopsClient {
path: String,
request: HttpRequest,
) -> Result<HttpResponse, SdkError> {
- if !sandbox.services.iter().any(|known| known == &service) {
- let mut available = sandbox.services.clone();
- available.sort_unstable();
- available.dedup();
- return Err(SdkError::UnknownService {
- requested: service,
- available,
- });
- }
-
- let url = service_url(self.base_url(), &sandbox, &service, &path)?;
+ let service_name = resolve_service_name(&sandbox, &service)?;
+ let url = service_url(self.base_url(), &sandbox.namespace, &service_name, &path)?;
let request = HttpRequest {
method: request.method,
url: url.to_string(),
@@ -35,6 +27,25 @@ impl CyclopsClient {
}
}
+pub(crate) fn resolve_service_name(sandbox: &Sandbox, service: &str) -> Result<String, SdkError> {
+ if !sandbox.services.iter().any(|known| known == service) {
+ let mut available = sandbox.services.clone();
+ available.sort_unstable();
+ available.dedup();
+ return Err(SdkError::UnknownService {
+ requested: service.into(),
+ available,
+ });
+ }
+
+ validate_dns_label_for("sandbox", &sandbox.name)?;
+ validate_dns_label_for("service", service)?;
+
+ let service_name = format!("{}-{service}", sandbox.name);
+ validate_dns_label_for("service", &service_name)?;
+ Ok(service_name)
+}
+
fn filtered_headers(headers: Vec<HttpHeader>) -> Vec<HttpHeader> {
let mut blocked: HashSet<String> = [
"connection",
@@ -102,3 +113,45 @@ mod tests {
);
}
}
+
+#[cfg(test)]
+mod service_resolution_tests {
+ use super::resolve_service_name;
+ use crate::{Sandbox, SdkError};
+
+ fn sandbox(name: &str, services: &[&str]) -> Sandbox {
+ Sandbox {
+ namespace: "tenant-a".into(),
+ claim: "claim-a".into(),
+ name: name.into(),
+ services: services.iter().map(|service| (*service).into()).collect(),
+ }
+ }
+
+ #[test]
+ fn resolves_logical_service_to_kubernetes_service_name() {
+ assert_eq!(
+ resolve_service_name(&sandbox("sandbox-a", &["mcp"]), "mcp").unwrap(),
+ "sandbox-a-mcp"
+ );
+ }
+
+ #[test]
+ fn unknown_service_lists_sorted_deduplicated_services() {
+ let error = resolve_service_name(&sandbox("sandbox-a", &["vnc", "mcp", "vnc"]), "browser")
+ .unwrap_err();
+
+ assert!(matches!(
+ error,
+ SdkError::UnknownService { requested, available }
+ if requested == "browser" && available == vec!["mcp", "vnc"]
+ ));
+ }
+
+ #[test]
+ fn rejects_invalid_derived_kubernetes_service_name() {
+ let error = resolve_service_name(&sandbox(&"a".repeat(61), &["mcp"]), "mcp").unwrap_err();
+
+ assert!(matches!(error, SdkError::InvalidResourceName { .. }));
+ }
+}
diff --git a/libs/fleet/sdk/src/signed_service_urls.rs b/libs/fleet/sdk/src/signed_service_urls.rs
new file mode 100644
index 0000000000..3f3d6a6dc7
--- /dev/null
+++ b/libs/fleet/sdk/src/signed_service_urls.rs
@@ -0,0 +1,177 @@
+use crate::{
+ CreateSignedServiceUrlRequest, HttpHeader, HttpRequest, Sandbox, SdkError, SignedServiceUrl,
+ client::CyclopsClient,
+ routes::{
+ signed_service_url_collection, signed_service_url_item, signed_service_url_list,
+ validate_signed_service_url_claim,
+ },
+ services::resolve_service_name,
+};
+use serde::{Deserialize, Serialize};
+use std::sync::Arc;
+use url::Url;
+
+const MIN_EXPIRATION_SECONDS: u32 = 60;
+const MAX_EXPIRATION_SECONDS: u32 = 86_400;
+const MAX_LABEL_BYTES: usize = 120;
+
+#[derive(Serialize)]
+#[serde(rename_all = "camelCase")]
+struct CreateSignedServiceUrlBody<'a> {
+ claim: &'a str,
+ sandbox: &'a str,
+ service: &'a str,
+ logical_service: &'a str,
+ label: Option<&'a str>,
+ expires_in_seconds: u32,
+}
+
+#[derive(Deserialize)]
+#[serde(rename_all = "camelCase")]
+struct SignedServiceUrlResponse {
+ id: String,
+ namespace: String,
+ claim: String,
+ sandbox: String,
+ logical_service: String,
+ label: Option<String>,
+ url: String,
+ created_at: String,
+ expires_at: String,
+ revoked_at: Option<String>,
+}
+
+impl From<SignedServiceUrlResponse> for SignedServiceUrl {
+ fn from(response: SignedServiceUrlResponse) -> Self {
+ Self {
+ id: response.id,
+ namespace: response.namespace,
+ claim: response.claim,
+ sandbox: response.sandbox,
+ service: response.logical_service,
+ label: response.label,
+ url: response.url,
+ created_at: response.created_at,
+ expires_at: response.expires_at,
+ revoked_at: response.revoked_at,
+ }
+ }
+}
+
+#[uniffi::export]
+impl CyclopsClient {
+ pub async fn create_signed_service_url(
+ self: Arc<Self>,
+ request: CreateSignedServiceUrlRequest,
+ ) -> Result<SignedServiceUrl, SdkError> {
+ let service_name = resolve_service_name(&request.sandbox, &request.service)?;
+ let label = validate_create_request(&request)?;
+ validate_signed_service_url_claim(&request.sandbox.claim)?;
+ let url = signed_service_url_collection(self.base_url(), &request.sandbox.namespace)?;
+ let body = serde_json::to_vec(&CreateSignedServiceUrlBody {
+ claim: &request.sandbox.claim,
+ sandbox: &request.sandbox.name,
+ service: &service_name,
+ logical_service: &request.service,
+ label: label.as_deref(),
+ expires_in_seconds: request.expires_in_seconds,
+ })
+ .map_err(|error| SdkError::Body {
+ reason: error.to_string(),
+ })?;
+
+ let response: SignedServiceUrlResponse = self
+ .send_json_crud(
+ "create signed service URL",
+ json_request("POST", url, Some(body)),
+ &[201],
+ )
+ .await
+ .map_err(map_signed_service_url_error)?;
+ Ok(response.into())
+ }
+
+ pub async fn list_signed_service_urls(
+ self: Arc<Self>,
+ sandbox: Sandbox,
+ ) -> Result<Vec<SignedServiceUrl>, SdkError> {
+ let url = signed_service_url_list(self.base_url(), &sandbox.namespace, &sandbox.claim)?;
+ let responses: Vec<SignedServiceUrlResponse> = self
+ .send_json_crud(
+ "list signed service URLs",
+ json_request("GET", url, None),
+ &[200],
+ )
+ .await
+ .map_err(map_signed_service_url_error)?;
+ Ok(responses.into_iter().map(Into::into).collect())
+ }
+
+ pub async fn revoke_signed_service_url(
+ self: Arc<Self>,
+ signed_service_url: SignedServiceUrl,
+ ) -> Result<(), SdkError> {
+ let url = signed_service_url_item(
+ self.base_url(),
+ &signed_service_url.namespace,
+ &signed_service_url.id,
+ )?;
+ self.send_unit_crud(
+ "revoke signed service URL",
+ json_request("DELETE", url, None),
+ &[204],
+ )
+ .await
+ .map_err(map_signed_service_url_error)
+ }
+}
+
+fn validate_create_request(
+ request: &CreateSignedServiceUrlRequest,
+) -> Result<Option<String>, SdkError> {
+ if !(MIN_EXPIRATION_SECONDS..=MAX_EXPIRATION_SECONDS).contains(&request.expires_in_seconds) {
+ return Err(SdkError::InvalidResourceName {
+ field: "expires_in_seconds".into(),
+ value: request.expires_in_seconds.to_string(),
+ reason: format!(
+ "must be between {MIN_EXPIRATION_SECONDS} and {MAX_EXPIRATION_SECONDS} seconds"
+ ),
+ });
+ }
+
+ let Some(label) = request.label.as_deref() else {
+ return Ok(None);
+ };
+ let label = label.trim();
+ if label.is_empty() {
+ return Ok(None);
+ }
+ if label.len() > MAX_LABEL_BYTES {
+ return Err(SdkError::InvalidResourceName {
+ field: "label".into(),
+ value: label.into(),
+ reason: format!("must be at most {MAX_LABEL_BYTES} UTF-8 bytes"),
+ });
+ }
+ Ok(Some(label.into()))
+}
+
+fn json_request(method: &str, url: Url, body: Option<Vec<u8>>) -> HttpRequest {
+ HttpRequest {
+ method: method.into(),
+ url: url.into(),
+ headers: vec![HttpHeader {
+ name: "content-type".into(),
+ value: "application/json".into(),
+ }],
+ body,
+ timeout_secs: None,
+ }
+}
+
+fn map_signed_service_url_error(error: SdkError) -> SdkError {
+ match error {
+ SdkError::Status { status: 503, .. } => SdkError::SignedServiceUrlsUnavailable,
+ other => other,
+ }
+}
diff --git a/libs/fleet/sdk/src/types.rs b/libs/fleet/sdk/src/types.rs
index aac65b4fc3..bac3045d37 100644
--- a/libs/fleet/sdk/src/types.rs
+++ b/libs/fleet/sdk/src/types.rs
@@ -202,6 +202,38 @@ pub struct Sandbox {
pub services: Vec<String>,
}
+#[derive(
+ Clone,
+ Debug,
+ PartialEq,
+ Serialize,
+ Deserialize,
+ uniffi::Record,
+ uniffi_builder_derive::UniffiBuilder,
+)]
+#[uniffi_builder(crate::SdkBuildError)]
+pub struct CreateSignedServiceUrlRequest {
+ pub sandbox: Sandbox,
+ pub service: String,
+ pub label: Option<String>,
+ pub expires_in_seconds: u32,
+}
+
+#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, uniffi::Record)]
+#[serde(rename_all = "camelCase")]
+pub struct SignedServiceUrl {
+ pub id: String,
+ pub namespace: String,
+ pub claim: String,
+ pub sandbox: String,
+ pub service: String,
+ pub label: Option<String>,
+ pub url: String,
+ pub created_at: String,
+ pub expires_at: String,
+ pub revoked_at: Option<String>,
+}
+
#[derive(
Clone, Debug, Serialize, Deserialize, uniffi::Record, uniffi_builder_derive::UniffiBuilder,
)]
diff --git a/libs/fleet/sdk/tests/signed_service_url_flow.rs b/libs/fleet/sdk/tests/signed_service_url_flow.rs
new file mode 100644
index 0000000000..1976aca59e
--- /dev/null
+++ b/libs/fleet/sdk/tests/signed_service_url_flow.rs
@@ -0,0 +1,244 @@
+mod support;
+
+use cyclops_sdk::{
+ CreateSignedServiceUrlRequestBuilder, CyclopsClient, CyclopsConfiguration, CyclopsCredentials,
+ HttpResponse, Sandbox, SdkError, SignedServiceUrl,
+};
+use std::sync::Arc;
+use support::ScriptedHttpClient;
+
+const BASE_URL: &str = "https://cyclops.example:8443/control/";
+const TOKEN_URL: &str = "https://auth.example/token";
+
+#[tokio::test]
+async fn creates_lists_and_revokes_signed_service_urls() {
+ let created = signed_service_url(
+ "31e1c9bb-8cc9-4c50-9cf4-51798b6978e4",
+ Some("Customer demo"),
+ );
+ let second = signed_service_url(
+ "347ceda8-7eec-4f34-82e1-04465e05f5cf",
+ Some("Support session"),
+ );
+ let http = Arc::new(ScriptedHttpClient::new([
+ Ok(token()),
+ Ok(json_response(201, &signed_service_url_response(&created))),
+ Ok(json_response(
+ 200,
+ &vec![
+ signed_service_url_response(&created),
+ signed_service_url_response(&second),
+ ],
+ )),
+ Ok(response(204, Vec::new())),
+ ]));
+ let client = client(Arc::clone(&http));
+
+ let actual = Arc::clone(&client)
+ .create_signed_service_url(request("Customer demo", 3600))
+ .await
+ .unwrap();
+ let listed = Arc::clone(&client)
+ .list_signed_service_urls(sandbox())
+ .await
+ .unwrap();
+ Arc::clone(&client)
+ .revoke_signed_service_url(actual.clone())
+ .await
+ .unwrap();
+
+ assert_eq!(actual, created);
+ assert_eq!(listed, vec![created, second]);
+ let requests = http.requests().await;
+ assert_eq!(requests[1].method, "POST");
+ assert_eq!(
+ requests[1].url,
+ "https://cyclops.example:8443/control/api/signed-service-urls/tenant-a"
+ );
+ assert_eq!(
+ requests[1].body.as_deref(),
+ Some(
+ br#"{"claim":"claim-a","sandbox":"sandbox-a","service":"sandbox-a-mcp","logicalService":"mcp","label":"Customer demo","expiresInSeconds":3600}"#
+ .as_slice()
+ )
+ );
+ assert_eq!(requests[2].method, "GET");
+ assert_eq!(
+ requests[2].url,
+ "https://cyclops.example:8443/control/api/signed-service-urls/tenant-a?claim=claim-a"
+ );
+ assert_eq!(requests[3].method, "DELETE");
+ assert_eq!(
+ requests[3].url,
+ "https://cyclops.example:8443/control/api/signed-service-urls/tenant-a/31e1c9bb-8cc9-4c50-9cf4-51798b6978e4"
+ );
+}
+
+#[tokio::test]
+async fn validates_logical_service_ttl_and_label_before_http() {
+ let http = Arc::new(ScriptedHttpClient::new([]));
+ let client = client(Arc::clone(&http));
+
+ let unknown_service = Arc::clone(&client)
+ .create_signed_service_url(
+ CreateSignedServiceUrlRequestBuilder::new()
+ .sandbox(sandbox())
+ .service("missing".into())
+ .expires_in_seconds(3600)
+ .build()
+ .unwrap(),
+ )
+ .await
+ .unwrap_err();
+ assert!(matches!(unknown_service, SdkError::UnknownService { .. }));
+
+ let short_ttl = Arc::clone(&client)
+ .create_signed_service_url(request("Customer demo", 59))
+ .await
+ .unwrap_err();
+ assert!(matches!(
+ short_ttl,
+ SdkError::InvalidResourceName { field, value, .. }
+ if field == "expires_in_seconds" && value == "59"
+ ));
+
+ let long_label = client
+ .create_signed_service_url(request(&"a".repeat(121), 3600))
+ .await
+ .unwrap_err();
+ assert!(matches!(
+ long_label,
+ SdkError::InvalidResourceName { field, value, .. }
+ if field == "label" && value.len() == 121
+ ));
+ assert_eq!(http.request_count().await, 0);
+}
+
+#[tokio::test]
+async fn maps_503_and_preserves_other_failures() {
+ let unavailable_http = Arc::new(ScriptedHttpClient::new([
+ Ok(token()),
+ Ok(response(503, b"not configured".to_vec())),
+ ]));
+ let unavailable_error = client(unavailable_http)
+ .list_signed_service_urls(sandbox())
+ .await
+ .unwrap_err();
+ assert!(matches!(
+ unavailable_error,
+ SdkError::SignedServiceUrlsUnavailable
+ ));
+
+ let status_http = Arc::new(ScriptedHttpClient::new([
+ Ok(token()),
+ Ok(response(
+ 400,
+ b"invalid signed service URL request".to_vec(),
+ )),
+ ]));
+ let status_error = client(status_http)
+ .create_signed_service_url(request("Customer demo", 3600))
+ .await
+ .unwrap_err();
+ assert!(matches!(
+ status_error,
+ SdkError::Status { operation, status: 400, body }
+ if operation == "create signed service URL"
+ && body == "invalid signed service URL request"
+ ));
+
+ let body_http = Arc::new(ScriptedHttpClient::new([
+ Ok(token()),
+ Ok(response(201, b"not-json".to_vec())),
+ ]));
+ let body_error = client(body_http)
+ .create_signed_service_url(request("Customer demo", 3600))
+ .await
+ .unwrap_err();
+ assert!(matches!(body_error, SdkError::Body { .. }));
+}
+
+fn request(label: &str, expires_in_seconds: u32) -> cyclops_sdk::CreateSignedServiceUrlRequest {
+ CreateSignedServiceUrlRequestBuilder::new()
+ .sandbox(sandbox())
+ .service("mcp".into())
+ .label(label.into())
+ .expires_in_seconds(expires_in_seconds)
+ .build()
+ .unwrap()
+}
+
+fn client(http: Arc<ScriptedHttpClient>) -> Arc<CyclopsClient> {
+ CyclopsClient::connect(
+ CyclopsConfiguration {
+ base_url: BASE_URL.into(),
+ token_url: TOKEN_URL.into(),
+ credentials: CyclopsCredentials::new("client-id".into(), "client-secret".into()),
+ pool_poll_interval_ms: 1,
+ pool_poll_limit: 3,
+ claim_poll_interval_ms: 1,
+ claim_poll_limit: 3,
+ },
+ http,
+ )
+ .unwrap()
+}
+
+fn sandbox() -> Sandbox {
+ Sandbox {
+ namespace: "tenant-a".into(),
+ claim: "claim-a".into(),
+ name: "sandbox-a".into(),
+ services: vec!["mcp".into(), "vnc".into()],
+ }
+}
+
+fn signed_service_url(id: &str, label: Option<&str>) -> SignedServiceUrl {
+ SignedServiceUrl {
+ id: id.into(),
+ namespace: "tenant-a".into(),
+ claim: "claim-a".into(),
+ sandbox: "sandbox-a".into(),
+ service: "mcp".into(),
+ label: label.map(str::to_owned),
+ url: format!("https://signed.example/{id}"),
+ created_at: "2026-08-31T12:34:56Z".into(),
+ expires_at: "2026-08-31T13:34:56Z".into(),
+ revoked_at: None,
+ }
+}
+
+fn signed_service_url_response(signed_service_url: &SignedServiceUrl) -> serde_json::Value {
+ serde_json::json!({
+ "id": signed_service_url.id,
+ "namespace": signed_service_url.namespace,
+ "claim": signed_service_url.claim,
+ "sandbox": signed_service_url.sandbox,
+ "service": "sandbox-a-mcp",
+ "logicalService": signed_service_url.service,
+ "label": signed_service_url.label,
+ "url": signed_service_url.url,
+ "createdAt": signed_service_url.created_at,
+ "expiresAt": signed_service_url.expires_at,
+ "revokedAt": signed_service_url.revoked_at,
+ })
+}
+
+fn token() -> HttpResponse {
+ response(
+ 200,
+ br#"{"access_token":"service-token","expires_in":3600}"#.to_vec(),
+ )
+}
+
+fn json_response<T: serde::Serialize>(status: u16, value: &T) -> HttpResponse {
+ response(status, serde_json::to_vec(value).unwrap())
+}
+
+fn response(status: u16, body: Vec<u8>) -> HttpResponse {
+ HttpResponse {
+ status,
+ headers: vec![],
+ body,
+ }
+}
diff --git a/libs/fleet/sdk/tests/uniffi_builder.rs b/libs/fleet/sdk/tests/uniffi_builder.rs
index a57cbbb3be..f106f90e46 100644
--- a/libs/fleet/sdk/tests/uniffi_builder.rs
+++ b/libs/fleet/sdk/tests/uniffi_builder.rs
@@ -1,8 +1,8 @@
use cyclops_sdk::{
- CreateClaimRequestBuilder, CreatePoolRequest, CreatePoolRequestBuilder, CreateTemplateRequest,
- CreateTemplateRequestBuilder, CreateUserApiKeyRequestBuilder,
- CyclopsTokenProviderConfigurationBuilder, Pool, ResourceMetadata, SdkBuildError,
- TemplateBuilder,
+ CreateClaimRequestBuilder, CreatePoolRequest, CreatePoolRequestBuilder,
+ CreateSignedServiceUrlRequestBuilder, CreateTemplateRequest, CreateTemplateRequestBuilder,
+ CreateUserApiKeyRequestBuilder, CyclopsTokenProviderConfigurationBuilder, Pool,
+ ResourceMetadata, Sandbox, SdkBuildError, TemplateBuilder,
};
use cyclops_sdk_schema::{
OSGymSandboxTemplateSpecBuilder, OSGymSandboxWarmPoolSpecBuilder, SandboxTemplateRefBuilder,
@@ -159,3 +159,73 @@ fn remaining_sdk_builders_use_stable_required_field_errors() {
));
}
}
+
+#[test]
+fn signed_service_url_request_builder_constructs_request() {
+ let sandbox = Sandbox {
+ namespace: "tenant-a".into(),
+ claim: "claim-a".into(),
+ name: "sandbox-a".into(),
+ services: vec!["mcp".into()],
+ };
+
+ let request = CreateSignedServiceUrlRequestBuilder::new()
+ .sandbox(sandbox.clone())
+ .service("mcp".into())
+ .label("Customer demo".into())
+ .expires_in_seconds(3600)
+ .build()
+ .unwrap();
+
+ assert_eq!(request.sandbox, sandbox);
+ assert_eq!(request.service, "mcp");
+ assert_eq!(request.label.as_deref(), Some("Customer demo"));
+ assert_eq!(request.expires_in_seconds, 3600);
+}
+
+#[test]
+fn signed_service_url_request_builder_requires_sandbox_service_and_expiration() {
+ let missing_sandbox = CreateSignedServiceUrlRequestBuilder::new()
+ .service("mcp".into())
+ .expires_in_seconds(3600)
+ .build()
+ .unwrap_err();
+ assert!(matches!(
+ missing_sandbox,
+ SdkBuildError::MissingRequiredField { record_type, field }
+ if record_type == "CreateSignedServiceUrlRequest" && field == "sandbox"
+ ));
+
+ let sandbox = Sandbox {
+ namespace: "tenant-a".into(),
+ claim: "claim-a".into(),
+ name: "sandbox-a".into(),
+ services: vec!["mcp".into()],
+ };
+ let missing_service = CreateSignedServiceUrlRequestBuilder::new()
+ .sandbox(sandbox)
+ .expires_in_seconds(3600)
+ .build()
+ .unwrap_err();
+ assert!(matches!(
+ missing_service,
+ SdkBuildError::MissingRequiredField { record_type, field }
+ if record_type == "CreateSignedServiceUrlRequest" && field == "service"
+ ));
+
+ let missing_expiration = CreateSignedServiceUrlRequestBuilder::new()
+ .sandbox(Sandbox {
+ namespace: "tenant-a".into(),
+ claim: "claim-a".into(),
+ name: "sandbox-a".into(),
+ services: vec!["mcp".into()],
+ })
+ .service("mcp".into())
+ .build()
+ .unwrap_err();
+ assert!(matches!(
+ missing_expiration,
+ SdkBuildError::MissingRequiredField { record_type, field }
+ if record_type == "CreateSignedServiceUrlRequest" && field == "expires_in_seconds"
+ ));
+}
diff --git a/libs/fleet/src/components/SignedServiceUrls.tsx b/libs/fleet/src/components/SignedServiceUrls.tsx
new file mode 100644
index 0000000000..9416e69fb4
--- /dev/null
+++ b/libs/fleet/src/components/SignedServiceUrls.tsx
@@ -0,0 +1,319 @@
+import { useEffect, useRef, useState } from "react"
+import Alert from "@cloudscape-design/components/alert"
+import Box from "@cloudscape-design/components/box"
+import Container from "@cloudscape-design/components/container"
+import CopyToClipboard from "@cloudscape-design/components/copy-to-clipboard"
+import Form from "@cloudscape-design/components/form"
+import FormField from "@cloudscape-design/components/form-field"
+import Header from "@cloudscape-design/components/header"
+import Input from "@cloudscape-design/components/input"
+import RadioGroup from "@cloudscape-design/components/radio-group"
+import Select, { type SelectProps } from "@cloudscape-design/components/select"
+import SpaceBetween from "@cloudscape-design/components/space-between"
+import StatusIndicator from "@cloudscape-design/components/status-indicator"
+import Table from "@cloudscape-design/components/table"
+import {
+ CreateSignedServiceUrlRequestBuilder,
+ SdkError,
+ type Sandbox,
+ type SignedServiceUrl,
+} from "../../sdk-bindings/ts-uniffi-browser/ts/index.web"
+import { withClient } from "../auth/cyclops-client"
+import { errorMessage } from "../error-message"
+import { CuaButton } from "./CuaButton"
+import { useFlash } from "./FlashContext"
+
+const expirationOptions = [
+ { value: "900", label: "15 minutes" },
+ { value: "3600", label: "1 hour" },
+ { value: "86400", label: "24 hours" },
+]
+
+function formatDate(value: string): string {
+ return new Intl.DateTimeFormat(undefined, {
+ dateStyle: "medium",
+ timeStyle: "short",
+ }).format(new Date(value))
+}
+
+function signedUrlStatus(item: SignedServiceUrl, now: number) {
+ if (item.revokedAt) {
+ return <StatusIndicator type="stopped">Revoked</StatusIndicator>
+ }
+ if (new Date(item.expiresAt).getTime() <= now) {
+ return <StatusIndicator type="error">Expired</StatusIndicator>
+ }
+ return <StatusIndicator type="success">Expires {formatDate(item.expiresAt)}</StatusIndicator>
+}
+
+export function SignedServiceUrls({ sandbox }: { sandbox: Sandbox }) {
+ const flash = useFlash()
+ const [signedUrls, setSignedUrls] = useState<SignedServiceUrl[]>([])
+ const [loading, setLoading] = useState(true)
+ const [unavailable, setUnavailable] = useState(false)
+ const [loadError, setLoadError] = useState<string | null>(null)
+ const [creating, setCreating] = useState(false)
+ const [submitting, setSubmitting] = useState(false)
+ const [revokingId, setRevokingId] = useState<string | null>(null)
+ const [service, setService] = useState<SelectProps.Option | null>(null)
+ const [label, setLabel] = useState("")
+ const [expiresInSeconds, setExpiresInSeconds] = useState("3600")
+ const [now, setNow] = useState(() => Date.now())
+ const sandboxIdentity = `${sandbox.namespace}\u0000${sandbox.claim}\u0000${sandbox.name}`
+ const currentSandboxIdentity = useRef(sandboxIdentity)
+ const mounted = useRef(false)
+ const requestGeneration = useRef(0)
+
+ if (currentSandboxIdentity.current !== sandboxIdentity) {
+ currentSandboxIdentity.current = sandboxIdentity
+ }
+
+ const isCurrent = (identity: string) => (
+ mounted.current && currentSandboxIdentity.current === identity
+ )
+
+ const markUnavailable = (identity: string) => {
+ if (!isCurrent(identity)) return
+ setUnavailable(true)
+ setCreating(false)
+ setSubmitting(false)
+ setRevokingId(null)
+ }
+
+ const refresh = async (
+ requestSandbox: Sandbox = sandbox,
+ identity: string = sandboxIdentity,
+ ) => {
+ const generation = ++requestGeneration.current
+ if (!isCurrent(identity)) return
+ setLoading(true)
+ try {
+ const urls = await withClient(client => client.listSignedServiceUrls(requestSandbox))
+ if (!isCurrent(identity) || generation !== requestGeneration.current) return
+ setSignedUrls(urls)
+ setUnavailable(false)
+ setLoadError(null)
+ } catch (error) {
+ if (!isCurrent(identity) || generation !== requestGeneration.current) return
+ if (SdkError.SignedServiceUrlsUnavailable.instanceOf(error)) {
+ markUnavailable(identity)
+ setLoadError(null)
+ } else {
+ setLoadError(errorMessage(error))
+ }
+ } finally {
+ if (isCurrent(identity) && generation === requestGeneration.current) setLoading(false)
+ }
+ }
+
+ useEffect(() => {
+ mounted.current = true
+ return () => {
+ mounted.current = false
+ requestGeneration.current += 1
+ }
+ }, [])
+ useEffect(() => {
+ const interval = window.setInterval(() => setNow(Date.now()), 30_000)
+ return () => window.clearInterval(interval)
+ }, [])
+
+
+ useEffect(() => {
+ const identity = sandboxIdentity
+ currentSandboxIdentity.current = identity
+ requestGeneration.current += 1
+ if (!isCurrent(identity)) return
+ setSignedUrls([])
+ setUnavailable(false)
+ setLoadError(null)
+ setCreating(false)
+ setSubmitting(false)
+ setRevokingId(null)
+ setService(null)
+ setLabel("")
+ setExpiresInSeconds("3600")
+ void refresh(sandbox, identity)
+ // eslint-disable-next-line react-hooks/exhaustive-deps
+ }, [sandbox.namespace, sandbox.claim, sandbox.name])
+
+ const create = async () => {
+ const identity = sandboxIdentity
+ const requestSandbox = sandbox
+ const selectedService = service?.value
+ if (!selectedService || !isCurrent(identity)) return
+ setSubmitting(true)
+ try {
+ let requestBuilder = new CreateSignedServiceUrlRequestBuilder()
+ .sandbox(requestSandbox)
+ .service(selectedService)
+ .expiresInSeconds(Number(expiresInSeconds))
+ const trimmedLabel = label.trim()
+ if (trimmedLabel) requestBuilder = requestBuilder.label(trimmedLabel)
+ await withClient(client => client.createSignedServiceUrl(requestBuilder.build()))
+ if (!isCurrent(identity)) return
+ flash.push({
+ type: "success",
+ header: "Signed URL created",
+ content: "Share this bearer link only with people who need temporary access.",
+ })
+ setCreating(false)
+ setService(null)
+ setLabel("")
+ setExpiresInSeconds("3600")
+ await refresh(requestSandbox, identity)
+ } catch (error) {
+ if (!isCurrent(identity)) return
+ if (SdkError.SignedServiceUrlsUnavailable.instanceOf(error)) {
+ markUnavailable(identity)
+ return
+ }
+ flash.push({
+ type: "error",
+ header: "Failed to create signed URL",
+ content: errorMessage(error),
+ })
+ } finally {
+ if (isCurrent(identity)) setSubmitting(false)
+ }
+ }
+
+ const revoke = async (item: SignedServiceUrl) => {
+ const identity = sandboxIdentity
+ const requestSandbox = sandbox
+ if (!isCurrent(identity)) return
+ setRevokingId(item.id)
+ try {
+ await withClient(client => client.revokeSignedServiceUrl(item))
+ if (!isCurrent(identity)) return
+ flash.push({ type: "success", header: "Signed URL revoked" })
+ await refresh(requestSandbox, identity)
+ } catch (error) {
+ if (!isCurrent(identity)) return
+ if (SdkError.SignedServiceUrlsUnavailable.instanceOf(error)) {
+ markUnavailable(identity)
+ return
+ }
+ flash.push({
+ type: "error",
+ header: "Failed to revoke signed URL",
+ content: errorMessage(error),
+ })
+ } finally {
+ if (isCurrent(identity)) setRevokingId(null)
+ }
+ }
+
+ const createAction = (
+ <SpaceBetween direction="horizontal" size="xs">
+ <CuaButton
+ tone="icon"
+ ariaLabel="Refresh signed URLs"
+ iconName="refresh"
+ disabled={loading}
+ onClick={() => void refresh()}
+ />
+ <CuaButton onClick={() => setCreating(true)}>Create signed URL</CuaButton>
+ </SpaceBetween>
+ )
+
+ if (unavailable) {
+ return (
+ <Container header={<Header variant="h2">Signed URLs</Header>}>
+ <Alert type="info">
+ Signed URLs are unavailable for this deployment. Other claim details remain available.
+ </Alert>
+ </Container>
+ )
+ }
+
+ return (
+ <SpaceBetween size="m">
+ {creating && (
+ <Container header={<Header variant="h2">Create signed URL</Header>}>
+ <Form
+ actions={
+ <SpaceBetween direction="horizontal" size="xs">
+ <CuaButton disabled={submitting} onClick={() => setCreating(false)}>
+ Cancel
+ </CuaButton>
+ <CuaButton tone="primary" loading={submitting} disabled={!service?.value} onClick={create}>
+ Create signed URL
+ </CuaButton>
+ </SpaceBetween>
+ }
+ >
+ <SpaceBetween size="m">
+ <Alert type="warning">
+ Anyone with this bearer link can access the selected service until it expires or is revoked.
+ </Alert>
+ <FormField label="Service">
+ <Select
+ selectedOption={service}
+ onChange={event => setService(event.detail.selectedOption)}
+ options={sandbox.services.map(value => ({ label: value, value }))}
+ placeholder="Choose a service"
+ />
+ </FormField>
+ <FormField label="Label (optional)">
+ <Input value={label} onChange={event => setLabel(event.detail.value)} />
+ </FormField>
+ <FormField label="Expiration">
+ <RadioGroup
+ value={expiresInSeconds}
+ onChange={event => setExpiresInSeconds(event.detail.value)}
+ items={expirationOptions}
+ />
+ </FormField>
+ </SpaceBetween>
+ </Form>
+ </Container>
+ )}
+
+ {loadError ? (
+ <Container header={<Header variant="h2" actions={createAction}>Signed URLs</Header>}>
+ <Alert type="error" action={<CuaButton onClick={() => void refresh()}>Retry</CuaButton>}>
+ {loadError}
+ </Alert>
+ </Container>
+ ) : (
+ <section className="cua-page-table">
+ <Table
+ variant="borderless"
+ loading={loading}
+ loadingText="Loading signed URLs"
+ items={signedUrls}
+ header={<Header variant="h2" counter={`(${signedUrls.length})`} actions={createAction}>Signed URLs</Header>}
+ empty={
+ <Box textAlign="center" color="inherit">
+ <SpaceBetween size="s">
+ <Box variant="p">No signed URLs yet.</Box>
+ <Box color="text-status-inactive">
+ Create a temporary bearer link to share service access without authentication.
+ </Box>
+ <div><CuaButton onClick={() => setCreating(true)}>Create signed URL</CuaButton></div>
+ </SpaceBetween>
+ </Box>
+ }
+ columnDefinitions={[
+ { id: "label", header: "Label", cell: item => item.label ?? item.id.slice(0, 8) },
+ { id: "service", header: "Service", cell: item => item.service },
+ { id: "url", header: "URL", cell: item => <CopyToClipboard textToCopy={item.url} copyButtonText="Copy URL" copyButtonAriaLabel={`Copy signed URL ${item.id}`} copySuccessText="Copied" copyErrorText="Unable to copy URL" /> },
+ { id: "created", header: "Created", cell: item => formatDate(item.createdAt) },
+ { id: "expires", header: "Expires", cell: item => signedUrlStatus(item, now) },
+ {
+ id: "actions",
+ header: "",
+ cell: item => !item.revokedAt && new Date(item.expiresAt).getTime() > now && (
+ <CuaButton ariaLabel={`Revoke signed URL ${item.id}`} loading={revokingId === item.id} onClick={() => void revoke(item)}>
+ Revoke
+ </CuaButton>
+ ),
+ },
+ ]}
+ />
+ </section>
+ )}
+ </SpaceBetween>
+ )
+}
diff --git a/libs/fleet/src/pages/ClaimDetail.tsx b/libs/fleet/src/pages/ClaimDetail.tsx
index 3e1968f7df..df433f75b9 100644
--- a/libs/fleet/src/pages/ClaimDetail.tsx
+++ b/libs/fleet/src/pages/ClaimDetail.tsx
@@ -11,11 +11,13 @@ import StatusIndicator from "@cloudscape-design/components/status-indicator"
import { useFlash } from "../components/FlashContext"
import { DesktopPane } from "../components/DesktopPane"
import { deleteClaim, getClaim } from "../fleet/claims"
-import type { Claim } from "../fleet/models"
+import type { Claim, PoolService } from "../fleet/models"
import { getPool } from "../fleet/pools"
+import type { Sandbox } from "../../sdk-bindings/ts-uniffi-browser/ts/index.web"
import { CuaButton } from "../components/CuaButton"
import { PageEmpty, PageError } from "../components/PageState"
import { PageShell } from "../components/PageShell"
+import { SignedServiceUrls } from "../components/SignedServiceUrls"
function phaseType(phase: string): "success" | "pending" | "error" | "info" {
switch (phase) {
@@ -30,18 +32,48 @@ function phaseType(phase: string): "success" | "pending" | "error" | "info" {
}
}
+function boundSandbox(claim: Claim, services: PoolService[]): Sandbox | null {
+ if (claim.phase !== "Bound" || !claim.sandboxName) return null
+ return {
+ namespace: claim.namespace,
+ claim: claim.name,
+ name: claim.sandboxName,
+ services: services.map(service => service.name),
+ }
+}
+
export function ClaimDetail() {
const { namespace = "", poolName = "", claimName = "" } = useParams()
+
+ return (
+ <ClaimDetailContent
+ key={`${namespace}/${poolName}/${claimName}`}
+ namespace={namespace}
+ poolName={poolName}
+ claimName={claimName}
+ />
+ )
+}
+
+function ClaimDetailContent({
+ namespace,
+ poolName,
+ claimName,
+}: {
+ namespace: string
+ poolName: string
+ claimName: string
+}) {
const navigate = useNavigate()
const flash = useFlash()
const [claim, setClaim] = useState<Claim | null>(null)
- const [services, setServices] = useState<{ name: string; targetPort: number; protocol: string }[]>([])
+ const [services, setServices] = useState<PoolService[]>([])
+ const [sandbox, setSandbox] = useState<Sandbox | null>(null)
const [loading, setLoading] = useState(true)
const [confirmRelease, setConfirmRelease] = useState(false)
const [releasing, setReleasing] = useState(false)
const [loadError, setLoadError] = useState<string | null>(null)
-
const load = async () => {
setLoading(true)
setLoadError(null)
@@ -50,8 +82,10 @@ export function ClaimDetail() {
getClaim(namespace, claimName),
getPool(namespace, poolName),
])
+ const nextSandbox = boundSandbox(claimData, poolData.services)
setClaim(claimData)
setServices(poolData.services)
+ setSandbox(nextSandbox)
} catch (e) {
const message = String((e as Error).message)
setLoadError(message)
@@ -78,13 +112,15 @@ export function ClaimDetail() {
const id = setInterval(async () => {
try {
const c = await getClaim(namespace, claimName)
+ const nextSandbox = boundSandbox(c, services)
setClaim(c)
+ setSandbox(nextSandbox)
} catch {
// Silent — next tick will retry
}
}, 3000)
return () => clearInterval(id)
- }, [claim?.phase, namespace, claimName])
+ }, [claim?.phase, namespace, claimName, services])
const release = async () => {
setReleasing(true)
@@ -238,6 +274,8 @@ export function ClaimDetail() {
</Container>
)}
+ {sandbox && <SignedServiceUrls key={`${sandbox.namespace}/${sandbox.name}`} sandbox={sandbox} />}
+
<Modal
visible={confirmRelease}
onDismiss={() => { if (!releasing) setConfirmRelease(false) }}
diff --git a/libs/fleet/tests/nginx-config.test.mjs b/libs/fleet/tests/nginx-config.test.mjs
index 90f3735455..7696ece0a2 100644
--- a/libs/fleet/tests/nginx-config.test.mjs
+++ b/libs/fleet/tests/nginx-config.test.mjs
@@ -39,6 +39,11 @@ test("backend API nginx route includes GitHub trust policy endpoints", async ()
/\badmin\b/,
"expected /api/admin/feature-flags to proxy to cyclops-cs-backend",
)
+ assert.match(
+ backendRoute[1],
+ /\bsigned-service-urls\b/,
+ "expected /api/signed-service-urls to proxy to cyclops-cs-backend",
+ )
})
test("oauth2-proxy accepts Fleets GitHub WIF bearer tokens", async () => {
@@ -61,3 +66,17 @@ test("sandbox service proxy streams bodies without a size cap", async () => {
assert.match(route[1], /proxy_read_timeout\s+1h\s*;/)
assert.match(route[1], /proxy_send_timeout\s+1h\s*;/)
})
+
+test("signed sandbox service proxy bypasses OAuth and SPA fallback", async () => {
+ const conf = await readFile(nginxConf, "utf8")
+ const route = conf.match(/location \^~ \/api\/signed-svc\/ \{([\s\S]*?)\n \}/)
+
+ assert.ok(route, "expected /api/signed-svc/ proxy route in nginx.conf")
+ assert.match(route[1], /access_log\s+off\s*;/)
+ assert.match(route[1], /error_log\s+\/dev\/null\s+crit\s*;/)
+ assert.match(route[1], /proxy_pass\s+\$\{CYCLOPS_CS_BACKEND\}\s*;/)
+ assert.doesNotMatch(route[1], /auth_request|oauth2|\$request_uri/)
+ assert.match(route[1], /client_max_body_size\s+0\s*;/)
+ assert.match(route[1], /proxy_request_buffering\s+off\s*;/)
+ assert.match(route[1], /proxy_buffering\s+off\s*;/)
+})
diff --git a/libs/fleet/tests/signed-service-url-sdk-boundary.test.mjs b/libs/fleet/tests/signed-service-url-sdk-boundary.test.mjs
new file mode 100644
index 0000000000..e0b8aa2700
--- /dev/null
+++ b/libs/fleet/tests/signed-service-url-sdk-boundary.test.mjs
@@ -0,0 +1,33 @@
+import assert from "node:assert/strict"
+import test from "node:test"
+import { readFile } from "node:fs/promises"
+
+test("claim detail manages signed service URLs through the shared SDK", async () => {
+ const source = [
+ await readFile(new URL("../src/pages/ClaimDetail.tsx", import.meta.url), "utf8"),
+ await readFile(new URL("../src/components/SignedServiceUrls.tsx", import.meta.url), "utf8"),
+ ].join("\n")
+
+ assert.match(source, /CreateSignedServiceUrlRequestBuilder/)
+ assert.match(source, /client\.createSignedServiceUrl\(/)
+ assert.match(source, /client\.listSignedServiceUrls\(/)
+ assert.match(source, /client\.revokeSignedServiceUrl\(/)
+ assert.doesNotMatch(source, /createPublicUrl|listPublicUrls|deletePublicUrl|Public URL/)
+})
+
+test("services retain authenticated proxy links", async () => {
+ const source = await readFile(new URL("../src/pages/ClaimDetail.tsx", import.meta.url), "utf8")
+
+ assert.match(source, /\/api\/svc\/\$\{namespace\}\/\$\{svcK8sName\}\//)
+})
+
+test("signed URL collection guards stale responses and disables on typed unavailability", async () => {
+ const source = await readFile(new URL("../src/components/SignedServiceUrls.tsx", import.meta.url), "utf8")
+
+ assert.match(source, /useRef/)
+ assert.match(source, /requestGeneration/)
+ assert.match(source, /SdkError\.SignedServiceUrlsUnavailable\.instanceOf\(error\)/)
+ assert.match(source, /client\.createSignedServiceUrl\(requestBuilder\.build\(\)\)/)
+ assert.match(source, /client\.revokeSignedServiceUrl\(item\)/)
+ assert.match(source, /copyButtonAriaLabel/)
+})
diff --git a/libs/fleet/tests/signed-service-url-swagger.test.mjs b/libs/fleet/tests/signed-service-url-swagger.test.mjs
new file mode 100644
index 0000000000..66518b9637
--- /dev/null
+++ b/libs/fleet/tests/signed-service-url-swagger.test.mjs
@@ -0,0 +1,27 @@
+import assert from "node:assert/strict"
+import test from "node:test"
+import { readFile } from "node:fs/promises"
+
+function definition(source, name) {
+ const start = source.indexOf(` ${name}:`)
+ assert.notEqual(start, -1, `${name} definition is missing`)
+ const next = source.indexOf("\n handlers.", start + name.length + 4)
+ return source.slice(start, next === -1 ? undefined : next)
+}
+
+test("signed service URL Swagger documents request bounds and server failures", async () => {
+ const source = await readFile(new URL("../backend/docs/swagger.yaml", import.meta.url), "utf8")
+ const request = definition(source, "handlers.CreateSignedServiceURLRequest")
+
+ assert.match(request, /expiresInSeconds:[\s\S]*maximum: 86400[\s\S]*minimum: 60/)
+ assert.match(request, /label:[\s\S]*maxLength: 120/)
+ assert.match(request, /120 UTF-8 bytes[\s\S]*backend byte validation remains authoritative/)
+ for (const field of ["claim", "sandbox", "service", "logicalService", "expiresInSeconds"]) {
+ assert.ok(request.split("\n").includes(` - ${field}`), `${field} is required`)
+ }
+
+ const collection = source.slice(source.indexOf(" /api/signed-service-urls/{namespace}:"), source.indexOf(" /api/signed-service-urls/{namespace}/{id}:"))
+ assert.match(collection, /get:[\s\S]*"500":/)
+ assert.match(collection, /post:[\s\S]*"500":/)
+ assert.match(source.slice(source.indexOf(" /api/signed-service-urls/{namespace}/{id}:")), /delete:[\s\S]*"500":/)
+})