Exemple #1
0
 def __init__(self, data_service, project, new_project_name):
     """
     Create an activity for our copy operation so users can trace back where the copied files came from.
     :param data_service: DataServiceApi: service used to create the activity
     :param project: RemoteProject project name we will download files from
     :param new_project_name: str project name we will upload files into
     """
     self.data_service = data_service
     self.name = "DukeDSClient copying project: {}".format(project.name)
     self.desc = "Copying {} to project {} using DukeDSClient{}".format(project.name, new_project_name,
                                                                        get_internal_version_str())
     self.started = self._current_timestamp_str()
     result = data_service.create_activity(self.name, self.desc, started_on=self.started)
     self.id = result.json()['id']
     self.remote_path_to_file_version_id = {}
Exemple #2
0
 def _create_parser(self):
     """
     Create a parser hooking up the command methods below to be run when chosen.
     :return: CommandParser parser with commands attached.
     """
     parser = CommandParser(get_internal_version_str())
     parser.register_list_command(self._setup_run_command(ListCommand))
     parser.register_upload_command(self._setup_run_command(UploadCommand))
     parser.register_add_user_command(self._setup_run_command(AddUserCommand))
     parser.register_remove_user_command(self._setup_run_command(RemoveUserCommand))
     parser.register_download_command(self._setup_run_command(DownloadCommand))
     parser.register_share_command(self._setup_run_command(ShareCommand))
     parser.register_deliver_command(self._setup_run_command(DeliverCommand))
     parser.register_delete_command(self._setup_run_command(DeleteCommand))
     parser.register_list_auth_roles_command(self._setup_run_command(ListAuthRolesCommand))
     return parser
Exemple #3
0
 def __init__(self, data_service, project_name, new_project_name):
     """
     Create an activity for our copy operation so users can trace back where the copied files came from.
     :param data_service: DataServiceApi: service used to create the activity
     :param project_name: str project name we will download files from
     :param new_project_name: str project name we will upload files into
     """
     self.data_service = data_service
     self.name = "DukeDSClient copying project: {}".format(project_name)
     self.desc = "Copying {} to project {} using DukeDSClient{}".format(
         project_name, new_project_name, get_internal_version_str())
     self.started = self._current_timestamp_str()
     result = data_service.create_activity(self.name,
                                           self.desc,
                                           started_on=self.started)
     self.id = result.json()['id']
     self.remote_path_to_file_version_id = {}
Exemple #4
0
 def _create_parser(self):
     """
     Create a parser hooking up the command methods below to be run when chosen.
     :return: CommandParser parser with commands attached.
     """
     parser = CommandParser(get_internal_version_str())
     parser.register_list_command(self._setup_run_command(ListCommand))
     parser.register_upload_command(self._setup_run_command(UploadCommand))
     parser.register_add_user_command(
         self._setup_run_command(AddUserCommand))
     parser.register_remove_user_command(
         self._setup_run_command(RemoveUserCommand))
     parser.register_download_command(
         self._setup_run_command(DownloadCommand))
     parser.register_share_command(self._setup_run_command(ShareCommand))
     parser.register_deliver_command(
         self._setup_run_command(DeliverCommand))
     parser.register_delete_command(self._setup_run_command(DeleteCommand))
     parser.register_list_auth_roles_command(
         self._setup_run_command(ListAuthRolesCommand))
     return parser
Exemple #5
0
def get_user_agent_str():
    """
    Returns the user agent: DukeDSClient/<version>
    :return: str: user agent value
    """
    return '{}/{}'.format(APP_NAME, get_internal_version_str())
Exemple #6
0
def get_user_agent_str():
    """
    Returns the user agent: DukeDSClient/<versigon>
    :return: str: user agent value
    """
    return '{}/{}'.format(APP_NAME, get_internal_version_str())