Skip to content

armgit / cua

Public Imported from GitHub
0

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

feat(cyclops-sdk): raise PoolAccessDenied for 403s on pool-namespace writes (#7013)

r33drichardsef5912c186e0
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 7a55af2a76..19088399ad 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
@@ -7052,6 +7052,20 @@ sealed class SdkException: kotlin.Exception() {
get() = ""
}
+ class PoolAccessDenied(
+
+ val `operation`: kotlin.String,
+
+ val `namespace`: kotlin.String,
+
+ val `status`: kotlin.UShort,
+
+ val `body`: kotlin.String
+ ) : SdkException() {
+ override val message
+ get() = "operation=${ `operation` }, namespace=${ `namespace` }, status=${ `status` }, body=${ `body` }"
+ }
+
@@ -7105,6 +7119,12 @@ public object FfiConverterTypeSdkError : FfiConverterRustBuffer<SdkException> {
FfiConverterString.read(buf),
)
10 -> SdkException.ClaimTimeout()
+ 11 -> SdkException.PoolAccessDenied(
+ FfiConverterString.read(buf),
+ FfiConverterString.read(buf),
+ FfiConverterUShort.read(buf),
+ FfiConverterString.read(buf),
+ )
else -> throw RuntimeException("invalid error enum value, something is very wrong!!")
}
}
@@ -7166,6 +7186,14 @@ public object FfiConverterTypeSdkError : FfiConverterRustBuffer<SdkException> {
// Add the size for the Int that specifies the variant plus the size needed for all fields
4UL
)
+ is SdkException.PoolAccessDenied -> (
+ // Add the size for the Int that specifies the variant plus the size needed for all fields
+ 4UL
+ + FfiConverterString.allocationSize(value.`operation`)
+ + FfiConverterString.allocationSize(value.`namespace`)
+ + FfiConverterUShort.allocationSize(value.`status`)
+ + FfiConverterString.allocationSize(value.`body`)
+ )
}
}
@@ -7226,6 +7254,14 @@ public object FfiConverterTypeSdkError : FfiConverterRustBuffer<SdkException> {
buf.putInt(10)
Unit
}
+ is SdkException.PoolAccessDenied -> {
+ buf.putInt(11)
+ FfiConverterString.write(value.`operation`, buf)
+ FfiConverterString.write(value.`namespace`, buf)
+ FfiConverterUShort.write(value.`status`, buf)
+ FfiConverterString.write(value.`body`, buf)
+ Unit
+ }
}.let { /* this makes the `when` an expression, which ensures it is exhaustive */ }
}
diff --git a/libs/fleet/sdk-bindings/python/fleet_sdk/_sdk.py b/libs/fleet/sdk-bindings/python/fleet_sdk/_sdk.py
index 4b9836901c..72692f9857 100644
--- a/libs/fleet/sdk-bindings/python/fleet_sdk/_sdk.py
+++ b/libs/fleet/sdk-bindings/python/fleet_sdk/_sdk.py
@@ -3350,6 +3350,23 @@ class SdkError: # type: ignore
def __repr__(self):
return "SdkError.ClaimTimeout({})".format(str(self))
_UniffiTempSdkError.ClaimTimeout = ClaimTimeout # type: ignore
+ class PoolAccessDenied(_UniffiTempSdkError):
+
+ def __init__(self, operation, namespace, status, body):
+ super().__init__(", ".join([
+ "operation={!r}".format(operation),
+ "namespace={!r}".format(namespace),
+ "status={!r}".format(status),
+ "body={!r}".format(body),
+ ]))
+ self.operation = operation
+ self.namespace = namespace
+ self.status = status
+ self.body = body
+
+ def __repr__(self):
+ return "SdkError.PoolAccessDenied({})".format(str(self))
+ _UniffiTempSdkError.PoolAccessDenied = PoolAccessDenied # type: ignore
SdkError = _UniffiTempSdkError # type: ignore
del _UniffiTempSdkError
@@ -3404,6 +3421,13 @@ class _UniffiFfiConverterTypeSdkError(_UniffiConverterRustBuffer):
if variant == 10:
return SdkError.ClaimTimeout(
)
+ if variant == 11:
+ return SdkError.PoolAccessDenied(
+ _UniffiFfiConverterString.read(buf),
+ _UniffiFfiConverterString.read(buf),
+ _UniffiFfiConverterUInt16.read(buf),
+ _UniffiFfiConverterString.read(buf),
+ )
raise InternalError("Raw enum value doesn't match any cases")
@staticmethod
@@ -3443,6 +3467,12 @@ class _UniffiFfiConverterTypeSdkError(_UniffiConverterRustBuffer):
return
if isinstance(value, SdkError.ClaimTimeout):
return
+ if isinstance(value, SdkError.PoolAccessDenied):
+ _UniffiFfiConverterString.check_lower(value.operation)
+ _UniffiFfiConverterString.check_lower(value.namespace)
+ _UniffiFfiConverterUInt16.check_lower(value.status)
+ _UniffiFfiConverterString.check_lower(value.body)
+ return
@staticmethod
def write(value, buf):
@@ -3481,6 +3511,12 @@ class _UniffiFfiConverterTypeSdkError(_UniffiConverterRustBuffer):
_UniffiFfiConverterString.write(value.status, buf)
if isinstance(value, SdkError.ClaimTimeout):
buf.write_i32(10)
+ if isinstance(value, SdkError.PoolAccessDenied):
+ buf.write_i32(11)
+ _UniffiFfiConverterString.write(value.operation, buf)
+ _UniffiFfiConverterString.write(value.namespace, buf)
+ _UniffiFfiConverterUInt16.write(value.status, buf)
+ _UniffiFfiConverterString.write(value.body, buf)
class _UniffiFfiConverterBoolean:
@classmethod
diff --git a/libs/fleet/sdk-bindings/ruby/cyclops_sdk/sdk.rb b/libs/fleet/sdk-bindings/ruby/cyclops_sdk/sdk.rb
index 8a565a5494..f141e0e157 100644
--- a/libs/fleet/sdk-bindings/ruby/cyclops_sdk/sdk.rb
+++ b/libs/fleet/sdk-bindings/ruby/cyclops_sdk/sdk.rb
@@ -1331,6 +1331,14 @@ class RustBufferStream
if variant == 10
return SdkError::ClaimTimeout.new
end
+ if variant == 11
+ return SdkError::PoolAccessDenied.new(
+ readString(),
+ readString(),
+ readU16(),
+ readString()
+ )
+ end
raise InternalError, 'Unexpected variant tag for TypeSdkError'
end
@@ -2267,6 +2275,22 @@ module SdkError
"#{self.class.name}()"
end
end
+ class PoolAccessDenied < StandardError
+ def initialize(operation, namespace, status, body)
+ @operation = operation
+ @namespace = namespace
+ @status = status
+ @body = body
+ super()
+ end
+
+ attr_reader :operation, :namespace, :status, :body
+
+
+ def to_s
+ "#{self.class.name}(operation=#{@operation.inspect}, namespace=#{@namespace.inspect}, status=#{@status.inspect}, body=#{@body.inspect})"
+ end
+ end
end
diff --git a/libs/fleet/sdk-bindings/swift/CyclopsSdk.swift b/libs/fleet/sdk-bindings/swift/CyclopsSdk.swift
index fdab5d5772..12dc32f572 100644
--- a/libs/fleet/sdk-bindings/swift/CyclopsSdk.swift
+++ b/libs/fleet/sdk-bindings/swift/CyclopsSdk.swift
@@ -4232,6 +4232,8 @@ public enum SdkError: Swift.Error, Equatable, Hashable, Foundation.LocalizedErro
case ClaimFailed(phase: String, status: String
)
case ClaimTimeout
+ case PoolAccessDenied(operation: String, namespace: String, status: UInt16, body: String
+ )
@@ -4295,6 +4297,12 @@ public struct FfiConverterTypeSdkError: FfiConverterRustBuffer {
status: try FfiConverterString.read(from: &buf)
)
case 10: return .ClaimTimeout
+ case 11: return .PoolAccessDenied(
+ operation: try FfiConverterString.read(from: &buf),
+ namespace: try FfiConverterString.read(from: &buf),
+ status: try FfiConverterUInt16.read(from: &buf),
+ body: try FfiConverterString.read(from: &buf)
+ )
default: throw UniffiInternalError.unexpectedEnumCase
}
@@ -4361,6 +4369,14 @@ public struct FfiConverterTypeSdkError: FfiConverterRustBuffer {
case .ClaimTimeout:
writeInt(&buf, Int32(10))
+
+ case let .PoolAccessDenied(operation,namespace,status,body):
+ writeInt(&buf, Int32(11))
+ FfiConverterString.write(operation, into: &buf)
+ FfiConverterString.write(namespace, into: &buf)
+ FfiConverterUInt16.write(status, into: &buf)
+ FfiConverterString.write(body, into: &buf)
+
}
}
}
diff --git a/libs/fleet/sdk-bindings/ts-uniffi-browser/ts/cyclops_sdk_schema.ts b/libs/fleet/sdk-bindings/ts-uniffi-browser/ts/cyclops_sdk_schema.ts
index 2a5c3608e9..fe7a8e7680 100644
--- a/libs/fleet/sdk-bindings/ts-uniffi-browser/ts/cyclops_sdk_schema.ts
+++ b/libs/fleet/sdk-bindings/ts-uniffi-browser/ts/cyclops_sdk_schema.ts
@@ -2188,6 +2188,7 @@ export interface VmTemplateBuilderLike {
imagePullPolicy(value: ImagePullPolicy): VmTemplateBuilderLike;
imagePullSecret(value: string): VmTemplateBuilderLike;
memory(value: string): VmTemplateBuilderLike;
+ nestedVirtualization(value: boolean): VmTemplateBuilderLike;
nodeSelector(value: Map<string, string>): VmTemplateBuilderLike;
oidc(value: OidcConfig): VmTemplateBuilderLike;
probes(value: PreservedJsonLike): VmTemplateBuilderLike;
@@ -2360,6 +2361,21 @@ export class VmTemplateBuilder
);
}
+ nestedVirtualization(value: boolean): VmTemplateBuilderLike {
+ return FfiConverterTypeVmTemplateBuilder.lift(
+ uniffiCaller.rustCall(
+ /*caller:*/ (callStatus) => {
+ return nativeModule().ubrn_uniffi_cyclops_sdk_schema_fn_method_vmtemplatebuilder_nested_virtualization(
+ uniffiTypeVmTemplateBuilderObjectFactory.clonePointer(this),
+ FfiConverterBool.lower(value, nativeModule().rustbuffer_alloc),
+ callStatus,
+ );
+ },
+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
+ ),
+ );
+ }
+
nodeSelector(value: Map<string, string>): VmTemplateBuilderLike {
return FfiConverterTypeVmTemplateBuilder.lift(
uniffiCaller.rustCall(
@@ -3122,6 +3138,14 @@ function uniffiEnsureInitialized() {
"uniffi_cyclops_sdk_schema_checksum_method_vmtemplatebuilder_memory",
);
}
+ if (
+ nativeModule().ubrn_uniffi_cyclops_sdk_schema_checksum_method_vmtemplatebuilder_nested_virtualization() !==
+ 23834
+ ) {
+ throw new UniffiInternalError.ApiChecksumMismatch(
+ "uniffi_cyclops_sdk_schema_checksum_method_vmtemplatebuilder_nested_virtualization",
+ );
+ }
if (
nativeModule().ubrn_uniffi_cyclops_sdk_schema_checksum_method_vmtemplatebuilder_node_selector() !==
45280
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 44cd92067d..a26b82de92 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
@@ -1459,6 +1459,7 @@ export enum SdkError_Tags {
InvalidServicePath = "InvalidServicePath",
ClaimFailed = "ClaimFailed",
ClaimTimeout = "ClaimTimeout",
+ PoolAccessDenied = "PoolAccessDenied",
}
export const SdkError = (() => {
type Configuration__interface = {
@@ -1816,6 +1817,69 @@ export const SdkError = (() => {
}
}
+ 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";
}
@@ -1832,6 +1896,7 @@ export const SdkError = (() => {
InvalidServicePath: InvalidServicePath_,
ClaimFailed: ClaimFailed_,
ClaimTimeout: ClaimTimeout_,
+ PoolAccessDenied: PoolAccessDenied_,
});
})();
export type SdkError = InstanceType<
@@ -1845,7 +1910,8 @@ export type SdkError = InstanceType<
| "UnknownService"
| "InvalidServicePath"
| "ClaimFailed"
- | "ClaimTimeout"]
+ | "ClaimTimeout"
+ | "PoolAccessDenied"]
>;
// FfiConverter for enum SdkError
@@ -1895,6 +1961,13 @@ const FfiConverterTypeSdkError = (() => {
});
case 10:
return new SdkError.ClaimTimeout();
+ case 11:
+ 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();
}
@@ -1965,6 +2038,15 @@ const FfiConverterTypeSdkError = (() => {
ordinalConverter.write(10, into);
return;
}
+ case SdkError_Tags.PoolAccessDenied: {
+ ordinalConverter.write(11, 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:
// Throwing from here means that SdkError_Tags hasn't matched an ordinal.
throw new UniffiInternalError.UnexpectedEnumCase();
@@ -2035,6 +2117,15 @@ const FfiConverterTypeSdkError = (() => {
case SdkError_Tags.ClaimTimeout: {
return ordinalConverter.allocationSize(10);
}
+ case SdkError_Tags.PoolAccessDenied: {
+ const inner = value.inner;
+ let size = ordinalConverter.allocationSize(11);
+ 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();
}
@@ -3070,6 +3161,10 @@ export interface CyclopsClientLike {
request: CreateClaimRequest,
asyncOpts_?: { signal: AbortSignal },
) /*throws*/ : Promise<Claim>;
+ createNamespace(
+ name: string,
+ asyncOpts_?: { signal: AbortSignal },
+ ) /*throws*/ : Promise<Namespace>;
createPool(
request: CreatePoolRequest,
asyncOpts_?: { signal: AbortSignal },
@@ -3086,6 +3181,10 @@ export interface CyclopsClientLike {
claim: Claim,
asyncOpts_?: { signal: AbortSignal },
) /*throws*/ : Promise<void>;
+ deleteNamespace(
+ name: string,
+ asyncOpts_?: { signal: AbortSignal },
+ ) /*throws*/ : Promise<void>;
deletePool(
pool: Pool,
asyncOpts_?: { signal: AbortSignal },
@@ -3102,6 +3201,10 @@ export interface CyclopsClientLike {
claim: Claim,
asyncOpts_?: { signal: AbortSignal },
) /*throws*/ : Promise<Claim>;
+ getNamespace(
+ name: string,
+ asyncOpts_?: { signal: AbortSignal },
+ ) /*throws*/ : Promise<Namespace>;
getPool(
name: string,
asyncOpts_?: { signal: AbortSignal },
@@ -3421,6 +3524,42 @@ export class CyclopsClient
);
}
+ async createNamespace(
+ name: string,
+ asyncOpts_?: { signal: AbortSignal },
+ ): Promise<Namespace> /*throws*/ {
+ return await uniffiRustCallAsync(
+ /*rustCaller:*/ uniffiCaller,
+ /*rustFutureFunc:*/ () => {
+ return nativeModule().ubrn_uniffi_cyclops_sdk_fn_method_cyclopsclient_create_namespace(
+ uniffiTypeCyclopsClientObjectFactory.clonePointer(this),
+ FfiConverterString.lower(name, nativeModule().rustbuffer_alloc),
+ );
+ },
+ /*pollFunc:*/ nativeModule()
+ .ubrn_ffi_cyclops_sdk_rust_future_poll_rust_buffer,
+ /*cancelFunc:*/ nativeModule()
+ .ubrn_ffi_cyclops_sdk_rust_future_cancel_rust_buffer,
+ /*completeFunc:*/ nativeModule()
+ .ubrn_ffi_cyclops_sdk_rust_future_complete_rust_buffer,
+ /*freeFunc:*/ nativeModule()
+ .ubrn_ffi_cyclops_sdk_rust_future_free_rust_buffer,
+ // Async returns always go through the JS-side converter: the
+ // FFI symbol returns the future handle (u64), and the user-level
+ // RustBuffer comes back via the shared `rust_future_complete_*`
+ // export. The bytes the runtime hands back must be deserialized
+ // here using the per-callable return-type converter.
+ /*liftFunc:*/ FfiConverterTypeNamespace.lift.bind(
+ FfiConverterTypeNamespace,
+ ),
+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
+ /*asyncOpts:*/ asyncOpts_,
+ /*errorHandler:*/ FfiConverterTypeSdkError.lift.bind(
+ FfiConverterTypeSdkError,
+ ),
+ );
+ }
+
async createPool(
request: CreatePoolRequest,
asyncOpts_?: { signal: AbortSignal },
@@ -3563,6 +3702,33 @@ export class CyclopsClient
);
}
+ async deleteNamespace(
+ name: string,
+ asyncOpts_?: { signal: AbortSignal },
+ ): Promise<void> /*throws*/ {
+ return await uniffiRustCallAsync(
+ /*rustCaller:*/ uniffiCaller,
+ /*rustFutureFunc:*/ () => {
+ return nativeModule().ubrn_uniffi_cyclops_sdk_fn_method_cyclopsclient_delete_namespace(
+ uniffiTypeCyclopsClientObjectFactory.clonePointer(this),
+ FfiConverterString.lower(name, 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 deletePool(
pool: Pool,
asyncOpts_?: { signal: AbortSignal },
@@ -3681,6 +3847,42 @@ export class CyclopsClient
);
}
+ async getNamespace(
+ name: string,
+ asyncOpts_?: { signal: AbortSignal },
+ ): Promise<Namespace> /*throws*/ {
+ return await uniffiRustCallAsync(
+ /*rustCaller:*/ uniffiCaller,
+ /*rustFutureFunc:*/ () => {
+ return nativeModule().ubrn_uniffi_cyclops_sdk_fn_method_cyclopsclient_get_namespace(
+ uniffiTypeCyclopsClientObjectFactory.clonePointer(this),
+ FfiConverterString.lower(name, nativeModule().rustbuffer_alloc),
+ );
+ },
+ /*pollFunc:*/ nativeModule()
+ .ubrn_ffi_cyclops_sdk_rust_future_poll_rust_buffer,
+ /*cancelFunc:*/ nativeModule()
+ .ubrn_ffi_cyclops_sdk_rust_future_cancel_rust_buffer,
+ /*completeFunc:*/ nativeModule()
+ .ubrn_ffi_cyclops_sdk_rust_future_complete_rust_buffer,
+ /*freeFunc:*/ nativeModule()
+ .ubrn_ffi_cyclops_sdk_rust_future_free_rust_buffer,
+ // Async returns always go through the JS-side converter: the
+ // FFI symbol returns the future handle (u64), and the user-level
+ // RustBuffer comes back via the shared `rust_future_complete_*`
+ // export. The bytes the runtime hands back must be deserialized
+ // here using the per-callable return-type converter.
+ /*liftFunc:*/ FfiConverterTypeNamespace.lift.bind(
+ FfiConverterTypeNamespace,
+ ),
+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
+ /*asyncOpts:*/ asyncOpts_,
+ /*errorHandler:*/ FfiConverterTypeSdkError.lift.bind(
+ FfiConverterTypeSdkError,
+ ),
+ );
+ }
+
async getPool(
name: string,
asyncOpts_?: { signal: AbortSignal },
@@ -5323,6 +5525,14 @@ function uniffiEnsureInitialized() {
"uniffi_cyclops_sdk_checksum_method_cyclopsclient_create_claim",
);
}
+ if (
+ nativeModule().ubrn_uniffi_cyclops_sdk_checksum_method_cyclopsclient_create_namespace() !==
+ 38049
+ ) {
+ throw new UniffiInternalError.ApiChecksumMismatch(
+ "uniffi_cyclops_sdk_checksum_method_cyclopsclient_create_namespace",
+ );
+ }
if (
nativeModule().ubrn_uniffi_cyclops_sdk_checksum_method_cyclopsclient_create_pool() !==
48557
@@ -5355,6 +5565,14 @@ function uniffiEnsureInitialized() {
"uniffi_cyclops_sdk_checksum_method_cyclopsclient_delete_claim",
);
}
+ if (
+ nativeModule().ubrn_uniffi_cyclops_sdk_checksum_method_cyclopsclient_delete_namespace() !==
+ 4545
+ ) {
+ throw new UniffiInternalError.ApiChecksumMismatch(
+ "uniffi_cyclops_sdk_checksum_method_cyclopsclient_delete_namespace",
+ );
+ }
if (
nativeModule().ubrn_uniffi_cyclops_sdk_checksum_method_cyclopsclient_delete_pool() !==
31235
@@ -5387,6 +5605,14 @@ function uniffiEnsureInitialized() {
"uniffi_cyclops_sdk_checksum_method_cyclopsclient_get_claim",
);
}
+ if (
+ nativeModule().ubrn_uniffi_cyclops_sdk_checksum_method_cyclopsclient_get_namespace() !==
+ 184
+ ) {
+ throw new UniffiInternalError.ApiChecksumMismatch(
+ "uniffi_cyclops_sdk_checksum_method_cyclopsclient_get_namespace",
+ );
+ }
if (
nativeModule().ubrn_uniffi_cyclops_sdk_checksum_method_cyclopsclient_get_pool() !==
49450
diff --git a/libs/fleet/sdk/src/error.rs b/libs/fleet/sdk/src/error.rs
index e645174435..08ddde56e5 100644
--- a/libs/fleet/sdk/src/error.rs
+++ b/libs/fleet/sdk/src/error.rs
@@ -47,6 +47,18 @@ pub enum SdkError {
ClaimFailed { phase: String, status: String },
#[error("claim did not bind before the polling limit")]
ClaimTimeout,
+ #[error(
+ "Fleet denied {operation} on pool namespace '{namespace}' (HTTP {status}: {body}). \
+ Pool names are globally unique across accounts, so this name may already be taken — \
+ try a new pool name. If that does not work, contact support on Discord: \
+ https://discord.gg/mVnXXpdE85"
+ )]
+ PoolAccessDenied {
+ operation: String,
+ namespace: String,
+ status: u16,
+ body: String,
+ },
}
impl SdkError {
@@ -57,6 +69,25 @@ impl SdkError {
body: bounded_body(body),
}
}
+
+ /// Reinterpret an HTTP 403 from a pool-namespace write as a pool access
+ /// denial. Reads are left as plain `Status` errors so reconcile flows can
+ /// keep treating 403 like "not visible, try to create".
+ pub(crate) fn deny_pool_access(namespace: &str, error: SdkError) -> SdkError {
+ match error {
+ SdkError::Status {
+ operation,
+ status: status @ 403,
+ body,
+ } => SdkError::PoolAccessDenied {
+ operation,
+ namespace: namespace.into(),
+ status,
+ body,
+ },
+ other => other,
+ }
+ }
}
pub fn bounded_body(body: &[u8]) -> String {
diff --git a/libs/fleet/sdk/src/pools.rs b/libs/fleet/sdk/src/pools.rs
index a9c640c74b..bdc1d8ff4d 100644
--- a/libs/fleet/sdk/src/pools.rs
+++ b/libs/fleet/sdk/src/pools.rs
@@ -44,7 +44,8 @@ impl CyclopsClient {
.await;
let namespace_created = matches!(
self.create_namespace_if_missing(&pool.metadata.namespace)
- .await?,
+ .await
+ .map_err(|error| SdkError::deny_pool_access(&pool.metadata.namespace, error))?,
NamespaceOwnership::Created
);
let result = self
@@ -63,7 +64,7 @@ impl CyclopsClient {
.delete_namespace(pool.metadata.namespace.clone())
.await;
}
- Err(error)
+ Err(SdkError::deny_pool_access(&pool.metadata.namespace, error))
}
}
}
@@ -111,6 +112,7 @@ impl CyclopsClient {
&[200],
)
.await
+ .map_err(|error| SdkError::deny_pool_access(&pool.metadata.namespace, error))
}
pub async fn delete_pool(self: Arc<Self>, pool: Pool) -> Result<(), SdkError> {
@@ -124,10 +126,12 @@ impl CyclopsClient {
json_request("DELETE", item_url, None),
&[200, 202, 204, 404],
)
- .await?;
+ .await
+ .map_err(|error| SdkError::deny_pool_access(&pool.metadata.namespace, error))?;
Arc::clone(&self)
.delete_namespace(pool.metadata.namespace.clone())
.await
+ .map_err(|error| SdkError::deny_pool_access(&pool.metadata.namespace, error))
}
}
diff --git a/libs/fleet/sdk/src/templates.rs b/libs/fleet/sdk/src/templates.rs
index 5b0df5adfc..b4eac62c70 100644
--- a/libs/fleet/sdk/src/templates.rs
+++ b/libs/fleet/sdk/src/templates.rs
@@ -42,6 +42,7 @@ impl CyclopsClient {
&[200, 201, 202],
)
.await
+ .map_err(|error| SdkError::deny_pool_access(&template.metadata.namespace, error))
}
pub async fn list_templates(
@@ -105,6 +106,7 @@ impl CyclopsClient {
&[200],
)
.await
+ .map_err(|error| SdkError::deny_pool_access(&template.metadata.namespace, error))
}
pub async fn delete_template(self: Arc<Self>, template: Template) -> Result<(), SdkError> {
@@ -119,6 +121,7 @@ impl CyclopsClient {
&[200, 202, 204, 404],
)
.await
+ .map_err(|error| SdkError::deny_pool_access(&template.metadata.namespace, error))
}
}
diff --git a/libs/fleet/sdk/tests/pool_flow.rs b/libs/fleet/sdk/tests/pool_flow.rs
index 6b3c214eef..0a9f131e26 100644
--- a/libs/fleet/sdk/tests/pool_flow.rs
+++ b/libs/fleet/sdk/tests/pool_flow.rs
@@ -538,6 +538,144 @@ async fn reconcile_returns_create_error_after_named_pool_is_forbidden() {
assert_request(&requests[2], "POST", COLLECTION, Some(&json_bytes(&pool())));
}
+#[tokio::test]
+async fn create_pool_403_maps_to_pool_access_denied_with_guidance() {
+ let http = Arc::new(ScriptedHttpClient::new([
+ Ok(token()),
+ Ok(response(409, b"already exists")),
+ Ok(response(403, b"k8s request is not allowed")),
+ ]));
+ let client = client(Arc::clone(&http));
+
+ let error = client
+ .create_pool(CreatePoolRequest {
+ namespace: NAMESPACE.into(),
+ spec: pool_spec(),
+ })
+ .await
+ .unwrap_err();
+
+ assert!(matches!(
+ error,
+ SdkError::PoolAccessDenied {
+ ref operation,
+ ref namespace,
+ status: 403,
+ ref body,
+ } if operation == "create pool"
+ && namespace == NAMESPACE
+ && body == "k8s request is not allowed"
+ ));
+ let message = error.to_string();
+ assert!(message.contains("globally unique"));
+ assert!(message.contains("try a new pool name"));
+ assert!(message.contains("https://discord.gg/mVnXXpdE85"));
+}
+
+#[tokio::test]
+async fn namespace_create_403_maps_to_pool_access_denied() {
+ let http = Arc::new(ScriptedHttpClient::new([
+ Ok(token()),
+ Ok(response(403, b"cannot create namespace")),
+ ]));
+ let client = client(Arc::clone(&http));
+
+ let error = client
+ .create_pool(CreatePoolRequest {
+ namespace: NAMESPACE.into(),
+ spec: pool_spec(),
+ })
+ .await
+ .unwrap_err();
+
+ assert!(matches!(
+ error,
+ SdkError::PoolAccessDenied {
+ ref operation,
+ ref namespace,
+ status: 403,
+ ..
+ } if operation == "create namespace" && namespace == NAMESPACE
+ ));
+}
+
+#[tokio::test]
+async fn reconcile_update_403_maps_to_pool_access_denied() {
+ let existing = pool();
+ let http = Arc::new(ScriptedHttpClient::new([
+ Ok(token()),
+ Ok(json_response(200, &existing)),
+ Ok(response(403, b"k8s request is not allowed")),
+ ]));
+ let client = client(Arc::clone(&http));
+
+ let error = client
+ .reconcile_pool(CreatePoolRequest {
+ namespace: NAMESPACE.into(),
+ spec: pool_spec(),
+ })
+ .await
+ .unwrap_err();
+
+ assert!(matches!(
+ error,
+ SdkError::PoolAccessDenied {
+ ref operation,
+ ref namespace,
+ status: 403,
+ ..
+ } if operation == "update pool" && namespace == NAMESPACE
+ ));
+}
+
+#[tokio::test]
+async fn delete_pool_403_maps_to_pool_access_denied() {
+ let http = Arc::new(ScriptedHttpClient::new([
+ Ok(token()),
+ Ok(response(403, b"k8s request is not allowed")),
+ ]));
+ let client = client(Arc::clone(&http));
+
+ let error = client.delete_pool(pool()).await.unwrap_err();
+
+ assert!(matches!(
+ error,
+ SdkError::PoolAccessDenied {
+ ref operation,
+ ref namespace,
+ status: 403,
+ ..
+ } if operation == "delete pool" && namespace == NAMESPACE
+ ));
+}
+
+#[tokio::test]
+async fn delete_pool_namespace_cleanup_403_maps_to_pool_access_denied() {
+ let http = Arc::new(ScriptedHttpClient::new([
+ Ok(token()),
+ Ok(response(204, b"")),
+ Ok(response(403, b"cannot delete namespace")),
+ ]));
+ let client = client(Arc::clone(&http));
+
+ let error = client.delete_pool(pool()).await.unwrap_err();
+
+ assert!(matches!(
+ error,
+ SdkError::PoolAccessDenied {
+ ref operation,
+ ref namespace,
+ status: 403,
+ ..
+ } if operation == "delete namespace" && namespace == NAMESPACE
+ ));
+
+ let requests = resource_requests(&http).await;
+ assert_eq!(requests.len(), 2);
+ assert_request(&requests[0], "DELETE", ITEM, None);
+ assert_request(&requests[1], "DELETE", NAMESPACE_ITEM, None);
+}
+
#[tokio::test]
async fn reconcile_returns_unrelated_named_pool_read_error_without_creating() {
let http = Arc::new(ScriptedHttpClient::new([
diff --git a/libs/fleet/sdk/tests/template_flow.rs b/libs/fleet/sdk/tests/template_flow.rs
index 6d52161c5b..1d957898da 100644
--- a/libs/fleet/sdk/tests/template_flow.rs
+++ b/libs/fleet/sdk/tests/template_flow.rs
@@ -2,7 +2,7 @@ mod support;
use cyclops_sdk::{
CreateTemplateRequest, CyclopsClient, CyclopsConfiguration, CyclopsCredentials, HttpHeader,
- HttpResponse, ResourceMetadata, Template,
+ HttpResponse, ResourceMetadata, SdkError, Template,
};
use std::sync::Arc;
use support::ScriptedHttpClient;
@@ -90,6 +90,81 @@ async fn reconcile_template_keeps_a_pull_secret_the_desired_spec_asks_for() {
);
}
+#[tokio::test]
+async fn reconcile_template_update_403_maps_to_pool_access_denied() {
+ let http = Arc::new(ScriptedHttpClient::new([
+ Ok(token()),
+ Ok(json_response(200, &template(None))),
+ Ok(response(403, b"k8s request is not allowed")),
+ ]));
+
+ let error = client(Arc::clone(&http))
+ .reconcile_template(create_request(None))
+ .await
+ .unwrap_err();
+
+ assert!(matches!(
+ error,
+ SdkError::PoolAccessDenied {
+ ref operation,
+ ref namespace,
+ status: 403,
+ ref body,
+ } if operation == "update template"
+ && namespace == NAMESPACE
+ && body == "k8s request is not allowed"
+ ));
+ let message = error.to_string();
+ assert!(message.contains("globally unique"));
+ assert!(message.contains("https://discord.gg/mVnXXpdE85"));
+}
+
+#[tokio::test]
+async fn create_template_403_maps_to_pool_access_denied() {
+ let http = Arc::new(ScriptedHttpClient::new([
+ Ok(token()),
+ Ok(response(403, b"k8s request is not allowed")),
+ ]));
+
+ let error = client(Arc::clone(&http))
+ .create_template(create_request(None))
+ .await
+ .unwrap_err();
+
+ assert!(matches!(
+ error,
+ SdkError::PoolAccessDenied {
+ ref operation,
+ ref namespace,
+ status: 403,
+ ..
+ } if operation == "create template" && namespace == NAMESPACE
+ ));
+}
+
+#[tokio::test]
+async fn delete_template_403_maps_to_pool_access_denied() {
+ let http = Arc::new(ScriptedHttpClient::new([
+ Ok(token()),
+ Ok(response(403, b"k8s request is not allowed")),
+ ]));
+
+ let error = client(Arc::clone(&http))
+ .delete_template(template(None))
+ .await
+ .unwrap_err();
+
+ assert!(matches!(
+ error,
+ SdkError::PoolAccessDenied {
+ ref operation,
+ ref namespace,
+ status: 403,
+ ..
+ } if operation == "delete template" && namespace == NAMESPACE
+ ));
+}
+
fn client(http: Arc<ScriptedHttpClient>) -> Arc<CyclopsClient> {
CyclopsClient::connect(
CyclopsConfiguration {