用于创建对Dellemc Unity的请求的包。
dellemc-unity-sdk的Python项目详细描述
#自述文件
一个执行[ansible dellemc unity]的python模块(https://github.com/ansible-dellemc-unity/ansible-dellemc-unity)(dellemc unity的ansible模块)。
##如何安装这个sdk
<
Dellemc统一软件开发包
python setup.py sdist
sudo pip install dist/dellemc戋u unity戋sdk.xxxx.tar.gz
git clone https://github.com/ansible dellemc unity/dellemc unity sdk.git
cd dellemc unity sdk
python setup.py sdist bdist戋wheel
sudo pip install dist/dellemc_unity嫒u sdk-xxxx-pyy-none-any.whl
\how to write modules
根据我们的经验和[问题4](https://github.com/ansible-dellemc-unity/dellemc-unity-sdk/issues/4),
您应该在模块中创建ansible module的实例。因此,要创建参数库,应该使用:
``支持性函数。为扩展模块(字典数组)或支持性函数创建参数库。然后为扩展模块(模板)创建参数库要
``runner.run(ansible_module,template)`
\how to write templates for runner.run(…)
template是一个字典,应该有以下键:
1。`` constants.rest_object='rest_object'``此键的值应为rest object
2。`` constants.actions='actions'``此键的值应该是操作字典,
例如,{'create:{…}','delete':{…},…}
>若要自动执行操作,操作字典应该具有以下参数:
1。`` constants.action_type``此键的值应为``constants.actionType.update``或``constants.actionType.query``
2。`` constants.parameter\u types='parameter\u types'``此键的值应该是一个字典,该字典中应该有键:
'必选','可选',并且每个键的值都应该是iterable。
例如:
{
{
常量。rest\u对象:'pool',
常量。操作:{
‘删除’:
{常量。操作类型:常量。操作类型。更新,
常量。参数类型:参数全部。获取('delete')}
}
}
1模板的可选参数(键)。`` constants.rest_object_for_get_request``使用此键发出对rest的get请求
对象,该对象不同于`` constants.rest_object``
`` constants.do_action='do action'``如果希望剧本中的参数名
与rest模型中的参数名不同,请使用此常量。例如,
{
constants.rest_object:'lun',
常量。操作:{
创建:
{
{
常量。操作类型:常量。操作类型。更新,
常量。参数类型:parameters_all.get('create'),
constants.do_action:
}
}
uments
{
"必选参数变量1":dict(必选=true,type=<;此对象的类型>;,default=<;默认值>;),
"必选参数变量2":dict(必选=true),
"可选参数":dict(re必选=false),
"可选参数:dict()…
}
您可以跳过字典中的某些键,默认情况下,它将是
``dict(必需=false,类型=none,默认=none)``
**支持的参数类型**:
*\u none\u验证器不检查此参数的类型*_object_u-与dict
*_bool_u
*_int_u
*_str_u
*_list_u
*任何其他python的object
*来自dellemc_unity_sdk的受支持枚举。rest_supported_u enums
带键的选项(简单方式)
字典应具有键:"必需"和"可选"。例如:
{
‘必需的’:{'type','name',
‘可选的’:{'description','ostype','tenant',
}
(…)``您可以使用键``常量执行自己的函数。executed_by='executed_by``
>例如:
{
{
{constants.rest_object:'pool',
constants.actions:{create':{constants.executed_by:function}
}
ve 2个参数(参数,单位)。parameters=parameters from*.yml file,
unity=instance of class unity and also function必须有返回语句,
该语句将添加到参数"output"的输出中,`
请求,您可以重新定义此操作
一个执行[ansible dellemc unity]的python模块(https://github.com/ansible-dellemc-unity/ansible-dellemc-unity)(dellemc unity的ansible模块)。
##如何安装这个sdk
<
Dellemc统一软件开发包
python setup.py sdist
sudo pip install dist/dellemc戋u unity戋sdk.xxxx.tar.gz
git clone https://github.com/ansible dellemc unity/dellemc unity sdk.git
cd dellemc unity sdk
python setup.py sdist bdist戋wheel
sudo pip install dist/dellemc_unity嫒u sdk-xxxx-pyy-none-any.whl
\how to write modules
根据我们的经验和[问题4](https://github.com/ansible-dellemc-unity/dellemc-unity-sdk/issues/4),
您应该在模块中创建ansible module的实例。因此,要创建参数库,应该使用:
``支持性函数。为扩展模块(字典数组)或支持性函数创建参数库。然后为扩展模块(模板)创建参数库要
``runner.run(ansible_module,template)`
\how to write templates for runner.run(…)
template是一个字典,应该有以下键:
1。`` constants.rest_object='rest_object'``此键的值应为rest object
2。`` constants.actions='actions'``此键的值应该是操作字典,
例如,{'create:{…}','delete':{…},…}
>若要自动执行操作,操作字典应该具有以下参数:
1。`` constants.action_type``此键的值应为``constants.actionType.update``或``constants.actionType.query``
2。`` constants.parameter\u types='parameter\u types'``此键的值应该是一个字典,该字典中应该有键:
'必选','可选',并且每个键的值都应该是iterable。
例如:
{
{
常量。rest\u对象:'pool',
常量。操作:{
‘删除’:
{常量。操作类型:常量。操作类型。更新,
常量。参数类型:参数全部。获取('delete')}
}
}
1模板的可选参数(键)。`` constants.rest_object_for_get_request``使用此键发出对rest的get请求
对象,该对象不同于`` constants.rest_object``
`` constants.do_action='do action'``如果希望剧本中的参数名
与rest模型中的参数名不同,请使用此常量。例如,
{
constants.rest_object:'lun',
常量。操作:{
创建:
{
{
常量。操作类型:常量。操作类型。更新,
常量。参数类型:parameters_all.get('create'),
constants.do_action:
}
}
uments
{
"必选参数变量1":dict(必选=true,type=<;此对象的类型>;,default=<;默认值>;),
"必选参数变量2":dict(必选=true),
"可选参数":dict(re必选=false),
"可选参数:dict()…
}
您可以跳过字典中的某些键,默认情况下,它将是
``dict(必需=false,类型=none,默认=none)``
**支持的参数类型**:
*\u none\u验证器不检查此参数的类型*_object_u-与dict
*_bool_u
*_int_u
*_str_u
*_list_u
*任何其他python的object
*来自dellemc_unity_sdk的受支持枚举。rest_supported_u enums
带键的选项(简单方式)
字典应具有键:"必需"和"可选"。例如:
{
‘必需的’:{'type','name',
‘可选的’:{'description','ostype','tenant',
}
(…)``您可以使用键``常量执行自己的函数。executed_by='executed_by``
>例如:
{
{
{constants.rest_object:'pool',
constants.actions:{create':{constants.executed_by:function}
}
ve 2个参数(参数,单位)。parameters=parameters from*.yml file,
unity=instance of class unity and also function必须有返回语句,
该语句将添加到参数"output"的输出中,`
请求,您可以重新定义此操作