Documentation ¶
Overview ¶
Package hvtag contains objects and utility functions to handle tags of Hivelocity devices.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // ErrDeviceTagKeyInvalid indicates that the device tag key is invalid. ErrDeviceTagKeyInvalid = fmt.Errorf("invalid device tag key") // ErrDeviceTagInvalidFormat indicates that the device tag has an invalid format. ErrDeviceTagInvalidFormat = fmt.Errorf("invalid format of device tag") // ErrDeviceTagEmptyKey indicates that the device tag has an empty key. ErrDeviceTagEmptyKey = fmt.Errorf("device tag has empty key") // ErrDeviceTagEmptyValue indicates that the device tag has an empty value. ErrDeviceTagEmptyValue = fmt.Errorf("device tag has empty value") // ErrMultipleDeviceTagsFound indicates that multiple device tags have been found in a list. ErrMultipleDeviceTagsFound = fmt.Errorf("found multiple device tags") // ErrDeviceTagNotFound indicates that no device tag has been found. ErrDeviceTagNotFound = fmt.Errorf("no device tag found") )
Functions ¶
This section is empty.
Types ¶
type DeviceTag ¶
type DeviceTag struct { Key DeviceTagKey Value string }
DeviceTag defines the object that represents a key-value pair that is stored as tag of Hivelocity devices.
func ClusterTagFromList ¶
ClusterTagFromList returns the machine tag from a list of tag strings.
func DeviceTagFromList ¶
func DeviceTagFromList(key DeviceTagKey, tagList []string) (DeviceTag, error)
DeviceTagFromList takes the tag of a HV device and returns a DeviceTag or an error if it is invalid.
func DeviceTypeTagFromList ¶
DeviceTypeTagFromList returns the machine tag from a list of tag strings.
func MachineTagFromList ¶
MachineTagFromList returns the machine tag from a list of tag strings.
func (DeviceTag) IsInStringList ¶
IsInStringList checks whether a DeviceTag object can be found in a list of tag strings.
func (DeviceTag) RemoveFromList ¶
RemoveFromList removes all tag strings from a list that equal the string representation of DeviceTag.
type DeviceTagKey ¶
type DeviceTagKey string
DeviceTagKey defines the key of the key-value pair that is stored as tag of Hivelocity devices.
const ( // DeviceTagKeyMachine is the key for the name of the associated HivelocityMachine object. DeviceTagKeyMachine DeviceTagKey = "caphv-machine-name" // DeviceTagKeyCluster is the key for the name of the associated HivelocityCluster object. DeviceTagKeyCluster DeviceTagKey = "caphv-cluster-name" // DeviceTagKeyDeviceType is the key for the device type that users can reference in HivelocityMachine.Spec. DeviceTagKeyDeviceType DeviceTagKey = "caphv-device-type" // DeviceTagKeyMachineType is the key for the machine type, i.e. worker, control_plane. DeviceTagKeyMachineType DeviceTagKey = "caphv-machine-type" )
func (DeviceTagKey) IsValid ¶
func (key DeviceTagKey) IsValid() bool
IsValid checks whether a DeviceTagKey is valid.
func (DeviceTagKey) Prefix ¶
func (key DeviceTagKey) Prefix() string
Prefix returns the prefix based on this DeviceTagKey used in Hivelocity tag strings.