Преглед изворни кода

HUE-8330 [cluster] Convert to using the proxy command and not CLI

Romain Rigaux пре 7 година
родитељ
комит
3b06fa3a19

+ 19 - 0
desktop/libs/metadata/src/metadata/conf.py

@@ -158,6 +158,25 @@ OPTIMIZER = ConfigSection(
 )
 
 
+ALTUS = ConfigSection(
+  key='altus',
+  help=_t("""Configuration options for Altus API"""),
+  members=dict(
+
+    AUTH_KEY_ID=Config(
+      key="auth_key_id",
+      help=_t("The name of the key of the service."),
+      private=False,
+      default=None),
+    AUTH_KEY_SECRET=Config(
+      key="auth_key_secret",
+      help=_t("The private part of the key associated with the auth_key."),
+      private=True,
+      default=None)
+  )
+)
+
+
 def get_navigator_auth_type():
   return NAVIGATOR.AUTH_TYPE.get().lower()
 

+ 9 - 0
desktop/libs/notebook/src/notebook/connectors/altus.py

@@ -68,6 +68,15 @@ class SdxApi():
     ]
     """
 
+    from navoptapi.api_lib import ApiLib
+    from metadata.conf import ALTUS
+#     api_url = 'sdxapi.us-west-1.altus.cloudera.com'
+    api_url = 'sdxapi.gridlink-dev.cloudera.com'
+    api = ApiLib("sdx", api_url, ALTUS.AUTH_KEY_ID.get(), ALTUS.AUTH_KEY_SECRET.get().replace('\\n', '\n'))
+    resp = api.call_api('listNamespaces', {'maxItems': 100}) # {'clusterId' : cluster_id}
+    print resp
+    print resp.json()
+
     args = ['list-namespaces']
     
     if True: