mirror of
https://github.com/hashicorp/vault.git
synced 2026-04-28 09:39:39 -04:00
103 lines
2.2 KiB
Markdown
103 lines
2.2 KiB
Markdown
|
|
---
|
|||
|
|
layout: "api"
|
|||
|
|
page_title: "/sys/namespaces - HTTP API"
|
|||
|
|
sidebar_current: "docs-http-system-namespaces"
|
|||
|
|
description: |-
|
|||
|
|
The `/sys/namespaces` endpoint is used manage namespaces in Vault.
|
|||
|
|
---
|
|||
|
|
|
|||
|
|
# `/sys/namespaces`
|
|||
|
|
|
|||
|
|
The `/sys/namespaces` endpoint is used manage namespaces in Vault.
|
|||
|
|
|
|||
|
|
## List Namespaces
|
|||
|
|
|
|||
|
|
This endpoints lists all the namespaces.
|
|||
|
|
|
|||
|
|
| Method | Path | Produces |
|
|||
|
|
| :------- | :--------------------------- | :--------------------- |
|
|||
|
|
| `LIST` | `/sys/namespaces` | `200 application/json` |
|
|||
|
|
|
|||
|
|
### Sample Request
|
|||
|
|
|
|||
|
|
```
|
|||
|
|
$ curl \
|
|||
|
|
--header "X-Vault-Token: ..." \
|
|||
|
|
-X LIST \
|
|||
|
|
http://127.0.0.1:8200/v1/sys/namespaces
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
### Sample Response
|
|||
|
|
|
|||
|
|
```json
|
|||
|
|
[
|
|||
|
|
"ns1/",
|
|||
|
|
"ns2/"
|
|||
|
|
]
|
|||
|
|
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
## Create Namespace
|
|||
|
|
|
|||
|
|
This endpoint creates a namespace at the givent path.
|
|||
|
|
|
|||
|
|
| Method | Path | Produces |
|
|||
|
|
| :------- | :--------------------------- | :--------------------- |
|
|||
|
|
| `POST` | `/sys/namespaces/:path` | `204 (empty body)` |
|
|||
|
|
|
|||
|
|
### Parameters
|
|||
|
|
|
|||
|
|
- `path` `(string: <required>)` – Specifies the path where the namespace
|
|||
|
|
will be namespace. This is specified as part of the URL.
|
|||
|
|
|
|||
|
|
### Sample Request
|
|||
|
|
|
|||
|
|
```
|
|||
|
|
$ curl \
|
|||
|
|
--header "X-Vault-Token: ..." \
|
|||
|
|
--request POST \
|
|||
|
|
http://127.0.0.1:8200/v1/sys/namespaces/ns1
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
## Delete Namespace
|
|||
|
|
|
|||
|
|
This endpoint deletes a namespace at the specified path.
|
|||
|
|
|
|||
|
|
| Method | Path | Produces |
|
|||
|
|
| :------- | :--------------------------- | :--------------------- |
|
|||
|
|
| `DELETE` | `/sys/namespaces/:path` | `204 (empty body) ` |
|
|||
|
|
|
|||
|
|
### Sample Request
|
|||
|
|
|
|||
|
|
```
|
|||
|
|
$ curl \
|
|||
|
|
--header "X-Vault-Token: ..." \
|
|||
|
|
--request DELETE \
|
|||
|
|
http://127.0.0.1:8200/v1/sys/namespaces/ns1
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
## Read Namespace Information
|
|||
|
|
|
|||
|
|
This endpoint get the metadata for the given namespace path.
|
|||
|
|
|
|||
|
|
| Method | Path | Produces |
|
|||
|
|
| :------- | :--------------------------- | :--------------------- |
|
|||
|
|
| `GET` | `/sys/namespaces/:path` | `200 application/json` |
|
|||
|
|
|
|||
|
|
### Sample Request
|
|||
|
|
|
|||
|
|
```
|
|||
|
|
$ curl \
|
|||
|
|
--header "X-Vault-Token: ..." \
|
|||
|
|
http://127.0.0.1:8200/v1/sys/namespaces/ns1
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
### Sample Response
|
|||
|
|
|
|||
|
|
```json
|
|||
|
|
{
|
|||
|
|
"id": "gsudj",
|
|||
|
|
"path": "ns1/"
|
|||
|
|
}
|
|||
|
|
```
|