Skip to main content

Basic OpenStack client library using asyncio

Project description

AsyncOpenStackClient
===================

|image0|_

.. |image0| image:: https://api.travis-ci.org/DreamLab/AsyncOpenStackClient.png?branch=master
.. _image0: https://travis-ci.org/DreamLab/AsyncOpenStackClient


Introduction
============

The `AsyncOpenStackClient` is a rest wrapper for the OpenStack API. It provides very raw functionality; however, it has a nice abstraction for authetication. For method specification, see the official OpenStack documentation: https://docs.openstack.org/queens/api/.


Installation
============

Use pip:

::

pip install AsyncOpenStackClient


Usage
=====

As mentioned above, this is a "raw" library, so you must handle `params` and/or `body` and the `response`.


.. code-block:: python

from asyncopenstackclient import NovaClient, GlanceClient, AuthPassword

auth = AuthPassword(
auth_url='https://keystone:5999/v3'
username='USER', password='PASS',
project_name='my-project',
user_domain_name='default',
project_domain_name='foo.bar'
)
nova = NovaClient(session=auth)
glance = GlanceClient(session=auth)

# api url for each service will be taken from catalog,
# but you may pass `api_url` param to force custom url eg.
# nova = NovaClient(session=auth, api_url='http://my-local-nova:9876/v2/')

await nova.init_api()
await glance.init_api()


servers = await nova.api.servers.list(params={'name': 'testvm'})
vm = await nova.api.servers.get(id)


body = {
"server": {
"name": 'some_name',
"flavorRef": 'flavor_id',
"imageRef": 'image_id',
"security_groups": [{'name': 'group1'}, {'name': 'group2'}]
"user_data": base64.b64encode(userdata).decode('utf-8')
}
}
response = await nova.api.servers.create(body=body)
print(response.body)


Available functions
-------------------

- Nova (https://developer.openstack.org/api-ref/compute)

- servers.list(params) # params optional
- servers.get(id)
- servers.create(body)
- servers.force_delete(id)
- flavors.list()

- Glance (https://developer.openstack.org/api-ref/image/v2/index.html)

- images.list()


License
=======

`Apache License 2.0 <LICENSE>`_

Changelog
=========

0.5.0 (2018-04-25)
------------------

* Feature: partial support for server metadata usage


0.4.1 (2018-04-25)
------------------

* Bugifx: invalid concat auth_url with urljoin


0.4.0 (2018-04-16)
------------------

* Feature: use `OS_` variables if present


0.3.0 (2018-04-13)
------------------

* Feature: accept to pass api_url
* Feature: determine api url if catalog provide incomplete one (eg. without version)


0.2.3 (2018-04-05)
------------------

* Bugfix: do_not_await_sync_method


0.2.2 (2018-04-02)
------------------

* Update simple-rest-client (fixed logging)


0.2.1 (2018-03-28)
------------------

* fix tests, cov report, MANIFEST.in


0.1.1 (2018-03-02)
------------------

* Update MANIFEST.in

0.1.0 (2018-02-15)
------------------

* First approach to build async openstack client library for Python3

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

AsyncOpenStackClient-0.5.0.tar.gz (18.5 kB view details)

Uploaded Source

File details

Details for the file AsyncOpenStackClient-0.5.0.tar.gz.

File metadata

File hashes

Hashes for AsyncOpenStackClient-0.5.0.tar.gz
Algorithm Hash digest
SHA256 7d1fe5520b712402c7df2a149cebe5c6dda278a8a3fa6c9c120440b784b06ff5
MD5 af14f26da5230c1a286deb7665a74005
BLAKE2b-256 0c58cd907e89c8e498dab59c9a8e7f9e2c798f9995ddd701b53f59a3a0ca7e9a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page