api_keys
Creates, updates, deletes, gets or lists an api_keys resource.
Overview
| Name | api_keys |
| Type | Resource |
| Id | aws.appsync.api_keys |
Fields
The following fields are returned by SELECT queries:
- list_api_keys
| Name | Datatype | Description |
|---|---|---|
id | string | The API key ID. |
deletes | integer (int64) | The time after which the API key is deleted. The date is represented as seconds since the epoch, rounded down to the nearest hour. |
description | string | A description of the purpose of the API key. |
expires | integer (int64) | The time after which the API key expires. The date is represented as seconds since the epoch, rounded down to the nearest hour. |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
list_api_keys | select | api_id, region | nextToken, maxResults | Lists the API keys for a given API. API keys are deleted automatically 60 days after they expire. However, they may still be included in the response until they have actually been deleted. You can safely call DeleteApiKey to manually delete a key before it's automatically deleted. |
create_api_key | insert | api_id, region | Creates a unique key that you can distribute to clients who invoke your API. | |
update_api_key | update | api_id, id, region | Updates an API key. You can update the key as long as it's not deleted. | |
delete_api_key | delete | api_id, id, region | Deletes an 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 |
|---|---|---|
api_id | string | The API ID. |
id | string | The ID for the API key. |
region | string | AWS region (default: us-east-1) |
maxResults | integer | The maximum number of results that you want the request to return. |
nextToken | string | An identifier that was returned from the previous call to this operation, which you can use to return the next set of items in the list. |
SELECT examples
- list_api_keys
Lists the API keys for a given API. API keys are deleted automatically 60 days after they expire. However, they may still be included in the response until they have actually been deleted. You can safely call DeleteApiKey to manually delete a key before it's automatically deleted.
SELECT
id,
deletes,
description,
expires
FROM aws.appsync.api_keys
WHERE api_id = '{{ api_id }}' -- required
AND region = '{{ region }}' -- required
AND nextToken = '{{ nextToken }}'
AND maxResults = '{{ maxResults }}'
;
INSERT examples
- create_api_key
- Manifest
Creates a unique key that you can distribute to clients who invoke your API.
INSERT INTO aws.appsync.api_keys (
description,
expires,
api_id,
region
)
SELECT
'{{ description }}',
{{ expires }},
'{{ api_id }}',
'{{ region }}'
RETURNING
api_key
;
# Description fields are for documentation purposes
- name: api_keys
props:
- name: api_id
value: "{{ api_id }}"
description: Required parameter for the api_keys resource.
- name: region
value: "{{ region }}"
description: Required parameter for the api_keys resource.
- name: description
value: "{{ description }}"
- name: expires
value: {{ expires }}
UPDATE examples
- update_api_key
Updates an API key. You can update the key as long as it's not deleted.
UPDATE aws.appsync.api_keys
SET
description = '{{ description }}',
expires = {{ expires }}
WHERE
api_id = '{{ api_id }}' --required
AND id = '{{ id }}' --required
AND region = '{{ region }}' --required
RETURNING
api_key;
DELETE examples
- delete_api_key
Deletes an API key.
DELETE FROM aws.appsync.api_keys
WHERE api_id = '{{ api_id }}' --required
AND id = '{{ id }}' --required
AND region = '{{ region }}' --required
;