manifest

package
v0.9.1 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ForMarshaling added in v0.6.0

type ForMarshaling Manifest

This absurdity is a workaround for a bug github.com/go-yaml/yaml/issues/817 in the YAML library. We want to inline a Manifest in a WithHeader when marshaling. But the bug prevents that, because anything that implements Unmarshaler cannot be inlined. As a workaround, we create a new type with the same fields but without the Unmarshal method.

type Input

type Input struct {
	Pos model.ConfigPos `yaml:"-"`

	// The name of the template input, e.g. "my_service_account"
	Name model.String `yaml:"name"`
	// The value of the template input, e.g. "foo@iam.gserviceaccount.com".
	Value model.String `yaml:"value"`
}

Input is a YAML object representing an input value that was provided to the template when it was rendered.

func (*Input) UnmarshalYAML

func (i *Input) UnmarshalYAML(n *yaml.Node) error

UnmarshalYAML implements yaml.Unmarshaler.

func (*Input) Validate

func (i *Input) Validate() error

Validate() implements model.Validator.

type Manifest

type Manifest struct {
	Pos model.ConfigPos `yaml:"-"`

	// The UTC time when the template was first rendered (it's not touched for
	// upgrades). Will be marshaled in RFC3339 format, like
	// "2006-01-02T15:04:05Z". This is only as accurate as the system clock
	// on the machine where the operation ran.
	CreationTime time.Time `yaml:"creation_time"`

	// The UTC time when the template was most recently upgraded, or if has
	// never been upgraded, the time of initial template rendering. Will be
	// marshaled in RFC3339 format, like "2006-01-02T15:04:05Z". This is only as
	// accurate as the system clock on the machine where the operation ran.
	ModificationTime time.Time `yaml:"modification_time"`

	// The canonical template location from which upgraded template versions can
	// be fetched in the future.
	TemplateLocation model.String `yaml:"template_location"`

	// How to interpret template_location, e.g. "remote_git" or "local_git".
	LocationType model.String `yaml:"location_type"`

	// The tag, branch, SHA, or other version information.
	TemplateVersion model.String `yaml:"template_version"`

	// The dirhash (https://pkg.go.dev/golang.org/x/mod/sumdb/dirhash) of the
	// template source tree (not the output). This shows exactly what version of
	// the template was installed.
	TemplateDirhash model.String `yaml:"template_dirhash"`

	// The input values that were supplied by the user when rendering the template.
	Inputs []*Input `yaml:"inputs"`

	// The hash of each output file created by the template.
	OutputFiles []*OutputFile `yaml:"output_files"`
}

Manifest represents the contents of a manifest file. A manifest file is the set of all information that is needed to cleanly upgrade to a new template version in the future.

func (*Manifest) UnmarshalYAML

func (m *Manifest) UnmarshalYAML(n *yaml.Node) error

UnmarshalYAML implements yaml.Unmarshaler.

func (*Manifest) Upgrade

func (m *Manifest) Upgrade(ctx context.Context) (model.ValidatorUpgrader, error)

Upgrade implements model.ValidatorUpgrader.

func (*Manifest) Validate

func (m *Manifest) Validate() error

Validate() implements model.Validator.

type OutputFile added in v0.8.0

type OutputFile struct {
	Pos model.ConfigPos `yaml:"-"`

	// The path, relative to the destination directory, of this file.
	File model.String `yaml:"file"`

	// The dirhash-style hash (see https://pkg.go.dev/golang.org/x/mod/sumdb/dirhash)
	// of this file. The format looks like "h1:0a1b2c3d...".
	Hash model.String `yaml:"hash"`

	// In the (somewhat rare) case where this file is a modified version of one
	// of the user's preexisting files using the "include from destination"
	// feature, then we save a patch here that is the inverse of our change.
	// This allows our change to be un-done in the future.
	Patch *model.String `yaml:"patch,omitempty"`
}

OutputFile records a checksum of a single file as it was created during template rendering.

func (*OutputFile) UnmarshalYAML added in v0.8.0

func (f *OutputFile) UnmarshalYAML(n *yaml.Node) error

UnmarshalYAML implements yaml.Unmarshaler.

func (*OutputFile) Validate added in v0.8.0

func (f *OutputFile) Validate() error

Validate() implements model.Validator.

type WithHeader added in v0.6.0

type WithHeader header.With[*ForMarshaling]

This absurdity is a workaround for a bug github.com/go-yaml/yaml/issues/817 in the YAML library. We want to inline a Manifest in a WithHeader when marshaling. But the bug prevents that, because anything that implements Unmarshaler cannot be inlined. As a workaround, we create a new type with the same fields but without the Unmarshal method.

Jump to

Keyboard shortcuts

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