cdk-real-drift 0.4.18 → 0.4.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/cli.js +39 -4
- package/dist/cli.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -274,7 +274,7 @@ snapshots its full live model and watches it, `ignore` accepts it, or `revert`
|
|
|
274
274
|
<summary>Covered parent types (the <code>CHILD_ENUMERATORS</code> registry, growing per type)</summary>
|
|
275
275
|
|
|
276
276
|
- **API Gateway REST**: resources, methods, authorizers, models, request
|
|
277
|
-
validators, gateway responses
|
|
277
|
+
validators, gateway responses, stages
|
|
278
278
|
- **API Gateway V2** (HTTP / WebSocket): routes, integrations, authorizers, stages
|
|
279
279
|
- **SNS**: topic subscriptions
|
|
280
280
|
- **Lambda**: event source mappings, function URLs, aliases, versions
|
package/dist/cli.js
CHANGED
|
@@ -9,10 +9,10 @@ import { BaseCredentials, CdkAppMultiContext, NonInteractiveIoHost, StackSelecti
|
|
|
9
9
|
import { CloudFormationClient, DescribeStackResourcesCommand, DescribeStacksCommand, DescribeTypeCommand, GetTemplateCommand, ListExportsCommand, ListStackResourcesCommand } from "@aws-sdk/client-cloudformation";
|
|
10
10
|
import jsonata from "jsonata";
|
|
11
11
|
import { KMSClient, ListAliasesCommand } from "@aws-sdk/client-kms";
|
|
12
|
-
import { APIGatewayClient, GetAuthorizersCommand, GetGatewayResponsesCommand, GetModelsCommand, GetRequestValidatorsCommand, GetResourcesCommand, UpdateIntegrationCommand, UpdateIntegrationResponseCommand, UpdateMethodResponseCommand, UpdateRestApiCommand } from "@aws-sdk/client-api-gateway";
|
|
12
|
+
import { APIGatewayClient, GetAuthorizersCommand, GetGatewayResponsesCommand, GetModelsCommand, GetRequestValidatorsCommand, GetResourcesCommand, GetStagesCommand, UpdateIntegrationCommand, UpdateIntegrationResponseCommand, UpdateMethodResponseCommand, UpdateRestApiCommand } from "@aws-sdk/client-api-gateway";
|
|
13
13
|
import { AppConfigClient, ListConfigurationProfilesCommand, ListEnvironmentsCommand } from "@aws-sdk/client-appconfig";
|
|
14
14
|
import { AppSyncClient, ListApiKeysCommand, ListDataSourcesCommand, ListFunctionsCommand, ListResolversCommand, ListTypesCommand } from "@aws-sdk/client-appsync";
|
|
15
|
-
import { ApiGatewayV2Client, DeleteAccessLogSettingsCommand, DeleteRouteSettingsCommand, GetAuthorizersCommand as GetAuthorizersCommand$1, GetIntegrationsCommand, GetRoutesCommand, GetStagesCommand, UpdateStageCommand } from "@aws-sdk/client-apigatewayv2";
|
|
15
|
+
import { ApiGatewayV2Client, DeleteAccessLogSettingsCommand, DeleteRouteSettingsCommand, GetAuthorizersCommand as GetAuthorizersCommand$1, GetIntegrationsCommand, GetRoutesCommand, GetStagesCommand as GetStagesCommand$1, UpdateStageCommand } from "@aws-sdk/client-apigatewayv2";
|
|
16
16
|
import { CloudWatchLogsClient, DescribeMetricFiltersCommand, DescribeSubscriptionFiltersCommand, PutBearerTokenAuthenticationCommand, PutMetricFilterCommand } from "@aws-sdk/client-cloudwatch-logs";
|
|
17
17
|
import { CognitoIdentityProviderClient, ListGroupsCommand, ListResourceServersCommand, ListUserPoolClientsCommand } from "@aws-sdk/client-cognito-identity-provider";
|
|
18
18
|
import { DescribeAddressesCommand, DescribeClientVpnAuthorizationRulesCommand, DescribeClientVpnEndpointsCommand, DescribeClientVpnTargetNetworksCommand, DescribeLaunchTemplateVersionsCommand, DescribeNetworkAclsCommand, DescribeRouteTablesCommand, DescribeSubnetsCommand, EC2Client, ModifyClientVpnEndpointCommand } from "@aws-sdk/client-ec2";
|
|
@@ -5889,12 +5889,17 @@ async function enumerateRestApiChildren(ctx) {
|
|
|
5889
5889
|
const declaredModelNames = [];
|
|
5890
5890
|
const declaredValidatorIds = [];
|
|
5891
5891
|
const declaredResponseTypes = [];
|
|
5892
|
+
const declaredStageNames = [];
|
|
5892
5893
|
for (const r of desired.resources) if (r.resourceType === "AWS::ApiGateway::Authorizer" && parentRefMatches(r.declared.RestApiId, apiId) && r.physicalId) declaredAuthorizerIds.push(r.physicalId);
|
|
5893
5894
|
else if (r.resourceType === "AWS::ApiGateway::Model" && parentRefMatches(r.declared.RestApiId, apiId)) {
|
|
5894
5895
|
const name = typeof r.declared.Name === "string" ? r.declared.Name : r.physicalId;
|
|
5895
5896
|
if (name) declaredModelNames.push(name);
|
|
5896
5897
|
} else if (r.resourceType === "AWS::ApiGateway::RequestValidator" && parentRefMatches(r.declared.RestApiId, apiId) && r.physicalId) declaredValidatorIds.push(r.physicalId);
|
|
5897
5898
|
else if (r.resourceType === "AWS::ApiGateway::GatewayResponse" && parentRefMatches(r.declared.RestApiId, apiId) && typeof r.declared.ResponseType === "string") declaredResponseTypes.push(r.declared.ResponseType);
|
|
5899
|
+
else if (r.resourceType === "AWS::ApiGateway::Stage" && parentRefMatches(r.declared.RestApiId, apiId)) {
|
|
5900
|
+
const name = typeof r.declared.StageName === "string" ? r.declared.StageName : r.physicalId;
|
|
5901
|
+
if (name) declaredStageNames.push(name);
|
|
5902
|
+
}
|
|
5898
5903
|
const client = new APIGatewayClient({
|
|
5899
5904
|
region,
|
|
5900
5905
|
...READ_RETRY
|
|
@@ -5961,14 +5966,44 @@ async function enumerateRestApiChildren(ctx) {
|
|
|
5961
5966
|
label: g.responseType
|
|
5962
5967
|
}))
|
|
5963
5968
|
});
|
|
5969
|
+
const stageAdded = diffApiGatewayStages({
|
|
5970
|
+
apiId,
|
|
5971
|
+
declaredStageNames,
|
|
5972
|
+
liveStages: (await getAllStages(client, apiId)).filter((s) => typeof s.stageName === "string").map((s) => ({
|
|
5973
|
+
name: s.stageName,
|
|
5974
|
+
label: s.stageName
|
|
5975
|
+
}))
|
|
5976
|
+
});
|
|
5964
5977
|
return [
|
|
5965
5978
|
...resourceAndMethodAdded,
|
|
5966
5979
|
...authorizerAdded,
|
|
5967
5980
|
...modelAdded,
|
|
5968
5981
|
...validatorAdded,
|
|
5969
|
-
...gatewayResponseAdded
|
|
5982
|
+
...gatewayResponseAdded,
|
|
5983
|
+
...stageAdded
|
|
5970
5984
|
];
|
|
5971
5985
|
}
|
|
5986
|
+
function diffApiGatewayStages(input) {
|
|
5987
|
+
const { apiId, declaredStageNames, liveStages } = input;
|
|
5988
|
+
const declared = new Set(declaredStageNames);
|
|
5989
|
+
const added = [];
|
|
5990
|
+
for (const s of liveStages) {
|
|
5991
|
+
if (declared.has(s.name)) continue;
|
|
5992
|
+
added.push({
|
|
5993
|
+
resourceType: "AWS::ApiGateway::Stage",
|
|
5994
|
+
identifier: `${apiId}|${s.name}`,
|
|
5995
|
+
label: s.label ?? s.name,
|
|
5996
|
+
live: {
|
|
5997
|
+
StageName: s.name,
|
|
5998
|
+
RestApiId: apiId
|
|
5999
|
+
}
|
|
6000
|
+
});
|
|
6001
|
+
}
|
|
6002
|
+
return added;
|
|
6003
|
+
}
|
|
6004
|
+
async function getAllStages(client, apiId) {
|
|
6005
|
+
return (await client.send(new GetStagesCommand({ restApiId: apiId }))).item ?? [];
|
|
6006
|
+
}
|
|
5972
6007
|
function diffApiGatewayAuthorizers(input) {
|
|
5973
6008
|
const { apiId, declaredAuthorizerIds, liveAuthorizers } = input;
|
|
5974
6009
|
const declared = new Set(declaredAuthorizerIds);
|
|
@@ -6210,7 +6245,7 @@ async function pageV2Stages(client, apiId) {
|
|
|
6210
6245
|
const out = [];
|
|
6211
6246
|
let next;
|
|
6212
6247
|
do {
|
|
6213
|
-
const res = await client.send(new GetStagesCommand({
|
|
6248
|
+
const res = await client.send(new GetStagesCommand$1({
|
|
6214
6249
|
ApiId: apiId,
|
|
6215
6250
|
NextToken: next
|
|
6216
6251
|
}));
|