cord-776 create build / runtime containers for autmation uservices
Change-Id: I246973192adef56a250ffe93a5f65fff488840c1
diff --git a/switchq/vendor/gopkg.in/juju/names.v2/space.go b/switchq/vendor/gopkg.in/juju/names.v2/space.go
new file mode 100644
index 0000000..049e1c7
--- /dev/null
+++ b/switchq/vendor/gopkg.in/juju/names.v2/space.go
@@ -0,0 +1,50 @@
+// Copyright 2015 Canonical Ltd.
+// Licensed under the LGPLv3, see LICENCE file for details.
+
+package names
+
+import (
+ "fmt"
+ "regexp"
+)
+
+const (
+ SpaceTagKind = "space"
+ SpaceSnippet = "(?:[a-z0-9]+(?:-[a-z0-9]+)*)"
+)
+
+var validSpace = regexp.MustCompile("^" + SpaceSnippet + "$")
+
+// IsValidSpace reports whether name is a valid space name.
+func IsValidSpace(name string) bool {
+ return validSpace.MatchString(name)
+}
+
+type SpaceTag struct {
+ name string
+}
+
+func (t SpaceTag) String() string { return t.Kind() + "-" + t.Id() }
+func (t SpaceTag) Kind() string { return SpaceTagKind }
+func (t SpaceTag) Id() string { return t.name }
+
+// NewSpaceTag returns the tag of a space with the given name.
+func NewSpaceTag(name string) SpaceTag {
+ if !IsValidSpace(name) {
+ panic(fmt.Sprintf("%q is not a valid space name", name))
+ }
+ return SpaceTag{name: name}
+}
+
+// ParseSpaceTag parses a space tag string.
+func ParseSpaceTag(spaceTag string) (SpaceTag, error) {
+ tag, err := ParseTag(spaceTag)
+ if err != nil {
+ return SpaceTag{}, err
+ }
+ nt, ok := tag.(SpaceTag)
+ if !ok {
+ return SpaceTag{}, invalidTagError(spaceTag, SpaceTagKind)
+ }
+ return nt, nil
+}