我想打印我帐户中可用的所有Analytics Engine实例。
我可以使用以下方式打印所有可用的组织和空间:
! pip install --quiet --upgrade git+https://github.com/snowch/ibm-analytics-engine-python@master
然后
from ibm_analytics_engine import CloudFoundryAPI, CloudFoundryAPI
from ibm_analytics_engine import IAE, IAEServicePlanGuid, IAEClusterSpecificationExamples
cf = CloudFoundryAPI(api_key_filename='api_key.json')
iae = IAE(cf_client=cf)
cf.print_orgs_and_spaces()
输出:
-------------------------------------------------------------------------
Org: me@me.com 12345-12345-12345678910
> Spc: dev 12345-12345-12345678912
> Spc: test 12345-12345-12345678913
-------------------------------------------------------------------------
Org: them@them.com aaaaa-bbbbb-ccccccccccc
> Spc: dev aaaaa-bbbbb-ccccccccccd
...
如何在这些空间中列出群集?
答案 0 :(得分:0)
您可以这样做:
! pip install --quiet --upgrade git+https://github.com/snowch/ibm-analytics-engine-python@master
然后
from ibm_analytics_engine import CloudFoundryAPI, CloudFoundryAPI
from ibm_analytics_engine import IAE, IAEServicePlanGuid, IAEClusterSpecificationExamples
cf = CloudFoundryAPI(api_key_filename='api_key.json')
iae = IAE(cf_client=cf)
import pprint
pp = pprint.PrettyPrinter(indent=4)
for org in cf.orgs_and_spaces():
for space in org['spaces']:
print('ORG {} | SPACE {}'.format(org['name'], space['name']))
print()
clusters = iae.clusters(space_guid=space['guid'])
if len(clusters) > 0:
for cluster in clusters:
pp.pprint(cluster)
print()
输出:
ORG me@me.com | SPACE dev
{ 'guid': 'abcd-abcd-abcdefghi',
'name': 'Analytics Engine',
'state': 'succeeded'}
ORG me@me.com | SPACE test
....