yml

package
v0.20.0 Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2022 License: AGPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bool added in v0.20.0

type Bool struct {
	// contains filtered or unexported fields
}

Bool is a YAML bool. It supports YAML serialization and deserialization.

During deserialization it replaces env. variable references with the corresponding values from the environment.

However, it preserves the YAML representation and does not serialize any value from the environment.

func (Bool) MarshalYAML added in v0.20.0

func (b Bool) MarshalYAML() (any, error)

MarshalYAML returns the Bool's YAML representation.

func (*Bool) Set added in v0.20.0

func (b *Bool) Set(value bool)

Set sets the boolean value.

func (*Bool) UnmarshalYAML added in v0.20.0

func (b *Bool) UnmarshalYAML(node *yaml.Node) error

UnmarshalYAML uses the unmarhsal function to unmarshal a YAML block into the Bool.

func (*Bool) Value added in v0.20.0

func (b *Bool) Value() bool

Value returns the boolean value, either true or false.

type Duration

type Duration struct {
	// contains filtered or unexported fields
}

A Duration represents the elapsed time between two instants as an int64 nanosecond count. The representation limits the largest representable duration to approximately 290 years.

It supports YAML serialization and deserialization.

During deserialization it replaces env. variable references with the corresponding values from the environment.

However, it preserves the YAML representation and does not serialize any value from the environment.

func (Duration) MarshalYAML

func (d Duration) MarshalYAML() (any, error)

MarshalYAML returns the Duration's YAML representation.

func (*Duration) Set added in v0.20.0

func (d *Duration) Set(value time.Duration)

Set sets the Duration value.

func (*Duration) UnmarshalYAML

func (d *Duration) UnmarshalYAML(node *yaml.Node) error

UnmarshalYAML uses the unmarhsal function to unmarshal a YAML block into the Duration.

func (*Duration) Value

func (d *Duration) Value() time.Duration

Value returns the time duration value.

type Identity

type Identity struct {
	// contains filtered or unexported fields
}

Identity is a KES identity. It supports YAML serialization and deserialization.

During deserialization it replaces env. variable references with the corresponding values from the environment.

However, it preserves the YAML representation and does not serialize any value from the environment.

func (Identity) MarshalYAML

func (i Identity) MarshalYAML() (any, error)

MarshalYAML returns the Identity's YAML representation.

func (*Identity) Set added in v0.20.0

func (i *Identity) Set(value kes.Identity)

Set sets the Identity value.

func (*Identity) UnmarshalYAML

func (i *Identity) UnmarshalYAML(node *yaml.Node) error

UnmarshalYAML uses the unmarhsal function to unmarshal a YAML block into the Identity.

func (*Identity) Value

func (i *Identity) Value() kes.Identity

Value returns the KES identity.

type ServerConfig

type ServerConfig struct {
	Address String `yaml:"address"`

	Admin struct {
		Identity Identity `yaml:"identity"`
	} `yaml:"admin"`

	TLS struct {
		PrivateKey  String `yaml:"key"`
		Certificate String `yaml:"cert"`
		Password    String `yaml:"password"`

		Proxy struct {
			Identities []Identity `yaml:"identities"`
			Header     struct {
				ClientCert String `yaml:"cert"`
			} `yaml:"header"`
		} `yaml:"proxy"`
	} `yaml:"tls"`

	Policies map[string]struct {
		Allow      []string   `yaml:"allow"` // Use 'string' type; We don't replace API allow patterns with env. vars
		Deny       []string   `yaml:"deny"`  // Use 'string' type; We don't replace API deny patterns with env. vars
		Identities []Identity `yaml:"identities"`
	} `yaml:"policy"`

	Cache struct {
		Expiry struct {
			Any     Duration `yaml:"any"`
			Unused  Duration `yaml:"unused"`
			Offline Duration `yaml:"offline"`
		} `yaml:"expiry"`
	} `yaml:"cache"`

	Log struct {
		Error String `yaml:"error"`
		Audit String `yaml:"audit"`
	} `yaml:"log"`

	Keys []struct {
		Name String `yaml:"name"`
	} `yaml:"keys"`

	KeyStore struct {
		Fs struct {
			Path String `yaml:"path"`
		} `yaml:"fs"`

		Generic struct {
			Endpoint String `yaml:"endpoint"`
			TLS      struct {
				PrivateKey  String `yaml:"key"`
				Certificate String `yaml:"cert"`
				CAPath      String `yaml:"ca"`
			} `yaml:"tls"`
		} `yaml:"generic"`

		Vault struct {
			Endpoint   String `yaml:"endpoint"`
			Engine     String `yaml:"engine"`
			APIVersion String `yaml:"version"`
			Namespace  String `yaml:"namespace"`

			Prefix String `yaml:"prefix"`

			AppRole struct {
				Engine String   `yaml:"engine"`
				ID     String   `yaml:"id"`
				Secret String   `yaml:"secret"`
				Retry  Duration `yaml:"retry"`
			} `yaml:"approle"`

			Kubernetes struct {
				Engine String   `yaml:"engine"`
				Role   String   `yaml:"role"`
				JWT    String   `yaml:"jwt"` // Can be either a JWT or a path to a file containing a JWT
				Retry  Duration `yaml:"retry"`
			} `yaml:"kubernetes"`

			TLS struct {
				PrivateKey  String `yaml:"key"`
				Certificate String `yaml:"cert"`
				CAPath      String `yaml:"ca"`
			} `yaml:"tls"`

			Status struct {
				Ping Duration `yaml:"ping"`
			} `yaml:"status"`
		} `yaml:"vault"`

		Fortanix struct {
			SDKMS struct {
				Endpoint String `yaml:"endpoint"`
				GroupID  String `yaml:"group_id"`

				Login struct {
					APIKey String `yaml:"key"`
				} `yaml:"credentials"`

				TLS struct {
					CAPath String `yaml:"ca"`
				} `yaml:"tls"`
			} `yaml:"sdkms"`
		} `yaml:"fortanix"`

		Aws struct {
			SecretsManager struct {
				Endpoint String `yaml:"endpoint"`
				Region   String `yaml:"region"`
				KmsKey   String ` yaml:"kmskey"`

				Login struct {
					AccessKey    String `yaml:"accesskey"`
					SecretKey    String `yaml:"secretkey"`
					SessionToken String `yaml:"token"`
				} `yaml:"credentials"`
			} `yaml:"secretsmanager"`
		} `yaml:"aws"`

		GCP struct {
			SecretManager struct {
				ProjectID   String   `yaml:"project_id"`
				Endpoint    String   `yaml:"endpoint"`
				Scopes      []String `yaml:"scopes"`
				Credentials struct {
					Client   String `yaml:"client_email"`
					ClientID String `yaml:"client_id"`
					KeyID    String `yaml:"private_key_id"`
					Key      String `yaml:"private_key"`
				} `yaml:"credentials"`
			} `yaml:"secretmanager"`
		} `yaml:"gcp"`

		Azure struct {
			KeyVault struct {
				Endpoint    String `yaml:"endpoint"`
				Credentials struct {
					TenantID String `yaml:"tenant_id"`
					ClientID String `yaml:"client_id"`
					Secret   String `yaml:"client_secret"`
				} `yaml:"credentials"`
				ManagedIdentity struct {
					ClientID String `yaml:"client_id"`
				} `yaml:"managed_identity"`
			} `yaml:"keyvault"`
		} `yaml:"azure"`

		Gemalto struct {
			KeySecure struct {
				Endpoint String `yaml:"endpoint"`

				Login struct {
					Token  String   `yaml:"token"`
					Domain String   `yaml:"domain"`
					Retry  Duration `yaml:"retry"`
				} `yaml:"credentials"`

				TLS struct {
					CAPath String `yaml:"ca"`
				} `yaml:"tls"`
			} `yaml:"keysecure"`
		} `yaml:"gemalto"`
	} `yaml:"keystore"`
}

ServerConfig is the structure containing all possible KES server configuration fields.

It can be (de)serialized from/into YAML.

func ReadServerConfig

func ReadServerConfig(filename string) (*ServerConfig, error)

ReadServerConfig reads file named by filename and returns the deserialized ServerConfig.

type String

type String struct {
	// contains filtered or unexported fields
}

String is a YAML string. It supports YAML serialization and deserialization.

During deserialization it replaces env. variable references with the corresponding values from the environment.

However, it preserves the YAML representation and does not serialize any value from the environment.

func (String) MarshalYAML

func (s String) MarshalYAML() (any, error)

MarshalYAML returns the String's YAML representation.

func (*String) Set

func (s *String) Set(value string)

Set sets the String value.

func (*String) UnmarshalYAML

func (s *String) UnmarshalYAML(node *yaml.Node) error

UnmarshalYAML uses the unmarhsal function to unmarshal a YAML block into the String.

func (*String) Value

func (s *String) Value() string

Value returns the plain string value.

Jump to

Keyboard shortcuts

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