Code Review
/
msb
/
service-mesh.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
review
|
tree
raw
(from parent 1:
b292c52
)
Merge "get data from consul"
author
Huabing Zhao
<zhaohuabing@gmail.com>
Thu, 2 Aug 2018 01:28:52 +0000
(
01:28
+0000)
committer
Gerrit Code Review
<gerrit@onap.org>
Thu, 2 Aug 2018 01:28:52 +0000
(
01:28
+0000)
msb2pilot/src/msb2pilot/consul/controller.go
patch
|
blob
|
history
diff --git
a/msb2pilot/src/msb2pilot/consul/controller.go
b/msb2pilot/src/msb2pilot/consul/controller.go
index
ca57bd2
..
1ba2cd8
100644
(file)
--- a/
msb2pilot/src/msb2pilot/consul/controller.go
+++ b/
msb2pilot/src/msb2pilot/consul/controller.go
@@
-71,3
+71,21
@@
func loadCfgInfo(path string) (map[interface{}]interface{}, error) {
}
return result, nil
}
+
+func GetServices() (map[string][]string, error) {
+ data, _, err := client.Catalog().Services(nil)
+
+ if err != nil {
+ return nil, err
+ }
+ return data, nil
+}
+
+func GetInstances(serviceName string) ([]*api.CatalogService, error) {
+ endpoints, _, err := client.Catalog().Service(serviceName, "", nil)
+ if err != nil {
+ log.Log.Error("can not get endpoints of ", serviceName)
+ return nil, err
+ }
+ return endpoints, nil
+}