用于LXD REST API的异步客户端库
asynclxd的Python项目详细描述
asyncLXD是用于LXDRESTAPI的基于异步的客户端库。在
它提供了一个高级API来与LXD服务器上的资源交互,比如 作为容器、图像、网络、配置文件和存储。在
LXD服务器可通过访问异步XD.remote.remote类,其中 公开服务器详细信息和配置,以及对资源的访问 收藏。在
集合(例如容器,图像,配置文件,网络,…)允许 创建和获取资源,可以修改、更新或删除。在
例如:
frompprintimportpprintfromasynclxdimportlxc# get all remotes defined in the client configremotes=lxc.get_remotes()asyncwithremotes['local']asremote:# fetch all images and print their detailsresp=awaitremote.images.read()forimageinresp:resp=awaitimage.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 namecontainer=awaitremote.containers.get('c')pprint(container.details())# rename itawaitcontainer.rename('new-c')# change some detailsawaitcontainer.update({'description':'foo'})# and now delete itawaitcontainer.delete()
- 项目
标签: