Back to Gitlabhq

API des certificats SSH de groupe

doc-locale/fr-fr/api/group_ssh_certificates.md

19.3.04.1 KB
Original Source

{{< details >}}

  • Édition : Premium, Ultimate
  • Offre : GitLab.com

{{< /details >}}

{{< history >}}

{{< /history >}}

Utilisez cette API pour gérer les certificats SSH pour les groupes. Seuls les groupes principaux peuvent stocker des certificats SSH.

Prérequis :

  • Vous devez être Propriétaire d'un groupe principal.

Lister tous les certificats SSH de groupe {#list-all-group-ssh-certificates}

Liste tous les certificats SSH pour un groupe spécifié.

plaintext
GET /groups/:id/ssh_certificates

Paramètres :

AttributTypeObligatoireDescription
identierOuiL'identifiant du groupe.

Par défaut, les requêtes GET renvoient 20 résultats à la fois, car les résultats de l'API REST sont paginés. En savoir plus sur la pagination.

Exemple de requête :

shell
curl --header "PRIVATE-TOKEN: <your_access_token>" \
  --url "https://primary.example.com/api/v4/groups/90/ssh_certificates"

Exemple de réponse :

json
[
  {
    "id": 12345,
    "title": "SSH Title 1",
    "key": "ssh-rsa AAAAB3NzaC1ea2dAAAADAQABAAAAgQDGbLkF44ScxRQi2FfA7VsHgGqptguSbmW26jkJhEiRZpGS4/+UzaaSqc8Psw2OhSsKc5QwfrB/ANpO4LhOjDzhf2FuD8ACkv3R7XtaJ+rN6PlyzoBfLAiSyzxhEoMFDBprTgaiZKgg2yQ9dRH55w3f6XMZ4hnaUae53nQgfQLxFw== [email protected]",
    "created_at": "2023-09-08T12:39:00.172Z"
  },
  {
    "id":12346,
    "title":"SSH Title 2",
    "key": "ssh-rsa AAAAB3NzaC1ac2EAAAADAQABAAAAgQDTl/hHfu1F/KlR+QfgM2wUmyxcN5YeiaWluEGIrfXUeJuI+bK6xjpE3+2afHDYtE9VQkeL32KRjefX2d72Jeoa68ewt87Vn8CcGkUTOTpHNzeL8pHMKFs3m7ArSBxNg5vTdgAsq5dbDGNtat7b2WCHTNvtWoON1Jetne30uW2EwQ== [email protected]",
    "created_at": "2023-09-08T12:39:00.244Z"
  }
]

Ajouter un certificat SSH de groupe {#add-a-group-ssh-certificate}

Ajoute un certificat SSH de groupe pour un groupe spécifié.

plaintext
POST /groups/:id/ssh_certificates

Paramètres :

AttributTypeObligatoireDescription
identierOuiL'identifiant du groupe.
keystringOuiLa clé publique du certificat SSH.
titlestringOuiLe titre du certificat SSH.

Exemple de requête :

shell
curl --request POST \
  --header "PRIVATE-TOKEN: <your_access_token>" \
  --url "https://gitlab.example.com/api/v4/groups/5/ssh_certificates?title=newtitle&key=ssh-rsa+REDACTED+example%40gitlab.com"

Exemple de réponse :

json
{
  "id": 54321,
  "title": "newtitle",
  "key": "ssh-rsa ssh-rsa AAAAB3NzaC1ea2dAAAADAQABAAAAgQDGbLkF44ScxRQi2FfA7VsHgGqptguSbmW26jkJhEiRZpGS4/+UzaaSqc8Psw2OhSsKc5QwfrB/ANpO4LhOjDzhf2FuD8ACkv3R7XtaJ+rN6PlyzoBfLAiSyzxhEoMFDBprTgaiZKgg2yQ9dRH55w3f6XMZ4hnaUae53nQgfQLxFw== [email protected]",
  "created_at": "2023-09-08T12:39:00.172Z"
}

Supprimer un certificat SSH de groupe {#delete-a-group-ssh-certificate}

Supprime un certificat SSH de groupe spécifié.

plaintext
DELETE /groups/:id/ssh_certificates/:id

Paramètres :

AttributTypeObligatoireDescription
identierOuiL'identifiant du groupe
identierOuiL'identifiant du certificat SSH

Exemple de requête :

shell
curl --request DELETE \
  --header "PRIVATE-TOKEN: <your_access_token>" \
  --url "https://gitlab.example.com/api/v4/groups/5/ssh_certificates/12345"