Class ImportExportApi

    • Constructor Detail

      • ImportExportApi

        public ImportExportApi​(GitLabApi gitLabApi)
    • Method Detail

      • scheduleExport

        public void scheduleExport​(Object projectIdOrPath)
                            throws GitLabApiException
        Schedule an export.
        GitLab Endpoint: POST /projects/:id/export
        Parameters:
        projectIdOrPath - the project in the form of an Integer(ID), String(path), or Project instance
        Throws:
        GitLabApiException - if any exception occurs
      • scheduleExport

        public void scheduleExport​(Object projectIdOrPath,
                                   String description)
                            throws GitLabApiException
        Schedule an export.
        GitLab Endpoint: POST /projects/:id/export
        Parameters:
        projectIdOrPath - the project in the form of an Integer(ID), String(path), or Project instance
        description - overrides the project description, optional
        Throws:
        GitLabApiException - if any exception occurs
      • scheduleExport

        public void scheduleExport​(Object projectIdOrPath,
                                   String description,
                                   Map<String,​String> upload,
                                   String uploadUrl,
                                   String uploadHttpMethod)
                            throws GitLabApiException
        Schedule an export.
        GitLab Endpoint: POST /projects/:id/export
        Parameters:
        projectIdOrPath - the project in the form of an Integer(ID), String(path), or Project instance
        description - overrides the project description, optional
        upload - Mao that contains the information to upload the exported project to a web server
        uploadUrl - the URL to upload the project
        uploadHttpMethod - the HTTP method to upload the exported project. Only PUT and POST methods allowed. Default is PUT
        Throws:
        GitLabApiException - if any exception occurs
      • getExportStatus

        public ExportStatus getExportStatus​(Object projectIdOrPath)
                                     throws GitLabApiException
        Get the status of export.
        GitLab Endpoint: GET /projects/:id/export
        Parameters:
        projectIdOrPath - the project in the form of an Integer(ID), String(path), or Project instance
        Returns:
        an ExportStatus instance holding information on the export status
        Throws:
        GitLabApiException - if any exception occurs
      • downloadExport

        public File downloadExport​(Object projectIdOrPath,
                                   File directory)
                            throws GitLabApiException
        Download the finished export.
        GitLab Endpoint: GET /projects/:id/export/download
        Parameters:
        projectIdOrPath - the project in the form of an Integer(ID), String(path), or Project instance
        directory - the File instance of the directory to save the export file to, if null will use "java.io.tmpdir"
        Returns:
        a File instance pointing to the download of the project export file
        Throws:
        GitLabApiException - if any exception occurs
      • startImport

        public ImportStatus startImport​(Object namespaceIdOrPath,
                                        File exportFile,
                                        String path,
                                        Boolean overwrite,
                                        Project overrideParams)
                                 throws GitLabApiException

        Import an exported project. The following properties on the Project instance are utilized in the creation of the new project:

        • defaultBranch (optional) - master by default
        • description (optional) - short project description
        • visibility (optional) - Limit by visibility public, internal, or private
        • visibilityLevel (optional)
        • issuesEnabled (optional) - Enable issues for this project
        • mergeMethod (optional) - Set the merge method used
        • mergeRequestsEnabled (optional) - Enable merge requests for this project
        • wikiEnabled (optional) - Enable wiki for this project
        • snippetsEnabled (optional) - Enable snippets for this project
        • jobsEnabled (optional) - Enable jobs for this project
        • containerRegistryEnabled (optional) - Enable container registry for this project
        • sharedRunnersEnabled (optional) - Enable shared runners for this project
        • publicJobs (optional) - If true, jobs can be viewed by non-project-members
        • onlyAllowMergeIfPipelineSucceeds (optional) - Set whether merge requests can only be merged with successful jobs
        • onlyAllowMergeIfAllDiscussionsAreResolved (optional) - Set whether merge requests can only be merged when all the discussions are resolved
        • lLfsEnabled (optional) - Enable LFS
        • requestAccessEnabled (optional) - Allow users to request member access
        • repositoryStorage (optional) - Which storage shard the repository is on. Available only to admins
        • approvalsBeforeMerge (optional) - How many approvers should approve merge request by default
        • printingMergeRequestLinkEnabled (optional) - Show link to create/view merge request when pushing from the command line
        • resolveOutdatedDiffDiscussions (optional) - Automatically resolve merge request diffs discussions on lines changed with a push
        • initialize_with_readme (optional) - Initialize project with README file
        • packagesEnabled (optional) - Enable or disable mvn packages repository feature
        GitLab Endpoint: POST /projects/import
        Parameters:
        namespaceIdOrPath - the ID or path of the namespace that the project will be imported to. Defaults to the current user’s namespace
        exportFile - the project export file to be imported
        path - the name and path for the new project
        overwrite - if there is a project with the same path the import will overwrite it. Defaults to false
        overrideParams - overriding project params, supports all fields defined by the ProjectApi, optional
        Returns:
        an Importstatus instance with info for the project being imported to
        Throws:
        GitLabApiException - if any exception occurs
      • getImportStatus

        public ImportStatus getImportStatus​(Object projectIdOrPath)
                                     throws GitLabApiException
        Get the status of an import.
        GitLab Endpoint: GET /projects/:id/import
        Parameters:
        projectIdOrPath - the new (imported) project identifier in the form of an Integer(ID), String(path), or Project instance
        Returns:
        an ImportStatus instance holding information on the import status
        Throws:
        GitLabApiException - if any exception occurs