dc

package
v1.24.3 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2026 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Package dc contains types and functions to facilitate parsing user-supplied configuration like tags and parameters, which are used for the deploy and forecast commands

Index

Constants

View Source
const (
	// EnvVarPrefix is the prefix used for environment variables that define template variables.
	// Variables with this prefix are automatically loaded and made available during template processing.
	EnvVarPrefix = "RAIN_VAR_"

	// DefaultTagPrefix is the prefix used for environment variables that define default tags.
	// Variables with this prefix are automatically loaded and made available during template processing.
	DefaultTagPrefix = "RAIN_DEFAULT_TAG_"
)
View Source
const MaxStackNameLength = 128

Variables

View Source
var FixStackNameRe *regexp.Regexp

Functions

func ConfigFromStack added in v1.8.0

func ConfigFromStack(stack types.Stack) (string, error)

ConfigFromStack returns a yaml string containing the tags and parameters of the given stack

func GetDefaultTagsFromEnv added in v1.24.3

func GetDefaultTagsFromEnv() map[string]string

GetDefaultTagsFromEnv scans the environment for RAIN_DEFAULT_TAG_ prefixed environment variables and returns them as a tag map. The prefix is removed from the keys.

Example:

export RAIN_DEFAULT_TAG_ManagedBy="Rain"
export RAIN_DEFAULT_TAG_CostCenter="engineering"

Returns:

map[string]string{"ManagedBy": "Rain", "CostCenter": "engineering"}

func GetDeployConfig

func GetDeployConfig(
	tags []string,
	params []string,
	configFilePath string,
	base string,
	template *cft.Template,
	stack types.Stack,
	stackExists bool,
	yes bool,
	ignoreUnknownParams bool) (*deployconfig.DeployConfig, error)

GetDeployConfig populates an instance of DeployConfig based on user-supplied values

func GetParameters

func GetParameters(
	template *cft.Template,
	combinedParameters map[string]string,
	old []types.Parameter,
	stackExists bool,
	yes bool,
	ignoreUnknownParams bool) []types.Parameter

GetParameters checks the combined params supplied as args and in a file and asks the user to supply any values that are missing

func GetParametersFromEnv added in v1.24.3

func GetParametersFromEnv() map[string]string

GetParametersFromEnv scans the environment for RAIN_VAR_ prefixed environment variables and returns them as a parameter map. The prefix is removed from the keys.

Example:

export RAIN_VAR_InstanceType="t3.medium"
export RAIN_VAR_Environment="production"

Returns:

map[string]string{"InstanceType": "t3.medium", "Environment": "production"}

func GetStackName

func GetStackName(stackName string, base string) string

GetStackName returns stackName if it is not blank, otherwise it creates a name based on the template file name

func ListToMap

func ListToMap(name string, in []string) map[string]string

ListToMap converts a pflag parsed StringSlice into a map where values are expected to be presented in the form Foo=bar,Baz=quux,mooz,Xyzzy=garply

func MakeTags

func MakeTags(tags map[string]string) []types.Tag

converts map of strings to a slice of types.Tag

Types

This section is empty.

Jump to

Keyboard shortcuts

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