Merge pull request #11 from platform9/api-version-urls
Add API version to URLs
This commit is contained in:
+15
-15
@@ -78,23 +78,23 @@ func (api *API) serve(port int) {
|
||||
r := mux.NewRouter()
|
||||
r.HandleFunc("/", api.HomeHandler)
|
||||
|
||||
r.HandleFunc("/functions", api.FunctionApiList).Methods("GET")
|
||||
r.HandleFunc("/functions", api.FunctionApiCreate).Methods("POST")
|
||||
r.HandleFunc("/functions/{function}", api.FunctionApiGet).Methods("GET")
|
||||
r.HandleFunc("/functions/{function}", api.FunctionApiUpdate).Methods("PUT")
|
||||
r.HandleFunc("/functions/{function}", api.FunctionApiDelete).Methods("DELETE")
|
||||
r.HandleFunc("/v1/functions", api.FunctionApiList).Methods("GET")
|
||||
r.HandleFunc("/v1/functions", api.FunctionApiCreate).Methods("POST")
|
||||
r.HandleFunc("/v1/functions/{function}", api.FunctionApiGet).Methods("GET")
|
||||
r.HandleFunc("/v1/functions/{function}", api.FunctionApiUpdate).Methods("PUT")
|
||||
r.HandleFunc("/v1/functions/{function}", api.FunctionApiDelete).Methods("DELETE")
|
||||
|
||||
r.HandleFunc("/triggers/http", api.HTTPTriggerApiList).Methods("GET")
|
||||
r.HandleFunc("/triggers/http", api.HTTPTriggerApiCreate).Methods("POST")
|
||||
r.HandleFunc("/triggers/http/{httpTrigger}", api.HTTPTriggerApiGet).Methods("GET")
|
||||
r.HandleFunc("/triggers/http/{httpTrigger}", api.HTTPTriggerApiUpdate).Methods("PUT")
|
||||
r.HandleFunc("/triggers/http/{httpTrigger}", api.HTTPTriggerApiDelete).Methods("DELETE")
|
||||
r.HandleFunc("/v1/triggers/http", api.HTTPTriggerApiList).Methods("GET")
|
||||
r.HandleFunc("/v1/triggers/http", api.HTTPTriggerApiCreate).Methods("POST")
|
||||
r.HandleFunc("/v1/triggers/http/{httpTrigger}", api.HTTPTriggerApiGet).Methods("GET")
|
||||
r.HandleFunc("/v1/triggers/http/{httpTrigger}", api.HTTPTriggerApiUpdate).Methods("PUT")
|
||||
r.HandleFunc("/v1/triggers/http/{httpTrigger}", api.HTTPTriggerApiDelete).Methods("DELETE")
|
||||
|
||||
r.HandleFunc("/environments", api.EnvironmentApiList).Methods("GET")
|
||||
r.HandleFunc("/environments", api.EnvironmentApiCreate).Methods("POST")
|
||||
r.HandleFunc("/environments/{environment}", api.EnvironmentApiGet).Methods("GET")
|
||||
r.HandleFunc("/environments/{environment}", api.EnvironmentApiUpdate).Methods("PUT")
|
||||
r.HandleFunc("/environments/{environment}", api.EnvironmentApiDelete).Methods("DELETE")
|
||||
r.HandleFunc("/v1/environments", api.EnvironmentApiList).Methods("GET")
|
||||
r.HandleFunc("/v1/environments", api.EnvironmentApiCreate).Methods("POST")
|
||||
r.HandleFunc("/v1/environments/{environment}", api.EnvironmentApiGet).Methods("GET")
|
||||
r.HandleFunc("/v1/environments/{environment}", api.EnvironmentApiUpdate).Methods("PUT")
|
||||
r.HandleFunc("/v1/environments/{environment}", api.EnvironmentApiDelete).Methods("DELETE")
|
||||
|
||||
address := fmt.Sprintf(":%v", port)
|
||||
|
||||
|
||||
@@ -74,7 +74,7 @@ func (c *Client) put(relativeUrl string, contentType string, body []byte) (*http
|
||||
}
|
||||
|
||||
func (c *Client) url(relativeUrl string) string {
|
||||
return c.Url + "/" + relativeUrl
|
||||
return c.Url + "/v1/" + relativeUrl
|
||||
}
|
||||
|
||||
func (c *Client) handleResponse(resp *http.Response) ([]byte, error) {
|
||||
|
||||
Reference in New Issue
Block a user