config

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2023 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AWSConfig

type AWSConfig struct {
	Region             string       `toml:"region,omitempty"`
	ReplicationRegions []string     `toml:"replicationRegions,omitempty"`
	AMIName            string       `toml:"amiName,omitempty" template:"true"`
	AMIDescription     string       `toml:"amiDescription,omitempty" template:"true"`
	Bucket             string       `toml:"bucket,omitempty" template:"true"`
	BlobName           string       `toml:"blobName,omitempty" template:"true"`
	SnapshotName       string       `toml:"snapshotName,omitempty" template:"true"`
	Publish            Option[bool] `toml:"publish,omitempty"`
}

type AzureConfig

type AzureConfig struct {
	SubscriptionID      string `toml:"subscriptionID,omitempty"`
	Location            string `toml:"location,omitempty"`
	ResourceGroup       string `toml:"resourceGroup,omitempty" template:"true"`
	AttestationVariant  string `toml:"attestationVariant,omitempty" template:"true"`
	SharedImageGallery  string `toml:"sharedImageGallery,omitempty" template:"true"`
	SharingProfile      string `toml:"sharingProfile,omitempty" template:"true"`
	SharingNamePrefix   string `toml:"sharingNamePrefix,omitempty" template:"true"`
	ImageDefinitionName string `toml:"imageDefinitionName,omitempty" template:"true"`
	Offer               string `toml:"offer,omitempty" template:"true"`
	SKU                 string `toml:"sku,omitempty" template:"true"`
	Publisher           string `toml:"publisher,omitempty" template:"true"`
	DiskName            string `toml:"diskName,omitempty" template:"true"`
}

type Config

type Config struct {
	Provider         string      `toml:"provider"`
	ImageVersion     string      `toml:"imageVersion"`
	ImageVersionFile string      `toml:"imageVersionFile"`
	Name             string      `toml:"name"`
	AWS              AWSConfig   `toml:"aws,omitempty"`
	Azure            AzureConfig `toml:"azure,omitempty"`
	GCP              GCPConfig   `toml:"gcp,omitempty"`
}

func (*Config) Merge

func (c *Config) Merge(other Config) error

func (*Config) Render

func (c *Config) Render(fileLookup func(name string) ([]byte, error)) error

Render renders the config by evaluating the version file and all template strings.

func (*Config) SetDefaults

func (c *Config) SetDefaults() error

type ConfigFile

type ConfigFile struct {
	Base     Config            `toml:"base"`
	Variants map[string]Config `toml:"variant"`
}

func (*ConfigFile) ForEach

func (c *ConfigFile) ForEach(fn func(name string, cfg Config) error, fileLookup fileLookupFn, filters ...variantFilter) error

func (*ConfigFile) Merge

func (c *ConfigFile) Merge(other ConfigFile) error

func (*ConfigFile) RenderedVariant

func (c *ConfigFile) RenderedVariant(fileLookup fileLookupFn, name string) (Config, error)

type GCPConfig

type GCPConfig struct {
	Project     string `toml:"project,omitempty"`
	Location    string `toml:"location,omitempty"`
	ImageName   string `toml:"imageName,omitempty" template:"true"`
	ImageFamily string `toml:"imageFamily,omitempty" template:"true"`
	Bucket      string `toml:"bucket,omitempty" template:"true"`
	BlobName    string `toml:"blobName,omitempty" template:"true"`
}

type Option

type Option[T any] struct {
	Val   T
	Valid bool
}

func None

func None[T any]() Option[T]

func Some

func Some[T any](val T) Option[T]

func (*Option[T]) IsNone

func (o *Option[T]) IsNone() bool

func (Option[T]) IsSome

func (o Option[T]) IsSome() bool

func (Option[T]) MarshalJSON

func (o Option[T]) MarshalJSON() ([]byte, error)

func (Option[T]) MarshalTOML

func (o Option[T]) MarshalTOML() ([]byte, error)

func (*Option[T]) UnmarshalJSON

func (o *Option[T]) UnmarshalJSON(data []byte) error

func (*Option[T]) UnmarshalTOML

func (o *Option[T]) UnmarshalTOML(v any) error

func (*Option[T]) Unwrap

func (o *Option[T]) Unwrap() T

func (*Option[T]) UnwrapOr

func (o *Option[T]) UnwrapOr(def T) T

func (*Option[T]) UnwrapOrElse

func (o *Option[T]) UnwrapOrElse(f func() T) T

type OptionTransformer

type OptionTransformer struct{}

func (OptionTransformer) Transformer

func (t OptionTransformer) Transformer(typ reflect.Type) func(dst, src reflect.Value) error

type Validator

type Validator struct{}

func (*Validator) Validate

func (v *Validator) Validate(ctx context.Context, config Config) error

Jump to

Keyboard shortcuts

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