Page tree
Skip to end of metadata
Go to start of metadata

RosettaHUB provides a rich API with almost 1000 public API functions to interact with the RosettaHUB platform: Platform Web Services and the RosettaHUB engines: Engine Web Services.

Platform web services allow you to perform all cloud governance tasks: manage users, cloud accounts, organizations, groups, budgets, access rights, etc. as well as manage RosettaHUB cloud artefacts (virtual labs, workspaces, formations, engines, machines, clusters, storages, file systems, disks, ssl certificates, domains). IT administrators can create their own applications by calling the RosettaHUB web services.

Below are some examples of how you can interact with the plaform using Python: Python Examples

Pyhton Examples

Install the Python module zeep

pip install zeep

List all members of a sub-organization

List Users
import zeep
platform = zeep.Client('').service
session = platform.newSession("cpoc.washington", "{PASSWORD}", 0 )
users = platform.cpocGetFederatedUsers(session, False, False, {'organizationName':'WASHINGTON'} );
for user in users:

List all cloud accounts

List Cloud Accounts Costs and Budgets
import zeep
platform = zeep.Client('').service
session = platform.newSession("cpoc.washington", "{PASSWORD}", 0 )
accounts = platform.cpocGetFederatedCloudAccounts(session, False, {'organizationName':'WASHINGTON-Researchers', 'cloudId':'aws','includeCustomization':False} );
for account in accounts:

Set a user's allowed cloud regions

Set cloud regions
import zeep
platform = zeep.Client('').service
session = platform.newSession("cpoc.washington", "{PASSWORD}", 0 )
platform.cpocSetAllowedRegions(session,["jim.educator"],"gcp",["europe-west1","europe-west4"], None)

List all sub-organization administrators, then add a new administrator

Add new administrators
import zeep
platform = zeep.Client('').service
session = platform.newSession("cpoc.washington", "{PASSWORD}", 0 )
orgs = platform.cpocGetFederatedOrganizations(session, False, True, True, {'organizationName':'*Big data*'})
platform.adminAssignAdminsToOrganization(session, orgs[0].organizationName, ['stuart.robinson'], False,None)

List all users, masquerade as individual users, retireve an STS session to access the user AWS account and list all EC2 instances

Masquerade and list EC2 instances by user
import zeep
import boto3
client = zeep.Client('')
platform = client.service
session = platform.newSession("{your_login}", "{your_password}", 0 )
users = platform.cpocGetFederatedUsers(session, False, False, False, {'organizationName':'WASHINGTON-Master of Science in Data Science'} , None);
for user in users:
    if user.enabled:
            stsSession=platform.getFederatedIamUserStsSession(session, user.login, 60*60, None) ;                
            client = boto3.resource(
            instances = client.instances.all()
            for instance in instances: 
                print(user.login+' : '+str(instance))
            print(user.login+' : '+'Failed to create STS')
Interact with engine
from zeep import Client
client = Client('')
platform = client.service
session = platform.newSession("{YOUR_LOGIN}", "{YOU_PASSWORD}", 0 )
engines = platform.getEngines(session, {'includePrivate':True,'includeShared':True, 'machineInstanceLabel':'*Data Science*' }, None);
esession=platform.newEngineSession(session, None, e.engineUid, [], 0,0, None);
kernel.console(esession, "x=c(5,66,66)", {'process':'R'}, asynch=False);
x=kernel.getObject(esession, "x", {'process':'R'});
kernel.console(esession, "abc=[55,66,66]", {'process':'Python'}, asynch=False);
abc=kernel.getObject(esession, "abc", {'process':'Python'});

Plaform Web Services

Engine Web Services

  • No labels