def cli(profile): """Webotron deploys websites to AWS.""" global session, bucket_manager, domain_manager session_cfg = {} if profile: session_cfg['profile_name'] = profile session = boto3.Session(**session_cfg) bucket_manager = BucketManager(session) domain_manager = DomainManager(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 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, util_manager session_cfg = {} if profile: session_cfg['profile_name'] = profile else: session_cfg['profile_name'] = 'pythonAutomation' session = boto3.Session(**session_cfg) # glob that will unwrap to fit func bucket_manager = BucketManager(session) domain_manager = DomainManager(session) util_manager = UtilManager()
def cli(profile): """Deploys websites to AWS.""" global SESSION, BUCKET_MANAGER, DOMAIN_MANAGER, CERT_MANAGER, DIST_MANAGER session_cfg = {} if profile: session_cfg['profile_name'] = profile session_cfg['region_name'] = 'eu-west-2' SESSION = boto3.Session(**session_cfg) BUCKET_MANAGER = BucketManager(SESSION) DOMAIN_MANAGER = DomainManager(SESSION) CERT_MANAGER = CertificateManager(SESSION) DIST_MANAGER = DistributionManager(SESSION)
def cli(profile): """This script executes various commands for S3""" global session, bucket_manager, domain_manager, certificate_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) certificate_manager = CertificateManager(session) dist_manager = DistributionManager(session)
# coding: utf-8 import csv from domain import DomainManager import boto3 import click import util session = None domain_manager = None session_cfg = {} session = boto3.Session(**session_cfg) domain_manager = DomainManager(session) public_hosted_zones = domain_manager.get_public_hosted_zones() print("All my public zones: ", public_hosted_zones, "\n\n") # Lets find all the A records for this hosted zone. response = domain_manager.get_a_records(public_hosted_zones[0]) print("A Records response: ", response, "\n\n") # Get Alias State (arec_name, dns_name) alias_state = [] alias_state_fn = 'alias_state.txt' with open(alias_state_fn) as csv_file: csv_reader = csv.reader(csv_file, delimiter=',') line_count = 0 for row in csv_reader:
import boto3 import click from botocore.exceptions import ClientError from pathlib import Path import mimetypes from bucket import BucketManager from domain import DomainManager from certificate import CertificateManager from cloudfront import CDNManager session = boto3.Session(profile_name='pythonAutomation') bucket_manager = BucketManager(session) #object of class domain_manager = DomainManager(session) cert_manager = CertificateManager(session) cdn_manager = CDNManager(session) @click.group() def cli(): "Webotron deploys websites to AWS" pass @cli.command('list-buckets') def list_buckets(): "list all s3 buckets" for i in bucket_manager.list_all_buckets(): print(i) @cli.command('list-bucket-objects')