Asynchronous client library for LXD REST API
Project description
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:
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()
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
asynclxd-0.0.1.tar.gz
(27.6 kB
view details)
File details
Details for the file asynclxd-0.0.1.tar.gz
.
File metadata
- Download URL: asynclxd-0.0.1.tar.gz
- Upload date:
- Size: 27.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.4.2 requests/2.21.0 setuptools/41.1.0 requests-toolbelt/0.8.0 tqdm/4.30.0 CPython/3.7.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2ecf222ee2195f2141e505194fb07f852ad9729b6f9b1def8425bd382d01b3d5 |
|
MD5 | 8587d36264ae5c78f54e76f8f01b62a4 |
|
BLAKE2b-256 | a1be53515721003c9fe718c4090734adb0a0cb93eacffa5cb4196d118db80f46 |