与ecs管理api交互的库

python-ecsclient的Python项目详细描述


Build StatusRead the docsPython VersionsVersionCoverage

这个库是用于Dell EMC Elastic Cloud Storage (ECS)的python软件开发工具包(sdk)。 它允许开发人员与ecs管理api交互。你可以找到 ecs api规范here

这个库是ECS Minion的后续库。

快速启动

您可以使用pip安装python-ecsclient

$ pip install python-ecsclient

创建ecsclient类的实例允许 参数:

NameRequiredDefault ValueDescription
^{tt2}$YesNoneVersion of the target ECS system. Options are ^{tt3}$ and ^{tt4}$
^{tt5}$NoNoneThe username used to fetch the ECS token
^{tt6}$NoNoneThe password used to fetch the ECS token
^{tt7}$NoNonePass a token to ECSClient (username/password are ignored then)
^{tt8}$YesNoneThe ECS API endpoint, ex: ^{tt9}$
^{tt10}$NoNoneThe ECS API endpoint, ex: ^{tt11}$
^{tt12}$NoFalseWhether to check a host’s SSL certificate
^{tt13}$No^{tt14}$The location to store the temporary token file
^{tt15}$No15.0Stop waiting for a response after a given number of seconds, this is a decimal value. Ex: 10.0 is ten seconds
^{tt16}$NoTrueWhether to cache the token, by default this is true you should only switch this to false when you want to directly fetch a token for a user

这就是如何实例化Client类并使用库的方法。

fromecsclient.clientimportClientclient=Client('3',username='ecsadmin@internal',password='PASSWORD',token_endpoint='https://192.168.0.149:4443/login',ecs_endpoint='https://192.168.0.149:4443')print(client.user_info.whoami())

查看我们的documentation以查找所有受支持的ecs端点和服务的列表。

提供代币

您可以将身份验证令牌直接传递给客户端,这意味着您 不需要提供用户名/密码。

client=Client('3',token='ALAcbGZtbjh6eVB3eUF1TzFEZWNmc0M2VVl2QjBVPQM',ecs_endpoint='https://192.168.1.146:4443')

令牌缓存

默认情况下,客户端缓存身份验证令牌。但是你可以禁用缓存 通过将cache_token参数设置为false。

client=Client('3',username='someone',password='password',token_endpoint='https://192.168.1.146:4443/login',ecs_endpoint='https://192.168.1.146:4443',cache_token=False)

或者,如果启用了令牌缓存,则可能需要强制客户端 在下次调用时获取新令牌。为此,可以删除缓存的令牌。

client.remove_cached_token()

支持的终结点

下表显示了每个API版本支持的终结点。

v2v3
Configuration
Certificate
Configuration Properties✓*✓*
Licensing
Feature
Syslog✓*
Snmp✓*
CAS
CAS User Profile✓*✓*
File System Access
NFS
Metering
Billing~~
Migration
Transformation
Monitoring
Capacity
Dashboard✓*✓*
Events✓*✓*
Alerts✓*✓*
Multi-tenancy
Namespace✓*✓*
Geo-Replication
Replication Group
Temporary Failed Zone✓*✓*
Provisioning
Base URL✓*✓*
Bucket✓*
Data Store✓*
Node~~
Storage Pool
Virtual Data Center
VDC Keystore
Support
Call Home
User Management
Authentication Provider~~
Password Group (Swift)
Secret Key
Secret Key Self-Service
User (Object)
User (Management)✓*
Other
Who am I

图例:

Supported and tested
✓*Supported but not tested yet
~Partially supported
Not supported yet
Not available in this API version

开发

开始

假设您安装了python和virtualenv,请设置 环境并安装所需的依赖项,而不是 上面定义的pip install python-ecsclient

$ git clone https://github.com/EMCECS/python-ecsclient.git
$ cd python-ecsclient
$ virtualenv venv
...
$ . venv/bin/activate
$ pip install -r requirements.txt

运行测试

您可以使用tox在所有受支持的python版本中运行测试。默认情况下, 它将运行所有单元测试,但您也可以指定自己的 nosetests选项。请注意,这要求您 安装了python的版本,否则必须传递-e,或运行 nosetests直接命令:

$ tox
$ tox -e py27,py35 tests/functional

您还可以使用默认的python版本运行单独的测试:

$ nosetests tests/unit

许可证

这个软件库是在apache许可证2.0下发布给您的。见 LICENSE 更多信息。


ECS是Dell EMC产品, 商标、版权等。

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java组织。springframework。jdbc。CannotGetJdbcConnectionException:无法获取JDBC连接;   java构造函数(int,int,string)未定义;在LWJGL中创建显示   java每当我调用一个函数时,静态函数是否会在类中自动被调用?   java如何为deck类toString方法编写函数   java分析堆使用JUnit JavaFx的内容   JavaJSF2+RichFaces在托管bean中设置变量时遇到问题   java Twitter API无法更新包含圆括号的状态   java Lucene LongField错误   Java正则表达式匹配零次或一次   通过linux中的java代码从windows共享使用数据的文件系统   java Android试图在不使用移动网络的情况下向自己发送虚假短信   Android ListView中的java增长堆   java CheckStyle检查未被忽略   数组java随机选取一个类/对象   java使用Jackson仅使用规范类型字符串反序列化JSON   使用两种编程语言生成的java UUID?   case equals方法中的java hashCode方法支持wildchar