AsyncOpenStackClient


NameAsyncOpenStackClient JSON
Version 0.9.0 PyPI version JSON
download
home_pagehttps://github.com/DreamLab/AsyncOpenStackClient
SummaryBasic OpenStack async client library using asyncio
upload_time2022-06-06 11:05:56
maintainer
docs_urlNone
authorDreamlab - PaaS KRK
requires_python
license
keywords iaas cloud openstack nova glance async
VCS
bugtrack_url
requirements aiohttp simplejson simple-rest-client python-dateutil
Travis-CI
coveralls test coverage
            AsyncOpenStackClient
====================

|image0|_ |image1|_

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

.. |image1| image:: https://badge.fury.io/py/AsyncOpenStackClient.svg
.. _image1: https://badge.fury.io/py/AsyncOpenStackClient



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

The `AsyncOpenStackClient` is a asynchronous rest wrapper for the OpenStack API. It provides a nice abstraction for authentication. For method specification, see the official OpenStack documentation: https://docs.openstack.org/queens/api/.


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

Use pip:

::

    pip install AsyncOpenStackClient


Usage
=====

.. code-block:: python

    from asyncopenstackclient import NovaClient, GlanceClient, CinderClient, AuthPassword

    # you can either pass credentials explicitly (as shown below)
    # or use environmental variables from OpenStack RC file
    # https://docs.openstack.org/mitaka/cli-reference/common/cli_set_environment_variables_using_openstack_rc.html
    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'
    )

    # alternatively you can also use application_credentials to authenticate with the OpenStack Keystone API
    # https://docs.openstack.org/keystone/queens/user/application_credentials.html
    alternative_auth = AuthPassword(
        auth_url='https://keystone:5999/v3'
        application_credential_id="ID",
        application_credential_secret="SECRET"
    )

    nova = NovaClient(session=auth)
    glance = GlanceClient(session=auth)
    cinder = CinderClient(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()
    await cinder.init_api()


    servers = await nova.servers.list(name='testvm')
    vm = await nova.servers.get(server_id)

    action_spec = {'os-stop': None}
    await nova.servers.run_action(server_id, **action_spec)


    specs = {
        "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.servers.create(server=specs)
    print(response)

    volume = {"size": 200,
              "imageRef": "image_id",
              "name": "some_name"}

    response = await cinder.volumes.create(volume=volume)
    print(response)

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

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

  - servers.list(optional=filter)  # params optional
  - servers.get(id)
  - servers.create(server=server_spec)
  - servers.force_delete(id)
  - servers.run_action(id, action=action_spec)
  - flavors.list()
  - metadata.get(server_id)
  - metadata.set(server_id, meta=meta_spec)
  - metadata.get_item(server_id, item_name)
  - metadata.set_item(server_id, item_name, meta=meta_spec)

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

  - images.list()

- Cinder (https://developer.openstack.org/api-ref/block-storage/v3/index.html)

  - volumes.list(optional=filter)  # params optional
  - volumes.get(id)
  - volumes.create(volume=volume_spec)
  - volumes.force_delete(id)


License
=======

`Apache License 2.0 <LICENSE>`_

Changelog
=========


0.9.0 (2022-06-06)
------------------

* Fixed: upgrade urllib3
* Feature: support for application credentials
  
0.8.2 (2021-03-28)
------------------

* Fixed: upgrade dependencies (aiohttp)

0.8.1 (2019-04-03)
------------------

* Fixed: upgrade dependencies (urllib3: CVE-2018-20060)

0.8.0 (2018-08-19)
------------------

* Feature: another part of compute API - run an action on server
* Feature: CD configuration

0.7.0 (2018-06-15)
------------------

* Feature: Cinder implementation
* Bugfix: typo fixes

0.6.3 (2018-06-13)
------------------

* Feature: adjustable request timeout, default is 60s now


0.6.2 (2018-05-18)
------------------

* Bugfix: initialize property (api) in Client to get some meaningful error instead of "recursion limit reached".


0.6.0 (2018-05-12)
------------------

* Feature: wrap requests with Resource/Method proxy


0.5.2 (2018-05-10)
------------------

* Bugfix: adding slash at the end of api_root_url


0.5.1 (2018-04-29)
------------------

* Bugfix: update README with metadata entry and envs notice


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
            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/DreamLab/AsyncOpenStackClient",
    "name": "AsyncOpenStackClient",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "iaas,cloud,openstack,nova,glance,async",
    "author": "Dreamlab - PaaS KRK",
    "author_email": "paas-support@dreamlab.pl",
    "download_url": "https://files.pythonhosted.org/packages/21/99/2cc66cd9df159f69dbc72b56f50f977da7d8c7b4496c750b06132a22f699/AsyncOpenStackClient-0.9.0.tar.gz",
    "platform": null,
    "description": "AsyncOpenStackClient\n====================\n\n|image0|_ |image1|_\n\n.. |image0| image:: https://api.travis-ci.org/DreamLab/AsyncOpenStackClient.png?branch=master\n.. _image0: https://travis-ci.org/DreamLab/AsyncOpenStackClient\n\n.. |image1| image:: https://badge.fury.io/py/AsyncOpenStackClient.svg\n.. _image1: https://badge.fury.io/py/AsyncOpenStackClient\n\n\n\nIntroduction\n============\n\nThe `AsyncOpenStackClient` is a asynchronous rest wrapper for the OpenStack API. It provides a nice abstraction for authentication. For method specification, see the official OpenStack documentation: https://docs.openstack.org/queens/api/.\n\n\nInstallation\n============\n\nUse pip:\n\n::\n\n    pip install AsyncOpenStackClient\n\n\nUsage\n=====\n\n.. code-block:: python\n\n    from asyncopenstackclient import NovaClient, GlanceClient, CinderClient, AuthPassword\n\n    # you can either pass credentials explicitly (as shown below)\n    # or use environmental variables from OpenStack RC file\n    # https://docs.openstack.org/mitaka/cli-reference/common/cli_set_environment_variables_using_openstack_rc.html\n    auth = AuthPassword(\n        auth_url='https://keystone:5999/v3'\n        username='USER', password='PASS',\n        project_name='my-project',\n        user_domain_name='default',\n        project_domain_name='foo.bar'\n    )\n\n    # alternatively you can also use application_credentials to authenticate with the OpenStack Keystone API\n    # https://docs.openstack.org/keystone/queens/user/application_credentials.html\n    alternative_auth = AuthPassword(\n        auth_url='https://keystone:5999/v3'\n        application_credential_id=\"ID\",\n        application_credential_secret=\"SECRET\"\n    )\n\n    nova = NovaClient(session=auth)\n    glance = GlanceClient(session=auth)\n    cinder = CinderClient(session=auth)\n\n    # api url for each service will be taken from catalog,\n    # but you may pass `api_url` param to force custom url eg.\n    # nova = NovaClient(session=auth, api_url='http://my-local-nova:9876/v2/')\n\n    await nova.init_api()\n    await glance.init_api()\n    await cinder.init_api()\n\n\n    servers = await nova.servers.list(name='testvm')\n    vm = await nova.servers.get(server_id)\n\n    action_spec = {'os-stop': None}\n    await nova.servers.run_action(server_id, **action_spec)\n\n\n    specs = {\n        \"name\": 'some_name',\n        \"flavorRef\": 'flavor_id',\n        \"imageRef\": 'image_id',\n        \"security_groups\": [{'name': 'group1'}, {'name': 'group2'}]\n        \"user_data\": base64.b64encode(userdata).decode('utf-8')\n    }\n    response = await nova.servers.create(server=specs)\n    print(response)\n\n    volume = {\"size\": 200,\n              \"imageRef\": \"image_id\",\n              \"name\": \"some_name\"}\n\n    response = await cinder.volumes.create(volume=volume)\n    print(response)\n\nAvailable functions\n-------------------\n\n- Nova (https://developer.openstack.org/api-ref/compute)\n\n  - servers.list(optional=filter)  # params optional\n  - servers.get(id)\n  - servers.create(server=server_spec)\n  - servers.force_delete(id)\n  - servers.run_action(id, action=action_spec)\n  - flavors.list()\n  - metadata.get(server_id)\n  - metadata.set(server_id, meta=meta_spec)\n  - metadata.get_item(server_id, item_name)\n  - metadata.set_item(server_id, item_name, meta=meta_spec)\n\n- Glance (https://developer.openstack.org/api-ref/image/v2/index.html)\n\n  - images.list()\n\n- Cinder (https://developer.openstack.org/api-ref/block-storage/v3/index.html)\n\n  - volumes.list(optional=filter)  # params optional\n  - volumes.get(id)\n  - volumes.create(volume=volume_spec)\n  - volumes.force_delete(id)\n\n\nLicense\n=======\n\n`Apache License 2.0 <LICENSE>`_\n\nChangelog\n=========\n\n\n0.9.0 (2022-06-06)\n------------------\n\n* Fixed: upgrade urllib3\n* Feature: support for application credentials\n  \n0.8.2 (2021-03-28)\n------------------\n\n* Fixed: upgrade dependencies (aiohttp)\n\n0.8.1 (2019-04-03)\n------------------\n\n* Fixed: upgrade dependencies (urllib3: CVE-2018-20060)\n\n0.8.0 (2018-08-19)\n------------------\n\n* Feature: another part of compute API - run an action on server\n* Feature: CD configuration\n\n0.7.0 (2018-06-15)\n------------------\n\n* Feature: Cinder implementation\n* Bugfix: typo fixes\n\n0.6.3 (2018-06-13)\n------------------\n\n* Feature: adjustable request timeout, default is 60s now\n\n\n0.6.2 (2018-05-18)\n------------------\n\n* Bugfix: initialize property (api) in Client to get some meaningful error instead of \"recursion limit reached\".\n\n\n0.6.0 (2018-05-12)\n------------------\n\n* Feature: wrap requests with Resource/Method proxy\n\n\n0.5.2 (2018-05-10)\n------------------\n\n* Bugfix: adding slash at the end of api_root_url\n\n\n0.5.1 (2018-04-29)\n------------------\n\n* Bugfix: update README with metadata entry and envs notice\n\n\n0.5.0 (2018-04-25)\n------------------\n\n* Feature: partial support for server metadata usage\n\n\n0.4.1 (2018-04-25)\n------------------\n\n* Bugifx: invalid concat auth_url with urljoin\n\n\n0.4.0 (2018-04-16)\n------------------\n\n* Feature: use `OS_` variables if present\n\n\n0.3.0 (2018-04-13)\n------------------\n\n* Feature: accept to pass api_url\n* Feature: determine api url if catalog provide incomplete one (eg. without version)\n\n\n0.2.3 (2018-04-05)\n------------------\n\n* Bugfix: do_not_await_sync_method\n\n\n0.2.2 (2018-04-02)\n------------------\n\n* Update simple-rest-client (fixed logging)\n\n\n0.2.1 (2018-03-28)\n------------------\n\n* fix tests, cov report,  MANIFEST.in\n\n\n0.1.1 (2018-03-02)\n------------------\n\n* Update MANIFEST.in\n\n0.1.0 (2018-02-15)\n------------------\n\n* First approach to build async openstack client library for Python3",
    "bugtrack_url": null,
    "license": "",
    "summary": "Basic OpenStack async client library using asyncio",
    "version": "0.9.0",
    "split_keywords": [
        "iaas",
        "cloud",
        "openstack",
        "nova",
        "glance",
        "async"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "md5": "c7ec35f6ce34547ed35f5f330019f86c",
                "sha256": "9910744b6350ab4059216a3bddb98a1eb79f591d4627164ce98ac68be919d254"
            },
            "downloads": -1,
            "filename": "AsyncOpenStackClient-0.9.0.tar.gz",
            "has_sig": false,
            "md5_digest": "c7ec35f6ce34547ed35f5f330019f86c",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 25298,
            "upload_time": "2022-06-06T11:05:56",
            "upload_time_iso_8601": "2022-06-06T11:05:56.344587Z",
            "url": "https://files.pythonhosted.org/packages/21/99/2cc66cd9df159f69dbc72b56f50f977da7d8c7b4496c750b06132a22f699/AsyncOpenStackClient-0.9.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2022-06-06 11:05:56",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "DreamLab",
    "github_project": "AsyncOpenStackClient",
    "travis_ci": true,
    "coveralls": true,
    "github_actions": false,
    "requirements": [
        {
            "name": "aiohttp",
            "specs": [
                [
                    ">=",
                    "3"
                ]
            ]
        },
        {
            "name": "simplejson",
            "specs": [
                [
                    "==",
                    "3.16.0"
                ]
            ]
        },
        {
            "name": "simple-rest-client",
            "specs": [
                [
                    "==",
                    "0.5.4"
                ]
            ]
        },
        {
            "name": "python-dateutil",
            "specs": [
                [
                    "==",
                    "2.8.0"
                ]
            ]
        }
    ],
    "tox": true,
    "lcname": "asyncopenstackclient"
}
        
Elapsed time: 0.01372s