Giter Club home page Giter Club logo

giji-rtwo's Introduction

rtwo

Build Status

A unified interface into multiple cloud providers.

Built on top of Apache libcloud with support for modern OpenStack. Also supports legacy Eucalyptus 2.x and AWS.

Install

pip install rtwo

Or from source

pip install -e git://github.com/cyverse/rtwo#egg=rtwo

Use

In [1]: import rtwo

In [2]: from rtwo.provider import OSProvider

In [3]: from rtwo.identity import OSIdentity

In [4]: from rtwo.driver import OSDriver

In [5]: from rtwo.accounts.openstack import AccountDriver

In [6]: osp = OSProvider()

In [7]: ad = AccountDriver()

In [8]: ad.create_account("awesomeo")
Out[8]: 
(<User {u'email': u'[email protected]', u'tenantId': u'97dfaaebb0d943baa0cfa7cbd3bf24d5', u'enabled': True, u'name': u'awesomeo', u'id': u'
3d3ca254e7054fdcaa54f473e4d5b59f'}>,
 'yourpassword',
 <Tenant {u'enabled': True, u'description': None, u'name': u'awesomeo', u'id': u'97dfaaebb0d943baa0cfa7cbd3bf24d5'}>)
In [9]: osi = OSIdentity(osp, key=OPENSTACK_ADMIN_KEY, secret=OPENSTACK_ADMIN_SECRET, user="awesomeo", auth_url="http://openstack-server.org:port/v2.0", password=ad.hashpass("awesomeo"), region_name="ValhallaRegion", ex_tenant_name="awesomeo", username="awesomeo")

In [19]: osdriver = OSDriver(osp, osi)

In [11]: sizes = osdriver.list_sizes()

In [12]: machines = osdriver.list_machines()
In [13]: osdriver.create_instance(name="Lame.", image=machines[-1], size=sizes[1])
Out[13]: <class 'rtwo.instance.OSInstance'> {'name': 'Lame.', 'ip': None, 'machine': {'alias': '7819f88b-b335-449d-b17f-ed3af350c918', 'provider': 'OpenStack', 'id': '7819f88b-b335-449d-b17f-ed3af350c918', 'name': 'Ubuntu 12.04 NoGui 4GB 64-bit bare'}, 'alias': '2b3a1021-aaed-439f-a6b6-5e6f1a9d1fd5', 'provider': 'OpenStack', 'id': '2b3a1021-aaed-439f-a6b6-5e6f1a9d1fd5', 'size': {'alias': '2', 'bandwidth': None, 'disk': 10, 'name': 'm1.small', 'price': 0.0, 'ram': 2048, 'id': 'm1.small', 'cpu': 1}}
In [14]: osdriver.list_instances()
Out[14]: [<class 'rtwo.instance.OSInstance'> {'name': 'Lame.', 'ip': None, 'machine': {'alias': '7819f88b-b335-449d-b17f-ed3af350c918', 'provider': 'OpenStack', 'id': '7819f88b-b335-449d-b17f-ed3af350c918', 'name': 'Ubuntu 12.04 NoGui 4GB 64-bit bare'}, 'alias': '2b3a1021-aaed-439f-a6b6-5e6f1a9d1fd5', 'provider': 'OpenStack', 'id': '2b3a1021-aaed-439f-a6b6-5e6f1a9d1fd5', 'size': {'alias': '2', 'bandwidth': None, 'disk': 10, 'name': 'm1.small', 'price': 0.0, 'ram': 2048, 'id': 'm1.small', 'cpu': 1}}]

License

See LICENSE file.

giji-rtwo's People

Contributors

steve-gregory avatar jmatt avatar xuhang57 avatar lenards avatar cjlarose avatar julianpistorius avatar nfaction avatar jmlowe avatar

Watchers

Orran Krieger avatar James Cloos avatar  avatar Peter Desnoyers avatar Kristi Nikolla avatar  avatar  avatar

Forkers

rob-baron

giji-rtwo's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.