Package org.gitlab4j.api
Class ImportExportApi
java.lang.Object
org.gitlab4j.api.AbstractApi
org.gitlab4j.api.ImportExportApi
- All Implemented Interfaces:
Constants
This class provides an entry point to all the GitLab API project import/export calls.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.gitlab4j.api.Constants
Constants.ActionType, Constants.ApplicationScope, Constants.ArchiveFormat, Constants.AutoDevopsDeployStrategy, Constants.BuildGitStrategy, Constants.CommitBuildState, Constants.ContributorOrderBy, Constants.DeploymentOrderBy, Constants.DeploymentStatus, Constants.DeployTokenScope, Constants.Encoding, Constants.EpicOrderBy, Constants.EventScope, Constants.GroupOrderBy, Constants.GroupSearchScope, Constants.ImpersonationState, Constants.IssueOrderBy, Constants.IssueScope, Constants.IssueState, Constants.JobScope, Constants.LineType, Constants.MergeRequestOrderBy, Constants.MergeRequestScope, Constants.MergeRequestSearchIn, Constants.MergeRequestState, Constants.MilestoneState, Constants.PackageOrderBy, Constants.PackageStatus, Constants.PipelineOrderBy, Constants.PipelineScope, Constants.ProjectOrderBy, Constants.ProjectSearchScope, Constants.SearchScope, Constants.SortOrder, Constants.SquashOption, Constants.StateEvent, Constants.TagOrderBy, Constants.TargetType, Constants.TodoAction, Constants.TodoState, Constants.TodoType, Constants.TokenType
-
Field Summary
Fields inherited from class org.gitlab4j.api.AbstractApi
gitLabApi
Fields inherited from interface org.gitlab4j.api.Constants
NEXT_PAGE_HEADER, PAGE_HEADER, PAGE_PARAM, PER_PAGE, PER_PAGE_PARAM, PREV_PAGE_HEADER, TOTAL_HEADER, TOTAL_PAGES_HEADER
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptiondownloadExport
(Object projectIdOrPath, File directory) Download the finished export.downloadExport
(Object projectIdOrPath, File directory, String filename) Download the finished export.getExportStatus
(Object projectIdOrPath) Get the status of export.getImportStatus
(Object projectIdOrPath) Get the status of an import.void
scheduleExport
(Object projectIdOrPath) Schedule an export.void
scheduleExport
(Object projectIdOrPath, String description) Schedule an export.void
scheduleExport
(Object projectIdOrPath, String description, Map<String, String> upload, String uploadUrl, String uploadHttpMethod) Schedule an export.startImport
(Object namespaceIdOrPath, File exportFile, String path, Boolean overwrite, Project overrideParams) Import an exported project.Methods inherited from class org.gitlab4j.api.AbstractApi
addFormParam, addFormParam, delete, delete, get, get, getApiClient, getApiVersion, getDefaultPerPage, getDefaultPerPageParam, getDefaultPerPageParam, getGroupIdOrPath, getLabelIdOrName, getPageQueryParams, getPageQueryParams, getPerPageQueryParam, getProjectIdOrPath, getUserIdOrUsername, getWithAccepts, handle, head, isApiVersion, patch, patch, post, post, post, post, post, put, put, put, putUpload, putUpload, putWithFormData, upload, upload, upload, upload, urlEncode, validate
-
Constructor Details
-
ImportExportApi
-
-
Method Details
-
scheduleExport
Schedule an export.GitLab Endpoint: POST /projects/:id/export
- Parameters:
projectIdOrPath
- the project in the form of an Long(ID), String(path), or Project instance- Throws:
GitLabApiException
- if any exception occurs
-
scheduleExport
Schedule an export.GitLab Endpoint: POST /projects/:id/export
- Parameters:
projectIdOrPath
- the project in the form of an Long(ID), String(path), or Project instancedescription
- 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 GitLabApiExceptionSchedule an export.GitLab Endpoint: POST /projects/:id/export
- Parameters:
projectIdOrPath
- the project in the form of an Long(ID), String(path), or Project instancedescription
- overrides the project description, optionalupload
- Mao that contains the information to upload the exported project to a web serveruploadUrl
- the URL to upload the projectuploadHttpMethod
- the HTTP method to upload the exported project. Only PUT and POST methods allowed. Default is PUT- Throws:
GitLabApiException
- if any exception occurs
-
getExportStatus
Get the status of export.GitLab Endpoint: GET /projects/:id/export
- Parameters:
projectIdOrPath
- the project in the form of an Long(ID), String(path), or Project instance- Returns:
- an ExportStatus instance holding information on the export status
- Throws:
GitLabApiException
- if any exception occurs
-
downloadExport
Download the finished export.GitLab Endpoint: GET /projects/:id/export/download
- Parameters:
projectIdOrPath
- the project in the form of an Long(ID), String(path), or Project instancedirectory
- 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
-
downloadExport
public File downloadExport(Object projectIdOrPath, File directory, String filename) throws GitLabApiException Download the finished export.GitLab Endpoint: GET /projects/:id/export/download
- Parameters:
projectIdOrPath
- the project in the form of an Long(ID), String(path), or Project instancedirectory
- the File instance of the directory to save the export file to, if null will use "java.io.tmpdir"filename
- Name to give to the downloaded file. If null then we try to get from Content-Disposition header or to compute one from parameters- 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
- lfsEnabled (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 namespaceexportFile
- the project export file to be importedpath
- the name and path for the new projectoverwrite
- if there is a project with the same path the import will overwrite it. Defaults to falseoverrideParams
- 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
Get the status of an import.GitLab Endpoint: GET /projects/:id/import
- Parameters:
projectIdOrPath
- the new (imported) project identifier in the form of an Long(ID), String(path), or Project instance- Returns:
- an ImportStatus instance holding information on the import status
- Throws:
GitLabApiException
- if any exception occurs
-