Skip to main content

stages

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

Overview

Namestages
TypeResource
Idaws.apigatewayv2.stages

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
access_log_settingsobjectSettings for logging access in a stage.
api_gateway_managedbooleanSpecifies whether a stage is managed by API Gateway. If you created an API using quick create, the $default stage is managed by API Gateway. You can't modify the $default stage.
auto_deploybooleanSpecifies whether updates to an API automatically trigger a new deployment. The default value is false.
client_certificate_idstringThe identifier.
created_datestring (date-time)The timestamp when the stage was created.
default_route_settingsobjectRepresents a collection of route settings.
deployment_idstringThe identifier.
descriptionstringA string with a length between [0-1024].
last_deployment_status_messagestringDescribes the status of the last deployment of a stage. Supported only for stages with autoDeploy enabled.
last_updated_datestring (date-time)The timestamp when the stage was last updated.
route_settingsobjectRoute settings for the stage, by routeKey.
stage_namestringA string with a length between [1-128].
stage_variablesobjectA map that defines the stage variables for a stage resource. Variable names can have alphanumeric and underscore characters, and the values must match [A-Za-z0-9-._~:/?#&=,]+.
tagsobjectThe collection of tags. Each tag element is associated with a given resource.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
get_stageselectapi_id, stage_name, regionGets a Stage.
get_stagesselectapi_id, regionmaxResults, nextTokenGets the Stages for an API.
create_stageinsertapi_id, region, StageNameCreates a Stage for an API.
update_stageupdateapi_id, stage_name, regionUpdates a Stage.
delete_stagedeleteapi_id, stage_name, regionDeletes a Stage.
delete_access_log_settingsexecapi_id, stage_name, regionDeletes the AccessLogSettings for a Stage. To disable access logging for a Stage, delete its AccessLogSettings.

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_idstringThe API identifier.
regionstringAWS region (default: us-east-1)
stage_namestringThe stage name. Stage names can only contain alphanumeric characters, hyphens, and underscores. Maximum length is 128 characters.
maxResultsstringThe maximum number of elements to be returned for this resource.
nextTokenstringThe next page of elements from this collection. Not valid for the last element of the collection.

SELECT examples

Gets a Stage.

SELECT
access_log_settings,
api_gateway_managed,
auto_deploy,
client_certificate_id,
created_date,
default_route_settings,
deployment_id,
description,
last_deployment_status_message,
last_updated_date,
route_settings,
stage_name,
stage_variables,
tags
FROM aws.apigatewayv2.stages
WHERE api_id = '{{ api_id }}' -- required
AND stage_name = '{{ stage_name }}' -- required
AND region = '{{ region }}' -- required
;

INSERT examples

Creates a Stage for an API.

INSERT INTO aws.apigatewayv2.stages (
AccessLogSettings,
AutoDeploy,
ClientCertificateId,
DefaultRouteSettings,
DeploymentId,
Description,
RouteSettings,
StageName,
StageVariables,
Tags,
api_id,
region
)
SELECT
'{{ AccessLogSettings }}',
{{ AutoDeploy }},
'{{ ClientCertificateId }}',
'{{ DefaultRouteSettings }}',
'{{ DeploymentId }}',
'{{ Description }}',
'{{ RouteSettings }}',
'{{ StageName }}' /* required */,
'{{ StageVariables }}',
'{{ Tags }}',
'{{ api_id }}',
'{{ region }}'
RETURNING
access_log_settings,
api_gateway_managed,
auto_deploy,
client_certificate_id,
created_date,
default_route_settings,
deployment_id,
description,
last_deployment_status_message,
last_updated_date,
route_settings,
stage_name,
stage_variables,
tags
;

UPDATE examples

Updates a Stage.

UPDATE aws.apigatewayv2.stages
SET
AccessLogSettings = '{{ AccessLogSettings }}',
AutoDeploy = {{ AutoDeploy }},
ClientCertificateId = '{{ ClientCertificateId }}',
DefaultRouteSettings = '{{ DefaultRouteSettings }}',
DeploymentId = '{{ DeploymentId }}',
Description = '{{ Description }}',
RouteSettings = '{{ RouteSettings }}',
StageVariables = '{{ StageVariables }}'
WHERE
api_id = '{{ api_id }}' --required
AND stage_name = '{{ stage_name }}' --required
AND region = '{{ region }}' --required
RETURNING
access_log_settings,
api_gateway_managed,
auto_deploy,
client_certificate_id,
created_date,
default_route_settings,
deployment_id,
description,
last_deployment_status_message,
last_updated_date,
route_settings,
stage_name,
stage_variables,
tags;

DELETE examples

Deletes a Stage.

DELETE FROM aws.apigatewayv2.stages
WHERE api_id = '{{ api_id }}' --required
AND stage_name = '{{ stage_name }}' --required
AND region = '{{ region }}' --required
;

Lifecycle Methods

Deletes the AccessLogSettings for a Stage. To disable access logging for a Stage, delete its AccessLogSettings.

EXEC aws.apigatewayv2.stages.delete_access_log_settings
@api_id='{{ api_id }}' --required,
@stage_name='{{ stage_name }}' --required,
@region='{{ region }}' --required
;