2017-10-13 21:02:30 +00:00
|
|
|
---
|
|
|
|
layout: api
|
2017-10-15 23:41:24 +00:00
|
|
|
page_title: Quotas - HTTP API
|
|
|
|
sidebar_current: api-quotas
|
2017-10-13 21:02:30 +00:00
|
|
|
description: |-
|
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
|
|
|
---
|
|
|
|
|
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
|
|
|
|
|
|
|
~> **Enterprise Only!** This API endpoint and functionality only exists in
|
|
|
|
Nomad Enterprise. This is not present in the open source version of Nomad.
|
|
|
|
|
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
|
|
|
|
|
|
|
| Method | Path | Produces |
|
|
|
|
| ------ | ----------------- | ------------------ |
|
2017-10-15 23:41:24 +00:00
|
|
|
| `GET` | `/v1/quotas` | `application/json` |
|
2017-10-13 21:02:30 +00:00
|
|
|
|
|
|
|
The table below shows this endpoint's support for
|
|
|
|
[blocking queries](/api/index.html#blocking-queries) and
|
|
|
|
[required ACLs](/api/index.html#acls).
|
|
|
|
|
|
|
|
| Blocking Queries | ACL Required |
|
|
|
|
| ---------------- | ------------- |
|
2017-10-15 23:41:24 +00:00
|
|
|
| `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
|
|
|
|
based on an index prefix. This is specified as a querystring parameter.
|
2017-10-13 21:02:30 +00:00
|
|
|
|
|
|
|
### Sample Request
|
|
|
|
|
|
|
|
```text
|
|
|
|
$ curl \
|
2018-01-29 16:27:52 +00:00
|
|
|
https://localhost:4646/v1/quotas
|
2017-10-13 21:02:30 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
```text
|
|
|
|
$ 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,
|
|
|
|
"Networks": null
|
|
|
|
}
|
|
|
|
}
|
|
|
|
],
|
|
|
|
"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
|
|
|
|
2017-10-15 23:41:24 +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
|
|
|
|
[blocking queries](/api/index.html#blocking-queries) and
|
|
|
|
[required ACLs](/api/index.html#acls).
|
|
|
|
|
|
|
|
| Blocking Queries | ACL Required |
|
|
|
|
| ---------------- | -------------------- |
|
2017-10-15 23:41:24 +00:00
|
|
|
| `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
|
|
|
|
|
|
|
|
```text
|
|
|
|
$ 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,
|
|
|
|
"Networks": null
|
|
|
|
}
|
|
|
|
}
|
|
|
|
],
|
|
|
|
"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
|
|
|
|
2017-10-15 23:41:24 +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
|
|
|
|
[blocking queries](/api/index.html#blocking-queries) and
|
|
|
|
[required ACLs](/api/index.html#acls).
|
|
|
|
|
|
|
|
| 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`
|
|
|
|
object](https://github.com/hashicorp/nomad/blob/master/api/quota.go#L100-L131).
|
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,
|
|
|
|
"MemoryMB": 1000
|
|
|
|
}
|
|
|
|
}
|
|
|
|
]
|
2017-10-13 21:02:30 +00:00
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
### Sample Request
|
|
|
|
|
|
|
|
```text
|
|
|
|
$ curl \
|
|
|
|
--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
|
|
|
```
|
|
|
|
|
|
|
|
```text
|
|
|
|
$ curl \
|
|
|
|
--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
|
|
|
|
|
|
|
| Method | Path | Produces |
|
|
|
|
| ------- | -------------------------- | -------------------------- |
|
2017-10-16 04:15:14 +00:00
|
|
|
| `DELETE` | `/v1/quota/:quota` | `application/json` |
|
2017-10-13 21:02:30 +00:00
|
|
|
|
|
|
|
The table below shows this endpoint's support for
|
|
|
|
[blocking queries](/api/index.html#blocking-queries) and
|
|
|
|
[required ACLs](/api/index.html#acls).
|
|
|
|
|
|
|
|
| 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
|
|
|
|
|
|
|
|
```text
|
|
|
|
$ curl \
|
|
|
|
--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.
|
|
|
|
|
|
|
|
| Method | Path | Produces |
|
|
|
|
| ------ | ----------------- | ------------------ |
|
|
|
|
| `GET` | `/v1/quota-usages` | `application/json` |
|
|
|
|
|
|
|
|
The table below shows this endpoint's support for
|
|
|
|
[blocking queries](/api/index.html#blocking-queries) and
|
|
|
|
[required ACLs](/api/index.html#acls).
|
|
|
|
|
|
|
|
| Blocking Queries | ACL Required |
|
|
|
|
| ---------------- | ------------- |
|
|
|
|
| `YES` | `quota:read`<br>`namespace:*` if namespace has quota attached|
|
|
|
|
|
|
|
|
### Parameters
|
|
|
|
|
|
|
|
- `prefix` `(string: "")`- Specifies a string to filter quota specifications on
|
|
|
|
based on an index prefix. This is specified as a querystring parameter.
|
|
|
|
|
|
|
|
### Sample Request
|
|
|
|
|
|
|
|
```text
|
|
|
|
$ curl \
|
2018-01-29 16:27:52 +00:00
|
|
|
https://localhost:4646/v1/quota-usages
|
2017-10-16 04:15:14 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
```text
|
|
|
|
$ 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.
|
|
|
|
|
|
|
|
| Method | Path | Produces |
|
|
|
|
| ------ | ------------------- | -------------------------- |
|
|
|
|
| `GET` | `/v1/quota/usage/:quota` | `application/json` |
|
|
|
|
|
|
|
|
The table below shows this endpoint's support for
|
|
|
|
[blocking queries](/api/index.html#blocking-queries) and
|
|
|
|
[required ACLs](/api/index.html#acls).
|
|
|
|
|
|
|
|
| Blocking Queries | ACL Required |
|
|
|
|
| ---------------- | -------------------- |
|
|
|
|
| `YES` | `quota:read`<br>`namespace:*` if namespace has quota attached|
|
|
|
|
|
|
|
|
### 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
|
|
|
|
|
|
|
|
```text
|
|
|
|
$ curl \
|
2018-01-29 16:27:52 +00:00
|
|
|
https://localhost:4646/v1/quota/shared-quota
|
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
|
|
|
|
}
|
2017-10-13 21:02:30 +00:00
|
|
|
```
|