Documentation
¶
Index ¶
- func AppOptionLabel(cfg config.IConfig, profileApps map[string]bool, cs *iostreams.ColorScheme, ...) string
- func ConfigureProfile(io *iostreams.IOStreams, cfg config.IConfig, appDetails *dashboard.Application, ...) error
- func CreateAndFetchApplication(io *iostreams.IOStreams, client *dashboard.Client, ...) (*dashboard.Application, string, error)
- func CreateApplicationWithRetry(io *iostreams.IOStreams, client *dashboard.Client, accessToken string, ...) (*dashboard.Application, string, error)
- func EnsureAPIKey(io *iostreams.IOStreams, client *dashboard.Client, accessToken string, ...) error
- func FindFreePlan(plans []dashboard.Plan) *dashboard.Plan
- func KnownPaidPlan(value string) *dashboard.Plan
- func PickPlan(candidates []dashboard.Plan) (*dashboard.Plan, error)
- func PlanAvailable(plans []dashboard.Plan, id string) bool
- func PlanChoices(plans []dashboard.Plan) []string
- func PlanTelemetryID(p dashboard.Plan) string
- func ProfileApplicationIDs(profiles []*config.Profile) map[string]bool
- func PromptName() (string, error)
- func PromptRegion(io *iostreams.IOStreams, client *dashboard.Client, accessToken string) (string, error)
- func ResolvePlan(plans []dashboard.Plan, value string) (*dashboard.Plan, error)
- func ReuseExistingAPIKey(cfg config.IConfig, app *dashboard.Application) bool
- func SelectablePlans(plans []dashboard.Plan, hideNonFree bool) []dashboard.Plan
- type ConfiguredStatus
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AppOptionLabel ¶ added in v1.12.0
func AppOptionLabel( cfg config.IConfig, profileApps map[string]bool, cs *iostreams.ColorScheme, app dashboard.Application, ) string
func ConfigureProfile ¶
func ConfigureProfile( io *iostreams.IOStreams, cfg config.IConfig, appDetails *dashboard.Application, profileName string, setDefault bool, ) error
ConfigureProfile persists the application credentials in the new model (state.toml + OS keychain) and optionally makes it the current application.
func CreateAndFetchApplication ¶
func CreateAndFetchApplication( io *iostreams.IOStreams, client *dashboard.Client, accessToken, region, appName string, tracker *telemetry.FlowTracker, ) (*dashboard.Application, string, error)
CreateAndFetchApplication creates an application (with region retry) and generates an API key for it. It returns the region the application was actually created in, which may differ from the requested one.
func CreateApplicationWithRetry ¶
func CreateApplicationWithRetry( io *iostreams.IOStreams, client *dashboard.Client, accessToken string, region string, appName string, tracker *telemetry.FlowTracker, ) (*dashboard.Application, string, error)
CreateApplicationWithRetry creates an application, retrying with a different region if the selected one has no available cluster.
The optional tracker (nil-safe) records which step the flow is in, so the telemetry of the calling flow can tell where the user stopped.
func EnsureAPIKey ¶
func EnsureAPIKey( io *iostreams.IOStreams, client *dashboard.Client, accessToken string, app *dashboard.Application, ) error
EnsureAPIKey generates a write API key for the application. Callers should skip this if the local profile already has a key.
func FindFreePlan ¶ added in v1.11.0
FindFreePlan returns the free-tier plan, or nil if none is present.
func KnownPaidPlan ¶ added in v1.11.0
KnownPaidPlan recognizes a documented paid --plan value even when the self-serve endpoint omits it (paid plans appear only once billing is on file).
func PlanAvailable ¶ added in v1.11.0
PlanAvailable reports whether a plan with the given id is in the list.
func PlanChoices ¶ added in v1.11.0
PlanChoices returns the user-facing plan identifiers (the free plan is shown as "free" regardless of its underlying id).
func PlanTelemetryID ¶ added in v1.11.0
PlanTelemetryID returns the plan identifier used in telemetry properties: the user-facing "free" for the free tier (whose underlying template id is not fixed and can be "build"), the plan id otherwise.
func ProfileApplicationIDs ¶ added in v1.12.0
ProfileApplicationIDs returns the set of application IDs backed by a legacy config.toml profile. Built once by the caller so a per-application loop tests membership in O(1) instead of re-parsing config.toml on every iteration.
func PromptName ¶ added in v1.13.0
PromptName prompts the user for the application name.
func PromptRegion ¶
func PromptRegion( io *iostreams.IOStreams, client *dashboard.Client, accessToken string, ) (string, error)
PromptRegion fetches regions from the API and prompts the user to select one.
func ResolvePlan ¶ added in v1.11.0
ResolvePlan maps a --plan value to one of the available plans. An exact match on the plan id wins; the user-facing "free" choice maps to the free-type template, whose id is not fixed (it can be "build"), so it is matched on type.
func ReuseExistingAPIKey ¶ added in v1.12.0
func ReuseExistingAPIKey(cfg config.IConfig, app *dashboard.Application) bool
ReuseExistingAPIKey looks for an API key already stored for the application (keychain first, then legacy config.toml profiles). If found, it sets app.APIKey and returns true so callers skip creating a new key. A key reused from a legacy profile has no known UUID, so api_key_uuid is left as-is.
func SelectablePlans ¶ added in v1.11.0
SelectablePlans returns the plans a user may choose from. When hideNonFree is true (no payment method on file) only the free plan(s) are offered, because paid plans require billing details the CLI can't collect.
Types ¶
type ConfiguredStatus ¶ added in v1.12.0
type ConfiguredStatus int
const ( StatusUnknown ConfiguredStatus = iota StatusOutOfSync StatusConfigured )