def cli(profile):
    """List buckets and objects in a given bucket."""
    global session, bucket_manager, domain_manager, cert_manager, dist_manager
    session_cfg = {}
    if profile:
        session_cfg['profile_name'] = profile
    session = boto3.Session(**session_cfg)
    bucket_manager = BucketManager(session)
    domain_manager = DomainManager(session)
    cert_manager = CertificateManager(session)
    dist_manager = DistributionManager(session)
Ejemplo n.º 2
0
def cli(profile):
    """Webotron deploys websites to AWS."""
    global session, bucket_manager, domain_manager, cert_manager, dist_manager
    session_cfg = {}
    if profile:
        session_cfg['profile_name'] = profile
    session = boto3.Session(**session_cfg)
    bucket_manager = BucketManager(session)
    domain_manager = DomainManager(session)
    cert_manager = CertificateManager(session)
    dist_manager = DistributionManager(session)
def cli(profile):
    """Grop all the click commands."""
    global session, bucket_manager, domain_manager, cert_manager, dist_manager
    session_data = {}
    if profile:
        session_data['profile_name'] = profile
    session = boto3.Session(**session_data)
    bucket_manager = BucketManager(session)
    domain_manager = DomainManager(session)
    cert_manager = CertificateManager(session)
    dist_manager = DistributionManager(session)
Ejemplo n.º 4
0
def cli(profile):
    """Webotron deploys websites to AWS."""
    global SESSION, BUCKET_MANAGER, DOMAIN_MANAGER, CERT_MANAGER, DIST_MANAGER

    session_cfg = {}
    if profile:
        session_cfg['profile_name'] = profile

    SESSION = boto3.Session(**session_cfg)
    BUCKET_MANAGER = BucketManager(SESSION)
    DOMAIN_MANAGER = DomainManager(SESSION)
    CERT_MANAGER = CertificateManager(SESSION)
    DIST_MANAGER = DistributionManager(SESSION)
def cli(profile):
    """Webotron deploys websites to AWS."""
    global session, bucket_manager, domain_manager, cert_manager, dist_manager
    session_cfg = {}
    if profile:
        session_cfg['profile_name'] = profile
    else:
        raise ValueError("Please provide a profile with the --profile option")

    session = boto3.Session(**session_cfg)
    bucket_manager = BucketManager(session)
    domain_manager = DomainManager(session)
    cert_manager = CertificateManager(session)
    dist_manager = DistributionManager(session)
Ejemplo n.º 6
0
def cli(profile, region):
    """Webotron deploys websites to AWS."""
    global SESSION, BUCKET_MANAGER,\
        DOMAIN_MANAGER, CERTIFICATE_MANAGER, DIST_MANAGER
    session_cfg = {}
    if profile:
        session_cfg['profile_name'] = profile
    else:
        sys.exit("Be careful when using default aws profile. \
                 Use --profile=name instead")
    if region:
        session_cfg['region_name'] = region

    SESSION = boto3.Session(**session_cfg)
    BUCKET_MANAGER = BucketManager(SESSION)
    DOMAIN_MANAGER = DomainManager(SESSION)
    CERTIFICATE_MANAGER = CertificateManager(SESSION)
    DIST_MANAGER = DistributionManager(SESSION)
Ejemplo n.º 7
0
def cli(profile):
    """Webotron deploys websites to AWS."""  # Docstring

    # reassign these values, so other functions can use them.
    global session, bucket_manager, domain_manager, cert_manager, dist_manager
    session_cfg = {}

    if profile:
        session_cfg['profile_name'] = profile
    else:
        session_cfg['profile_name'] = 'default'

    session = boto3.Session(
        **session_cfg)  # loads the provided section of ~/.aws/config file
    bucket_manager = BucketManager(session)
    domain_manager = DomainManager(session)
    cert_manager = CertificateManager(session)
    dist_manager = DistributionManager(session)
Ejemplo n.º 8
0
def cli(profile):
    """Webotron deploys websites to AWS."""
    global session, bucket_manager, domain_manager, cert_manager, dist_manager
    session_cfg = {}
    if profile:
        session_cfg['profile_name'] = profile
        try:
            session = boto3.Session(**session_cfg)
            bucket_manager = BucketManager(session)
            domain_manager = DomainManager(session)
            cert_manager = CertificateManager(session)
            dist_manager = DistributionManager(session)
        except ProfileNotFound as e:
            print(e)
            exit()
    else:
        raise NoCredentialsError(
            "Please input profile name with --profile flag"
        )
        exit()
Ejemplo n.º 9
0
- Configure coding
"""

import boto3
import click

from webotron.bucket import BucketManager
from webotron.domain import DomainManager
from webotron.certificate import CertificateManager
from webotron.cdn import DistributionManager

session = boto3.Session(profile_name='pythonAutomation')
bucket_manager = BucketManager(session)
domain_manager = DomainManager(session)
cert_manager = CertificateManager(session)
dist_manager = DistributionManager(session)

#s3 = session.resource('s3')


@click.group()
def cli():
    """Webotron deploys websites to AWS."""
    pass


@cli.command('find-cert')
@click.argument('domain')
def find_cert(domain):
    print(cert_manager.find_matching_cert(domain))