当前位置: 首页>>代码示例>>Python>>正文


Python api.rest_api函数代码示例

本文整理汇总了Python中utils.api.rest_api函数的典型用法代码示例。如果您正苦于以下问题:Python rest_api函数的具体用法?Python rest_api怎么用?Python rest_api使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了rest_api函数的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: num_host

 def num_host(self):
     provider = rest_api().collections.providers.find_by(name=self.name)[0]
     num_host = 0
     for host in rest_api().collections.hosts:
         if host["ems_id"] == provider.id:
             num_host += 1
     return num_host
开发者ID:RonnyPfannschmidt,项目名称:cfme_tests,代码行数:7,代码来源:__init__.py

示例2: num_cluster

 def num_cluster(self):
     provider = rest_api().collections.providers.find_by(name=self.name)[0]
     num_cluster = 0
     for cluster in rest_api().collections.clusters:
         if cluster["ems_id"] == provider.id:
             num_cluster += 1
     return num_cluster
开发者ID:RonnyPfannschmidt,项目名称:cfme_tests,代码行数:7,代码来源:__init__.py

示例3: refresh_provider_relationships

 def refresh_provider_relationships(self, from_list_view=False):
     # from_list_view is ignored as it is included here for sake of compatibility with UI call.
     col = rest_api().collections.providers.find_by(name=self.name)
     try:
         col[0].action.refresh()
     except IndexError:
         raise Exception("Provider collection empty")
开发者ID:akrzos,项目名称:cfme_tests,代码行数:7,代码来源:provider.py

示例4: __init__

    def __init__(self, name, provider):
        self.name = name
        self._short_name = self.name.split('in')[0].strip()
        self.provider = provider

        col = rest_api().collections
        self._id = [cl.id for cl in col.clusters.all if cl.name == self._short_name
                    and cl.ems_id == self.provider.id][-1]
开发者ID:anewmanRH,项目名称:cfme_tests,代码行数:8,代码来源:cluster.py

示例5: __init__

    def __init__(self, name, provider, appliance=None):
        Navigatable.__init__(self, appliance=appliance)
        self.name = name
        self._short_name = self.name.split('in')[0].strip()
        self.provider = provider
        self.quad_name = 'cluster'

        col = rest_api().collections
        self._id = [cl.id for cl in col.clusters.all if cl.name == self._short_name
                    and cl.ems_id == self.provider.id][-1]
开发者ID:RonnyPfannschmidt,项目名称:cfme_tests,代码行数:10,代码来源:cluster.py

示例6: __init__

    def __init__(self, name=None, provider_key=None):
        self.name = name
        self._short_name = self.name.split('in')[0].strip()

        col = rest_api().collections
        cluster = [cl for cl in col.clusters.all if cl.name == self._short_name][-1]
        self._cluster_id = cluster.id
        provider_id = cluster.ems_id

        #  fixme: to remove this part when provider_key becomes mandatory field
        if not provider_key:
            provider_name = [pr.name for pr in col.providers.all if pr.id == provider_id][-1]
            provider_key = get_provider_key(provider_name)

        self.provider = get_crud(provider_key)
开发者ID:rrasouli,项目名称:cfme_tests,代码行数:15,代码来源:cluster.py

示例7: id

 def id(self):
     """
     returns current provider id using rest api
     """
     return rest_api().collections.providers.find_by(name=self.name)[0].id
开发者ID:RonnyPfannschmidt,项目名称:cfme_tests,代码行数:5,代码来源:__init__.py

示例8: get_collection_via_rest

 def get_collection_via_rest(self):
     return rest_api().collections.vms
开发者ID:RonnyPfannschmidt,项目名称:cfme_tests,代码行数:2,代码来源:virtual_machines.py

示例9: get_vm_via_rest

 def get_vm_via_rest(self):
     return rest_api().collections.vms.get(name=self.name)
开发者ID:RonnyPfannschmidt,项目名称:cfme_tests,代码行数:2,代码来源:virtual_machines.py

示例10: last_refresh_date

 def last_refresh_date(self):
     try:
         col = rest_api().collections.providers.find_by(name=self.name)[0]
         return col.last_refresh_date
     except AttributeError:
         return None
开发者ID:akrzos,项目名称:cfme_tests,代码行数:6,代码来源:provider.py

示例11: refresh_provider_relationships

 def refresh_provider_relationships(self, from_list_view=False):
     # from_list_view is ignored as it is included here for sake of compatibility with UI call.
     col = rest_api().collections.providers.find_by(name=self.name)[0]
     col.action.refresh()
开发者ID:amavinag,项目名称:cfme_tests,代码行数:4,代码来源:provider.py


注:本文中的utils.api.rest_api函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。