solidfire python开发包

solidfire-sdk-python的Python项目详细描述


用于与solidfire元素api交互的python sdk库

pypypythonformatdownloadslicensebuild

当前版本

版本1.5.0.87

说明

solidfire python sdk是一个库的集合,它有助于 专有系统与 第三方应用程序。python sdk允许开发人员深入了解 将solidfire系统api与python编程语言集成。这个 solidfire python sdk减少了额外的编码时间 集成所必需的。

兼容性

ComponentVersion
SolidFire Element OS7.0 - 10.0

获取帮助

如果您对本产品有任何疑问或意见,请联系 ng-sf-host-integrations-sdk@netapp.com或者上网 位于ThePub的开发人员社区。你的反馈 帮助我们将精力集中在新的特性和功能上。

安装

来自pypi

pip install solidfire-sdk-python

来自源

note:建议使用 virtualenv用于隔离 python环境只提供所需的库。

或者,出于开发目的或检查来源, 以下操作将起作用:

git clone git@github.com:solidfire/solidfire-sdk-python.git
cd solidfire-sdk-python
git checkout develop
pip install -e ".[dev, test, docs, release]"
python setup.py install

然后将此目录的位置附加到PYTHONPATH 在其他python脚本中使用sdk的环境变量:

export PYTHONPATH=$PYTHONPATH:/path/to/sf-python-sdk/

就这样-你已经准备好开始和你的SolidFire互动了 使用python集群!

示例

步骤1-使用factory

这是构建 Element 反对。工厂将使用 提供用于测试连接的凭据。它还将设置 基于 sdk和element操作系统。也可以选择设置版本 手动以及是否验证ssl。在 ElementFactory文档。

fromsolidfire.factoryimportElementFactory# Use ElementFactory to get a SolidFireElement object.sfe=ElementFactory.create("ip-address-of-cluster","username","password")

步骤2-调用api方法并检索结果

solidfirelement中的所有服务方法都调用api端点 返回结果对象。命名约定是[method_name]_result。 例如,list_accounts返回一个list_accounts_result对象 它有一个名为accounts的属性,可以迭代。

此示例发送一个请求以列出帐户,然后提取第一个帐户 从add_account_result对象。

# Send the request and wait for the result then pull the AccountIDlist_accounts_result=sfe.list_accounts()account=list_accounts_result.accounts[0];

使用python sdk的更多示例

fromsolidfire.factoryimportElementFactory# Create connection to SF Clustersfe=ElementFactory.create("ip-address-of-cluster","username","password")# --------- EXAMPLE 1 - CREATE AN ACCOUNT -----------# Send the request with required parameters and gather the resultadd_account_result=sfe.add_account(username="example-account")# Pull the account ID from the result objectaccount_id=add_account_result.account_id# --------- EXAMPLE 2 - CREATE A VOLUME -------------# Send the request with required parameters and gather the resultcreate_volume_result=sfe.create_volume(name="example-volume",account_id=account_id,total_size=1000000000,enable512e=False)# Pull the VolumeID off the result objectvolume_id=create_volume_result.volume_id# --------- EXAMPLE 3 - LIST ONE VOLUME FOR AN ACCOUNT -------------# Send the request with desired parameters and pull the first volume in the# resultvolume=sfe.list_volumes(accounts=[account_id],limit=1).volumes[0]# pull the iqn from the volumeiqn=volume.iqn# --------- EXAMPLE 3 - MODIFY A VOLUME -------------# Send the request with the desired parameterssfe.modify_volume(volume_id=volume_id,total_size=2000000000)

更多示例

有更多具体的例子here

日志记录

要配置日志记录响应,请执行以下操作:

importloggingfromsolidfireimportcommoncommon.setLogLevel(logging.DEBUG)

要访问元素实例的记录器:

fromsolidfire.commonimportLOG

超时

连接超时(当主机变为 无法到达):

fromsolidfire.factoryimportElementFactorysfe=ElementFactory.create("ip-address-of-cluster","username","password")sfe.timeout(600)

读取超时(用于延长服务调用返回的时间):

fromsolidfire.factoryimportElementFactorysfe=ElementFactory.create("ip-address-of-cluster","username","password")sf.read_timeout(600)

许可证

版权所有©2016,2017 NetApp,Inc.保留所有权利。

根据apache许可证2.0版(以下简称“许可证”)授权;您可以 除非符合许可证,否则不要使用此文件。你可以获得 在

http://www.apache.org/licenses/LICENSE-2.0

除非适用法律要求或书面同意,否则软件 根据许可证分发是按“原样”分发的, 无任何明示或默示的保证或条件。 有关管理权限的特定语言和 许可下的限制。

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

推荐PyPI第三方库


热门话题
java如何在不影响项目中其他jtabbed窗格的情况下更改jtabbed窗格所选选项卡的颜色   java域模型映射器应该是静态的吗?   java使用javamail api在outllok中打开包含电子邮件作为附件的附加电子邮件   java Swagger扩展SwaggerSpecFilter   Java泛型数组类强制转换异常   java如何使用opencv计算人脸识别的百分比格式预测置信度?   jakarta ee Java ee:如何从web模块访问本地EJB?   java如何将变量传递到同一个包中的另一个类中   通过FTP在Java中上传文件   java似乎无法在JFrame中更新我的GridLayout。现在它增加了越来越多的帧,我只想更新它   java我的代码中有什么可以识别为病毒?   java在Android Studio中添加延迟计时器   javascript值更改事件并单击事件   java如何优雅地处理更新版本中的数据库升级?   java如何在Intellij Idea中切换到其他git帐户   无效的Java正则表达式   java使用相同的方法向字符串或其他对象的ArrayList添加元素   使用数组作为参数的java   java ASM拦截在方法外部进行的字段访问