kmsconfig

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2019 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Package kmsconfig configures KMS tests.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// ID is the ID used for KMS resource creation.
	ID string `json:"id,omitempty"`
	// ConfigPath is the configuration file path.
	// Deployer is expected to update this file with latest status.
	ConfigPath string `json:"config-path,omitempty"`

	// AWSAccountID is the AWS account ID.
	AWSAccountID string `json:"aws-account-id,omitempty"`
	// AWSRegion is the AWS geographic area for EKS deployment.
	// If empty, set default region.
	AWSRegion string `json:"aws-region,omitempty"`

	// LogLevel configures log level. Only supports debug, info, warn, error, panic, or fatal. Default 'info'.
	LogLevel string `json:"log-level"`
	// LogOutputs is a list of log outputs. Valid values are 'default', 'stderr', 'stdout', or file names.
	// Logs are appended to the existing file, if any.
	// Multiple values are accepted. If empty, it sets to 'default', which outputs to stderr.
	// See https://godoc.org/go.uber.org/zap#Open and https://godoc.org/go.uber.org/zap#Config for more details.
	LogOutputs []string `json:"log-outputs,omitempty"`

	// UpdatedAt is the timestamp when the configuration has been updated.
	// Read only to 'Config' struct users.
	UpdatedAt time.Time `json:"updated-at,omitempty"` // read-only to user
	// KeyMetadata is the EKS metadata status.
	KeyMetadata *KeyMetadata `json:"key-meta-data,omitempty"`
	// KeyRotationEnabled is true, if key rotation is enabled.
	KeyRotationEnabled bool `json:"key-rotation-enabled,omitempty"`
}

Config defines EKS test configuration.

func Load

func Load(p string) (cfg *Config, err error)

Load loads configuration from YAML. Useful when injecting shared configuration via ConfigMap.

Example usage:

import "github.com/aws/aws-k8s-tester/kmsconfig"
cfg := kmsconfig.Load("test.yaml")
err := cfg.ValidateAndSetDefaults()

Do not set default values in this function. "ValidateAndSetDefaults" must be called separately, to prevent overwriting previous data when loaded from disks.

func NewDefault

func NewDefault() *Config

NewDefault returns a copy of the default configuration.

func (*Config) Sync

func (cfg *Config) Sync() (err error)

Sync persists current configuration and states to disk.

func (*Config) UpdateFromEnvs

func (cfg *Config) UpdateFromEnvs() error

UpdateFromEnvs updates fields from environmental variables.

func (*Config) ValidateAndSetDefaults

func (cfg *Config) ValidateAndSetDefaults() error

ValidateAndSetDefaults returns an error for invalid configurations. And updates empty fields with default values. At the end, it writes populated YAML to aws-k8s-tester config path.

type KeyMetadata

type KeyMetadata struct {
	AWSAccountID string    `json:"aws-account-id"`
	ARN          string    `json:"arn"`
	CreationDate time.Time `json:"creation-date"`
	Description  string    `json:"description"`
	Enabled      bool      `json:"enabled"`
	KeyID        string    `json:"key-id"`
	KeyManager   string    `json:"key-manager"`
	KeyState     string    `json:"key-state"`
	KeyUsage     string    `json:"key-usage"`
	Origin       string    `json:"origin"`
}

KeyMetadata is the key's current metadata.

Jump to

Keyboard shortcuts

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