cdk-real-drift 0.4.14 → 0.4.15
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 +195 -48
- package/dist/cli.js.map +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -5615,9 +5615,15 @@ function classifyResource(resource, liveRaw, schema, opts = {}) {
|
|
|
5615
5615
|
|
|
5616
5616
|
//#endregion
|
|
5617
5617
|
//#region src/read/client-config.ts
|
|
5618
|
+
const CLIENT_TIMEOUTS = { requestHandler: {
|
|
5619
|
+
connectionTimeout: 6e3,
|
|
5620
|
+
requestTimeout: 6e4,
|
|
5621
|
+
throwOnRequestTimeout: true
|
|
5622
|
+
} };
|
|
5618
5623
|
const READ_RETRY = {
|
|
5619
5624
|
maxAttempts: 10,
|
|
5620
|
-
retryMode: "adaptive"
|
|
5625
|
+
retryMode: "adaptive",
|
|
5626
|
+
...CLIENT_TIMEOUTS
|
|
5621
5627
|
};
|
|
5622
5628
|
|
|
5623
5629
|
//#endregion
|
|
@@ -10626,7 +10632,10 @@ const writeS3BucketPolicy = async (ctx, ops) => {
|
|
|
10626
10632
|
const bucket = str(ctx.declared["Bucket"]);
|
|
10627
10633
|
if (!bucket) throw new Error("cannot resolve bucket for revert");
|
|
10628
10634
|
const desired = policyJson(await desiredModel("AWS::S3::BucketPolicy", ctx, ops));
|
|
10629
|
-
const c = new S3Client({
|
|
10635
|
+
const c = new S3Client({
|
|
10636
|
+
region: ctx.region,
|
|
10637
|
+
...CLIENT_TIMEOUTS
|
|
10638
|
+
});
|
|
10630
10639
|
if (desired === void 0) await c.send(new DeleteBucketPolicyCommand({ Bucket: bucket }));
|
|
10631
10640
|
else await c.send(new PutBucketPolicyCommand({
|
|
10632
10641
|
Bucket: bucket,
|
|
@@ -10637,7 +10646,10 @@ const writeSnsTopicPolicy = async (ctx, ops) => {
|
|
|
10637
10646
|
const topics = strList(ctx.declared["Topics"]);
|
|
10638
10647
|
if (topics.length === 0) throw new Error("cannot resolve topic for revert");
|
|
10639
10648
|
const desired = policyJson(await desiredModel("AWS::SNS::TopicPolicy", ctx, ops)) ?? "";
|
|
10640
|
-
const c = new SNSClient({
|
|
10649
|
+
const c = new SNSClient({
|
|
10650
|
+
region: ctx.region,
|
|
10651
|
+
...CLIENT_TIMEOUTS
|
|
10652
|
+
});
|
|
10641
10653
|
for (const topic of topics) await c.send(new SetTopicAttributesCommand({
|
|
10642
10654
|
TopicArn: topic,
|
|
10643
10655
|
AttributeName: "Policy",
|
|
@@ -10648,7 +10660,10 @@ const writeSqsQueuePolicy = async (ctx, ops) => {
|
|
|
10648
10660
|
const queues = strList(ctx.declared["Queues"]);
|
|
10649
10661
|
if (queues.length === 0) throw new Error("cannot resolve queue for revert");
|
|
10650
10662
|
const desired = policyJson(await desiredModel("AWS::SQS::QueuePolicy", ctx, ops)) ?? "";
|
|
10651
|
-
const c = new SQSClient({
|
|
10663
|
+
const c = new SQSClient({
|
|
10664
|
+
region: ctx.region,
|
|
10665
|
+
...CLIENT_TIMEOUTS
|
|
10666
|
+
});
|
|
10652
10667
|
for (const queue of queues) await c.send(new SetQueueAttributesCommand({
|
|
10653
10668
|
QueueUrl: queue,
|
|
10654
10669
|
Attributes: { Policy: desired }
|
|
@@ -10658,7 +10673,10 @@ const writeEventBusPolicy = async (ctx) => {
|
|
|
10658
10673
|
const eventBusName = str(ctx.declared["EventBusName"]) ?? "default";
|
|
10659
10674
|
const statementId = str(ctx.declared["StatementId"]);
|
|
10660
10675
|
if (!statementId) throw new Error("cannot resolve StatementId for EventBusPolicy revert");
|
|
10661
|
-
const c = new EventBridgeClient({
|
|
10676
|
+
const c = new EventBridgeClient({
|
|
10677
|
+
region: ctx.region,
|
|
10678
|
+
...CLIENT_TIMEOUTS
|
|
10679
|
+
});
|
|
10662
10680
|
const declaredStmt = ctx.declared["Statement"];
|
|
10663
10681
|
let desiredStatement;
|
|
10664
10682
|
if (declaredStmt && typeof declaredStmt === "object" && !Array.isArray(declaredStmt)) desiredStatement = {
|
|
@@ -10701,7 +10719,10 @@ const writeIamPolicy = async (ctx, ops) => {
|
|
|
10701
10719
|
if (!name) throw new Error("cannot resolve policy name for revert");
|
|
10702
10720
|
const desired = policyJson(await desiredModel("AWS::IAM::Policy", ctx, ops));
|
|
10703
10721
|
if (desired === void 0) throw new Error("cannot revert an IAM inline policy to absent");
|
|
10704
|
-
const c = new IAMClient({
|
|
10722
|
+
const c = new IAMClient({
|
|
10723
|
+
region: ctx.region,
|
|
10724
|
+
...CLIENT_TIMEOUTS
|
|
10725
|
+
});
|
|
10705
10726
|
const roles = strList(ctx.declared["Roles"]);
|
|
10706
10727
|
const users = strList(ctx.declared["Users"]);
|
|
10707
10728
|
const groups = strList(ctx.declared["Groups"]);
|
|
@@ -10750,7 +10771,10 @@ const parseAttachmentOp = (o) => {
|
|
|
10750
10771
|
const writeIamManagedPolicy = async (ctx, ops) => {
|
|
10751
10772
|
const arn = isArn(ctx.physicalId) ?? isArn(ctx.declared["ManagedPolicyArn"]);
|
|
10752
10773
|
if (!arn) throw new Error("cannot resolve managed policy arn for revert");
|
|
10753
|
-
const c = new IAMClient({
|
|
10774
|
+
const c = new IAMClient({
|
|
10775
|
+
region: ctx.region,
|
|
10776
|
+
...CLIENT_TIMEOUTS
|
|
10777
|
+
});
|
|
10754
10778
|
for (const o of ops) {
|
|
10755
10779
|
const parsed = parseAttachmentOp(o);
|
|
10756
10780
|
if (!parsed) continue;
|
|
@@ -10800,7 +10824,10 @@ const asInlinePolicies = (v) => Array.isArray(v) ? v.filter((p) => !!p && typeof
|
|
|
10800
10824
|
const writeIamRoleInlinePolicies = async (ctx, ops) => {
|
|
10801
10825
|
const role = str(ctx.physicalId);
|
|
10802
10826
|
if (!role) throw new Error("cannot resolve role name for revert");
|
|
10803
|
-
const c = new IAMClient({
|
|
10827
|
+
const c = new IAMClient({
|
|
10828
|
+
region: ctx.region,
|
|
10829
|
+
...CLIENT_TIMEOUTS
|
|
10830
|
+
});
|
|
10804
10831
|
for (const op of ops) {
|
|
10805
10832
|
if (op.path !== "/Policies") throw new Error(`unsupported inline-policy revert path: ${op.path}`);
|
|
10806
10833
|
const desired = op.op === "add" ? asInlinePolicies(op.value) : [];
|
|
@@ -10825,7 +10852,10 @@ const writeElbLoadBalancerAttributes = async (ctx, ops) => {
|
|
|
10825
10852
|
if (!arn) throw new Error("cannot resolve load balancer arn for revert");
|
|
10826
10853
|
const attrs = elbAttributeOps(ops);
|
|
10827
10854
|
if (attrs.length === 0) return;
|
|
10828
|
-
await new ElasticLoadBalancingV2Client({
|
|
10855
|
+
await new ElasticLoadBalancingV2Client({
|
|
10856
|
+
region: ctx.region,
|
|
10857
|
+
...CLIENT_TIMEOUTS
|
|
10858
|
+
}).send(new ModifyLoadBalancerAttributesCommand({
|
|
10829
10859
|
LoadBalancerArn: arn,
|
|
10830
10860
|
Attributes: attrs
|
|
10831
10861
|
}));
|
|
@@ -10835,7 +10865,10 @@ const writeElbTargetGroupAttributes = async (ctx, ops) => {
|
|
|
10835
10865
|
if (!arn) throw new Error("cannot resolve target group arn for revert");
|
|
10836
10866
|
const attrs = elbAttributeOps(ops);
|
|
10837
10867
|
if (attrs.length === 0) return;
|
|
10838
|
-
await new ElasticLoadBalancingV2Client({
|
|
10868
|
+
await new ElasticLoadBalancingV2Client({
|
|
10869
|
+
region: ctx.region,
|
|
10870
|
+
...CLIENT_TIMEOUTS
|
|
10871
|
+
}).send(new ModifyTargetGroupAttributesCommand({
|
|
10839
10872
|
TargetGroupArn: arn,
|
|
10840
10873
|
Attributes: attrs
|
|
10841
10874
|
}));
|
|
@@ -10844,7 +10877,10 @@ const writeServiceDiscoveryHttpNamespace = async (ctx, ops) => {
|
|
|
10844
10877
|
const id = str(ctx.physicalId);
|
|
10845
10878
|
if (!id) throw new Error("cannot resolve namespace id for revert");
|
|
10846
10879
|
const m = await desiredModel("AWS::ServiceDiscovery::HttpNamespace", ctx, ops);
|
|
10847
|
-
await new ServiceDiscoveryClient({
|
|
10880
|
+
await new ServiceDiscoveryClient({
|
|
10881
|
+
region: ctx.region,
|
|
10882
|
+
...CLIENT_TIMEOUTS
|
|
10883
|
+
}).send(new UpdateHttpNamespaceCommand({
|
|
10848
10884
|
Id: id,
|
|
10849
10885
|
Namespace: { Description: str(m.Description) ?? "" }
|
|
10850
10886
|
}));
|
|
@@ -10874,7 +10910,10 @@ const writeDocDbCluster = async (ctx, ops) => {
|
|
|
10874
10910
|
any = true;
|
|
10875
10911
|
}
|
|
10876
10912
|
if (!any) return;
|
|
10877
|
-
await new DocDBClient({
|
|
10913
|
+
await new DocDBClient({
|
|
10914
|
+
region: ctx.region,
|
|
10915
|
+
...CLIENT_TIMEOUTS
|
|
10916
|
+
}).send(new ModifyDBClusterCommand(input));
|
|
10878
10917
|
};
|
|
10879
10918
|
const DOCDB_INSTANCE_MODIFY_PARAMS = new Set([
|
|
10880
10919
|
"DBInstanceClass",
|
|
@@ -10900,12 +10939,18 @@ const writeDocDbInstance = async (ctx, ops) => {
|
|
|
10900
10939
|
any = true;
|
|
10901
10940
|
}
|
|
10902
10941
|
if (!any) return;
|
|
10903
|
-
await new DocDBClient({
|
|
10942
|
+
await new DocDBClient({
|
|
10943
|
+
region: ctx.region,
|
|
10944
|
+
...CLIENT_TIMEOUTS
|
|
10945
|
+
}).send(new ModifyDBInstanceCommand(input));
|
|
10904
10946
|
};
|
|
10905
10947
|
const writeCloudFrontDistribution = async (ctx, ops) => {
|
|
10906
10948
|
const id = str(ctx.physicalId);
|
|
10907
10949
|
if (!id) throw new Error("cannot resolve distribution id for revert");
|
|
10908
|
-
const c = new CloudFrontClient({
|
|
10950
|
+
const c = new CloudFrontClient({
|
|
10951
|
+
region: ctx.region,
|
|
10952
|
+
...CLIENT_TIMEOUTS
|
|
10953
|
+
});
|
|
10909
10954
|
const cur = await c.send(new GetDistributionConfigCommand({ Id: id }));
|
|
10910
10955
|
if (!cur.DistributionConfig || !cur.ETag) throw new Error("could not read current distribution config for revert");
|
|
10911
10956
|
const reverted = applyOps({ DistributionConfig: cur.DistributionConfig }, ops);
|
|
@@ -10930,7 +10975,10 @@ const WAF_UPDATABLE_PASSTHROUGH = [
|
|
|
10930
10975
|
const writeWafv2WebAcl = async (ctx, ops) => {
|
|
10931
10976
|
const [name, id, scope] = (str(ctx.physicalId) ?? "").split("|");
|
|
10932
10977
|
if (!name || !id || !scope) throw new Error("cannot resolve WebACL Name|Id|Scope for revert");
|
|
10933
|
-
const c = new WAFV2Client({
|
|
10978
|
+
const c = new WAFV2Client({
|
|
10979
|
+
region: ctx.region,
|
|
10980
|
+
...CLIENT_TIMEOUTS
|
|
10981
|
+
});
|
|
10934
10982
|
const cur = await c.send(new GetWebACLCommand({
|
|
10935
10983
|
Name: name,
|
|
10936
10984
|
Id: id,
|
|
@@ -10976,7 +11024,10 @@ const GLUE_JOB_UPDATE_FIELDS = [
|
|
|
10976
11024
|
const writeGlueJob = async (ctx, ops) => {
|
|
10977
11025
|
const name = str(ctx.physicalId) ?? str(ctx.declared["Name"]);
|
|
10978
11026
|
if (!name) throw new Error("cannot resolve Glue job name for revert");
|
|
10979
|
-
const c = new GlueClient({
|
|
11027
|
+
const c = new GlueClient({
|
|
11028
|
+
region: ctx.region,
|
|
11029
|
+
...CLIENT_TIMEOUTS
|
|
11030
|
+
});
|
|
10980
11031
|
const got = await c.send(new GetJobCommand({ JobName: name }));
|
|
10981
11032
|
if (!got.Job) throw new Error("could not read current Glue job for revert");
|
|
10982
11033
|
const m = applyOps(got.Job, ops);
|
|
@@ -10997,7 +11048,10 @@ const writeGlueTable = async (ctx, ops) => {
|
|
|
10997
11048
|
const tableInput = m.TableInput;
|
|
10998
11049
|
if (!dbName || !tableInput || !str(tableInput.Name)) throw new Error("cannot resolve Glue table target for revert");
|
|
10999
11050
|
const catalogId = str(m.CatalogId) ?? str(ctx.declared["CatalogId"]);
|
|
11000
|
-
await new GlueClient({
|
|
11051
|
+
await new GlueClient({
|
|
11052
|
+
region: ctx.region,
|
|
11053
|
+
...CLIENT_TIMEOUTS
|
|
11054
|
+
}).send(new UpdateTableCommand({
|
|
11001
11055
|
DatabaseName: dbName,
|
|
11002
11056
|
TableInput: tableInput,
|
|
11003
11057
|
...catalogId && { CatalogId: catalogId }
|
|
@@ -11019,7 +11073,10 @@ const writeGlueClassifier = async (ctx, ops) => {
|
|
|
11019
11073
|
}
|
|
11020
11074
|
}
|
|
11021
11075
|
if (Object.keys(input).length === 0) throw new Error("cannot resolve Glue classifier target for revert");
|
|
11022
|
-
await new GlueClient({
|
|
11076
|
+
await new GlueClient({
|
|
11077
|
+
region: ctx.region,
|
|
11078
|
+
...CLIENT_TIMEOUTS
|
|
11079
|
+
}).send(new UpdateClassifierCommand(input));
|
|
11023
11080
|
};
|
|
11024
11081
|
const writeGlueWorkflow = async (ctx, ops) => {
|
|
11025
11082
|
const m = await desiredModel("AWS::Glue::Workflow", ctx, ops);
|
|
@@ -11033,7 +11090,10 @@ const writeGlueWorkflow = async (ctx, ops) => {
|
|
|
11033
11090
|
if (m.DefaultRunProperties !== void 0) input.DefaultRunProperties = m.DefaultRunProperties;
|
|
11034
11091
|
else if (removed("DefaultRunProperties")) input.DefaultRunProperties = {};
|
|
11035
11092
|
if (m.MaxConcurrentRuns !== void 0) input.MaxConcurrentRuns = Number(m.MaxConcurrentRuns);
|
|
11036
|
-
await new GlueClient({
|
|
11093
|
+
await new GlueClient({
|
|
11094
|
+
region: ctx.region,
|
|
11095
|
+
...CLIENT_TIMEOUTS
|
|
11096
|
+
}).send(new UpdateWorkflowCommand(input));
|
|
11037
11097
|
};
|
|
11038
11098
|
const GLUE_CONNECTION_PASSWORD_KEY = /PASSWORD/i;
|
|
11039
11099
|
const writeGlueConnection = async (ctx, ops) => {
|
|
@@ -11045,7 +11105,10 @@ const writeGlueConnection = async (ctx, ops) => {
|
|
|
11045
11105
|
const name = str(ci?.Name) ?? str(ctx.physicalId) ?? str(declInput?.Name);
|
|
11046
11106
|
if (!ci || !name) throw new Error("cannot resolve Glue connection target for revert");
|
|
11047
11107
|
const catalogId = str(m.CatalogId) ?? str(ctx.declared["CatalogId"]);
|
|
11048
|
-
await new GlueClient({
|
|
11108
|
+
await new GlueClient({
|
|
11109
|
+
region: ctx.region,
|
|
11110
|
+
...CLIENT_TIMEOUTS
|
|
11111
|
+
}).send(new UpdateConnectionCommand({
|
|
11049
11112
|
Name: name,
|
|
11050
11113
|
...catalogId && { CatalogId: catalogId },
|
|
11051
11114
|
ConnectionInput: {
|
|
@@ -11060,7 +11123,10 @@ const writeSesReceiptRule = async (ctx, ops) => {
|
|
|
11060
11123
|
const ruleSetName = str(m.RuleSetName) ?? str(ctx.declared["RuleSetName"]);
|
|
11061
11124
|
const rule = m.Rule;
|
|
11062
11125
|
if (!ruleSetName || !rule || !str(rule.Name)) throw new Error("cannot resolve SES receipt rule target for revert");
|
|
11063
|
-
await new SESClient({
|
|
11126
|
+
await new SESClient({
|
|
11127
|
+
region: ctx.region,
|
|
11128
|
+
...CLIENT_TIMEOUTS
|
|
11129
|
+
}).send(new UpdateReceiptRuleCommand({
|
|
11064
11130
|
RuleSetName: ruleSetName,
|
|
11065
11131
|
Rule: rule
|
|
11066
11132
|
}));
|
|
@@ -11080,7 +11146,10 @@ const writeCloudWatchAnomalyDetector = async (ctx, ops) => {
|
|
|
11080
11146
|
EndTime: toDate(r.EndTime)
|
|
11081
11147
|
})) }
|
|
11082
11148
|
};
|
|
11083
|
-
await new CloudWatchClient({
|
|
11149
|
+
await new CloudWatchClient({
|
|
11150
|
+
region: ctx.region,
|
|
11151
|
+
...CLIENT_TIMEOUTS
|
|
11152
|
+
}).send(new PutAnomalyDetectorCommand({
|
|
11084
11153
|
...single && { SingleMetricAnomalyDetector: single },
|
|
11085
11154
|
...math && { MetricMathAnomalyDetector: math },
|
|
11086
11155
|
...!single && !math && { SingleMetricAnomalyDetector: {
|
|
@@ -11099,7 +11168,10 @@ const writeDlmLifecyclePolicy = async (ctx, ops) => {
|
|
|
11099
11168
|
const top = o.path.replace(/^\//, "").split("/")[0] ?? "";
|
|
11100
11169
|
if (o.op === "remove" && (top === "State" || top === "Description" || top === "ExecutionRoleArn")) throw new Error(`DLM LifecyclePolicy ${top} cannot be cleared via UpdateLifecyclePolicy (no safe clearing value; needs live confirmation); update it manually`);
|
|
11101
11170
|
}
|
|
11102
|
-
const c = new DLMClient({
|
|
11171
|
+
const c = new DLMClient({
|
|
11172
|
+
region: ctx.region,
|
|
11173
|
+
...CLIENT_TIMEOUTS
|
|
11174
|
+
});
|
|
11103
11175
|
const m = await desiredModel("AWS::DLM::LifecyclePolicy", ctx, ops);
|
|
11104
11176
|
let details = m.PolicyDetails;
|
|
11105
11177
|
if (details === void 0 && DLM_DEFAULT_POLICY_SHORTHAND.some((k) => m[k] !== void 0)) {
|
|
@@ -11127,7 +11199,10 @@ const writeMetricFilter = async (ctx, ops) => {
|
|
|
11127
11199
|
...t.Unit !== void 0 && { unit: t.Unit },
|
|
11128
11200
|
...t.Dimensions !== void 0 && { dimensions: t.Dimensions }
|
|
11129
11201
|
}));
|
|
11130
|
-
await new CloudWatchLogsClient({
|
|
11202
|
+
await new CloudWatchLogsClient({
|
|
11203
|
+
region: ctx.region,
|
|
11204
|
+
...CLIENT_TIMEOUTS
|
|
11205
|
+
}).send(new PutMetricFilterCommand({
|
|
11131
11206
|
logGroupName: logGroup,
|
|
11132
11207
|
filterName,
|
|
11133
11208
|
filterPattern: str(m.FilterPattern) ?? "",
|
|
@@ -11160,7 +11235,10 @@ const writeRoute53RecordSet = async (ctx, ops) => {
|
|
|
11160
11235
|
if (Array.isArray(m.ResourceRecords)) rrset.ResourceRecords = m.ResourceRecords.map((v) => ({ Value: v }));
|
|
11161
11236
|
if (m.AliasTarget !== void 0) rrset.AliasTarget = m.AliasTarget;
|
|
11162
11237
|
for (const k of RR_ROUTING_FIELDS) if (m[k] !== void 0) rrset[k] = m[k];
|
|
11163
|
-
await new Route53Client({
|
|
11238
|
+
await new Route53Client({
|
|
11239
|
+
region: ctx.region,
|
|
11240
|
+
...CLIENT_TIMEOUTS
|
|
11241
|
+
}).send(new ChangeResourceRecordSetsCommand({
|
|
11164
11242
|
HostedZoneId: zone,
|
|
11165
11243
|
ChangeBatch: { Changes: [{
|
|
11166
11244
|
Action: "UPSERT",
|
|
@@ -11188,7 +11266,10 @@ const writeConfigRuleInputParameters = async (ctx, ops) => {
|
|
|
11188
11266
|
const op = ops.find((o) => o.path === "/InputParameters");
|
|
11189
11267
|
if (!op) throw new Error("Config rule InputParameters revert: op not found");
|
|
11190
11268
|
if (op.op !== "add") throw new Error("Config rule InputParameters cannot be cleared via revert: PutConfigRule re-PUTs the whole rule and the exact clearing payload (omit vs empty {}) needs live confirmation; clear it manually");
|
|
11191
|
-
const client = new ConfigServiceClient({
|
|
11269
|
+
const client = new ConfigServiceClient({
|
|
11270
|
+
region: ctx.region,
|
|
11271
|
+
...CLIENT_TIMEOUTS
|
|
11272
|
+
});
|
|
11192
11273
|
const rule = (await client.send(new DescribeConfigRulesCommand({ ConfigRuleNames: [name] }))).ConfigRules?.[0];
|
|
11193
11274
|
if (!rule) throw new Error(`Config rule not found for revert: ${name}`);
|
|
11194
11275
|
const { ConfigRuleArn, ConfigRuleId, ConfigRuleState, CreatedBy, RuleEvaluationVisibility, ...rest } = rule;
|
|
@@ -11219,7 +11300,10 @@ const writeOpenSearchDomain = async (ctx, ops) => {
|
|
|
11219
11300
|
const name = str(ctx.physicalId) ?? str(ctx.declared["DomainName"]);
|
|
11220
11301
|
if (!name) throw new Error("cannot resolve OpenSearch domain name for revert");
|
|
11221
11302
|
const touched = new Set(ops.map((o) => o.path.replace(/^\//, "").split("/")[0]).filter((p) => !!p));
|
|
11222
|
-
const c = new OpenSearchClient({
|
|
11303
|
+
const c = new OpenSearchClient({
|
|
11304
|
+
region: ctx.region,
|
|
11305
|
+
...CLIENT_TIMEOUTS
|
|
11306
|
+
});
|
|
11223
11307
|
const cfg = (await c.send(new DescribeDomainConfigCommand({ DomainName: name }))).DomainConfig;
|
|
11224
11308
|
const model = {};
|
|
11225
11309
|
for (const p of touched) if (cfg?.[p]?.Options !== void 0) model[p] = cfg[p].Options;
|
|
@@ -11237,7 +11321,10 @@ const writeOpenSearchDomain = async (ctx, ops) => {
|
|
|
11237
11321
|
const writeLogGroupBearerTokenAuth = async (ctx, ops) => {
|
|
11238
11322
|
const lg = str(ctx.physicalId) ?? str(ctx.declared["LogGroupName"]);
|
|
11239
11323
|
if (!lg) throw new Error("cannot resolve log group name for revert");
|
|
11240
|
-
const c = new CloudWatchLogsClient({
|
|
11324
|
+
const c = new CloudWatchLogsClient({
|
|
11325
|
+
region: ctx.region,
|
|
11326
|
+
...CLIENT_TIMEOUTS
|
|
11327
|
+
});
|
|
11241
11328
|
for (const op of ops) {
|
|
11242
11329
|
const enabled = op.op === "add" ? op.value === true : false;
|
|
11243
11330
|
await c.send(new PutBearerTokenAuthenticationCommand({
|
|
@@ -11249,7 +11336,10 @@ const writeLogGroupBearerTokenAuth = async (ctx, ops) => {
|
|
|
11249
11336
|
const writeCognitoIdentityPoolEvents = async (ctx, ops) => {
|
|
11250
11337
|
const id = str(ctx.physicalId) ?? str(ctx.declared["Id"]);
|
|
11251
11338
|
if (!id) throw new Error("cannot resolve identity pool id for CognitoEvents revert");
|
|
11252
|
-
const c = new CognitoSyncClient({
|
|
11339
|
+
const c = new CognitoSyncClient({
|
|
11340
|
+
region: ctx.region,
|
|
11341
|
+
...CLIENT_TIMEOUTS
|
|
11342
|
+
});
|
|
11253
11343
|
const cur = (await c.send(new GetCognitoEventsCommand({ IdentityPoolId: id }))).Events ?? {};
|
|
11254
11344
|
const events = { ...applyOps({ CognitoEvents: { ...cur } }, ops).CognitoEvents ?? {} };
|
|
11255
11345
|
for (const k of Object.keys(cur)) if (!(k in events)) events[k] = "";
|
|
@@ -11332,7 +11422,10 @@ const writeApiGatewayMethod = async (ctx, ops) => {
|
|
|
11332
11422
|
for (const op of ops) for (const p of apigwKnobPatches(op)) if (p.kind === "integration") integrationPatches.push(p.patch);
|
|
11333
11423
|
else if (p.kind === "integrationResponse") pushByKey(integrationRespPatches, p.statusCode, p.patch);
|
|
11334
11424
|
else pushByKey(methodRespPatches, p.statusCode, p.patch);
|
|
11335
|
-
const c = new APIGatewayClient({
|
|
11425
|
+
const c = new APIGatewayClient({
|
|
11426
|
+
region: ctx.region,
|
|
11427
|
+
...CLIENT_TIMEOUTS
|
|
11428
|
+
});
|
|
11336
11429
|
if (integrationPatches.length > 0) await c.send(new UpdateIntegrationCommand({
|
|
11337
11430
|
restApiId,
|
|
11338
11431
|
resourceId,
|
|
@@ -11379,14 +11472,20 @@ const writeEcsServiceWriteOnlyProps = async (ctx, ops) => {
|
|
|
11379
11472
|
const declared = ctx.declared["VolumeConfigurations"];
|
|
11380
11473
|
input.volumeConfigurations = Array.isArray(declared) ? camelKeysDeep(declared) : [];
|
|
11381
11474
|
}
|
|
11382
|
-
await new ECSClient({
|
|
11475
|
+
await new ECSClient({
|
|
11476
|
+
region: ctx.region,
|
|
11477
|
+
...CLIENT_TIMEOUTS
|
|
11478
|
+
}).send(new UpdateServiceCommand(input));
|
|
11383
11479
|
};
|
|
11384
11480
|
const writeMskConfiguration = async (ctx, ops) => {
|
|
11385
11481
|
const arn = str(ctx.physicalId);
|
|
11386
11482
|
if (!arn) throw new Error("cannot resolve MSK Configuration ARN for revert");
|
|
11387
11483
|
const op = ops.find((o) => o.path === "/ServerProperties");
|
|
11388
11484
|
if (op === void 0 || op.op === "remove" || typeof op.value !== "string") throw new Error("MSK Configuration ServerProperties revert: unexpected op");
|
|
11389
|
-
await new KafkaClient({
|
|
11485
|
+
await new KafkaClient({
|
|
11486
|
+
region: ctx.region,
|
|
11487
|
+
...CLIENT_TIMEOUTS
|
|
11488
|
+
}).send(new UpdateConfigurationCommand({
|
|
11390
11489
|
Arn: arn,
|
|
11391
11490
|
ServerProperties: new TextEncoder().encode(op.value)
|
|
11392
11491
|
}));
|
|
@@ -11415,7 +11514,10 @@ const writeCodeBuildReportGroup = async (ctx, ops) => {
|
|
|
11415
11514
|
key: str(t.Key),
|
|
11416
11515
|
value: str(t.Value)
|
|
11417
11516
|
})) : [];
|
|
11418
|
-
await new CodeBuildClient({
|
|
11517
|
+
await new CodeBuildClient({
|
|
11518
|
+
region: ctx.region,
|
|
11519
|
+
...CLIENT_TIMEOUTS
|
|
11520
|
+
}).send(new UpdateReportGroupCommand(input));
|
|
11419
11521
|
};
|
|
11420
11522
|
const DAX_CLUSTER_MODIFY_PARAMS = {
|
|
11421
11523
|
Description: "Description",
|
|
@@ -11441,7 +11543,10 @@ const writeDaxCluster = async (ctx, ops) => {
|
|
|
11441
11543
|
any = true;
|
|
11442
11544
|
}
|
|
11443
11545
|
if (!any) return;
|
|
11444
|
-
await new DAXClient({
|
|
11546
|
+
await new DAXClient({
|
|
11547
|
+
region: ctx.region,
|
|
11548
|
+
...CLIENT_TIMEOUTS
|
|
11549
|
+
}).send(new UpdateClusterCommand(input));
|
|
11445
11550
|
};
|
|
11446
11551
|
const writeDaxParameterGroup = async (ctx, ops) => {
|
|
11447
11552
|
const name = str(ctx.physicalId) ?? str(ctx.declared["ParameterGroupName"]);
|
|
@@ -11459,7 +11564,10 @@ const writeDaxParameterGroup = async (ctx, ops) => {
|
|
|
11459
11564
|
ParameterValue: desiredValues[k]
|
|
11460
11565
|
}));
|
|
11461
11566
|
if (values.length === 0) return;
|
|
11462
|
-
await new DAXClient({
|
|
11567
|
+
await new DAXClient({
|
|
11568
|
+
region: ctx.region,
|
|
11569
|
+
...CLIENT_TIMEOUTS
|
|
11570
|
+
}).send(new UpdateParameterGroupCommand({
|
|
11463
11571
|
ParameterGroupName: name,
|
|
11464
11572
|
ParameterNameValues: values
|
|
11465
11573
|
}));
|
|
@@ -11479,7 +11587,10 @@ const writeElastiCacheParameterGroup = async (ctx, ops) => {
|
|
|
11479
11587
|
} else if (key !== void 0) modifyKeys.add(key);
|
|
11480
11588
|
else for (const k of Object.keys(desiredValues)) modifyKeys.add(k);
|
|
11481
11589
|
}
|
|
11482
|
-
const c = new ElastiCacheClient({
|
|
11590
|
+
const c = new ElastiCacheClient({
|
|
11591
|
+
region: ctx.region,
|
|
11592
|
+
...CLIENT_TIMEOUTS
|
|
11593
|
+
});
|
|
11483
11594
|
const modify = [...modifyKeys].filter((k) => typeof desiredValues[k] === "string").map((k) => ({
|
|
11484
11595
|
ParameterName: k,
|
|
11485
11596
|
ParameterValue: desiredValues[k]
|
|
@@ -11510,7 +11621,10 @@ const writeMemoryDbParameterGroup = async (ctx, ops) => {
|
|
|
11510
11621
|
} else if (key !== void 0) modifyKeys.add(key);
|
|
11511
11622
|
else for (const k of Object.keys(desiredValues)) modifyKeys.add(k);
|
|
11512
11623
|
}
|
|
11513
|
-
const c = new MemoryDBClient({
|
|
11624
|
+
const c = new MemoryDBClient({
|
|
11625
|
+
region: ctx.region,
|
|
11626
|
+
...CLIENT_TIMEOUTS
|
|
11627
|
+
});
|
|
11514
11628
|
const modify = [...modifyKeys].filter((k) => typeof desiredValues[k] === "string").map((k) => ({
|
|
11515
11629
|
ParameterName: k,
|
|
11516
11630
|
ParameterValue: desiredValues[k]
|
|
@@ -11574,7 +11688,10 @@ const writeEc2ClientVpnEndpoint = async (ctx, ops) => {
|
|
|
11574
11688
|
} else if (removed("SecurityGroupIds")) throw new Error("EC2 ClientVpnEndpoint SecurityGroupIds cannot be cleared via ModifyClientVpnEndpoint (an endpoint cannot revert to no security group in a selective modify); update it manually");
|
|
11575
11689
|
}
|
|
11576
11690
|
if (!any) return;
|
|
11577
|
-
await new EC2Client({
|
|
11691
|
+
await new EC2Client({
|
|
11692
|
+
region: ctx.region,
|
|
11693
|
+
...CLIENT_TIMEOUTS
|
|
11694
|
+
}).send(new ModifyClientVpnEndpointCommand(input));
|
|
11578
11695
|
};
|
|
11579
11696
|
const LEX_CFN_TO_LEX_RESOLUTION_STRATEGY = {
|
|
11580
11697
|
ORIGINAL_VALUE: "OriginalValue",
|
|
@@ -11612,7 +11729,10 @@ const writeLexBotLocales = async (ctx, ops) => {
|
|
|
11612
11729
|
if (!botId) throw new Error("cannot resolve Lex Bot id for revert");
|
|
11613
11730
|
const declaredLocales = ctx.declared["BotLocales"];
|
|
11614
11731
|
if (!Array.isArray(declaredLocales)) throw new Error("Lex BotLocales revert: declared BotLocales is not an array");
|
|
11615
|
-
const c = new LexModelsV2Client({
|
|
11732
|
+
const c = new LexModelsV2Client({
|
|
11733
|
+
region: ctx.region,
|
|
11734
|
+
...CLIENT_TIMEOUTS
|
|
11735
|
+
});
|
|
11616
11736
|
const botVersion = "DRAFT";
|
|
11617
11737
|
for (const rawLocale of declaredLocales) {
|
|
11618
11738
|
if (!rawLocale || typeof rawLocale !== "object") continue;
|
|
@@ -11914,7 +12034,10 @@ const writeElasticBeanstalkApplication = async (ctx, ops) => {
|
|
|
11914
12034
|
}
|
|
11915
12035
|
}
|
|
11916
12036
|
if (!any) return;
|
|
11917
|
-
await new ElasticBeanstalkClient({
|
|
12037
|
+
await new ElasticBeanstalkClient({
|
|
12038
|
+
region: ctx.region,
|
|
12039
|
+
...CLIENT_TIMEOUTS
|
|
12040
|
+
}).send(new UpdateApplicationCommand(input));
|
|
11918
12041
|
};
|
|
11919
12042
|
const EB_ENVIRONMENT_MODIFY_PARAMS = new Set(["Description"]);
|
|
11920
12043
|
const writeElasticBeanstalkEnvironment = async (ctx, ops) => {
|
|
@@ -11930,7 +12053,10 @@ const writeElasticBeanstalkEnvironment = async (ctx, ops) => {
|
|
|
11930
12053
|
}
|
|
11931
12054
|
}
|
|
11932
12055
|
if (!any) return;
|
|
11933
|
-
await new ElasticBeanstalkClient({
|
|
12056
|
+
await new ElasticBeanstalkClient({
|
|
12057
|
+
region: ctx.region,
|
|
12058
|
+
...CLIENT_TIMEOUTS
|
|
12059
|
+
}).send(new UpdateEnvironmentCommand(input));
|
|
11934
12060
|
};
|
|
11935
12061
|
const KVS_STREAM_RETENTION_DEFAULT = 0;
|
|
11936
12062
|
const KVS_CHANNEL_MESSAGE_TTL_DEFAULT = 60;
|
|
@@ -11942,7 +12068,10 @@ const writeKinesisVideoStreamRetention = async (ctx, ops) => {
|
|
|
11942
12068
|
const op = ops.find((o) => o.path.replace(/^\//, "") === "DataRetentionInHours");
|
|
11943
12069
|
if (!op) return;
|
|
11944
12070
|
const target = op.op === "add" && typeof op.value === "number" ? op.value : KVS_STREAM_RETENTION_DEFAULT;
|
|
11945
|
-
const kv = new KinesisVideoClient({
|
|
12071
|
+
const kv = new KinesisVideoClient({
|
|
12072
|
+
region: ctx.region,
|
|
12073
|
+
...CLIENT_TIMEOUTS
|
|
12074
|
+
});
|
|
11946
12075
|
const desc = await kv.send(new DescribeStreamCommand(kvsStreamRef(id)));
|
|
11947
12076
|
const current = desc.StreamInfo?.DataRetentionInHours ?? 0;
|
|
11948
12077
|
const version = desc.StreamInfo?.Version;
|
|
@@ -11961,7 +12090,10 @@ const writeKinesisVideoSignalingChannel = async (ctx, ops) => {
|
|
|
11961
12090
|
const op = ops.find((o) => o.path.replace(/^\//, "") === "MessageTtlSeconds");
|
|
11962
12091
|
if (!op) return;
|
|
11963
12092
|
const target = op.op === "add" && typeof op.value === "number" ? op.value : KVS_CHANNEL_MESSAGE_TTL_DEFAULT;
|
|
11964
|
-
const kv = new KinesisVideoClient({
|
|
12093
|
+
const kv = new KinesisVideoClient({
|
|
12094
|
+
region: ctx.region,
|
|
12095
|
+
...CLIENT_TIMEOUTS
|
|
12096
|
+
});
|
|
11965
12097
|
const desc = await kv.send(new DescribeSignalingChannelCommand(kvsChannelDescribeRef(id)));
|
|
11966
12098
|
const arn = desc.ChannelInfo?.ChannelARN;
|
|
11967
12099
|
const version = desc.ChannelInfo?.Version;
|
|
@@ -11979,7 +12111,10 @@ const writeKinesisVideoStreamStorage = async (ctx, ops) => {
|
|
|
11979
12111
|
const op = ops.find((o) => o.path.replace(/^\//, "").replace(/\//g, ".").endsWith("DefaultStorageTier"));
|
|
11980
12112
|
if (!op) return;
|
|
11981
12113
|
const target = op.op === "add" && typeof op.value === "string" ? op.value : KVS_STREAM_STORAGE_TIER_DEFAULT;
|
|
11982
|
-
const kv = new KinesisVideoClient({
|
|
12114
|
+
const kv = new KinesisVideoClient({
|
|
12115
|
+
region: ctx.region,
|
|
12116
|
+
...CLIENT_TIMEOUTS
|
|
12117
|
+
});
|
|
11983
12118
|
const version = (await kv.send(new DescribeStreamCommand(kvsStreamRef(id)))).StreamInfo?.Version;
|
|
11984
12119
|
if (version === void 0) throw new Error(`cannot resolve stream version for ${id}`);
|
|
11985
12120
|
await kv.send(new UpdateStreamStorageConfigurationCommand({
|
|
@@ -12016,7 +12151,10 @@ const writeApiGatewayV2Stage = async (ctx, ops) => {
|
|
|
12016
12151
|
}
|
|
12017
12152
|
return [...keys];
|
|
12018
12153
|
};
|
|
12019
|
-
const client = new ApiGatewayV2Client({
|
|
12154
|
+
const client = new ApiGatewayV2Client({
|
|
12155
|
+
region: ctx.region,
|
|
12156
|
+
...CLIENT_TIMEOUTS
|
|
12157
|
+
});
|
|
12020
12158
|
if (touched.has("AccessLogSettings") && isCleared("AccessLogSettings")) await client.send(new DeleteAccessLogSettingsCommand({
|
|
12021
12159
|
ApiId: apiId,
|
|
12022
12160
|
StageName: stageName
|
|
@@ -12050,7 +12188,10 @@ const writeApiGatewayRestApiPolicy = async (ctx) => {
|
|
|
12050
12188
|
if (!restApiId) throw new Error("cannot resolve RestApiId for RestApi Policy revert");
|
|
12051
12189
|
const declaredPolicy = ctx.declared["Policy"];
|
|
12052
12190
|
const value = declaredPolicy === void 0 || declaredPolicy === null ? "" : typeof declaredPolicy === "string" ? declaredPolicy : JSON.stringify(declaredPolicy);
|
|
12053
|
-
await new APIGatewayClient({
|
|
12191
|
+
await new APIGatewayClient({
|
|
12192
|
+
region: ctx.region,
|
|
12193
|
+
...CLIENT_TIMEOUTS
|
|
12194
|
+
}).send(new UpdateRestApiCommand({
|
|
12054
12195
|
restApiId,
|
|
12055
12196
|
patchOperations: [{
|
|
12056
12197
|
op: "replace",
|
|
@@ -12134,7 +12275,10 @@ const writeCloudControlIndexNested = async (ctx, ops) => {
|
|
|
12134
12275
|
const type = ctx.resourceType;
|
|
12135
12276
|
if (!type) throw new Error("writeCloudControlIndexNested: resourceType missing on ctx");
|
|
12136
12277
|
const identifier = ctx.identifier ?? ctx.physicalId;
|
|
12137
|
-
const cc = new CloudControlClient({
|
|
12278
|
+
const cc = new CloudControlClient({
|
|
12279
|
+
region: ctx.region,
|
|
12280
|
+
...CLIENT_TIMEOUTS
|
|
12281
|
+
});
|
|
12138
12282
|
const got = await cc.send(new GetResourceCommand({
|
|
12139
12283
|
TypeName: type,
|
|
12140
12284
|
Identifier: identifier
|
|
@@ -13360,7 +13504,10 @@ async function revertStack(p) {
|
|
|
13360
13504
|
};
|
|
13361
13505
|
}
|
|
13362
13506
|
}
|
|
13363
|
-
const cc = new CloudControlClient({
|
|
13507
|
+
const cc = new CloudControlClient({
|
|
13508
|
+
region,
|
|
13509
|
+
...CLIENT_TIMEOUTS
|
|
13510
|
+
});
|
|
13364
13511
|
const byLogical = new Map(gathered.desired.resources.map((res) => [res.logicalId, res]));
|
|
13365
13512
|
const failedDeleteIds = /* @__PURE__ */ new Set();
|
|
13366
13513
|
const failedUpdateIds = /* @__PURE__ */ new Set();
|