aliyun swarm api
Project description
pip install
pip install aliyunswarm
集群接入点地址:
参考:
https://help.aliyun.com/document_detail/26063.html?spm=a2c4g.11186623.6.768.81bb2d05Wmhak0
Test
from aliyunswarm import *
if __name__ == "__main__":
swarm_api = SwarmApi("https://host:port/",
"/path/ca.pem",
"/path/cert.pem",
"/path/key.pem")
################################################
# applications api
################################################
# 查询全部应用
swarm_api.query_applications()
# 查询应用
swarm_api.query_applications('swarmtest')
# 创建应用
template = open('./compose/compose_ngx.yaml', 'r').read()
swarm_api.create_application(template, 'swarmtest', 'swarm test')
# 停止应用
swarm_api.stop_application('swarmtest')
# 启动应用
swarm_api.start_application('swarmtest')
# 终止应用
swarm_api.kill_application('swarmtest')
# 删除应用
swarm_api.delete_application('swarmtest')
# 重新部署应用
swarm_api.redeploy_application('swarmtest')
# 更新应用
template = open('./compose/compose_ngx.yaml', 'r').read()
swarm_api.update_application(template, 'swarmtest', 'swarmtest 2', version='2.0')
################################################
# services api
################################################
# 查询服务
swarm_api.query_services('api')
# 查询指定应用的服务
swarm_api.query_service('swarmtest', 'api')
# 启动指定应用的服务
swarm_api.start_service('swarmtest', 'api')
# 停止指定应用的服务
swarm_api.stop_service('swarmtest', 'api')
# 中止指定应用的服务
swarm_api.kill_service('swarmtest', 'api')
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
aliyunswarm-0.0.16.tar.gz
(3.9 kB
view hashes)
Built Distribution
Close
Hashes for aliyunswarm-0.0.16-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 75add67bfe8bc7cbfa8185ffef70bcd4d09dc0d68e86628653443ca567c1d665 |
|
MD5 | 3e37ed6b7a148900c722de9454c2d00e |
|
BLAKE2b-256 | 35190c551ed6dd343cdb230b43859ed2cf6ed7820692bb58c17ed23c0219c687 |