def createResource(self, resource_type, title, resource_file=None, resource_filename=None,<EOL>abstract=None, keywords=None,<EOL>edit_users=None, view_users=None, edit_groups=None, view_groups=None,<EOL>metadata=None, extra_metadata=None, progress_callback=None):
url = "<STR_LIT>".format(url_base=self.url_base)<EOL>close_fd = False<EOL>if resource_type not in self.resource_types:<EOL><INDENT>raise HydroShareArgumentException("<STR_LIT>".format(resource_type,<EOL>"<STR_LIT:U+002CU+0020>".join([r for r in self.resource_types])))<EOL><DEDENT>params = {'<STR_LIT>': resource_type, '<STR_LIT:title>': title}<EOL>if abstract:<EOL><INDENT>params['<STR_LIT>'] = abstract<EOL><DEDENT>if keywords:<EOL><INDENT>for (i, kw) in enumerate(keywords):<EOL><INDENT>key = "<STR_LIT>".format(index=i)<EOL>params[key] = kw<EOL><DEDENT><DEDENT>if edit_users:<EOL><INDENT>params['<STR_LIT>'] = edit_users<EOL><DEDENT>if view_users:<EOL><INDENT>params['<STR_LIT>'] = view_users<EOL><DEDENT>if edit_groups:<EOL><INDENT>params['<STR_LIT>'] = edit_groups<EOL><DEDENT>if view_groups:<EOL><INDENT>params['<STR_LIT>'] = view_groups<EOL><DEDENT>if metadata:<EOL><INDENT>params['<STR_LIT>'] = metadata<EOL><DEDENT>if extra_metadata:<EOL><INDENT>params['<STR_LIT>'] = extra_metadata<EOL><DEDENT>if resource_file:<EOL><INDENT>close_fd = self._prepareFileForUpload(params, resource_file, resource_filename)<EOL><DEDENT>encoder = MultipartEncoder(params)<EOL>if progress_callback is None:<EOL><INDENT>progress_callback = default_progress_callback<EOL><DEDENT>monitor = MultipartEncoderMonitor(encoder, progress_callback)<EOL>r = self._request('<STR_LIT:POST>', url, data=monitor, headers={'<STR_LIT:Content-Type>': monitor.content_type})<EOL>if close_fd:<EOL><INDENT>fd = params['<STR_LIT:file>'][<NUM_LIT:1>]<EOL>fd.close()<EOL><DEDENT>if r.status_code != <NUM_LIT>:<EOL><INDENT>if r.status_code == <NUM_LIT>:<EOL><INDENT>raise HydroShareNotAuthorized(('<STR_LIT:POST>', url))<EOL><DEDENT>else:<EOL><INDENT>raise HydroShareHTTPException((url, '<STR_LIT:POST>', r.status_code, params))<EOL><DEDENT><DEDENT>response = r.json()<EOL>new_resource_id = response['<STR_LIT>']<EOL>return new_resource_id<EOL>
Create a new resource.

        :param resource_type: string representing the a HydroShare resource type recognized by this
            server.
        :param title: string representing the title of the new resource
        :param resource_file: a read-only binary file-like object (i.e. opened with the flag 'rb') or a string
            representing path to file to be uploaded as part of the new resource
        :param resource_filename: string representing the filename of the resource file.  Must be specified
            if resource_file is a file-like object.  If resource_file is a string representing a valid file path,
            and resource_filename is not specified, resource_filename will be equal to os.path.basename(resource_file).
            is a string
        :param abstract: string representing abstract of resource
        :param keywords: list of strings representing keywords to associate with the resource
        :param edit_users: list of HydroShare usernames who will be given edit permissions
        :param view_users: list of HydroShare usernames who will be given view permissions
        :param edit_groups: list of HydroShare group names that will be given edit permissions
        :param view_groups: list of HydroShare group names that will be given view permissions
        :param metadata: json string data for each of the metadata elements
        :param extra_metadata: json string data for key/value pair metadata elements defined by user
        :param progress_callback: user-defined function to provide feedback to the user about the progress
            of the upload of resource_file.  For more information, see:
            http://toolbelt.readthedocs.org/en/latest/uploading-data.html#monitoring-your-streaming-multipart-upload

        :return: string representing ID of newly created resource.

        :raises: HydroShareArgumentException if any parameters are invalid.
        :raises: HydroShareNotAuthorized if user is not authorized to perform action.
        :raises: HydroShareHTTPException if an unexpected HTTP response code is encountered.