Commit 79ccbd28 authored by vaikas-google's avatar vaikas-google

Merge pull request #126 from bmelville/125

deployed-instances needs to work with primitives.
parents 9854ebd0 047a1f9a
...@@ -160,6 +160,10 @@ func main() { ...@@ -160,6 +160,10 @@ func main() {
} }
tUrl := getTypeUrl(args[1]) tUrl := getTypeUrl(args[1])
if tUrl == "" {
// Type is most likely a primitive.
tUrl = args[1]
}
path := fmt.Sprintf("types/%s/instances", url.QueryEscape(tUrl)) path := fmt.Sprintf("types/%s/instances", url.QueryEscape(tUrl))
action := fmt.Sprintf("list deployed instances of type %s", tUrl) action := fmt.Sprintf("list deployed instances of type %s", tUrl)
callService(path, "GET", action, nil) callService(path, "GET", action, nil)
...@@ -217,10 +221,14 @@ func describeType(args []string) { ...@@ -217,10 +221,14 @@ func describeType(args []string) {
} }
tUrl := getTypeUrl(args[1]) tUrl := getTypeUrl(args[1])
if tUrl == "" {
log.Fatalf("Invalid type name, must be a template URL or in the form \"<type-name>:<version>\": %s", args[1])
}
schemaUrl := tUrl + ".schema" schemaUrl := tUrl + ".schema"
fmt.Println(callHttp(schemaUrl, "GET", "get schema for type ("+tUrl+")", nil)) fmt.Println(callHttp(schemaUrl, "GET", "get schema for type ("+tUrl+")", nil))
} }
// getTypeUrl returns URL or empty if a primitive type.
func getTypeUrl(tName string) string { func getTypeUrl(tName string) string {
if util.IsHttpUrl(tName) { if util.IsHttpUrl(tName) {
// User can pass raw URL to template. // User can pass raw URL to template.
...@@ -230,7 +238,8 @@ func getTypeUrl(tName string) string { ...@@ -230,7 +238,8 @@ func getTypeUrl(tName string) string {
// User can pass registry type. // User can pass registry type.
t := getRegistryType(tName) t := getRegistryType(tName)
if t == nil { if t == nil {
log.Fatalf("Invalid type name, must be in the form \"<type-name>:<version>\": %s", tName) // Primitive types have no associated URL.
return ""
} }
return getDownloadUrl(*t) return getDownloadUrl(*t)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment