def enable_rls(args): io.start('Enabling row level security on entity type %s' % highlight(args.entity)) ensure_resource_exists(args.entity, ResourceType.ENTITY_TYPE) post(config().get('api', 'rls'), data={ 'id': args.entity, 'rlsEnabled': True })
def enable_rls(args): if not io.confirm( 'Are you sure you want to disable row level security on %s?' % args.entity): return io.start('Disabling row level security on entity type %s' % highlight(args.entity)) ensure_resource_exists(args.entity, ResourceType.ENTITY_TYPE) post(config.api('rls'), data={'id': args.entity, 'rlsEnabled': False})
def _get_resource_type(args): resource_id = args.resource if args.entity_type: ensure_resource_exists(resource_id, ResourceType.ENTITY_TYPE) return ResourceType.ENTITY_TYPE elif args.package: ensure_resource_exists(resource_id, ResourceType.PACKAGE) return ResourceType.PACKAGE elif args.plugin: ensure_resource_exists(resource_id, ResourceType.PLUGIN) return ResourceType.PLUGIN else: # No resource type specified, let's guess it results = dict() for resource_type in ResourceType: if resource_exists(resource_id, resource_type): results[resource_type.get_label()] = resource_id if len(results) == 0: raise McmdError('No resources found with id %s' % resource_id) elif len(results) > 1: choices = results.keys() answer = multi_choice('Multiple resources found for id %s. Choose one:' % resource_id, choices) return ResourceType.of_label(answer) else: return ResourceType.of_label(list(results)[0])
def _get_resource_type(args): resource_id = args.resource if args.entity_type: ensure_resource_exists(resource_id, ResourceType.ENTITY_TYPE) return ResourceType.ENTITY_TYPE elif args.package: ensure_resource_exists(resource_id, ResourceType.PACKAGE) return ResourceType.PACKAGE elif args.plugin: ensure_resource_exists(resource_id, ResourceType.PLUGIN) return ResourceType.PLUGIN else: return _guess_resource_type(resource_id)
def delete_entity(args): ensure_resource_exists(args.entity_type, ResourceType.ENTITY_TYPE) if args.force or (not args.force and io.confirm( 'Are you sure you want to remove the complete entity: {}?'.format( args.entity_type))): _delete_entity_type(args.entity_type)
def delete_all_data(args): ensure_resource_exists(args.entity_type, ResourceType.ENTITY_TYPE) if args.force or (not args.force and io.confirm( 'Are you sure you want to remove all data from entity: {}?'.format( args.entity_type))): _delete_all_data(args.entity_type)