mirror of
https://github.com/NVIDIA/OpenShell.git
synced 2026-10-28 07:13:04 +08:00
* feat(sdk/go): complete Go SDK with domain clients, auth, and hardening Add the Go SDK implementation covering all gateway RPC services with domain-typed clients, comprehensive OIDC authentication flows, fake test doubles, and proto converters. Domain clients: Sandbox, Provider, Exec, File, TCP, SSH, Policy, Profile, Health, Service, Config, Workspace, Inference, Refresh. Each client validates inputs, resolves sandboxes by name, and converts between domain types and proto at the boundary. Auth: OIDC authorization code (PKCE), device code (RFC 8628), and client credentials (RFC 6749 Section 4.4) flows with gateway config auto-resolution. Token refresh with singleflight deduplication and exponential backoff. Edge tunnel proxy for gRPC-over-WebSocket. Gateway: On-disk gateway discovery with user/system directory precedence, lazy token loading, and auth mode mapping. Testing: In-memory fake client with deep-copy isolation, watch broadcasting with filtering, and workspace-scoped object stores. Bufconn-based gRPC tests for all domain clients. Ref: #2044 Signed-off-by: Roland Huß <rhuss@redhat.com> * feat(sdk/go): add gateway client options for logger, timeout, and retry Add WithLogger, WithTimeout, and WithRetryPolicy options to the gateway package's NewClient function. These forward the corresponding Config fields (Logger, Timeout, RetryPolicy) through to the underlying SDK client, giving callers full control over observability, connection timeouts, and retry behavior when constructing clients from on-disk gateway configurations. Also adds RetryPolicy type to types package and extends Config with the three new fields. * fix(mise): sync sccache lock entry Signed-off-by: Drew Newberry <anewberry@nvidia.com> --------- Signed-off-by: Roland Huß <rhuss@redhat.com> Signed-off-by: Drew Newberry <anewberry@nvidia.com> Co-authored-by: Drew Newberry <anewberry@nvidia.com>
68 lines
2.3 KiB
Go
68 lines
2.3 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"
|
|
)
|
|
|
|
// SandboxConfig represents the full configuration state of a sandbox.
|
|
type SandboxConfig = types.SandboxConfig
|
|
|
|
// GatewayConfig represents gateway-global settings.
|
|
type GatewayConfig = types.GatewayConfig
|
|
|
|
// ConfigUpdate represents a configuration mutation request.
|
|
type ConfigUpdate = types.ConfigUpdate
|
|
|
|
// ConfigUpdateResult holds the result of a configuration update operation.
|
|
type ConfigUpdateResult = types.ConfigUpdateResult
|
|
|
|
// SettingValue is a typed setting value (string, bool, int64, or bytes).
|
|
type SettingValue = types.SettingValue
|
|
|
|
// SettingValueType identifies which typed field of a SettingValue is active.
|
|
type SettingValueType = types.SettingValueType
|
|
|
|
// EffectiveSetting is a setting value paired with its resolved scope.
|
|
type EffectiveSetting = types.EffectiveSetting
|
|
|
|
// SettingScope indicates whether a setting is sandbox or global.
|
|
type SettingScope = types.SettingScope
|
|
|
|
// PolicySource indicates the source of a policy payload.
|
|
type PolicySource = types.PolicySource
|
|
|
|
// SettingValueType constants re-exported from types package.
|
|
const (
|
|
SettingValueString = types.SettingValueString
|
|
SettingValueBool = types.SettingValueBool
|
|
SettingValueInt = types.SettingValueInt
|
|
SettingValueBytes = types.SettingValueBytes
|
|
)
|
|
|
|
// SettingScope constants re-exported from types package.
|
|
const (
|
|
SettingScopeUnspecified = types.SettingScopeUnspecified
|
|
SettingScopeSandbox = types.SettingScopeSandbox
|
|
SettingScopeGlobal = types.SettingScopeGlobal
|
|
)
|
|
|
|
// PolicySource constants re-exported from types package.
|
|
const (
|
|
PolicySourceUnspecified = types.PolicySourceUnspecified
|
|
PolicySourceSandbox = types.PolicySourceSandbox
|
|
PolicySourceGlobal = types.PolicySourceGlobal
|
|
)
|
|
|
|
// ConfigInterface defines operations for reading and updating gateway and
|
|
// sandbox configuration.
|
|
type ConfigInterface interface {
|
|
GetSandbox(ctx context.Context, workspace, sandboxName string) (*SandboxConfig, error)
|
|
GetGateway(ctx context.Context) (*GatewayConfig, error)
|
|
Update(ctx context.Context, workspace string, update *ConfigUpdate) (*ConfigUpdateResult, error)
|
|
}
|