api

package
v0.22.0 Latest Latest
Warning

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

Go to latest
Published: Aug 13, 2026 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrCloudPodNotFound = errors.New("cloud pod not found")

ErrCloudPodNotFound is returned by GetCloudPod when the platform reports the requested pod does not exist (HTTP 404).

View Source
var ErrCloudPodVersionNotFound = errors.New("cloud pod version not found")

ErrCloudPodVersionNotFound is returned by GetCloudPod when the pod exists but the specifically requested version does not. It is distinct from ErrCloudPodNotFound so callers can point the user at the pod's version list rather than at the list of pods. Match it with errors.Is; use errors.As with CloudPodVersionNotFoundError to read the highest available version.

View Source
var ErrCloudPodsForbidden = errors.New("cloud pods not available on this plan")

ErrCloudPodsForbidden is returned when the platform refuses a cloud pod request with HTTP 403 ("generic.forbidden"), which is how it reports that the caller's plan does not include Cloud Pods. Only 403 maps here: the token authenticated fine and was then denied. A bad or expired token comes back as 401 and stays a generic error, so re-login problems aren't misreported as a billing problem.

Functions

This section is empty.

Types

type AuthRequest

type AuthRequest struct {
	ID            string `json:"id"`
	Code          string `json:"code"`
	ExchangeToken string `json:"exchange_token"`
}

type CloudPod added in v0.12.0

type CloudPod struct {
	Name        string
	Version     int
	LastChanged *time.Time
}

type CloudPodDetails added in v0.13.0

type CloudPodDetails struct {
	Name              string
	Version           int
	Created           *time.Time
	Size              int64
	LocalStackVersion string
	Message           string
	Services          []string
	Resources         []CloudPodResource
}

CloudPodDetails is the metadata for a single cloud snapshot, taken from its latest version. Resources is empty when the platform has no resource breakdown for the snapshot (e.g. it was saved without resource indexing enabled).

type CloudPodResource added in v0.13.0

type CloudPodResource struct {
	Service string
	Counts  []CloudPodResourceCount
}

CloudPodResource groups the resource counts of a single service.

type CloudPodResourceCount added in v0.13.0

type CloudPodResourceCount struct {
	Noun  string
	Count int
}

CloudPodResourceCount is a count of a single resource kind within a service, e.g. {Noun: "buckets", Count: 3}.

type CloudPodVersion added in v0.21.0

type CloudPodVersion struct {
	Version           int
	Created           *time.Time
	Size              int64
	LocalStackVersion string
	Description       string
	Services          []string
}

CloudPodVersion is one entry in a cloud snapshot's version history. Created is nil when the platform reports no usable timestamp for the version.

type CloudPodVersionNotFoundError added in v0.21.0

type CloudPodVersionNotFoundError struct {
	PodName    string
	Version    int
	MaxVersion int
}

CloudPodVersionNotFoundError carries which version was asked for and what the highest available one is, so callers can render that without re-parsing a message. It satisfies errors.Is(err, ErrCloudPodVersionNotFound).

func (*CloudPodVersionNotFoundError) Error added in v0.21.0

func (*CloudPodVersionNotFoundError) Is added in v0.21.0

func (e *CloudPodVersionNotFoundError) Is(target error) bool

type CredentialsInfo

type CredentialsInfo struct {
	Token string `json:"token"`
}

type LicenseError added in v0.5.0

type LicenseError struct {
	Status           int
	Message          string
	Detail           string
	IsUnsupportedTag bool
}

LicenseError is returned when license validation fails. Message is user-friendly; Detail contains the raw server response for debugging. IsUnsupportedTag is set when the server rejects the image tag format (a 400 whose detail carries the licensing.license.format error code). It means "the server cannot judge this tag", not that the license was rejected — the start pre-flight skips validation entirely on it and defers to the container's own license check, so keep the detection narrow: widening it widens that bypass.

func (*LicenseError) Error added in v0.5.0

func (e *LicenseError) Error() string

type LicenseRequest

type LicenseRequest struct {
	Product     ProductInfo     `json:"product"`
	Credentials CredentialsInfo `json:"credentials"`
	Machine     MachineInfo     `json:"machine"`
}

type LicenseResponse added in v0.5.7

type LicenseResponse struct {
	LicenseType string          `json:"license_type"`
	RawBytes    json.RawMessage `json:"-"`
}

func (*LicenseResponse) PlanDisplayName added in v0.5.7

func (r *LicenseResponse) PlanDisplayName() string

PlanDisplayName returns a human-readable plan name for the license type. Returns an empty string for a nil receiver or unknown types.

type MachineInfo

type MachineInfo struct {
	Hostname        string `json:"hostname,omitempty"`
	Platform        string `json:"platform,omitempty"`
	PlatformRelease string `json:"platform_release,omitempty"`
}

type PlatformAPI

type PlatformAPI interface {
	CreateAuthRequest(ctx context.Context) (*AuthRequest, error)
	CheckAuthRequestConfirmed(ctx context.Context, id, exchangeToken string) (bool, error)
	ExchangeAuthRequest(ctx context.Context, id, exchangeToken string) (string, error)
	GetLicenseToken(ctx context.Context, bearerToken string) (string, error)
	GetLicense(ctx context.Context, req *LicenseRequest) (*LicenseResponse, error)
}

type PlatformClient

type PlatformClient struct {
	// contains filtered or unexported fields
}

func NewPlatformClient

func NewPlatformClient(apiEndpoint string, logger log.Logger) *PlatformClient

func (*PlatformClient) CheckAuthRequestConfirmed

func (c *PlatformClient) CheckAuthRequestConfirmed(ctx context.Context, id, exchangeToken string) (bool, error)

func (*PlatformClient) CreateAuthRequest

func (c *PlatformClient) CreateAuthRequest(ctx context.Context) (*AuthRequest, error)

func (*PlatformClient) ExchangeAuthRequest

func (c *PlatformClient) ExchangeAuthRequest(ctx context.Context, id, exchangeToken string) (string, error)

func (*PlatformClient) GetCloudPod added in v0.13.0

func (c *PlatformClient) GetCloudPod(ctx context.Context, authToken, podName string, version int) (*CloudPodDetails, error)

GetCloudPod fetches metadata for a single cloud snapshot from the platform. version 0 reports the latest version; any other value reports that exact one. It returns ErrCloudPodNotFound when the pod does not exist and ErrCloudPodVersionNotFound when the pod exists but that version does not.

func (*PlatformClient) GetCloudPodVersions added in v0.21.0

func (c *PlatformClient) GetCloudPodVersions(ctx context.Context, authToken, podName string) ([]CloudPodVersion, error)

GetCloudPodVersions returns the version history of a cloud snapshot, newest first, with versions the platform marked deleted filtered out. It returns ErrCloudPodNotFound when the pod does not exist.

func (*PlatformClient) GetLicense

func (c *PlatformClient) GetLicense(ctx context.Context, licReq *LicenseRequest) (*LicenseResponse, error)

func (*PlatformClient) GetLicenseToken

func (c *PlatformClient) GetLicenseToken(ctx context.Context, bearerToken string) (string, error)

func (*PlatformClient) ListCloudPods added in v0.12.0

func (c *PlatformClient) ListCloudPods(ctx context.Context, authToken, creator string) ([]CloudPod, error)

type ProductInfo

type ProductInfo struct {
	Name    string `json:"name"`
	Version string `json:"version"`
}

Jump to

Keyboard shortcuts

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