Example #1
0
 def get_parser(self, prog_name):
     parser = super(FilesCopy, self).get_parser(prog_name)
     parser = AgaveURI.extend_parser(self, parser)
     parser.add_argument('destination',
                         metavar='<destination>',
                         help='Destination path')
     return parser
Example #2
0
    def take_action(self, parsed_args):
        parsed_args = FilesPemsFormatMany.preprocess_args(self, parsed_args)
        headers = Permission.get_headers(self, self.VERBOSITY,
                                         parsed_args.formatter)
        self.update_payload(parsed_args)
        (storage_system, file_path) = AgaveURI.parse_url(parsed_args.agave_uri)
        results = pems_list(file_path,
                            system_id=storage_system,
                            limit=parsed_args.limit,
                            offset=parsed_args.offset,
                            permissive=False,
                            agave=self.tapis_client)

        records = []
        for rec in results:
            record = []
            # Table display
            if self.app_verbose_level > self.VERBOSITY:
                record.append(rec.get('username'))
                record.extend(Permission.pem_to_row(rec.get('permission', {})))
            else:
                for key in headers:
                    val = self.render_value(rec.get(key, None))
                    record.append(val)
            # Deal with an API-side bug where >1 identical pems are
            # returned for the owning user when no additional pems have been
            # granted on the app
            if record not in records:
                records.append(record)

        return (tuple(headers), tuple(records))
Example #3
0
    def take_action(self, parsed_args):
        parsed_args = self.preprocess_args(parsed_args)
        self.requests_client.setup(API_NAME, SERVICE_VERSION)
        self.update_payload(parsed_args)

        (storage_system, file_path) = AgaveURI.parse_url(parsed_args.agave_uri)
        dir_name = parsed_args.dir_name
        if dir_name is None:
            dir_name = ''

        headers = self.render_headers(FileStaging, parsed_args)
        rec = makedirs(dir_name,
                       system_id=storage_system,
                       destination=file_path,
                       exist_ok=True,
                       permissive=False,
                       agave=self.tapis_client)

        # Fixes issue where the name of the listed file/directory is not
        # returned by the files service
        if rec['name'] == '.':
            rec['name'] = os.path.basename(rec['path'])
        # Coerce path to absolute path
        rec['path'] = abspath(rec['path'], '/')

        data = []
        for key in headers:
            try:
                val = rec[key]
            except KeyError:
                val = None
            data.append(self.render_value(val))

        return (tuple(headers), tuple(data))
Example #4
0
 def get_parser(self, prog_name):
     parser = super(FilesMakeDir, self).get_parser(prog_name)
     parser = AgaveURI.extend_parser(self, parser)
     parser.add_argument(
         'dir_name',
         metavar='DIRECTORY',
         help='Name of the new directory (relative to <agave_uri>)')
     return parser
Example #5
0
 def get_parser(self, prog_name):
     parser = super(FilesPemsGrant, self).get_parser(prog_name)
     parser = AgaveURI.extend_parser(self, parser)
     parser = Username.extend_parser(self, parser)
     parser.add_argument('permission',
                         metavar='<permission>',
                         choices=Permission.NAMES,
                         help='Permission string ({0})'.format('| '.join(
                             Permission.NAMES)))
     return parser
Example #6
0
 def get_parser(self, prog_name):
     parser = super(FilesDownload, self).get_parser(prog_name)
     parser = AgaveURI.extend_parser(self, parser)
     parser = IncludeFiles.extend_parser(self, parser)
     parser = ExcludeFiles.extend_parser(self, parser)
     parser = DownloadDirectoryArg.extend_parser(self, parser)
     parser = OverwritePolicy.extend_parser(self, parser)
     parser = ReportProgress.extend_parser(self, parser)
     # Other options might include:
     # --parallel : whether to attempt parallel downloads
     # --retries : max retries before error
     # --timeout : max elapsed time before error
     # --destination : explicitly specify download destination
     return parser
Example #7
0
 def get_parser(self, prog_name):
     parser = super(FilesUpload, self).get_parser(prog_name)
     # Positionals:
     #
     # CLI expects <agave_uri> <file_path> so the user can up-arrow
     # in the terminal to change the uploaded file path
     parser = AgaveURI.extend_parser(self, parser)
     parser = LocalFilePath.extend_parser(self, parser)
     # Arguments:
     #
     # parser = IncludeFiles.extend_parser(self, parser)
     parser = ExcludeFiles.extend_parser(self, parser)
     parser = OverwritePolicy.extend_parser(self, parser)
     parser = FilesCallbackURI.extend_parser(self, parser)
     parser = ReportProgress.extend_parser(self, parser)
     # --sync : wait for all files to complete staging
     return parser
Example #8
0
 def get_parser(self, prog_name):
     parser = FilesPemsFormatMany.get_parser(self, prog_name)
     parser = AgaveURI.extend_parser(self, parser)
     parser = FileOptions.extend_parser(self, parser)
     return parser
Example #9
0
 def get_parser(self, prog_name):
     parser = super(FilesPemsDrop, self).get_parser(prog_name)
     parser = AgaveURI.extend_parser(self, parser)
     return parser
Example #10
0
 def get_parser(self, prog_name):
     parser = super(FilesDelete, self).get_parser(prog_name)
     parser = AgaveURI.extend_parser(self, parser)
     parser = FileOptions.extend_parser(self, parser)
     parser = ReportProgress.extend_parser(self, parser)
     return parser
Example #11
0
 def get_parser(self, prog_name):
     parser = super(FilesPemsRevoke, self).get_parser(prog_name)
     parser = AgaveURI.extend_parser(self, parser)
     parser = Username.extend_parser(self, parser)
     return parser
Example #12
0
 def get_parser(self, prog_name):
     parser = super(FilesShow, self).get_parser(prog_name)
     parser = AgaveURI.extend_parser(self, parser)
     parser = FileOptions.extend_parser(self, parser)
     return parser