Commit 1b0bb082 authored by Brendan Melville's avatar Brendan Melville

Merge pull request #12 from vaikas-google/master

change gettype -> listtypeinstances. URL escape only the name of the instance
parents 5d4364d4 580a3512
...@@ -31,7 +31,7 @@ import ( ...@@ -31,7 +31,7 @@ import (
) )
var ( var (
action = flag.String("action", "deploy", "expand | deploy | list | get | delete | update | listtypes | gettype") action = flag.String("action", "deploy", "expand | deploy | list | get | delete | update | listtypes | listtypeinstances")
name = flag.String("name", "", "Name of template or deployment") name = flag.String("name", "", "Name of template or deployment")
service = flag.String("service", "http://localhost:8080", "URL for deployment manager") service = flag.String("service", "http://localhost:8080", "URL for deployment manager")
binary = flag.String("binary", "../expandybird/expansion/expansion.py", binary = flag.String("binary", "../expandybird/expansion/expansion.py",
...@@ -72,8 +72,8 @@ func main() { ...@@ -72,8 +72,8 @@ func main() {
callService(path, "PUT", name, readTemplate(name)) callService(path, "PUT", name, readTemplate(name))
case "listtypes": case "listtypes":
callService("types", "GET", name, nil) callService("types", "GET", name, nil)
case "gettype": case "listtypeinstances":
path := fmt.Sprintf("types/%s/instances", name) path := fmt.Sprintf("types/%s/instances", url.QueryEscape(name))
callService(path, "GET", name, nil) callService(path, "GET", name, nil)
} }
} }
...@@ -84,7 +84,7 @@ func callService(path, method, name string, reader io.ReadCloser) { ...@@ -84,7 +84,7 @@ func callService(path, method, name string, reader io.ReadCloser) {
action = "deploy" action = "deploy"
} }
u := fmt.Sprintf("%s/%s", *service, url.QueryEscape(path)) u := fmt.Sprintf("%s/%s", *service, path)
request, err := http.NewRequest(method, u, reader) request, err := http.NewRequest(method, u, reader)
request.Header.Add("Content-Type", "application/json") request.Header.Add("Content-Type", "application/json")
response, err := http.DefaultClient.Do(request) response, err := http.DefaultClient.Do(request)
......
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