names

package
v0.0.0-...-a7271ac Latest Latest
Warning

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

Go to latest
Published: May 4, 2014 License: AGPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ContainerTypeSnippet = "[a-z]+"
	ContainerSnippet     = "(/" + ContainerTypeSnippet + "/" + NumberSnippet + ")"
	MachineSnippet       = NumberSnippet + ContainerSnippet + "*"
)
View Source
const (
	ServiceSnippet = "([a-z][a-z0-9]*(-[a-z0-9]*[a-z][a-z0-9]*)*)"
	NumberSnippet  = "(0|[1-9][0-9]*)"
)
View Source
const (
	UnitTagKind     = "unit"
	MachineTagKind  = "machine"
	ServiceTagKind  = "service"
	EnvironTagKind  = "environment"
	UserTagKind     = "user"
	RelationTagKind = "relation"
)
View Source
const RelationSnippet = "[a-z][a-z0-9]*([_-][a-z0-9]+)*"

Variables

This section is empty.

Functions

func EnvironTag

func EnvironTag(uuid string) string

EnvironTag returns the tag of an environment with the given environment UUID.

func IsEnvironment

func IsEnvironment(id string) bool

IsEnvironment returns whether id is a valid environment UUID.

func IsMachine

func IsMachine(id string) bool

IsMachine returns whether id is a valid machine id.

func IsRelation

func IsRelation(key string) bool

IsRelation returns whether key is a valid relation key.

func IsService

func IsService(name string) bool

IsService returns whether name is a valid service name.

func IsUnit

func IsUnit(name string) bool

IsUnit returns whether name is a valid unit name.

func IsUser

func IsUser(name string) bool

IsUser returns whether id is a valid user id. TODO(rog) stricter constraints

func MachineTag

func MachineTag(id string) string

MachineTag returns the tag for the machine with the given id.

func ParseTag

func ParseTag(tag, expectKind string) (kind, id string, err error)

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

func RelationTag(relationKey string) string

RelationTag returns the tag for the relation with the given key.

func ServiceTag

func ServiceTag(serviceName string) string

ServiceTag returns the tag for the service with the given name.

func TagKind

func TagKind(tag string) (string, error)

TagKind returns one of the *TagKind constants for the given tag, or an error if none matches.

func UnitService

func UnitService(unitName string) string

UnitService returns the name of the service that the unit is associated with. It panics if unitName is not a valid unit name.

func UnitTag

func UnitTag(unitName string) string

UnitTag returns the tag for the unit with the given name. It will panic if the given unit name is not valid.

func UserTag

func UserTag(userName string) string

UserTag returns the tag for the user with the given name.

Types

This section is empty.

Jump to

Keyboard shortcuts

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