Files
nomad/website/source/api/quotas.html.md
Alex Dadgar bf72d096ca quota api
2017-10-15 16:41:24 -07:00

4.8 KiB

layout, page_title, sidebar_current, description
layout page_title sidebar_current description
api Quotas - HTTP API api-quotas The /quota endpoints are used to query for and interact with quotas.

Quota HTTP API

The /quota endpoints are used to query for and interact with quotas.

~> Enterprise Only! This API endpoint and functionality only exists in Nomad Enterprise. This is not present in the open source version of Nomad.

List Quota Specifications

This endpoint lists all quota specifications.

Method Path Produces
GET /v1/quotas application/json

The table below shows this endpoint's support for blocking queries and required ACLs.

Blocking Queries ACL Required
YES quota:read
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

$ curl \
    https://nomad.rocks/v1/quotas
$ curl \
    https://nomad.rocks/v1/quotas?prefix=sha

Sample Response

[
  {
    "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"
  }
]

Read Quota Specification

This endpoint reads information about a specific quota specification.

Method Path Produces
GET /v1/quota/:quota application/json

The table below shows this endpoint's support for blocking queries and required ACLs.

Blocking Queries ACL Required
YES quota:read
namespace:* if namespace has quota attached

Parameters

  • :namespace (string: <required>)- Specifies the namespace to query.

Sample Request

$ curl \
    https://nomad.rocks/v1/quota/shared-quota

Sample Response

{
  "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"
}

Create or Update Quota Specification

This endpoint is used to create or update a quota specification.

Method Path Produces
POST /v1/quota/:quota
/v1/quota
application/json

The table below shows this endpoint's support for blocking queries and required ACLs.

Blocking Queries ACL Required
NO quota:write

Parameters

  • Namespace (string: <required>)- Specifies the namespace to create or update.

  • Description (string: "") - Specifies an optional human-readable description of the namespace.

Sample Payload

{
  "Namespace": "api-prod",
  "Description": "Production API Servers"
}

Sample Request

$ curl \
    --request POST \
    --data @namespace.json \
    https://nomad.rocks/v1/namespace/api-prod
$ 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 and required ACLs.

Blocking Queries ACL Required
NO management

Parameters

  • :namespace (string: <required>)- Specifies the namespace to delete.

Sample Request

$ curl \
    --request DELETE \
    https://nomad.rocks/v1/namespace/api-prod