Documentation ¶
Index ¶
- Constants
- func IsContainerMachine(id string) bool
- func IsValidAction(actionId string) bool
- func IsValidActionResult(resultId string) bool
- func IsValidEnvironment(id string) bool
- func IsValidMachine(id string) bool
- func IsValidNetwork(name string) bool
- func IsValidRelation(key string) bool
- func IsValidService(name string) bool
- func IsValidUnit(name string) bool
- func IsValidUser(name string) bool
- func IsValidUserName(name string) bool
- func TagKind(tag string) (string, error)
- func UnitService(unitName string) string
- type ActionResultTag
- type ActionTag
- type EnvironTag
- type MachineTag
- type NetworkTag
- type PrefixTag
- type RelationTag
- type ServiceTag
- type Tag
- type UnitTag
- type UserTag
Examples ¶
Constants ¶
const ( // ActionTagKind is used to identify the Tag type ActionTagKind = "action" // ActionResultTagKind is used to identify the Tag type ActionResultTagKind = "actionresult" )
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 ( UserTagKind = "user" LocalProvider = "local" )
const EnvironTagKind = "environment"
const MachineTagKind = "machine"
const (
NetworkSnippet = "(?:[a-z0-9]+(?:-[a-z0-9]+)*)"
)
const NetworkTagKind = "network"
const RelationSnippet = "[a-z][a-z0-9]*(?:[_-][a-z0-9]+)*"
const RelationTagKind = "relation"
const ServiceTagKind = "service"
const UnitTagKind = "unit"
Variables ¶
This section is empty.
Functions ¶
func IsContainerMachine ¶
IsContainerMachine returns whether id is a valid container machine id.
func IsValidAction ¶
IsValidAction returns whether actionId is a valid actionId Valid action ids include the names.actionMarker token that delimits a prefix that can be used for filtering, and a suffix that should be unique. The prefix should match the name rules for units
func IsValidActionResult ¶
IsValidActionResult returns whether resultId is a valid actionResultId Valid action result ids include the names.actionResultMarker token that delimits a prefix that can be used for filtering, and a suffix that should be unique. The prefix should match the name rules for units or services
func IsValidEnvironment ¶
IsValidEnvironment returns whether id is a valid environment UUID.
func IsValidMachine ¶
IsValidMachine returns whether id is a valid machine id.
func IsValidNetwork ¶
IsValidNetwork reports whether name is a valid network name.
func IsValidRelation ¶
IsValidRelation returns whether key is a valid relation key.
func IsValidService ¶
IsValidService returns whether name is a valid service name.
func IsValidUnit ¶
IsValidUnit returns whether name is a valid unit name.
func IsValidUser ¶
IsValidUser returns whether id is a valid user id.
func IsValidUserName ¶
IsValidUserName returns whether the user's name is a valid.
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 ¶
type ActionResultTag ¶
type ActionResultTag struct {
// contains filtered or unexported fields
}
ActionResultTag represents the actionresult of an action
func NewActionResultTag ¶
func NewActionResultTag(id string) ActionResultTag
NewActionResultTag returns a tag for an actionresult using it's id
func ParseActionResultTag ¶
func ParseActionResultTag(actionResultTag string) (ActionResultTag, error)
ParseActionResultTag parses a action result tag string.
func (ActionResultTag) Id ¶
func (t ActionResultTag) Id() string
Id returns the id of the type this Tag represents
func (ActionResultTag) Kind ¶
func (t ActionResultTag) Kind() string
Kind exposes the value to identify what kind of Tag this is
func (ActionResultTag) Prefix ¶
func (t ActionResultTag) Prefix() string
Prefix returns the string representation of the prefix of the Tag
func (ActionResultTag) PrefixTag ¶
func (t ActionResultTag) PrefixTag() Tag
PrefixTag returns a Tag representing the Entity matching the id prefix
type ActionTag ¶
type ActionTag struct {
// contains filtered or unexported fields
}
ActionTag is a Tag type for representing Action entities, which are records of queued actions for a given unit
func JoinActionTag ¶
JoinActionTag reconstitutes an ActionTag from it's prefix and sequence
func NewActionTag ¶
NewActionTag returns the tag for the action with the given id.
func ParseActionTag ¶
ParseActionTag parses a action tag string.
func (ActionTag) Id ¶
func (t ActionTag) Id() string
Id returns the id of the type this Tag represents
func (ActionTag) Kind ¶
func (t ActionTag) Kind() string
Kind exposes the value to identify what kind of Tag this is
func (ActionTag) Prefix ¶
func (t ActionTag) Prefix() string
Prefix returns the string representation of the prefix of the Tag
func (ActionTag) PrefixTag ¶
func (t ActionTag) PrefixTag() Tag
PrefixTag returns a Tag representing the Entity matching the id prefix
type EnvironTag ¶
type EnvironTag struct {
// contains filtered or unexported fields
}
func NewEnvironTag ¶
func NewEnvironTag(uuid string) EnvironTag
NewEnvironTag returns the tag of an environment with the given environment UUID.
func ParseEnvironTag ¶
func ParseEnvironTag(environTag string) (EnvironTag, error)
ParseEnvironTag parses an environ tag string.
func (EnvironTag) Id ¶
func (t EnvironTag) Id() string
func (EnvironTag) Kind ¶
func (t EnvironTag) Kind() string
func (EnvironTag) String ¶
func (t EnvironTag) String() string
type MachineTag ¶
type MachineTag struct {
// contains filtered or unexported fields
}
func NewMachineTag ¶
func NewMachineTag(id string) MachineTag
NewMachineTag returns the tag for the machine with the given id.
func ParseMachineTag ¶
func ParseMachineTag(machineTag string) (MachineTag, error)
ParseMachineTag parses a machine tag string.
func (MachineTag) Id ¶
func (t MachineTag) Id() string
func (MachineTag) Kind ¶
func (t MachineTag) Kind() string
func (MachineTag) String ¶
func (t MachineTag) String() string
type NetworkTag ¶
type NetworkTag struct {
// contains filtered or unexported fields
}
func NewNetworkTag ¶
func NewNetworkTag(name string) NetworkTag
NewNetworkTag returns the tag of a network with the given name.
func ParseNetworkTag ¶
func ParseNetworkTag(networkTag string) (NetworkTag, error)
ParseNetworkTag parses a network tag string.
func (NetworkTag) Id ¶
func (t NetworkTag) Id() string
func (NetworkTag) Kind ¶
func (t NetworkTag) Kind() string
func (NetworkTag) String ¶
func (t NetworkTag) String() string
type RelationTag ¶
type RelationTag struct {
// contains filtered or unexported fields
}
func NewRelationTag ¶
func NewRelationTag(relationKey string) RelationTag
NewRelationTag returns the tag for the relation with the given key.
func ParseRelationTag ¶
func ParseRelationTag(relationTag string) (RelationTag, error)
ParseRelationTag parses a relation tag string.
func (RelationTag) Id ¶
func (t RelationTag) Id() string
func (RelationTag) Kind ¶
func (t RelationTag) Kind() string
func (RelationTag) String ¶
func (t RelationTag) String() string
type ServiceTag ¶
type ServiceTag struct {
// contains filtered or unexported fields
}
func NewServiceTag ¶
func NewServiceTag(serviceName string) ServiceTag
NewServiceTag returns the tag for the service with the given name.
func ParseServiceTag ¶
func ParseServiceTag(serviceTag string) (ServiceTag, error)
ParseServiceTag parses a service tag string.
func (ServiceTag) Id ¶
func (t ServiceTag) Id() string
func (ServiceTag) Kind ¶
func (t ServiceTag) Kind() string
func (ServiceTag) String ¶
func (t ServiceTag) String() string
type Tag ¶
type Tag interface { // Kind returns the kind of the tag. // This method is for legacy compatibility, callers should // use equality or type assertions to verify the Kind, or type // of a Tag. Kind() string // Id returns an identifier for this Tag. // The contents and format of the identifier are specific // to the implementer of the Tag. Id() string fmt.Stringer // all Tags should be able to print themselves }
A Tag tags things that are taggable.
type UnitTag ¶
type UnitTag struct {
// contains filtered or unexported fields
}
func NewUnitTag ¶
NewUnitTag returns the tag for the unit with the given name. It will panic if the given unit name is not valid.
func ParseUnitTag ¶
ParseUnitTag parses a unit tag string.
type UserTag ¶
type UserTag struct {
// contains filtered or unexported fields
}
UserTag represents a user that may be stored in the local database, or provided through some remote identity provider.
func NewLocalUserTag ¶
NewLocalUserTag returns the tag for a local user with the given name.
func NewUserTag ¶
NewUserTag returns the tag for the user with the given name.
func ParseUserTag ¶
ParseUserTag parser a user tag string.