summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authoralex lundberg <alex.lundberg@commonbond.co>2019-11-25 09:49:55 -0500
committeralex lundberg <alex.lundberg@commonbond.co>2019-11-25 09:56:56 -0500
commitd15801d7e7742a43ad9517f0ac13b6dba24c6283 (patch)
tree9dc573c83fcc324b724237d85a3e4b9bd5d69685 /docs
parentebd053e7bb695124c8117a95eab0072db185ddf9 (diff)
downloadgitlab-d15801d7e7742a43ad9517f0ac13b6dba24c6283.tar.gz
docs: add project and group cluster examples
Diffstat (limited to 'docs')
-rw-r--r--docs/gl_objects/clusters.rst82
1 files changed, 82 insertions, 0 deletions
diff --git a/docs/gl_objects/clusters.rst b/docs/gl_objects/clusters.rst
new file mode 100644
index 0000000..96edd82
--- /dev/null
+++ b/docs/gl_objects/clusters.rst
@@ -0,0 +1,82 @@
+############
+Clusters
+############
+
+Reference
+---------
+
+* v4 API:
+
+ + :class:`gitlab.v4.objects.ProjectCluster`
+ + :class:`gitlab.v4.objects.ProjectClusterManager`
+ + :attr:`gitlab.v4.objects.Project.clusters`
+ + :class:`gitlab.v4.objects.GroupCluster`
+ + :class:`gitlab.v4.objects.GroupClusterManager`
+ + :attr:`gitlab.v4.objects.Group.clusters`
+
+* GitLab API: https://docs.gitlab.com/ee/api/project_clusters.html
+* GitLab API: https://docs.gitlab.com/ee/api/group_clusters.html
+
+Examples
+--------
+
+List clusters for a project::
+
+ clusters = project.clusters.list()
+
+Create an cluster for a project::
+
+ cluster = project.clusters.create(
+ {
+ "name": "cluster1",
+ "platform_kubernetes_attributes": {
+ "api_url": "http://url",
+ "token": "tokenval",
+ },
+ })
+
+Retrieve a specific cluster for a project::
+
+ cluster = project.clusters.get(cluster_id)
+
+Update an cluster for a project::
+
+ cluster.platform_kubernetes_attributes = {"api_url": "http://newurl"}
+ cluster.save()
+
+Delete an cluster for a project::
+
+ cluster = project.clusters.delete(cluster_id)
+ # or
+ cluster.delete()
+
+
+List clusters for a group::
+
+ clusters = group.clusters.list()
+
+Create an cluster for a group::
+
+ cluster = group.clusters.create(
+ {
+ "name": "cluster1",
+ "platform_kubernetes_attributes": {
+ "api_url": "http://url",
+ "token": "tokenval",
+ },
+ })
+
+Retrieve a specific cluster for a group::
+
+ cluster = group.clusters.get(cluster_id)
+
+Update an cluster for a group::
+
+ cluster.platform_kubernetes_attributes = {"api_url": "http://newurl"}
+ cluster.save()
+
+Delete an cluster for a group::
+
+ cluster = group.clusters.delete(cluster_id)
+ # or
+ cluster.delete()