usages
Creates, updates, deletes, gets or lists a usages resource.
Overview
| Name | usages |
| Type | Resource |
| Id | aws.apigateway.usages |
Fields
The following fields are returned by SELECT queries:
- get_usage
| Name | Datatype | Description |
|---|---|---|
end_date | string | The ending date of the usage data. |
items_ | object | The usage data, as daily logs of used and remaining quotas, over the specified time interval indexed over the API keys in a usage plan. For example, {..., "values" : { "{api_key}" : [ [0, 100], [10, 90], [100, 10]]}, where {api_key} stands for an API key value and the daily log entry is of the format [used quota, remaining quota]. |
position | string | |
start_date | string | The starting date of the usage data. |
usage_plan_id | string | The plan Id associated with this usage data. |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
get_usage | select | usageplan_id, startDate, endDate, region | keyId, position, limit | Gets the usage data of a usage plan in a specified time interval. |
update_usage | update | usageplan_id, key_id, region | Grants a temporary extension to the remaining quota of a usage plan associated with a specified API key. |
Parameters
Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.
| Name | Datatype | Description |
|---|---|---|
endDate | string | The ending date (e.g., 2016-12-31) of the usage data. |
key_id | string | The identifier of the API key associated with the usage plan in which a temporary extension is granted to the remaining quota. |
region | string | AWS region (default: us-east-1) |
startDate | string | The starting date (e.g., 2016-01-01) of the usage data. |
usageplan_id | string | The Id of the usage plan associated with the usage data. |
keyId | string | The Id of the API key associated with the resultant usage data. |
limit | integer | The maximum number of returned results per page. The default value is 25 and the maximum value is 500. |
position | string | The current pagination position in the paged result set. |
SELECT examples
- get_usage
Gets the usage data of a usage plan in a specified time interval.
SELECT
end_date,
items_,
position,
start_date,
usage_plan_id
FROM aws.apigateway.usages
WHERE usageplan_id = '{{ usageplan_id }}' -- required
AND startDate = '{{ startDate }}' -- required
AND endDate = '{{ endDate }}' -- required
AND region = '{{ region }}' -- required
AND keyId = '{{ keyId }}'
AND position = '{{ position }}'
AND limit = '{{ limit }}'
;
UPDATE examples
- update_usage
Grants a temporary extension to the remaining quota of a usage plan associated with a specified API key.
UPDATE aws.apigateway.usages
SET
patchOperations = '{{ patchOperations }}'
WHERE
usageplan_id = '{{ usageplan_id }}' --required
AND key_id = '{{ key_id }}' --required
AND region = '{{ region }}' --required
RETURNING
end_date,
items_,
position,
start_date,
usage_plan_id;