本文整理汇总了Python中SoftLayer.CLI.Table.align['ttl']方法的典型用法代码示例。如果您正苦于以下问题:Python Table.align['ttl']方法的具体用法?Python Table.align['ttl']怎么用?Python Table.align['ttl']使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SoftLayer.CLI.Table
的用法示例。
在下文中一共展示了Table.align['ttl']方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: list_zone
# 需要导入模块: from SoftLayer.CLI import Table [as 别名]
# 或者: from SoftLayer.CLI.Table import align['ttl'] [as 别名]
def list_zone(client, zone, args):
manager = DNSManager(client)
t = Table([
"record",
"type",
"ttl",
"value",
])
t.align['ttl'] = 'l'
t.align['record'] = 'r'
t.align['value'] = 'l'
zone_id = resolve_id(manager.resolve_ids, args['<zone>'], name='zone')
try:
records = manager.get_records(
zone_id,
type=args.get('--type'),
host=args.get('--record'),
ttl=args.get('--ttl'),
data=args.get('--data'),
)
except DNSZoneNotFound:
raise CLIAbort("No zone found matching: %s" % args['<zone>'])
for rr in records:
t.add_row([
rr['host'],
rr['type'].upper(),
rr['ttl'],
rr['data']
])
return t
示例2: execute
# 需要导入模块: from SoftLayer.CLI import Table [as 别名]
# 或者: from SoftLayer.CLI.Table import align['ttl'] [as 别名]
def execute(client, args):
manager = DNSManager(client)
results = manager.search_record(
args['<domain>'],
args['<record>'])
t = Table(['id', 'type', 'ttl', 'data'])
t.align['ttl'] = 'c'
for r in results:
t.add_row([r['id'], r['type'], r['ttl'], r['data']])
return t
示例3: list_zone
# 需要导入模块: from SoftLayer.CLI import Table [as 别名]
# 或者: from SoftLayer.CLI.Table import align['ttl'] [as 别名]
def list_zone(self, args):
""" list records for a particular zone """
manager = DNSManager(self.client)
table = Table([
"id",
"record",
"type",
"ttl",
"value",
])
table.align['ttl'] = 'l'
table.align['record'] = 'r'
table.align['value'] = 'l'
zone_id = resolve_id(manager.resolve_ids, args['<zone>'], name='zone')
try:
records = manager.get_records(
zone_id,
record_type=args.get('--type'),
host=args.get('--record'),
ttl=args.get('--ttl'),
data=args.get('--data'),
)
except DNSZoneNotFound:
raise CLIAbort("No zone found matching: %s" % args['<zone>'])
for record in records:
table.add_row([
record['id'],
record['host'],
record['type'].upper(),
record['ttl'],
record['data']
])
return table