2016-11-05 17:09:05 -07:00
|
|
|
/*
|
|
|
|
|
Copyright 2016 The Rook Authors. All rights reserved.
|
|
|
|
|
|
|
|
|
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
|
you may not use this file except in compliance with the License.
|
|
|
|
|
You may obtain a copy of the License at
|
|
|
|
|
|
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
|
|
|
|
|
|
Unless required by applicable law or agreed to in writing, software
|
|
|
|
|
distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
|
See the License for the specific language governing permissions and
|
|
|
|
|
limitations under the License.
|
|
|
|
|
*/
|
2016-09-15 13:52:55 -07:00
|
|
|
package api
|
|
|
|
|
|
2017-03-10 19:00:27 -08:00
|
|
|
import (
|
|
|
|
|
"net/http"
|
|
|
|
|
|
|
|
|
|
"github.com/prometheus/client_golang/prometheus/promhttp"
|
|
|
|
|
)
|
|
|
|
|
|
2016-09-15 13:52:55 -07:00
|
|
|
func (h *Handler) GetRoutes() []Route {
|
|
|
|
|
return []Route{
|
2016-10-27 11:11:54 -07:00
|
|
|
{
|
|
|
|
|
"GetStatusDetails",
|
|
|
|
|
"GET",
|
|
|
|
|
"/status",
|
|
|
|
|
h.GetStatusDetails,
|
|
|
|
|
},
|
2016-09-15 13:52:55 -07:00
|
|
|
{
|
|
|
|
|
"GetNodes",
|
|
|
|
|
"GET",
|
|
|
|
|
"/node",
|
|
|
|
|
h.GetNodes,
|
|
|
|
|
},
|
2016-09-20 15:20:17 -07:00
|
|
|
{
|
|
|
|
|
"GetPools",
|
|
|
|
|
"GET",
|
|
|
|
|
"/pool",
|
|
|
|
|
h.GetPools,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"CreatePool",
|
|
|
|
|
"POST",
|
|
|
|
|
"/pool",
|
|
|
|
|
h.CreatePool,
|
|
|
|
|
},
|
2017-10-12 16:08:08 -07:00
|
|
|
{
|
|
|
|
|
"DeletePool",
|
|
|
|
|
"DELETE",
|
|
|
|
|
"/pool/{name}",
|
|
|
|
|
h.DeletePool,
|
|
|
|
|
},
|
2016-09-30 12:56:56 -07:00
|
|
|
{
|
|
|
|
|
"GetImages",
|
|
|
|
|
"GET",
|
|
|
|
|
"/image",
|
|
|
|
|
h.GetImages,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"CreateImage",
|
|
|
|
|
"POST",
|
|
|
|
|
"/image",
|
|
|
|
|
h.CreateImage,
|
|
|
|
|
},
|
2017-03-20 21:38:03 -07:00
|
|
|
{
|
|
|
|
|
"DeleteImage",
|
2017-03-21 21:17:18 -07:00
|
|
|
"DELETE",
|
|
|
|
|
"/image",
|
2017-03-20 21:38:03 -07:00
|
|
|
h.DeleteImage,
|
|
|
|
|
},
|
2016-09-30 12:56:56 -07:00
|
|
|
{
|
2016-11-28 17:38:06 -08:00
|
|
|
"GetClientAccessInfo",
|
2016-09-30 12:56:56 -07:00
|
|
|
"GET",
|
2016-11-28 17:38:06 -08:00
|
|
|
"/client",
|
|
|
|
|
h.GetClientAccessInfo,
|
2016-09-30 12:56:56 -07:00
|
|
|
},
|
2017-09-11 14:58:13 -07:00
|
|
|
{
|
|
|
|
|
"GetObjectStores",
|
|
|
|
|
"GET",
|
|
|
|
|
"/objectstore",
|
|
|
|
|
h.GetObjectStores,
|
|
|
|
|
},
|
2016-11-22 13:24:08 -08:00
|
|
|
{
|
|
|
|
|
"CreateObjectStore",
|
|
|
|
|
"POST",
|
|
|
|
|
"/objectstore",
|
|
|
|
|
h.CreateObjectStore,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"RemoveObjectStore",
|
2017-03-21 21:17:18 -07:00
|
|
|
"DELETE",
|
2017-09-14 16:11:20 -07:00
|
|
|
"/objectstore/{name}",
|
2016-11-22 13:24:08 -08:00
|
|
|
h.RemoveObjectStore,
|
|
|
|
|
},
|
2016-12-02 16:57:41 -08:00
|
|
|
{
|
|
|
|
|
"GetObjectStoreConnectionInfo",
|
|
|
|
|
"GET",
|
2017-09-14 16:11:20 -07:00
|
|
|
"/objectstore/{name}/connectioninfo",
|
2016-12-02 16:57:41 -08:00
|
|
|
h.GetObjectStoreConnectionInfo,
|
|
|
|
|
},
|
2017-02-03 13:16:36 -08:00
|
|
|
{
|
|
|
|
|
"ListUsers",
|
|
|
|
|
"GET",
|
2017-09-14 16:11:20 -07:00
|
|
|
"/objectstore/{name}/users",
|
2017-02-03 13:16:36 -08:00
|
|
|
h.ListUsers,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"GetUser",
|
|
|
|
|
"GET",
|
2017-09-14 16:11:20 -07:00
|
|
|
"/objectstore/{name}/users/{id}",
|
2017-02-03 13:16:36 -08:00
|
|
|
h.GetUser,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"CreateUser",
|
|
|
|
|
"POST",
|
2017-09-14 16:11:20 -07:00
|
|
|
"/objectstore/{name}/users",
|
2017-02-03 13:16:36 -08:00
|
|
|
h.CreateUser,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"UpdateUser",
|
|
|
|
|
"PUT",
|
2017-09-14 16:11:20 -07:00
|
|
|
"/objectstore/{name}/users/{id}",
|
2017-02-03 13:16:36 -08:00
|
|
|
h.UpdateUser,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"DeleteUser",
|
|
|
|
|
"DELETE",
|
2017-09-14 16:11:20 -07:00
|
|
|
"/objectstore/{name}/users/{id}",
|
2017-02-03 13:16:36 -08:00
|
|
|
h.DeleteUser,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"ListBuckets",
|
|
|
|
|
"GET",
|
2017-09-14 16:11:20 -07:00
|
|
|
"/objectstore/{name}/buckets",
|
2017-03-07 14:38:55 -08:00
|
|
|
h.ListBuckets,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"GetBucket",
|
|
|
|
|
"GET",
|
2017-09-14 16:11:20 -07:00
|
|
|
"/objectstore/{name}/buckets/{bucketName}",
|
2017-03-07 14:38:55 -08:00
|
|
|
h.GetBucket,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"DeleteBucket",
|
|
|
|
|
"DELETE",
|
2017-09-14 16:11:20 -07:00
|
|
|
"/objectstore/{name}/buckets/{bucketName}",
|
2017-03-07 14:38:55 -08:00
|
|
|
h.DeleteBucket,
|
2017-02-03 13:16:36 -08:00
|
|
|
},
|
2016-11-28 17:38:06 -08:00
|
|
|
{
|
|
|
|
|
"GetFileSystems",
|
|
|
|
|
"GET",
|
|
|
|
|
"/filesystem",
|
|
|
|
|
h.GetFileSystems,
|
|
|
|
|
},
|
2016-11-21 14:24:49 -08:00
|
|
|
{
|
|
|
|
|
"CreateFileSystem",
|
|
|
|
|
"POST",
|
|
|
|
|
"/filesystem",
|
|
|
|
|
h.CreateFileSystem,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"RemoveFileSystem",
|
2017-03-21 21:17:18 -07:00
|
|
|
"DELETE",
|
|
|
|
|
"/filesystem",
|
2016-11-21 14:24:49 -08:00
|
|
|
h.RemoveFileSystem,
|
|
|
|
|
},
|
2016-11-11 17:37:08 -08:00
|
|
|
{
|
|
|
|
|
"SetLogLevel",
|
|
|
|
|
"POST",
|
|
|
|
|
"/log",
|
|
|
|
|
h.SetLogLevel,
|
|
|
|
|
},
|
2017-03-10 19:00:27 -08:00
|
|
|
{
|
|
|
|
|
"GetMetrics",
|
|
|
|
|
"GET",
|
|
|
|
|
"/metrics",
|
|
|
|
|
promhttp.Handler().(http.HandlerFunc),
|
|
|
|
|
},
|
2016-09-15 13:52:55 -07:00
|
|
|
}
|
|
|
|
|
}
|