Files
OpenShell/sdk/go/openshell/v1/workspace.go
Mrunal Patel c502be9fd7 feat(api): return typed deletion outcomes with explicit missing-target semantics (#3317)
* feat(api): return typed deletion outcomes with explicit missing-target semantics

Implement phase 2 of #3051 across the public gateway API and first-party SDKs. Preserve asynchronous sandbox deletion and observed resource identities, reserve legacy wire fields, and document the coordinated migration.

Signed-off-by: Mrunal Patel <mrunalp@gmail.com>

* fix(sdk): bind deletion waits to sandbox identity

Track accepted deletions by original sandbox identity in Rust and TypeScript. Preserve name-only waits and cover replacement races and lookup failures.

Merge the phase-one cleanup fix and adapt its interceptor regressions to typed deletion outcomes.

Refs #3051.

Signed-off-by: Mrunal Patel <mrunalp@gmail.com>

* test(e2e): accept asynchronous stopped sandbox deletion

Allow either completed or accepted deletion output, then continue polling for actual sandbox absence. This preserves the lifecycle assertion under the phase-two deletion contract.

Refs #3051.

Signed-off-by: Mrunal Patel <mrunalp@gmail.com>

---------

Signed-off-by: Mrunal Patel <mrunalp@gmail.com>
2026-09-16 22:11:19 +00:00

50 lines
1.9 KiB
Go

// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
// SPDX-License-Identifier: Apache-2.0
package v1
import (
"context"
"github.com/NVIDIA/OpenShell/sdk/go/openshell/v1/types"
)
// Workspace represents a logical grouping of resources.
type Workspace = types.Workspace
// WorkspaceMember represents a user's membership in a workspace.
type WorkspaceMember = types.WorkspaceMember
// WorkspacePhase describes the lifecycle state of a workspace.
type WorkspacePhase = types.WorkspacePhase
// WorkspaceRole describes a member's role within a workspace.
type WorkspaceRole = types.WorkspaceRole
// WorkspacePhase constants.
const (
WorkspaceActive = types.WorkspaceActive
WorkspaceTerminating = types.WorkspaceTerminating
WorkspaceUnknown = types.WorkspaceUnknown
)
// WorkspaceRole constants.
const (
WorkspaceRoleAdmin = types.WorkspaceRoleAdmin
WorkspaceRoleUser = types.WorkspaceRoleUser
WorkspaceRoleUnknown = types.WorkspaceRoleUnknown
)
// WorkspaceInterface defines workspace and member management operations.
type WorkspaceInterface interface {
Create(ctx context.Context, name string, labels map[string]string) (*Workspace, error)
Get(ctx context.Context, name string) (*Workspace, error)
List(opts ...ListOptions) (*Pager[*Workspace], error)
ListAll(ctx context.Context, opts ...ListOptions) ([]*Workspace, error)
Delete(ctx context.Context, name string, opts ...DeleteOptions) (*DeletionResult, error)
AddMember(ctx context.Context, workspace, principalSubject string, role WorkspaceRole) (*WorkspaceMember, error)
RemoveMember(ctx context.Context, workspace, principalSubject string, opts ...DeleteOptions) (*DeletionResult, error)
ListMembers(workspace string, opts ...ListOptions) (*Pager[*WorkspaceMember], error)
ListAllMembers(ctx context.Context, workspace string, opts ...ListOptions) ([]*WorkspaceMember, error)
}