ovh命令行接口
ovhcli的Python项目详细描述
ovh cli
ovh命令行接口。
$ ovh webhosting config mydomain.fr +---------+-------------+----------------+---------------+------+--------+----------+ | #ID | Environment | Engine version | Container | Path | Engine | Firewall | +---------+-------------+----------------+---------------+------+--------+----------+ | 1994114 | production | 5.6 | stable | | php | security | +---------+-------------+----------------+---------------+------+--------+----------+ $ ovh webhosting config:update mydomain.fr --engine-version=7.0 [*] The configuration will be updated in a few seconds. $ ovh webhosting config mydomain.fr +---------+-------------+----------------+---------------+------+--------+----------+ | #ID | Environment | Engine version | Container | Path | Engine | Firewall | +---------+-------------+----------------+---------------+------+--------+----------+ | 2023413 | production | 7.0 | stable | | php | security | +---------+-------------+----------------+---------------+------+--------+----------+
安装
ovh cli与python 2.7+和python 3.3+一起工作。
获得最新稳定版本的最简单方法是使用pip:
$ pip install ovhcli
或者如果您没有使用virtualenv:
$ sudo pip install ovhcli
如果要升级:
$ pip install --upgrade ovhcli
或者,您可以直接从git获得最新的开发版本:
$ pip install -e git+https://github.com/ovh/ovh-cli.git#egg=ovh-cli
开始
cli使用公共ovh api来管理用户产品。一个setup命令 是为了帮助您创建所需的令牌:
$ ovh setup init Welcome to the OVH Cli. This tool uses the public OVH API to manage your products. In order to work, 3 tokens that you must generate are required : - the application key (AK) - the application secret (AS) - the consumer key (CK) What's your context : 1) You already have the keys (AK, AS and CK) 2) You just have AK and AS, the CK must be generated 3) You have no keys Your choice [1]: 3 [-] Please visit the following link to authenticate you and obtain your keys (AK, AS and CK) : [-] https://api.ovh.com/createToken/index.cgi?GET=/*&POST=/*&PUT=/*&DELETE=/* Press any key to continue ... Endpoint [ovh-eu]: ovh-eu Application key: <application key> Application secret: <application secret> Consumer key: <consumer key> [*] Configuration file created.
命令帮助
每个命令和子命令都提供一个--help参数:
$ ovh webhosting --help Usage: ovh webhosting [OPTIONS] COMMAND [ARGS]... Manage and configure your WebHosting products. Options: --help Show this message and exit. Commands: config Display the ovhConfig information. config:update Update the ovhConfig information. info Display information about a service. info:countries Display the service countries. info:quota Display the service quota. list List the services. users List the users of a service. users:create Add a new user to a service. users:remove Remove a user from a service. users:show Information about a user. users:update Update an existing user.
json输出
默认情况下,ovh cli以漂亮的表表示形式显示输出。如果可能,将提供一个--json参数来返回纯json格式的内容:
$ ovh webhosting users mydomain.fr --full +-------------+------+-------+--------+-----------------+ | Login | Home | State | Ssh | Primary account | +-------------+------+-------+--------+-----------------+ | johndoe | . | rw | active | True | | johndoe-foo | foo | rw | none | False | +-------------+------+-------+--------+-----------------+ $ ovh webhosting users mydomain.fr --full --json [{"iisRemoteRights": null, "sshState": "none", "webDavRights": null, "login": "johndoe-foo", "isPrimaryAccount": false, "state": "rw", "home": "foo"}, {"iisRemoteRights": null, "sshState": "active", "webDavRights": null, "login": "johndoe", "isPrimaryAccount": true, "state": "rw", "home": "."}]
贡献
请参阅CONTRIBUTING.rst以获取贡献指南。
许可证
3条款BSD