workspace

package
v1.4.2 Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EditAccessControl added in v1.4.2

func EditAccessControl(ac *client.AlpaconClient) (any, error)

EditAccessControl retrieves current settings and opens them in an editor for editing. Returns the edited data ready to be sent as a PATCH request.

func EditAuthentication added in v1.4.2

func EditAuthentication(ac *client.AlpaconClient) (any, error)

EditAuthentication retrieves current settings and opens them in an editor for editing. Returns the edited data ready to be sent as a PATCH request.

func GetAccessControl added in v1.4.2

func GetAccessControl(ac *client.AlpaconClient) ([]byte, error)

GetAccessControl retrieves the workspace access control settings.

func GetAuthentication added in v1.4.2

func GetAuthentication(ac *client.AlpaconClient) ([]byte, error)

GetAuthentication retrieves the workspace authentication settings.

func GetMFAMethods added in v1.4.2

func GetMFAMethods(ac *client.AlpaconClient) ([]byte, error)

GetMFAMethods retrieves the available MFA methods for the workspace.

func GetNotifications added in v1.4.2

func GetNotifications(ac *client.AlpaconClient) ([]byte, error)

GetNotifications retrieves the workspace notification settings.

func GetPaymentAPIBaseURL added in v1.4.2

func GetPaymentAPIBaseURL(workspaceURL string) (string, error)

GetPaymentAPIBaseURL determines the payment API base URL from the workspace URL. Dev regions use the staging payment API; all others use production.

func GetPreferences added in v1.4.2

func GetPreferences(ac *client.AlpaconClient) ([]byte, error)

GetPreferences retrieves the workspace preferences.

func GetWorkspaceID added in v1.4.2

func GetWorkspaceID(ac *client.AlpaconClient, paymentBaseURL, workspaceName string) (string, error)

GetWorkspaceID retrieves the workspace UUID from the payment API by matching schema_name. It follows pagination until the workspace is found or all pages are exhausted. The payment API uses page-number pagination: next/previous are integers, not URLs.

func PatchAccessControl added in v1.4.2

func PatchAccessControl(ac *client.AlpaconClient, data any) ([]byte, error)

PatchAccessControl sends the edited access control settings to the server. Returns the raw error from SendPatchRequest to preserve error structure for ParseErrorResponse.

func PatchAuthentication added in v1.4.2

func PatchAuthentication(ac *client.AlpaconClient, data any) ([]byte, error)

PatchAuthentication sends the edited authentication settings to the server. Returns the raw error from SendPatchRequest to preserve error structure for ParseErrorResponse.

func ResolveWorkspaceURL added in v1.1.1

func ResolveWorkspaceURL(accessToken, targetName, baseDomain string) (newURL, newName string, err error)

ResolveWorkspaceURL finds the target workspace in the JWT and builds its full URL.

func UpdateNotifications added in v1.4.2

func UpdateNotifications(ac *client.AlpaconClient) ([]byte, error)

UpdateNotifications opens the current notification settings in an editor and sends the changes.

func UpdatePreferences added in v1.4.2

func UpdatePreferences(ac *client.AlpaconClient) ([]byte, error)

UpdatePreferences opens the current preferences in an editor and sends the changes.

func ValidateAndBuildWorkspaceURL

func ValidateAndBuildWorkspaceURL(cfg config.Config, targetName string) (newURL, newName string, err error)

ValidateAndBuildWorkspaceURL finds the target workspace in the JWT and builds its full URL.

Types

type BillingPeriod added in v1.4.2

type BillingPeriod struct {
	Start     string `json:"start"`
	End       string `json:"end"`
	TotalDays int    `json:"total_days"`
}

BillingPeriod represents the billing period for a workspace.

type ServiceUsage added in v1.4.2

type ServiceUsage struct {
	Name         string   `json:"name"`
	Unit         string   `json:"unit"`
	Limit        *float64 `json:"limit"`
	CurrentUsage float64  `json:"current_usage"`
	CurrentCost  string   `json:"current_cost"`
	OverageCost  *string  `json:"overage_cost"`
}

ServiceUsage represents usage details for a single service.

type Subscription added in v1.4.2

type Subscription struct {
	ProductName  string             `json:"product_name"`
	PlanName     string             `json:"plan_name"`
	ProductCode  string             `json:"product_code"`
	PlanCode     string             `json:"plan_code"`
	BaseQuantity int                `json:"base_quantity"`
	UnitPrice    string             `json:"unit_price"`
	SubTotal     string             `json:"sub_total"`
	Period       SubscriptionPeriod `json:"period"`
}

Subscription represents the subscription details.

type SubscriptionPeriod added in v1.4.2

type SubscriptionPeriod struct {
	Start string `json:"start"`
	End   string `json:"end"`
}

SubscriptionPeriod represents the subscription period.

type UsageEstimate added in v1.4.2

type UsageEstimate struct {
	BillingPeriod BillingPeriod           `json:"billing_period"`
	Currency      string                  `json:"currency"`
	Subscription  Subscription            `json:"subscription"`
	Services      map[string]ServiceUsage `json:"services"`
	Metadata      *UsageMetadata          `json:"metadata"`
}

UsageEstimate represents the full usage estimate response.

func GetUsageEstimate added in v1.4.2

func GetUsageEstimate(ac *client.AlpaconClient, paymentBaseURL, workspaceID string) (*UsageEstimate, error)

GetUsageEstimate retrieves the usage estimate for a workspace from the payment API.

type UsageMetadata added in v1.4.2

type UsageMetadata struct {
	Plan            string `json:"plan"`
	IsSubscribed    bool   `json:"is_subscribed"`
	IsTrialing      bool   `json:"is_trialing"`
	IsPaid          bool   `json:"is_paid"`
	AvailableCredit string `json:"available_credit"`
}

UsageMetadata holds account-level metadata for a workspace.

type Workspace

type Workspace struct {
	SchemaName string `json:"schema_name"`
	Auth0ID    string `json:"auth0_id"`
	Region     string `json:"region"`
}

Workspace represents a workspace entry from the JWT token's workspaces claim.

func GetWorkspacesFromToken

func GetWorkspacesFromToken(accessToken string) ([]Workspace, error)

GetWorkspacesFromToken decodes the JWT access token and extracts the workspaces claim.

type WorkspaceListEntry

type WorkspaceListEntry struct {
	Name    string
	Region  string
	Current string
}

WorkspaceListEntry is used for displaying workspace information in a table.

func GetWorkspaceList

func GetWorkspaceList(cfg config.Config) ([]WorkspaceListEntry, error)

GetWorkspaceList returns a display-ready list of workspaces, marking the current one.

Jump to

Keyboard shortcuts

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