From a39132cfda8e42c53226c3936a4a8b84a60fb44e Mon Sep 17 00:00:00 2001 From: awstools Date: Fri, 20 Sep 2024 18:17:07 +0000 Subject: [PATCH] feat(client-dynamodb): Generate account endpoint for DynamoDB requests when the account ID is available --- clients/client-dynamodb/src/DynamoDBClient.ts | 6 + .../src/endpoint/EndpointParameters.ts | 6 + .../src/endpoint/endpointResolver.ts | 2 +- .../client-dynamodb/src/endpoint/ruleset.ts | 67 +- .../src/runtimeConfig.browser.ts | 2 + clients/client-dynamodb/src/runtimeConfig.ts | 3 + codegen/sdk-codegen/aws-models/dynamodb.json | 1276 ++++++++++++++++- 7 files changed, 1293 insertions(+), 69 deletions(-) diff --git a/clients/client-dynamodb/src/DynamoDBClient.ts b/clients/client-dynamodb/src/DynamoDBClient.ts index 814cdb0190b0..dd5540cf7a59 100644 --- a/clients/client-dynamodb/src/DynamoDBClient.ts +++ b/clients/client-dynamodb/src/DynamoDBClient.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { AccountIdEndpointMode } from "@aws-sdk/core/account-id-endpoint"; import { EndpointDiscoveryInputConfig, EndpointDiscoveryResolvedConfig, @@ -402,6 +403,11 @@ export interface ClientDefaults extends Partial<__SmithyConfiguration<__HttpHand */ region?: string | __Provider; + /** + * Defines if the AWS AccountId will be used for endpoint routing. + */ + accountIdEndpointMode?: AccountIdEndpointMode | __Provider; + /** * The provider populating default tracking information to be sent with `user-agent`, `x-amz-user-agent` header * @internal diff --git a/clients/client-dynamodb/src/endpoint/EndpointParameters.ts b/clients/client-dynamodb/src/endpoint/EndpointParameters.ts index 1f9f859e550e..a31f1295d860 100644 --- a/clients/client-dynamodb/src/endpoint/EndpointParameters.ts +++ b/clients/client-dynamodb/src/endpoint/EndpointParameters.ts @@ -9,6 +9,8 @@ export interface ClientInputEndpointParameters { useDualstackEndpoint?: boolean | Provider; useFipsEndpoint?: boolean | Provider; endpoint?: string | Provider | Endpoint | Provider | EndpointV2 | Provider; + accountId?: string | Provider; + accountIdEndpointMode?: string | Provider; } export type ClientResolvedEndpointParameters = ClientInputEndpointParameters & { @@ -28,9 +30,11 @@ export const resolveClientEndpointParameters = ( export const commonParams = { UseFIPS: { type: "builtInParams", name: "useFipsEndpoint" }, + AccountId: { type: "builtInParams", name: "accountId" }, Endpoint: { type: "builtInParams", name: "endpoint" }, Region: { type: "builtInParams", name: "region" }, UseDualStack: { type: "builtInParams", name: "useDualstackEndpoint" }, + AccountIdEndpointMode: { type: "builtInParams", name: "accountIdEndpointMode" }, } as const; export interface EndpointParameters extends __EndpointParameters { @@ -38,4 +42,6 @@ export interface EndpointParameters extends __EndpointParameters { UseDualStack?: boolean; UseFIPS?: boolean; Endpoint?: string; + AccountId?: string; + AccountIdEndpointMode?: string; } diff --git a/clients/client-dynamodb/src/endpoint/endpointResolver.ts b/clients/client-dynamodb/src/endpoint/endpointResolver.ts index ccee107f30d6..35fda91d43f1 100644 --- a/clients/client-dynamodb/src/endpoint/endpointResolver.ts +++ b/clients/client-dynamodb/src/endpoint/endpointResolver.ts @@ -8,7 +8,7 @@ import { ruleSet } from "./ruleset"; const cache = new EndpointCache({ size: 50, - params: ["Endpoint", "Region", "UseDualStack", "UseFIPS"], + params: ["AccountId", "AccountIdEndpointMode", "Endpoint", "Region", "UseDualStack", "UseFIPS"], }); export const defaultEndpointResolver = ( diff --git a/clients/client-dynamodb/src/endpoint/ruleset.ts b/clients/client-dynamodb/src/endpoint/ruleset.ts index 0a841c51cefa..01abfd47f74d 100644 --- a/clients/client-dynamodb/src/endpoint/ruleset.ts +++ b/clients/client-dynamodb/src/endpoint/ruleset.ts @@ -6,31 +6,46 @@ import { RuleSetObject } from "@smithy/types"; or see "smithy.rules#endpointRuleSet" in codegen/sdk-codegen/aws-models/dynamodb.json */ -const w="required", -x="fn", -y="argv", -z="ref"; -const a=true, +const H="required", +I="type", +J="fn", +K="argv", +L="ref", +M="url", +N="properties", +O="headers"; +const a=false, b="isSet", -c="booleanEquals", -d="error", -e="endpoint", -f="tree", -g="PartitionResult", -h="getAttr", -i="stringEquals", -j={[w]:false,"type":"String"}, -k={[w]:true,"default":false,"type":"Boolean"}, -l={[z]:"Endpoint"}, -m={[x]:c,[y]:[{[z]:"UseFIPS"},true]}, -n={[x]:c,[y]:[{[z]:"UseDualStack"},true]}, -o={}, -p={[z]:"Region"}, -q={[x]:h,[y]:[{[z]:g},"supportsFIPS"]}, -r={[z]:g}, -s={[x]:c,[y]:[true,{[x]:h,[y]:[r,"supportsDualStack"]}]}, -t=[m], -u=[n], -v=[p]; -const _data={version:"1.0",parameters:{Region:j,UseDualStack:k,UseFIPS:k,Endpoint:j},rules:[{conditions:[{[x]:b,[y]:[l]}],rules:[{conditions:t,error:"Invalid Configuration: FIPS and custom endpoint are not supported",type:d},{conditions:u,error:"Invalid Configuration: Dualstack and custom endpoint are not supported",type:d},{endpoint:{url:l,properties:o,headers:o},type:e}],type:f},{conditions:[{[x]:b,[y]:v}],rules:[{conditions:[{[x]:"aws.partition",[y]:v,assign:g}],rules:[{conditions:[m,n],rules:[{conditions:[{[x]:c,[y]:[a,q]},s],rules:[{endpoint:{url:"https://dynamodb-fips.{Region}.{PartitionResult#dualStackDnsSuffix}",properties:o,headers:o},type:e}],type:f},{error:"FIPS and DualStack are enabled, but this partition does not support one or both",type:d}],type:f},{conditions:t,rules:[{conditions:[{[x]:c,[y]:[q,a]}],rules:[{conditions:[{[x]:i,[y]:[{[x]:h,[y]:[r,"name"]},"aws-us-gov"]}],endpoint:{url:"https://dynamodb.{Region}.amazonaws.com",properties:o,headers:o},type:e},{endpoint:{url:"https://dynamodb-fips.{Region}.{PartitionResult#dnsSuffix}",properties:o,headers:o},type:e}],type:f},{error:"FIPS is enabled but this partition does not support FIPS",type:d}],type:f},{conditions:u,rules:[{conditions:[s],rules:[{endpoint:{url:"https://dynamodb.{Region}.{PartitionResult#dualStackDnsSuffix}",properties:o,headers:o},type:e}],type:f},{error:"DualStack is enabled but this partition does not support DualStack",type:d}],type:f},{conditions:[{[x]:i,[y]:[p,"local"]}],endpoint:{url:"http://localhost:8000",properties:{authSchemes:[{name:"sigv4",signingName:"dynamodb",signingRegion:"us-east-1"}]},headers:o},type:e},{endpoint:{url:"https://dynamodb.{Region}.{PartitionResult#dnsSuffix}",properties:o,headers:o},type:e}],type:f}],type:f},{error:"Invalid Configuration: Missing Region",type:d}]}; +c="error", +d="endpoint", +e="tree", +f="PartitionResult", +g="stringEquals", +h="not", +i={[H]:false,[I]:"String"}, +j={[H]:true,"default":false,[I]:"Boolean"}, +k={[J]:"booleanEquals",[K]:[{[L]:"UseFIPS"},true]}, +l={[J]:"booleanEquals",[K]:[{[L]:"UseDualStack"},true]}, +m={}, +n={[L]:"Region"}, +o={[J]:b,[K]:[{[L]:"AccountIdEndpointMode"}]}, +p={[L]:"AccountIdEndpointMode"}, +q={[J]:b,[K]:[{[L]:"AccountId"}]}, +r={[L]:"AccountId"}, +s={[J]:g,[K]:[{[J]:"getAttr",[K]:[{[L]:f},"name"]},"aws"]}, +t={[J]:"getAttr",[K]:[{[L]:f},"name"]}, +u={[J]:h,[K]:[k]}, +v={[J]:h,[K]:[l]}, +w={[J]:"booleanEquals",[K]:[{[J]:"getAttr",[K]:[{[L]:f},"supportsFIPS"]},true]}, +x={[J]:"booleanEquals",[K]:[{[J]:"getAttr",[K]:[{[L]:f},"supportsDualStack"]},true]}, +y={[M]:"https://dynamodb-fips.{Region}.{PartitionResult#dualStackDnsSuffix}",[N]:{},[O]:{}}, +z={"conditions":[o,{[J]:g,[K]:[p,"disabled"]}],[d]:{[M]:"https://dynamodb.{Region}.{PartitionResult#dnsSuffix}",[N]:{},[O]:{}},[I]:d}, +A={[d]:{[M]:"https://dynamodb.{Region}.{PartitionResult#dnsSuffix}",[N]:{},[O]:{}},[I]:d}, +B={[M]:"https://dynamodb-fips.{Region}.{PartitionResult#dnsSuffix}",[N]:{},[O]:{}}, +C={[M]:"https://dynamodb.{Region}.{PartitionResult#dualStackDnsSuffix}",[N]:{},[O]:{}}, +D=[k], +E=[l], +F=[n], +G=[o,{[J]:g,[K]:[p,"disabled"]}]; +const _data={version:"1.0",parameters:{Region:i,UseDualStack:j,UseFIPS:j,Endpoint:i,AccountId:i,AccountIdEndpointMode:i},rules:[{conditions:[{[J]:b,[K]:[{[L]:"Endpoint"}]}],rules:[{conditions:D,error:"Invalid Configuration: FIPS and custom endpoint are not supported",[I]:c},{conditions:E,error:"Invalid Configuration: Dualstack and custom endpoint are not supported",[I]:c},{endpoint:{[M]:"{Endpoint}",[N]:m,[O]:m},[I]:d}],[I]:e},{conditions:[{[J]:b,[K]:F}],rules:[{conditions:[{[J]:"aws.partition",[K]:F,assign:f}],rules:[{conditions:[{[J]:g,[K]:[n,"local"]}],rules:[{conditions:D,error:"Invalid Configuration: FIPS and local endpoint are not supported",[I]:c},{conditions:E,error:"Invalid Configuration: Dualstack and local endpoint are not supported",[I]:c},{endpoint:{[M]:"http://localhost:8000",[N]:{authSchemes:[{name:"sigv4",signingName:"dynamodb",signingRegion:"us-east-1"}]},[O]:m},[I]:d}],[I]:e},{conditions:[o,{[J]:g,[K]:[p,"required"]},{[J]:h,[K]:[q]}],error:"AccountIdEndpointMode is required but no AccountID was provided or able to be loaded.",[I]:c},{conditions:[q,s,u,v,{[J]:h,[K]:[{[J]:"isValidHostLabel",[K]:[r,a]}]}],error:"Credentials-sourced account ID parameter is invalid",[I]:c},{conditions:[k,l],rules:[{conditions:[w,x],rules:[{conditions:G,endpoint:y,[I]:d},{endpoint:y,[I]:d}],[I]:e},{error:"FIPS and DualStack are enabled, but this partition does not support one or both",[I]:c}],[I]:e},{conditions:D,rules:[{conditions:[w],rules:[{conditions:[{[J]:g,[K]:[t,"aws-us-gov"]}],rules:[z,A],[I]:e},{conditions:G,endpoint:B,[I]:d},{endpoint:B,[I]:d}],[I]:e},{error:"FIPS is enabled but this partition does not support FIPS",[I]:c}],[I]:e},{conditions:E,rules:[{conditions:[x],rules:[{conditions:G,endpoint:C,[I]:d},{endpoint:C,[I]:d}],[I]:e},{error:"DualStack is enabled but this partition does not support DualStack",[I]:c}],[I]:e},z,{conditions:[q,s,u,v],endpoint:{[M]:"https://{AccountId}.ddb.{Region}.{PartitionResult#dnsSuffix}",[N]:m,[O]:m},[I]:d},A],[I]:e}],[I]:e},{error:"Invalid Configuration: Missing Region",[I]:c}]}; export const ruleSet: RuleSetObject = _data; diff --git a/clients/client-dynamodb/src/runtimeConfig.browser.ts b/clients/client-dynamodb/src/runtimeConfig.browser.ts index f99d2dd7bc5a..e5b03504886a 100644 --- a/clients/client-dynamodb/src/runtimeConfig.browser.ts +++ b/clients/client-dynamodb/src/runtimeConfig.browser.ts @@ -3,6 +3,7 @@ import packageInfo from "../package.json"; // eslint-disable-line import { Sha256 } from "@aws-crypto/sha256-browser"; +import { DEFAULT_ACCOUNT_ID_ENDPOINT_MODE } from "@aws-sdk/core/account-id-endpoint"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { DEFAULT_USE_DUALSTACK_ENDPOINT, DEFAULT_USE_FIPS_ENDPOINT } from "@smithy/config-resolver"; import { FetchHttpHandler as RequestHandler, streamCollector } from "@smithy/fetch-http-handler"; @@ -26,6 +27,7 @@ export const getRuntimeConfig = (config: DynamoDBClientConfig) => { ...config, runtime: "browser", defaultsMode, + accountIdEndpointMode: config?.accountIdEndpointMode ?? (() => Promise.resolve(DEFAULT_ACCOUNT_ID_ENDPOINT_MODE)), bodyLengthChecker: config?.bodyLengthChecker ?? calculateBodyLength, credentialDefaultProvider: config?.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), diff --git a/clients/client-dynamodb/src/runtimeConfig.ts b/clients/client-dynamodb/src/runtimeConfig.ts index 6e156d1ed12f..7485dfd6aee0 100644 --- a/clients/client-dynamodb/src/runtimeConfig.ts +++ b/clients/client-dynamodb/src/runtimeConfig.ts @@ -3,6 +3,7 @@ import packageInfo from "../package.json"; // eslint-disable-line import { emitWarningIfUnsupportedVersion as awsCheckVersion } from "@aws-sdk/core"; +import { NODE_ACCOUNT_ID_ENDPOINT_MODE_CONFIG_OPTIONS } from "@aws-sdk/core/account-id-endpoint"; import { defaultProvider as credentialDefaultProvider } from "@aws-sdk/credential-provider-node"; import { NODE_ENDPOINT_DISCOVERY_CONFIG_OPTIONS } from "@aws-sdk/middleware-endpoint-discovery"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -38,6 +39,8 @@ export const getRuntimeConfig = (config: DynamoDBClientConfig) => { ...config, runtime: "node", defaultsMode, + accountIdEndpointMode: + config?.accountIdEndpointMode ?? loadNodeConfig(NODE_ACCOUNT_ID_ENDPOINT_MODE_CONFIG_OPTIONS), bodyLengthChecker: config?.bodyLengthChecker ?? calculateBodyLength, credentialDefaultProvider: config?.credentialDefaultProvider ?? credentialDefaultProvider, defaultUserAgentProvider: diff --git a/codegen/sdk-codegen/aws-models/dynamodb.json b/codegen/sdk-codegen/aws-models/dynamodb.json index 7b2af2bd4add..c3358460c8ab 100644 --- a/codegen/sdk-codegen/aws-models/dynamodb.json +++ b/codegen/sdk-codegen/aws-models/dynamodb.json @@ -3882,6 +3882,18 @@ "required": false, "documentation": "Override the endpoint used to send this request", "type": "String" + }, + "AccountId": { + "builtIn": "AWS::Auth::AccountId", + "required": false, + "documentation": "The AWS AccountId used for the request.", + "type": "String" + }, + "AccountIdEndpointMode": { + "builtIn": "AWS::Auth::AccountIdEndpointMode", + "required": false, + "documentation": "The AccountId Endpoint Mode.", + "type": "String" } }, "rules": [ @@ -3930,9 +3942,7 @@ { "conditions": [], "endpoint": { - "url": { - "ref": "Endpoint" - }, + "url": "{Endpoint}", "properties": {}, "headers": {} }, @@ -3966,6 +3976,176 @@ } ], "rules": [ + { + "conditions": [ + { + "fn": "stringEquals", + "argv": [ + { + "ref": "Region" + }, + "local" + ] + } + ], + "rules": [ + { + "conditions": [ + { + "fn": "booleanEquals", + "argv": [ + { + "ref": "UseFIPS" + }, + true + ] + } + ], + "error": "Invalid Configuration: FIPS and local endpoint are not supported", + "type": "error" + }, + { + "conditions": [ + { + "fn": "booleanEquals", + "argv": [ + { + "ref": "UseDualStack" + }, + true + ] + } + ], + "error": "Invalid Configuration: Dualstack and local endpoint are not supported", + "type": "error" + }, + { + "conditions": [], + "endpoint": { + "url": "http://localhost:8000", + "properties": { + "authSchemes": [ + { + "name": "sigv4", + "signingName": "dynamodb", + "signingRegion": "us-east-1" + } + ] + }, + "headers": {} + }, + "type": "endpoint" + } + ], + "type": "tree" + }, + { + "conditions": [ + { + "fn": "isSet", + "argv": [ + { + "ref": "AccountIdEndpointMode" + } + ] + }, + { + "fn": "stringEquals", + "argv": [ + { + "ref": "AccountIdEndpointMode" + }, + "required" + ] + }, + { + "fn": "not", + "argv": [ + { + "fn": "isSet", + "argv": [ + { + "ref": "AccountId" + } + ] + } + ] + } + ], + "error": "AccountIdEndpointMode is required but no AccountID was provided or able to be loaded.", + "type": "error" + }, + { + "conditions": [ + { + "fn": "isSet", + "argv": [ + { + "ref": "AccountId" + } + ] + }, + { + "fn": "stringEquals", + "argv": [ + { + "fn": "getAttr", + "argv": [ + { + "ref": "PartitionResult" + }, + "name" + ] + }, + "aws" + ] + }, + { + "fn": "not", + "argv": [ + { + "fn": "booleanEquals", + "argv": [ + { + "ref": "UseFIPS" + }, + true + ] + } + ] + }, + { + "fn": "not", + "argv": [ + { + "fn": "booleanEquals", + "argv": [ + { + "ref": "UseDualStack" + }, + true + ] + } + ] + }, + { + "fn": "not", + "argv": [ + { + "fn": "isValidHostLabel", + "argv": [ + { + "ref": "AccountId" + }, + false + ] + } + ] + } + ], + "error": "Credentials-sourced account ID parameter is invalid", + "type": "error" + }, { "conditions": [ { @@ -3993,7 +4173,6 @@ { "fn": "booleanEquals", "argv": [ - true, { "fn": "getAttr", "argv": [ @@ -4002,13 +4181,13 @@ }, "supportsFIPS" ] - } + }, + true ] }, { "fn": "booleanEquals", "argv": [ - true, { "fn": "getAttr", "argv": [ @@ -4017,11 +4196,39 @@ }, "supportsDualStack" ] - } + }, + true ] } ], "rules": [ + { + "conditions": [ + { + "fn": "isSet", + "argv": [ + { + "ref": "AccountIdEndpointMode" + } + ] + }, + { + "fn": "stringEquals", + "argv": [ + { + "ref": "AccountIdEndpointMode" + }, + "disabled" + ] + } + ], + "endpoint": { + "url": "https://dynamodb-fips.{Region}.{PartitionResult#dualStackDnsSuffix}", + "properties": {}, + "headers": {} + }, + "type": "endpoint" + }, { "conditions": [], "endpoint": { @@ -4092,8 +4299,68 @@ ] } ], + "rules": [ + { + "conditions": [ + { + "fn": "isSet", + "argv": [ + { + "ref": "AccountIdEndpointMode" + } + ] + }, + { + "fn": "stringEquals", + "argv": [ + { + "ref": "AccountIdEndpointMode" + }, + "disabled" + ] + } + ], + "endpoint": { + "url": "https://dynamodb.{Region}.{PartitionResult#dnsSuffix}", + "properties": {}, + "headers": {} + }, + "type": "endpoint" + }, + { + "conditions": [], + "endpoint": { + "url": "https://dynamodb.{Region}.{PartitionResult#dnsSuffix}", + "properties": {}, + "headers": {} + }, + "type": "endpoint" + } + ], + "type": "tree" + }, + { + "conditions": [ + { + "fn": "isSet", + "argv": [ + { + "ref": "AccountIdEndpointMode" + } + ] + }, + { + "fn": "stringEquals", + "argv": [ + { + "ref": "AccountIdEndpointMode" + }, + "disabled" + ] + } + ], "endpoint": { - "url": "https://dynamodb.{Region}.amazonaws.com", + "url": "https://dynamodb-fips.{Region}.{PartitionResult#dnsSuffix}", "properties": {}, "headers": {} }, @@ -4137,7 +4404,6 @@ { "fn": "booleanEquals", "argv": [ - true, { "fn": "getAttr", "argv": [ @@ -4146,11 +4412,39 @@ }, "supportsDualStack" ] - } + }, + true ] } ], "rules": [ + { + "conditions": [ + { + "fn": "isSet", + "argv": [ + { + "ref": "AccountIdEndpointMode" + } + ] + }, + { + "fn": "stringEquals", + "argv": [ + { + "ref": "AccountIdEndpointMode" + }, + "disabled" + ] + } + ], + "endpoint": { + "url": "https://dynamodb.{Region}.{PartitionResult#dualStackDnsSuffix}", + "properties": {}, + "headers": {} + }, + "type": "endpoint" + }, { "conditions": [], "endpoint": { @@ -4173,52 +4467,113 @@ }, { "conditions": [ + { + "fn": "isSet", + "argv": [ + { + "ref": "AccountIdEndpointMode" + } + ] + }, { "fn": "stringEquals", "argv": [ { - "ref": "Region" + "ref": "AccountIdEndpointMode" }, - "local" + "disabled" ] } ], - "endpoint": { - "url": "http://localhost:8000", - "properties": { - "authSchemes": [ - { - "name": "sigv4", - "signingName": "dynamodb", - "signingRegion": "us-east-1" - } - ] - }, - "headers": {} - }, - "type": "endpoint" - }, - { - "conditions": [], "endpoint": { "url": "https://dynamodb.{Region}.{PartitionResult#dnsSuffix}", "properties": {}, "headers": {} }, "type": "endpoint" - } - ], - "type": "tree" - } - ], - "type": "tree" - }, - { - "conditions": [], - "error": "Invalid Configuration: Missing Region", - "type": "error" - } - ] + }, + { + "conditions": [ + { + "fn": "isSet", + "argv": [ + { + "ref": "AccountId" + } + ] + }, + { + "fn": "stringEquals", + "argv": [ + { + "fn": "getAttr", + "argv": [ + { + "ref": "PartitionResult" + }, + "name" + ] + }, + "aws" + ] + }, + { + "fn": "not", + "argv": [ + { + "fn": "booleanEquals", + "argv": [ + { + "ref": "UseFIPS" + }, + true + ] + } + ] + }, + { + "fn": "not", + "argv": [ + { + "fn": "booleanEquals", + "argv": [ + { + "ref": "UseDualStack" + }, + true + ] + } + ] + } + ], + "endpoint": { + "url": "https://{AccountId}.ddb.{Region}.{PartitionResult#dnsSuffix}", + "properties": {}, + "headers": {} + }, + "type": "endpoint" + }, + { + "conditions": [], + "endpoint": { + "url": "https://dynamodb.{Region}.{PartitionResult#dnsSuffix}", + "properties": {}, + "headers": {} + }, + "type": "endpoint" + } + ], + "type": "tree" + } + ], + "type": "tree" + }, + { + "conditions": [], + "error": "Invalid Configuration: Missing Region", + "type": "error" + } + ] }, "smithy.rules#endpointTests": { "testCases": [ @@ -4929,6 +5284,843 @@ "expect": { "error": "Invalid Configuration: Missing Region" } + }, + { + "documentation": "For custom endpoint with account ID available, FIPS enabled, and DualStack enabled", + "expect": { + "error": "Invalid Configuration: FIPS and custom endpoint are not supported" + }, + "params": { + "AccountId": "012345678901", + "UseFIPS": true, + "UseDualStack": true, + "Endpoint": "https://example.com" + } + }, + { + "documentation": "For custom endpoint with account ID available, FIPS enabled, and DualStack disabled", + "expect": { + "error": "Invalid Configuration: FIPS and custom endpoint are not supported" + }, + "params": { + "AccountId": "012345678901", + "UseFIPS": true, + "UseDualStack": false, + "Endpoint": "https://example.com" + } + }, + { + "documentation": "For custom endpoint with account ID available, FIPS disabled, and DualStack enabled", + "expect": { + "error": "Invalid Configuration: Dualstack and custom endpoint are not supported" + }, + "params": { + "AccountId": "012345678901", + "UseFIPS": false, + "UseDualStack": true, + "Endpoint": "https://example.com" + } + }, + { + "documentation": "For custom endpoint with account ID available, FIPS disabled, and DualStack disabled", + "expect": { + "endpoint": { + "url": "https://example.com" + } + }, + "operationInputs": [ + { + "builtInParams": { + "SDK::Endpoint": "https://example.com", + "AWS::Auth::AccountId": "012345678901" + }, + "operationName": "ListTables" + } + ], + "params": { + "AccountId": "012345678901", + "UseFIPS": false, + "UseDualStack": false, + "Endpoint": "https://example.com" + } + }, + { + "documentation": "For custom endpoint with empty account ID available, FIPS disabled, and DualStack disabled", + "expect": { + "endpoint": { + "url": "https://example.com" + } + }, + "operationInputs": [ + { + "builtInParams": { + "SDK::Endpoint": "https://example.com", + "AWS::Auth::AccountId": "" + }, + "operationName": "ListTables" + } + ], + "params": { + "AccountId": "", + "UseFIPS": false, + "UseDualStack": false, + "Endpoint": "https://example.com" + } + }, + { + "documentation": "For region local with account ID available, FIPS enabled, and DualStack enabled", + "expect": { + "error": "Invalid Configuration: FIPS and local endpoint are not supported" + }, + "params": { + "Region": "local", + "AccountId": "012345678901", + "UseFIPS": true, + "UseDualStack": true + } + }, + { + "documentation": "For region local with account ID available, FIPS enabled, and DualStack disabled", + "expect": { + "error": "Invalid Configuration: FIPS and local endpoint are not supported" + }, + "params": { + "Region": "local", + "AccountId": "012345678901", + "UseFIPS": true, + "UseDualStack": false + } + }, + { + "documentation": "For region local with account ID available, FIPS disabled, and DualStack enabled", + "expect": { + "error": "Invalid Configuration: Dualstack and local endpoint are not supported" + }, + "params": { + "Region": "local", + "AccountId": "012345678901", + "UseFIPS": false, + "UseDualStack": true + } + }, + { + "documentation": "For region local with account ID available, FIPS disabled, and DualStack disabled", + "expect": { + "endpoint": { + "properties": { + "authSchemes": [ + { + "name": "sigv4", + "signingName": "dynamodb", + "signingRegion": "us-east-1" + } + ] + }, + "url": "http://localhost:8000" + } + }, + "operationInputs": [ + { + "builtInParams": { + "AWS::Region": "local", + "AWS::Auth::AccountId": "012345678901" + }, + "operationName": "ListTables" + } + ], + "params": { + "Region": "local", + "AccountId": "012345678901", + "UseFIPS": false, + "UseDualStack": false + } + }, + { + "documentation": "For region local with empty account ID available, FIPS disabled, and DualStack disabled", + "expect": { + "endpoint": { + "properties": { + "authSchemes": [ + { + "name": "sigv4", + "signingName": "dynamodb", + "signingRegion": "us-east-1" + } + ] + }, + "url": "http://localhost:8000" + } + }, + "operationInputs": [ + { + "builtInParams": { + "AWS::Region": "local", + "AWS::Auth::AccountId": "" + }, + "operationName": "ListTables" + } + ], + "params": { + "Region": "local", + "AccountId": "", + "UseFIPS": false, + "UseDualStack": false + } + }, + { + "documentation": "For AccountIdEndpointMode required and no AccountId set", + "expect": { + "error": "AccountIdEndpointMode is required but no AccountID was provided or able to be loaded." + }, + "operationInputs": [ + { + "builtInParams": { + "AWS::Region": "us-east-1", + "AWS::Auth::AccountIdEndpointMode": "required" + }, + "operationName": "ListTables" + } + ], + "params": { + "Region": "us-east-1", + "AccountIdEndpointMode": "required" + } + }, + { + "documentation": "For region us-east-1 with account ID available, FIPS enabled, and DualStack enabled", + "expect": { + "endpoint": { + "url": "https://dynamodb-fips.us-east-1.api.aws" + } + }, + "operationInputs": [ + { + "builtInParams": { + "AWS::Region": "us-east-1", + "AWS::Auth::AccountId": "012345678901", + "AWS::UseFIPS": true, + "AWS::UseDualStack": true + }, + "operationName": "ListTables" + } + ], + "params": { + "Region": "us-east-1", + "AccountId": "012345678901", + "UseFIPS": true, + "UseDualStack": true + } + }, + { + "documentation": "For region us-east-1 with account ID available, FIPS enabled, and DualStack disabled", + "expect": { + "endpoint": { + "url": "https://dynamodb-fips.us-east-1.amazonaws.com" + } + }, + "operationInputs": [ + { + "builtInParams": { + "AWS::Region": "us-east-1", + "AWS::Auth::AccountId": "012345678901", + "AWS::UseFIPS": true + }, + "operationName": "ListTables" + } + ], + "params": { + "Region": "us-east-1", + "AccountId": "012345678901", + "UseFIPS": true, + "UseDualStack": false + } + }, + { + "documentation": "For region us-east-1 with account ID available, AccountIdEndpointMode preferred, FIPS enabled, and DualStack disabled", + "expect": { + "endpoint": { + "url": "https://dynamodb-fips.us-east-1.amazonaws.com" + } + }, + "operationInputs": [ + { + "builtInParams": { + "AWS::Region": "us-east-1", + "AWS::Auth::AccountId": "012345678901", + "AWS::Auth::AccountIdEndpointMode": "preferred", + "AWS::UseFIPS": true + }, + "operationName": "ListTables" + } + ], + "params": { + "Region": "us-east-1", + "AccountId": "012345678901", + "AccountIdEndpointMode": "preferred", + "UseFIPS": true, + "UseDualStack": false + } + }, + { + "documentation": "For region us-east-1 with account ID available, AccountIdEndpointMode required, FIPS enabled, and DualStack disabled", + "expect": { + "endpoint": { + "url": "https://dynamodb-fips.us-east-1.amazonaws.com" + } + }, + "operationInputs": [ + { + "builtInParams": { + "AWS::Region": "us-east-1", + "AWS::Auth::AccountId": "012345678901", + "AWS::Auth::AccountIdEndpointMode": "required", + "AWS::UseFIPS": true + }, + "operationName": "ListTables" + } + ], + "params": { + "Region": "us-east-1", + "AccountId": "012345678901", + "AccountIdEndpointMode": "required", + "UseFIPS": true, + "UseDualStack": false + } + }, + { + "documentation": "For region us-east-1 with account ID available, FIPS disabled, and DualStack enabled", + "expect": { + "endpoint": { + "url": "https://dynamodb.us-east-1.api.aws" + } + }, + "operationInputs": [ + { + "builtInParams": { + "AWS::Region": "us-east-1", + "AWS::Auth::AccountId": "012345678901", + "AWS::UseDualStack": true + }, + "operationName": "ListTables" + } + ], + "params": { + "Region": "us-east-1", + "AccountId": "012345678901", + "UseFIPS": false, + "UseDualStack": true + } + }, + { + "documentation": "For region us-east-1 with account ID available, FIPS disabled, and DualStack enabled", + "expect": { + "endpoint": { + "url": "https://dynamodb.us-east-1.api.aws" + } + }, + "operationInputs": [ + { + "builtInParams": { + "AWS::Region": "us-east-1", + "AWS::Auth::AccountId": "012345678901", + "AWS::UseDualStack": true + }, + "operationName": "ListTables" + } + ], + "params": { + "Region": "us-east-1", + "AccountId": "012345678901", + "UseFIPS": false, + "UseDualStack": true + } + }, + { + "documentation": "For region us-east-1 with account ID available, AccountIdEndpointMode preferred, FIPS disabled, and DualStack enabled", + "expect": { + "endpoint": { + "url": "https://dynamodb.us-east-1.api.aws" + } + }, + "params": { + "Region": "us-east-1", + "AccountId": "012345678901", + "AccountIdEndpointMode": "preferred", + "UseFIPS": false, + "UseDualStack": true + } + }, + { + "documentation": "For region us-east-1 with account ID available, AccountIdEndpointMode disabled, FIPS disabled, and DualStack enabled", + "expect": { + "endpoint": { + "url": "https://dynamodb.us-east-1.api.aws" + } + }, + "params": { + "Region": "us-east-1", + "AccountId": "012345678901", + "AccountIdEndpointMode": "disabled", + "UseFIPS": false, + "UseDualStack": true + } + }, + { + "documentation": "For region us-east-1 with account ID available, AccountIdEndpointMode required, FIPS disabled, and DualStack enabled", + "expect": { + "endpoint": { + "url": "https://dynamodb.us-east-1.api.aws" + } + }, + "params": { + "Region": "us-east-1", + "AccountId": "012345678901", + "AccountIdEndpointMode": "required", + "UseFIPS": false, + "UseDualStack": true + } + }, + { + "documentation": "For region us-east-1 with account ID available, AccountIdEndpointMode preferred, FIPS disabled, and DualStack disabled", + "expect": { + "endpoint": { + "url": "https://012345678901.ddb.us-east-1.amazonaws.com" + } + }, + "operationInputs": [ + { + "builtInParams": { + "AWS::Region": "us-east-1", + "AWS::Auth::AccountId": "012345678901", + "AWS::Auth::AccountIdEndpointMode": "preferred" + }, + "operationName": "ListTables" + } + ], + "params": { + "Region": "us-east-1", + "AccountId": "012345678901", + "UseFIPS": false, + "UseDualStack": false, + "AccountIdEndpointMode": "preferred" + } + }, + { + "documentation": "For region us-east-1 with account ID available, AccountIdEndpointMode required, FIPS disabled, and DualStack disabled", + "expect": { + "endpoint": { + "url": "https://012345678901.ddb.us-east-1.amazonaws.com" + } + }, + "operationInputs": [ + { + "builtInParams": { + "AWS::Region": "us-east-1", + "AWS::Auth::AccountId": "012345678901", + "AWS::Auth::AccountIdEndpointMode": "required" + }, + "operationName": "ListTables" + } + ], + "params": { + "Region": "us-east-1", + "AccountId": "012345678901", + "UseFIPS": false, + "UseDualStack": false, + "AccountIdEndpointMode": "required" + } + }, + { + "documentation": "For region us-east-1 with account ID available, AccountIdEndpointMode disabled, FIPS disabled, and DualStack disabled", + "expect": { + "endpoint": { + "url": "https://dynamodb.us-east-1.amazonaws.com" + } + }, + "operationInputs": [ + { + "builtInParams": { + "AWS::Region": "us-east-1", + "AWS::Auth::AccountId": "012345678901", + "AWS::Auth::AccountIdEndpointMode": "disabled" + }, + "operationName": "ListTables" + } + ], + "params": { + "Region": "us-east-1", + "AccountId": "012345678901", + "UseFIPS": false, + "UseDualStack": false, + "AccountIdEndpointMode": "disabled" + } + }, + { + "documentation": "For region us-east-1 with empty account ID, FIPS disabled, and DualStack disabled", + "expect": { + "error": "Credentials-sourced account ID parameter is invalid" + }, + "operationInputs": [ + { + "builtInParams": { + "AWS::Region": "us-east-1", + "AWS::Auth::AccountId": " " + }, + "operationName": "ListTables" + } + ], + "params": { + "Region": "us-east-1", + "AccountId": "", + "UseFIPS": false, + "UseDualStack": false + } + }, + { + "documentation": "For region cn-north-1 with account ID available, FIPS enabled, and DualStack enabled", + "expect": { + "endpoint": { + "url": "https://dynamodb-fips.cn-north-1.api.amazonwebservices.com.cn" + } + }, + "operationInputs": [ + { + "builtInParams": { + "AWS::Region": "cn-north-1", + "AWS::Auth::AccountId": "012345678901", + "AWS::UseFIPS": true, + "AWS::UseDualStack": true + }, + "operationName": "ListTables" + } + ], + "params": { + "Region": "cn-north-1", + "AccountId": "012345678901", + "UseFIPS": true, + "UseDualStack": true + } + }, + { + "documentation": "For region cn-north-1 with account ID available, FIPS enabled, and DualStack disabled", + "expect": { + "endpoint": { + "url": "https://dynamodb-fips.cn-north-1.amazonaws.com.cn" + } + }, + "operationInputs": [ + { + "builtInParams": { + "AWS::Region": "cn-north-1", + "AWS::Auth::AccountId": "012345678901", + "AWS::UseFIPS": true + }, + "operationName": "ListTables" + } + ], + "params": { + "Region": "cn-north-1", + "AccountId": "012345678901", + "UseFIPS": true, + "UseDualStack": false + } + }, + { + "documentation": "For region cn-north-1 with account ID available, FIPS disabled, and DualStack enabled", + "expect": { + "endpoint": { + "url": "https://dynamodb.cn-north-1.api.amazonwebservices.com.cn" + } + }, + "operationInputs": [ + { + "builtInParams": { + "AWS::Region": "cn-north-1", + "AWS::Auth::AccountId": "012345678901", + "AWS::UseDualStack": true + }, + "operationName": "ListTables" + } + ], + "params": { + "Region": "cn-north-1", + "AccountId": "012345678901", + "UseFIPS": false, + "UseDualStack": true + } + }, + { + "documentation": "For region cn-north-1 with account ID available, FIPS disabled, and DualStack disabled", + "expect": { + "endpoint": { + "url": "https://dynamodb.cn-north-1.amazonaws.com.cn" + } + }, + "operationInputs": [ + { + "builtInParams": { + "AWS::Region": "cn-north-1", + "AWS::Auth::AccountId": "012345678901" + }, + "operationName": "ListTables" + } + ], + "params": { + "Region": "cn-north-1", + "AccountId": "012345678901", + "UseFIPS": false, + "UseDualStack": false + } + }, + { + "documentation": "For region cn-north-1 with account ID available, AccountIdEndpointMode preferred, FIPS disabled, and DualStack disabled", + "expect": { + "endpoint": { + "url": "https://dynamodb.cn-north-1.amazonaws.com.cn" + } + }, + "params": { + "Region": "cn-north-1", + "AccountId": "012345678901", + "AccountIdEndpointMode": "preferred", + "UseFIPS": false, + "UseDualStack": false + } + }, + { + "documentation": "For region cn-north-1 with account ID available, AccountIdEndpointMode disabled, FIPS disabled, and DualStack disabled", + "expect": { + "endpoint": { + "url": "https://dynamodb.cn-north-1.amazonaws.com.cn" + } + }, + "params": { + "Region": "cn-north-1", + "AccountId": "012345678901", + "AccountIdEndpointMode": "disabled", + "UseFIPS": false, + "UseDualStack": false + } + }, + { + "documentation": "For region cn-north-1 with account ID available, AccountIdEndpointMode required, FIPS disabled, and DualStack disabled", + "expect": { + "endpoint": { + "url": "https://dynamodb.cn-north-1.amazonaws.com.cn" + } + }, + "params": { + "Region": "cn-north-1", + "AccountId": "012345678901", + "AccountIdEndpointMode": "required", + "UseFIPS": false, + "UseDualStack": false + } + }, + { + "documentation": "For region cn-north-1 with empty account ID available, FIPS disabled, and DualStack disabled", + "expect": { + "endpoint": { + "url": "https://dynamodb.cn-north-1.amazonaws.com.cn" + } + }, + "operationInputs": [ + { + "builtInParams": { + "AWS::Region": "cn-north-1", + "AWS::Auth::AccountId": "" + }, + "operationName": "ListTables" + } + ], + "params": { + "Region": "cn-north-1", + "AccountId": "", + "UseFIPS": false, + "UseDualStack": false + } + }, + { + "documentation": "For region us-iso-east-1 with account ID available, FIPS enabled, and DualStack enabled", + "expect": { + "error": "FIPS and DualStack are enabled, but this partition does not support one or both" + }, + "params": { + "Region": "us-iso-east-1", + "AccountId": "012345678901", + "UseFIPS": true, + "UseDualStack": true + } + }, + { + "documentation": "For region us-iso-east-1 with account ID available, FIPS enabled, and DualStack disabled", + "expect": { + "endpoint": { + "url": "https://dynamodb-fips.us-iso-east-1.c2s.ic.gov" + } + }, + "operationInputs": [ + { + "builtInParams": { + "AWS::Region": "us-iso-east-1", + "AWS::Auth::AccountId": "012345678901", + "AWS::UseFIPS": true + }, + "operationName": "ListTables" + } + ], + "params": { + "Region": "us-iso-east-1", + "AccountId": "012345678901", + "UseFIPS": true, + "UseDualStack": false + } + }, + { + "documentation": "For region us-iso-east-1 with account ID available, FIPS disabled, and DualStack enabled", + "expect": { + "error": "DualStack is enabled but this partition does not support DualStack" + }, + "params": { + "Region": "us-iso-east-1", + "AccountId": "012345678901", + "UseFIPS": false, + "UseDualStack": true + } + }, + { + "documentation": "For region us-iso-east-1 with account ID available, FIPS disabled, and DualStack disabled", + "expect": { + "endpoint": { + "url": "https://dynamodb.us-iso-east-1.c2s.ic.gov" + } + }, + "operationInputs": [ + { + "builtInParams": { + "AWS::Region": "us-iso-east-1", + "AWS::Auth::AccountId": "012345678901" + }, + "operationName": "ListTables" + } + ], + "params": { + "Region": "us-iso-east-1", + "AccountId": "012345678901", + "UseFIPS": false, + "UseDualStack": false + } + }, + { + "documentation": "For region us-iso-east-1 with empty account ID available, FIPS disabled, and DualStack disabled", + "expect": { + "endpoint": { + "url": "https://dynamodb.us-iso-east-1.c2s.ic.gov" + } + }, + "operationInputs": [ + { + "builtInParams": { + "AWS::Region": "us-iso-east-1", + "AWS::Auth::AccountId": "012345678901" + }, + "operationName": "ListTables" + } + ], + "params": { + "Region": "us-iso-east-1", + "AccountId": "", + "UseFIPS": false, + "UseDualStack": false + } + }, + { + "documentation": "For region us-gov-east-1 with account ID available, FIPS enabled, and DualStack enabled", + "expect": { + "endpoint": { + "url": "https://dynamodb-fips.us-gov-east-1.api.aws" + } + }, + "params": { + "Region": "us-gov-east-1", + "AccountId": "012345678901", + "UseFIPS": true, + "UseDualStack": true + } + }, + { + "documentation": "For region us-gov-east-1 with account ID available, FIPS enabled, and DualStack disabled", + "expect": { + "endpoint": { + "url": "https://dynamodb.us-gov-east-1.amazonaws.com" + } + }, + "params": { + "Region": "us-gov-east-1", + "AccountId": "012345678901", + "UseFIPS": true, + "UseDualStack": false + } + }, + { + "documentation": "For region us-gov-east-1 with account ID available, FIPS disabled, and DualStack enabled", + "expect": { + "endpoint": { + "url": "https://dynamodb.us-gov-east-1.api.aws" + } + }, + "params": { + "Region": "us-gov-east-1", + "AccountId": "012345678901", + "UseFIPS": false, + "UseDualStack": true + } + }, + { + "documentation": "For region us-gov-east-1 with account ID available, FIPS disabled, and DualStack disabled", + "expect": { + "endpoint": { + "url": "https://dynamodb.us-gov-east-1.amazonaws.com" + } + }, + "operationInputs": [ + { + "builtInParams": { + "AWS::Region": "us-gov-east-1", + "AWS::Auth::AccountId": "012345678901" + }, + "operationName": "ListTables" + } + ], + "params": { + "Region": "us-gov-east-1", + "AccountId": "012345678901", + "UseFIPS": false, + "UseDualStack": false + } + }, + { + "documentation": "For region us-gov-east-1 with empty account ID available, FIPS disabled, and DualStack disabled", + "expect": { + "endpoint": { + "url": "https://dynamodb.us-gov-east-1.amazonaws.com" + } + }, + "operationInputs": [ + { + "builtInParams": { + "AWS::Region": "us-gov-east-1", + "AWS::Auth::AccountId": "" + }, + "operationName": "ListTables" + } + ], + "params": { + "Region": "us-gov-east-1", + "AccountId": "", + "UseFIPS": false, + "UseDualStack": false + } } ], "version": "1.0"