degradation

package
v1.223.0 Latest Latest
Warning

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

Go to latest
Published: Jul 15, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package degradation supports graceful degradation for describe/list commands: when a recoverable YAML-function error occurs (e.g. a Terraform backend that has not been provisioned yet), the caller may substitute AtmosComputedValue for the unresolved value and continue instead of aborting. Warning tracks one such substitution, and Collector accumulates them across a single command run for an end-of-command summary.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AtmosComputedValue

type AtmosComputedValue struct{}

AtmosComputedValue is substituted for a value that could not be resolved — most often because the underlying Terraform backend/state isn't accessible yet (not provisioned, not applied, not authenticated, or not the caller's most recent state). It is only substituted when a caller opts into lenient processing (list/describe --error-mode=warn|silent).

AtmosComputedValue renders as the literal "(computed)" in every output format without any renderer needing to special-case it: text/template and fmt.Fprint call String() automatically for any fmt.Stringer, and encoding/json and gopkg.in/yaml.v3 call MarshalJSON/MarshalYAML automatically for any value implementing those interfaces.

func (AtmosComputedValue) MarshalJSON

func (AtmosComputedValue) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler.

func (AtmosComputedValue) MarshalYAML

func (AtmosComputedValue) MarshalYAML() (interface{}, error)

MarshalYAML implements yaml.Marshaler (gopkg.in/yaml.v3).

func (AtmosComputedValue) String

func (AtmosComputedValue) String() string

String implements fmt.Stringer.

type Collector

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

Collector accumulates Warnings during a single command run and can produce a one-line UI-facing summary. Not safe for concurrent use — matches the single-threaded describe-stacks processing pass.

func (*Collector) Add

func (c *Collector) Add(w Warning)

Add records one degraded value. The full detail is always logged at debug level (visible with --logs-level=Debug); whether a user-facing summary is ever shown is up to the caller — see Summary.

func (*Collector) Count

func (c *Collector) Count() int

Count returns the number of warnings collected so far.

func (*Collector) Summary

func (c *Collector) Summary()

Summary prints one ui.Warningf line naming how many values could not be determined, if any were collected. No-op when nothing was collected (or c is nil).

type Warning

type Warning struct {
	Stack     string
	Component string
	Function  string
	Reason    string
}

Warning describes one value that could not be resolved and was substituted with AtmosComputedValue.

Jump to

Keyboard shortcuts

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