config

package
v0.11.1 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2016 License: Apache-2.0 Imports: 1 Imported by: 13

Documentation

Overview

Package config defines various structures including the configuration.

Index

Constants

View Source
const (
	// EcodeKeyNotFound      = 100
	StatusContinue           = 100
	StatusSwitchingProtocols = 101

	StatusOK       = 200
	StatusCreated  = 201
	StatusAccepted = 202
)

discfg status codes (not unlike HTTP status codes, but different numbers)

Variables

This section is empty.

Functions

func StatusText

func StatusText(code int) string

StatusText returns a text for the discfg status code. It returns the empty string if the code is unknown.

Types

type AWS

type AWS struct {
	Region          string
	AccessKeyID     string
	SecretAccessKey string
	SessionToken    string
	CredProfile     string
}

AWS credentials and options

type Item

type Item struct {
	Version int64  `json:"version,omitempty"`
	Key     string `json:"key,omitempty"`
	//Value   []byte `json:"value,omitempty"`
	Value       interface{}            `json:"value,omitempty"`
	OutputValue map[string]interface{} `json:"ovalue,omitempty"`

	// perfect for json, not good if some other value was stored
	//OutputValue            map[string]interface{} `json:"value,omitempty"`
	// We really need interface{} for any type of data. []byte above is for DynamoDB specifically.
	// It could be ... yea. an interface{} too. converted to []byte for storing in dynamodb.
	//OutputValue            interface{} `json:"value,omitempty"`
	TTL              int64     `json:"ttl,omitempty"`
	Expiration       time.Time `json:"-"`
	OutputExpiration string    `json:"expiration,omitempty"`
	// For now, skip this. The original thinking was to have a tree like directory structure like etcd.
	// Though discfg has now deviated away from that to a flat key/value structure.
	// Items                  []Item    `json:"items,omitepty"`
	CfgVersion             int64 `json:"-"`
	CfgModifiedNanoseconds int64 `json:"-"`
}

Item defines the data structure around a key and its state

type Options

type Options struct {
	CfgName              string
	ConditionalValue     string
	Recursive            bool
	Key                  string
	Value                []byte
	TTL                  int64
	StorageInterfaceName string
	// Storage options, for now AWS is the only supported storage
	Storage struct {
		AWS
	}
	Version      string
	OutputFormat string
}

Options needed by various functions (set by CLI commands, config files, other code, etc.)

type ResponseObject

type ResponseObject struct {
	Action        string `json:"action"`
	Item          Item   `json:"item,omitempty"`
	PrevItem      Item   `json:"prevItem,omitempty"`
	ErrorCode     int    `json:"errorCode,omitempty"`
	CurrentDiscfg string `json:"currentDiscfg,omitempty"`
	// Error message
	Error string `json:"error,omitempty"`
	// Message returned to the CLI
	Message string `json:"message,omitempty"`
	// Add this? Might be useful for troubleshooting, but users shouldn't really need to worry about it.
	// On the other hand, for things like DynamoDB, it's handy to know where the config stands in terms of scalability/capacity.
	// For things like S3, there's no real settings to care about (for the most part at least).
	// StorageResponse interface{} `json:"storageResponse,omitempty"`
	// Information about the config
	CfgVersion int64 `json:"cfgVersion,omitempty"`
	// In seconds since that's probably more common for people
	CfgModified int64 `json:"cfgModified,omitempty"`
	// In nanoseconds for the gophers like me who are snobby about time =)
	CfgModifiedNanoseconds int64 `json:"cfgModifiedNanoseconds,omitempty"`
	// A parsed date for humans to read
	CfgModifiedParsed string `json:"cfgModifiedParsed,omitempty"`
	// Configuration state (some storage engines, such as DynamoDB, have "active" and "updating" states)
	CfgState string `json:"cfgState,omitempty"`
	// Information about the configuration storage
	CfgStorage StorageInfo `json:"cfgStorage,omitempty"`
}

ResponseObject for output

type StorageInfo

type StorageInfo struct {
	Name          string                 `json:"name"`
	InterfaceName string                 `json:"interfaceName"`
	Options       map[string]interface{} `json:"options"`
}

StorageInfo holds information about the storage engine used for the configuration

Jump to

Keyboard shortcuts

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