2017-10-13 21:02:30 +00:00
|
|
|
---
|
|
|
|
layout: api
|
2017-10-15 23:41:24 +00:00
|
|
|
page_title: Quotas - HTTP API
|
2020-02-06 23:45:31 +00:00
|
|
|
description: The /quota endpoints are used to query for and interact with quotas.
|
2017-10-13 21:02:30 +00:00
|
|
|
---
|
|
|
|
|
2017-10-15 23:41:24 +00:00
|
|
|
# Quota HTTP API
|
2017-10-13 21:02:30 +00:00
|
|
|
|
2017-10-15 23:41:24 +00:00
|
|
|
The `/quota` endpoints are used to query for and interact with quotas.
|
2017-10-13 21:02:30 +00:00
|
|
|
|
2021-01-05 14:44:37 +00:00
|
|
|
<EnterpriseAlert>
|
2021-03-31 13:43:17 +00:00
|
|
|
This API endpoint and functionality only exists in Nomad Enterprise. This is
|
|
|
|
not present in the open source version of Nomad.
|
2021-01-05 14:44:37 +00:00
|
|
|
</EnterpriseAlert>
|
2017-10-13 21:02:30 +00:00
|
|
|
|
2017-10-15 23:41:24 +00:00
|
|
|
## List Quota Specifications
|
2017-10-13 21:02:30 +00:00
|
|
|
|
2017-10-15 23:41:24 +00:00
|
|
|
This endpoint lists all quota specifications.
|
2017-10-13 21:02:30 +00:00
|
|
|
|
2020-02-06 23:45:31 +00:00
|
|
|
| Method | Path | Produces |
|
|
|
|
| ------ | ------------ | ------------------ |
|
|
|
|
| `GET` | `/v1/quotas` | `application/json` |
|
2017-10-13 21:02:30 +00:00
|
|
|
|
|
|
|
The table below shows this endpoint's support for
|
2020-03-20 22:24:56 +00:00
|
|
|
[blocking queries](/api-docs#blocking-queries) and
|
|
|
|
[required ACLs](/api-docs#acls).
|
2017-10-13 21:02:30 +00:00
|
|
|
|
2020-02-06 23:45:31 +00:00
|
|
|
| Blocking Queries | ACL Required |
|
|
|
|
| ---------------- | --------------------------------------------------------------- |
|
|
|
|
| `YES` | `quota:read`<br />`namespace:*` if namespace has quota attached |
|
2017-10-13 21:02:30 +00:00
|
|
|
|
|
|
|
### Parameters
|
|
|
|
|
2017-10-15 23:41:24 +00:00
|
|
|
- `prefix` `(string: "")`- Specifies a string to filter quota specifications on
|
2019-05-08 19:14:31 +00:00
|
|
|
based on an index prefix. This is specified as a query string parameter.
|
2017-10-13 21:02:30 +00:00
|
|
|
|
|
|
|
### Sample Request
|
|
|
|
|
2020-05-18 20:53:06 +00:00
|
|
|
```shell-session
|
|
|
|
$ curl \
|
2018-01-29 16:27:52 +00:00
|
|
|
https://localhost:4646/v1/quotas
|
2017-10-13 21:02:30 +00:00
|
|
|
```
|
|
|
|
|
2020-05-18 20:53:06 +00:00
|
|
|
```shell-session
|
|
|
|
$ curl \
|
2018-01-29 16:27:52 +00:00
|
|
|
https://localhost:4646/v1/quotas?prefix=sha
|
2017-10-13 21:02:30 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
### Sample Response
|
|
|
|
|
|
|
|
```json
|
|
|
|
[
|
2017-10-15 23:41:24 +00:00
|
|
|
{
|
|
|
|
"CreateIndex": 8,
|
|
|
|
"Description": "Limit the shared default namespace",
|
|
|
|
"Hash": "SgDCH7L5ZDqNSi2NmJlqdvczt/Q6mjyVwVJC0XjWglQ=",
|
|
|
|
"Limits": [
|
|
|
|
{
|
|
|
|
"Hash": "NLOoV2WBU8ieJIrYXXx8NRb5C2xU61pVVWRDLEIMxlU=",
|
|
|
|
"Region": "global",
|
|
|
|
"RegionLimit": {
|
|
|
|
"CPU": 2500,
|
|
|
|
"DiskMB": 0,
|
|
|
|
"MemoryMB": 2000,
|
2019-11-19 21:52:03 +00:00
|
|
|
"Networks": [
|
|
|
|
{
|
|
|
|
"CIDR": "",
|
|
|
|
"Device": "",
|
|
|
|
"DynamicPorts": null,
|
|
|
|
"IP": "",
|
|
|
|
"MBits": 50,
|
|
|
|
"Mode": "",
|
|
|
|
"ReservedPorts": null
|
|
|
|
}
|
|
|
|
]
|
2022-08-02 13:32:09 +00:00
|
|
|
},
|
2022-08-30 14:08:50 +00:00
|
|
|
"VariablesLimit": 1000
|
2017-10-15 23:41:24 +00:00
|
|
|
}
|
|
|
|
],
|
|
|
|
"ModifyIndex": 56,
|
|
|
|
"Name": "shared-quota"
|
|
|
|
}
|
2017-10-13 21:02:30 +00:00
|
|
|
]
|
|
|
|
```
|
|
|
|
|
2017-10-15 23:41:24 +00:00
|
|
|
## Read Quota Specification
|
2017-10-13 21:02:30 +00:00
|
|
|
|
2017-10-15 23:41:24 +00:00
|
|
|
This endpoint reads information about a specific quota specification.
|
2017-10-13 21:02:30 +00:00
|
|
|
|
2020-02-06 23:45:31 +00:00
|
|
|
| Method | Path | Produces |
|
|
|
|
| ------ | ------------------ | ------------------ |
|
|
|
|
| `GET` | `/v1/quota/:quota` | `application/json` |
|
2017-10-13 21:02:30 +00:00
|
|
|
|
|
|
|
The table below shows this endpoint's support for
|
2020-03-20 22:24:56 +00:00
|
|
|
[blocking queries](/api-docs#blocking-queries) and
|
|
|
|
[required ACLs](/api-docs#acls).
|
2017-10-13 21:02:30 +00:00
|
|
|
|
2020-02-06 23:45:31 +00:00
|
|
|
| Blocking Queries | ACL Required |
|
|
|
|
| ---------------- | --------------------------------------------------------------- |
|
|
|
|
| `YES` | `quota:read`<br />`namespace:*` if namespace has quota attached |
|
2017-10-13 21:02:30 +00:00
|
|
|
|
|
|
|
### Parameters
|
|
|
|
|
2017-10-16 19:40:41 +00:00
|
|
|
- `:quota` `(string: <required>)`- Specifies the quota specification to query
|
|
|
|
where the identifier is the quota's name.
|
2017-10-13 21:02:30 +00:00
|
|
|
|
|
|
|
### Sample Request
|
|
|
|
|
2020-05-18 20:53:06 +00:00
|
|
|
```shell-session
|
|
|
|
$ curl \
|
2018-01-29 16:27:52 +00:00
|
|
|
https://localhost:4646/v1/quota/shared-quota
|
2017-10-13 21:02:30 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
### Sample Response
|
|
|
|
|
|
|
|
```json
|
|
|
|
{
|
2017-10-15 23:41:24 +00:00
|
|
|
"CreateIndex": 8,
|
|
|
|
"Description": "Limit the shared default namespace",
|
|
|
|
"Hash": "SgDCH7L5ZDqNSi2NmJlqdvczt/Q6mjyVwVJC0XjWglQ=",
|
|
|
|
"Limits": [
|
|
|
|
{
|
|
|
|
"Hash": "NLOoV2WBU8ieJIrYXXx8NRb5C2xU61pVVWRDLEIMxlU=",
|
|
|
|
"Region": "global",
|
|
|
|
"RegionLimit": {
|
|
|
|
"CPU": 2500,
|
|
|
|
"DiskMB": 0,
|
|
|
|
"MemoryMB": 2000,
|
2019-11-19 21:52:03 +00:00
|
|
|
"Networks": [
|
|
|
|
{
|
|
|
|
"CIDR": "",
|
|
|
|
"Device": "",
|
|
|
|
"DynamicPorts": null,
|
|
|
|
"IP": "",
|
|
|
|
"MBits": 50,
|
|
|
|
"Mode": "",
|
|
|
|
"ReservedPorts": null
|
|
|
|
}
|
|
|
|
]
|
2022-08-02 13:32:09 +00:00
|
|
|
},
|
2022-08-30 14:08:50 +00:00
|
|
|
"VariablesLimit": 1000
|
2017-10-15 23:41:24 +00:00
|
|
|
}
|
|
|
|
],
|
|
|
|
"ModifyIndex": 56,
|
|
|
|
"Name": "shared-quota"
|
2017-10-13 21:02:30 +00:00
|
|
|
}
|
|
|
|
```
|
|
|
|
|
2017-10-15 23:41:24 +00:00
|
|
|
## Create or Update Quota Specification
|
2017-10-13 21:02:30 +00:00
|
|
|
|
2017-10-15 23:41:24 +00:00
|
|
|
This endpoint is used to create or update a quota specification.
|
2017-10-13 21:02:30 +00:00
|
|
|
|
2020-02-06 23:45:31 +00:00
|
|
|
| Method | Path | Produces |
|
|
|
|
| ------ | ------------------------------------- | ------------------ |
|
|
|
|
| `POST` | `/v1/quota/:quota` <br /> `/v1/quota` | `application/json` |
|
2017-10-13 21:02:30 +00:00
|
|
|
|
|
|
|
The table below shows this endpoint's support for
|
2020-03-20 22:24:56 +00:00
|
|
|
[blocking queries](/api-docs#blocking-queries) and
|
|
|
|
[required ACLs](/api-docs#acls).
|
2017-10-13 21:02:30 +00:00
|
|
|
|
2020-02-06 23:45:31 +00:00
|
|
|
| Blocking Queries | ACL Required |
|
|
|
|
| ---------------- | ------------- |
|
2017-10-15 23:41:24 +00:00
|
|
|
| `NO` | `quota:write` |
|
2017-10-13 21:02:30 +00:00
|
|
|
|
2017-10-16 04:15:14 +00:00
|
|
|
### Body
|
2017-10-13 21:02:30 +00:00
|
|
|
|
2017-10-16 04:15:14 +00:00
|
|
|
The request body contains a valid, JSON quota specification. View the api
|
|
|
|
package to see the definition of a [`QuotaSpec`
|
2021-03-09 19:33:35 +00:00
|
|
|
object](https://pkg.go.dev/github.com/hashicorp/nomad/api#QuotaSpec).
|
2017-10-13 21:02:30 +00:00
|
|
|
|
|
|
|
### Sample Payload
|
|
|
|
|
|
|
|
```javascript
|
|
|
|
{
|
2017-10-16 04:15:14 +00:00
|
|
|
"Name": "shared-quota",
|
|
|
|
"Description": "Limit the shared default namespace",
|
|
|
|
"Limits": [
|
|
|
|
{
|
|
|
|
"Region": "global",
|
|
|
|
"RegionLimit": {
|
|
|
|
"CPU": 2500,
|
2019-11-19 21:52:03 +00:00
|
|
|
"MemoryMB": 1000,
|
|
|
|
"Networks": [
|
|
|
|
{
|
|
|
|
"Mbits": 50
|
|
|
|
}
|
|
|
|
]
|
2017-10-16 04:15:14 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
]
|
2017-10-13 21:02:30 +00:00
|
|
|
}
|
2019-11-19 21:52:03 +00:00
|
|
|
```
|
2017-10-13 21:02:30 +00:00
|
|
|
|
|
|
|
### Sample Request
|
|
|
|
|
2020-05-18 20:53:06 +00:00
|
|
|
```shell-session
|
|
|
|
$ curl \
|
2017-10-13 21:02:30 +00:00
|
|
|
--request POST \
|
2017-10-16 04:15:14 +00:00
|
|
|
--data @spec.json \
|
2018-01-29 16:27:52 +00:00
|
|
|
https://localhost:4646/v1/quota/shared-quota
|
2017-10-13 21:02:30 +00:00
|
|
|
```
|
|
|
|
|
2020-05-18 20:53:06 +00:00
|
|
|
```shell-session
|
|
|
|
$ curl \
|
2017-10-13 21:02:30 +00:00
|
|
|
--request POST \
|
2017-10-16 04:15:14 +00:00
|
|
|
--data @spec.json \
|
2018-01-29 16:27:52 +00:00
|
|
|
https://localhost:4646/v1/quota
|
2017-10-13 21:02:30 +00:00
|
|
|
```
|
|
|
|
|
2017-10-16 04:15:14 +00:00
|
|
|
## Delete Quota Specification
|
2017-10-13 21:02:30 +00:00
|
|
|
|
2017-10-16 04:15:14 +00:00
|
|
|
This endpoint is used to delete a quota specification.
|
2017-10-13 21:02:30 +00:00
|
|
|
|
2020-02-06 23:45:31 +00:00
|
|
|
| Method | Path | Produces |
|
|
|
|
| -------- | ------------------ | ------------------ |
|
|
|
|
| `DELETE` | `/v1/quota/:quota` | `application/json` |
|
2017-10-13 21:02:30 +00:00
|
|
|
|
|
|
|
The table below shows this endpoint's support for
|
2020-03-20 22:24:56 +00:00
|
|
|
[blocking queries](/api-docs#blocking-queries) and
|
|
|
|
[required ACLs](/api-docs#acls).
|
2017-10-13 21:02:30 +00:00
|
|
|
|
2020-02-06 23:45:31 +00:00
|
|
|
| Blocking Queries | ACL Required |
|
|
|
|
| ---------------- | ------------- |
|
2017-10-16 04:15:14 +00:00
|
|
|
| `NO` | `quota:write` |
|
2017-10-13 21:02:30 +00:00
|
|
|
|
|
|
|
### Parameters
|
|
|
|
|
2017-10-16 19:40:41 +00:00
|
|
|
- `:quota` `(string: <required>)`- Specifies the quota specification to delete
|
|
|
|
where the identifier is the quota's name.
|
2017-10-13 21:02:30 +00:00
|
|
|
|
|
|
|
### Sample Request
|
|
|
|
|
2020-05-18 20:53:06 +00:00
|
|
|
```shell-session
|
|
|
|
$ curl \
|
2017-10-13 21:02:30 +00:00
|
|
|
--request DELETE \
|
2018-01-29 16:27:52 +00:00
|
|
|
https://localhost:4646/v1/quota/shared-quota
|
2017-10-16 04:15:14 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
## List Quota Usages
|
|
|
|
|
|
|
|
This endpoint lists all quota usages.
|
|
|
|
|
2020-02-06 23:45:31 +00:00
|
|
|
| Method | Path | Produces |
|
|
|
|
| ------ | ------------------ | ------------------ |
|
|
|
|
| `GET` | `/v1/quota-usages` | `application/json` |
|
2017-10-16 04:15:14 +00:00
|
|
|
|
|
|
|
The table below shows this endpoint's support for
|
2020-03-20 22:24:56 +00:00
|
|
|
[blocking queries](/api-docs#blocking-queries) and
|
|
|
|
[required ACLs](/api-docs#acls).
|
2017-10-16 04:15:14 +00:00
|
|
|
|
2020-02-06 23:45:31 +00:00
|
|
|
| Blocking Queries | ACL Required |
|
|
|
|
| ---------------- | --------------------------------------------------------------- |
|
|
|
|
| `YES` | `quota:read`<br />`namespace:*` if namespace has quota attached |
|
2017-10-16 04:15:14 +00:00
|
|
|
|
|
|
|
### Parameters
|
|
|
|
|
|
|
|
- `prefix` `(string: "")`- Specifies a string to filter quota specifications on
|
2019-05-08 19:14:31 +00:00
|
|
|
based on an index prefix. This is specified as a query string parameter.
|
2017-10-16 04:15:14 +00:00
|
|
|
|
|
|
|
### Sample Request
|
|
|
|
|
2020-05-18 20:53:06 +00:00
|
|
|
```shell-session
|
|
|
|
$ curl \
|
2018-01-29 16:27:52 +00:00
|
|
|
https://localhost:4646/v1/quota-usages
|
2017-10-16 04:15:14 +00:00
|
|
|
```
|
|
|
|
|
2020-05-18 20:53:06 +00:00
|
|
|
```shell-session
|
|
|
|
$ curl \
|
2018-01-29 16:27:52 +00:00
|
|
|
https://localhost:4646/v1/quota-usages?prefix=sha
|
2017-10-16 04:15:14 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
### Sample Response
|
|
|
|
|
|
|
|
```json
|
|
|
|
[
|
|
|
|
{
|
|
|
|
"Used": {
|
|
|
|
"NLOoV2WBU8ieJIrYXXx8NRb5C2xU61pVVWRDLEIMxlU=": {
|
|
|
|
"Region": "global",
|
|
|
|
"RegionLimit": {
|
|
|
|
"CPU": 500,
|
|
|
|
"MemoryMB": 256,
|
|
|
|
"DiskMB": 0,
|
|
|
|
"Networks": null
|
|
|
|
},
|
|
|
|
"Hash": "NLOoV2WBU8ieJIrYXXx8NRb5C2xU61pVVWRDLEIMxlU="
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"Name": "default",
|
|
|
|
"CreateIndex": 8,
|
|
|
|
"ModifyIndex": 56
|
|
|
|
}
|
|
|
|
]
|
|
|
|
```
|
|
|
|
|
|
|
|
## Read Quota Usage
|
|
|
|
|
|
|
|
This endpoint reads information about a specific quota usage.
|
|
|
|
|
2020-02-06 23:45:31 +00:00
|
|
|
| Method | Path | Produces |
|
|
|
|
| ------ | ------------------------ | ------------------ |
|
|
|
|
| `GET` | `/v1/quota/usage/:quota` | `application/json` |
|
2017-10-16 04:15:14 +00:00
|
|
|
|
|
|
|
The table below shows this endpoint's support for
|
2020-03-20 22:24:56 +00:00
|
|
|
[blocking queries](/api-docs#blocking-queries) and
|
|
|
|
[required ACLs](/api-docs#acls).
|
2017-10-16 04:15:14 +00:00
|
|
|
|
2020-02-06 23:45:31 +00:00
|
|
|
| Blocking Queries | ACL Required |
|
|
|
|
| ---------------- | --------------------------------------------------------------- |
|
|
|
|
| `YES` | `quota:read`<br />`namespace:*` if namespace has quota attached |
|
2017-10-16 04:15:14 +00:00
|
|
|
|
|
|
|
### Parameters
|
|
|
|
|
2017-10-16 19:40:41 +00:00
|
|
|
- `:quota` `(string: <required>)`- Specifies the quota specification to query
|
|
|
|
where the identifier is the quota's name.
|
2017-10-16 04:15:14 +00:00
|
|
|
|
|
|
|
### Sample Request
|
|
|
|
|
2020-05-18 20:53:06 +00:00
|
|
|
```shell-session
|
|
|
|
$ curl \
|
2022-08-02 12:46:45 +00:00
|
|
|
https://localhost:4646/v1/quota/usage/shared-quota
|
2017-10-16 04:15:14 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
### Sample Response
|
|
|
|
|
|
|
|
```json
|
|
|
|
{
|
|
|
|
"Used": {
|
|
|
|
"NLOoV2WBU8ieJIrYXXx8NRb5C2xU61pVVWRDLEIMxlU=": {
|
|
|
|
"Region": "global",
|
|
|
|
"RegionLimit": {
|
|
|
|
"CPU": 500,
|
|
|
|
"MemoryMB": 256,
|
|
|
|
"DiskMB": 0,
|
2019-11-19 21:52:03 +00:00
|
|
|
"Networks": [
|
|
|
|
{
|
|
|
|
"CIDR": "",
|
|
|
|
"Device": "",
|
|
|
|
"DynamicPorts": null,
|
|
|
|
"IP": "",
|
|
|
|
"MBits": 50,
|
|
|
|
"Mode": "",
|
|
|
|
"ReservedPorts": null
|
|
|
|
}
|
|
|
|
]
|
2017-10-16 04:15:14 +00:00
|
|
|
},
|
|
|
|
"Hash": "NLOoV2WBU8ieJIrYXXx8NRb5C2xU61pVVWRDLEIMxlU="
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"Name": "default",
|
|
|
|
"CreateIndex": 8,
|
|
|
|
"ModifyIndex": 56
|
|
|
|
}
|
2017-10-13 21:02:30 +00:00
|
|
|
```
|