controls

package
v0.77.21 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2025 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package controls contains strict controls.

Index

Constants

View Source
const (
	// DeprecatedCommands is the control that prevents the use of deprecated commands.
	DeprecatedCommands = "deprecated-commands"

	// DeprecatedFlags is the control that prevents the use of deprecated flag names.
	DeprecatedFlags = "deprecated-flags"

	// DeprecatedEnvVars is the control that prevents the use of deprecated env vars.
	DeprecatedEnvVars = "deprecated-env-vars"

	// DeprecatedConfigs is the control that prevents the use of deprecated config fields/section/..., anything related to config syntax.
	DeprecatedConfigs = "deprecated-configs"

	// LegacyAll is a control group for the legacy *-all commands.
	LegacyAll = "legacy-all"

	// LegacyLogs is a control group for legacy log flags that were in use before the log was redesign.
	LegacyLogs = "legacy-logs"

	// TerragruntPrefixFlags is a control group for flags that used to have the `terragrunt-` prefix.
	TerragruntPrefixFlags = "terragrunt-prefix-flags"

	// TerragruntPrefixEnvVars is a control group for env vars that used to have the `TERRAGRUNT_` prefix.
	TerragruntPrefixEnvVars = "terragrunt-prefix-env-vars"

	// DefaultCommands is a control group for TF commands that were used as default commands,
	// namely without using the parent `run` commands and were not shortcuts commands.
	DefaultCommands = "default-commands"

	// RootTerragruntHCL is the control that prevents usage of a `terragrunt.hcl` file as the root of Terragrunt configurations.
	RootTerragruntHCL = "root-terragrunt-hcl"

	// SkipDependenciesInputs is the control that prevents reading dependencies inputs and get performance boost.
	SkipDependenciesInputs = "skip-dependencies-inputs"

	// RequireExplicitBootstrap is the control that prevents the backend for remote state from being bootstrapped unless the `--backend-bootstrap` flag is specified.
	RequireExplicitBootstrap = "require-explicit-bootstrap"
)
View Source
const (
	DefaultCommandsCategoryName = "Default commands"
	RunAllCommandsCategoryName  = "`*-all` commands"
)
View Source
const (
	GlobalEnvVarsCategoryName     = "Global env vars"
	CommandEnvVarsCategoryNameFmt = "`%s` command env vars"
)
View Source
const (
	MovedGlobalFlagsCategoryNameFmt = "Global flags moved to `%s` command"
	GlobalFlagsCategoryName         = "Global flags"
	CommandFlagsCategoryNameFmt     = "`%s` command flags"
)

Variables

This section is empty.

Functions

func New

func New() strict.Controls

Types

type Control

type Control struct {
	// Error is the Error that will be returned when the Control is Enabled.
	Error error

	// Category is the category of the control.
	Category *strict.Category

	// Name is the name of the control.
	Name string

	// Description is the description of the control.
	Description string

	// Warning is a Warning that will be logged when the Control is not Enabled.
	Warning string

	// Subcontrols are child controls.
	Subcontrols strict.Controls

	// OnceWarn is used to prevent the warning message from being displayed multiple times.
	OnceWarn sync.Once

	// Status of the strict Control.
	Status strict.Status

	// Enabled indicates whether the control is enabled.
	Enabled bool

	// Suppress suppresses the warning message from being displayed.
	Suppress bool
}

Control is the simplest implementation of the `strict.Control` interface.

func NewDeprecatedCommand

func NewDeprecatedCommand(command, newCommand string) *Control

NewDeprecatedCommand declares the deprecated command.

func (*Control) AddSubcontrols

func (ctrl *Control) AddSubcontrols(newCtrls ...strict.Control)

AddSubcontrols implements `strict.Control` interface.

func (*Control) Enable

func (ctrl *Control) Enable()

Enable implements `strict.Control` interface.

func (*Control) Evaluate

func (ctrl *Control) Evaluate(ctx context.Context) error

Evaluate implements `strict.Control` interface.

func (*Control) GetCategory

func (ctrl *Control) GetCategory() *strict.Category

GetCategory implements `strict.Control` interface.

func (*Control) GetDescription

func (ctrl *Control) GetDescription() string

GetDescription implements `strict.Control` interface.

func (*Control) GetEnabled

func (ctrl *Control) GetEnabled() bool

GetEnabled implements `strict.Control` interface.

func (*Control) GetName

func (ctrl *Control) GetName() string

GetName implements `strict.Control` interface.

func (*Control) GetStatus

func (ctrl *Control) GetStatus() strict.Status

GetStatus implements `strict.Control` interface.

func (*Control) GetSubcontrols

func (ctrl *Control) GetSubcontrols() strict.Controls

GetSubcontrols implements `strict.Control` interface.

func (*Control) SetCategory

func (ctrl *Control) SetCategory(category *strict.Category)

SetCategory implements `strict.Control` interface.

func (*Control) String

func (ctrl *Control) String() string

String implements `fmt.Stringer` interface.

func (*Control) SuppressWarning added in v0.73.2

func (ctrl *Control) SuppressWarning()

SuppressWarning suppresses the warning message from being displayed.

type DeprecatedEnvVar

type DeprecatedEnvVar struct {
	*Control
	ErrorFmt   string
	WarningFmt string
	// contains filtered or unexported fields
}

DeprecatedEnvVar is strict control for deprecated environment variables.

func NewDeprecatedEnvVar

func NewDeprecatedEnvVar(deprecatedFlag, newFlag cli.Flag, newValue string) *DeprecatedEnvVar

NewDeprecatedEnvVar returns a new `DeprecatedEnvVar` instance. Since we don't know which env vars can be used at the time of definition, we take the first env var from the list `GetEnvVars()` for the name and description to display it in `info strict`.

func (*DeprecatedEnvVar) Evaluate

func (ctrl *DeprecatedEnvVar) Evaluate(ctx context.Context) error

Evaluate implements `strict.Control` interface.

type DeprecatedFlagName

type DeprecatedFlagName struct {
	*Control
	ErrorFmt   string
	WarningFmt string
	// contains filtered or unexported fields
}

DeprecatedFlagName is strict control for deprecated flag names.

func NewDeprecatedFlagName

func NewDeprecatedFlagName(deprecatedFlag, newFlag cli.Flag, newValue string) *DeprecatedFlagName

NewDeprecatedFlagName returns a new `DeprecatedFlagName` instance. Since we don't know which names can be used at the time of definition, we take the first name from the list `Names()` for the name and description to display it in `info strict`.

func NewDeprecatedMovedFlagName

func NewDeprecatedMovedFlagName(deprecatedFlag, newFlag cli.Flag, commandName string) *DeprecatedFlagName

func (*DeprecatedFlagName) Evaluate

func (ctrl *DeprecatedFlagName) Evaluate(ctx context.Context) error

Evaluate implements `strict.Control` interface.

Jump to

Keyboard shortcuts

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