本文整理汇总了Python中sevenbridges.meta.transformer.Transform.to_billing_group方法的典型用法代码示例。如果您正苦于以下问题:Python Transform.to_billing_group方法的具体用法?Python Transform.to_billing_group怎么用?Python Transform.to_billing_group使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sevenbridges.meta.transformer.Transform
的用法示例。
在下文中一共展示了Transform.to_billing_group方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: create
# 需要导入模块: from sevenbridges.meta.transformer import Transform [as 别名]
# 或者: from sevenbridges.meta.transformer.Transform import to_billing_group [as 别名]
def create(cls, name, billing_group, description=None, tags=None,
api=None):
"""
Create a project.
:param name: Project name.
:param billing_group: Project billing group.
:param description: Project description.
:param tags: Project tags.
:param api: Api instance.
:return:
"""
api = api if api else cls._API
billing_group = Transform.to_billing_group(billing_group)
if name is None:
raise SbgError('Project name is required!')
data = {
'name': name,
'billing_group': billing_group,
}
if description:
data['description'] = description
if tags:
data['tags'] = tags
project_data = api.post(url=cls._URL['query'],
data=data).json()
return Project(api=api, **project_data)
示例2: create
# 需要导入模块: from sevenbridges.meta.transformer import Transform [as 别名]
# 或者: from sevenbridges.meta.transformer.Transform import to_billing_group [as 别名]
def create(cls, name, billing_group=None, description=None, tags=None,
settings=None, api=None):
"""
Create a project.
:param name: Project name.
:param billing_group: Project billing group.
:param description: Project description.
:param tags: Project tags.
:param settings: Project settings.
:param api: Api instance.
:return:
"""
api = api if api else cls._API
if name is None:
raise SbgError('Project name is required!')
data = {
'name': name,
}
if billing_group:
data['billing_group'] = Transform.to_billing_group(billing_group)
if description:
data['description'] = description
if tags:
data['tags'] = tags
if settings:
data['settings'] = settings
extra = {
'resource': cls.__name__,
'query': data
}
logger.info('Creating project', extra=extra)
project_data = api.post(url=cls._URL['create'], data=data).json()
return Project(api=api, **project_data)
示例3: test_transform_billing_group_invalid_values
# 需要导入模块: from sevenbridges.meta.transformer import Transform [as 别名]
# 或者: from sevenbridges.meta.transformer.Transform import to_billing_group [as 别名]
def test_transform_billing_group_invalid_values(group):
with pytest.raises(SbgError):
Transform.to_billing_group(group)
示例4: test_transform_billing_group
# 需要导入模块: from sevenbridges.meta.transformer import Transform [as 别名]
# 或者: from sevenbridges.meta.transformer.Transform import to_billing_group [as 别名]
def test_transform_billing_group(group):
Transform.to_billing_group(group)