本文整理汇总了Python中trove.common.views.create_links函数的典型用法代码示例。如果您正苦于以下问题:Python create_links函数的具体用法?Python create_links怎么用?Python create_links使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了create_links函数的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: _build_configuration_info
def _build_configuration_info(self):
return {
"id": self.instance.configuration.id,
"name": self.instance.configuration.name,
"links": create_links("configurations", self.req,
self.instance.configuration.id)
}
开发者ID:bodenr,项目名称:trove,代码行数:7,代码来源:views.py
示例2: build_instances
def build_instances(self):
instances = []
ip_list = []
if self.load_servers:
cluster_instances = self.cluster.instances
else:
cluster_instances = self.cluster.instances_without_server
for instance in cluster_instances:
instance_dict = {
"id": instance.id,
"name": instance.name,
"type": instance.type,
"links": create_links("instances", self.req, instance.id)
}
instance_ips = instance.get_visible_ip_addresses()
if self.load_servers and instance_ips:
instance_dict["ip"] = instance_ips
if instance.type == 'query_router':
ip_list.append(instance_ips[0])
if instance.shard_id:
instance_dict["shard_id"] = instance.shard_id
if self.load_servers:
instance_dict["status"] = instance.status
if CONF.get(instance.datastore_version.manager).volume_support:
instance_dict["volume"] = {"size": instance.volume_size}
instance_dict["flavor"] = self._build_flavor_info(
instance.flavor_id)
instances.append(instance_dict)
ip_list.sort()
return instances, ip_list
开发者ID:ShaguftaMethwani,项目名称:trove,代码行数:30,代码来源:api.py
示例3: _build_instances
def _build_instances(self, ip_to_be_published_for=[],
instance_dict_to_be_published_for=[]):
instances = []
ip_list = []
if self.load_servers:
cluster_instances = self.cluster.instances
else:
cluster_instances = self.cluster.instances_without_server
for instance in cluster_instances:
instance_dict = {
"id": instance.id,
"name": instance.name,
"type": instance.type,
"links": create_links("instances", self.req, instance.id)
}
if instance.shard_id:
instance_dict["shard_id"] = instance.shard_id
if self.load_servers:
instance_dict["status"] = instance.status
if CONF.get(instance.datastore_version.manager).volume_support:
instance_dict["volume"] = {"size": instance.volume_size}
instance_dict["flavor"] = self._build_flavor_info(
instance.flavor_id)
instance_ips = instance.get_visible_ip_addresses()
instance_types = instance.type.split(',')
if self.load_servers and instance_ips:
instance_dict["ip"] = instance_ips
if any(t in instance_types for t in ip_to_be_published_for):
ip_list.extend(instance_ips)
if any(t in instance_types
for t in instance_dict_to_be_published_for):
instances.append(instance_dict)
ip_list.sort()
return instances, ip_list
开发者ID:Tesora,项目名称:tesora-trove,代码行数:34,代码来源:views.py
示例4: _build_slaves_info
def _build_slaves_info(self):
data = []
for slave in self.instance.slaves:
data.append({
"id": slave.id,
"links": create_links("instances", self.req, slave.id)
})
return data
开发者ID:cdelatte,项目名称:tesora-trove,代码行数:8,代码来源:views.py
示例5: _build_flavor_links
def _build_flavor_links(self):
return create_links("flavors", self.req,
self.instance.flavor_id)
开发者ID:bodenr,项目名称:trove,代码行数:3,代码来源:views.py
示例6: _build_links
def _build_links(self):
return create_links("instances", self.req, self.instance.id)
开发者ID:bodenr,项目名称:trove,代码行数:2,代码来源:views.py
示例7: _build_links
def _build_links(self):
return create_links("clusters", self.req, self.cluster.id)
开发者ID:Tesora,项目名称:tesora-trove,代码行数:2,代码来源:views.py
示例8: _build_flavor_info
def _build_flavor_info(self, flavor_id):
return {
"id": flavor_id,
"links": create_links("flavors", self.req, flavor_id)
}
开发者ID:Tesora,项目名称:tesora-trove,代码行数:5,代码来源:views.py
示例9: _build_links
def _build_links(self):
return create_links("flavors", self.req, self.flavor.id)
开发者ID:zhujzhuo,项目名称:trove-1.0.10.4,代码行数:2,代码来源:views.py
示例10: _build_master_info
def _build_master_info(self):
return {
"id": self.instance.slave_of_id,
"links": create_links("instances", self.req,
self.instance.slave_of_id)
}
开发者ID:cdelatte,项目名称:tesora-trove,代码行数:6,代码来源:views.py
示例11: _build_links
def _build_links(self):
return create_links("datastores/versions",
self.req, self.datastore_version.id)
开发者ID:AlexeyDeyneko,项目名称:trove,代码行数:3,代码来源:views.py
注:本文中的trove.common.views.create_links函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论