cdk-real-drift 0.24.0 → 0.25.0
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/dist/cli.js +124 -2
- package/dist/cli.js.map +1 -1
- package/package.json +2 -1
package/dist/cli.js
CHANGED
|
@@ -23,9 +23,11 @@ import { ApplicationAutoScalingClient, DescribeScalingPoliciesCommand } from "@a
|
|
|
23
23
|
import { AppSyncClient, DeleteApiKeyCommand, ListApiKeysCommand, ListDataSourcesCommand, ListFunctionsCommand, ListResolversCommand, ListTypesCommand } from "@aws-sdk/client-appsync";
|
|
24
24
|
import { ApiGatewayV2Client, DeleteAccessLogSettingsCommand, DeleteRouteSettingsCommand, GetAuthorizersCommand as GetAuthorizersCommand$1, GetIntegrationsCommand, GetRoutesCommand, GetStagesCommand as GetStagesCommand$1, UpdateStageCommand } from "@aws-sdk/client-apigatewayv2";
|
|
25
25
|
import { AutoScalingClient, DescribeLifecycleHooksCommand, DescribeScheduledActionsCommand } from "@aws-sdk/client-auto-scaling";
|
|
26
|
+
import { CodeDeployClient, ListDeploymentGroupsCommand } from "@aws-sdk/client-codedeploy";
|
|
26
27
|
import { CloudWatchLogsClient, DescribeMetricFiltersCommand, DescribeSubscriptionFiltersCommand, PutBearerTokenAuthenticationCommand, PutMetricFilterCommand } from "@aws-sdk/client-cloudwatch-logs";
|
|
27
28
|
import { CognitoIdentityProviderClient, DescribeUserPoolCommand, ListGroupsCommand, ListIdentityProvidersCommand, ListResourceServersCommand, ListUserPoolClientsCommand } from "@aws-sdk/client-cognito-identity-provider";
|
|
28
29
|
import { DescribeMountTargetsCommand, EFSClient } from "@aws-sdk/client-efs";
|
|
30
|
+
import { DescribeApplicationVersionsCommand, DescribeApplicationsCommand, DescribeConfigurationSettingsCommand, ElasticBeanstalkClient, UpdateApplicationCommand, UpdateApplicationResourceLifecycleCommand, UpdateEnvironmentCommand } from "@aws-sdk/client-elastic-beanstalk";
|
|
29
31
|
import { DescribeListenerCertificatesCommand, DescribeListenersCommand, DescribeRulesCommand, ElasticLoadBalancingV2Client, GetTrustStoreCaCertificatesBundleCommand, ModifyLoadBalancerAttributesCommand, ModifyTargetGroupAttributesCommand } from "@aws-sdk/client-elastic-load-balancing-v2";
|
|
30
32
|
import { DescribeEventBusCommand, EventBridgeClient, ListRulesCommand, PutPermissionCommand } from "@aws-sdk/client-eventbridge";
|
|
31
33
|
import { GetClassifierCommand, GetConnectionCommand, GetJobCommand, GetSecurityConfigurationCommand, GetTableCommand, GetTablesCommand, GetTagsCommand, GetWorkflowCommand, GlueClient, UpdateClassifierCommand, UpdateConnectionCommand, UpdateJobCommand, UpdateTableCommand, UpdateWorkflowCommand } from "@aws-sdk/client-glue";
|
|
@@ -39,7 +41,6 @@ import { GetTopicAttributesCommand, ListSubscriptionsByTopicCommand, SNSClient,
|
|
|
39
41
|
import { GetQueueAttributesCommand, SQSClient, SetQueueAttributesCommand } from "@aws-sdk/client-sqs";
|
|
40
42
|
import { ACMClient, DescribeCertificateCommand, ListTagsForCertificateCommand } from "@aws-sdk/client-acm";
|
|
41
43
|
import { BudgetsClient, DescribeBudgetCommand, UpdateBudgetCommand } from "@aws-sdk/client-budgets";
|
|
42
|
-
import { DescribeConfigurationSettingsCommand, ElasticBeanstalkClient, UpdateApplicationCommand, UpdateApplicationResourceLifecycleCommand, UpdateEnvironmentCommand } from "@aws-sdk/client-elastic-beanstalk";
|
|
43
44
|
import { CognitoSyncClient, GetCognitoEventsCommand, SetCognitoEventsCommand } from "@aws-sdk/client-cognito-sync";
|
|
44
45
|
import { BatchGetProjectsCommand, BatchGetReportGroupsCommand, CodeBuildClient, UpdateProjectCommand, UpdateReportGroupCommand } from "@aws-sdk/client-codebuild";
|
|
45
46
|
import { DescribeDBClustersCommand as DescribeDBClustersCommand$1, DescribeDBInstancesCommand as DescribeDBInstancesCommand$1, DocDBClient, ListTagsForResourceCommand as ListTagsForResourceCommand$1, ModifyDBClusterCommand, ModifyDBInstanceCommand } from "@aws-sdk/client-docdb";
|
|
@@ -8447,7 +8448,9 @@ const CHILD_ENUMERATORS = {
|
|
|
8447
8448
|
"AWS::EC2::TransitGateway": enumerateTransitGatewayChildren,
|
|
8448
8449
|
"AWS::GuardDuty::Detector": enumerateGuardDutyDetectorChildren,
|
|
8449
8450
|
"AWS::SSM::MaintenanceWindow": enumerateMaintenanceWindowChildren,
|
|
8450
|
-
"AWS::ApplicationAutoScaling::ScalableTarget": enumerateScalableTargetChildren
|
|
8451
|
+
"AWS::ApplicationAutoScaling::ScalableTarget": enumerateScalableTargetChildren,
|
|
8452
|
+
"AWS::CodeDeploy::Application": enumerateCodeDeployApplicationChildren,
|
|
8453
|
+
"AWS::ElasticBeanstalk::Application": enumerateElasticBeanstalkApplicationChildren
|
|
8451
8454
|
};
|
|
8452
8455
|
function normalizeApiPath(p) {
|
|
8453
8456
|
let out = p.startsWith("/") ? p : `/${p}`;
|
|
@@ -11907,6 +11910,125 @@ async function enumerateScalableTargetChildren(ctx) {
|
|
|
11907
11910
|
}))
|
|
11908
11911
|
});
|
|
11909
11912
|
}
|
|
11913
|
+
function diffCodeDeployApplicationChildren(input) {
|
|
11914
|
+
const app = input.applicationName;
|
|
11915
|
+
const declared = new Set(input.declaredGroupNames);
|
|
11916
|
+
const added = [];
|
|
11917
|
+
for (const name of input.liveGroupNames) {
|
|
11918
|
+
if (declared.has(name)) continue;
|
|
11919
|
+
added.push({
|
|
11920
|
+
resourceType: "AWS::CodeDeploy::DeploymentGroup",
|
|
11921
|
+
identifier: `${app}|${name}`,
|
|
11922
|
+
label: name,
|
|
11923
|
+
live: {
|
|
11924
|
+
ApplicationName: app,
|
|
11925
|
+
DeploymentGroupName: name
|
|
11926
|
+
},
|
|
11927
|
+
siblingLookupId: name
|
|
11928
|
+
});
|
|
11929
|
+
}
|
|
11930
|
+
return added;
|
|
11931
|
+
}
|
|
11932
|
+
async function enumerateCodeDeployApplicationChildren(ctx) {
|
|
11933
|
+
const { parent, desired, region } = ctx;
|
|
11934
|
+
const applicationName = parent.physicalId;
|
|
11935
|
+
if (!applicationName) return [];
|
|
11936
|
+
const declaredGroupNames = [];
|
|
11937
|
+
for (const r of desired.resources) {
|
|
11938
|
+
if (r.resourceType !== "AWS::CodeDeploy::DeploymentGroup") continue;
|
|
11939
|
+
if (!parentRefMatches(r.declared.ApplicationName, applicationName)) continue;
|
|
11940
|
+
if (r.physicalId) declaredGroupNames.push(r.physicalId);
|
|
11941
|
+
if (typeof r.declared.DeploymentGroupName === "string") declaredGroupNames.push(r.declared.DeploymentGroupName);
|
|
11942
|
+
}
|
|
11943
|
+
const client = new CodeDeployClient({
|
|
11944
|
+
region,
|
|
11945
|
+
...READ_RETRY
|
|
11946
|
+
});
|
|
11947
|
+
const liveGroupNames = [];
|
|
11948
|
+
let token;
|
|
11949
|
+
do {
|
|
11950
|
+
const r = await client.send(new ListDeploymentGroupsCommand({
|
|
11951
|
+
applicationName,
|
|
11952
|
+
nextToken: token
|
|
11953
|
+
}));
|
|
11954
|
+
liveGroupNames.push(...r.deploymentGroups ?? []);
|
|
11955
|
+
token = r.nextToken;
|
|
11956
|
+
} while (token);
|
|
11957
|
+
return diffCodeDeployApplicationChildren({
|
|
11958
|
+
applicationName,
|
|
11959
|
+
declaredGroupNames,
|
|
11960
|
+
liveGroupNames
|
|
11961
|
+
});
|
|
11962
|
+
}
|
|
11963
|
+
function diffElasticBeanstalkApplicationChildren(input) {
|
|
11964
|
+
const app = input.applicationName;
|
|
11965
|
+
const added = [];
|
|
11966
|
+
const declaredVersions = new Set(input.declaredVersionLabels);
|
|
11967
|
+
for (const label of input.liveVersionLabels) {
|
|
11968
|
+
if (declaredVersions.has(label)) continue;
|
|
11969
|
+
added.push({
|
|
11970
|
+
resourceType: "AWS::ElasticBeanstalk::ApplicationVersion",
|
|
11971
|
+
identifier: `${app}|${label}`,
|
|
11972
|
+
label,
|
|
11973
|
+
live: {
|
|
11974
|
+
ApplicationName: app,
|
|
11975
|
+
Id: label
|
|
11976
|
+
},
|
|
11977
|
+
siblingLookupId: label
|
|
11978
|
+
});
|
|
11979
|
+
}
|
|
11980
|
+
const declaredTemplates = new Set(input.declaredTemplateNames);
|
|
11981
|
+
for (const name of input.liveTemplateNames) {
|
|
11982
|
+
if (declaredTemplates.has(name)) continue;
|
|
11983
|
+
added.push({
|
|
11984
|
+
resourceType: "AWS::ElasticBeanstalk::ConfigurationTemplate",
|
|
11985
|
+
identifier: `${app}|${name}`,
|
|
11986
|
+
label: name,
|
|
11987
|
+
live: {
|
|
11988
|
+
ApplicationName: app,
|
|
11989
|
+
TemplateName: name
|
|
11990
|
+
},
|
|
11991
|
+
siblingLookupId: name
|
|
11992
|
+
});
|
|
11993
|
+
}
|
|
11994
|
+
return added;
|
|
11995
|
+
}
|
|
11996
|
+
async function enumerateElasticBeanstalkApplicationChildren(ctx) {
|
|
11997
|
+
const { parent, desired, region } = ctx;
|
|
11998
|
+
const applicationName = parent.physicalId;
|
|
11999
|
+
if (!applicationName) return [];
|
|
12000
|
+
const declaredIdsOf = (type) => {
|
|
12001
|
+
const out = [];
|
|
12002
|
+
for (const r of desired.resources) {
|
|
12003
|
+
if (r.resourceType !== type) continue;
|
|
12004
|
+
if (!parentRefMatches(r.declared.ApplicationName, applicationName)) continue;
|
|
12005
|
+
if (r.physicalId) out.push(r.physicalId);
|
|
12006
|
+
}
|
|
12007
|
+
return out;
|
|
12008
|
+
};
|
|
12009
|
+
const client = new ElasticBeanstalkClient({
|
|
12010
|
+
region,
|
|
12011
|
+
...READ_RETRY
|
|
12012
|
+
});
|
|
12013
|
+
const liveVersions = [];
|
|
12014
|
+
let token;
|
|
12015
|
+
do {
|
|
12016
|
+
const r = await client.send(new DescribeApplicationVersionsCommand({
|
|
12017
|
+
ApplicationName: applicationName,
|
|
12018
|
+
NextToken: token
|
|
12019
|
+
}));
|
|
12020
|
+
liveVersions.push(...r.ApplicationVersions ?? []);
|
|
12021
|
+
token = r.NextToken;
|
|
12022
|
+
} while (token);
|
|
12023
|
+
const liveTemplateNames = (await client.send(new DescribeApplicationsCommand({ ApplicationNames: [applicationName] }))).Applications?.[0]?.ConfigurationTemplates ?? [];
|
|
12024
|
+
return diffElasticBeanstalkApplicationChildren({
|
|
12025
|
+
applicationName,
|
|
12026
|
+
declaredVersionLabels: declaredIdsOf("AWS::ElasticBeanstalk::ApplicationVersion"),
|
|
12027
|
+
declaredTemplateNames: declaredIdsOf("AWS::ElasticBeanstalk::ConfigurationTemplate"),
|
|
12028
|
+
liveVersionLabels: liveVersions.map((v) => v.VersionLabel).filter((l) => typeof l === "string"),
|
|
12029
|
+
liveTemplateNames
|
|
12030
|
+
});
|
|
12031
|
+
}
|
|
11910
12032
|
|
|
11911
12033
|
//#endregion
|
|
11912
12034
|
//#region src/read/pem.ts
|