Documentation
¶
Overview ¶
Package upstream provides HTTP helpers for fetching workspace-scoped data from the rysh-server using the local upstream API key.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FetchWorkspaceID ¶
func FetchWorkspaceID(up config.UpstreamConfig) (string, error)
FetchWorkspaceID queries the upstream server's /api/server-info endpoint with the workspace API key and returns the workspace id (UUID). The id is the globally unique NATS namespace token (ws.{id}.*); workspace names are unique per user, so the name cannot be used on the wire.
func ResolveWorkspaceID ¶
func ResolveWorkspaceID(up config.UpstreamConfig) string
ResolveWorkspaceID returns the upstream NATS namespace token for the given upstream config. When the configured workspace value is already a UUID it is returned unchanged (no network call). Otherwise — when sharing is enabled and an api_key is present — it resolves the workspace id from the server via the api key. On any failure it falls back to the configured value so the CLI still starts (sharing simply won't line up until the id is correct).
Types ¶
type ConnectionCredentials ¶
type ConnectionCredentials struct {
ConnectionID string `json:"connection_id"`
WorkspaceID string `json:"workspace_id"`
Name string `json:"name"`
ConnectionType string `json:"connection_type"`
Config map[string]string `json:"config"`
Secrets map[string]string `json:"secrets"`
}
ConnectionCredentials carries decrypted secrets plus public config for an external connection of a given type, fetched from the rysh-server.
func FetchConnectionCredentials ¶
func FetchConnectionCredentials(cfg config.Config, connType string) (*ConnectionCredentials, error)
FetchConnectionCredentials retrieves the decrypted credentials for the workspace's enabled connection of the given type (e.g. "slack", "whatsapp"). Returns an error if upstream is not configured, the request fails, or the workspace has no enabled connection of that type.
type RemoteShare ¶
type RemoteShare struct {
}
RemoteShare represents a shared entity returned by the upstream server.
func FetchRemoteShares ¶
func FetchRemoteShares(cfg config.Config) ([]RemoteShare, error)
FetchRemoteShares retrieves all active shares in the workspace from the upstream server. The workspace API key scopes the query to the key's workspace only.