apputil

package
v1.11.0 Latest Latest
Warning

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

Go to latest
Published: Jun 26, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConfigureProfile

func ConfigureProfile(
	io *iostreams.IOStreams,
	cfg config.IConfig,
	appDetails *dashboard.Application,
	profileName string,
	setDefault bool,
) error

ConfigureProfile creates a CLI profile from application details and optionally sets it as the default.

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

func FindFreePlan(plans []dashboard.Plan) *dashboard.Plan

FindFreePlan returns the free-tier plan, or nil if none is present.

func KnownPaidPlan added in v1.11.0

func KnownPaidPlan(value string) *dashboard.Plan

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 PickPlan added in v1.11.0

func PickPlan(candidates []dashboard.Plan) (*dashboard.Plan, error)

PickPlan shows an interactive selector over the candidate plans.

func PlanAvailable added in v1.11.0

func PlanAvailable(plans []dashboard.Plan, id string) bool

PlanAvailable reports whether a plan with the given id is in the list.

func PlanChoices added in v1.11.0

func PlanChoices(plans []dashboard.Plan) []string

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

func PlanTelemetryID(p dashboard.Plan) string

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 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

func ResolvePlan(plans []dashboard.Plan, value string) (*dashboard.Plan, error)

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 SelectablePlans added in v1.11.0

func SelectablePlans(plans []dashboard.Plan, hideNonFree bool) []dashboard.Plan

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

This section is empty.

Jump to

Keyboard shortcuts

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