open-nomad/website/source/api/quotas.html.md

204 lines
4.8 KiB
Markdown
Raw Normal View History

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 \
2017-10-15 23:41:24 +00:00
https://nomad.rocks/v1/quotas
2017-10-13 21:02:30 +00:00
```
```text
$ curl \
2017-10-15 23:41:24 +00:00
https://nomad.rocks/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,
"IOPS": 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
- `:namespace` `(string: <required>)`- Specifies the namespace to query.
### Sample Request
```text
$ curl \
2017-10-15 23:41:24 +00:00
https://nomad.rocks/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,
"IOPS": 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
### Parameters
- `Namespace` `(string: <required>)`- Specifies the namespace to create or
update.
- `Description` `(string: "")` - Specifies an optional human-readable
description of the namespace.
### Sample Payload
```javascript
{
"Namespace": "api-prod",
"Description": "Production API Servers"
}
```
### Sample Request
```text
$ curl \
--request POST \
--data @namespace.json \
https://nomad.rocks/v1/namespace/api-prod
```
```text
$ curl \
--request POST \
--data @namespace.json \
https://nomad.rocks/v1/namespace
```
## Delete Namespace
This endpoint is used to delete a namespace.
| Method | Path | Produces |
| ------- | -------------------------- | -------------------------- |
| `DELETE` | `/v1/namespace/:namespace` | `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 |
| ---------------- | ------------ |
| `NO` | `management` |
### Parameters
- `:namespace` `(string: <required>)`- Specifies the namespace to delete.
### Sample Request
```text
$ curl \
--request DELETE \
https://nomad.rocks/v1/namespace/api-prod
```