def lambda_deploy( ctx, verbose, nocache, yes, warn, disable_validation, quiet_changes_only, hooks_only, cfn_lint, config_scope, home='.', ): """ Deploy Lambda code to AWS. """ paco_ctx = ctx.obj command = 'lambda deploy' controller_type, obj = init_cloud_command(command, paco_ctx, verbose, nocache, yes, warn, disable_validation, quiet_changes_only, hooks_only, cfn_lint, config_scope, home) controller = paco_ctx.get_controller(controller_type, command, obj) controller.lambda_deploy_command(obj)
def set_command( paco_ctx, verbose, nocache, yes, warn, disable_validation, quiet_changes_only, config_scope, home='.', ): """Set the value of a cloud resource""" command = 'set' controller_type, obj = init_cloud_command( command, paco_ctx, verbose, nocache, yes, warn, disable_validation, quiet_changes_only, config_scope, home ) controller = paco_ctx.get_controller(controller_type, command, obj) controller.set_command(obj)
def validate_command( paco_ctx, verbose, nocache, yes, warn, disable_validation, quiet_changes_only, hooks_only, config_scope, home='.' ): "Validate resources" command = 'validate' controller_type, obj = init_cloud_command( command, paco_ctx, verbose, nocache, yes, warn, disable_validation, quiet_changes_only, hooks_only, config_scope, home ) controller = paco_ctx.get_controller(controller_type, 'validate', obj) controller.validate()
def delete_command(paco_ctx, verbose, nocache, yes, warn, disable_validation, quiet_changes_only, hooks_only, config_scope, home='.'): """Deletes provisioned Cloud Resources""" command = 'delete' controller_type, obj = init_cloud_command(command, paco_ctx, verbose, nocache, yes, warn, disable_validation, quiet_changes_only, hooks_only, config_scope, home) answer = paco_ctx.input_confirm_action( "Proceed with deletion of {}?".format(config_scope)) if answer == False: print("Aborted delete operation.") return controller = paco_ctx.get_controller(controller_type, 'delete', obj) controller.delete()
def lambda_invoke( ctx, verbose, nocache, yes, warn, disable_validation, quiet_changes_only, hooks_only, config_scope, home='.', event='', event_file='', ): """ Invoke a provisioned Lambda """ paco_ctx = ctx.obj command = 'lambda invoke' if event_file != '' and event != '': print( "Can not supply both -e,--event and -f,--event-file options. Event must be one or the other." ) sys.exit() if event_file != '': try: with open(event_file, 'r') as fh: event = fh.read() except FileNotFoundError: print( f"No file exists at the location supplied with the -f,--event-file option:\n\n {event_file}\n" ) sys.exit() if event != '': # validate the JSON try: json.loads(event) except json.decoder.JSONDecodeError: print("Event supplied is not in valid JSON format.") sys.exit() else: event = None controller_type, obj = init_cloud_command(command, paco_ctx, verbose, nocache, yes, warn, disable_validation, quiet_changes_only, hooks_only, config_scope, home) controller = paco_ctx.get_controller(controller_type, command, obj) controller.lambda_invoke_command(obj, event)
def provision_command(paco_ctx, verbose, nocache, yes, disable_validation, quiet_changes_only, config_scope, home='.'): """Provision Cloud Resources""" command = 'provision' controller_type, obj = init_cloud_command(command, paco_ctx, verbose, nocache, yes, disable_validation, quiet_changes_only, config_scope, home) controller = paco_ctx.get_controller(controller_type, command, obj) controller.provision()
def provision_command( paco_ctx, verbose, nocache, yes, warn, disable_validation, quiet_changes_only, hooks_only, config_scope, home='.', auto_publish_code=False, ): """Provision Cloud Resources""" paco_ctx.auto_publish_code = auto_publish_code command = 'provision' controller_type, obj = init_cloud_command(command, paco_ctx, verbose, nocache, yes, warn, disable_validation, quiet_changes_only, hooks_only, config_scope, home) controller = paco_ctx.get_controller(controller_type, command, obj) controller.provision()