Add LIST support to sys/policies/password (#12787)

* Add read support to sys/policies/password

Closes https://github.com/hashicorp/vault/issues/12562

* Add changelog

* Empty commit to trigger CI

* Add optional /

Co-authored-by: Calvin Leung Huang <1883212+calvn@users.noreply.github.com>

* Use a ListOperation

Co-authored-by: Calvin Leung Huang <1883212+calvn@users.noreply.github.com>
This commit is contained in:
Rémi Lapeyre
2022-01-24 22:42:14 +01:00
committed by GitHub
parent 300a2271e9
commit 7c2ee26b78
5 changed files with 162 additions and 0 deletions

View File

@@ -77,6 +77,43 @@ rule "charset" {
$ vault write sys/policies/password/my-policy policy=@my-policy.hcl
```
## List Password Policies
This endpoints list the password policies.
| Method | Path |
| :------ | :--------------------------------- |
| `LIST` | `/sys/policies/password` |
| `GET` | `/sys/policies/password?list=true` |
### Sample Request
```shell
$ curl \
--header "X-Vault-Token: ..." \
--request LIST \
http://127.0.0.1:8200/v1/sys/policies/password
```
### Sample Response
```json
{
"request_id": "58e2540f-8c51-6390-46de-38e279e75468",
"lease_id": "",
"renewable": false,
"lease_duration": 0,
"data": {
"keys": [
"my-policy"
]
},
"wrap_info": null,
"warnings": null,
"auth": null
}
```
## Read Password Policy
This endpoint retrieves information about the named password policy.