初始化环境文件

This commit is contained in:
CN-JS-HuiBai
2026-04-04 12:49:09 +08:00
parent 07742d2688
commit c607af6fac
5971 changed files with 515160 additions and 18 deletions

View File

@@ -0,0 +1,30 @@
'use strict';
function locationConstraintMiddleware(options) {
return (next) => async (args) => {
const { CreateBucketConfiguration } = args.input;
const region = await options.region();
if (!CreateBucketConfiguration?.LocationConstraint && !CreateBucketConfiguration?.Location) {
if (region !== "us-east-1") {
args.input.CreateBucketConfiguration = args.input.CreateBucketConfiguration ?? {};
args.input.CreateBucketConfiguration.LocationConstraint = region;
}
}
return next(args);
};
}
const locationConstraintMiddlewareOptions = {
step: "initialize",
tags: ["LOCATION_CONSTRAINT", "CREATE_BUCKET_CONFIGURATION"],
name: "locationConstraintMiddleware",
override: true,
};
const getLocationConstraintPlugin = (config) => ({
applyToStack: (clientStack) => {
clientStack.add(locationConstraintMiddleware(config), locationConstraintMiddlewareOptions);
},
});
exports.getLocationConstraintPlugin = getLocationConstraintPlugin;
exports.locationConstraintMiddleware = locationConstraintMiddleware;
exports.locationConstraintMiddlewareOptions = locationConstraintMiddlewareOptions;