Exemple #1
0
    def __init__(self, bucket):
        self.config = get_config()
        self.aws_config = self.__aws_config()
        self.session = Session(self.aws_access_key_id,
                               self.aws_secret_access_key)

        self.bucket = bucket
        self.s3 = self.session.client('s3')
Exemple #2
0
import click

from bigrentz.lib.config import get_config
from bigrentz.lib.storage import S3

# instantiate our S3 storage class
config = get_config()
bucket = config.get('aws', 's3_artifact_bucket')
s3 = S3(bucket=bucket)
client = s3.s3


@click.group()
def cli():
    pass


@cli.command()
def show():
    """
    List all BigRentz artifacts ending in tar.gz
    """
    objects = client.list_objects(Bucket=s3.bucket)
    keys = [i.get('Key') for i in objects.get('Contents')]
    for i in sorted([i for i in keys if i.endswith('tar.gz')]):
        click.echo(i)


@cli.command()
def show():
    """