@geek-fun/serverlessinsight 0.9.6 → 0.9.8
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/AGENTS.md +1 -0
- package/CHANGELOG.md +68 -0
- package/README.md +52 -11
- package/README.zh-CN.md +44 -10
- package/dist/package.json +2 -1
- package/dist/src/commands/deploy.js +3 -1
- package/dist/src/commands/destroy.js +3 -1
- package/dist/src/commands/forceUnlock.js +2 -2
- package/dist/src/commands/index.js +28 -8
- package/dist/src/commands/local.js +3 -2
- package/dist/src/commands/login.js +120 -37
- package/dist/src/commands/logout.js +3 -5
- package/dist/src/commands/migrate.js +17 -10
- package/dist/src/commands/plan.js +5 -1
- package/dist/src/commands/show.js +3 -1
- package/dist/src/commands/whoami.js +24 -6
- package/dist/src/common/aliyunClient/cdnOperations.js +64 -29
- package/dist/src/common/aliyunClient/dnsOperations.js +10 -0
- package/dist/src/common/aliyunClient/fc3Operations.js +36 -7
- package/dist/src/common/apiClient.js +1 -0
- package/dist/src/common/bindingReconcile.js +182 -0
- package/dist/src/common/cdnCapabilities.js +80 -0
- package/dist/src/common/certUtils.js +44 -5
- package/dist/src/common/consoleLines.js +126 -0
- package/dist/src/common/constants.js +4 -2
- package/dist/src/common/credentialStore.js +136 -39
- package/dist/src/common/domainUtils.js +23 -4
- package/dist/src/common/functionDefinition.js +4 -1
- package/dist/src/common/functionDomainCapabilities.js +28 -0
- package/dist/src/common/functionDomainReconcile.js +197 -0
- package/dist/src/common/lineContext.js +164 -0
- package/dist/src/common/planCapabilities.js +14 -27
- package/dist/src/common/planCompare.js +8 -7
- package/dist/src/common/planFormatter.js +71 -37
- package/dist/src/common/stateBackend/cosStateBackend.js +0 -46
- package/dist/src/common/stateBackend/index.js +24 -16
- package/dist/src/common/stateBackend/ossStateBackend.js +0 -25
- package/dist/src/common/stateBackend/remoteStateBackend.js +5 -22
- package/dist/src/common/stateBackend/saasStateBackend.js +46 -53
- package/dist/src/common/stateBackend/tosStateBackend.js +100 -0
- package/dist/src/common/stateBackend/types.js +0 -9
- package/dist/src/common/tencentClient/cdnOperations.js +165 -0
- package/dist/src/common/tencentClient/cosOperations.js +18 -2
- package/dist/src/common/tencentClient/dnspodOperations.js +12 -0
- package/dist/src/common/tencentClient/index.js +16 -0
- package/dist/src/common/tencentClient/scfOperations.js +23 -1
- package/dist/src/common/tencentClient/sslOperations.js +147 -77
- package/dist/src/common/volcengineClient/cdnOperations.js +221 -0
- package/dist/src/common/volcengineClient/dnsOperations.js +132 -0
- package/dist/src/common/volcengineClient/index.js +28 -0
- package/dist/src/common/volcengineClient/tosOperations.js +131 -1
- package/dist/src/lang/en.js +89 -12
- package/dist/src/lang/zh-CN.js +90 -11
- package/dist/src/parser/bucketParser.js +22 -79
- package/dist/src/parser/functionParser.js +13 -9
- package/dist/src/stack/aliyunStack/apigwResource.js +2 -1
- package/dist/src/stack/aliyunStack/fc3Planner.js +32 -12
- package/dist/src/stack/aliyunStack/fc3Resource.js +169 -121
- package/dist/src/stack/aliyunStack/ossPlanner.js +12 -4
- package/dist/src/stack/aliyunStack/ossResource.js +484 -501
- package/dist/src/stack/aliyunStack/ossTypes.js +21 -67
- package/dist/src/stack/localStack/aliyunFc.js +59 -9
- package/dist/src/stack/localStack/bucket.js +75 -28
- package/dist/src/stack/localStack/event.js +33 -24
- package/dist/src/stack/localStack/httpAdapter.js +1 -13
- package/dist/src/stack/localStack/index.js +2 -2
- package/dist/src/stack/localStack/localServer.js +85 -7
- package/dist/src/stack/scfStack/cosPlanner.js +11 -3
- package/dist/src/stack/scfStack/cosResource.js +339 -161
- package/dist/src/stack/scfStack/cosTypes.js +25 -34
- package/dist/src/stack/scfStack/scfPlanner.js +26 -8
- package/dist/src/stack/scfStack/scfResource.js +191 -124
- package/dist/src/stack/volcengineStack/tosPlanner.js +13 -1
- package/dist/src/stack/volcengineStack/tosResource.js +398 -7
- package/dist/src/stack/volcengineStack/tosTypes.js +27 -0
- package/dist/src/stack/volcengineStack/vefaasTypes.js +1 -1
- package/dist/src/types/domains/state.js +6 -0
- package/dist/src/validator/bucketSchema.js +35 -113
- package/dist/src/validator/cdnSchema.js +30 -0
- package/dist/src/validator/eventSchema.js +2 -20
- package/dist/src/validator/functionSchema.js +55 -8
- package/dist/src/validator/rootSchema.js +3 -3
- package/dist/src/validator/semanticValidation.js +504 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -1
- package/release-notes.md +82 -6
- package/samples/aliyun-poc-api-cdn.yml +1 -1
- package/samples/aliyun-poc-bucket-cdn.yml +28 -26
- package/samples/aliyun-poc-domain.yml +2 -1
- package/samples/volcengine-poc-tos-state.yml +36 -0
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.deleteBucketResource = exports.updateBucketResource = exports.readBucketResource = exports.createBucketResource = void 0;
|
|
4
|
-
const domainUtils_1 = require("../../common/domainUtils");
|
|
5
4
|
const planCompare_1 = require("../../common/planCompare");
|
|
6
5
|
const bucketPolicy_1 = require("../../common/bucketPolicy");
|
|
7
6
|
const functionDefinition_1 = require("../../common/functionDefinition");
|
|
7
|
+
const bindingReconcile_1 = require("../../common/bindingReconcile");
|
|
8
|
+
const cdnCapabilities_1 = require("../../common/cdnCapabilities");
|
|
9
|
+
const certUtils_1 = require("../../common/certUtils");
|
|
8
10
|
const types_1 = require("../../types");
|
|
9
11
|
const tencentClient_1 = require("../../common/tencentClient");
|
|
10
12
|
const cosTypes_1 = require("./cosTypes");
|
|
11
13
|
const common_1 = require("../../common");
|
|
12
|
-
const certUtils_1 = require("../../common/certUtils");
|
|
13
14
|
const logger_1 = require("../../common/logger");
|
|
14
15
|
const lang_1 = require("../../lang");
|
|
15
|
-
const
|
|
16
|
+
const domainUtils_1 = require("../../common/domainUtils");
|
|
16
17
|
const ownershipTag_1 = require("../ownershipTag");
|
|
17
18
|
const alreadyExists_1 = require("../alreadyExists");
|
|
18
19
|
const buildCosBucketPolicyJson = (iam) => (0, bucketPolicy_1.buildBucketPolicy)(iam, 'tencent');
|
|
@@ -48,63 +49,297 @@ const deleteBucketPolicy = async (client, bucketName, region) => {
|
|
|
48
49
|
throw err;
|
|
49
50
|
}
|
|
50
51
|
};
|
|
51
|
-
const
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
if (!
|
|
52
|
+
const asTencentGroup = (group) => group;
|
|
53
|
+
const TENCENT_BINDING_ROLE_BY_TYPE = {
|
|
54
|
+
[types_1.ResourceTypeEnum.COS_DNS_CNAME]: 'dns',
|
|
55
|
+
[types_1.ResourceTypeEnum.TENCENT_CDN_DOMAIN]: 'cdn',
|
|
56
|
+
[types_1.ResourceTypeEnum.TENCENT_CDN_DNS_CNAME]: 'cdnDns',
|
|
57
|
+
};
|
|
58
|
+
/** Legacy single-domain definitions (pre-v1 state) migrate in place; legacy Tencent bindings were always direct. */
|
|
59
|
+
const tencentLegacyBinding = (definition) => {
|
|
60
|
+
const legacy = definition;
|
|
61
|
+
if (Array.isArray(legacy.domains) || typeof legacy.domain !== 'string' || !legacy.domain) {
|
|
61
62
|
return undefined;
|
|
62
|
-
if (website.domain_certificate_id) {
|
|
63
|
-
logger_1.logger.info(lang_1.lang.__('CERT_RESOLVING_REFERENCE', {
|
|
64
|
-
reference: website.domain_certificate_id,
|
|
65
|
-
domain: website.domain ?? bucket.key,
|
|
66
|
-
}));
|
|
67
|
-
return {
|
|
68
|
-
mode: 'reference',
|
|
69
|
-
certificateId: website.domain_certificate_id,
|
|
70
|
-
};
|
|
71
|
-
}
|
|
72
|
-
if (website.domain_certificate_body && website.domain_certificate_private_key) {
|
|
73
|
-
if (!website.domain) {
|
|
74
|
-
throw new Error(lang_1.lang.__('BUCKET_DOMAIN_REQUIRED_FOR_CERT', { name: bucket.key }));
|
|
75
|
-
}
|
|
76
|
-
const body = (0, certUtils_1.readPemContent)(website.domain_certificate_body);
|
|
77
|
-
const key = (0, certUtils_1.readPemContent)(website.domain_certificate_private_key);
|
|
78
|
-
(0, certUtils_1.warnInlinePem)(website.domain_certificate_private_key);
|
|
79
|
-
return {
|
|
80
|
-
mode: 'upload',
|
|
81
|
-
certificateName: website.domain.replace(/\./g, '_'),
|
|
82
|
-
certificateBody: body,
|
|
83
|
-
certificatePrivateKey: key,
|
|
84
|
-
};
|
|
85
63
|
}
|
|
86
|
-
return
|
|
64
|
+
return { hostname: (0, domainUtils_1.normalizeHostname)(legacy.domain), mode: 'direct' };
|
|
87
65
|
};
|
|
88
|
-
const
|
|
89
|
-
logger_1.logger.info(lang_1.lang.__('COS_BUCKET_CERT_DEPLOYING', { domain, bucketName }));
|
|
90
|
-
let certificateId;
|
|
66
|
+
const resolveCosCertificateId = async (client, resolved) => {
|
|
91
67
|
if (resolved.mode === 'reference') {
|
|
92
68
|
logger_1.logger.info(lang_1.lang.__('CERT_RESOLVED_REFERENCE', {
|
|
93
|
-
name:
|
|
69
|
+
name: resolved.certificateId,
|
|
94
70
|
certId: resolved.certificateId,
|
|
95
71
|
}));
|
|
96
|
-
|
|
97
|
-
}
|
|
98
|
-
else {
|
|
99
|
-
logger_1.logger.info(lang_1.lang.__('CERT_RESOLVED_UPLOAD', {
|
|
100
|
-
name: resolved.certificateName,
|
|
101
|
-
}));
|
|
102
|
-
const certInfo = await client.ssl.uploadCertificate(resolved.certificateName, resolved.certificateBody, resolved.certificatePrivateKey);
|
|
103
|
-
certificateId = certInfo.certificateId;
|
|
72
|
+
return resolved.certificateId;
|
|
104
73
|
}
|
|
74
|
+
logger_1.logger.info(lang_1.lang.__('CERT_RESOLVED_UPLOAD', {
|
|
75
|
+
name: resolved.certificateName,
|
|
76
|
+
}));
|
|
77
|
+
// Repeatable: false — Tencent returns the existing certificate id when the
|
|
78
|
+
// same content was uploaded before, so this is idempotent.
|
|
79
|
+
const certInfo = await client.ssl.uploadCertificate(resolved.certificateName, resolved.certificateBody, resolved.certificatePrivateKey);
|
|
80
|
+
return certInfo.certificateId;
|
|
81
|
+
};
|
|
82
|
+
const deployCertificateToCosDomain = async (client, resolved, bucketName, domain, region) => {
|
|
83
|
+
logger_1.logger.info(lang_1.lang.__('COS_BUCKET_CERT_DEPLOYING', { domain, bucketName }));
|
|
84
|
+
const certificateId = await resolveCosCertificateId(client, resolved);
|
|
105
85
|
const instanceId = `${region}|${bucketName}|${domain}`;
|
|
106
86
|
await client.ssl.deployCertificateInstance(certificateId, 'cos', [instanceId]);
|
|
107
87
|
};
|
|
88
|
+
// v1 capability contract (issue #279): bucket-level transfer acceleration is
|
|
89
|
+
// implemented on aliyun OSS only; COS rejects it instead of ignoring it.
|
|
90
|
+
const guardCosCapabilities = (bucket) => {
|
|
91
|
+
if (bucket.accelerate === true) {
|
|
92
|
+
throw new Error(lang_1.lang.__('BUCKET_ACCELERATE_PROVIDER_NOT_SUPPORTED', { key: bucket.key, provider: 'tencent' }));
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
const bindCosDomain = async (client, bucket, binding, context, instances, stored) => {
|
|
96
|
+
const resolved = (0, bindingReconcile_1.resolveBindingCertificate)(binding);
|
|
97
|
+
logger_1.logger.info(lang_1.lang.__('BINDING_CUSTOM_DOMAIN_TO_BUCKET', {
|
|
98
|
+
domain: binding.domain_name,
|
|
99
|
+
bucketName: bucket.name,
|
|
100
|
+
}));
|
|
101
|
+
const cnameInfo = await client.cos.bindCustomDomain(bucket.name, binding.domain_name);
|
|
102
|
+
if (cnameInfo) {
|
|
103
|
+
const instanceId = cnameInfo.dnsRecordId ?? binding.domain_name;
|
|
104
|
+
instances.push({
|
|
105
|
+
sid: (0, common_1.buildSid)('tencent', 'dnspod', context.stage, instanceId),
|
|
106
|
+
id: instanceId,
|
|
107
|
+
type: types_1.ResourceTypeEnum.COS_DNS_CNAME,
|
|
108
|
+
domain: binding.domain_name,
|
|
109
|
+
cname: cnameInfo.cname,
|
|
110
|
+
...(cnameInfo.dnsRecordId ? { dnsRecordId: cnameInfo.dnsRecordId } : {}),
|
|
111
|
+
});
|
|
112
|
+
if (resolved && cnameInfo.bucketDomainBound) {
|
|
113
|
+
// Certificate redeploys are keyed on content hash (issue #283): an
|
|
114
|
+
// unchanged certificate must not re-hit the SSL APIs on every deploy.
|
|
115
|
+
const certificateHash = (0, certUtils_1.resolveBindingCertificateHash)({
|
|
116
|
+
certificate_id: binding.certificate_id,
|
|
117
|
+
certificate_body: binding.certificate_body,
|
|
118
|
+
certificate_private_key: binding.certificate_private_key,
|
|
119
|
+
});
|
|
120
|
+
if ((0, bindingReconcile_1.shouldDeployBindingCertificate)({
|
|
121
|
+
pending: false,
|
|
122
|
+
certificateId: resolved.mode === 'reference' ? resolved.certificateId : undefined,
|
|
123
|
+
certificateHash,
|
|
124
|
+
stored,
|
|
125
|
+
})) {
|
|
126
|
+
await deployCertificateToCosDomain(client, resolved, bucket.name, binding.domain_name, context.region);
|
|
127
|
+
}
|
|
128
|
+
else {
|
|
129
|
+
logger_1.logger.info(lang_1.lang.__('CDN_CERT_UNCHANGED_SKIPPED', { domain: binding.domain_name }));
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
};
|
|
134
|
+
// ---------------------------------------------------------------------------
|
|
135
|
+
// Per-binding CDN delivery (issue #283)
|
|
136
|
+
// ---------------------------------------------------------------------------
|
|
137
|
+
const buildCosOrigin = (client, bucketName, cdnObj) => {
|
|
138
|
+
const cosEndpoint = client.cos.getCosEndpoint(bucketName);
|
|
139
|
+
return {
|
|
140
|
+
originType: 'cos',
|
|
141
|
+
origins: [cosEndpoint],
|
|
142
|
+
serverName: cosEndpoint,
|
|
143
|
+
...(cdnObj?.origin_protocol
|
|
144
|
+
? { originPullProtocol: (0, cdnCapabilities_1.mapOriginProtocol)('tencent', cdnObj.origin_protocol) }
|
|
145
|
+
: {}),
|
|
146
|
+
};
|
|
147
|
+
};
|
|
148
|
+
const ensureCdnDns = async (context, client, hostname, cname, instances) => {
|
|
149
|
+
// The CDN CNAME for a hostname is stable, so an existing delivery record is
|
|
150
|
+
// kept as recorded — only a missing record is created here.
|
|
151
|
+
const mainDomain = (0, domainUtils_1.extractMainDomain)(hostname);
|
|
152
|
+
const dnsRecordId = await client.dns.addDomainRecord({
|
|
153
|
+
domainName: mainDomain,
|
|
154
|
+
rr: (0, domainUtils_1.extractHostRecord)(hostname, mainDomain),
|
|
155
|
+
type: 'CNAME',
|
|
156
|
+
value: cname,
|
|
157
|
+
ttl: 600,
|
|
158
|
+
});
|
|
159
|
+
const id = dnsRecordId || hostname;
|
|
160
|
+
instances.push({
|
|
161
|
+
sid: (0, common_1.buildSid)('tencent', 'dnspod', context.stage, id),
|
|
162
|
+
id,
|
|
163
|
+
type: types_1.ResourceTypeEnum.TENCENT_CDN_DNS_CNAME,
|
|
164
|
+
domain: hostname,
|
|
165
|
+
cname,
|
|
166
|
+
...(dnsRecordId ? { dnsRecordId } : {}),
|
|
167
|
+
});
|
|
168
|
+
};
|
|
169
|
+
const applyCdnOptions = async (client, bucketName, hostname, cdnObj) => {
|
|
170
|
+
if (cdnObj?.cache_ttl != null || cdnObj?.ignore_query_string != null) {
|
|
171
|
+
await client.cdn.applyCacheConfig(hostname, cdnObj?.cache_ttl, cdnObj?.ignore_query_string);
|
|
172
|
+
}
|
|
173
|
+
if (cdnObj?.compression != null) {
|
|
174
|
+
await client.cdn.applyCompression(hostname, cdnObj.compression);
|
|
175
|
+
}
|
|
176
|
+
if (cdnObj?.force_redirect_https != null) {
|
|
177
|
+
await client.cdn.applyHttpsRedirect(hostname, cdnObj.force_redirect_https);
|
|
178
|
+
}
|
|
179
|
+
};
|
|
180
|
+
const createCdnBinding = async (context, client, bucket, binding, certificate, instances) => {
|
|
181
|
+
const hostname = binding.domain_name;
|
|
182
|
+
const cdnObj = (0, bindingReconcile_1.getBindingCdnOptions)(binding);
|
|
183
|
+
const origin = buildCosOrigin(client, bucket.name, cdnObj);
|
|
184
|
+
logger_1.logger.info(lang_1.lang.__('CREATING_CDN_DISTRIBUTION', { domain: hostname, origin: origin.origins[0] }));
|
|
185
|
+
try {
|
|
186
|
+
await client.cdn.addCdnDomain({
|
|
187
|
+
domainName: hostname,
|
|
188
|
+
serviceType: cdnObj?.cdn_type ?? 'web',
|
|
189
|
+
area: (0, cdnCapabilities_1.mapCdnScope)('tencent', cdnObj?.scope),
|
|
190
|
+
origin,
|
|
191
|
+
});
|
|
192
|
+
}
|
|
193
|
+
catch (error) {
|
|
194
|
+
// Partial-failure retry: a CDN domain created by an interrupted earlier run
|
|
195
|
+
// must not block convergence — probe, verify ownership and continue as an
|
|
196
|
+
// update. A same-account domain whose origin does not point at this bucket
|
|
197
|
+
// is not ours to adopt (repo convention: refuse un-owned resources); one
|
|
198
|
+
// still being deleted by a prior teardown is not adoptable either —
|
|
199
|
+
// surface the original conflict so the user retries after it completes.
|
|
200
|
+
const existing = await client.cdn.describeCdnDomain(hostname);
|
|
201
|
+
if (!existing || existing.status === 'deleting')
|
|
202
|
+
throw error;
|
|
203
|
+
const cosEndpoint = client.cos.getCosEndpoint(bucket.name);
|
|
204
|
+
const origins = existing.origin?.origins ?? [];
|
|
205
|
+
if (existing.origin?.originType !== 'cos' || !origins.includes(cosEndpoint)) {
|
|
206
|
+
throw new Error(lang_1.lang.__('CDN_DOMAIN_EXISTS_NOT_OWNED', { domain: hostname, bucketName: bucket.name }), { cause: error });
|
|
207
|
+
}
|
|
208
|
+
logger_1.logger.info(lang_1.lang.__('RESOURCE_OWNERSHIP_TAG_ADOPT', {
|
|
209
|
+
resourceType: 'CDN domain',
|
|
210
|
+
name: hostname,
|
|
211
|
+
tag: 'state',
|
|
212
|
+
}));
|
|
213
|
+
}
|
|
214
|
+
return updateCdnBinding(context, client, bucket, binding, certificate, { hostname, mode: 'cdn', cdn: { ...cdnObj, enabled: true } }, {
|
|
215
|
+
cdn: {
|
|
216
|
+
sid: (0, common_1.buildSid)('tencent', 'cdn', context.stage, hostname),
|
|
217
|
+
id: hostname,
|
|
218
|
+
type: types_1.ResourceTypeEnum.TENCENT_CDN_DOMAIN,
|
|
219
|
+
domainName: hostname,
|
|
220
|
+
pending: true,
|
|
221
|
+
},
|
|
222
|
+
}, instances);
|
|
223
|
+
};
|
|
224
|
+
const updateCdnBinding = async (context, client, bucket, binding, certificate, stored, group, instances) => {
|
|
225
|
+
const hostname = binding.domain_name;
|
|
226
|
+
const cdnObj = (0, bindingReconcile_1.getBindingCdnOptions)(binding);
|
|
227
|
+
const tencentGroup = asTencentGroup(group);
|
|
228
|
+
const pending = tencentGroup?.cdn?.pending === true;
|
|
229
|
+
const distributionIndex = instances.length;
|
|
230
|
+
instances.push({
|
|
231
|
+
...tencentGroup?.cdn,
|
|
232
|
+
sid: tencentGroup?.cdn?.sid ?? (0, common_1.buildSid)('tencent', 'cdn', context.stage, hostname),
|
|
233
|
+
id: hostname,
|
|
234
|
+
type: types_1.ResourceTypeEnum.TENCENT_CDN_DOMAIN,
|
|
235
|
+
domainName: hostname,
|
|
236
|
+
pending: true,
|
|
237
|
+
});
|
|
238
|
+
// Tencent updates service type / acceleration area / origin in place via
|
|
239
|
+
// UpdateDomainConfig — no distribution recreation needed.
|
|
240
|
+
if (!pending && (0, bindingReconcile_1.cdnDeliveryChanged)(stored.cdn, cdnObj)) {
|
|
241
|
+
await client.cdn.updateCdnDelivery(hostname, {
|
|
242
|
+
serviceType: cdnObj?.cdn_type ?? 'web',
|
|
243
|
+
area: (0, cdnCapabilities_1.mapCdnScope)('tencent', cdnObj?.scope),
|
|
244
|
+
origin: buildCosOrigin(client, bucket.name, cdnObj),
|
|
245
|
+
});
|
|
246
|
+
}
|
|
247
|
+
const applyOptions = pending || (0, bindingReconcile_1.cdnDeliveryChanged)(stored.cdn, cdnObj);
|
|
248
|
+
if (applyOptions) {
|
|
249
|
+
await applyCdnOptions(client, bucket.name, hostname, cdnObj);
|
|
250
|
+
}
|
|
251
|
+
else {
|
|
252
|
+
// Omitted options resolve to their documented defaults (issue #283/#294
|
|
253
|
+
// unified contract): cache_ttl/ignore_query_string → provider-default
|
|
254
|
+
// cache behavior, the boolean knobs → off. The apply layer renders null
|
|
255
|
+
// as the default module, so a dropped option converges the cloud instead
|
|
256
|
+
// of leaving the previous setting behind (same shape on aliyun/volcengine).
|
|
257
|
+
if ((stored.cdn?.cache_ttl ?? null) !== (cdnObj?.cache_ttl ?? null) ||
|
|
258
|
+
(stored.cdn?.ignore_query_string ?? null) !== (cdnObj?.ignore_query_string ?? null)) {
|
|
259
|
+
await client.cdn.applyCacheConfig(hostname, cdnObj?.cache_ttl ?? null, cdnObj?.ignore_query_string ?? null);
|
|
260
|
+
}
|
|
261
|
+
if ((stored.cdn?.compression ?? null) !== (cdnObj?.compression ?? null)) {
|
|
262
|
+
await client.cdn.applyCompression(hostname, cdnObj?.compression ?? false);
|
|
263
|
+
}
|
|
264
|
+
if ((stored.cdn?.force_redirect_https ?? null) !== (cdnObj?.force_redirect_https ?? null)) {
|
|
265
|
+
await client.cdn.applyHttpsRedirect(hostname, cdnObj?.force_redirect_https ?? false);
|
|
266
|
+
}
|
|
267
|
+
if ((stored.cdn?.origin_protocol ?? null) !== (cdnObj?.origin_protocol ?? null)) {
|
|
268
|
+
// An explicit origin config is required to reset the pull protocol; the
|
|
269
|
+
// provider default when unset is plain http.
|
|
270
|
+
await client.cdn.updateCdnDelivery(hostname, {
|
|
271
|
+
origin: {
|
|
272
|
+
...buildCosOrigin(client, bucket.name, cdnObj),
|
|
273
|
+
originPullProtocol: (0, cdnCapabilities_1.mapOriginProtocol)('tencent', cdnObj?.origin_protocol) ?? 'http',
|
|
274
|
+
},
|
|
275
|
+
});
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
if (certificate) {
|
|
279
|
+
const certificateHash = (0, certUtils_1.resolveBindingCertificateHash)({
|
|
280
|
+
certificate_id: binding.certificate_id,
|
|
281
|
+
certificate_body: binding.certificate_body,
|
|
282
|
+
certificate_private_key: binding.certificate_private_key,
|
|
283
|
+
});
|
|
284
|
+
if ((0, bindingReconcile_1.shouldDeployBindingCertificate)({
|
|
285
|
+
pending,
|
|
286
|
+
certificateId: certificate.mode === 'reference' ? certificate.certificateId : undefined,
|
|
287
|
+
certificateHash,
|
|
288
|
+
stored,
|
|
289
|
+
})) {
|
|
290
|
+
logger_1.logger.info(lang_1.lang.__('CDN_DEPLOYING_CERTIFICATE', { domain: hostname }));
|
|
291
|
+
const certId = await resolveCosCertificateId(client, certificate);
|
|
292
|
+
await client.ssl.deployCertificateInstance(certId, 'cdn', [hostname]);
|
|
293
|
+
await client.cdn.enableHttps(hostname);
|
|
294
|
+
}
|
|
295
|
+
else {
|
|
296
|
+
logger_1.logger.info(lang_1.lang.__('CDN_CERT_UNCHANGED_SKIPPED', { domain: hostname }));
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
if (tencentGroup?.cdnDns) {
|
|
300
|
+
instances.push(tencentGroup.cdnDns);
|
|
301
|
+
}
|
|
302
|
+
else {
|
|
303
|
+
const detail = await client.cdn.describeCdnDomain(hostname);
|
|
304
|
+
if (!detail?.cname) {
|
|
305
|
+
throw new Error(lang_1.lang.__('FAILED_TO_REFRESH_STATE', { resourceType: 'CDN domain', name: hostname }));
|
|
306
|
+
}
|
|
307
|
+
await ensureCdnDns(context, client, hostname, detail.cname, instances);
|
|
308
|
+
instances[distributionIndex] = { ...instances[distributionIndex], cname: detail.cname };
|
|
309
|
+
}
|
|
310
|
+
// The bucket keeps the domain bound (REST rule + CORS) so direct origin
|
|
311
|
+
// checks and browser CORS keep working alongside CDN delivery.
|
|
312
|
+
const cnameInfo = await client.cos.bindCustomDomain(bucket.name, hostname, { skipDns: true });
|
|
313
|
+
const { pending: _pending, ...ready } = instances[distributionIndex];
|
|
314
|
+
instances[distributionIndex] = ready;
|
|
315
|
+
return cnameInfo?.bucketDomainBound;
|
|
316
|
+
};
|
|
317
|
+
const teardownCosBinding = async (client, bucketName, stored, group) => {
|
|
318
|
+
if (!group)
|
|
319
|
+
return;
|
|
320
|
+
const tencentGroup = asTencentGroup(group);
|
|
321
|
+
if (stored.mode === 'cdn') {
|
|
322
|
+
const distributionName = tencentGroup?.cdn?.domainName ?? stored.hostname;
|
|
323
|
+
await client.cdn.deleteCdnDomain(distributionName);
|
|
324
|
+
logger_1.logger.info(lang_1.lang.__('CDN_DOMAIN_DELETED', { domain: distributionName }));
|
|
325
|
+
if (tencentGroup?.cdnDns?.dnsRecordId) {
|
|
326
|
+
const mainDomain = (0, domainUtils_1.extractMainDomain)(stored.hostname);
|
|
327
|
+
try {
|
|
328
|
+
await client.dns.deleteDomainRecord(mainDomain, tencentGroup.cdnDns.dnsRecordId);
|
|
329
|
+
}
|
|
330
|
+
catch (error) {
|
|
331
|
+
// Best-effort delivery-record cleanup: the binding teardown must not
|
|
332
|
+
// fail because the record is already gone.
|
|
333
|
+
logger_1.logger.debug(lang_1.lang.__('DNS_OPERATION_ERROR', { error: String(error) }));
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
await client.cos.unbindCustomDomain(bucketName, stored.hostname);
|
|
337
|
+
return;
|
|
338
|
+
}
|
|
339
|
+
// direct binding
|
|
340
|
+
const domain = tencentGroup?.dns?.domain ?? stored.hostname;
|
|
341
|
+
await client.cos.unbindCustomDomain(bucketName, domain, tencentGroup?.dns?.dnsRecordId);
|
|
342
|
+
};
|
|
108
343
|
const buildCosInstanceFromProvider = (info, sid) => {
|
|
109
344
|
return {
|
|
110
345
|
sid,
|
|
@@ -272,55 +507,17 @@ const createBucketResource = async (context, bucket, state) => {
|
|
|
272
507
|
const instances = [
|
|
273
508
|
buildCosInstanceFromProvider(bucketInfo, sid),
|
|
274
509
|
];
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
logger_1.logger.info(lang_1.lang.__('BINDING_CUSTOM_DOMAIN_TO_BUCKET', {
|
|
281
|
-
domain: primaryDomain,
|
|
282
|
-
bucketName: bucket.name,
|
|
283
|
-
}));
|
|
284
|
-
cnameInfo = await client.cos.bindCustomDomain(bucket.name, primaryDomain);
|
|
285
|
-
if (cnameInfo) {
|
|
286
|
-
const instanceId = cnameInfo.dnsRecordId ?? primaryDomain;
|
|
287
|
-
const dnsInstance = {
|
|
288
|
-
sid: (0, common_1.buildSid)('tencent', 'dnspod', context.stage, instanceId),
|
|
289
|
-
id: instanceId,
|
|
290
|
-
type: types_1.ResourceTypeEnum.COS_DNS_CNAME,
|
|
291
|
-
domain: primaryDomain,
|
|
292
|
-
cname: cnameInfo.cname,
|
|
293
|
-
...(cnameInfo.dnsRecordId ? { dnsRecordId: cnameInfo.dnsRecordId } : {}),
|
|
294
|
-
};
|
|
295
|
-
instances.push(dnsInstance);
|
|
296
|
-
if (resolved && cnameInfo.bucketDomainBound) {
|
|
297
|
-
await deployCertificateToCosDomain(client, resolved, bucket.name, primaryDomain, context.region);
|
|
298
|
-
}
|
|
510
|
+
guardCosCapabilities(bucket);
|
|
511
|
+
for (const binding of bucket.domains ?? []) {
|
|
512
|
+
if ((0, bindingReconcile_1.isBindingCdnEnabled)(binding)) {
|
|
513
|
+
const certificate = (0, bindingReconcile_1.resolveBindingCertificate)(binding);
|
|
514
|
+
await createCdnBinding(context, client, bucket, binding, certificate, instances);
|
|
299
515
|
}
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
logger_1.logger.info(lang_1.lang.__('BINDING_CUSTOM_DOMAIN_TO_BUCKET', {
|
|
303
|
-
domain: wwwDomain,
|
|
304
|
-
bucketName: bucket.name,
|
|
305
|
-
}));
|
|
306
|
-
const wwwCnameInfo = await client.cos.bindCustomDomain(bucket.name, wwwDomain);
|
|
307
|
-
if (wwwCnameInfo) {
|
|
308
|
-
const wwwInstanceId = wwwCnameInfo.dnsRecordId ?? wwwDomain;
|
|
309
|
-
const wwwDnsInstance = {
|
|
310
|
-
sid: (0, common_1.buildSid)('tencent', 'dnspod', context.stage, wwwInstanceId),
|
|
311
|
-
id: wwwInstanceId,
|
|
312
|
-
type: types_1.ResourceTypeEnum.COS_DNS_CNAME,
|
|
313
|
-
domain: wwwDomain,
|
|
314
|
-
cname: wwwCnameInfo.cname,
|
|
315
|
-
isWwwVariant: true,
|
|
316
|
-
...(wwwCnameInfo.dnsRecordId ? { dnsRecordId: wwwCnameInfo.dnsRecordId } : {}),
|
|
317
|
-
};
|
|
318
|
-
instances.push(wwwDnsInstance);
|
|
319
|
-
if (resolved && wwwCnameInfo.bucketDomainBound) {
|
|
320
|
-
await deployCertificateToCosDomain(client, resolved, bucket.name, wwwDomain, context.region);
|
|
321
|
-
}
|
|
322
|
-
}
|
|
516
|
+
else {
|
|
517
|
+
await bindCosDomain(client, bucket, binding, context, instances);
|
|
323
518
|
}
|
|
519
|
+
}
|
|
520
|
+
if ((bucket.domains?.length ?? 0) > 0) {
|
|
324
521
|
const refreshedInfo = await client.cos.getBucket(bucket.name, context.region);
|
|
325
522
|
if (refreshedInfo) {
|
|
326
523
|
instances[0] = buildCosInstanceFromProvider(refreshedInfo, sid);
|
|
@@ -370,76 +567,55 @@ const updateBucketResource = async (context, bucket, state) => {
|
|
|
370
567
|
buildCosInstanceFromProvider(bucketInfo, sid),
|
|
371
568
|
];
|
|
372
569
|
const existingState = state.resources[logicalId];
|
|
373
|
-
const
|
|
374
|
-
const
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
570
|
+
const groups = (0, bindingReconcile_1.groupBindingInstances)(existingState?.instances, TENCENT_BINDING_ROLE_BY_TYPE);
|
|
571
|
+
const storedBindings = (0, bindingReconcile_1.buildStoredBindings)(existingState, groups, {
|
|
572
|
+
accelerateEnabled: false,
|
|
573
|
+
legacyBinding: tencentLegacyBinding,
|
|
574
|
+
});
|
|
575
|
+
// Per-binding reconcile (issue #279/#283): bindings are identified by
|
|
576
|
+
// normalized hostname — re-binding an existing host is idempotent, delivery
|
|
577
|
+
// mode switches tear down and rebuild at binding level, undeclared stored
|
|
578
|
+
// bindings are torn down.
|
|
579
|
+
guardCosCapabilities(bucket);
|
|
580
|
+
const desiredDomains = bucket.domains ?? [];
|
|
581
|
+
const desiredHosts = new Set(desiredDomains.map((b) => (0, domainUtils_1.normalizeHostname)(b.domain_name)));
|
|
582
|
+
for (const rawBinding of desiredDomains) {
|
|
583
|
+
const hostname = (0, domainUtils_1.normalizeHostname)(rawBinding.domain_name);
|
|
584
|
+
const binding = { ...rawBinding, domain_name: hostname };
|
|
585
|
+
let stored = storedBindings.get(hostname);
|
|
586
|
+
const cdnEnabled = (0, bindingReconcile_1.isBindingCdnEnabled)(binding);
|
|
587
|
+
// Binding-level delivery-mode switch (issue #283): tear the previous
|
|
588
|
+
// delivery group down and rebuild in the new mode below.
|
|
589
|
+
if (stored && stored.mode !== (0, bindingReconcile_1.desiredBindingMode)(cdnEnabled, false)) {
|
|
590
|
+
await teardownCosBinding(client, bucket.name, stored, groups.get(hostname));
|
|
591
|
+
stored = undefined;
|
|
384
592
|
}
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
}));
|
|
390
|
-
const cnameInfo = await client.cos.bindCustomDomain(bucket.name, primaryDomain);
|
|
391
|
-
if (cnameInfo) {
|
|
392
|
-
const instanceId = cnameInfo.dnsRecordId ?? primaryDomain;
|
|
393
|
-
const dnsInstance = {
|
|
394
|
-
sid: (0, common_1.buildSid)('tencent', 'dnspod', context.stage, instanceId),
|
|
395
|
-
id: instanceId,
|
|
396
|
-
type: types_1.ResourceTypeEnum.COS_DNS_CNAME,
|
|
397
|
-
domain: primaryDomain,
|
|
398
|
-
cname: cnameInfo.cname,
|
|
399
|
-
...(cnameInfo.dnsRecordId ? { dnsRecordId: cnameInfo.dnsRecordId } : {}),
|
|
400
|
-
};
|
|
401
|
-
instances.push(dnsInstance);
|
|
402
|
-
if (resolved && cnameInfo.bucketDomainBound) {
|
|
403
|
-
await deployCertificateToCosDomain(client, resolved, bucket.name, primaryDomain, context.region);
|
|
593
|
+
if (cdnEnabled) {
|
|
594
|
+
const certificate = (0, bindingReconcile_1.resolveBindingCertificate)(binding);
|
|
595
|
+
if (stored?.mode === 'cdn' && groups.get(hostname)?.cdn) {
|
|
596
|
+
await updateCdnBinding(context, client, bucket, binding, certificate, stored, groups.get(hostname), instances);
|
|
404
597
|
}
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
if (wwwDomain) {
|
|
408
|
-
logger_1.logger.info(lang_1.lang.__('BINDING_CUSTOM_DOMAIN_TO_BUCKET', {
|
|
409
|
-
domain: wwwDomain,
|
|
410
|
-
bucketName: bucket.name,
|
|
411
|
-
}));
|
|
412
|
-
const wwwCnameInfo = await client.cos.bindCustomDomain(bucket.name, wwwDomain);
|
|
413
|
-
if (wwwCnameInfo) {
|
|
414
|
-
const wwwInstanceId = wwwCnameInfo.dnsRecordId ?? wwwDomain;
|
|
415
|
-
const wwwDnsInstance = {
|
|
416
|
-
sid: (0, common_1.buildSid)('tencent', 'dnspod', context.stage, wwwInstanceId),
|
|
417
|
-
id: wwwInstanceId,
|
|
418
|
-
type: types_1.ResourceTypeEnum.COS_DNS_CNAME,
|
|
419
|
-
domain: wwwDomain,
|
|
420
|
-
cname: wwwCnameInfo.cname,
|
|
421
|
-
isWwwVariant: true,
|
|
422
|
-
...(wwwCnameInfo.dnsRecordId ? { dnsRecordId: wwwCnameInfo.dnsRecordId } : {}),
|
|
423
|
-
};
|
|
424
|
-
instances.push(wwwDnsInstance);
|
|
425
|
-
if (resolved && wwwCnameInfo.bucketDomainBound) {
|
|
426
|
-
await deployCertificateToCosDomain(client, resolved, bucket.name, wwwDomain, context.region);
|
|
427
|
-
}
|
|
598
|
+
else {
|
|
599
|
+
await createCdnBinding(context, client, bucket, binding, certificate, instances);
|
|
428
600
|
}
|
|
429
601
|
}
|
|
430
|
-
else
|
|
431
|
-
await client
|
|
602
|
+
else {
|
|
603
|
+
await bindCosDomain(client, bucket, binding, context, instances, stored);
|
|
432
604
|
}
|
|
605
|
+
}
|
|
606
|
+
// Converge removed bindings: any stored binding no longer declared is torn down.
|
|
607
|
+
for (const [hostname, stored] of storedBindings) {
|
|
608
|
+
if (desiredHosts.has(hostname))
|
|
609
|
+
continue;
|
|
610
|
+
logger_1.logger.info(lang_1.lang.__('BINDING_REMOVING_DOMAIN', { domain: hostname, bucketName: bucket.name }));
|
|
611
|
+
await teardownCosBinding(client, bucket.name, stored, groups.get(hostname));
|
|
612
|
+
}
|
|
613
|
+
if (desiredDomains.length > 0) {
|
|
433
614
|
const refreshedInfo = await client.cos.getBucket(bucket.name, context.region);
|
|
434
615
|
if (refreshedInfo) {
|
|
435
616
|
instances[0] = buildCosInstanceFromProvider(refreshedInfo, sid);
|
|
436
617
|
}
|
|
437
618
|
}
|
|
438
|
-
else {
|
|
439
|
-
for (const instance of existingDnsInstances ?? []) {
|
|
440
|
-
await client.cos.unbindCustomDomain(bucket.name, instance.domain, instance.dnsRecordId);
|
|
441
|
-
}
|
|
442
|
-
}
|
|
443
619
|
const policyOwned = (0, bucketPolicy_1.isOwnedBucketPolicy)(cosTypes_1.COS_BUCKET_POLICY_INSTANCE_TYPE, existingState?.instances, existingState?.definition);
|
|
444
620
|
await applyBucketPolicy(client, bucket, context.region, policyOwned);
|
|
445
621
|
if (buildCosBucketPolicyJson(bucket.iam)) {
|
|
@@ -458,13 +634,15 @@ exports.updateBucketResource = updateBucketResource;
|
|
|
458
634
|
const deleteBucketResource = async (context, bucketName, region, logicalId, state) => {
|
|
459
635
|
const client = (0, tencentClient_1.createTencentClient)(context);
|
|
460
636
|
const existingState = state.resources[logicalId];
|
|
461
|
-
const
|
|
637
|
+
const groups = (0, bindingReconcile_1.groupBindingInstances)(existingState?.instances, TENCENT_BINDING_ROLE_BY_TYPE);
|
|
638
|
+
const storedBindings = (0, bindingReconcile_1.buildStoredBindings)(existingState, groups, {
|
|
639
|
+
accelerateEnabled: false,
|
|
640
|
+
legacyBinding: tencentLegacyBinding,
|
|
641
|
+
});
|
|
462
642
|
// Clean up bucket policy before deleting bucket
|
|
463
643
|
await deleteBucketPolicy(client, bucketName, region);
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
await client.cos.unbindCustomDomain(bucketName, dnsInstance.domain, dnsInstance.dnsRecordId);
|
|
467
|
-
}
|
|
644
|
+
for (const [hostname, stored] of storedBindings) {
|
|
645
|
+
await teardownCosBinding(client, bucketName, stored, groups.get(hostname));
|
|
468
646
|
}
|
|
469
647
|
try {
|
|
470
648
|
await client.cos.deleteBucket(bucketName, region);
|
|
@@ -2,7 +2,15 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.cloudCosToDefinition = exports.extractCosBucketDefinition = exports.bucketToCosBucketConfig = exports.COS_BUCKET_POLICY_INSTANCE_TYPE = void 0;
|
|
4
4
|
const bucketPolicy_1 = require("../../common/bucketPolicy");
|
|
5
|
+
const bindingReconcile_1 = require("../../common/bindingReconcile");
|
|
5
6
|
exports.COS_BUCKET_POLICY_INSTANCE_TYPE = 'TENCENT_COS_BUCKET_POLICY';
|
|
7
|
+
const cosBindingToDefinitionEntry = (binding) => (0, bindingReconcile_1.bindingToDefinitionEntry)({
|
|
8
|
+
domainName: binding.domain,
|
|
9
|
+
certificateId: binding.certificateId,
|
|
10
|
+
certificateBody: binding.certificateBody,
|
|
11
|
+
certificatePrivateKey: binding.certificatePrivateKey,
|
|
12
|
+
...(binding.cdn != null ? { cdn: binding.cdn } : {}),
|
|
13
|
+
});
|
|
6
14
|
const bucketToCosBucketConfig = (bucket, region) => {
|
|
7
15
|
const config = {
|
|
8
16
|
Bucket: bucket.name,
|
|
@@ -24,36 +32,19 @@ const bucketToCosBucketConfig = (bucket, region) => {
|
|
|
24
32
|
IndexDocument: {
|
|
25
33
|
Suffix: bucket.website.index,
|
|
26
34
|
},
|
|
35
|
+
ErrorDocument: {
|
|
36
|
+
Key: bucket.website.index,
|
|
37
|
+
},
|
|
27
38
|
};
|
|
28
|
-
config.WebsiteConfiguration.ErrorDocument = {
|
|
29
|
-
Key: bucket.website.index,
|
|
30
|
-
};
|
|
31
|
-
if (bucket.website.domain) {
|
|
32
|
-
config.Domain = bucket.website.domain;
|
|
33
|
-
}
|
|
34
|
-
if (bucket.website.www_bind_apex !== undefined) {
|
|
35
|
-
config.WwwBindApex = bucket.website.www_bind_apex;
|
|
36
|
-
}
|
|
37
|
-
if (bucket.website.domain_certificate_id) {
|
|
38
|
-
config.DomainCertificateId = bucket.website.domain_certificate_id;
|
|
39
|
-
}
|
|
40
|
-
if (bucket.website.domain_certificate_body) {
|
|
41
|
-
config.DomainCertificateBody = bucket.website.domain_certificate_body;
|
|
42
|
-
}
|
|
43
|
-
if (bucket.website.domain_certificate_private_key) {
|
|
44
|
-
config.DomainCertificatePrivateKey = bucket.website.domain_certificate_private_key;
|
|
45
|
-
}
|
|
46
|
-
if (bucket.website.domain_protocol) {
|
|
47
|
-
config.DomainProtocol = bucket.website.domain_protocol;
|
|
48
|
-
}
|
|
49
39
|
}
|
|
50
|
-
if (bucket.
|
|
51
|
-
config.
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
40
|
+
if (bucket.domains?.length) {
|
|
41
|
+
config.domains = bucket.domains.map((binding) => ({
|
|
42
|
+
domain: binding.domain_name,
|
|
43
|
+
certificateId: binding.certificate_id,
|
|
44
|
+
certificateBody: binding.certificate_body,
|
|
45
|
+
certificatePrivateKey: binding.certificate_private_key,
|
|
46
|
+
...(binding.cdn != null ? { cdn: binding.cdn } : {}),
|
|
47
|
+
}));
|
|
57
48
|
}
|
|
58
49
|
if (bucket.versioning?.status) {
|
|
59
50
|
config.VersioningStatus = bucket.versioning.status;
|
|
@@ -78,12 +69,12 @@ const extractCosBucketDefinition = (config) => {
|
|
|
78
69
|
errorDocument: config.WebsiteConfiguration.ErrorDocument?.Key ?? null,
|
|
79
70
|
}
|
|
80
71
|
: {},
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
72
|
+
// Bindings are canonicalized: sorted by hostname so list reordering in
|
|
73
|
+
// YAML never produces a plan change (issue #279).
|
|
74
|
+
domains: (config.domains ?? [])
|
|
75
|
+
.slice()
|
|
76
|
+
.sort((a, b) => a.domain.localeCompare(b.domain))
|
|
77
|
+
.map(cosBindingToDefinitionEntry),
|
|
87
78
|
versioningStatus: config.VersioningStatus ?? null,
|
|
88
79
|
sseAlgorithm: config.SseAlgorithm ?? null,
|
|
89
80
|
sseKmsMasterKeyId: config.SseKmsMasterKeyId ?? null,
|