Documentation
¶
Index ¶
- Constants
- func IsProviderReviewPending(err error) bool
- func ParseError(resp *http.Response) error
- type APIError
- type Client
- func (c *Client) DoWithAutoRefresh(ctx context.Context, maxRetries uint, fn func() (*http.Response, error)) (*http.Response, error)
- func (c *Client) GetBaseURL() string
- func (c *Client) GetGeneratedClient() *generated.Client
- func (c *Client) GetPlatformVersions(ctx context.Context) (*PlatformPins, error)
- func (c *Client) GetPlatformVersionsWithRetry(ctx context.Context, maxRetries uint) (*PlatformPins, error)
- func (c *Client) GetToken() string
- func (c *Client) SetToken(token string)
- func (c *Client) SetTokenRefreshFunc(fn TokenRefreshFunc)
- func (c *Client) WithRetry(ctx context.Context, maxRetries uint, fn func() error) error
- type ComponentPin
- type Config
- type PlatformPins
- type TokenRefreshFunc
Constants ¶
const ( ComponentK3s = "k3s" ComponentK3d = "k3d" ComponentCalico = "calico" ComponentLiqo = "liqo" ComponentLiqoctl = "liqoctl" ComponentHelm = "helm" )
Component names returned by MetadataService.GetPlatformVersions.
const ProviderReviewPendingMessage = "Provider organization review is pending."
ProviderReviewPendingMessage is the backend PermissionDenied copy for an unverified provider organization. CLI commands that hit blocked provider APIs must surface this string to the user (not a generic 403).
Variables ¶
This section is empty.
Functions ¶
func IsProviderReviewPending ¶
IsProviderReviewPending reports the unverified-provider marketplace lock.
func ParseError ¶
ParseError parses an HTTP error response from the backend API. The gateway emits google.rpc.Status JSON (code/message/details) and sometimes a nested camelCase error object ({error:{message,status}}).
Types ¶
type APIError ¶
type APIError struct {
StatusCode int
Message string
Details string
Code string // gRPC error code (e.g., "NOT_FOUND", "ALREADY_EXISTS")
}
APIError represents an API error from the backend API
func (*APIError) IsAlreadyExists ¶
IsAlreadyExists checks if error is 409 or ALREADY_EXISTS
func (*APIError) IsNotFound ¶
IsNotFound checks if error is 404
func (*APIError) IsPermissionDenied ¶
IsPermissionDenied checks if error is 403 or PERMISSION_DENIED
func (*APIError) IsQuotaExceeded ¶
IsQuotaExceeded reports plan/entitlement limits (HTTP 429 + quota message). Distinct from transient rate limiting so callers can avoid retrying forever.
func (*APIError) IsUnauthorized ¶
IsUnauthorized checks if error is 401
func (*APIError) UserMessage ¶
UserMessage returns the backend error text when it is more specific than an HTTP status label.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is the API client wrapper for the platform API It wraps the generated oapi-codegen client with token authentication, retry logic, and error handling
func (*Client) DoWithAutoRefresh ¶
func (c *Client) DoWithAutoRefresh(ctx context.Context, maxRetries uint, fn func() (*http.Response, error)) (*http.Response, error)
DoWithAutoRefresh executes an API call function and automatically refreshes token on 401 It wraps the call with retry logic and handles 401 by refreshing the token once
func (*Client) GetBaseURL ¶
GetBaseURL returns the base URL of the API client
func (*Client) GetGeneratedClient ¶
GetGeneratedClient returns the underlying generated API client (for advanced usage)
func (*Client) GetPlatformVersions ¶
func (c *Client) GetPlatformVersions(ctx context.Context) (*PlatformPins, error)
GetPlatformVersions fetches the server-pinned install matrix. This endpoint is anonymous; no auth token is required.
func (*Client) GetPlatformVersionsWithRetry ¶
func (c *Client) GetPlatformVersionsWithRetry(ctx context.Context, maxRetries uint) (*PlatformPins, error)
GetPlatformVersionsWithRetry fetches platform versions with retry on transient failures.
func (*Client) SetToken ¶
SetToken sets the authentication token used by every request. The request editor is installed once and reads the current token per request, so refreshing a token never mutates the editor slice while requests are in flight.
func (*Client) SetTokenRefreshFunc ¶
func (c *Client) SetTokenRefreshFunc(fn TokenRefreshFunc)
SetTokenRefreshFunc sets the function to call when token needs to be refreshed
type ComponentPin ¶
type ComponentPin struct {
Name string
Version string
MinVersion string
DownloadURL string
ChecksumSHA256 string
}
ComponentPin is a normalized platform component version pin.
type PlatformPins ¶
type PlatformPins struct {
SchemaVersion string
Components map[string]ComponentPin
}
PlatformPins is the install matrix keyed by component name.
func ParsePlatformVersions ¶
func ParsePlatformVersions(pv *generated.V1PlatformVersions) (*PlatformPins, error)
ParsePlatformVersions converts a generated V1PlatformVersions into PlatformPins.
func (*PlatformPins) Get ¶
func (p *PlatformPins) Get(name string) (ComponentPin, bool)
Get returns a component pin by name.
func (*PlatformPins) VersionOr ¶
func (p *PlatformPins) VersionOr(name, fallback string) string
VersionOr returns the pinned version for name, or fallback if missing/empty.