usage_plans
Creates, updates, deletes, gets or lists a usage_plans resource.
Overview
| Name | usage_plans |
| Type | Resource |
| Id | aws.apigateway.usage_plans |
Fields
The following fields are returned by SELECT queries:
- get_usage_plan
- get_usage_plans
| Name | Datatype | Description |
|---|---|---|
id | string | The identifier of a UsagePlan resource. |
name | string | The name of a usage plan. |
api_stages | array | The associated API stages of a usage plan. |
description | string | The description of a usage plan. |
product_code | string | The Amazon Web Services Marketplace product identifier to associate with the usage plan as a SaaS product on the Amazon Web Services Marketplace. |
quota | object | Quotas configured for a usage plan. |
tags | object | The collection of tags. Each tag element is associated with a given resource. |
throttle | object | The API request rate limits. |
| Name | Datatype | Description |
|---|---|---|
id | string | The identifier of a UsagePlan resource. |
name | string | The name of a usage plan. |
api_stages | array | The associated API stages of a usage plan. |
description | string | The description of a usage plan. |
product_code | string | The Amazon Web Services Marketplace product identifier to associate with the usage plan as a SaaS product on the Amazon Web Services Marketplace. |
quota | object | Quotas configured for a usage plan. |
tags | object | The collection of tags. Each tag element is associated with a given resource. |
throttle | object | The API request rate limits. |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
get_usage_plan | select | usageplan_id, region | Gets a usage plan of a given plan identifier. | |
get_usage_plans | select | region | position, keyId, limit | Gets all the usage plans of the caller's account. |
create_usage_plan | insert | region, name | Creates a usage plan with the throttle and quota limits, as well as the associated API stages, specified in the payload. | |
update_usage_plan | update | usageplan_id, region | Updates a usage plan of a given plan Id. | |
delete_usage_plan | delete | usageplan_id, region | Deletes a usage plan of a given plan Id. |
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 |
|---|---|---|
region | string | AWS region (default: us-east-1) |
usageplan_id | string | The Id of the to-be-deleted usage plan. |
keyId | string | The identifier of the API key associated with the usage plans. |
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_plan
- get_usage_plans
Gets a usage plan of a given plan identifier.
SELECT
id,
name,
api_stages,
description,
product_code,
quota,
tags,
throttle
FROM aws.apigateway.usage_plans
WHERE usageplan_id = '{{ usageplan_id }}' -- required
AND region = '{{ region }}' -- required
;
Gets all the usage plans of the caller's account.
SELECT
id,
name,
api_stages,
description,
product_code,
quota,
tags,
throttle
FROM aws.apigateway.usage_plans
WHERE region = '{{ region }}' -- required
AND position = '{{ position }}'
AND keyId = '{{ keyId }}'
AND limit = '{{ limit }}'
;
INSERT examples
- create_usage_plan
- Manifest
Creates a usage plan with the throttle and quota limits, as well as the associated API stages, specified in the payload.
INSERT INTO aws.apigateway.usage_plans (
name,
description,
apiStages,
throttle,
quota,
tags,
region
)
SELECT
'{{ name }}' /* required */,
'{{ description }}',
'{{ apiStages }}',
'{{ throttle }}',
'{{ quota }}',
'{{ tags }}',
'{{ region }}'
RETURNING
id,
name,
api_stages,
description,
product_code,
quota,
tags,
throttle
;
# Description fields are for documentation purposes
- name: usage_plans
props:
- name: region
value: "{{ region }}"
description: Required parameter for the usage_plans resource.
- name: name
value: "{{ name }}"
- name: description
value: "{{ description }}"
- name: apiStages
value:
- apiId: "{{ apiId }}"
stage: "{{ stage }}"
throttle: "{{ throttle }}"
- name: throttle
description: |
The API request rate limits.
value:
burstLimit: {{ burstLimit }}
rateLimit: {{ rateLimit }}
- name: quota
description: |
Quotas configured for a usage plan.
value:
limit: {{ limit }}
offset: {{ offset }}
period: "{{ period }}"
- name: tags
value: "{{ tags }}"
UPDATE examples
- update_usage_plan
Updates a usage plan of a given plan Id.
UPDATE aws.apigateway.usage_plans
SET
patchOperations = '{{ patchOperations }}'
WHERE
usageplan_id = '{{ usageplan_id }}' --required
AND region = '{{ region }}' --required
RETURNING
id,
name,
api_stages,
description,
product_code,
quota,
tags,
throttle;
DELETE examples
- delete_usage_plan
Deletes a usage plan of a given plan Id.
DELETE FROM aws.apigateway.usage_plans
WHERE usageplan_id = '{{ usageplan_id }}' --required
AND region = '{{ region }}' --required
;