Documentation
¶
Index ¶
Constants ¶
const ( // Filename is the name of the package manifest file. // It is expected to be a project specific configuration file. Filename = "fastly.toml" // ManifestLatestVersion represents the latest known manifest schema version // supported by the CLI. ManifestLatestVersion = 1 // FilePermissions represents a read/write file mode. FilePermissions = 0666 // 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 // SourceEnv indicates the parameter came from the user's shell environment. SourceEnv // SourceFlag indicates the parameter came from an explicit flag. SourceFlag // SpecIntro informs the user of what the manifest file is for. SpecIntro = "This file describes a Fastly Compute@Edge package. To learn more visit:" // SpecURL points to the fastly.toml manifest specification reference. SpecURL = "https://developer.fastly.com/reference/fastly-toml/" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Backend ¶
type Backend struct { URL string `toml:"url"` OverrideHost string `toml:"override_host,omitempty"` }
Backend represents a backend to be mocked by the local testing server.
type Data ¶
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) Description ¶
Description yields a Description.
type Dictionary ¶ added in v0.38.0
Dictionary represents a dictionary to be mocked by the local testing server.
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"` LocalServer LocalServer `toml:"local_server,omitempty"` Setup Setup `toml:"setup,omitempty"` // contains filtered or unexported fields }
File represents all of the configuration parameters in the fastly.toml manifest file schema.
type Flag ¶
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 LocalServer ¶
type LocalServer struct { Backends map[string]Backend `toml:"backends"` Dictionaries map[string]Dictionary `toml:"dictionaries,omitempty"` }
LocalServer represents a list of backends that should be mocked as per the configuration values.
type Mapper ¶ added in v0.37.0
type Mapper map[string]interface{}
Mapper represents a generic toml table.
type Setup ¶ added in v0.37.0
type Setup struct {
Backends []Mapper `toml:"backends"`
}
Setup represents a set of service configuration that works with the code in the package. See https://developer.fastly.com/reference/fastly-toml/.
type Version ¶
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 ¶
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.