ux

package
v1.23.13 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DurationAsText

func DurationAsText(d time.Duration) string

DurationAsText provides a slightly nicer string representation of a duration when compared to default formatting in go, by spelling out the words hour, minute and second and providing some spacing and eliding the fractional component of the seconds part.

func ListAsText

func ListAsText(items []string) string

generates text from a list of strings, for example: ["foo"] => "foo" ["foo", "bar"] => "foo and bar" ["foo", "bar", "axe"] => "foo, bar and axe" ["foo", "bar", ..., ..., "axe"] => "foo, bar, ..., ... and axe"

Types

type ActionResult

type ActionResult struct {
	SuccessMessage string
	FollowUp       string
	Err            error
}

func (*ActionResult) MarshalJSON

func (ar *ActionResult) MarshalJSON() ([]byte, error)

func (*ActionResult) ToString

func (ar *ActionResult) ToString(currentIndentation string) (result string)

type AuthStatusView

type AuthStatusView struct {
	Result *contracts.StatusResult
	// AuthMode indicates the current authentication mode.
	// When set to a non-built-in mode, the unauthenticated message adjusts guidance accordingly.
	AuthMode string
}

AuthStatusView renders a contracts.StatusResult for console output.

func (*AuthStatusView) MarshalJSON

func (v *AuthStatusView) MarshalJSON() ([]byte, error)

func (*AuthStatusView) ToString

func (v *AuthStatusView) ToString(currentIndentation string) string

type CreatedRepoValue

type CreatedRepoValue struct {
	Name   string
	Kind   GitHubValueKind
	Action string
}

func (*CreatedRepoValue) MarshalJSON

func (cr *CreatedRepoValue) MarshalJSON() ([]byte, error)

func (*CreatedRepoValue) ToString

func (cr *CreatedRepoValue) ToString(currentIndentation string) string

type DisplayedResource

type DisplayedResource struct {
	Type     string
	Name     string
	State    DisplayedResourceState
	Duration time.Duration
}

func (*DisplayedResource) MarshalJSON

func (cr *DisplayedResource) MarshalJSON() ([]byte, error)

func (*DisplayedResource) ToString

func (cr *DisplayedResource) ToString(currentIndentation string) string

type DisplayedResourceState

type DisplayedResourceState string
const (
	SucceededState DisplayedResourceState = "Succeeded"
	FailedState    DisplayedResourceState = "Failed"
)

type DoneMessage

type DoneMessage struct {
	Message string
}

func (*DoneMessage) MarshalJSON

func (d *DoneMessage) MarshalJSON() ([]byte, error)

func (*DoneMessage) ToString

func (d *DoneMessage) ToString(currentIndentation string) string

type EnvironmentDetails

type EnvironmentDetails struct {
	Subscription string
	Location     string
}

func (*EnvironmentDetails) MarshalJSON

func (t *EnvironmentDetails) MarshalJSON() ([]byte, error)

func (*EnvironmentDetails) ToString

func (t *EnvironmentDetails) ToString(currentIndentation string) string

type ErrorWithSuggestion

type ErrorWithSuggestion struct {
	// Err is the original underlying error
	Err error

	// Message is a user-friendly explanation of what went wrong
	Message string

	// Suggestion is actionable next steps to resolve the issue
	Suggestion string

	// Links is an optional list of reference links
	Links []errorhandler.ErrorLink
}

ErrorWithSuggestion displays an error with user-friendly messaging. Layout:

  1. User-friendly message (red ERROR: line)
  2. Suggestion (actionable next steps)
  3. Reference links (optional, as a list)
  4. Original error (grey, de-emphasized technical details)

func (*ErrorWithSuggestion) MarshalJSON

func (e *ErrorWithSuggestion) MarshalJSON() ([]byte, error)

func (*ErrorWithSuggestion) ToString

func (e *ErrorWithSuggestion) ToString(currentIndentation string) string

type GitHubValueKind

type GitHubValueKind string
const (
	GitHubSecret   GitHubValueKind = "secret"
	GitHubVariable GitHubValueKind = "variable"
)

type LoggedIn

type LoggedIn struct {
	LoggedInAs string
	LoginType  LoginType
}

func (*LoggedIn) MarshalJSON

func (cr *LoggedIn) MarshalJSON() ([]byte, error)

func (*LoggedIn) ToString

func (cr *LoggedIn) ToString(currentIndentation string) string

type LoginType

type LoginType string
const (
	EmailLoginType    LoginType = "email"
	ClientIdLoginType LoginType = "clientId"
)

type MessageTitle

type MessageTitle struct {
	Title     string
	TitleNote string
}

func (*MessageTitle) MarshalJSON

func (t *MessageTitle) MarshalJSON() ([]byte, error)

func (*MessageTitle) ToString

func (t *MessageTitle) ToString(currentIndentation string) string

type MultilineMessage

type MultilineMessage struct {
	Lines []string
}

func (*MultilineMessage) MarshalJSON

func (mm *MultilineMessage) MarshalJSON() ([]byte, error)

func (*MultilineMessage) ToString

func (mm *MultilineMessage) ToString(currentIndentation string) string

type OperationType

type OperationType string

OperationType defines the valid options for a resource change.

const (
	OperationTypeCreate      OperationType = "Create"
	OperationTypeDelete      OperationType = "Delete"
	OperationTypeDeploy      OperationType = "Deploy"
	OperationTypeIgnore      OperationType = "Ignore"
	OperationTypeModify      OperationType = "Modify"
	OperationTypeNoChange    OperationType = "NoChange"
	OperationTypeUnsupported OperationType = "Unsupported"
)

func (OperationType) String

func (op OperationType) String() (displayName string)

type PreflightReport

type PreflightReport struct {
	Items []PreflightReportItem
}

PreflightReport displays the results of local preflight validation. Warnings are shown first, followed by errors. Each entry is separated by a blank line.

func (*PreflightReport) HasErrors

func (r *PreflightReport) HasErrors() bool

HasErrors returns true if the report contains at least one error-level item.

func (*PreflightReport) HasWarnings

func (r *PreflightReport) HasWarnings() bool

HasWarnings returns true if the report contains at least one warning-level item.

func (*PreflightReport) MarshalJSON

func (r *PreflightReport) MarshalJSON() ([]byte, error)

func (*PreflightReport) ToString

func (r *PreflightReport) ToString(currentIndentation string) string

type PreflightReportItem

type PreflightReportItem struct {
	// IsError is true for blocking errors, false for warnings.
	IsError bool
	// Message describes the finding.
	Message string
}

PreflightReportItem represents a single finding from preflight validation.

type PreviewProvision

type PreviewProvision struct {
	Operations []*Resource
}

PreviewProvision defines a ux item for displaying a provision preview.

func (*PreviewProvision) MarshalJSON

func (pp *PreviewProvision) MarshalJSON() ([]byte, error)

func (*PreviewProvision) ToString

func (pp *PreviewProvision) ToString(currentIndentation string) string

type PropertyDelta

type PropertyDelta struct {
	Path       string
	ChangeType string
	Before     any
	After      any
}

PropertyDelta represents a property-level change in a resource

type Resource

type Resource struct {
	Operation      OperationType
	Name           string
	Type           string
	PropertyDeltas []PropertyDelta
}

Resource provides a basic structure for an Azure resource.

type Show

type Show struct {
	AppName         string
	Services        []*ShowService
	Environments    []*ShowEnvironment
	AzurePortalLink string
}

func (*Show) MarshalJSON

func (s *Show) MarshalJSON() ([]byte, error)

func (*Show) ToString

func (s *Show) ToString(currentIndentation string) string

type ShowEnvironment

type ShowEnvironment struct {
	Name      string
	IsCurrent bool
	IsRemote  bool
}

type ShowResource

type ShowResource struct {
	Name        string
	TypeDisplay string
	Variables   map[string]string
}

func (*ShowResource) MarshalJSON

func (s *ShowResource) MarshalJSON() ([]byte, error)

func (*ShowResource) ToString

func (s *ShowResource) ToString(currentIndentation string) string

type ShowService

type ShowService struct {
	Name        string
	IngresUrl   string
	Env         map[string]string
	DisplayType string
}

func (*ShowService) MarshalJSON

func (s *ShowService) MarshalJSON() ([]byte, error)

func (*ShowService) ToString

func (s *ShowService) ToString(currentIndentation string) string

type SkippedMessage

type SkippedMessage struct {
	Message string
}

func (*SkippedMessage) MarshalJSON

func (d *SkippedMessage) MarshalJSON() ([]byte, error)

func (*SkippedMessage) ToString

func (d *SkippedMessage) ToString(currentIndentation string) string

type UxItem

type UxItem interface {
	// Defines how the object is transformed into a printable string.
	// The current indentation can be used to make the string to be aligned to the previous lines.
	ToString(currentIndentation string) string
	json.Marshaler
}

type WarningAltMessage

type WarningAltMessage struct {
	Message string
}

Warning message with the prefix "(!) Warning: "

func (*WarningAltMessage) MarshalJSON

func (d *WarningAltMessage) MarshalJSON() ([]byte, error)

func (*WarningAltMessage) ToString

func (d *WarningAltMessage) ToString(currentIndentation string) string

type WarningMessage

type WarningMessage struct {
	Description string
	HidePrefix  bool
	// Hints are optional additional lines displayed as bullets below the warning
	Hints []string
}

Warning message with hidable prefix "WARNING: "

func (*WarningMessage) MarshalJSON

func (t *WarningMessage) MarshalJSON() ([]byte, error)

func (*WarningMessage) ToString

func (t *WarningMessage) ToString(currentIndentation string) string

Jump to

Keyboard shortcuts

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