Documentation ¶
Index ¶
- Constants
- func EnvironTag(uuid string) string
- func IsEnvironment(id string) bool
- func IsMachine(id string) bool
- func IsRelation(key string) bool
- func IsService(name string) bool
- func IsUnit(name string) bool
- func IsUser(name string) bool
- func MachineTag(id string) string
- func ParseTag(tag, expectKind string) (kind, id string, err error)
- func RelationTag(relationKey string) string
- func ServiceTag(serviceName string) string
- func TagKind(tag string) (string, error)
- func UnitService(unitName string) string
- func UnitTag(unitName string) string
- func UserTag(userName string) string
Constants ¶
const ( ContainerTypeSnippet = "[a-z]+" ContainerSnippet = "(/" + ContainerTypeSnippet + "/" + NumberSnippet + ")" MachineSnippet = NumberSnippet + ContainerSnippet + "*" )
const ( ServiceSnippet = "([a-z][a-z0-9]*(-[a-z0-9]*[a-z][a-z0-9]*)*)" NumberSnippet = "(0|[1-9][0-9]*)" )
const ( UnitTagKind = "unit" MachineTagKind = "machine" ServiceTagKind = "service" EnvironTagKind = "environment" UserTagKind = "user" RelationTagKind = "relation" )
const RelationSnippet = "[a-z][a-z0-9]*([_-][a-z0-9]+)*"
Variables ¶
This section is empty.
Functions ¶
func EnvironTag ¶
EnvironTag returns the tag of an environment with the given environment UUID.
func IsEnvironment ¶
IsEnvironment returns whether id is a valid environment UUID.
func IsRelation ¶
IsRelation returns whether key is a valid relation key.
func MachineTag ¶
MachineTag returns the tag for the machine with the given id.
func ParseTag ¶
ParseTag parses a tag into its kind and identifier components. It returns an error if the tag is malformed, or if expectKind is not empty and the kind is not as expected.
func RelationTag ¶
RelationTag returns the tag for the relation with the given key.
func ServiceTag ¶
ServiceTag returns the tag for the service with the given name.
func TagKind ¶
TagKind returns one of the *TagKind constants for the given tag, or an error if none matches.
func UnitService ¶
UnitService returns the name of the service that the unit is associated with. It panics if unitName is not a valid unit name.
Types ¶
This section is empty.