本文整理匯總了Python中misc.Misc.parse_service_columns方法的典型用法代碼示例。如果您正苦於以下問題:Python Misc.parse_service_columns方法的具體用法?Python Misc.parse_service_columns怎麽用?Python Misc.parse_service_columns使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類misc.Misc
的用法示例。
在下文中一共展示了Misc.parse_service_columns方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: report_elb
# 需要導入模塊: from misc import Misc [as 別名]
# 或者: from misc.Misc import parse_service_columns [as 別名]
def report_elb(self):
'''
This function is a wrapper for parsing arguments and printing for elb attribute reports
Tested
:return:
'''
logger.info("Started report generation command")
a = awsrequests(session=self.account_information['session'])
parser = argparse.ArgumentParser(description='report generation about elbs', usage='''kerrigan.py elb report_elb [<args>]]
''' + self.global_options, formatter_class=argparse.ArgumentDefaultsHelpFormatter, prog="kerrigan")
parser.add_argument('--columns', action='store', default=a.service_supported_columns(service="elb"),
help="Which columns to display")
parser.add_argument('--filters', action='store', default=None,
help="The filters that should be used, example: key1:value1,key2:value2")
args = parser.parse_args(sys.argv[3:])
columns = Misc.parse_service_columns(columns=args.columns, service="elb")
if args.filters:
filters = Misc.format_boto3_filter(filters=args.filters)
else:
filters = None
result = a.information_elbs(columns=columns, filters=filters)
for res in result:
if self.account_information['logger_arguments']['table']:
res['AvailabilityZones'] = Misc.list_to_multiline_string(list=res['AvailabilityZones'])
res['SecurityGroups'] = Misc.list_to_multiline_string(list=res['SecurityGroups'])
res['Instances'] = Misc.list_to_multiline_string(list=res['Instances'])
else:
res['AvailabilityZones'] = Misc.join_list_to_string(list=res['AvailabilityZones'])
res['SecurityGroups'] = Misc.join_list_to_string(list=res['SecurityGroups'])
res['Instances'] = Misc.join_list_to_string(list=res['Instances'])
logger.output(data=result, csvvar=self.account_information['logger_arguments']['csv'],
tablevar=self.account_information['logger_arguments']['table'])
示例2: report_apigateway
# 需要導入模塊: from misc import Misc [as 別名]
# 或者: from misc.Misc import parse_service_columns [as 別名]
def report_apigateway(self):
'''
This function is a wrapper for parsing arguments and printing for apigateway attribute reports
:return:
'''
logger.info("Started report generation command")
a = awsrequests(session=self.account_information['session'])
parser = argparse.ArgumentParser(description='report generation about apigateway', usage='''kerrigan.py apigateway report_apigateway [<args>]]
''' + self.global_options, formatter_class=argparse.ArgumentDefaultsHelpFormatter, prog="kerrigan")
parser.add_argument('--columns', action='store', default=a.service_supported_columns(service="sg").keys(),
help="Which columns to display")
args = parser.parse_args(sys.argv[3:])
columns = Misc.parse_service_columns(service="apigateway", columns=args.columns)
result = a.information_apigateway(columns=columns)
logger.output(data=result, csvvar=self.account_information['logger_arguments']['csv'],
tablevar=self.account_information['logger_arguments']['table'])
示例3: report_ami
# 需要導入模塊: from misc import Misc [as 別名]
# 或者: from misc.Misc import parse_service_columns [as 別名]
def report_ami(self):
'''
This function is a wrapper for parsing arguments and printing for ami attribute reports
:return:
'''
logger.info("Started report generation command")
a = awsrequests(session=self.account_information['session'])
parser = argparse.ArgumentParser(description='report generation about ami', usage='''kerrigan.py ami report_ami [<args>]]
''' + self.global_options, formatter_class=argparse.ArgumentDefaultsHelpFormatter, prog="kerrigan")
parser.add_argument('--columns', action='store', default=a.service_supported_columns(service="ami").keys(),
help="Which columns to display")
parser.add_argument('--filters', action='store', default=None,
help="The filters that should be used, example: key1:value1,key2:value2")
args = parser.parse_args(sys.argv[3:])
columns = Misc.parse_service_columns(service="ami", columns=args.columns)
if args.filters:
filters = Misc.format_boto3_filter(filters=args.filters)
else:
filters = None
result = a.information_ami(columns=columns, filters=filters)
logger.output(data=result, csvvar=self.account_information['logger_arguments']['csv'],
tablevar=self.account_information['logger_arguments']['table'])
示例4: test_parse_service_columns_with_services_elb
# 需要導入模塊: from misc import Misc [as 別名]
# 或者: from misc.Misc import parse_service_columns [as 別名]
def test_parse_service_columns_with_services_elb(self):
columns = ""
keys = Misc.get_supported_columns(service="elb").keys()
self.assertListEqual(keys, Misc.parse_service_columns(service="elb",columns=columns))
示例5: test_parse_service_columns_with_services_cloudformation
# 需要導入模塊: from misc import Misc [as 別名]
# 或者: from misc.Misc import parse_service_columns [as 別名]
def test_parse_service_columns_with_services_cloudformation(self):
columns = ""
keys = Misc.get_supported_columns(service="cloudformation").keys()
self.assertListEqual(keys, Misc.parse_service_columns(service="cloudformation",columns=columns))
示例6: test_parse_service_columns_all_column
# 需要導入模塊: from misc import Misc [as 別名]
# 或者: from misc.Misc import parse_service_columns [as 別名]
def test_parse_service_columns_all_column(self):
keys = Misc.ec2_columns.keys()
columns = ",".join(keys)
self.assertListEqual(keys, Misc.parse_service_columns(service="ec2",columns=columns))
示例7: test_parse_service_columns_2_column
# 需要導入模塊: from misc import Misc [as 別名]
# 或者: from misc.Misc import parse_service_columns [as 別名]
def test_parse_service_columns_2_column(self):
columns = "id,vpc_id,notexist"
keys = ["id", "vpc_id"]
self.assertListEqual(keys, Misc.parse_service_columns(service="ec2",columns=columns))
示例8: test_parse_service_columns_empty
# 需要導入模塊: from misc import Misc [as 別名]
# 或者: from misc.Misc import parse_service_columns [as 別名]
def test_parse_service_columns_empty(self):
columns = ""
keys = Misc.ec2_columns.keys()
self.assertListEqual(keys, Misc.parse_service_columns(service="ec2",columns=columns))