def Handle(self, args, token=None): ValidateVfsPath(args.file_path) aff4_path = args.client_id.ToClientURN().Add(args.file_path) fd = aff4.FACTORY.Open(aff4_path, token=token) if args.max_depth == 1: flow_args = filesystem.ListDirectoryArgs(pathspec=fd.real_pathspec) flow_urn = flow.StartFlow( client_id=args.client_id.ToClientURN(), flow_name=filesystem.ListDirectory.__name__, args=flow_args, notify_to_user=args.notify_user, token=token) else: flow_args = filesystem.RecursiveListDirectoryArgs( pathspec=fd.real_pathspec, max_depth=args.max_depth) flow_urn = flow.StartFlow( client_id=args.client_id.ToClientURN(), flow_name=filesystem.RecursiveListDirectory.__name__, args=flow_args, notify_to_user=args.notify_user, token=token) return ApiCreateVfsRefreshOperationResult(operation_id=str(flow_urn))
def Handle(self, args, token=None): if args.max_depth == 1: flow_args = filesystem.ListDirectoryArgs( pathspec=self._FindPathspec(args)) flow_cls = filesystem.ListDirectory else: flow_args = filesystem.RecursiveListDirectoryArgs( pathspec=self._FindPathspec(args), max_depth=args.max_depth) flow_cls = filesystem.RecursiveListDirectory flow_id = flow.StartFlow(client_id=str(args.client_id), flow_cls=flow_cls, flow_args=flow_args, creator=token.username if token else None) return ApiCreateVfsRefreshOperationResult(operation_id=flow_id)