|
|
@@ -1,6 +1,7 @@
|
|
|
package sdk
|
|
|
|
|
|
import (
|
|
|
+ "errors"
|
|
|
"git.sxidc.com/service-supports/ds-sdk/client"
|
|
|
"git.sxidc.com/service-supports/ds-sdk/grpc_client"
|
|
|
)
|
|
|
@@ -30,6 +31,25 @@ func InitInstance(token string, address string, httpPort string, grpcPort string
|
|
|
|
|
|
c := client.New(options.timeout)
|
|
|
|
|
|
+ namespaceInfos, err := c.GetNamespaces(options.token, options.baseUrl, options.namespace, 1, 1)
|
|
|
+ if err != nil {
|
|
|
+ return err
|
|
|
+ }
|
|
|
+
|
|
|
+ if namespaceInfos == nil || len(namespaceInfos) == 0 {
|
|
|
+ return errors.New("命名空间不存在")
|
|
|
+ }
|
|
|
+
|
|
|
+ dataSourceInfos, err := c.GetDataSources(
|
|
|
+ options.token, options.baseUrl, options.namespace, options.dataSource, "", 1, 1)
|
|
|
+ if err != nil {
|
|
|
+ return err
|
|
|
+ }
|
|
|
+
|
|
|
+ if dataSourceInfos == nil || len(dataSourceInfos) == 0 {
|
|
|
+ return errors.New("数据源不存在")
|
|
|
+ }
|
|
|
+
|
|
|
grpcClient, err := grpc_client.NewClient(options.grpcAddress)
|
|
|
if err != nil {
|
|
|
return err
|