statebucket

package
v1.0.20 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2022 License: BSD-3-Clause Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DynamicEnvironment

type DynamicEnvironment struct {
	Name                 string               `json:"name"`
	Template             string               `json:"template"`
	Overrides            map[string]*Override `json:"overrides"`
	TerraHelmfileRef     string               `json:"terraHelmfileRef"`
	UniqueResourcePrefix string               `json:"uniqueResourcePrefix"`
}

DynamicEnvironment is a struct representing a dynamic environment in the state file

func (DynamicEnvironment) MarshalJSON added in v0.0.35

func (e DynamicEnvironment) MarshalJSON() ([]byte, error)

Note: DynamicEnvironment has custom JSON marshallers/unmarshallers to replace null overrides maps with empty

func (*DynamicEnvironment) UnmarshalJSON added in v0.0.35

func (e *DynamicEnvironment) UnmarshalJSON(data []byte) error

type Override added in v0.0.35

type Override struct {
	Enabled  *bool                 `json:"enabled,omitempty" yaml:",omitempty"`
	Versions terra.VersionOverride `json:"versions,omitempty" yaml:",omitempty"`
}

Override represents configuration overrides for a release in an environment

func (*Override) Disable added in v0.0.35

func (o *Override) Disable()

func (*Override) Enable added in v0.0.35

func (o *Override) Enable()

func (*Override) HasEnableOverride added in v0.0.35

func (o *Override) HasEnableOverride() bool

func (*Override) IsEnabled added in v0.0.35

func (o *Override) IsEnabled() bool

func (*Override) PinVersions added in v0.0.35

func (o *Override) PinVersions(versions terra.VersionOverride)

PinVersions applies the given VersionOverride to this override, ignoring empty fields in the parameter

func (*Override) UnpinVersions added in v0.0.35

func (o *Override) UnpinVersions()

UnpinVersions removes all version overrides

type StateBucket

type StateBucket interface {
	// Environments returns the list of all environments in the state file
	Environments() ([]DynamicEnvironment, error)
	// Add adds a new environment to the state file
	Add(environment DynamicEnvironment) (DynamicEnvironment, error)
	// AddGenerateName adds a new environment to the state file, generating a unique name from an optional prefix
	AddGenerateName(namePrefix string, environment DynamicEnvironment) (DynamicEnvironment, error)
	// EnableRelease enables the given release in the target environment
	EnableRelease(environmentName string, releaseName string) error
	// DisableRelease disables the given release in the target environment
	DisableRelease(environmentName string, releaseName string) error
	// PinVersions can be used to update the environment's map of version overrides
	PinVersions(environmentName string, versions map[string]terra.VersionOverride) (map[string]terra.VersionOverride, error)
	// UnpinVersions can be used to remove the environment's map of version overrides
	UnpinVersions(environmentName string) (map[string]terra.VersionOverride, error)
	// PinEnvironmentToTerraHelmfileRef pins an entire environment to a specific terra-helmfile ref
	PinEnvironmentToTerraHelmfileRef(environmentName string, terraHelmfileRef string) error
	// Delete will delete an environment from the state file
	Delete(environmentName string) error
	// contains filtered or unexported methods
}

StateBucket is for tracking state for dynamic environments. (Stored in a GCS bucket)

func New

func New(thelmaConfig config.Config, bucketFactory api.BucketFactory) (StateBucket, error)

New returns a new statebucket

func NewFake

func NewFake(dir string) (StateBucket, error)

NewFake (FOR USE IN TESTS ONLY) returns a new fake statebucket, backed by local filesystem instead of a GCS bucket

type StateFile

type StateFile struct {
	SchemaVersion int32                         `json:"schemaVersion"`
	Environments  map[string]DynamicEnvironment `json:"environments"`
}

StateFile represents the structure of the statefile

Jump to

Keyboard shortcuts

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