Skip to content

Commit

Permalink
Add docs for v1/acl/policy/name endpoint (hashicorp#7501)
Browse files Browse the repository at this point in the history
  • Loading branch information
mkeeler authored and alvin-huang committed May 6, 2020
1 parent c72a0d3 commit 1b20c7f
Showing 1 changed file with 53 additions and 0 deletions.
53 changes: 53 additions & 0 deletions website/pages/api-docs/acl/policies.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,59 @@ $ curl -X GET http://127.0.0.1:8500/v1/acl/policy/name/node-read
}
```

## Read a Policy by Name

This endpoint reads an ACL policy with the given ID.

| Method | Path | Produces |
| ------ | ---------------------------- | -------------------------- |
| `GET` | `/acl/policy/name/:name` | `application/json` |

The table below shows this endpoint's support for
[blocking queries](/api/features/blocking.html),
[consistency modes](/api/features/consistency.html),
[agent caching](/api/features/caching.html), and
[required ACLs](/api/index.html#authentication).

| Blocking Queries | Consistency Modes | Agent Caching | ACL Required |
| ---------------- | ----------------- | ------------- | ------------ |
| `YES` | `all` | `none` | `acl:read` |

### Parameters

- `name` `(string: <required>)` - Specifies the name of the ACL policy to
read. This is required and is specified as part of the URL path.

- `ns` `(string: "")` - **(Enterprise Only)** Specifies the namespace to lookup
the policy. This value can be specified as the `ns` URL query
parameter or the `X-Consul-Namespace` header. If not provided by either,
the namespace will be inherited from the request's ACL token or will default
to the `default` namespace. Added in Consul 1.7.0.


### Sample Request

```sh
$ curl -X GET http://127.0.0.1:8500/v1/acl/policy/name/node-read
```

### Sample Response

```json
{
"ID": "e359bd81-baca-903e-7e64-1ccd9fdc78f5",
"Name": "node-read",
"Description": "Grants read access to all node information",
"Rules": "node_prefix \"\" { policy = \"read\"}",
"Datacenters": [
"dc1"
],
"Hash": "OtZUUKhInTLEqTPfNSSOYbRiSBKm3c4vI2p6MxZnGWc=",
"CreateIndex": 14,
"ModifyIndex": 14
}
```

## Update a Policy

This endpoint updates an existing ACL policy.
Expand Down

0 comments on commit 1b20c7f

Please sign in to comment.