跳转到主要内容

LXD REST API的异步客户端库

项目描述

Latest Version Build Status Coverage Status

asyncLXD是一个基于asyncio的LXD REST API客户端库。

它提供了一个高级API,用于与LXD服务器上的资源交互,例如容器、镜像、网络、配置文件和存储。

LXD服务器可通过asynclxd.remote.Remote类访问,该类公开服务器细节和配置,以及资源集合的访问权限。

集合(如containersimagesprofilesnetworks等)允许创建和检索资源,这些资源可以进行修改、更新或删除。

例如

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()

项目详情


下载文件

下载适用于您平台的文件。如果您不确定选择哪个,请了解有关安装包的更多信息。

源分发

asynclxd-0.0.1.tar.gz (27.6 kB 查看散列)

上传时间:

由以下提供支持