Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/albertodonato/asynclxd

Asynchronous client library for the LXD API
https://github.com/albertodonato/asynclxd

async asyncio lxd rest-api

Last synced: 6 days ago
JSON representation

Asynchronous client library for the LXD API

Awesome Lists containing this project

README

        

======================================================
asyncLXD - Asynchronous client library for the LXD API
======================================================

|Latest Version| |Build Status| |Coverage Status|

asyncLXD is an asyncio-based client library for the the LXD_ REST API.

It provides an high level API to interact with resources on LXD servers, such
as containers, images, networks, profiles and storage.

LXD servers are accessible through the `asynclxd.remote.Remote` class, which
exposes server details and configuration, as well as access to resource
collections.

Collections (such as `containers`, `images`, `profiles`, `networks`, ...) allow
creating and fetching resources, which can be modified, updated or deleted.

For example:

.. code:: python

from pprint import pprint

from asynclxd import lxc

# get all remotes defined in the client config
remotes = lxc.get_remotes()
async with remotes['local'] as remote:
# fetch all images and print their details
resp = await remote.images.read()
for image in resp:
resp = await image.read()
pprint(resp.metadata)
# image details have been read, now they're also cached (same
# output as above)
pprint(image.details())

# fetch a single container by name
container = await remote.containers.get('c')
pprint(container.details())
# rename it
await container.rename('new-c')
# change some details
await container.update({'description': 'foo'})
# and now delete it
await container.delete()

.. _LXD: https://linuxcontainers.org/lxd/

.. |Latest Version| image:: https://img.shields.io/pypi/v/asynclxd.svg
:alt: Latest Version
:target: https://pypi.python.org/pypi/asynclxd
.. |Build Status| image:: https://github.com/albertodonato/asynclxd/workflows/CI/badge.svg
:alt: Build Status
:target: https://github.com/albertodonato/asynclxd/actions?query=workflow%3ACI
.. |Coverage Status| image:: https://img.shields.io/codecov/c/github/albertodonato/asynclxd/main.svg
:alt: Coverage Status
:target: https://codecov.io/gh/albertodonato/asynclxd
.. |Documentation| image:: https://readthedocs.org/projects/asynclxd/badge/?version=stable
:alt: Documentation
:target: https://asynclxd.readthedocs.io/en/stable/?badge=stable