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


Python Links._xml_ele_to_obj方法代码示例

本文整理汇总了Python中cloudcafe.compute.common.models.link.Links._xml_ele_to_obj方法的典型用法代码示例。如果您正苦于以下问题:Python Links._xml_ele_to_obj方法的具体用法?Python Links._xml_ele_to_obj怎么用?Python Links._xml_ele_to_obj使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在cloudcafe.compute.common.models.link.Links的用法示例。


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

示例1: _xml_ele_to_obj

# 需要导入模块: from cloudcafe.compute.common.models.link import Links [as 别名]
# 或者: from cloudcafe.compute.common.models.link.Links import _xml_ele_to_obj [as 别名]
 def _xml_ele_to_obj(cls, element):
     """Helper method to turn ElementTree instance to Server instance."""
     flavor_dict = element.attrib
     flavor_min = FlavorMin(id=flavor_dict.get('id'),
                            name=flavor_dict.get('name'))
     flavor_min.links = Links._xml_ele_to_obj(element)
     return flavor_min
开发者ID:dani4571,项目名称:cloudcafe,代码行数:9,代码来源:flavor.py

示例2: _xml_ele_to_obj

# 需要导入模块: from cloudcafe.compute.common.models.link import Links [as 别名]
# 或者: from cloudcafe.compute.common.models.link.Links import _xml_ele_to_obj [as 别名]
 def _xml_ele_to_obj(cls, element):
     '''Helper method to turn ElementTree instance to Image instance.'''
     cls._remove_xml_etree_namespace(element, Constants.XML_API_NAMESPACE)
     image_dict = element.attrib
     image_min = ImageMin(**image_dict)
     image_min.links = Links._xml_ele_to_obj(element)
     return image_min
开发者ID:SamDanes,项目名称:cloudcafe,代码行数:9,代码来源:image.py

示例3: _xml_ele_to_obj

# 需要导入模块: from cloudcafe.compute.common.models.link import Links [as 别名]
# 或者: from cloudcafe.compute.common.models.link.Links import _xml_ele_to_obj [as 别名]
    def _xml_ele_to_obj(cls, element):
        image_dict = element.attrib
        if 'minDisk' in image_dict:
            image_dict['minDisk'] = (image_dict.get('minDisk')
                                     and int(image_dict.get('minDisk')))
        if 'progress' in image_dict:
            image_dict['progress'] = (image_dict.get('progress')
                                      and int(image_dict.get('progress')))
        if 'minRam' in image_dict:
            image_dict['minRam'] = (image_dict.get('minRam')
                                    and int(image_dict.get('minRam')))

        links = None
        metadata = None
        server = None
        if element.find('link') is not None:
            links = Links._xml_ele_to_obj(element)
        if element.find('metadata') is not None:
            metadata = Metadata._xml_ele_to_obj(element.find('metadata'))
        if element.find('server') is not None:
            # Prevents circular import issue import just in time
            from cloudcafe.compute.servers_api.models.servers import ServerMin
            server = ServerMin._xml_ele_to_obj(element)

        image = Image(
            disk_config=image_dict.get('diskConfig'),
            size=image_dict.get('size'), id=image_dict.get('id'),
            name=image_dict.get('name'), status=image_dict.get('status'),
            updated=image_dict.get('updated'),
            created=image_dict.get('created'),
            min_disk=image_dict.get('minDisk'),
            min_ram=image_dict.get('minRam'),
            progress=image_dict.get('progress'),
            links=links, metadata=metadata, server=server)
        return image
开发者ID:MUSABALOYI,项目名称:cloudcafe,代码行数:37,代码来源:image.py

示例4: _xml_ele_to_obj

# 需要导入模块: from cloudcafe.compute.common.models.link import Links [as 别名]
# 或者: from cloudcafe.compute.common.models.link.Links import _xml_ele_to_obj [as 别名]
 def _xml_ele_to_obj(cls, element):
     flavor_dict = element.attrib
     links = Links._xml_ele_to_obj(element)
     flavor_min = FlavorMin(id=flavor_dict.get('id'),
                            name=flavor_dict.get('name'),
                            links=links)
     return flavor_min
开发者ID:akshatknsl,项目名称:cloudcafe,代码行数:9,代码来源:flavor.py

示例5: _xml_ele_to_obj

# 需要导入模块: from cloudcafe.compute.common.models.link import Links [as 别名]
# 或者: from cloudcafe.compute.common.models.link.Links import _xml_ele_to_obj [as 别名]
 def _xml_ele_to_obj(cls, element):
     '''Helper method to turn ElementTree instance to Server instance.'''
     if element.find('server') is not None:
         element = element.find('server')
         server_dict = element.attrib
         servermin = ServerMin(**server_dict)
         servermin.links = Links._xml_ele_to_obj(element)
     return servermin
开发者ID:kaofelix,项目名称:cloudcafe,代码行数:10,代码来源:servers.py

示例6: _xml_ele_to_obj

# 需要导入模块: from cloudcafe.compute.common.models.link import Links [as 别名]
# 或者: from cloudcafe.compute.common.models.link.Links import _xml_ele_to_obj [as 别名]
    def _xml_ele_to_obj(cls, element):
        """Helper method to turn ElementTree instance to Server instance."""
        server = element.attrib

        addresses = None
        flavor = None
        image = None
        metadata = None
        links = Links._xml_ele_to_obj(element)

        if element.find("addresses") is not None:
            addresses = Addresses._xml_ele_to_obj(element.find("addresses"))
        if element.find("flavor") is not None:
            flavor = Flavor._xml_ele_to_obj(element.find("flavor"))
        if element.find("image") is not None:
            image = Image._xml_ele_to_obj(element.find("image"))
        if element.find("metadata") is not None:
            metadata = Metadata._xml_ele_to_obj(element.find("metadata"))

        if "progress" in server:
            progress = server.get("progress") and int(server.get("progress"))
        else:
            progress = None

        server = Server(
            id=server.get("id"),
            disk_config=server.get("diskConfig"),
            power_state=server.get("power_state"),
            progress=progress,
            task_state=server.get("task_state").lower(),
            vm_state=server.get("vm_state"),
            name=server.get("name"),
            tenant_id=server.get("tenant_id"),
            status=server.get("status"),
            updated=server.get("updated"),
            created=server.get("created"),
            host_id=server.get("hostId"),
            user_id=server.get("userId"),
            accessIPv4=server.get("accessIPv4"),
            config_drive=server.get("config_drive"),
            accessIPv6=server.get("accessIPv6"),
            addresses=addresses,
            flavor=flavor,
            image=image,
            links=links,
            metadata=metadata,
            admin_pass=server.get("adminPass"),
            key_name=server.get("key_name"),
            host=server.get("host"),
            instance_name=server.get("instance_name"),
            hypervisor_name=server.get("hypervisor_hostname"),
        )

        return server
开发者ID:vishalkankatala,项目名称:cloudcafe,代码行数:56,代码来源:servers.py

示例7: _xml_ele_to_obj

# 需要导入模块: from cloudcafe.compute.common.models.link import Links [as 别名]
# 或者: from cloudcafe.compute.common.models.link.Links import _xml_ele_to_obj [as 别名]
    def _xml_ele_to_obj(cls, element):
        """Helper method to turn ElementTree instance to Server instance."""
        server_dict = element.attrib

        addresses = None
        flavor = None
        image = None
        links = None
        metadata = None

        links = Links._xml_ele_to_obj(element)
        if element.find("addresses") is not None:
            addresses = Addresses._xml_ele_to_obj(element.find("addresses"))
        if element.find("flavor") is not None:
            flavor = Flavor._xml_ele_to_obj(element.find("flavor"))
        if element.find("image") is not None:
            image = Image._xml_ele_to_obj(element.find("image"))
        if element.find("metadata") is not None:
            metadata = Metadata._xml_ele_to_obj(element)

        if "progress" in server_dict:
            progress = server_dict.get("progress") and int(server_dict.get("progress"))
        if "tenantId" in server_dict:
            tenant_id = server_dict.get("tenantId")
        if "userId" in server_dict:
            user_id = server_dict.get("userId")

        server = Server(
            server_dict["id"],
            server_dict["diskConfig"],
            server_dict["power_state"],
            progress,
            server_dict["task_state"],
            server_dict["vm_state"],
            server_dict["name"],
            tenant_id,
            server_dict["status"],
            server_dict["updated"],
            server_dict["created"],
            server_dict["hostId"],
            user_id,
            server_dict["accessIPv4"],
            server_dict["accessIPv6"],
            addresses,
            flavor,
            image,
            links,
            metadata,
        )
        return server
开发者ID:john5223,项目名称:cloudcafe,代码行数:52,代码来源:servers.py

示例8: _xml_ele_to_obj

# 需要导入模块: from cloudcafe.compute.common.models.link import Links [as 别名]
# 或者: from cloudcafe.compute.common.models.link.Links import _xml_ele_to_obj [as 别名]
    def _xml_ele_to_obj(cls, element):
        """Helper method to turn ElementTree instance to Server instance."""
        server = element.attrib

        addresses = None
        flavor = None
        image = None
        metadata = None
        fault = None
        links = Links._xml_ele_to_obj(element)

        if element.find('addresses') is not None:
            addresses = Addresses._xml_ele_to_obj(element.find('addresses'))
        if element.find('flavor') is not None:
            flavor = Flavor._xml_ele_to_obj(element.find('flavor'))
        if element.find('image'):
            image = Image._xml_ele_to_obj(element.find('image'))
        if element.find('metadata') is not None:
            metadata = Metadata._xml_ele_to_obj(element.find('metadata'))
        if element.find('fault') is not None:
            fault = Fault._xml_ele_to_obj(element.find('fault'))

        if 'progress' in server:
            progress = (server.get('progress')
                        and int(server.get('progress')))
        else:
            progress = None

        server = Server(
            id=server.get('id'), disk_config=server.get('diskConfig'),
            power_state=server.get('power_state'), progress=progress,
            task_state=server.get('task_state').lower(),
            vm_state=server.get('vm_state'), name=server.get('name'),
            tenant_id=server.get('tenant_id'), status=server.get('status'),
            updated=server.get('updated'), created=server.get('created'),
            host_id=server.get('hostId'), user_id=server.get('userId'),
            accessIPv4=server.get('accessIPv4'),
            config_drive=server.get('config_drive'),
            accessIPv6=server.get('accessIPv6'), addresses=addresses,
            flavor=flavor, image=image, links=links, metadata=metadata,
            admin_pass=server.get('adminPass'),
            key_name=server.get('key_name'), host=server.get('host'),
            instance_name=server.get('instance_name'),
            hypervisor_name=server.get('hypervisor_hostname'),
            security_groups=server.get('security_groups'),
            fault=fault)

        return server
开发者ID:kshortwindham,项目名称:cloudcafe,代码行数:50,代码来源:servers.py

示例9: _xml_ele_to_obj

# 需要导入模块: from cloudcafe.compute.common.models.link import Links [as 别名]
# 或者: from cloudcafe.compute.common.models.link.Links import _xml_ele_to_obj [as 别名]
    def _xml_ele_to_obj(cls, element):
        '''Helper method to turn ElementTree instance to Server instance.'''
        server_dict = element.attrib

        addresses = None
        flavor = None
        image = None
        links = None
        metadata = None

        links = Links._xml_ele_to_obj(element)
        if element.find('addresses') is not None:
            addresses = Addresses._xml_ele_to_obj(element.find('addresses'))
        if element.find('flavor') is not None:
            flavor = Flavor._xml_ele_to_obj(element.find('flavor'))
        if element.find('image') is not None:
            image = Image._xml_ele_to_obj(element.find('image'))
        if element.find('metadata') is not None:
            metadata = Metadata._xml_ele_to_obj(element)

        if 'progress' in server_dict:
            progress = server_dict.get('progress') \
                and int(server_dict.get('progress'))
        if 'tenantId' in server_dict:
            tenant_id = server_dict.get('tenantId')
        if 'userId' in server_dict:
            user_id = server_dict.get('userId')

        server = Server(server_dict['id'], server_dict['diskConfig'],
                        server_dict['power_state'], progress,
                        server_dict['task_state'],
                        server_dict['vm_state'],
                        server_dict['name'], tenant_id,
                        server_dict['status'], server_dict['updated'],
                        server_dict['created'], server_dict['hostId'],
                        user_id, server_dict['accessIPv4'],
                        server_dict['accessIPv6'], addresses, flavor,
                        image, links, metadata)
        return server
开发者ID:SamDanes,项目名称:cloudcafe,代码行数:41,代码来源:servers.py

示例10: _xml_ele_to_obj

# 需要导入模块: from cloudcafe.compute.common.models.link import Links [as 别名]
# 或者: from cloudcafe.compute.common.models.link.Links import _xml_ele_to_obj [as 别名]
 def _xml_ele_to_obj(cls, element):
     server_dict = element.attrib
     links = Links._xml_ele_to_obj(element)
     server = ServerMin(id=server_dict.get('id'),
                        name=server_dict.get('name'), links=links)
     return server
开发者ID:cloudkeep,项目名称:cloudcafe,代码行数:8,代码来源:servers.py


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