orcacli.py 文件源码

python
阅读 25 收藏 0 点赞 0 评论 0

项目:orca 作者: bdastur 项目源码 文件源码
def perform_profile_operations(self, namespace):
        '''
        Handle the profile operations
        '''
        awsconfig = aws_config.AwsConfig()
        profiles = awsconfig.get_profiles()

        profile_summary = {}
        for profile in profiles:
            profile_summary[profile] = {}
            profile_summary[profile]['access_key_id'] = \
                awsconfig.get_aws_access_key_id(profile)
            profile_summary[profile]['secret_access_key'] = \
                awsconfig.get_aws_secret_access_key(profile)

        if namespace.output == "json":
            pprinter = pprint.PrettyPrinter()
            pprinter.pprint(profile_summary)
        else:
            # Setup table.
            header = ["Profile Name", "Access Key ID", "Secret Access Key"]
            table = prettytable.PrettyTable(header)

            for profile in profile_summary.keys():
                row = [profile,
                       profile_summary[profile]['access_key_id'],
                       profile_summary[profile]['secret_access_key']]
                table.add_row(row)

            print table
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号