summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
Diffstat (limited to 'docs')
-rw-r--r--docs/api-objects.rst1
-rw-r--r--docs/gl_objects/groups.rst56
-rw-r--r--docs/gl_objects/remote_mirrors.rst34
3 files changed, 91 insertions, 0 deletions
diff --git a/docs/api-objects.rst b/docs/api-objects.rst
index 32f0d0c..32852f8 100644
--- a/docs/api-objects.rst
+++ b/docs/api-objects.rst
@@ -37,6 +37,7 @@ API examples
gl_objects/projects
gl_objects/protected_branches
gl_objects/runners
+ gl_objects/remote_mirrors
gl_objects/repositories
gl_objects/repository_tags
gl_objects/search
diff --git a/docs/gl_objects/groups.rst b/docs/gl_objects/groups.rst
index 0bc00d9..d3e4d92 100644
--- a/docs/gl_objects/groups.rst
+++ b/docs/gl_objects/groups.rst
@@ -67,6 +67,62 @@ Remove a group::
# or
group.delete()
+Import / Export
+===============
+
+You can export groups from gitlab, and re-import them to create new groups.
+
+Reference
+---------
+
+* v4 API:
+
+ + :class:`gitlab.v4.objects.GroupExport`
+ + :class:`gitlab.v4.objects.GroupExportManager`
+ + :attr:`gitlab.v4.objects.Group.exports`
+ + :class:`gitlab.v4.objects.GroupImport`
+ + :class:`gitlab.v4.objects.GroupImportManager`
+ + :attr:`gitlab.v4.objects.Group.imports`
+ + :attr:`gitlab.v4.objects.GroupManager.import_group`
+
+* GitLab API: https://docs.gitlab.com/ce/api/group_import_export.html
+
+Examples
+--------
+
+A group export is an asynchronous operation. To retrieve the archive
+generated by GitLab you need to:
+
+#. Create an export using the API
+#. Wait for the export to be done
+#. Download the result
+
+.. warning::
+
+ Unlike the Project Export API, GitLab does not provide an export_status
+ for Group Exports. It is up to the user to ensure the export is finished.
+
+ However, Group Exports only contain metadata, so they are much faster
+ than Project Exports.
+
+::
+
+ # Create the export
+ group = gl.groups.get(my_group)
+ export = group.exports.create()
+
+ # Wait for the export to finish
+ time.sleep(3)
+
+ # Download the result
+ with open('/tmp/export.tgz', 'wb') as f:
+ export.download(streamed=True, action=f.write)
+
+Import the group::
+
+ with open('/tmp/export.tgz', 'rb') as f:
+ gl.groups.import_group(f, path='imported-group', name="Imported Group")
+
Subgroups
=========
diff --git a/docs/gl_objects/remote_mirrors.rst b/docs/gl_objects/remote_mirrors.rst
new file mode 100644
index 0000000..ea4f72c
--- /dev/null
+++ b/docs/gl_objects/remote_mirrors.rst
@@ -0,0 +1,34 @@
+##########
+Project Remote Mirrors
+##########
+
+Remote Mirrors allow you to set up push mirroring for a project.
+
+References
+==========
+
+* v4 API:
+
+ + :class:`gitlab.v4.objects.ProjectRemoteMirror`
+ + :class:`gitlab.v4.objects.ProjectRemoteMirrorManager`
+ + :attr:`gitlab.v4.objects.Project.remote_mirrors`
+
+* GitLab API: https://docs.gitlab.com/ce/api/remote_mirrors.html
+
+Examples
+--------
+
+Get the list of a project's remote mirrors::
+
+ mirrors = project.remote_mirrors.list()
+
+Create (and enable) a remote mirror for a project::
+
+ mirror = project.wikis.create({'url': 'https://gitlab.com/example.git',
+ 'enabled': True})
+
+Update an existing remote mirror's attributes::
+
+ mirror.enabled = False
+ mirror.only_protected_branches = True
+ mirror.save()