Documentation ¶
Index ¶
- Constants
- Variables
- func IsContainerMachine(id string) bool
- func IsValidAction(id string) bool
- func IsValidCharm(url string) bool
- func IsValidDisk(name 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, error)
- type ActionTag
- type CharmTag
- type DiskTag
- type EnvironTag
- type MachineTag
- type NetworkTag
- type RelationTag
- type ServiceTag
- type Tag
- type UnitTag
- type UserTag
Examples ¶
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 ( UserTagKind = "user" LocalProvider = "local" )
const ActionTagKind = "action"
const CharmTagKind = "charm"
CharmTagKind specifies charm tag kind
const DiskTagKind = "disk"
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 ¶
var ( // SeriesSnippet is a regular expression representing series SeriesSnippet = "[a-z]+([a-z0-9]+)?" // CharmNameSnippet is a regular expression representing charm name CharmNameSnippet = "[a-z][a-z0-9]*(-[a-z0-9]*[a-z][a-z0-9]*)*" )
Functions ¶
func IsContainerMachine ¶
IsContainerMachine returns whether id is a valid container machine id.
func IsValidAction ¶
IsValidAction returns whether id is a valid action id (UUID).
func IsValidCharm ¶
IsValidCharm returns whether name is a valid charm url.
func IsValidDisk ¶
IsValidDisk returns whether name is a valid disk name.
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 returns an error if unitName is not a valid unit name.
Types ¶
type ActionTag ¶
func NewActionTag ¶
NewActionTag returns the tag of an action with the given id (UUID).
func ParseActionTag ¶
ParseActionTag parses an action tag string.
type CharmTag ¶
type CharmTag struct {
// contains filtered or unexported fields
}
CharmTag represents tag for charm using charm's URL
func NewCharmTag ¶
NewCharmTag returns the tag for the charm with the given url. It will panic if the given charm url is not valid.
func ParseCharmTag ¶
ParseCharmTag parses a charm tag string.
type DiskTag ¶
type DiskTag struct {
// contains filtered or unexported fields
}
func NewDiskTag ¶
NewDiskTag returns the tag for the disk with the given name. It will panic if the given disk name is not valid.
func ParseDiskTag ¶
ParseDiskTag parses a disk tag string.
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 {
Name string
}
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.
func ActionReceiverTag ¶
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.