kwargs = {} # check systemID if args.systemID is None: args.systemID = vdjpy.prompt_user('system ID') kwargs['systemId'] = args.systemID # check username if args.username is not '': if args.username is None: args.username = vdjpy.prompt_user('username') kwargs['username'] = args.username # -l if args.limit is None: args.limit = vdjpy.prompt_for_integer('limit', 250) kwargs['limit'] = args.limit # -o if args.offset is None: args.offset = vdjpy.prompt_for_integer('offset', 0) kwargs['offset'] = args.offset # get systems my_agave = vdjpy.make_vdj_agave(args.accesstoken) # if -u if args.username is not '': roles_list = my_agave.systems.getRoleForUser(**kwargs) # if no -u
projects_cache = './.vdjprojects' # make Agave object and kwargs my_agave = vdjpy.make_vdj_agave(args.accesstoken) kwargs = {} # -p if args.project is None: args.project = vdjpy.prompt_user('project name') project_uuid = vdjpy.get_uuid(args.project, my_agave) if project_uuid is None: sys.exit() # -l (for listMetadata) if args.limit is None: args.limit = vdjpy.prompt_for_integer('limit', 5000) kwargs['limit'] = args.limit # -o (for listMetadata) if args.offset is None: args.offset = vdjpy.prompt_for_integer('offset value', 0) kwargs['offset'] = args.offset # SET UP FILETYPE # -f if args.projectfile is not '' and args.jobfile is '': filetype = 'projectFile' # -j elif args.jobfile is not '' and args.projectfile is '': filetype = 'projectJobFile' else:
kwargs = {} # -s if args.systemID is None: args.systemID = vdjpy.prompt_user("system") kwargs["systemId"] = args.systemID # -p if args.path is None: args.path = vdjpy.prompt_user("path") kwargs["filePath"] = args.path # -l if args.limit is None: args.limit = vdjpy.prompt_for_integer("limit", 250) kwargs["limit"] = args.limit # -o if args.offset is None: args.offset = vdjpy.prompt_for_integer("offset", 0) kwargs["offset"] = args.offset # list permissions my_agave = vdjpy.make_vdj_agave(args.accesstoken) permissions = my_agave.files.listPermissions(**kwargs) # if -v if args.verbose: print json.dumps(permissions, default=vdjpy.json_serial, sort_keys=True, indent=4, separators=(",", ": "))
args.description_file = vdjpy.prompt_user("path to description file") body_contents = vdjpy.read_json(args.description_file) if body_contents is None: sys.exit("Not a valid file path or does not contain a valid app description.") kwargs["body"] = json.dumps(body_contents) # else, build body else: # -u if args.url is None: args.url = vdjpy.prompt_user("url of postit") kwargs["body"] = '{"url": "' + args.url + '"' # -x if args.max_uses is None: args.max_uses = vdjpy.prompt_for_integer("max number of uses", 25) kwargs["body"] += ', "maxUses": "' + str(args.max_uses) + '"' # -a no_auth = "false" if args.no_auth: no_auth = "true" kwargs["body"] += ', "noauth": ' + no_auth # -l if args.lifetime is None: args.lifetime = vdjpy.prompt_for_integer("lifetime in seconds", 2592000) kwargs["body"] += ', "lifetime": ' + str(args.lifetime) # -m if args.method is None:
) parser.add_argument( "-o", "--offset", dest="offset", type=int, default=0, nargs="?", help="number of results to skip from the start" ) parser.add_argument("-z", "--accesstoken", dest="accesstoken", nargs="?", help="access token") args = parser.parse_args() kwargs = {} # -q if args.query is None: args.query = vdjpy.prompt_user("metadata query") args.query = re.sub(r"^\'|\'$", "", args.query) args.query = urllib.quote(args.query) kwargs["q"] = args.query # -l if args.limit is None: args.limit = vdjpy.prompt_for_integer("limit", 5000) kwargs["limit"] = args.limit # -o if args.offset is None: args.offset = vdjpy.prompt_for_integer("offset value", 0) kwargs["offset"] = args.offset my_agave = vdjpy.make_vdj_agave(args.accesstoken) metadata = my_agave.meta.listMetadata(**kwargs) print json.dumps(metadata, default=vdjpy.json_serial, sort_keys=True, indent=4, separators=(",", ": "))