metadata

package
v0.2.5 Latest Latest
Warning

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

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

Documentation

Overview

This package governs metadata in configuration repos and their surrounding development repositories as well.

Metadata refers to a yaml file that provides information about how to parse and interact with the referenced configuration files.

ConfigRepo or configuration repository refers to the source of truth repository.

DevRepo or development repository refers to the repository where lekko config is used, but not as a source of truth.

Index

Constants

View Source
const DefaultNamespaceConfigRepoMetadataFileName = "lekko.ns.yaml"
View Source
const DefaultRootConfigRepoMetadataFileName = "lekko.root.yaml"
View Source
const GenFolderPathJSON = "gen/json"
View Source
const GenFolderPathProto = "gen/proto"
View Source
const LatestNamespaceVersion = "v1beta3"

Variables

This section is empty.

Functions

func CreateNamespaceMetadata

func CreateNamespaceMetadata(ctx context.Context, rootPath, namespaceName string, cw fs.ConfigWriter) error

func MarshalYAML

func MarshalYAML(v interface{}) ([]byte, error)

func NewYAMLDecoderStrict

func NewYAMLDecoderStrict(reader io.Reader) *yaml.Decoder

NewYAMLDecoderStrict creates a new YAML decoder from the reader.

func NewYAMLEncoderStrict

func NewYAMLEncoderStrict(writer io.Writer) *yaml.Encoder

NewYAMLDecoderStrict creates a new YAML decoder from the reader.

func UnmarshalYAMLStrict

func UnmarshalYAMLStrict(data []byte, v interface{}) error

This is taken from github.com/bufbuild/buf/private/pkg/encoding/encoding.go

UnmarshalYAMLStrict unmarshals the data as YAML, returning a user error on failure.

If the data length is 0, this is a no-op.

func UpdateRootConfigRepoMetadata

func UpdateRootConfigRepoMetadata(ctx context.Context, path string, cw fs.ConfigWriter, f func(*RootConfigRepoMetadata)) error

Types

type NamespaceConfigRepoMetadata

type NamespaceConfigRepoMetadata struct {
	// This version refers to the version of the configuration in the repo itself.
	// TODO we should move this to a separate version number.
	Version string `json:"version,omitempty" yaml:"version,omitempty"`
	Name    string `json:"name,omitempty" yaml:"name,omitempty"`
}

func ParseNamespaceMetadataStrict

func ParseNamespaceMetadataStrict(ctx context.Context, rootPath, namespaceName string, provider fs.Provider) (*NamespaceConfigRepoMetadata, error)

type RootConfigRepoMetadata

type RootConfigRepoMetadata struct {
	// This version refers to the version of the metadata.
	Version        string   `json:"version,omitempty" yaml:"version,omitempty"`
	Namespaces     []string `json:"namespaces,omitempty" yaml:"namespaces,omitempty"`
	ProtoDirectory string   `json:"protoDir,omitempty" yaml:"protoDir,omitempty"`
}

The type for

func ParseFullConfigRepoMetadataStrict

func ParseFullConfigRepoMetadataStrict(ctx context.Context, path string, provider fs.Provider) (*RootConfigRepoMetadata, map[string]*NamespaceConfigRepoMetadata, error)

Parses the lekko metadata from a configuration repo in a strict way, returning a user error on failure.

This looks in the default locations and names for now, and a custom extension can be written later.

This returns the root metadata of a repository and a map from namespace name to namespace metadata.

This takes a provider so that we can use the same code on a local version on disk as well as in Github.

Jump to

Keyboard shortcuts

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