cord-776 create build / runtime containers for autmation uservices
Change-Id: I246973192adef56a250ffe93a5f65fff488840c1
diff --git a/automation/vendor/gopkg.in/juju/names.v2/cloud.go b/automation/vendor/gopkg.in/juju/names.v2/cloud.go
new file mode 100644
index 0000000..78a3c8b
--- /dev/null
+++ b/automation/vendor/gopkg.in/juju/names.v2/cloud.go
@@ -0,0 +1,51 @@
+// Copyright 2016 Canonical Ltd.
+// Licensed under the LGPLv3, see LICENCE file for details.
+
+package names
+
+import (
+ "fmt"
+ "regexp"
+)
+
+const CloudTagKind = "cloud"
+
+var (
+ cloudSnippet = "[a-zA-Z0-9][a-zA-Z0-9.-]*"
+ validCloud = regexp.MustCompile("^" + cloudSnippet + "$")
+)
+
+type CloudTag struct {
+ id string
+}
+
+func (t CloudTag) String() string { return t.Kind() + "-" + t.id }
+func (t CloudTag) Kind() string { return CloudTagKind }
+func (t CloudTag) Id() string { return t.id }
+
+// NewCloudTag returns the tag for the cloud with the given ID.
+// It will panic if the given cloud ID is not valid.
+func NewCloudTag(id string) CloudTag {
+ if !IsValidCloud(id) {
+ panic(fmt.Sprintf("%q is not a valid cloud ID", id))
+ }
+ return CloudTag{id}
+}
+
+// ParseCloudTag parses a cloud tag string.
+func ParseCloudTag(cloudTag string) (CloudTag, error) {
+ tag, err := ParseTag(cloudTag)
+ if err != nil {
+ return CloudTag{}, err
+ }
+ dt, ok := tag.(CloudTag)
+ if !ok {
+ return CloudTag{}, invalidTagError(cloudTag, CloudTagKind)
+ }
+ return dt, nil
+}
+
+// IsValidCloud returns whether id is a valid cloud ID.
+func IsValidCloud(id string) bool {
+ return validCloud.MatchString(id)
+}