strict

package
v0.73.0-alpha2025020401 Latest Latest
Warning

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

Go to latest
Published: Feb 4, 2025 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package strict provides utilities used by Terragrunt to support a "strict" mode. By default strict mode is disabled, but when Enabled, any breaking changes to Terragrunt behavior that is not backwards compatible will result in an error.

Note that any behavior outlined here should be documented in /docs/_docs/04_reference/strict-mode.md

That is how users will know what to expect when they enable strict mode, and how to customize it.

Index

Constants

View Source
const CompletedControlsFmt = "" /* 368-byte string literal not displayed */

Variables

This section is empty.

Functions

This section is empty.

Types

type Categories added in v0.73.0

type Categories []*Category

Categories is multiple of DeprecatedFlag Category.

func (Categories) FilterByNames added in v0.73.0

func (categories Categories) FilterByNames(names ...string) Categories

FilterByNames filters `categories` by the given `names`.

func (Categories) Find added in v0.73.0

func (categories Categories) Find(name string) *Category

Find search category by given `name`, returns nil if not found.

func (Categories) Len added in v0.73.0

func (categories Categories) Len() int

Len implements `sort.Interface` interface.

func (Categories) Less added in v0.73.0

func (categories Categories) Less(i, j int) bool

Less implements `sort.Interface` interface.

func (Categories) Sort added in v0.73.0

func (categories Categories) Sort() Categories

Sort returns `categories` in sorted order by `Name`.

func (Categories) Swap added in v0.73.0

func (categories Categories) Swap(i, j int)

Swap implements `sort.Interface` interface.

type Category added in v0.73.0

type Category struct {
	// Name is the name of the category.
	Name string
	// ShowStatus specifies whether to show or hide `Status`.
	ShowStatus bool
	// AllowedStatuses allows controls to be displayed only with the specified statuses.
	AllowedStatuses Statuses
}

Category strict control category. Used to group controls when they are displayed.

func (*Category) String added in v0.73.0

func (category *Category) String() string

String implements `fmt.Stringer` interface.

type Control

type Control interface {
	// GetName returns the name of the strict control.
	GetName() string

	// GetDescription returns the description of the strict control.
	GetDescription() string

	// GetStatus returns the status of the strict control.
	GetStatus() Status

	// Enable enables the control.
	Enable()

	// GetEnabled returns true if the control is enabled.
	GetEnabled() bool

	// GetCategory returns category of the strict control.
	GetCategory() *Category

	// SetCategory sets the category.
	SetCategory(category *Category)

	// GetSubcontrols returns all subcontrols.
	GetSubcontrols() Controls

	// AddSubcontrols adds the given `newCtrls` as subcontrols.
	AddSubcontrols(newCtrls ...Control)

	// Evaluate evaluates the struct control.
	Evaluate(ctx context.Context) error
}

Control represents an interface that can be enabled or disabled in strict mode. When the Control is Enabled, Terragrunt will behave in a way that is not backwards compatible.

type ControlNames added in v0.73.0

type ControlNames []string

func (ControlNames) String added in v0.73.0

func (names ControlNames) String() string

type Controls

type Controls []Control

Controls are multiple of Controls.

func (Controls) AddSubcontrols added in v0.73.0

func (ctrls Controls) AddSubcontrols(newCtrls ...Control)

AddSubcontrols adds the given `newCtrls` as subcontrols into all `ctrls`.

func (Controls) AddSubcontrolsToCategory added in v0.73.0

func (ctrls Controls) AddSubcontrolsToCategory(categoryName string, controls ...Control)

func (Controls) Enable added in v0.73.0

func (ctrls Controls) Enable()

Enable recursively enables all `ctrls`.

func (Controls) EnableControl added in v0.73.0

func (ctrls Controls) EnableControl(name string) error

EnableControl validates that the specified control name is valid and enables `ctrl`.

func (Controls) Evaluate added in v0.73.0

func (ctrls Controls) Evaluate(ctx context.Context) error

Evaluate returns an error if the one of the controls is enabled otherwise logs warning messages and returns nil.

func (Controls) FilterByCategories added in v0.73.0

func (ctrls Controls) FilterByCategories(categories ...*Category) Controls

FilterByCategories filters `ctrls` by the given `categories`.

func (Controls) FilterByEnabled added in v0.73.0

func (ctrls Controls) FilterByEnabled() Controls

FilterByEnabled filters `ctrls` by `Enabled: true` field.

func (Controls) FilterByNames added in v0.73.0

func (ctrls Controls) FilterByNames(names ...string) Controls

FilterByNames filters `ctrls` by the given `names`.

func (Controls) FilterByStatus added in v0.73.0

func (ctrls Controls) FilterByStatus(statuses ...Status) Controls

FilterByStatus filters `ctrls` by given statuses.

func (Controls) Find added in v0.73.0

func (ctrls Controls) Find(name string) Control

Find search control by given `name`, returns nil if not found.

func (Controls) GetCategories added in v0.73.0

func (ctrls Controls) GetCategories() Categories

GetCategories returns a unique list of the `ctrls` categories.

func (Controls) GetSubcontrols added in v0.73.0

func (ctrls Controls) GetSubcontrols() Controls

GetSubcontrols returns all subcontrols from all `ctrls`.

func (Controls) Len added in v0.73.0

func (ctrls Controls) Len() int

Len implements `sort.Interface` interface.

func (Controls) Less added in v0.73.0

func (ctrls Controls) Less(i, j int) bool

Less implements `sort.Interface` interface.

func (Controls) LogEnabled added in v0.73.0

func (ctrls Controls) LogEnabled(logger log.Logger)

LogEnabled logs the control names that are enabled and have completed Status.

func (Controls) Names added in v0.68.5

func (ctrls Controls) Names() ControlNames

Names returns names of all `ctrls`.

func (Controls) RemoveDuplicates added in v0.73.0

func (ctrls Controls) RemoveDuplicates() Controls

RemoveDuplicates removes controls with duplicate names.

func (Controls) SetCategory added in v0.73.0

func (ctrls Controls) SetCategory(category *Category)

SetCategory sets the given category for all `ctrls`.

func (Controls) Sort added in v0.73.0

func (ctrls Controls) Sort() Controls

Sort returns `ctrls` in sorted order by `Name` and `Status`.

func (Controls) Swap added in v0.73.0

func (ctrls Controls) Swap(i, j int)

Swap implements `sort.Interface` interface.

type InvalidControlNameError added in v0.73.0

type InvalidControlNameError struct {
	// contains filtered or unexported fields
}

InvalidControlNameError is an error that is returned when an invalid control name is requested.

func NewInvalidControlNameError added in v0.73.0

func NewInvalidControlNameError(allowedNames ControlNames) *InvalidControlNameError

func (InvalidControlNameError) Error added in v0.73.0

func (err InvalidControlNameError) Error() string

type Status added in v0.73.0

type Status byte

Status represetns the status of the Control.

const (
	// ActiveStatus is the Status of a control that is ongoing.
	ActiveStatus Status = iota
	// CompletedStatus is the Status of a Control that is completed.
	CompletedStatus
	// SuspendedStatus is the Status of a Control that is suspended.
	// It does nothing and is assigned to a control only to avoid returning the `InvalidControlNameError`.
	SuspendedStatus
)

func (Status) String added in v0.73.0

func (status Status) String() string

String implements `fmt.Stringer` interface.

type Statuses added in v0.73.0

type Statuses []Status

Statuses are a set of Statuses.

func (Statuses) Contains added in v0.73.0

func (statuses Statuses) Contains(status Status) bool

Contains returns true if the `statuses` slice contains the given `status`.

Directories

Path Synopsis
Package controls contains strict controls.
Package controls contains strict controls.
Package view contains the rendering logic for printing strict controls.
Package view contains the rendering logic for printing strict controls.
plaintext
Package plaintext implements the view.Render interface for displaying strict controls in plaintext format.
Package plaintext implements the view.Render interface for displaying strict controls in plaintext format.

Jump to

Keyboard shortcuts

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