workspace

package
v0.1.0-preview Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 2, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package workspace covers the entire /api/v2/setup/* surface — workspace + organization lifecycle, cloud provider credential storage (AWS / GCP / Azure), AI provider credential storage (16 providers), Git provider connections, payment / SMTP / SSL / OAuth / OKTA / CyberArk creds, and the API token lifecycle.

The platform stores everything in HashiCorp Vault under a per-workspace path; this SDK never logs request bodies and all credential POSTs are over TLS.

Roughly 35 endpoints are wrapped here. Most follow the same shape: POST /api/v2/setup/<thing>-credentials with a JSON body containing the secret + a name, returning { "stored": true, "vault_path": "..." }.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AICredentialsInput

type AICredentialsInput struct {
	APIKey   string `json:"api_key,omitempty"`
	OrgID    string `json:"org_id,omitempty"`
	Endpoint string `json:"endpoint,omitempty"` // for self-hosted Ollama / Hermes
}

AICredentialsInput is the body shape every /api/v2/setup/ai-*-credentials endpoint accepts. Most providers want only ApiKey; some accept extras.

type APIToken

type APIToken struct {
	Token     string                 `json:"token"`
	TokenName string                 `json:"token_name,omitempty"`
	ExpiresAt string                 `json:"expires_at,omitempty"`
	Raw       map[string]interface{} `json:"-"`
}

type AWSCredentials

type AWSCredentials struct {
	AccessKeyID     string `json:"AWS_ACCESS_KEY_ID"`
	SecretAccessKey string `json:"AWS_SECRET_ACCESS_KEY"`
	Region          string `json:"AWS_REGION,omitempty"`
	IAMUser         string `json:"AWS_IAM_USER,omitempty"`
	AccountID       string `json:"AWS_ACCOUNT_ID,omitempty"`
}

AWSCredentials — JSON tags mirror AWSVariablesRequest in vxnode/services/workspace/workspace.go (UPPER_SNAKE, not snake_case).

type AzureCredentials

type AzureCredentials struct {
	ClientID       string `json:"AZURE_CLIENT_ID"`
	ClientSecret   string `json:"AZURE_CLIENT_SECRET"`
	TenantID       string `json:"AZURE_TENANT_ID"`
	SubscriptionID string `json:"AZURE_SUBSCRIPTION_ID"`
}

AzureCredentials — JSON tags mirror AzureVariablesRequest (workspace.go).

type Client

type Client struct {
	T       *transport.Transport
	NodeURL string
	// AuthedUsername / AuthedOrganization are injected into every
	// /api/v2/setup/* body by post(); the server validates both
	// (VaultCredentialsRequest in vxnode/services/workspace/workspace.go).
	AuthedUsername     string
	AuthedOrganization string
}

Client — construct via c.Workspace().

func (*Client) CreateAPIToken

func (c *Client) CreateAPIToken(ctx context.Context, in CreateAPITokenInput) (*APIToken, error)

func (*Client) CreateOrganization

func (c *Client) CreateOrganization(ctx context.Context, in CreateOrganizationInput) (map[string]interface{}, error)

CreateOrganization under the current workspace.

func (*Client) CreateWorkspace

func (c *Client) CreateWorkspace(ctx context.Context, in CreateWorkspaceInput) (*WorkspaceResult, error)

Create a new tenant workspace with Vault-backed storage.

func (*Client) DeleteCredential

func (c *Client) DeleteCredential(ctx context.Context, name string) (map[string]interface{}, error)

DeleteCredential removes a stored credential by name.

func (*Client) DeleteDockerRegistry

func (c *Client) DeleteDockerRegistry(ctx context.Context, registrySlug string) (map[string]interface{}, error)

func (*Client) DeleteRandomCredential

func (c *Client) DeleteRandomCredential(ctx context.Context, credentialSlug string) (map[string]interface{}, error)

func (*Client) DeleteServer

func (c *Client) DeleteServer(ctx context.Context, serverSlug string) (map[string]interface{}, error)

func (*Client) DeleteWorkspace

func (c *Client) DeleteWorkspace(ctx context.Context) (map[string]interface{}, error)

DeleteWorkspace tears down the current workspace and all resources.

func (*Client) GetAPIToken

func (c *Client) GetAPIToken(ctx context.Context, name string) (*APIToken, error)

func (*Client) GetAllAICredentials

func (c *Client) GetAllAICredentials(ctx context.Context) (map[string]interface{}, error)

GetAllAICredentials lists every AI provider with stored credentials in the current workspace.

func (*Client) GetAllCredentials

func (c *Client) GetAllCredentials(ctx context.Context) (map[string]interface{}, error)

GetAllCredentials lists every cloud credential stored in the current workspace (names + types only — never returns the secret values).

func (*Client) GetAllDockerCredentials

func (c *Client) GetAllDockerCredentials(ctx context.Context) (map[string]interface{}, error)

GetAllDockerCredentials lists every Docker credential entry (sensitive fields masked).

func (*Client) GetAllDockerRegistries

func (c *Client) GetAllDockerRegistries(ctx context.Context) (map[string]interface{}, error)

func (*Client) GetAllMessagingCredentials

func (c *Client) GetAllMessagingCredentials(ctx context.Context) (map[string]interface{}, error)

func (*Client) GetAllPaymentCredentials

func (c *Client) GetAllPaymentCredentials(ctx context.Context) (map[string]interface{}, error)

func (*Client) GetAllRandomCredentials

func (c *Client) GetAllRandomCredentials(ctx context.Context) (map[string]interface{}, error)

func (*Client) GetAllSMTPCredentials

func (c *Client) GetAllSMTPCredentials(ctx context.Context) (map[string]interface{}, error)

func (*Client) GetAllServers

func (c *Client) GetAllServers(ctx context.Context) (map[string]interface{}, error)

func (*Client) GetAllVMCredentials

func (c *Client) GetAllVMCredentials(ctx context.Context) (map[string]interface{}, error)

func (*Client) GetDockerCredentialsByRegistry

func (c *Client) GetDockerCredentialsByRegistry(ctx context.Context, registrySlug string) (map[string]interface{}, error)

GetDockerCredentialsByRegistry fetches one Docker credential by registry slug.

func (*Client) GetDockerRegistry

func (c *Client) GetDockerRegistry(ctx context.Context, registrySlug string) (map[string]interface{}, error)

func (*Client) GetRandomCredential

func (c *Client) GetRandomCredential(ctx context.Context, credentialSlug string) (map[string]interface{}, error)

func (*Client) GetServer

func (c *Client) GetServer(ctx context.Context, serverSlug string) (map[string]interface{}, error)

func (*Client) GetVMCredentialsByKeypair

func (c *Client) GetVMCredentialsByKeypair(ctx context.Context, keyPairName string) (map[string]interface{}, error)

func (*Client) GetVaultCredentials

func (c *Client) GetVaultCredentials(ctx context.Context, body map[string]interface{}) (map[string]interface{}, error)

func (*Client) StoreAICredentials

func (c *Client) StoreAICredentials(ctx context.Context, provider string, in AICredentialsInput) (map[string]interface{}, error)

func (*Client) StoreAWSCredentials

func (c *Client) StoreAWSCredentials(ctx context.Context, in AWSCredentials) (map[string]interface{}, error)

func (*Client) StoreAzureCredentials

func (c *Client) StoreAzureCredentials(ctx context.Context, in AzureCredentials) (map[string]interface{}, error)

func (*Client) StoreCyberarkCredentials

func (c *Client) StoreCyberarkCredentials(ctx context.Context, body map[string]interface{}) (map[string]interface{}, error)

func (*Client) StoreDockerCredentials

func (c *Client) StoreDockerCredentials(ctx context.Context, in DockerCredentials) (map[string]interface{}, error)

func (*Client) StoreDockerRegistry

func (c *Client) StoreDockerRegistry(ctx context.Context, in DockerRegistry) (map[string]interface{}, error)

func (*Client) StoreExternalVaultCredentials

func (c *Client) StoreExternalVaultCredentials(ctx context.Context, body map[string]interface{}) (map[string]interface{}, error)

func (*Client) StoreGCPCredentials

func (c *Client) StoreGCPCredentials(ctx context.Context, in GCPCredentials) (map[string]interface{}, error)

func (*Client) StoreGitCredentials

func (c *Client) StoreGitCredentials(ctx context.Context, body map[string]interface{}) (map[string]interface{}, error)

func (*Client) StoreGitHubCredentials

func (c *Client) StoreGitHubCredentials(ctx context.Context, in GitHubCredentials) (map[string]interface{}, error)

func (*Client) StoreGitlabCredentials

func (c *Client) StoreGitlabCredentials(ctx context.Context, body map[string]interface{}) (map[string]interface{}, error)

func (*Client) StoreKubeconfigCredentials

func (c *Client) StoreKubeconfigCredentials(ctx context.Context, body map[string]interface{}) (map[string]interface{}, error)

func (*Client) StoreMessagingBotCredentials

func (c *Client) StoreMessagingBotCredentials(ctx context.Context, body map[string]interface{}) (map[string]interface{}, error)

func (*Client) StoreOAuthCredentials

func (c *Client) StoreOAuthCredentials(ctx context.Context, body map[string]interface{}) (map[string]interface{}, error)

func (*Client) StoreOktaCredentials

func (c *Client) StoreOktaCredentials(ctx context.Context, body map[string]interface{}) (map[string]interface{}, error)

func (*Client) StorePaymentCredentials

func (c *Client) StorePaymentCredentials(ctx context.Context, body map[string]interface{}) (map[string]interface{}, error)

func (*Client) StoreRandomCredential

func (c *Client) StoreRandomCredential(ctx context.Context, in RandomCredential) (map[string]interface{}, error)

func (*Client) StoreSMTPCredentials

func (c *Client) StoreSMTPCredentials(ctx context.Context, body map[string]interface{}) (map[string]interface{}, error)

func (*Client) StoreSSLCertificateCredentials

func (c *Client) StoreSSLCertificateCredentials(ctx context.Context, body map[string]interface{}) (map[string]interface{}, error)

func (*Client) StoreServer

func (c *Client) StoreServer(ctx context.Context, in ServerEntry) (map[string]interface{}, error)

func (*Client) StoreVMCredentials

func (c *Client) StoreVMCredentials(ctx context.Context, in VMCredentials) (map[string]interface{}, error)

type CreateAPITokenInput

type CreateAPITokenInput struct {
	TokenName     string `json:"token_name"`
	ExpiresInDays int    `json:"expires_in_days,omitempty"`
}

type CreateOrganizationInput

type CreateOrganizationInput struct {
	OrgName string `json:"org_name"`
	Plan    string `json:"plan,omitempty"`
}

type CreateWorkspaceInput

type CreateWorkspaceInput struct {
	WorkspaceName string `json:"workspace_name"`
	Region        string `json:"region,omitempty"`
}

type DockerCredentials

type DockerCredentials struct {
	DockerUser         string `json:"DOCKER_USERNAME"`
	DockerPass         string `json:"DOCKER_PASSWORD"`
	DockerEmail        string `json:"DOCKER_EMAIL,omitempty"`
	DockerServer       string `json:"DOCKER_SERVER,omitempty"`
	DockerRegistryName string `json:"DOCKER_REGISTRY_NAME"`
	DockerRegistryType string `json:"DOCKER_REGISTRY_TYPE,omitempty"`
}

DockerCredentials mirrors DockerVariablesRequest (workspace.go). DockerRegistryName is the slug — multiple registries can coexist in one workspace.

type DockerRegistry

type DockerRegistry struct {
	RegistryName          string `json:"registry_name"`
	RegistryType          string `json:"registry_type"` // dockerhub|ecr|gcr|acr|ghcr|gitlab|quay|harbor|jfrog|custom
	RegistryURL           string `json:"registry_url"`
	Namespace             string `json:"namespace,omitempty"`
	Region                string `json:"region,omitempty"`
	DefaultCredentialSlug string `json:"default_credential_slug,omitempty"`
	Description           string `json:"description,omitempty"`
	IsDefault             bool   `json:"is_default,omitempty"`
}

DockerRegistry mirrors DockerRegistryRequest. Stored at docker/registry-endpoints/<slug>. May reference a saved Docker credential by slug via DefaultCredentialSlug.

type GCPCredentials

type GCPCredentials struct {
	ProjectID         string `json:"GCP_PROJECT_ID"`
	ServiceAccountKey string `json:"GCP_SERVICE_ACCOUNT_KEY"` // raw JSON string
}

GCPCredentials — JSON tags mirror GCPVariablesRequest (workspace.go).

type GitHubCredentials

type GitHubCredentials struct {
	GitHubTokenName string `json:"GITHUB_TOKEN_NAME,omitempty"`
	GitHubToken     string `json:"GITHUB_TOKEN"`
	GitHubUser      string `json:"GITHUB_USER,omitempty"`
	SSHPublicKey    string `json:"SSH_PUBLIC_KEY,omitempty"`
	SSHPrivateKey   string `json:"SSH_PRIVATE_KEY,omitempty"`
}

type RandomCredential

type RandomCredential struct {
	CredentialName string                 `json:"credential_name"`
	CredentialType string                 `json:"credential_type,omitempty"` // free-form tag
	Description    string                 `json:"description,omitempty"`
	Fields         map[string]interface{} `json:"fields,omitempty"`
	JSONBlob       string                 `json:"json_blob,omitempty"`
}

RandomCredential is a free-form credential entry. Fields holds arbitrary K/V; JSONBlob is opaque text (e.g. a full GCP service-account JSON document).

type ServerEntry

type ServerEntry struct {
	Name            string   `json:"name"`
	IPAddress       string   `json:"ip_address"`
	Hostname        string   `json:"hostname,omitempty"`
	Port            int      `json:"port,omitempty"`
	Description     string   `json:"description,omitempty"`
	KeypairName     string   `json:"keypair_name,omitempty"`
	KeypairLocation string   `json:"keypair_location,omitempty"`
	Tags            []string `json:"tags,omitempty"`
}

ServerEntry is one row in the workspace server inventory. Name + IPAddress are required; KeypairName / KeypairLocation are optional.

type VMCredentials

type VMCredentials struct {
	KeyPairName   string `json:"key_pair_name"`
	SSHPublicKey  string `json:"SSH_PUBLIC_KEY,omitempty"`
	SSHPrivateKey string `json:"SSH_PRIVATE_KEY,omitempty"`
	VMPassword    string `json:"VM_PASSWORD,omitempty"`
}

type WorkspaceResult

type WorkspaceResult struct {
	WorkspaceID string                 `json:"workspace_id"`
	Status      string                 `json:"status,omitempty"`
	Raw         map[string]interface{} `json:"-"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL