Quotaο
Read Quotaο
- Quota.read_quota(name)[source]
Read quota. Only works when calling on the root namespace.
- Supported methods:
GET: /sys/quotas/rate-limit/:name. Produces: 200 application/json
- Parameters:
name (str | unicode) β the name of the quota to look up.
- Returns:
JSON response from API request.
- Return type:
requests.Response
Examplesο
import hvac
client = hvac.Client(url='https://127.0.0.1:8200')
client.sys.create_or_update_quota(name="quota1", rate=100.0)
Create or Update Quotaο
- Quota.create_or_update_quota(name, rate, path=None, interval=None, block_interval=None, role=None, rate_limit_type=None, inheritable=None)[source]
Create quota if it doesnβt exist or update if already created. Only works when calling on the root namespace.
- Supported methods:
POST: /sys/quotas/rate-limit. Produces: 204 (empty body)
- Parameters:
name (str | unicode) β The name of the quota to create or update.
path (str | unicode) β Path of the mount or namespace to apply the quota.
rate (float) β The maximum number of requests in a given interval to be allowed. Must be positive.
interval (str | unicode) β The duration to enforce rate limit. Default is β1sβ.
block_interval (str | unicode) β If rate limit is reached, how long before client can send requests again.
role (str | unicode) β If quota is set on an auth mount path, restrict login requests that are made with a specified role.
rate_limit_type (str | unicode) β Type of rate limit quota. Can be lease-count or rate-limit.
inheritable (bool) β If set to true on a path that is a namespace, quota will be applied to all child namespaces
- Returns:
API status code from request.
- Return type:
requests.Response
import hvac
client = hvac.Client(url='https://127.0.0.1:8200')
# Create file quota
client.sys.create_or_update_quota(name="quota1", rate=100.0)
# Update quota that already exists
client.sys.create_or_update_quota(name="quota1", rate=101.0)
List Quotasο
- Quota.list_quotas()[source]
Retrieve a list of quotas by name. Only works when calling on the root namespace.
- Supported methods:
LIST: /sys/quotas/rate-limit. Produces: 200 application/json
- Returns:
JSON response from API request.
- Return type:
requests.Response
Examplesο
import hvac
client = hvac.Client(url='https://127.0.0.1:8200')
client.sys.create_or_update_quota(name="quota1", rate=1000.0, interval="10m")
client.sys.create_or_update_quota(name="quota2", rate=1000.0, path="/kv")
Delete Quotaο
- Quota.delete_quota(name)[source]
Delete a given quota. Only works when calling on the root namespace.
- Supported methods:
DELETE: /sys/quotas/rate-limit. Produces: 204 (empty body)
- Parameters:
name (str | unicode) β Name of the quota to delete
- Returns:
API status code from request.
- Return type:
requests.Response
Examplesο
import hvac
client = hvac.Client(url='https://127.0.0.1:8200')
client.sys.delete_quota(name="quota1")