cdk-real-drift 0.4.18 → 0.4.20

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 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";
@@ -2135,7 +2135,9 @@ const KNOWN_DEFAULTS = {
2135
2135
  "AWS::EC2::IPAM": { MeteredAccount: "ipam-owner" },
2136
2136
  "AWS::EC2::ClientVpnEndpoint": {
2137
2137
  VpnPort: 443,
2138
- DisconnectOnSessionTimeout: true
2138
+ DisconnectOnSessionTimeout: true,
2139
+ TransportProtocol: "udp",
2140
+ SessionTimeoutHours: 24
2139
2141
  },
2140
2142
  "AWS::DAX::Cluster": { ClusterEndpointEncryptionType: "NONE" },
2141
2143
  "AWS::APS::Workspace": { WorkspaceConfiguration: {
@@ -5889,12 +5891,17 @@ async function enumerateRestApiChildren(ctx) {
5889
5891
  const declaredModelNames = [];
5890
5892
  const declaredValidatorIds = [];
5891
5893
  const declaredResponseTypes = [];
5894
+ const declaredStageNames = [];
5892
5895
  for (const r of desired.resources) if (r.resourceType === "AWS::ApiGateway::Authorizer" && parentRefMatches(r.declared.RestApiId, apiId) && r.physicalId) declaredAuthorizerIds.push(r.physicalId);
5893
5896
  else if (r.resourceType === "AWS::ApiGateway::Model" && parentRefMatches(r.declared.RestApiId, apiId)) {
5894
5897
  const name = typeof r.declared.Name === "string" ? r.declared.Name : r.physicalId;
5895
5898
  if (name) declaredModelNames.push(name);
5896
5899
  } else if (r.resourceType === "AWS::ApiGateway::RequestValidator" && parentRefMatches(r.declared.RestApiId, apiId) && r.physicalId) declaredValidatorIds.push(r.physicalId);
5897
5900
  else if (r.resourceType === "AWS::ApiGateway::GatewayResponse" && parentRefMatches(r.declared.RestApiId, apiId) && typeof r.declared.ResponseType === "string") declaredResponseTypes.push(r.declared.ResponseType);
5901
+ else if (r.resourceType === "AWS::ApiGateway::Stage" && parentRefMatches(r.declared.RestApiId, apiId)) {
5902
+ const name = typeof r.declared.StageName === "string" ? r.declared.StageName : r.physicalId;
5903
+ if (name) declaredStageNames.push(name);
5904
+ }
5898
5905
  const client = new APIGatewayClient({
5899
5906
  region,
5900
5907
  ...READ_RETRY
@@ -5961,14 +5968,44 @@ async function enumerateRestApiChildren(ctx) {
5961
5968
  label: g.responseType
5962
5969
  }))
5963
5970
  });
5971
+ const stageAdded = diffApiGatewayStages({
5972
+ apiId,
5973
+ declaredStageNames,
5974
+ liveStages: (await getAllStages(client, apiId)).filter((s) => typeof s.stageName === "string").map((s) => ({
5975
+ name: s.stageName,
5976
+ label: s.stageName
5977
+ }))
5978
+ });
5964
5979
  return [
5965
5980
  ...resourceAndMethodAdded,
5966
5981
  ...authorizerAdded,
5967
5982
  ...modelAdded,
5968
5983
  ...validatorAdded,
5969
- ...gatewayResponseAdded
5984
+ ...gatewayResponseAdded,
5985
+ ...stageAdded
5970
5986
  ];
5971
5987
  }
5988
+ function diffApiGatewayStages(input) {
5989
+ const { apiId, declaredStageNames, liveStages } = input;
5990
+ const declared = new Set(declaredStageNames);
5991
+ const added = [];
5992
+ for (const s of liveStages) {
5993
+ if (declared.has(s.name)) continue;
5994
+ added.push({
5995
+ resourceType: "AWS::ApiGateway::Stage",
5996
+ identifier: `${apiId}|${s.name}`,
5997
+ label: s.label ?? s.name,
5998
+ live: {
5999
+ StageName: s.name,
6000
+ RestApiId: apiId
6001
+ }
6002
+ });
6003
+ }
6004
+ return added;
6005
+ }
6006
+ async function getAllStages(client, apiId) {
6007
+ return (await client.send(new GetStagesCommand({ restApiId: apiId }))).item ?? [];
6008
+ }
5972
6009
  function diffApiGatewayAuthorizers(input) {
5973
6010
  const { apiId, declaredAuthorizerIds, liveAuthorizers } = input;
5974
6011
  const declared = new Set(declaredAuthorizerIds);
@@ -6210,7 +6247,7 @@ async function pageV2Stages(client, apiId) {
6210
6247
  const out = [];
6211
6248
  let next;
6212
6249
  do {
6213
- const res = await client.send(new GetStagesCommand({
6250
+ const res = await client.send(new GetStagesCommand$1({
6214
6251
  ApiId: apiId,
6215
6252
  NextToken: next
6216
6253
  }));