How to use the aegea.util.printing.page_output function in aegea

To help you get started, we’ve selected a few aegea examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github kislyuk / aegea / aegea / aegea_config.py View on Github external
def ls(args):
    from . import config, tweak

    def collect_kv(d, path, collector):
        for k, v in d.items():
            if isinstance(v, (dict, tweak.Config)):
                collect_kv(d[k], path + "." + k, collector)
            else:
                collector.append([path.lstrip(".") + "." + k, repr(v)])
    collector = []
    collect_kv(config, "", collector)
    page_output(format_table(collector))
github kislyuk / aegea / aegea / rds.py View on Github external
def ls(args):
    page_output(tabulate(list_rds_clusters(), args))
github kislyuk / aegea / aegea / ls.py View on Github external
def images(args):
    page_output(filter_and_tabulate(resources.ec2.images.filter(Owners=["self"]), args))
github kislyuk / aegea / aegea / ebs.py View on Github external
def ls(args):
    @lru_cache()
    def instance_id_to_name(i):
        return add_name(resources.ec2.Instance(i)).name
    table = [{f: get_cell(i, f) for f in args.columns} for i in filter_collection(resources.ec2.volumes, args)]
    if "attachments" in args.columns:
        for row in table:
            row["attachments"] = ", ".join(instance_id_to_name(a["InstanceId"]) for a in row["attachments"])
    page_output(tabulate(table, args))
github kislyuk / aegea / aegea / ls.py View on Github external
def tables(args):
    page_output(tabulate(resources.dynamodb.tables.all(), args))
github kislyuk / aegea / aegea / ls.py View on Github external
def key_pairs(args):
    page_output(tabulate(resources.ec2.key_pairs.all(), args))
github kislyuk / aegea / aegea / buckets.py View on Github external
cloudwatch = resources.cloudwatch
        bucket_region = bucket.LocationConstraint or "us-east-1"
        if bucket_region != cloudwatch.meta.client.meta.region_name:
            cloudwatch = boto3.Session(region_name=bucket_region).resource("cloudwatch")
        data = get_cloudwatch_metric_stats("AWS/S3", "NumberOfObjects",
                                           start_time=datetime.utcnow() - timedelta(days=2),
                                           end_time=datetime.utcnow(), period=3600, BucketName=bucket.name,
                                           StorageType="AllStorageTypes", resource=cloudwatch)
        bucket.NumberOfObjects = int(data["Datapoints"][-1]["Average"]) if data["Datapoints"] else None
        data = get_cloudwatch_metric_stats("AWS/S3", "BucketSizeBytes",
                                           start_time=datetime.utcnow() - timedelta(days=2),
                                           end_time=datetime.utcnow(), period=3600, BucketName=bucket.name,
                                           StorageType="StandardStorage", resource=cloudwatch)
        bucket.BucketSizeBytes = format_number(data["Datapoints"][-1]["Average"]) if data["Datapoints"] else None
        table.append(bucket)
    page_output(tabulate(table, args))
github kislyuk / aegea / aegea / batch.py View on Github external
def compute_environments(args):
    page_output(tabulate(paginate(clients.batch.get_paginator("describe_compute_environments")), args))