Skip to main content

api_keys

Creates, updates, deletes, gets or lists an api_keys resource.

Overview

Nameapi_keys
TypeResource
Idaws.apigateway.api_keys

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
idstringThe identifier of the API Key.
namestringThe name of the API Key.
created_datestring (date-time)The timestamp when the API Key was created.
customer_idstringAn Amazon Web Services Marketplace customer identifier, when integrating with the Amazon Web Services SaaS Marketplace.
descriptionstringThe description of the API Key.
enabledbooleanSpecifies whether the API Key can be used by callers.
last_updated_datestring (date-time)The timestamp when the API Key was last updated.
stage_keysarrayA list of Stage resources that are associated with the ApiKey resource.
tagsobjectThe collection of tags. Each tag element is associated with a given resource.
valuestringThe value of the API Key.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
get_api_keyselectapi__key, regionincludeValueGets information about the current ApiKey resource.
get_api_keysselectregionposition, limit, name, customerId, includeValuesGets information about the current ApiKeys resource.
create_api_keyinsertregionCreate an ApiKey resource.
update_api_keyupdateapi__key, regionChanges information about an ApiKey resource.
delete_api_keydeleteapi__key, regionDeletes the ApiKey resource.
import_api_keysexecformat, region, bodyfailonwarningsImport API keys from an external source, such as a CSV-formatted file.

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
api__keystringThe identifier of the ApiKey resource to be deleted.
formatstringA query parameter to specify the input format to imported API keys. Currently, only the csv format is supported.
regionstringAWS region (default: us-east-1)
customerIdstringThe identifier of a customer in Amazon Web Services Marketplace or an external system, such as a developer portal.
failonwarningsbooleanA query parameter to indicate whether to rollback ApiKey importation (true) or not (false) when error is encountered.
includeValuebooleanA boolean flag to specify whether (true) or not (false) the result contains the key value.
includeValuesbooleanA boolean flag to specify whether (true) or not (false) the result contains key values.
limitintegerThe maximum number of returned results per page. The default value is 25 and the maximum value is 500.
namestringThe name of queried API keys.
positionstringThe current pagination position in the paged result set.

SELECT examples

Gets information about the current ApiKey resource.

SELECT
id,
name,
created_date,
customer_id,
description,
enabled,
last_updated_date,
stage_keys,
tags,
value
FROM aws.apigateway.api_keys
WHERE api__key = '{{ api__key }}' -- required
AND region = '{{ region }}' -- required
AND includeValue = '{{ includeValue }}'
;

INSERT examples

Create an ApiKey resource.

INSERT INTO aws.apigateway.api_keys (
name,
description,
enabled,
generateDistinctId,
value,
stageKeys,
customerId,
tags,
region
)
SELECT
'{{ name }}',
'{{ description }}',
{{ enabled }},
{{ generateDistinctId }},
'{{ value }}',
'{{ stageKeys }}',
'{{ customerId }}',
'{{ tags }}',
'{{ region }}'
RETURNING
id,
name,
created_date,
customer_id,
description,
enabled,
last_updated_date,
stage_keys,
tags,
value
;

UPDATE examples

Changes information about an ApiKey resource.

UPDATE aws.apigateway.api_keys
SET
patchOperations = '{{ patchOperations }}'
WHERE
api__key = '{{ api__key }}' --required
AND region = '{{ region }}' --required
RETURNING
id,
name,
created_date,
customer_id,
description,
enabled,
last_updated_date,
stage_keys,
tags,
value;

DELETE examples

Deletes the ApiKey resource.

DELETE FROM aws.apigateway.api_keys
WHERE api__key = '{{ api__key }}' --required
AND region = '{{ region }}' --required
;

Lifecycle Methods

Import API keys from an external source, such as a CSV-formatted file.

EXEC aws.apigateway.api_keys.import_api_keys
@format='{{ format }}' --required,
@region='{{ region }}' --required,
@failonwarnings={{ failonwarnings }}
@@json=
'{
"body": "{{ body }}"
}'
;