本文整理汇总了Python中troveclient.utils.print_list函数的典型用法代码示例。如果您正苦于以下问题:Python print_list函数的具体用法?Python print_list怎么用?Python print_list使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了print_list函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: do_secgroup_list_rules
def do_secgroup_list_rules(cs, args):
"""Lists all rules for a security group."""
sec_grp = cs.security_groups.get(args.security_group)
rules = sec_grp._info['rules']
utils.print_list(
rules, ['id', 'protocol', 'from_port', 'to_port', 'cidr'],
obj_is_dict=True)
示例2: do_limit_list
def do_limit_list(cs, args):
"""Lists the limits for a tenant."""
limits = cs.limits.list()
# Pop the first one, its absolute limits
absolute = limits.pop(0)
_print_object(absolute)
utils.print_list(limits, ["value", "verb", "remaining", "unit"])
示例3: do_secgroup_add_rule
def do_secgroup_add_rule(cs, args):
"""Creates a security group rule."""
rules = cs.security_group_rules.create(args.security_group, args.cidr)
utils.print_list(
rules, ["id", "security_group_id", "protocol", "from_port", "to_port", "cidr", "created"], obj_is_dict=True
)
示例4: do_limit_list
def do_limit_list(cs, args):
"""Lists the limits for a tenant."""
limits = cs.limits.list()
# Pop the first one, its absolute limits
absolute = limits.pop(0)
_print_instance(absolute)
utils.print_list(limits, ['value', 'verb', 'remaining', 'unit'])
示例5: do_backup_list
def do_backup_list(cs, args):
"""Lists available backups."""
wrapper = cs.backups.list(limit=args.limit, datastore=args.datastore)
backups = wrapper.items
while wrapper.next and not args.limit:
wrapper = cs.backups.list(marker=wrapper.next)
backups += wrapper.items
utils.print_list(backups, ["id", "instance_id", "name", "status", "parent_id", "updated"], order_by="updated")
示例6: do_secgroup_add_rule
def do_secgroup_add_rule(cs, args):
"""Creates a security group rule."""
rules = cs.security_group_rules.create(
args.security_group, args.cidr)
utils.print_list(rules, [
'id', 'security_group_id', 'protocol',
'from_port', 'to_port', 'cidr', 'created'], obj_is_dict=True)
示例7: do_cluster_instances
def do_cluster_instances(cs, args):
"""Lists all instances of a cluster."""
cluster = _find_cluster(cs, args.cluster)
instances = cluster._info["instances"]
for instance in instances:
instance["flavor_id"] = instance["flavor"]["id"]
if instance.get("volume"):
instance["size"] = instance["volume"]["size"]
utils.print_list(instances, ["id", "name", "flavor_id", "size", "status"], obj_is_dict=True)
示例8: do_cluster_list
def do_cluster_list(cs, args):
"""Lists all the clusters."""
clusters = cs.clusters.list(limit=args.limit, marker=args.marker)
for cluster in clusters:
setattr(cluster, "datastore_version", cluster.datastore["version"])
setattr(cluster, "datastore", cluster.datastore["type"])
setattr(cluster, "task_name", cluster.task["name"])
utils.print_list(clusters, ["id", "name", "datastore", "datastore_version", "task_name"])
示例9: do_mgmt_cluster_instances
def do_mgmt_cluster_instances(cs, args):
"""Lists all instances of a cluster."""
cluster = cs.management_cluster_python_troveclient_ext.show(args.cluster)
instances = cluster._info["instances"]
for instance in instances:
instance["flavor_id"] = instance["flavor"]["id"]
if instance.get("volume"):
instance["size"] = instance["volume"]["size"]
utils.print_list(instances, ["id", "name", "type", "flavor_id", "size"], obj_is_dict=True)
开发者ID:venkataramant,项目名称:mgmt_python_troveclient_ext,代码行数:9,代码来源:management_cluster_python_troveclient_ext.py
示例10: do_backup_list_instance
def do_backup_list_instance(cs, args):
"""Lists available backups for an instance."""
instance = _find_instance(cs, args.instance)
wrapper = cs.instances.backups(instance, limit=args.limit)
backups = wrapper.items
while wrapper.next and not args.limit:
wrapper = cs.instances.backups(instance, marker=wrapper.next)
backups += wrapper.items
utils.print_list(backups, ["id", "name", "status", "parent_id", "updated"], order_by="updated")
示例11: do_secgroup_list
def do_secgroup_list(cs, args):
"""Lists all security groups."""
wrapper = cs.security_groups.list()
sec_grps = wrapper.items
while wrapper.next:
wrapper = cs.security_groups.list()
sec_grps += wrapper.items
utils.print_list(sec_grps, ["id", "name", "instance_id"])
示例12: do_list
def do_list(cs, args):
"""List all the instances."""
instances = cs.instances.list()
for instance in instances:
setattr(instance, 'flavor_id', instance.flavor['id'])
if hasattr(instance, 'volume'):
setattr(instance, 'size', instance.volume['size'])
utils.print_list(instances, ['id', 'name', 'status', 'flavor_id', 'size'])
示例13: do_database_list
def do_database_list(cs, args):
"""Lists available databases on an instance."""
wrapper = cs.databases.list(args.instance)
databases = wrapper.items
while (wrapper.next):
wrapper = cs.databases.list(args.instance, marker=wrapper.next)
databases += wrapper.items
utils.print_list(databases, ['name'])
示例14: do_user_list
def do_user_list(cs, args):
"""Lists the users for a instance."""
wrapper = cs.users.list(args.instance)
users = wrapper.items
while (wrapper.next):
wrapper = cs.users.list(args.instance, marker=wrapper.next)
users += wrapper.items
utils.print_list(users, ['name', 'host', 'databases'])
示例15: do_secgroup_list
def do_secgroup_list(cs, args):
"""Lists all security groups."""
wrapper = cs.security_groups.list()
sec_grps = wrapper.items
while (wrapper.next):
wrapper = cs.security_groups.list()
sec_grps += wrapper.items
utils.print_list(sec_grps, ['id', 'name', 'rules', 'instance_id'])