summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Bajao <ebajao@gitlab.com>2019-06-13 20:04:36 -0800
committerPatrick Bajao <ebajao@gitlab.com>2019-06-26 10:10:11 +0800
commit550ac52b143b7d4b77203b81c1b92997c4c63e34 (patch)
tree799d859632a2ff74fa93f4a3e0760cadc2113b2b
parent13ab6a3842407b481ab536576f8d8517a23baa49 (diff)
downloadgitlab-ce-550ac52b143b7d4b77203b81c1b92997c4c63e34.tar.gz
Add documentation for feature and API
-rw-r--r--doc/api/project_aliases.md101
-rw-r--r--doc/user/project/index.md13
2 files changed, 114 insertions, 0 deletions
diff --git a/doc/api/project_aliases.md b/doc/api/project_aliases.md
new file mode 100644
index 00000000000..4456388c74f
--- /dev/null
+++ b/doc/api/project_aliases.md
@@ -0,0 +1,101 @@
+# Project Aliases API
+
+All methods require administrator authorization.
+
+## List all project aliases
+
+Get a list of all project aliases
+
+```
+GET /project_aliases
+```
+
+```
+curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/project_aliases"
+```
+
+Example response:
+
+```json
+[
+ {
+ "id": 1,
+ "project_id": 1,
+ "name": "gitlab-ce"
+ },
+ {
+ "id": 2,
+ "project_id": 2,
+ "name": "gitlab-ee"
+ }
+]
+```
+
+## Get project alias' details
+
+Get details of a project alias
+
+```
+GET /project_aliases/:name
+```
+
+| Attribute | Type | Required | Description |
+|-----------|--------|----------|-----------------------|
+| `name` | string | yes | The name of the alias |
+
+```
+curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/project_aliases/gitlab-ee"
+```
+
+Example response:
+
+```json
+{
+ "id": 1,
+ "project_id": 1,
+ "name": "gitlab-ee"
+}
+```
+
+## Create an alias for a project
+
+Add a new alias for a project. Reponds with a 201 when successful, 400 when there are validation errors (e.g. alias already exists).
+
+```
+POST /project_aliases
+```
+
+| Attribute | Type | Required | Description |
+|--------------|--------|----------|-----------------------------------------------|
+| `project_id` | string | yes | The The ID or URL-encoded path of the project |
+| `name` | string | yes | The name of the alias. Must be unique. |
+
+```
+curl --request POST "https://gitlab.example.com/api/v4/project_aliases" --form "project_id=gitlab-org%2Fgitlab-ee" --form "name=gitlab-ee"
+```
+
+Example response:
+
+```json
+{
+ "id": 1,
+ "project_id": 1,
+ "name": "gitlab-ee"
+}
+```
+
+## Delete a project aliase
+
+Removes a project aliases. Respond with a 204 when project alias exists, 404 when it doesn't.
+
+```
+DELETE /project_aliases/:name
+```
+
+| Attribute | Type | Required | Description |
+|-----------|--------|----------|-----------------------|
+| `name` | string | yes | The name of the alias |
+
+```
+curl --request DELETE --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/project_aliases/gitlab-ee"
+```
diff --git a/doc/user/project/index.md b/doc/user/project/index.md
index 587b4121e4e..d9c35165ac8 100644
--- a/doc/user/project/index.md
+++ b/doc/user/project/index.md
@@ -193,6 +193,18 @@ password <personal_access_token>
To quickly access a project from the GitLab UI using the project ID,
visit the `/projects/:id` URL in your browser or other tool accessing the project.
+## Project aliases
+
+Projects' repositories are usually cloned with a namespace and project name. It is
+also possible to clone them via a project alias. This feature is only available on Git over SSH.
+
+A project alias can be created via API only by administrators. Follow the
+[Project Aliases API documentation](../../api/project_aliases.md) for more details.
+
+Once an alias has been created for a project (e.g. gitlab-ce for gitlab-org/gitlab-ce),
+the repository can be cloned using the alias (e.g `git clone git@gitlab.com:gitlab-ce.git`
+instead of `git clone git@gitlab.com:gitlab-org/gitlab-ce.git`).
+
## Project APIs
There are numerous [APIs](../../api/README.md) to use with your projects:
@@ -212,3 +224,4 @@ There are numerous [APIs](../../api/README.md) to use with your projects:
- [Templates](../../api/project_templates.md)
- [Traffic](../../api/project_statistics.md)
- [Variables](../../api/project_level_variables.md)
+- [Aliases](../../api/project_aliases.md)