當前位置: 首頁>>代碼示例>>Python>>正文


Python Transform.to_billing_group方法代碼示例

本文整理匯總了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)
開發者ID:SenadI,項目名稱:sevenbridges-python,代碼行數:31,代碼來源:project.py

示例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)
開發者ID:sbg,項目名稱:sevenbridges-python,代碼行數:41,代碼來源:project.py

示例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)
開發者ID:sbg,項目名稱:sevenbridges-python,代碼行數:5,代碼來源:test_transformer.py

示例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)
開發者ID:sbg,項目名稱:sevenbridges-python,代碼行數:4,代碼來源:test_transformer.py


注:本文中的sevenbridges.meta.transformer.Transform.to_billing_group方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。