@aws-sdk/client-s3
Version:
AWS SDK for JavaScript S3 Client for Node.js, Browser and React Native
648 lines (647 loc) • 1.46 MB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ruleSet = void 0;
exports.ruleSet = {
version: "1.0",
parameters: {
Bucket: {
required: false,
documentation: "The S3 bucket used to send the request. This is an optional parameter that will be set automatically for operations that are scoped to an S3 bucket.",
type: "String",
},
Region: {
builtIn: "AWS::Region",
required: false,
documentation: "The AWS region used to dispatch the request.",
type: "String",
},
UseFIPS: {
builtIn: "AWS::UseFIPS",
required: true,
default: false,
documentation: "When true, send this request to the FIPS-compliant regional endpoint. If the configured endpoint does not have a FIPS compliant endpoint, dispatching the request will return an error.",
type: "Boolean",
},
UseDualStack: {
builtIn: "AWS::UseDualStack",
required: true,
default: false,
documentation: "When true, use the dual-stack endpoint. If the configured endpoint does not support dual-stack, dispatching the request MAY return an error.",
type: "Boolean",
},
Endpoint: {
builtIn: "SDK::Endpoint",
required: false,
documentation: "Override the endpoint used to send this request",
type: "String",
},
ForcePathStyle: {
builtIn: "AWS::S3::ForcePathStyle",
required: false,
documentation: "When true, force a path-style endpoint to be used where the bucket name is part of the path.",
type: "Boolean",
},
Accelerate: {
builtIn: "AWS::S3::Accelerate",
required: true,
default: false,
documentation: "When true, use S3 Accelerate. NOTE: Not all regions support S3 accelerate.",
type: "Boolean",
},
UseGlobalEndpoint: {
builtIn: "AWS::S3::UseGlobalEndpoint",
required: true,
default: false,
documentation: "Whether the global endpoint should be used, rather then the regional endpoint for us-east-1.",
type: "Boolean",
},
UseObjectLambdaEndpoint: {
required: false,
documentation: "Internal parameter to use object lambda endpoint for an operation (eg: WriteGetObjectResponse)",
type: "Boolean",
},
DisableAccessPoints: {
required: false,
documentation: "Internal parameter to disable Access Point Buckets",
type: "Boolean",
},
DisableMultiRegionAccessPoints: {
builtIn: "AWS::S3::DisableMultiRegionAccessPoints",
required: true,
default: false,
documentation: "Whether multi-region access points (MRAP) should be disabled.",
type: "Boolean",
},
UseArnRegion: {
builtIn: "AWS::S3::UseArnRegion",
required: false,
documentation: "When an Access Point ARN is provided and this flag is enabled, the SDK MUST use the ARN's region when constructing the endpoint instead of the client's configured region.",
type: "Boolean",
},
},
rules: [
{
conditions: [],
type: "tree",
rules: [
{
conditions: [
{
fn: "isSet",
argv: [
{
ref: "Region",
},
],
},
],
type: "tree",
rules: [
{
conditions: [],
type: "tree",
rules: [
{
conditions: [
{
fn: "isSet",
argv: [
{
ref: "Bucket",
},
],
},
{
fn: "substring",
argv: [
{
ref: "Bucket",
},
49,
50,
true,
],
assign: "hardwareType",
},
{
fn: "substring",
argv: [
{
ref: "Bucket",
},
8,
12,
true,
],
assign: "regionPrefix",
},
{
fn: "substring",
argv: [
{
ref: "Bucket",
},
0,
7,
true,
],
assign: "abbaSuffix",
},
{
fn: "substring",
argv: [
{
ref: "Bucket",
},
32,
49,
true,
],
assign: "outpostId",
},
{
fn: "aws.partition",
argv: [
{
ref: "Region",
},
],
assign: "regionPartition",
},
{
fn: "stringEquals",
argv: [
{
ref: "abbaSuffix",
},
"--op-s3",
],
},
],
type: "tree",
rules: [
{
conditions: [
{
fn: "isValidHostLabel",
argv: [
{
ref: "outpostId",
},
false,
],
},
],
type: "tree",
rules: [
{
conditions: [],
type: "tree",
rules: [
{
conditions: [
{
fn: "stringEquals",
argv: [
{
ref: "hardwareType",
},
"e",
],
},
],
type: "tree",
rules: [
{
conditions: [
{
fn: "stringEquals",
argv: [
{
ref: "regionPrefix",
},
"beta",
],
},
],
type: "tree",
rules: [
{
conditions: [
{
fn: "not",
argv: [
{
fn: "isSet",
argv: [
{
ref: "Endpoint",
},
],
},
],
},
],
error: "Expected a endpoint to be specified but no endpoint was found",
type: "error",
},
{
conditions: [
{
fn: "isSet",
argv: [
{
ref: "Endpoint",
},
],
},
{
fn: "parseURL",
argv: [
{
ref: "Endpoint",
},
],
assign: "url",
},
],
endpoint: {
url: "https://{Bucket}.ec2.{url#authority}",
properties: {
authSchemes: [
{
name: "sigv4",
signingName: "s3-outposts",
disableDoubleEncoding: true,
signingRegion: "{Region}",
},
],
},
headers: {},
},
type: "endpoint",
},
],
},
{
conditions: [],
endpoint: {
url: "https://{Bucket}.ec2.s3-outposts.{Region}.{regionPartition#dnsSuffix}",
properties: {
authSchemes: [
{
name: "sigv4",
signingName: "s3-outposts",
disableDoubleEncoding: true,
signingRegion: "{Region}",
},
],
},
headers: {},
},
type: "endpoint",
},
],
},
{
conditions: [
{
fn: "stringEquals",
argv: [
{
ref: "hardwareType",
},
"o",
],
},
],
type: "tree",
rules: [
{
conditions: [
{
fn: "stringEquals",
argv: [
{
ref: "regionPrefix",
},
"beta",
],
},
],
type: "tree",
rules: [
{
conditions: [
{
fn: "not",
argv: [
{
fn: "isSet",
argv: [
{
ref: "Endpoint",
},
],
},
],
},
],
error: "Expected a endpoint to be specified but no endpoint was found",
type: "error",
},
{
conditions: [
{
fn: "isSet",
argv: [
{
ref: "Endpoint",
},
],
},
{
fn: "parseURL",
argv: [
{
ref: "Endpoint",
},
],
assign: "url",
},
],
endpoint: {
url: "https://{Bucket}.op-{outpostId}.{url#authority}",
properties: {
authSchemes: [
{
name: "sigv4",
signingName: "s3-outposts",
disableDoubleEncoding: true,
signingRegion: "{Region}",
},
],
},
headers: {},
},
type: "endpoint",
},
],
},
{
conditions: [],
endpoint: {
url: "https://{Bucket}.op-{outpostId}.s3-outposts.{Region}.{regionPartition#dnsSuffix}",
properties: {
authSchemes: [
{
name: "sigv4",
signingName: "s3-outposts",
disableDoubleEncoding: true,
signingRegion: "{Region}",
},
],
},
headers: {},
},
type: "endpoint",
},
],
},
{
conditions: [],
error: `Unrecognized hardware type: "Expected hardware type o or e but got {hardwareType}"`,
type: "error",
},
],
},
],
},
{
conditions: [],
error: "Invalid ARN: The outpost Id must only contain a-z, A-Z, 0-9 and `-`.",
type: "error",
},
],
},
{
conditions: [
{
fn: "isSet",
argv: [
{
ref: "Bucket",
},
],
},
],
type: "tree",
rules: [
{
conditions: [
{
fn: "isSet",
argv: [
{
ref: "Endpoint",
},
],
},
{
fn: "not",
argv: [
{
fn: "isSet",
argv: [
{
fn: "parseURL",
argv: [
{
ref: "Endpoint",
},
],
},
],
},
],
},
],
error: "Custom endpoint `{Endpoint}` was not a valid URI",
type: "error",
},
{
conditions: [],
type: "tree",
rules: [
{
conditions: [
{
fn: "isSet",
argv: [
{
ref: "ForcePathStyle",
},
],
},
{
fn: "booleanEquals",
argv: [
{
ref: "ForcePathStyle",
},
true,
],
},
],
type: "tree",
rules: [
{
conditions: [],
type: "tree",
rules: [
{
conditions: [
{
fn: "aws.parseArn",
argv: [
{
ref: "Bucket",
},
],
},
],
error: "Path-style addressing cannot be used with ARN buckets",
type: "error",
},
{
conditions: [
{
fn: "uriEncode",
argv: [
{
ref: "Bucket",
},
],
assign: "uri_encoded_bucket",
},
],
type: "tree",
rules: [
{
conditions: [
{
fn: "booleanEquals",
argv: [
{
ref: "UseDualStack",
},
true,
],
},
{
fn: "isSet",
argv: [
{
ref: "Endpoint",
},
],
},
],
error: "Cannot set dual-stack in combination with a custom endpoint.",
type: "error",
},
{
conditions: [],
type: "tree",
rules: [
{
conditions: [
{
fn: "aws.partition",
argv: [
{
ref: "Region",
},
],
assign: "partitionResult",
},
],
type: "tree",
rules: [
{
conditions: [],
type: "tree",
rules: [
{
conditions: [
{
fn: "booleanEquals",
argv: [
{
ref: "Accelerate",
},
false,
],
},
],
type: "tree",
rules: [
{
conditions: [],
type: "tree",
rules: [
{
conditions: [
{
fn: "booleanEquals",
argv: [
{
ref: "UseFIPS",
},
false,
],
},
],
type: "tree",
rules: [
{
conditions: [],
type: "tree",
rules: [
{
conditions: [
{
fn: "booleanEquals",
argv: [
{
ref: "UseDualStack",
},
true,
],
},
{
fn: "not",
argv: [
{
fn: "isSet",
argv: [
{
ref: "Endpoint",
},
],
},
],
},
{
fn: "stringEquals",
argv: [
{
ref: "Region",
},
"aws-global",
],
},
],
endpoint: {
url: "https://s3.dualstack.us-east-1.{partitionResult#dnsSuffix}/{uri_encoded_bucket}",
properties: {