Skip to content

Commit 4a6f8d6

Browse files
nejchJohnVillalovos
authored andcommitted
docs(cli): showcase use of token scopes
1 parent 263fe3d commit 4a6f8d6

File tree

1 file changed

+48
-1
lines changed

1 file changed

+48
-1
lines changed

docs/cli-examples.rst

Lines changed: 48 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,12 @@ Get a specific user by id:
111111
112112
$ gitlab user get --id 3
113113
114+
Create a user impersonation token (admin-only):
115+
116+
.. code-block:: console
117+
118+
gitlab user-impersonation-token create --user-id 2 --name test-token --scopes api,read_user
119+
114120
Deploy tokens
115121
-------------
116122

@@ -119,14 +125,55 @@ Create a deploy token for a project:
119125
.. code-block:: console
120126
121127
$ gitlab -v project-deploy-token create --project-id 2 \
122-
--name bar --username root --expires-at "2021-09-09" --scopes "read_repository"
128+
--name bar --username root --expires-at "2021-09-09" --scopes "api,read_repository"
123129
124130
List deploy tokens for a group:
125131

126132
.. code-block:: console
127133
128134
$ gitlab -v group-deploy-token list --group-id 3
129135
136+
Resource access tokens
137+
----------------------
138+
139+
Create a project access token:
140+
141+
.. code-block:: console
142+
143+
$ gitlab -v project-access-token create --project-id 2 \
144+
--name project-token --expires-at "2023-01-01" --scopes "api,read_repository"
145+
146+
List project access tokens:
147+
148+
.. code-block:: console
149+
150+
$ gitlab -v project-access-token list --project-id 3
151+
152+
Revoke a project access token:
153+
154+
.. code-block:: console
155+
156+
$ gitlab project-access-token delete --project-id 3 --id 1
157+
158+
Create a group access token:
159+
160+
.. code-block:: console
161+
162+
$ gitlab -v group-access-token create --group-id 2 \
163+
--name group-token --expires-at "2022-01-01" --scopes "api,read_repository"
164+
165+
List group access tokens:
166+
167+
.. code-block:: console
168+
169+
$ gitlab -v group-access-token list --group-id 3
170+
171+
Revoke a group access token:
172+
173+
.. code-block:: console
174+
175+
$ gitlab group-access-token delete --group-id 3 --id 1
176+
130177
Packages
131178
--------
132179

0 commit comments

Comments
 (0)