本文整理匯總了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)