manifest

package
v0.26.2 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2021 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const FilePermissions = 0666

FilePermissions represents a read/write file mode.

View Source
const Filename = "fastly.toml"

Filename is the name of the package manifest file. It is expected to be a project specific configuration file.

View Source
const ManifestLatestVersion = 1

ManifestLatestVersion represents the latest known manifest schema version supported by the CLI.

Variables

This section is empty.

Functions

This section is empty.

Types

type Data

type Data struct {
	File File
	Flag Flag
}

Data holds global-ish manifest data from manifest files, and flag sources. It has methods to give each parameter to the components that need it, including the place the parameter came from, which is a requirement.

If the same parameter is defined in multiple places, it is resolved according to the following priority order: the manifest file (lowest priority) and then explicit flags (highest priority).

func (*Data) Authors added in v0.16.0

func (d *Data) Authors() ([]string, Source)

Authors yields an Authors.

func (*Data) Description added in v0.16.0

func (d *Data) Description() (string, Source)

Description yields a Description.

func (*Data) Name

func (d *Data) Name() (string, Source)

Name yields a Name.

func (*Data) ServiceID

func (d *Data) ServiceID() (string, Source)

ServiceID yields a ServiceID.

type File

type File struct {
	ManifestVersion Version  `toml:"manifest_version"`
	Name            string   `toml:"name"`
	Description     string   `toml:"description"`
	Authors         []string `toml:"authors"`
	Language        string   `toml:"language"`
	ServiceID       string   `toml:"service_id"`
	// contains filtered or unexported fields
}

File represents all of the configuration parameters in the fastly.toml manifest file schema.

func (*File) Exists added in v0.16.0

func (f *File) Exists() bool

Exists yields whether the manifest exists.

func (*File) Read

func (f *File) Read(fpath string) error

Read loads the manifest file content from disk.

func (*File) SetOutput added in v0.25.1

func (f *File) SetOutput(output io.Writer)

SetOutput sets the output stream for any messages.

func (*File) Write

func (f *File) Write(filename string) error

Write persists the manifest content to disk.

type Flag

type Flag struct {
	Name        string
	Description string
	Authors     []string
	ServiceID   string
}

Flag represents all of the manifest parameters that can be set with explicit flags. Consumers should bind their flag values to these fields directly.

type Source

type Source uint8

Source enumerates where a manifest parameter is taken from.

const (
	// SourceUndefined indicates the parameter isn't provided in any of the
	// available sources, similar to "not found".
	SourceUndefined Source = iota

	// SourceFile indicates the parameter came from a manifest file.
	SourceFile

	// SourceFlag indicates the parameter came from an explicit flag.
	SourceFlag
)

type Version added in v0.25.0

type Version int

Version represents the currently supported schema for the fastly.toml manifest file that determines the configuration for a compute@edge service.

NOTE: the File object has a field called ManifestVersion which this type is assigned. The reason we don't name this type ManifestVersion is to appease the static analysis linter which complains re: stutter in the import manifest.ManifestVersion.

func (*Version) UnmarshalText added in v0.25.0

func (v *Version) UnmarshalText(text []byte) error

UnmarshalText manages multiple scenarios where historically the manifest version was a string value and not an integer.

Example mappings:

"0.1.0" -> 1 "1" -> 1 1 -> 1 "1.0.0" -> 1 0.1 -> 1 "0.2.0" -> 1 "2.0.0" -> 2

We also constrain the version so that if a user has a manifest_version defined as "99.0.0" then we won't accidentally store it as the integer 99 but instead will return an error because it exceeds the current ManifestLatestVersion version of 1.

Jump to

Keyboard shortcuts

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