Basic OpenStack client library using asyncio
Project description
AsyncOpenstakClient
Introduction
The AsyncOpenStakClient is rest wrapper to OpenStack API. It provides very raw functionality however, it has a nice abstraction for authetication. For method specification go to official OpenStack reference https://docs.openstack.org/queens/api/.
Installation
Use pip:
pip install AsyncOpenStackClient
Usage
As mentioned above this is “raw” library, so you must handle params and/or body and the response.
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(API_VERSION, session=auth)
glance = GlanceClient(session=auth)
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
Changelog
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Hashes for AsyncOpenStackClient-0.2.1.linux-x86_64.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 22ef37d69610d9d5410170a09b37199eb6bbcf42c8777f93b61c52a4a63a3dd9 |
|
MD5 | 6766cdfe8e817c1d9d2f9478e7d716d5 |
|
BLAKE2b-256 | 8568b7e66fec69507aa030801557a5fdd433d05723d7eb3358b560ffefe098f0 |