Documentation ¶
Index ¶
- Constants
- Variables
- func CalculateKeys(obj interface{}, field string, prefix string) []string
- func Decode(src DataSource, dest interface{}) interface{}
- func DecodeWithPrefix(src DataSource, dest interface{}, prefix string) interface{}
- func Encode(sink DataSink, src interface{})
- func EncodeWithPrefix(sink DataSink, src interface{}, prefix string)
- func SetLogLevel(level logrus.Level)
- type DataSink
- type DataSource
- type MapStore
- type SecretKey
- type Store
Constants ¶
const ( // DefaultTagName value DefaultTagName = "vic" // DefaultPrefix value DefaultPrefix = "" // DefaultGuestInfoPrefix value DefaultGuestInfoPrefix = "guestinfo.vice." //Separator for slice values and map keys Separator = "|" )
const ( // Invalid value Invalid = 1 << iota // Hidden value Hidden // ReadOnly value ReadOnly // ReadWrite value ReadWrite // NonPersistent value NonPersistent // Volatile value Volatile // Secret value Secret )
const GuestInfoSecretKey = "guestinfo.ovfEnv"
The value of this key is hidden from API requests, but visible within the guest #nosec: Potential hardcoded credentials
Variables ¶
var (
ErrKeyNotFound = errors.New("key not found")
)
var Unbounded = recursion{/* contains filtered or unexported fields */}
Unbounded is the value used for unbounded recursion
Functions ¶
func CalculateKeys ¶
CalculateKeys gets the keys in extraconfig corresponding to the field specification passed in for obj. Examples:
type struct A { I int `vic:"0.1" scope:"read-only" key:"i"` Str string `vic:"0.1" scope:"read-only" key:"str"` } type struct B { A A `vic:"0.1" scope:"read-only" key:"a"` Array []A `vic:"0.1" scope:"read-only" key:"array"` Map map[string]string `vic:"0.1" scope:"read-only" key:"map"` } b := B{} b.Array = []A{A{}} b.Map = map[string]string{"foo": "", "bar": ""} // returns []string{"a/str"} CalculateKeys(b, "A.Str", "") // returns []string{"array|0"} CalculateKeys(b, "Array.0", "") // returns []string{"array|0"} CalculateKeys(b, "Array.*", "") // returns []string{"map|foo", "map|bar"} CalculateKeys(b, "Map.*", "") // returns []string{"map|foo"} CalculateKeys(b, "Map.foo", "") // returns []string{"map|foo/str"} CalculateKeys(b, "Map.foo.str", "")
func Decode ¶
func Decode(src DataSource, dest interface{}) interface{}
Decode populates a destination with data from the supplied data source
func DecodeWithPrefix ¶
func DecodeWithPrefix(src DataSource, dest interface{}, prefix string) interface{}
DecodeWithPrefix populates a destination with data from the supplied data source, using the specified prefix - this allows for decode into substructres.
func Encode ¶
func Encode(sink DataSink, src interface{})
Encode serializes the given type to the supplied data sink
func EncodeWithPrefix ¶
EncodeWithPrefix serializes the given type to the supplied data sink, using the supplied prefix - this allows for serialization of subsections of a struct
Types ¶
type DataSink ¶
DataSink provides a function that, given a key/value will persist that in some manner suited for later retrieval
func GuestInfoSink ¶
GuestInfoSink uses the rpcvmx mechanism to update the guestinfo key/value map as the datasink for encoding target structures
func GuestInfoSinkWithPrefix ¶
GuestInfoSinkWithPrefix adds a prefix to all keys accessed. The key must not have leading or trailing separator characters, but may have separators in other positions. The separator (either . or /) will be replaced with the appropriate value for the key in question.
func ScopeFilterSink ¶
ScopeFilterSink will create a DataSink that only stores entries where the key scope matches one or more scopes in the filter. The filter is a bitwise composion of scope flags
type DataSource ¶
DataSource provides a function that, give a key will return a value this is to be used during extraConfig decode to obtain values. Should return ErrKeyNotFound if the key does not exist in the data source.
func GuestInfoSource ¶
func GuestInfoSource() (DataSource, error)
GuestInfoSource uses the rpcvmx mechanism to access the guestinfo key/value map as the datasource for decoding into target structures
func GuestInfoSourceWithPrefix ¶
func GuestInfoSourceWithPrefix(prefix string) (DataSource, error)
GuestInfoSourceWithPrefix adds a prefix to all keys accessed. The key must not have leading or trailing separator characters, but may have separators in other positions. The separator (either . or /) will be replaced with the appropriate value for the key in question.
func MapSource ¶
func MapSource(src map[string]string) DataSource
MapSource takes a key/value map and uses that as the datasource for decoding into target structures
type SecretKey ¶
type SecretKey struct {
// contains filtered or unexported fields
}
SecretKey provides helpers to encrypt/decrypt extraconfig values
func (*SecretKey) FromString ¶
FromString base64 decodes an existing SecretKey
func (*SecretKey) Source ¶
func (s *SecretKey) Source(ds DataSource) DataSource
Source wraps the given DataSource, decrypting any secret values
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package vmomi is in a separate package to avoid the transitive inclusion of govmomi as a fundamental dependency of the main extraconfig
|
Package vmomi is in a separate package to avoid the transitive inclusion of govmomi as a fundamental dependency of the main extraconfig |