Skip to main content

usages

Creates, updates, deletes, gets or lists a usages resource.

Overview

Nameusages
TypeResource
Idaws.apigateway.usages

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
end_datestringThe ending date of the usage data.
items_objectThe 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].
positionstring
start_datestringThe starting date of the usage data.
usage_plan_idstringThe plan Id associated with this usage data.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
get_usageselectusageplan_id, startDate, endDate, regionkeyId, position, limitGets the usage data of a usage plan in a specified time interval.
update_usageupdateusageplan_id, key_id, regionGrants 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.

NameDatatypeDescription
endDatestringThe ending date (e.g., 2016-12-31) of the usage data.
key_idstringThe identifier of the API key associated with the usage plan in which a temporary extension is granted to the remaining quota.
regionstringAWS region (default: us-east-1)
startDatestringThe starting date (e.g., 2016-01-01) of the usage data.
usageplan_idstringThe Id of the usage plan associated with the usage data.
keyIdstringThe Id of the API key associated with the resultant usage data.
limitintegerThe maximum number of returned results per page. The default value is 25 and the maximum value is 500.
positionstringThe current pagination position in the paged result set.

SELECT examples

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

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;