Пример #1
0
class LogsClient(ClientFactory):
    """Cloudformation command client"""
    def __init__(self):
        self._logs = Logs(args)
        self._dispatcher = Dispatcher()

    def execute(self):
        if self._args.get('tail'):
            self._dispatcher.run(TailCommand(self._logs))
        else:
            Oprint.err('Command option is required', 'lmdo')
Пример #2
0
class S3Client(ClientFactory):
    """Cloudformation command client"""
    def __init__(self, args):
        self._s3 = S3()
        self._dispatcher = Dispatcher()
        self._args = args

    def execute(self):
        if self._args.get('sync'):
            self._dispatcher.run(SyncCommand(self._s3))
        else:
            Oprint.err('sync command option is required', 'lmdo')
Пример #3
0
class BpClient(ClientFactory):
    """Init command client"""
    def __init__(self, args):
        self._boiler_plate = BoilerPlate(args)
        self._dispatcher = Dispatcher()
        self._args = args

    def execute(self):
        if self._args.get('init'):
            self._dispatcher.run(InitCommand(self._boiler_plate))

        if self._args.get('bp'):
            if self._args.get('fetch'):
                self._dispatcher.run(FetchCommand(self._boiler_plate))
Пример #4
0
class DeployClient(ClientFactory):
    """Cloudformation command client"""
    def __init__(self, args):
        self._cloudformation = Cloudformation()
        self._lambda = AWSLambda()
        self._apigateway = Apigateway()
        self._cloudwatchevent = CloudWatchEvent()
        self._dispatcher = Dispatcher()
        self._args = args

    def execute(self):
        Oprint.info('Start deploying service', 'lmdo')
        self._dispatcher.run(CreateCommand(self._cloudformation))
        self._dispatcher.run(CreateCommand(self._lambda))
        self._dispatcher.run(CreateCommand(self._apigateway))
        self._dispatcher.run(CreateCommand(self._cloudwatchevent))
        Oprint.info('Complete deploying service', 'lmdo')
Пример #5
0
class DestroyClient(ClientFactory):
    """Cloudformation command client"""
    def __init__(self, args):
        self._cloudformation = Cloudformation()
        self._lambda = AWSLambda()
        self._apigateway = Apigateway()
        self._cloudwatchevent = CloudWatchEvent()
        self._dispatcher = Dispatcher()
        self._args = args

    def execute(self):
        Oprint.info('Start tear down service', 'lmdo')
        self._dispatcher.run(DeleteCommand(self._apigateway))
        self._dispatcher.run(DeleteCommand(self._lambda))
        self._dispatcher.run(DeleteCommand(self._cloudformation))
        self._dispatcher.run(DeleteCommand(self._cloudwatchevent))
        Oprint.info('Service has been destroy', 'lmdo')
Пример #6
0
class LmClient(ClientFactory):
    """Lambda command client"""
    def __init__(self, args):
        self._lambda = AWSLambda()
        self._dispatcher = Dispatcher()
        self._args = args

    def execute(self):
        if self._args.get('create'):
            self._dispatcher.run(CreateCommand(self._lambda))
        elif self._args.get('update'):
            self._dispatcher.run(UpdateCommand(self._lambda))
        elif self._args.get('delete'):
            self._dispatcher.run(DeleteCommand(self._lambda))
        elif self._args.get('package'):
            self._dispatcher.run(PackageCommand(self._lambda))
        else:
            Oprint.err(
                'create|update|delete|package command option is required',
                'lmdo')
Пример #7
0
class CfClient(ClientFactory):
    """Cloudformation command client"""
    def __init__(self, args):
        self._cloudformation = Cloudformation()
        self._dispatcher = Dispatcher()
        self._args = args

    def execute(self):
        if self._args.get('create'):
            self._dispatcher.run(CreateCommand(self._cloudformation))
        elif self._args.get('update'):
            self._dispatcher.run(UpdateCommand(self._cloudformation))
        elif self._args.get('delete'):
            self._dispatcher.run(DeleteCommand(self._cloudformation))
        else:
            Oprint.err('create|update|delete command option is required',
                       'lmdo')
Пример #8
0
class ApiClient(ClientFactory):
    """Cloudformation command client"""
    def __init__(self, args):
        self._apigateway = Apigateway()
        self._dispatcher = Dispatcher()
        self._args = args

    def execute(self):
        if self._args.get('create'):
            self._dispatcher.run(CreateCommand(self._apigateway))
        elif self._args.get('update'):
            self._dispatcher.run(UpdateCommand(self._apigateway))
        elif self._args.get('delete'):
            self._dispatcher.run(DeleteCommand(self._apigateway))
        elif self._args.get('create-stage'):
            self._dispatcher.run(CreateStageCommand(self._apigateway))
        elif self._args.get('delete-stage'):
            self._dispatcher.run(DeleteStageCommand(self._apigateway))
        elif self._args.get('create-domain'):
            self._dispatcher.run(CreateDomainCommand(self._apigateway))
        elif self._args.get('delete-domain'):
            self._dispatcher.run(DeleteDomainCommand(self._apigateway))
        elif self._args.get('create-mapping'):
            self._dispatcher.run(CreateMappingCommand(self._apigateway))
        elif self._args.get('delete-mapping'):
            self._dispatcher.run(DeleteMappingCommand(self._apigateway))
        else:
            Oprint.err('create|update|delete command option is required',
                       'lmdo')