From e0f0d9b6c2818a1da0e11c5a49caed6af25697bd Mon Sep 17 00:00:00 2001 From: AWS CDK Team Date: Mon, 21 Oct 2024 21:07:30 +0000 Subject: [PATCH 01/33] chore(release): 2.163.0 --- CHANGELOG.v2.alpha.md | 16 ++++++++++ CHANGELOG.v2.md | 31 ++++++++++++++++++++ packages/aws-cdk-lib/cx-api/FEATURE_FLAGS.md | 4 +-- packages/aws-cdk-lib/cx-api/lib/features.ts | 2 +- version.v2.json | 4 +-- 5 files changed, 52 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.v2.alpha.md b/CHANGELOG.v2.alpha.md index a93422e10ca79..6475212e36ed4 100644 --- a/CHANGELOG.v2.alpha.md +++ b/CHANGELOG.v2.alpha.md @@ -2,6 +2,22 @@ All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. +## [2.163.0-alpha.0](https://github.com/aws/aws-cdk/compare/v2.162.1-alpha.0...v2.163.0-alpha.0) (2024-10-21) + + +### Features + +* **ec2:** disable api termination ([#30620](https://github.com/aws/aws-cdk/issues/30620)) ([108737d](https://github.com/aws/aws-cdk/commit/108737d613e2a2da20a53fe92a4dac2b43d21044)) +* **kinesisfirehose-alpha:** refactor sourceStream property to support multiple types of sources ([#31723](https://github.com/aws/aws-cdk/issues/31723)) ([0260046](https://github.com/aws/aws-cdk/commit/026004682f25d324b5f82b8d0ed92820c55233c1)) +* **pipes-enrichments:** support API destination enrichment ([#31312](https://github.com/aws/aws-cdk/issues/31312)) ([1557793](https://github.com/aws/aws-cdk/commit/1557793f696da77ab592e81165dbbb5c0886e7e2)), closes [#29383](https://github.com/aws/aws-cdk/issues/29383) +* **pipes-targets:** add CloudWatch Logs ([#30665](https://github.com/aws/aws-cdk/issues/30665)) ([893769e](https://github.com/aws/aws-cdk/commit/893769ed22818a6c31ec1bdd58d458f50ba28c48)) + + +### Bug Fixes + +* **ec2:** exposed userDataCausesReplacement in BastionHostLinuxProps ([#31416](https://github.com/aws/aws-cdk/issues/31416)) ([029c298](https://github.com/aws/aws-cdk/commit/029c298db9875214eb16b88689b13f5e244b5ea4)), closes [#31348](https://github.com/aws/aws-cdk/issues/31348) +* **scheduler-alpha:** remove `targetOverrides` prop from Schedule ([#31799](https://github.com/aws/aws-cdk/issues/31799)) ([be4154b](https://github.com/aws/aws-cdk/commit/be4154b3a2bba28700b8476dfb26af54da0bdc6f)) + ## [2.162.1-alpha.0](https://github.com/aws/aws-cdk/compare/v2.162.0-alpha.0...v2.162.1-alpha.0) (2024-10-11) ## [2.162.0-alpha.0](https://github.com/aws/aws-cdk/compare/v2.161.1-alpha.0...v2.162.0-alpha.0) (2024-10-10) diff --git a/CHANGELOG.v2.md b/CHANGELOG.v2.md index e69595316408f..236442df4b2ac 100644 --- a/CHANGELOG.v2.md +++ b/CHANGELOG.v2.md @@ -2,6 +2,37 @@ All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. +## [2.163.0](https://github.com/aws/aws-cdk/compare/v2.162.1...v2.163.0) (2024-10-21) + + +### Features + +* **cli:** garbage collect s3 assets (under `--unstable` flag) ([#31611](https://github.com/aws/aws-cdk/issues/31611)) ([0a0e4ad](https://github.com/aws/aws-cdk/commit/0a0e4ad271197ccec2242d247516616f966a959c)) +* **cognito:** support `emailVerified` for `AttributeMapping` interface ([#31632](https://github.com/aws/aws-cdk/issues/31632)) ([5de7835](https://github.com/aws/aws-cdk/commit/5de783504111b6a04dc8d1da7c67a30200f3e3e5)), closes [#30467](https://github.com/aws/aws-cdk/issues/30467) [#30467](https://github.com/aws/aws-cdk/issues/30467) +* **dynamodb:** enable contributor insights for global secondary index ([#30560](https://github.com/aws/aws-cdk/issues/30560)) ([799b541](https://github.com/aws/aws-cdk/commit/799b541135d0fb9cea31ddf29a8dacc1a94cb0fc)), closes [#15671](https://github.com/aws/aws-cdk/issues/15671) +* **ecs-patterns:** support NLB with TLS listener and target group ([#30611](https://github.com/aws/aws-cdk/issues/30611)) ([f4f8abc](https://github.com/aws/aws-cdk/commit/f4f8abcb2a6df6a26b289b49b7738efce78b2936)), closes [#8517](https://github.com/aws/aws-cdk/issues/8517) +* **efs:** allow AccessPoint to set client token ([#31184](https://github.com/aws/aws-cdk/issues/31184)) ([8208774](https://github.com/aws/aws-cdk/commit/8208774fb9a5f9d58a5fea24e60aa6862e861aba)) +* **events:** dead letter queue for an Event Bus ([#30628](https://github.com/aws/aws-cdk/issues/30628)) ([318eae6](https://github.com/aws/aws-cdk/commit/318eae6c9eca456e0c34ed21855dad9d2bfa2a0f)), closes [#30531](https://github.com/aws/aws-cdk/issues/30531) +* **fsx:** specify file system type version for the Lustre file system ([#31136](https://github.com/aws/aws-cdk/issues/31136)) ([252cca9](https://github.com/aws/aws-cdk/commit/252cca9351be0dc09c242107639dceee74b96898)), closes [#31130](https://github.com/aws/aws-cdk/issues/31130) +* **fsx:** support HDD storage type for a Lustre file systems ([#30207](https://github.com/aws/aws-cdk/issues/30207)) ([2d9aefb](https://github.com/aws/aws-cdk/commit/2d9aefbb6c2c5323d3d2d17e5961fb2300c25fa3)), closes [#30206](https://github.com/aws/aws-cdk/issues/30206) +* **iam:** allow creating service principal using custom name ([#31793](https://github.com/aws/aws-cdk/issues/31793)) ([3d650c3](https://github.com/aws/aws-cdk/commit/3d650c30a2e1a47584b3dacd632269bab2071348)), closes [#31767](https://github.com/aws/aws-cdk/issues/31767) +* **kms:** allow `fromLookup` method to return dummy key if target key was not found ([#31676](https://github.com/aws/aws-cdk/issues/31676)) ([34bdeca](https://github.com/aws/aws-cdk/commit/34bdecad76ac93d7dc4f8321352e851cebc75e17)), closes [#31574](https://github.com/aws/aws-cdk/issues/31574) [/github.com/aws/aws-cdk/blob/v2.161.0/packages/aws-cdk-lib/aws-kms/lib/key.ts#L686](https://github.com/aws//github.com/aws/aws-cdk/blob/v2.161.0/packages/aws-cdk-lib/aws-kms/lib/key.ts/issues/L686) [/github.com/aws/aws-cdk/issues/31574#issuecomment-2399080697](https://github.com/aws//github.com/aws/aws-cdk/issues/31574/issues/issuecomment-2399080697) +* **rds:** support local write forwarding for an aurora PostgreSQL cluster ([#31803](https://github.com/aws/aws-cdk/issues/31803)) ([a32436a](https://github.com/aws/aws-cdk/commit/a32436a5ea834b29faed19f37652fb4dae3fb1d7)), closes [#31802](https://github.com/aws/aws-cdk/issues/31802) +* **s3:** support `transitionDefaultMinimumObjectSize` for life cycle ([#31778](https://github.com/aws/aws-cdk/issues/31778)) ([4aa117b](https://github.com/aws/aws-cdk/commit/4aa117b34c95555ea7d53dfa748a048196bf4044)), closes [#31777](https://github.com/aws/aws-cdk/issues/31777) [/docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-s3-bucket-lifecycleconfiguration.html#cfn-s3](https://github.com/aws//docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-s3-bucket-lifecycleconfiguration.html/issues/cfn-s3) +* update L1 CloudFormation resource definitions ([#31752](https://github.com/aws/aws-cdk/issues/31752)) ([8067294](https://github.com/aws/aws-cdk/commit/8067294f6c378795538d7ed2a8e0741310bec0b9)) +* update L1 CloudFormation resource definitions ([#31800](https://github.com/aws/aws-cdk/issues/31800)) ([fccb006](https://github.com/aws/aws-cdk/commit/fccb0060759af997db1bf2b69a27d1c0d282e28c)) +* **rds:** support performance insights configuration at cluster level ([#31385](https://github.com/aws/aws-cdk/issues/31385)) ([7d6bf77](https://github.com/aws/aws-cdk/commit/7d6bf773d3a8f17d94c4aa5d5aa9025270c254aa)), closes [#31375](https://github.com/aws/aws-cdk/issues/31375) +* disallow cross account asset publishing in some scenarios ([#31623](https://github.com/aws/aws-cdk/issues/31623)) ([edd031d](https://github.com/aws/aws-cdk/commit/edd031d3c76a870991bf8a5f021f8043d6a2b871)) +* **step-functions:** add bucketNamePath in item reader ([#31619](https://github.com/aws/aws-cdk/issues/31619)) ([97130d8](https://github.com/aws/aws-cdk/commit/97130d80824cbbef4323ed7ead00fcfdc61fe7fb)), closes [#29409](https://github.com/aws/aws-cdk/issues/29409) + + +### Bug Fixes + +* **cli:** `cdk import` errors with 'S3 error: Access Denied' ([#31727](https://github.com/aws/aws-cdk/issues/31727)) ([cd324d0](https://github.com/aws/aws-cdk/commit/cd324d028e03215e877f13a26992ebd5a2b4db03)), closes [#31597](https://github.com/aws/aws-cdk/issues/31597) [#31716](https://github.com/aws/aws-cdk/issues/31716) +* **lambda:** filterRule.null() returns empty array ([#31701](https://github.com/aws/aws-cdk/issues/31701)) ([5830ee1](https://github.com/aws/aws-cdk/commit/5830ee1eb29fc025c3ebe1451647c79cef155ea1)), closes [#31458](https://github.com/aws/aws-cdk/issues/31458) +* **s3:** add support for uppercase characters in legacy bucket names ([#31813](https://github.com/aws/aws-cdk/issues/31813)) ([7bebf40](https://github.com/aws/aws-cdk/commit/7bebf400a6e271c3f50402a5e72aff1f1b8be109)), closes [#31731](https://github.com/aws/aws-cdk/issues/31731) [/github.com/aws/aws-cdk/issues/31731#issuecomment-2417649670](https://github.com/aws//github.com/aws/aws-cdk/issues/31731/issues/issuecomment-2417649670) [#31731](https://github.com/aws/aws-cdk/issues/31731) +* **stepfunctions-tasks:** stateMachine construct doesn't generate a valid policy for default StateMachineRole ([#31801](https://github.com/aws/aws-cdk/issues/31801)) ([efbbddb](https://github.com/aws/aws-cdk/commit/efbbddbee370a9b4dba2fbea4c92b44ad39be973)), closes [#31714](https://github.com/aws/aws-cdk/issues/31714) + ## [2.162.1](https://github.com/aws/aws-cdk/compare/v2.162.0...v2.162.1) (2024-10-11) diff --git a/packages/aws-cdk-lib/cx-api/FEATURE_FLAGS.md b/packages/aws-cdk-lib/cx-api/FEATURE_FLAGS.md index 70d1a8ba65fb8..0e959c0a2a5ee 100644 --- a/packages/aws-cdk-lib/cx-api/FEATURE_FLAGS.md +++ b/packages/aws-cdk-lib/cx-api/FEATURE_FLAGS.md @@ -79,7 +79,7 @@ Flags come in three types: | [@aws-cdk/aws-lambda-nodejs:sdkV3ExcludeSmithyPackages](#aws-cdkaws-lambda-nodejssdkv3excludesmithypackages) | When enabled, both `@aws-sdk` and `@smithy` packages will be excluded from the Lambda Node.js 18.x runtime to prevent version mismatches in bundled applications. | 2.161.0 | (fix) | | [@aws-cdk/aws-rds:setCorrectValueForDatabaseInstanceReadReplicaInstanceResourceId](#aws-cdkaws-rdssetcorrectvaluefordatabaseinstancereadreplicainstanceresourceid) | When enabled, the value of property `instanceResourceId` in construct `DatabaseInstanceReadReplica` will be set to the correct value which is `DbiResourceId` instead of currently `DbInstanceArn` | 2.161.0 | (fix) | | [@aws-cdk/core:cfnIncludeRejectComplexResourceUpdateCreatePolicyIntrinsics](#aws-cdkcorecfnincluderejectcomplexresourceupdatecreatepolicyintrinsics) | When enabled, CFN templates added with `cfn-include` will error if the template contains Resource Update or Create policies with CFN Intrinsics that include non-primitive values. | 2.161.0 | (fix) | -| [@aws-cdk/aws-stepfunctions-tasks:fixRunEcsTaskPolicy](#aws-cdkaws-stepfunctions-tasksfixrunecstaskpolicy) | When enabled, the resource of IAM Run Ecs policy generated by SFN EcsRunTask will reference the definition, instead of constructing ARN. | V2NEXT | (fix) | +| [@aws-cdk/aws-stepfunctions-tasks:fixRunEcsTaskPolicy](#aws-cdkaws-stepfunctions-tasksfixrunecstaskpolicy) | When enabled, the resource of IAM Run Ecs policy generated by SFN EcsRunTask will reference the definition, instead of constructing ARN. | 2.163.0 | (fix) | @@ -1506,7 +1506,7 @@ When this feature flag is enabled, if the task definition is created in the stac | Since | Default | Recommended | | ----- | ----- | ----- | | (not in v1) | | | -| V2NEXT | `false` | `true` | +| 2.163.0 | `false` | `true` | diff --git a/packages/aws-cdk-lib/cx-api/lib/features.ts b/packages/aws-cdk-lib/cx-api/lib/features.ts index bbdf865b7627a..7cd1ee4b5e7e0 100644 --- a/packages/aws-cdk-lib/cx-api/lib/features.ts +++ b/packages/aws-cdk-lib/cx-api/lib/features.ts @@ -1231,7 +1231,7 @@ export const FLAGS: Record = { When this feature flag is enabled, if the task definition is created in the stack, the 'Resource' section will 'Ref' the taskDefinition. `, - introducedIn: { v2: 'V2NEXT' }, + introducedIn: { v2: '2.163.0' }, recommendedValue: true, }, }; diff --git a/version.v2.json b/version.v2.json index cf3d1e099212e..142efd973f4cd 100644 --- a/version.v2.json +++ b/version.v2.json @@ -1,4 +1,4 @@ { - "version": "2.162.1", - "alphaVersion": "2.162.1-alpha.0" + "version": "2.163.0", + "alphaVersion": "2.163.0-alpha.0" } \ No newline at end of file From f03e52fe12a5316bc1b6a22e8dd145ea6ee62f78 Mon Sep 17 00:00:00 2001 From: Mohamed Elasmar <71043312+moelasmar@users.noreply.github.com> Date: Mon, 21 Oct 2024 14:27:24 -0700 Subject: [PATCH 02/33] chore: update CHANGELOG.v2.md --- CHANGELOG.v2.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.v2.md b/CHANGELOG.v2.md index 236442df4b2ac..72b48d4be8ef8 100644 --- a/CHANGELOG.v2.md +++ b/CHANGELOG.v2.md @@ -30,7 +30,7 @@ All notable changes to this project will be documented in this file. See [standa * **cli:** `cdk import` errors with 'S3 error: Access Denied' ([#31727](https://github.com/aws/aws-cdk/issues/31727)) ([cd324d0](https://github.com/aws/aws-cdk/commit/cd324d028e03215e877f13a26992ebd5a2b4db03)), closes [#31597](https://github.com/aws/aws-cdk/issues/31597) [#31716](https://github.com/aws/aws-cdk/issues/31716) * **lambda:** filterRule.null() returns empty array ([#31701](https://github.com/aws/aws-cdk/issues/31701)) ([5830ee1](https://github.com/aws/aws-cdk/commit/5830ee1eb29fc025c3ebe1451647c79cef155ea1)), closes [#31458](https://github.com/aws/aws-cdk/issues/31458) -* **s3:** add support for uppercase characters in legacy bucket names ([#31813](https://github.com/aws/aws-cdk/issues/31813)) ([7bebf40](https://github.com/aws/aws-cdk/commit/7bebf400a6e271c3f50402a5e72aff1f1b8be109)), closes [#31731](https://github.com/aws/aws-cdk/issues/31731) [/github.com/aws/aws-cdk/issues/31731#issuecomment-2417649670](https://github.com/aws//github.com/aws/aws-cdk/issues/31731/issues/issuecomment-2417649670) [#31731](https://github.com/aws/aws-cdk/issues/31731) +* **s3:** add support for uppercase characters in legacy bucket names ([#31813](https://github.com/aws/aws-cdk/issues/31813)) ([7bebf40](https://github.com/aws/aws-cdk/commit/7bebf400a6e271c3f50402a5e72aff1f1b8be109)), closes [#31731](https://github.com/aws/aws-cdk/issues/31731) * **stepfunctions-tasks:** stateMachine construct doesn't generate a valid policy for default StateMachineRole ([#31801](https://github.com/aws/aws-cdk/issues/31801)) ([efbbddb](https://github.com/aws/aws-cdk/commit/efbbddbee370a9b4dba2fbea4c92b44ad39be973)), closes [#31714](https://github.com/aws/aws-cdk/issues/31714) ## [2.162.1](https://github.com/aws/aws-cdk/compare/v2.162.0...v2.162.1) (2024-10-11) From 530aa4eb013ecd9393533572be98b518e1174269 Mon Sep 17 00:00:00 2001 From: Matsuda Date: Tue, 22 Oct 2024 08:46:45 +0900 Subject: [PATCH 03/33] docs(lambda): fix some typos in function (#31824) I found some typos by chance and fixed them :) ### Checklist - [x] My code adheres to the [CONTRIBUTING GUIDE](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and [DESIGN GUIDELINES](https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md) ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license* --- packages/aws-cdk-lib/aws-lambda/lib/function.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/aws-cdk-lib/aws-lambda/lib/function.ts b/packages/aws-cdk-lib/aws-lambda/lib/function.ts index 6615ffe179ac0..c8061020ad04c 100644 --- a/packages/aws-cdk-lib/aws-lambda/lib/function.ts +++ b/packages/aws-cdk-lib/aws-lambda/lib/function.ts @@ -108,7 +108,7 @@ export enum ApplicationLogLevel { * This field takes in 2 values either Text or JSON. By setting this value to Text, * will result in the current structure of logs format, whereas, by setting this value to JSON, * Lambda will print the logs as Structured JSON Logs, with the corresponding timestamp and log level - * of each event. Selecting ‘JSON’ format will only allow customer’s to have different log level + * of each event. Selecting ‘JSON’ format will only allow customers to have different log level * Application log level and the System log level. */ export enum LogFormat { @@ -126,7 +126,7 @@ export enum LogFormat { * This field takes in 2 values either Text or JSON. By setting this value to Text, * will result in the current structure of logs format, whereas, by setting this value to JSON, * Lambda will print the logs as Structured JSON Logs, with the corresponding timestamp and log level - * of each event. Selecting ‘JSON’ format will only allow customer’s to have different log level + * of each event. Selecting ‘JSON’ format will only allow customers to have different log level * Application log level and the System log level. */ export enum LoggingFormat { @@ -562,7 +562,7 @@ export interface FunctionOptions extends EventInvokeConfigOptions { /** * Sets the Recursive Loop Protection for Lambda Function. - * It lets Lambda detect and terminate unintended recusrive loops. + * It lets Lambda detect and terminate unintended recursive loops. * * @default RecursiveLoop.Terminate */ @@ -1207,7 +1207,7 @@ export class Function extends FunctionBase { } /** - * Get Logging Config propety for the function. + * Get Logging Config property for the function. * This method returns the function LoggingConfig Property if the property is set on the * function and undefined if not. */ @@ -1405,7 +1405,7 @@ Environment variables can be marked for removal when used in Lambda@Edge by sett } /** - * Configured lambda insights on the function if specified. This is acheived by adding an imported layer which is added to the + * Configured lambda insights on the function if specified. This is achieved by adding an imported layer which is added to the * list of lambda layers on synthesis. * * https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/Lambda-Insights-extension-versions.html From de7029f02f860a12e9a43b6f283c33efd6b36a1d Mon Sep 17 00:00:00 2001 From: paulhcsun <47882901+paulhcsun@users.noreply.github.com> Date: Mon, 21 Oct 2024 17:34:16 -0700 Subject: [PATCH 04/33] chore(kinesisfirehose-alpha): update README with name changes and clarifications (#31840) ### Description of changes Update the README to have the service be called *Amazon Data Firehose* instead of *Kinesis Data Firehose* as it has been renamed earlier this year: https://aws.amazon.com/about-aws/whats-new/2024/02/amazon-data-firehose-formerly-kinesis-data-firehose/ Additionally some more edits to include clarifications. ### Description of how you validated changes ### Checklist - [x] My code adheres to the [CONTRIBUTING GUIDE](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and [DESIGN GUIDELINES](https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md) ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license* --- .../aws-kinesisfirehose-alpha/README.md | 81 +++++++++---------- 1 file changed, 38 insertions(+), 43 deletions(-) diff --git a/packages/@aws-cdk/aws-kinesisfirehose-alpha/README.md b/packages/@aws-cdk/aws-kinesisfirehose-alpha/README.md index 279b43b2cb7cc..ad33ea30db7f5 100644 --- a/packages/@aws-cdk/aws-kinesisfirehose-alpha/README.md +++ b/packages/@aws-cdk/aws-kinesisfirehose-alpha/README.md @@ -1,4 +1,4 @@ -# Amazon Kinesis Data Firehose Construct Library +# Amazon Data Firehose Construct Library @@ -16,13 +16,13 @@ -[Amazon Kinesis Data Firehose](https://docs.aws.amazon.com/firehose/latest/dev/what-is-this-service.html) +[Amazon Data Firehose](https://docs.aws.amazon.com/firehose/latest/dev/what-is-this-service.html), [formerly known as Amazon Kinesis Data Firehose](https://aws.amazon.com/about-aws/whats-new/2024/02/amazon-data-firehose-formerly-kinesis-data-firehose/), is a service for fully-managed delivery of real-time streaming data to storage services such as Amazon S3, Amazon Redshift, Amazon Elasticsearch, Splunk, or any custom HTTP endpoint or third-party services such as Datadog, Dynatrace, LogicMonitor, MongoDB, New Relic, and Sumo Logic. -Kinesis Data Firehose delivery streams are distinguished from Kinesis data streams in +Amazon Data Firehose delivery streams are distinguished from Kinesis data streams in their models of consumption. Whereas consumers read from a data stream by actively pulling data from the stream, a delivery stream pushes data to its destination on a regular cadence. This means that data streams are intended to have consumers that do on-demand @@ -31,12 +31,12 @@ intended to have destinations that are sources for offline processing and analyt as Amazon S3 and Amazon Redshift. This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) -project. It allows you to define Kinesis Data Firehose delivery streams. +project. It allows you to define Amazon Data Firehose delivery streams. ## Defining a Delivery Stream In order to define a Delivery Stream, you must specify a destination. An S3 bucket can be -used as a destination. More supported destinations are covered [below](#destinations). +used as a destination. Currently the CDK supports only S3 as a destination which is covered [below](#destinations). ```ts const bucket = new s3.Bucket(this, 'Bucket'); @@ -48,16 +48,16 @@ new firehose.DeliveryStream(this, 'Delivery Stream', { The above example defines the following resources: - An S3 bucket -- A Kinesis Data Firehose delivery stream with Direct PUT as the source and CloudWatch +- An Amazon Data Firehose delivery stream with Direct PUT as the source and CloudWatch error logging turned on. - An IAM role which gives the delivery stream permission to write to the S3 bucket. ## Sources -A Kinesis Data Firehose delivery stream can accept data from three main sources: Kinesis Data Streams, Managed Streaming for Apache Kafka (MSK), or via a "direct put" (API calls). +An Amazon Data Firehose delivery stream can accept data from three main sources: Kinesis Data Streams, Managed Streaming for Apache Kafka (MSK), or via a "direct put" (API calls). See: [Sending Data to a Delivery Stream](https://docs.aws.amazon.com/firehose/latest/dev/basic-write.html) -in the *Kinesis Data Firehose Developer Guide*. +in the *Amazon Data Firehose Developer Guide*. ### Kinesis Data Stream @@ -81,11 +81,11 @@ Data must be provided via "direct put", ie., by using a `PutRecord` or `PutRecordBatch` API call. There are a number of ways of doing so, such as: - Kinesis Agent: a standalone Java application that monitors and delivers files while - handling file rotation, checkpointing, and retries. See: [Writing to Kinesis Data Firehose Using Kinesis Agent](https://docs.aws.amazon.com/firehose/latest/dev/writing-with-agents.html) - in the *Kinesis Data Firehose Developer Guide*. + handling file rotation, checkpointing, and retries. See: [Writing to Amazon Data Firehose Using Kinesis Agent](https://docs.aws.amazon.com/firehose/latest/dev/writing-with-agents.html) + in the *Amazon Data Firehose Developer Guide*. - AWS SDK: a general purpose solution that allows you to deliver data to a delivery stream - from anywhere using Java, .NET, Node.js, Python, or Ruby. See: [Writing to Kinesis Data Firehose Using the AWS SDK](https://docs.aws.amazon.com/firehose/latest/dev/writing-with-sdk.html) - in the *Kinesis Data Firehose Developer Guide*. + from anywhere using Java, .NET, Node.js, Python, or Ruby. See: [Writing to Amazon Data Firehose Using the AWS SDK](https://docs.aws.amazon.com/firehose/latest/dev/writing-with-sdk.html) + in the *Amazon Data Firehose Developer Guide*. - CloudWatch Logs: subscribe to a log group and receive filtered log events directly into a delivery stream. See: [logs-destinations](https://docs.aws.amazon.com/cdk/api/latest/docs/aws-logs-destinations-readme.html). - Eventbridge: add an event rule target to send events to a delivery stream based on the @@ -125,11 +125,11 @@ const s3Destination = new destinations.S3Bucket(bucket, { ``` See: [Custom S3 Prefixes](https://docs.aws.amazon.com/firehose/latest/dev/s3-prefixes.html) -in the *Kinesis Data Firehose Developer Guide*. +in the *Amazon Data Firehose Developer Guide*. ## Server-side Encryption -Enabling server-side encryption (SSE) requires Kinesis Data Firehose to encrypt all data +Enabling server-side encryption (SSE) requires Amazon Data Firehose to encrypt all data sent to delivery stream when it is stored at rest. This means that data is encrypted before being written to the service's internal storage layer and decrypted after it is received from the internal storage layer. The service manages keys and cryptographic @@ -152,39 +152,40 @@ in the *KMS Developer Guide*. declare const destination: firehose.IDestination; // SSE with an AWS-owned key -new firehose.DeliveryStream(this, 'Delivery Stream AWS Owned', { +new firehose.DeliveryStream(this, 'Delivery Stream with AWS Owned Key', { encryption: firehose.StreamEncryption.awsOwnedKey(), destination: destination, }); // SSE with an customer-managed key that is created automatically by the CDK -new firehose.DeliveryStream(this, 'Delivery Stream Implicit Customer Managed', { +new firehose.DeliveryStream(this, 'Delivery Stream with Customer Managed Key', { encryption: firehose.StreamEncryption.customerManagedKey(), destination: destination, }); // SSE with an customer-managed key that is explicitly specified declare const key: kms.Key; -new firehose.DeliveryStream(this, 'Delivery Stream Explicit Customer Managed', { +new firehose.DeliveryStream(this, 'Delivery Stream with Customer Managed and Provided Key', { encryption: firehose.StreamEncryption.customerManagedKey(key), destination: destination, }); ``` See: [Data Protection](https://docs.aws.amazon.com/firehose/latest/dev/encryption.html) -in the *Kinesis Data Firehose Developer Guide*. +in the *Amazon Data Firehose Developer Guide*. ## Monitoring -Kinesis Data Firehose is integrated with CloudWatch, so you can monitor the performance of +Amazon Data Firehose is integrated with CloudWatch, so you can monitor the performance of your delivery streams via logs and metrics. ### Logs -Kinesis Data Firehose will send logs to CloudWatch when data transformation or data +Amazon Data Firehose will send logs to CloudWatch when data transformation or data delivery fails. The CDK will enable logging by default and create a CloudWatch LogGroup and LogStream for your Delivery Stream. When creating a destination, you can provide an `ILoggingConfig`, which can either be an `EnableLogging` or `DisableLogging` instance. -If you use `EnableLogging`, you can specify a log group where the CDK will create log streams to capture and store log events. For example: +If you use `EnableLogging`, the CDK will create a CloudWatch LogGroup and LogStream with all CloudFormation default settings for you, or you can optionally +specify your own log group to be used for capturing and storing log events. For example: ```ts import * as logs from 'aws-cdk-lib/aws-logs'; @@ -213,11 +214,11 @@ new firehose.DeliveryStream(this, 'Delivery Stream', { ``` See: [Monitoring using CloudWatch Logs](https://docs.aws.amazon.com/firehose/latest/dev/monitoring-with-cloudwatch-logs.html) -in the *Kinesis Data Firehose Developer Guide*. +in the *Amazon Data Firehose Developer Guide*. ### Metrics -Kinesis Data Firehose sends metrics to CloudWatch so that you can collect and analyze the +Amazon Data Firehose sends metrics to CloudWatch so that you can collect and analyze the performance of the delivery stream, including data delivery, data ingestion, data transformation, format conversion, API usage, encryption, and resource usage. You can then use CloudWatch alarms to alert you, for example, when data freshness (the age of the @@ -229,7 +230,7 @@ than it is configured to process). CDK provides methods for accessing delivery stream metrics with default configuration, such as `metricIncomingBytes`, and `metricIncomingRecords` (see [`IDeliveryStream`](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-kinesisfirehose.IDeliveryStream.html) for a full list). CDK also provides a generic `metric` method that can be used to produce -metric configurations for any metric provided by Kinesis Data Firehose; the configurations +metric configurations for any metric provided by Amazon Data Firehose; the configurations are pre-populated with the correct dimensions for the delivery stream. ```ts @@ -254,7 +255,7 @@ new cloudwatch.Alarm(this, 'Alarm', { ``` See: [Monitoring Using CloudWatch Metrics](https://docs.aws.amazon.com/firehose/latest/dev/monitoring-with-cloudwatch-metrics.html) -in the *Kinesis Data Firehose Developer Guide*. +in the *Amazon Data Firehose Developer Guide*. ## Compression @@ -297,9 +298,9 @@ new firehose.DeliveryStream(this, 'Delivery Stream', { ``` See: [Data Delivery Frequency](https://docs.aws.amazon.com/firehose/latest/dev/basic-deliver.html#frequency) -in the *Kinesis Data Firehose Developer Guide*. +in the *Amazon Data Firehose Developer Guide*. -Zero buffering, where Amazon Kinesis Data Firehose stream can be configured to not buffer data before delivery, is supported by +Zero buffering, where Amazon Data Firehose stream can be configured to not buffer data before delivery, is supported by setting the "buffer interval" to 0. ```ts @@ -318,7 +319,7 @@ See: [Buffering Hints](https://docs.aws.amazon.com/firehose/latest/dev/buffering ## Destination Encryption Your data can be automatically encrypted when it is delivered to S3 as a final or an -intermediary/backup destination. Kinesis Data Firehose supports Amazon S3 server-side +intermediary/backup destination. Amazon Data Firehose supports Amazon S3 server-side encryption with AWS Key Management Service (AWS KMS) for encrypting delivered data in Amazon S3. You can choose to not encrypt the data or to encrypt with a key from the list of AWS KMS keys that you own. For more information, @@ -394,7 +395,7 @@ to track the status of adding support for record format conversion. ### Data transformation with AWS Lambda -To transform the data, Kinesis Data Firehose will call a Lambda function that you provide +To transform the data, Amazon Data Firehose will call a Lambda function that you provide and deliver the data returned in place of the source record. The function must return a result that contains records in a specific format, including the following fields: @@ -435,29 +436,29 @@ new firehose.DeliveryStream(this, 'Delivery Stream', { [Example Lambda data processor performing the identity transformation.](../aws-kinesisfirehose-destinations-alpha/test/integ.s3-bucket.lit.ts) See: [Data Transformation](https://docs.aws.amazon.com/firehose/latest/dev/data-transformation.html) -in the *Kinesis Data Firehose Developer Guide*. +in the *Amazon Data Firehose Developer Guide*. ## Specifying an IAM role The DeliveryStream class automatically creates IAM service roles with all the minimum -necessary permissions for Kinesis Data Firehose to access the resources referenced by your -delivery stream. One service role is created for the delivery stream that allows Kinesis +necessary permissions for Amazon Data Firehose to access the resources referenced by your +delivery stream. One service role is created for the delivery stream that allows Amazon Data Firehose to read from a Kinesis data stream (if one is configured as the delivery stream source) and for server-side encryption. Note that if the DeliveryStream is created without specifying a `source` or `encryptionKey`, this role is not created as it is not needed. -Another service role is created for each destination, which gives Kinesis Data Firehose write +Another service role is created for each destination, which gives Amazon Data Firehose write access to the destination resource, as well as the ability to invoke data transformers and read schemas for record format conversion. If you wish, you may specify your own IAM role for either the delivery stream or the destination service role, or both. It must have the correct -trust policy (it must allow Kinesis Data Firehose to assume it) or delivery stream creation or +trust policy (it must allow Amazon Data Firehose to assume it) or delivery stream creation or data delivery will fail. Other required permissions to destination resources, encryption keys, etc., will be provided automatically. ```ts // Create service roles for the delivery stream and destination. // These can be used for other purposes and granted access to different resources. -// They must include the Kinesis Data Firehose service principal in their trust policies. +// They must include the Amazon Data Firehose service principal in their trust policies. // Two separate roles are shown below, but the same role can be used for both purposes. const deliveryStreamRole = new iam.Role(this, 'Delivery Stream Role', { assumedBy: new iam.ServicePrincipal('firehose.amazonaws.com'), @@ -476,7 +477,7 @@ new firehose.DeliveryStream(this, 'Delivery Stream', { ``` See [Controlling Access](https://docs.aws.amazon.com/firehose/latest/dev/controlling-access.html) -in the *Kinesis Data Firehose Developer Guide*. +in the *Amazon Data Firehose Developer Guide*. ## Granting application access to a delivery stream @@ -509,7 +510,7 @@ The following write permissions are provided to a service principal by the ## Granting a delivery stream access to a resource -Conversely to the above, Kinesis Data Firehose requires permissions in order for delivery +Conversely to the above, Amazon Data Firehose requires permissions in order for delivery streams to interact with resources that you own. For example, if an S3 bucket is specified as a destination of a delivery stream, the delivery stream must be granted permissions to put and get objects from the bucket. When using the built-in AWS service destinations @@ -527,9 +528,3 @@ const fn = new lambda.Function(this, 'Function', { declare const deliveryStream: firehose.DeliveryStream; fn.grantInvoke(deliveryStream); ``` - -## Multiple destinations - -Though the delivery stream allows specifying an array of destinations, only one -destination per delivery stream is currently allowed. This limitation is enforced at CDK -synthesis time and will throw an error. From f1e2f3b602899b28610849b8b55748f288f50fcd Mon Sep 17 00:00:00 2001 From: Shailja Khurana <117320115+khushail@users.noreply.github.com> Date: Mon, 21 Oct 2024 23:35:39 -0700 Subject: [PATCH 05/33] chore(lambda-nodejs): grammatical correction in statement reg bundleAwsSDK (#31839) ### Issue # (if applicable) Closes #31789 ### Reason for this change Comments had grammatical mistakes. ### Description of changes Rephrased the sentence and added more clarifcation. ### Description of how you validated changes No ### Checklist - [ ] My code adheres to the [CONTRIBUTING GUIDE](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and [DESIGN GUIDELINES](https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md) ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license* --- packages/aws-cdk-lib/aws-lambda-nodejs/README.md | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/packages/aws-cdk-lib/aws-lambda-nodejs/README.md b/packages/aws-cdk-lib/aws-lambda-nodejs/README.md index 10e757ef7e0d7..7559733151157 100644 --- a/packages/aws-cdk-lib/aws-lambda-nodejs/README.md +++ b/packages/aws-cdk-lib/aws-lambda-nodejs/README.md @@ -175,9 +175,7 @@ new nodejs.NodejsFunction(this, 'my-handler', { }, }); ``` -Includes AWS SDK in the bundle asset by setting `bundleAwsSDK` to `true`. This will be essentially exclude sdk from the external -module and not be resolved to the Lambda provided sdk. - +Includes AWS SDK in the bundle asset by setting `bundleAwsSDK` to `true`. This will exclude SDK from the external module and would not be resolved to Lambda provided SDK. ```ts new nodejs.NodejsFunction(this, 'my-handler', { bundling: { From 595a422a614daecf386bde96f4cefeb4f7473815 Mon Sep 17 00:00:00 2001 From: Rico Hermans Date: Tue, 22 Oct 2024 17:04:51 +0200 Subject: [PATCH 06/33] fix: 'Need to perform AWS calls for account' when doing cross-account deployments (#31846) Fixes #31845 Manually verified that cross-account access is possible again. Will follow up with a PR for more tests. ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license* --- packages/aws-cdk/lib/api/deployments.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/aws-cdk/lib/api/deployments.ts b/packages/aws-cdk/lib/api/deployments.ts index 788c42796be36..a2e729ce30689 100644 --- a/packages/aws-cdk/lib/api/deployments.ts +++ b/packages/aws-cdk/lib/api/deployments.ts @@ -812,7 +812,7 @@ export class Deployments { const { manifest, stackEnv } = await this.prepareAndValidateAssets(asset, options); await publishAssets(manifest, this.sdkProvider, stackEnv, { ...options.publishOptions, - allowCrossAccount: await this.allowCrossAccountAssetPublishingForEnv(stackEnv), + allowCrossAccount: await this.allowCrossAccountAssetPublishingForEnv(options.stack), }); } @@ -852,15 +852,15 @@ export class Deployments { // No need to validate anymore, we already did that during build const publisher = this.cachedPublisher(assetManifest, stackEnv, options.stackName); // eslint-disable-next-line no-console - await publisher.publishEntry(asset, { allowCrossAccount: await this.allowCrossAccountAssetPublishingForEnv(stackEnv) }); + await publisher.publishEntry(asset, { allowCrossAccount: await this.allowCrossAccountAssetPublishingForEnv(options.stack) }); if (publisher.hasFailures) { throw new Error(`Failed to publish asset ${asset.id}`); } } - private async allowCrossAccountAssetPublishingForEnv(env: cxapi.Environment): Promise { + private async allowCrossAccountAssetPublishingForEnv(stack: cxapi.CloudFormationStackArtifact): Promise { if (this._allowCrossAccountAssetPublishing === undefined) { - const sdk = (await this.cachedSdkForEnvironment(env, Mode.ForReading)).sdk; + const { stackSdk: sdk } = await this.prepareSdkFor(stack, undefined, Mode.ForReading); this._allowCrossAccountAssetPublishing = await determineAllowCrossAccountAssetPublishing(sdk, this.props.toolkitStackName); } return this._allowCrossAccountAssetPublishing; From 5aa63d136294a42df2f65a3705655eb3c108fc2c Mon Sep 17 00:00:00 2001 From: Rico Hermans Date: Tue, 22 Oct 2024 17:04:51 +0200 Subject: [PATCH 07/33] fix: 'Need to perform AWS calls for account' when doing cross-account deployments (#31846) Fixes #31845 Manually verified that cross-account access is possible again. Will follow up with a PR for more tests. ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license* --- packages/aws-cdk/lib/api/deployments.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/aws-cdk/lib/api/deployments.ts b/packages/aws-cdk/lib/api/deployments.ts index 788c42796be36..a2e729ce30689 100644 --- a/packages/aws-cdk/lib/api/deployments.ts +++ b/packages/aws-cdk/lib/api/deployments.ts @@ -812,7 +812,7 @@ export class Deployments { const { manifest, stackEnv } = await this.prepareAndValidateAssets(asset, options); await publishAssets(manifest, this.sdkProvider, stackEnv, { ...options.publishOptions, - allowCrossAccount: await this.allowCrossAccountAssetPublishingForEnv(stackEnv), + allowCrossAccount: await this.allowCrossAccountAssetPublishingForEnv(options.stack), }); } @@ -852,15 +852,15 @@ export class Deployments { // No need to validate anymore, we already did that during build const publisher = this.cachedPublisher(assetManifest, stackEnv, options.stackName); // eslint-disable-next-line no-console - await publisher.publishEntry(asset, { allowCrossAccount: await this.allowCrossAccountAssetPublishingForEnv(stackEnv) }); + await publisher.publishEntry(asset, { allowCrossAccount: await this.allowCrossAccountAssetPublishingForEnv(options.stack) }); if (publisher.hasFailures) { throw new Error(`Failed to publish asset ${asset.id}`); } } - private async allowCrossAccountAssetPublishingForEnv(env: cxapi.Environment): Promise { + private async allowCrossAccountAssetPublishingForEnv(stack: cxapi.CloudFormationStackArtifact): Promise { if (this._allowCrossAccountAssetPublishing === undefined) { - const sdk = (await this.cachedSdkForEnvironment(env, Mode.ForReading)).sdk; + const { stackSdk: sdk } = await this.prepareSdkFor(stack, undefined, Mode.ForReading); this._allowCrossAccountAssetPublishing = await determineAllowCrossAccountAssetPublishing(sdk, this.props.toolkitStackName); } return this._allowCrossAccountAssetPublishing; From 11275fa3421f9694d622c0acbf687f0d92c98740 Mon Sep 17 00:00:00 2001 From: Momo Kornher Date: Tue, 22 Oct 2024 16:12:19 +0100 Subject: [PATCH 08/33] chore(release): 2.163.1 --- CHANGELOG.v2.alpha.md | 2 ++ CHANGELOG.v2.md | 7 +++++++ version.v2.json | 4 ++-- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.v2.alpha.md b/CHANGELOG.v2.alpha.md index 6475212e36ed4..ae5784f8a9df1 100644 --- a/CHANGELOG.v2.alpha.md +++ b/CHANGELOG.v2.alpha.md @@ -2,6 +2,8 @@ All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. +## [2.163.1-alpha.0](https://github.com/aws/aws-cdk/compare/v2.163.0-alpha.0...v2.163.1-alpha.0) (2024-10-22) + ## [2.163.0-alpha.0](https://github.com/aws/aws-cdk/compare/v2.162.1-alpha.0...v2.163.0-alpha.0) (2024-10-21) diff --git a/CHANGELOG.v2.md b/CHANGELOG.v2.md index 72b48d4be8ef8..0bc7d0feea9bb 100644 --- a/CHANGELOG.v2.md +++ b/CHANGELOG.v2.md @@ -2,6 +2,13 @@ All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. +## [2.163.1](https://github.com/aws/aws-cdk/compare/v2.163.0...v2.163.1) (2024-10-22) + + +### Bug Fixes + +* 'Need to perform AWS calls for account' when doing cross-account deployments ([#31846](https://github.com/aws/aws-cdk/issues/31846)) ([5aa63d1](https://github.com/aws/aws-cdk/commit/5aa63d136294a42df2f65a3705655eb3c108fc2c)), closes [#31845](https://github.com/aws/aws-cdk/issues/31845) + ## [2.163.0](https://github.com/aws/aws-cdk/compare/v2.162.1...v2.163.0) (2024-10-21) diff --git a/version.v2.json b/version.v2.json index 142efd973f4cd..a3c8b17a2f5e2 100644 --- a/version.v2.json +++ b/version.v2.json @@ -1,4 +1,4 @@ { - "version": "2.163.0", - "alphaVersion": "2.163.0-alpha.0" + "version": "2.163.1", + "alphaVersion": "2.163.1-alpha.0" } \ No newline at end of file From f656308cb76de0f20e37b657ba9ed30869b359f5 Mon Sep 17 00:00:00 2001 From: Atanas Pamukchiev Date: Tue, 22 Oct 2024 18:32:05 +0200 Subject: [PATCH 09/33] chore(ci): fix deprecated parameters for actions-comment-pull-request (#31805) ### Reason for this change The `request-cli-integ-test` pipeline is currently broken after a dependabot commit ([af89640](https://github.com/aws/aws-cdk/commit/af89640357e3e28e9098e2244e0d6fe91d6d1e78)) which upgraded the version of the `actions-comment-pull-request` action to the latest changes which had breaking changes. ### Description of changes Updated the parameters passed to the action to correspond to the new naming convention as defined in the [changelog](https://github.com/thollander/actions-comment-pull-request/releases/tag/v3.0.0). ### Description of how you validated changes I cannot test this myself, but the changes are straightforward. ### Checklist - [x] My code adheres to the [CONTRIBUTING GUIDE](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and [DESIGN GUIDELINES](https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md) ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license* --- .github/workflows/request-cli-integ-test.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/request-cli-integ-test.yml b/.github/workflows/request-cli-integ-test.yml index 99833ec28031c..35a7f1e4c1558 100644 --- a/.github/workflows/request-cli-integ-test.yml +++ b/.github/workflows/request-cli-integ-test.yml @@ -60,7 +60,7 @@ jobs: :arrow_right: **PR build request submitted to `test-main-pipeline`** :arrow_left: A maintainer must now check the pipeline and add the `pr-linter/cli-integ-tested` label once the pipeline succeeds. - comment_tag: request-cli-integ-test + comment-tag: request-cli-integ-test mode: recreate # Post as our automation user - GITHUB_TOKEN: ${{ secrets.PROJEN_GITHUB_TOKEN }} + github-token: ${{ secrets.PROJEN_GITHUB_TOKEN }} From aae03c9f899ec2a77b841207ef0b4eb3a7e0ae00 Mon Sep 17 00:00:00 2001 From: GZ Date: Tue, 22 Oct 2024 11:00:59 -0700 Subject: [PATCH 10/33] fix(core): fix policy synthesizer logic for precreated roles (#31710) ### Issue # (if applicable) Closes https://github.com/aws/aws-cdk/issues/31653 ### Reason for this change With Role.customizeRoles enabled, dynamodb.Table.addGlobalSecondaryIndex causes an error. This is a critical blocker for customers who require the use of customizeRoles. ### Description of changes #### Intended behaviour When `customizeRoles` is used, the `iam-policy-report.txt` report will contain a list of IAM roles and associated permissions that would have been created. This report is generated so that it attempts to resolve any references and replace with a more user friendly value. The following are some examples of the value that will appear in the report: ```json "Resource": { "Fn::GetAtt": [ "SomeResource", "Arn" ] } ``` The policy report will instead get: ```json "(Path/To/SomeResource.Arn)" ``` #### Current issues There are two main issues here: 1. Policy synthesizer (which is used for customizeRoles to generate report) is created with `App` scope. This caused the failure in the original issue `Resolution error: PolicySynthesizer at 'PolicySynthesizer' should be created in the scope of a Stack, but no Stack found.` because token resolution requires a Stack scope not an App scope. 2. The policy synthesizer was using `DefaultTokenResolver`. The default token resolution class does not generate the same format of output values for the policy report. i.e. A concatenated token value, i.e. `${Token[Token.X]}/index/*` would be converted to `(PhysicalId).Arn` instead of `"(Path/To/SomeResource.Arn)"`. 3. Pseudo parameters like `AWS::NoValue` would be rendered as `Tokens` in the policy report which is not idea. Update it to make it output `NOVALUE`. This PR addresses the above two issues. ### Description of how you validated changes New and existing tests pass. ### Checklist - [ ] My code adheres to the [CONTRIBUTING GUIDE](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and [DESIGN GUIDELINES](https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md) ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license* --- ...cdk-table-with-customized-role.assets.json | 19 ++ ...k-table-with-customized-role.template.json | 83 +++++ ...dk-table-with-customized-role2.assets.json | 19 ++ ...-table-with-customized-role2.template.json | 61 ++++ .../cdk.out | 1 + ...efaultTestDeployAssertD6C925FC.assets.json | 19 ++ ...aultTestDeployAssertD6C925FC.template.json | 36 ++ .../iam-policy-report.json | 90 +++++ .../iam-policy-report.txt | 107 ++++++ .../integ.json | 14 + .../manifest.json | 170 ++++++++++ .../tree.json | 319 ++++++++++++++++++ .../test/integ.table-with-customized-role.ts | 70 ++++ .../integ.customize-role.js.snapshot/cdk.out | 1 + .../iam-policy-report.json | 33 ++ .../iam-policy-report.txt | 33 ++ .../integ-customize-role.assets.json | 19 ++ .../integ-customize-role.template.json | 41 +++ .../integ.json | 12 + ...efaultTestDeployAssert811D838D.assets.json | 19 ++ ...aultTestDeployAssert811D838D.template.json | 36 ++ .../manifest.json | 115 +++++++ .../tree.json | 157 +++++++++ .../test/aws-iam/test/integ.customize-role.ts | 36 ++ packages/aws-cdk-lib/aws-iam/README.md | 66 ++++ .../lib/helpers-internal/customize-roles.ts | 67 +++- 26 files changed, 1637 insertions(+), 6 deletions(-) create mode 100644 packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.table-with-customized-role.js.snapshot/cdk-table-with-customized-role.assets.json create mode 100644 packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.table-with-customized-role.js.snapshot/cdk-table-with-customized-role.template.json create mode 100644 packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.table-with-customized-role.js.snapshot/cdk-table-with-customized-role2.assets.json create mode 100644 packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.table-with-customized-role.js.snapshot/cdk-table-with-customized-role2.template.json create mode 100644 packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.table-with-customized-role.js.snapshot/cdk.out create mode 100644 packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.table-with-customized-role.js.snapshot/cdkdynamodbcustomizedroleintegDefaultTestDeployAssertD6C925FC.assets.json create mode 100644 packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.table-with-customized-role.js.snapshot/cdkdynamodbcustomizedroleintegDefaultTestDeployAssertD6C925FC.template.json create mode 100644 packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.table-with-customized-role.js.snapshot/iam-policy-report.json create mode 100644 packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.table-with-customized-role.js.snapshot/iam-policy-report.txt create mode 100644 packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.table-with-customized-role.js.snapshot/integ.json create mode 100644 packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.table-with-customized-role.js.snapshot/manifest.json create mode 100644 packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.table-with-customized-role.js.snapshot/tree.json create mode 100644 packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.table-with-customized-role.ts create mode 100644 packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.customize-role.js.snapshot/cdk.out create mode 100644 packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.customize-role.js.snapshot/iam-policy-report.json create mode 100644 packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.customize-role.js.snapshot/iam-policy-report.txt create mode 100644 packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.customize-role.js.snapshot/integ-customize-role.assets.json create mode 100644 packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.customize-role.js.snapshot/integ-customize-role.template.json create mode 100644 packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.customize-role.js.snapshot/integ.json create mode 100644 packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.customize-role.js.snapshot/integiamcustomizeroleDefaultTestDeployAssert811D838D.assets.json create mode 100644 packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.customize-role.js.snapshot/integiamcustomizeroleDefaultTestDeployAssert811D838D.template.json create mode 100644 packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.customize-role.js.snapshot/manifest.json create mode 100644 packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.customize-role.js.snapshot/tree.json create mode 100644 packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.customize-role.ts diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.table-with-customized-role.js.snapshot/cdk-table-with-customized-role.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.table-with-customized-role.js.snapshot/cdk-table-with-customized-role.assets.json new file mode 100644 index 0000000000000..23b584c2e6591 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.table-with-customized-role.js.snapshot/cdk-table-with-customized-role.assets.json @@ -0,0 +1,19 @@ +{ + "version": "38.0.1", + "files": { + "70267cb4d71000f9402304c37f8f7f27be51a2639cc15153bf93abab53fc60cd": { + "source": { + "path": "cdk-table-with-customized-role.template.json", + "packaging": "file" + }, + "destinations": { + "current_account-current_region": { + "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", + "objectKey": "70267cb4d71000f9402304c37f8f7f27be51a2639cc15153bf93abab53fc60cd.json", + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" + } + } + } + }, + "dockerImages": {} +} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.table-with-customized-role.js.snapshot/cdk-table-with-customized-role.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.table-with-customized-role.js.snapshot/cdk-table-with-customized-role.template.json new file mode 100644 index 0000000000000..4a512f0150bc8 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.table-with-customized-role.js.snapshot/cdk-table-with-customized-role.template.json @@ -0,0 +1,83 @@ +{ + "Resources": { + "TableCD117FA1": { + "Type": "AWS::DynamoDB::Table", + "Properties": { + "AttributeDefinitions": [ + { + "AttributeName": "pk", + "AttributeType": "S" + }, + { + "AttributeName": "gsi-pk", + "AttributeType": "S" + } + ], + "GlobalSecondaryIndexes": [ + { + "IndexName": "gsi", + "KeySchema": [ + { + "AttributeName": "gsi-pk", + "KeyType": "HASH" + } + ], + "Projection": { + "ProjectionType": "ALL" + }, + "ProvisionedThroughput": { + "ReadCapacityUnits": 5, + "WriteCapacityUnits": 5 + } + } + ], + "KeySchema": [ + { + "AttributeName": "pk", + "KeyType": "HASH" + } + ], + "ProvisionedThroughput": { + "ReadCapacityUnits": 5, + "WriteCapacityUnits": 5 + } + }, + "UpdateReplacePolicy": "Retain", + "DeletionPolicy": "Retain" + } + }, + "Parameters": { + "BootstrapVersion": { + "Type": "AWS::SSM::Parameter::Value", + "Default": "/cdk-bootstrap/hnb659fds/version", + "Description": "Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]" + } + }, + "Rules": { + "CheckBootstrapVersion": { + "Assertions": [ + { + "Assert": { + "Fn::Not": [ + { + "Fn::Contains": [ + [ + "1", + "2", + "3", + "4", + "5" + ], + { + "Ref": "BootstrapVersion" + } + ] + } + ] + }, + "AssertDescription": "CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI." + } + ] + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.table-with-customized-role.js.snapshot/cdk-table-with-customized-role2.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.table-with-customized-role.js.snapshot/cdk-table-with-customized-role2.assets.json new file mode 100644 index 0000000000000..05d955ca02cea --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.table-with-customized-role.js.snapshot/cdk-table-with-customized-role2.assets.json @@ -0,0 +1,19 @@ +{ + "version": "38.0.1", + "files": { + "75d2a3c3208960a28b88f27cd9f94f89a8126de261c69dc422537395c5c29fbe": { + "source": { + "path": "cdk-table-with-customized-role2.template.json", + "packaging": "file" + }, + "destinations": { + "current_account-current_region": { + "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", + "objectKey": "75d2a3c3208960a28b88f27cd9f94f89a8126de261c69dc422537395c5c29fbe.json", + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" + } + } + } + }, + "dockerImages": {} +} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.table-with-customized-role.js.snapshot/cdk-table-with-customized-role2.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.table-with-customized-role.js.snapshot/cdk-table-with-customized-role2.template.json new file mode 100644 index 0000000000000..9b673891b73cb --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.table-with-customized-role.js.snapshot/cdk-table-with-customized-role2.template.json @@ -0,0 +1,61 @@ +{ + "Resources": { + "TableCD117FA1": { + "Type": "AWS::DynamoDB::Table", + "Properties": { + "AttributeDefinitions": [ + { + "AttributeName": "pk", + "AttributeType": "S" + } + ], + "KeySchema": [ + { + "AttributeName": "pk", + "KeyType": "HASH" + } + ], + "ProvisionedThroughput": { + "ReadCapacityUnits": 5, + "WriteCapacityUnits": 5 + } + }, + "UpdateReplacePolicy": "Retain", + "DeletionPolicy": "Retain" + } + }, + "Parameters": { + "BootstrapVersion": { + "Type": "AWS::SSM::Parameter::Value", + "Default": "/cdk-bootstrap/hnb659fds/version", + "Description": "Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]" + } + }, + "Rules": { + "CheckBootstrapVersion": { + "Assertions": [ + { + "Assert": { + "Fn::Not": [ + { + "Fn::Contains": [ + [ + "1", + "2", + "3", + "4", + "5" + ], + { + "Ref": "BootstrapVersion" + } + ] + } + ] + }, + "AssertDescription": "CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI." + } + ] + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.table-with-customized-role.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.table-with-customized-role.js.snapshot/cdk.out new file mode 100644 index 0000000000000..c6e612584e352 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.table-with-customized-role.js.snapshot/cdk.out @@ -0,0 +1 @@ +{"version":"38.0.1"} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.table-with-customized-role.js.snapshot/cdkdynamodbcustomizedroleintegDefaultTestDeployAssertD6C925FC.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.table-with-customized-role.js.snapshot/cdkdynamodbcustomizedroleintegDefaultTestDeployAssertD6C925FC.assets.json new file mode 100644 index 0000000000000..374f439045d06 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.table-with-customized-role.js.snapshot/cdkdynamodbcustomizedroleintegDefaultTestDeployAssertD6C925FC.assets.json @@ -0,0 +1,19 @@ +{ + "version": "38.0.1", + "files": { + "21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22": { + "source": { + "path": "cdkdynamodbcustomizedroleintegDefaultTestDeployAssertD6C925FC.template.json", + "packaging": "file" + }, + "destinations": { + "current_account-current_region": { + "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", + "objectKey": "21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22.json", + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" + } + } + } + }, + "dockerImages": {} +} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.table-with-customized-role.js.snapshot/cdkdynamodbcustomizedroleintegDefaultTestDeployAssertD6C925FC.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.table-with-customized-role.js.snapshot/cdkdynamodbcustomizedroleintegDefaultTestDeployAssertD6C925FC.template.json new file mode 100644 index 0000000000000..ad9d0fb73d1dd --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.table-with-customized-role.js.snapshot/cdkdynamodbcustomizedroleintegDefaultTestDeployAssertD6C925FC.template.json @@ -0,0 +1,36 @@ +{ + "Parameters": { + "BootstrapVersion": { + "Type": "AWS::SSM::Parameter::Value", + "Default": "/cdk-bootstrap/hnb659fds/version", + "Description": "Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]" + } + }, + "Rules": { + "CheckBootstrapVersion": { + "Assertions": [ + { + "Assert": { + "Fn::Not": [ + { + "Fn::Contains": [ + [ + "1", + "2", + "3", + "4", + "5" + ], + { + "Ref": "BootstrapVersion" + } + ] + } + ] + }, + "AssertDescription": "CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI." + } + ] + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.table-with-customized-role.js.snapshot/iam-policy-report.json b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.table-with-customized-role.js.snapshot/iam-policy-report.json new file mode 100644 index 0000000000000..aadc926f1bee0 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.table-with-customized-role.js.snapshot/iam-policy-report.json @@ -0,0 +1,90 @@ +{ + "roles": [ + { + "roleConstructPath": "cdk-table-with-customized-role/Table/ScalingRole", + "roleName": "AWSServiceRoleForApplicationAutoScaling_DynamoDBTable", + "assumeRolePolicy": [], + "managedPolicyArns": [], + "managedPolicyStatements": [], + "identityPolicyStatements": [] + }, + { + "roleConstructPath": "cdk-table-with-customized-role/Role", + "roleName": "my-precreated-role-name", + "missing": false, + "assumeRolePolicy": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "dynamodb.amazonaws.com" + } + } + ], + "managedPolicyArns": [], + "managedPolicyStatements": [], + "identityPolicyStatements": [ + { + "Action": [ + "dynamodb:BatchGetItem", + "dynamodb:GetRecords", + "dynamodb:GetShardIterator", + "dynamodb:Query", + "dynamodb:GetItem", + "dynamodb:Scan", + "dynamodb:ConditionCheckItem", + "dynamodb:DescribeTable" + ], + "Effect": "Allow", + "Resource": [ + "(cdk-table-with-customized-role/Table/Resource.Arn)", + "(cdk-table-with-customized-role/Table/Resource.Arn)/index/*" + ] + } + ] + }, + { + "roleConstructPath": "cdk-table-with-customized-role2/Table/ScalingRole", + "roleName": "AWSServiceRoleForApplicationAutoScaling_DynamoDBTable", + "assumeRolePolicy": [], + "managedPolicyArns": [], + "managedPolicyStatements": [], + "identityPolicyStatements": [] + }, + { + "roleConstructPath": "cdk-table-with-customized-role2/Role", + "roleName": "my-precreated-role-name", + "missing": false, + "assumeRolePolicy": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "dynamodb.amazonaws.com" + } + } + ], + "managedPolicyArns": [], + "managedPolicyStatements": [], + "identityPolicyStatements": [ + { + "Action": [ + "dynamodb:BatchGetItem", + "dynamodb:GetRecords", + "dynamodb:GetShardIterator", + "dynamodb:Query", + "dynamodb:GetItem", + "dynamodb:Scan", + "dynamodb:ConditionCheckItem", + "dynamodb:DescribeTable" + ], + "Effect": "Allow", + "Resource": [ + "(cdk-table-with-customized-role2/Table/Resource.Arn)", + "(NOVALUE)" + ] + } + ] + } + ] +} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.table-with-customized-role.js.snapshot/iam-policy-report.txt b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.table-with-customized-role.js.snapshot/iam-policy-report.txt new file mode 100644 index 0000000000000..25b1ead7ae780 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.table-with-customized-role.js.snapshot/iam-policy-report.txt @@ -0,0 +1,107 @@ + (cdk-table-with-customized-role/Table/ScalingRole) + +AssumeRole Policy: +NONE + +Managed Policy ARNs: +NONE + +Managed Policies Statements: +NONE + +Identity Policy Statements: +NONE + + (cdk-table-with-customized-role/Role) + +AssumeRole Policy: +[ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "dynamodb.amazonaws.com" + } + } +] + +Managed Policy ARNs: +NONE + +Managed Policies Statements: +NONE + +Identity Policy Statements: +[ + { + "Action": [ + "dynamodb:BatchGetItem", + "dynamodb:GetRecords", + "dynamodb:GetShardIterator", + "dynamodb:Query", + "dynamodb:GetItem", + "dynamodb:Scan", + "dynamodb:ConditionCheckItem", + "dynamodb:DescribeTable" + ], + "Effect": "Allow", + "Resource": [ + "(cdk-table-with-customized-role/Table/Resource.Arn)", + "(cdk-table-with-customized-role/Table/Resource.Arn)/index/*" + ] + } +] + + (cdk-table-with-customized-role2/Table/ScalingRole) + +AssumeRole Policy: +NONE + +Managed Policy ARNs: +NONE + +Managed Policies Statements: +NONE + +Identity Policy Statements: +NONE + + (cdk-table-with-customized-role2/Role) + +AssumeRole Policy: +[ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "dynamodb.amazonaws.com" + } + } +] + +Managed Policy ARNs: +NONE + +Managed Policies Statements: +NONE + +Identity Policy Statements: +[ + { + "Action": [ + "dynamodb:BatchGetItem", + "dynamodb:GetRecords", + "dynamodb:GetShardIterator", + "dynamodb:Query", + "dynamodb:GetItem", + "dynamodb:Scan", + "dynamodb:ConditionCheckItem", + "dynamodb:DescribeTable" + ], + "Effect": "Allow", + "Resource": [ + "(cdk-table-with-customized-role2/Table/Resource.Arn)", + "(NOVALUE)" + ] + } +] \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.table-with-customized-role.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.table-with-customized-role.js.snapshot/integ.json new file mode 100644 index 0000000000000..05d41e8b269ff --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.table-with-customized-role.js.snapshot/integ.json @@ -0,0 +1,14 @@ +{ + "version": "38.0.1", + "testCases": { + "cdk-dynamodb-customized-role-integ/DefaultTest": { + "stacks": [ + "cdk-table-with-customized-role", + "cdk-table-with-customized-role2" + ], + "diffAssets": true, + "assertionStack": "cdk-dynamodb-customized-role-integ/DefaultTest/DeployAssert", + "assertionStackName": "cdkdynamodbcustomizedroleintegDefaultTestDeployAssertD6C925FC" + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.table-with-customized-role.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.table-with-customized-role.js.snapshot/manifest.json new file mode 100644 index 0000000000000..66aa906b31622 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.table-with-customized-role.js.snapshot/manifest.json @@ -0,0 +1,170 @@ +{ + "version": "38.0.1", + "artifacts": { + "cdk-table-with-customized-role.assets": { + "type": "cdk:asset-manifest", + "properties": { + "file": "cdk-table-with-customized-role.assets.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "cdk-table-with-customized-role": { + "type": "aws:cloudformation:stack", + "environment": "aws://unknown-account/unknown-region", + "properties": { + "templateFile": "cdk-table-with-customized-role.template.json", + "terminationProtection": false, + "validateOnSynth": false, + "notificationArns": [], + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", + "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", + "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/70267cb4d71000f9402304c37f8f7f27be51a2639cc15153bf93abab53fc60cd.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", + "additionalDependencies": [ + "cdk-table-with-customized-role.assets" + ], + "lookupRole": { + "arn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-lookup-role-${AWS::AccountId}-${AWS::Region}", + "requiresBootstrapStackVersion": 8, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "dependencies": [ + "cdk-table-with-customized-role.assets" + ], + "metadata": { + "/cdk-table-with-customized-role/Table/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "TableCD117FA1" + } + ], + "/cdk-table-with-customized-role/BootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "BootstrapVersion" + } + ], + "/cdk-table-with-customized-role/CheckBootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "CheckBootstrapVersion" + } + ] + }, + "displayName": "cdk-table-with-customized-role" + }, + "cdk-table-with-customized-role2.assets": { + "type": "cdk:asset-manifest", + "properties": { + "file": "cdk-table-with-customized-role2.assets.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "cdk-table-with-customized-role2": { + "type": "aws:cloudformation:stack", + "environment": "aws://unknown-account/unknown-region", + "properties": { + "templateFile": "cdk-table-with-customized-role2.template.json", + "terminationProtection": false, + "validateOnSynth": false, + "notificationArns": [], + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", + "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", + "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/75d2a3c3208960a28b88f27cd9f94f89a8126de261c69dc422537395c5c29fbe.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", + "additionalDependencies": [ + "cdk-table-with-customized-role2.assets" + ], + "lookupRole": { + "arn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-lookup-role-${AWS::AccountId}-${AWS::Region}", + "requiresBootstrapStackVersion": 8, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "dependencies": [ + "cdk-table-with-customized-role2.assets" + ], + "metadata": { + "/cdk-table-with-customized-role2/Table/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "TableCD117FA1" + } + ], + "/cdk-table-with-customized-role2/BootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "BootstrapVersion" + } + ], + "/cdk-table-with-customized-role2/CheckBootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "CheckBootstrapVersion" + } + ] + }, + "displayName": "cdk-table-with-customized-role2" + }, + "cdkdynamodbcustomizedroleintegDefaultTestDeployAssertD6C925FC.assets": { + "type": "cdk:asset-manifest", + "properties": { + "file": "cdkdynamodbcustomizedroleintegDefaultTestDeployAssertD6C925FC.assets.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "cdkdynamodbcustomizedroleintegDefaultTestDeployAssertD6C925FC": { + "type": "aws:cloudformation:stack", + "environment": "aws://unknown-account/unknown-region", + "properties": { + "templateFile": "cdkdynamodbcustomizedroleintegDefaultTestDeployAssertD6C925FC.template.json", + "terminationProtection": false, + "validateOnSynth": false, + "notificationArns": [], + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", + "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", + "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", + "additionalDependencies": [ + "cdkdynamodbcustomizedroleintegDefaultTestDeployAssertD6C925FC.assets" + ], + "lookupRole": { + "arn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-lookup-role-${AWS::AccountId}-${AWS::Region}", + "requiresBootstrapStackVersion": 8, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "dependencies": [ + "cdkdynamodbcustomizedroleintegDefaultTestDeployAssertD6C925FC.assets" + ], + "metadata": { + "/cdk-dynamodb-customized-role-integ/DefaultTest/DeployAssert/BootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "BootstrapVersion" + } + ], + "/cdk-dynamodb-customized-role-integ/DefaultTest/DeployAssert/CheckBootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "CheckBootstrapVersion" + } + ] + }, + "displayName": "cdk-dynamodb-customized-role-integ/DefaultTest/DeployAssert" + }, + "Tree": { + "type": "cdk:tree", + "properties": { + "file": "tree.json" + } + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.table-with-customized-role.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.table-with-customized-role.js.snapshot/tree.json new file mode 100644 index 0000000000000..8cb209f416f3b --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.table-with-customized-role.js.snapshot/tree.json @@ -0,0 +1,319 @@ +{ + "version": "tree-0.1", + "tree": { + "id": "App", + "path": "", + "children": { + "cdk-table-with-customized-role": { + "id": "cdk-table-with-customized-role", + "path": "cdk-table-with-customized-role", + "children": { + "Table": { + "id": "Table", + "path": "cdk-table-with-customized-role/Table", + "children": { + "Resource": { + "id": "Resource", + "path": "cdk-table-with-customized-role/Table/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::DynamoDB::Table", + "aws:cdk:cloudformation:props": { + "attributeDefinitions": [ + { + "attributeName": "pk", + "attributeType": "S" + }, + { + "attributeName": "gsi-pk", + "attributeType": "S" + } + ], + "globalSecondaryIndexes": [ + { + "indexName": "gsi", + "keySchema": [ + { + "attributeName": "gsi-pk", + "keyType": "HASH" + } + ], + "projection": { + "projectionType": "ALL" + }, + "provisionedThroughput": { + "readCapacityUnits": 5, + "writeCapacityUnits": 5 + } + } + ], + "keySchema": [ + { + "attributeName": "pk", + "keyType": "HASH" + } + ], + "provisionedThroughput": { + "readCapacityUnits": 5, + "writeCapacityUnits": 5 + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_dynamodb.CfnTable", + "version": "0.0.0" + } + }, + "ImportScalingRole": { + "id": "ImportScalingRole", + "path": "cdk-table-with-customized-role/Table/ImportScalingRole", + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "0.0.0" + } + }, + "ScalingRole": { + "id": "ScalingRole", + "path": "cdk-table-with-customized-role/Table/ScalingRole", + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_dynamodb.Table", + "version": "0.0.0" + } + }, + "Role": { + "id": "Role", + "path": "cdk-table-with-customized-role/Role", + "children": { + "ImportRole": { + "id": "ImportRole", + "path": "cdk-table-with-customized-role/Role/ImportRole", + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "0.0.0" + } + }, + "PrecreatedRoleRole": { + "id": "PrecreatedRoleRole", + "path": "cdk-table-with-customized-role/Role/PrecreatedRoleRole", + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.Role", + "version": "0.0.0" + } + }, + "BootstrapVersion": { + "id": "BootstrapVersion", + "path": "cdk-table-with-customized-role/BootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnParameter", + "version": "0.0.0" + } + }, + "CheckBootstrapVersion": { + "id": "CheckBootstrapVersion", + "path": "cdk-table-with-customized-role/CheckBootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnRule", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.Stack", + "version": "0.0.0" + } + }, + "PolicySynthesizer": { + "id": "PolicySynthesizer", + "path": "PolicySynthesizer", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.3.0" + } + }, + "cdk-table-with-customized-role2": { + "id": "cdk-table-with-customized-role2", + "path": "cdk-table-with-customized-role2", + "children": { + "Table": { + "id": "Table", + "path": "cdk-table-with-customized-role2/Table", + "children": { + "Resource": { + "id": "Resource", + "path": "cdk-table-with-customized-role2/Table/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::DynamoDB::Table", + "aws:cdk:cloudformation:props": { + "attributeDefinitions": [ + { + "attributeName": "pk", + "attributeType": "S" + } + ], + "keySchema": [ + { + "attributeName": "pk", + "keyType": "HASH" + } + ], + "provisionedThroughput": { + "readCapacityUnits": 5, + "writeCapacityUnits": 5 + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_dynamodb.CfnTable", + "version": "0.0.0" + } + }, + "ImportScalingRole": { + "id": "ImportScalingRole", + "path": "cdk-table-with-customized-role2/Table/ImportScalingRole", + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "0.0.0" + } + }, + "ScalingRole": { + "id": "ScalingRole", + "path": "cdk-table-with-customized-role2/Table/ScalingRole", + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_dynamodb.Table", + "version": "0.0.0" + } + }, + "Role": { + "id": "Role", + "path": "cdk-table-with-customized-role2/Role", + "children": { + "ImportRole": { + "id": "ImportRole", + "path": "cdk-table-with-customized-role2/Role/ImportRole", + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "0.0.0" + } + }, + "PrecreatedRoleRole": { + "id": "PrecreatedRoleRole", + "path": "cdk-table-with-customized-role2/Role/PrecreatedRoleRole", + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.Role", + "version": "0.0.0" + } + }, + "BootstrapVersion": { + "id": "BootstrapVersion", + "path": "cdk-table-with-customized-role2/BootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnParameter", + "version": "0.0.0" + } + }, + "CheckBootstrapVersion": { + "id": "CheckBootstrapVersion", + "path": "cdk-table-with-customized-role2/CheckBootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnRule", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.Stack", + "version": "0.0.0" + } + }, + "cdk-dynamodb-customized-role-integ": { + "id": "cdk-dynamodb-customized-role-integ", + "path": "cdk-dynamodb-customized-role-integ", + "children": { + "DefaultTest": { + "id": "DefaultTest", + "path": "cdk-dynamodb-customized-role-integ/DefaultTest", + "children": { + "Default": { + "id": "Default", + "path": "cdk-dynamodb-customized-role-integ/DefaultTest/Default", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.3.0" + } + }, + "DeployAssert": { + "id": "DeployAssert", + "path": "cdk-dynamodb-customized-role-integ/DefaultTest/DeployAssert", + "children": { + "BootstrapVersion": { + "id": "BootstrapVersion", + "path": "cdk-dynamodb-customized-role-integ/DefaultTest/DeployAssert/BootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnParameter", + "version": "0.0.0" + } + }, + "CheckBootstrapVersion": { + "id": "CheckBootstrapVersion", + "path": "cdk-dynamodb-customized-role-integ/DefaultTest/DeployAssert/CheckBootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnRule", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.Stack", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/integ-tests-alpha.IntegTestCase", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/integ-tests-alpha.IntegTest", + "version": "0.0.0" + } + }, + "Tree": { + "id": "Tree", + "path": "Tree", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.3.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.App", + "version": "0.0.0" + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.table-with-customized-role.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.table-with-customized-role.ts new file mode 100644 index 0000000000000..f57a789aac8af --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.table-with-customized-role.ts @@ -0,0 +1,70 @@ +import { IntegTest } from '@aws-cdk/integ-tests-alpha'; +import { App, Stack, StackProps } from 'aws-cdk-lib'; +import { AttributeType, Table } from 'aws-cdk-lib/aws-dynamodb'; +import { Construct } from 'constructs'; +import { Role, ServicePrincipal } from 'aws-cdk-lib/aws-iam'; + +class TestStack extends Stack { + public constructor(scope: Construct, id: string, props: StackProps) { + super(scope, id, props); + + Role.customizeRoles(this, { + usePrecreatedRoles: { + 'cdk-table-with-customized-role/Role': 'my-precreated-role-name', + }, + }); + + const table = new Table(this, 'Table', { + partitionKey: { + name: 'pk', + type: AttributeType.STRING, + }, + }); + + // Add GSI will add a new Resource under IAM Policy + // i.e. `${this.tableArn}/index/*`. Test the Policy + // Synthesizer generation with concatenated value. + table.addGlobalSecondaryIndex({ + indexName: 'gsi', + partitionKey: { + name: 'gsi-pk', + type: AttributeType.STRING, + }, + }); + const role = new Role(this, 'Role', { + assumedBy: new ServicePrincipal('dynamodb.amazonaws.com'), + }); + table.grantReadData(role); + } +} + +class TestStack2 extends Stack { + public constructor(scope: Construct, id: string, props: StackProps) { + super(scope, id, props); + + Role.customizeRoles(this, { + usePrecreatedRoles: { + 'cdk-table-with-customized-role2/Role': 'my-precreated-role-name', + }, + }); + + const table = new Table(this, 'Table', { + partitionKey: { + name: 'pk', + type: AttributeType.STRING, + }, + }); + const role = new Role(this, 'Role', { + assumedBy: new ServicePrincipal('dynamodb.amazonaws.com'), + }); + table.grantReadData(role); + } +} + +const app = new App(); +const stack = new TestStack(app, 'cdk-table-with-customized-role', {}); +const stack2 = new TestStack2(app, 'cdk-table-with-customized-role2', {}); +new IntegTest(app, 'cdk-dynamodb-customized-role-integ', { + testCases: [stack, stack2], + diffAssets: true, +}); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.customize-role.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.customize-role.js.snapshot/cdk.out new file mode 100644 index 0000000000000..c6e612584e352 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.customize-role.js.snapshot/cdk.out @@ -0,0 +1 @@ +{"version":"38.0.1"} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.customize-role.js.snapshot/iam-policy-report.json b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.customize-role.js.snapshot/iam-policy-report.json new file mode 100644 index 0000000000000..5158764076512 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.customize-role.js.snapshot/iam-policy-report.json @@ -0,0 +1,33 @@ +{ + "roles": [ + { + "roleConstructPath": "integ-customize-role/TestRole", + "roleName": "my-precreated-role", + "missing": false, + "assumeRolePolicy": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "sqs.amazonaws.com" + } + } + ], + "managedPolicyArns": [], + "managedPolicyStatements": [], + "identityPolicyStatements": [ + { + "Action": "sqs:SendMessage", + "Effect": "Allow", + "Resource": [ + "arn:aws:s3:::abc/xyz/123.txt", + "(NOVALUE)", + "arn:(PARTITION):iam:(REGION):(ACCOUNT)/role/FakeRole'", + "(integ-customize-role/MyGroup/Resource.Arn)/*", + "(integ-customize-role/MyGroup/Resource.Arn)" + ] + } + ] + } + ] +} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.customize-role.js.snapshot/iam-policy-report.txt b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.customize-role.js.snapshot/iam-policy-report.txt new file mode 100644 index 0000000000000..411574c3f4a84 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.customize-role.js.snapshot/iam-policy-report.txt @@ -0,0 +1,33 @@ + (integ-customize-role/TestRole) + +AssumeRole Policy: +[ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "sqs.amazonaws.com" + } + } +] + +Managed Policy ARNs: +NONE + +Managed Policies Statements: +NONE + +Identity Policy Statements: +[ + { + "Action": "sqs:SendMessage", + "Effect": "Allow", + "Resource": [ + "arn:aws:s3:::abc/xyz/123.txt", + "(NOVALUE)", + "arn:(PARTITION):iam:(REGION):(ACCOUNT)/role/FakeRole'", + "(integ-customize-role/MyGroup/Resource.Arn)/*", + "(integ-customize-role/MyGroup/Resource.Arn)" + ] + } +] \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.customize-role.js.snapshot/integ-customize-role.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.customize-role.js.snapshot/integ-customize-role.assets.json new file mode 100644 index 0000000000000..ced77f405ca79 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.customize-role.js.snapshot/integ-customize-role.assets.json @@ -0,0 +1,19 @@ +{ + "version": "38.0.1", + "files": { + "99b010bd74243a5c7fc3fe4f0861127e62239193f1706349d5e1cc8bede9b752": { + "source": { + "path": "integ-customize-role.template.json", + "packaging": "file" + }, + "destinations": { + "current_account-current_region": { + "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", + "objectKey": "99b010bd74243a5c7fc3fe4f0861127e62239193f1706349d5e1cc8bede9b752.json", + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" + } + } + } + }, + "dockerImages": {} +} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.customize-role.js.snapshot/integ-customize-role.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.customize-role.js.snapshot/integ-customize-role.template.json new file mode 100644 index 0000000000000..19256abf8289c --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.customize-role.js.snapshot/integ-customize-role.template.json @@ -0,0 +1,41 @@ +{ + "Resources": { + "MyGroupCBA54B1B": { + "Type": "AWS::IAM::Group" + } + }, + "Parameters": { + "BootstrapVersion": { + "Type": "AWS::SSM::Parameter::Value", + "Default": "/cdk-bootstrap/hnb659fds/version", + "Description": "Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]" + } + }, + "Rules": { + "CheckBootstrapVersion": { + "Assertions": [ + { + "Assert": { + "Fn::Not": [ + { + "Fn::Contains": [ + [ + "1", + "2", + "3", + "4", + "5" + ], + { + "Ref": "BootstrapVersion" + } + ] + } + ] + }, + "AssertDescription": "CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI." + } + ] + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.customize-role.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.customize-role.js.snapshot/integ.json new file mode 100644 index 0000000000000..9268abe090edd --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.customize-role.js.snapshot/integ.json @@ -0,0 +1,12 @@ +{ + "version": "38.0.1", + "testCases": { + "integ-iam-customize-role/DefaultTest": { + "stacks": [ + "integ-customize-role" + ], + "assertionStack": "integ-iam-customize-role/DefaultTest/DeployAssert", + "assertionStackName": "integiamcustomizeroleDefaultTestDeployAssert811D838D" + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.customize-role.js.snapshot/integiamcustomizeroleDefaultTestDeployAssert811D838D.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.customize-role.js.snapshot/integiamcustomizeroleDefaultTestDeployAssert811D838D.assets.json new file mode 100644 index 0000000000000..f200334e177fb --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.customize-role.js.snapshot/integiamcustomizeroleDefaultTestDeployAssert811D838D.assets.json @@ -0,0 +1,19 @@ +{ + "version": "38.0.1", + "files": { + "21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22": { + "source": { + "path": "integiamcustomizeroleDefaultTestDeployAssert811D838D.template.json", + "packaging": "file" + }, + "destinations": { + "current_account-current_region": { + "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", + "objectKey": "21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22.json", + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" + } + } + } + }, + "dockerImages": {} +} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.customize-role.js.snapshot/integiamcustomizeroleDefaultTestDeployAssert811D838D.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.customize-role.js.snapshot/integiamcustomizeroleDefaultTestDeployAssert811D838D.template.json new file mode 100644 index 0000000000000..ad9d0fb73d1dd --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.customize-role.js.snapshot/integiamcustomizeroleDefaultTestDeployAssert811D838D.template.json @@ -0,0 +1,36 @@ +{ + "Parameters": { + "BootstrapVersion": { + "Type": "AWS::SSM::Parameter::Value", + "Default": "/cdk-bootstrap/hnb659fds/version", + "Description": "Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]" + } + }, + "Rules": { + "CheckBootstrapVersion": { + "Assertions": [ + { + "Assert": { + "Fn::Not": [ + { + "Fn::Contains": [ + [ + "1", + "2", + "3", + "4", + "5" + ], + { + "Ref": "BootstrapVersion" + } + ] + } + ] + }, + "AssertDescription": "CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI." + } + ] + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.customize-role.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.customize-role.js.snapshot/manifest.json new file mode 100644 index 0000000000000..c68843a263202 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.customize-role.js.snapshot/manifest.json @@ -0,0 +1,115 @@ +{ + "version": "38.0.1", + "artifacts": { + "integ-customize-role.assets": { + "type": "cdk:asset-manifest", + "properties": { + "file": "integ-customize-role.assets.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "integ-customize-role": { + "type": "aws:cloudformation:stack", + "environment": "aws://unknown-account/unknown-region", + "properties": { + "templateFile": "integ-customize-role.template.json", + "terminationProtection": false, + "validateOnSynth": false, + "notificationArns": [], + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", + "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", + "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/99b010bd74243a5c7fc3fe4f0861127e62239193f1706349d5e1cc8bede9b752.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", + "additionalDependencies": [ + "integ-customize-role.assets" + ], + "lookupRole": { + "arn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-lookup-role-${AWS::AccountId}-${AWS::Region}", + "requiresBootstrapStackVersion": 8, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "dependencies": [ + "integ-customize-role.assets" + ], + "metadata": { + "/integ-customize-role/MyGroup/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "MyGroupCBA54B1B" + } + ], + "/integ-customize-role/BootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "BootstrapVersion" + } + ], + "/integ-customize-role/CheckBootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "CheckBootstrapVersion" + } + ] + }, + "displayName": "integ-customize-role" + }, + "integiamcustomizeroleDefaultTestDeployAssert811D838D.assets": { + "type": "cdk:asset-manifest", + "properties": { + "file": "integiamcustomizeroleDefaultTestDeployAssert811D838D.assets.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "integiamcustomizeroleDefaultTestDeployAssert811D838D": { + "type": "aws:cloudformation:stack", + "environment": "aws://unknown-account/unknown-region", + "properties": { + "templateFile": "integiamcustomizeroleDefaultTestDeployAssert811D838D.template.json", + "terminationProtection": false, + "validateOnSynth": false, + "notificationArns": [], + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", + "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", + "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", + "additionalDependencies": [ + "integiamcustomizeroleDefaultTestDeployAssert811D838D.assets" + ], + "lookupRole": { + "arn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-lookup-role-${AWS::AccountId}-${AWS::Region}", + "requiresBootstrapStackVersion": 8, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "dependencies": [ + "integiamcustomizeroleDefaultTestDeployAssert811D838D.assets" + ], + "metadata": { + "/integ-iam-customize-role/DefaultTest/DeployAssert/BootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "BootstrapVersion" + } + ], + "/integ-iam-customize-role/DefaultTest/DeployAssert/CheckBootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "CheckBootstrapVersion" + } + ] + }, + "displayName": "integ-iam-customize-role/DefaultTest/DeployAssert" + }, + "Tree": { + "type": "cdk:tree", + "properties": { + "file": "tree.json" + } + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.customize-role.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.customize-role.js.snapshot/tree.json new file mode 100644 index 0000000000000..8ea986612ca8b --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.customize-role.js.snapshot/tree.json @@ -0,0 +1,157 @@ +{ + "version": "tree-0.1", + "tree": { + "id": "App", + "path": "", + "children": { + "integ-customize-role": { + "id": "integ-customize-role", + "path": "integ-customize-role", + "children": { + "MyGroup": { + "id": "MyGroup", + "path": "integ-customize-role/MyGroup", + "children": { + "Resource": { + "id": "Resource", + "path": "integ-customize-role/MyGroup/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Group", + "aws:cdk:cloudformation:props": {} + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.CfnGroup", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.Group", + "version": "0.0.0" + } + }, + "TestRole": { + "id": "TestRole", + "path": "integ-customize-role/TestRole", + "children": { + "ImportTestRole": { + "id": "ImportTestRole", + "path": "integ-customize-role/TestRole/ImportTestRole", + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "0.0.0" + } + }, + "PrecreatedRoleTestRole": { + "id": "PrecreatedRoleTestRole", + "path": "integ-customize-role/TestRole/PrecreatedRoleTestRole", + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.Role", + "version": "0.0.0" + } + }, + "BootstrapVersion": { + "id": "BootstrapVersion", + "path": "integ-customize-role/BootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnParameter", + "version": "0.0.0" + } + }, + "CheckBootstrapVersion": { + "id": "CheckBootstrapVersion", + "path": "integ-customize-role/CheckBootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnRule", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.Stack", + "version": "0.0.0" + } + }, + "PolicySynthesizer": { + "id": "PolicySynthesizer", + "path": "PolicySynthesizer", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.3.0" + } + }, + "integ-iam-customize-role": { + "id": "integ-iam-customize-role", + "path": "integ-iam-customize-role", + "children": { + "DefaultTest": { + "id": "DefaultTest", + "path": "integ-iam-customize-role/DefaultTest", + "children": { + "Default": { + "id": "Default", + "path": "integ-iam-customize-role/DefaultTest/Default", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.3.0" + } + }, + "DeployAssert": { + "id": "DeployAssert", + "path": "integ-iam-customize-role/DefaultTest/DeployAssert", + "children": { + "BootstrapVersion": { + "id": "BootstrapVersion", + "path": "integ-iam-customize-role/DefaultTest/DeployAssert/BootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnParameter", + "version": "0.0.0" + } + }, + "CheckBootstrapVersion": { + "id": "CheckBootstrapVersion", + "path": "integ-iam-customize-role/DefaultTest/DeployAssert/CheckBootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnRule", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.Stack", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/integ-tests-alpha.IntegTestCase", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/integ-tests-alpha.IntegTest", + "version": "0.0.0" + } + }, + "Tree": { + "id": "Tree", + "path": "Tree", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.3.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.App", + "version": "0.0.0" + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.customize-role.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.customize-role.ts new file mode 100644 index 0000000000000..13f36822fdb6f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.customize-role.ts @@ -0,0 +1,36 @@ +import { App, Fn, Stack } from 'aws-cdk-lib'; +import { IntegTest } from '@aws-cdk/integ-tests-alpha'; +import { Group, PolicyStatement, Role, ServicePrincipal } from 'aws-cdk-lib/aws-iam'; + +const app = new App(); + +const stack = new Stack(app, 'integ-customize-role'); + +Role.customizeRoles(stack, { + usePrecreatedRoles: { + 'integ-customize-role/TestRole': 'my-precreated-role', + }, +}); + +const group = new Group(stack, 'MyGroup'); + +const role = new Role(stack, 'TestRole', { + assumedBy: new ServicePrincipal('sqs.amazonaws.com'), +}); + +role.addToPolicy(new PolicyStatement({ + resources: [ + 'arn:aws:s3:::abc/xyz/123.txt', + Fn.ref('AWS::NoValue'), + `arn:${Fn.ref('AWS::Partition')}:iam:${Fn.ref('AWS::Region')}:${Fn.ref('AWS::AccountId')}/role/FakeRole'`, + `${group.groupArn}/*`, + group.groupArn, + ], + actions: ['sqs:SendMessage'], +})); + +new IntegTest(app, 'integ-iam-customize-role', { + testCases: [stack], +}); + +app.synth(); diff --git a/packages/aws-cdk-lib/aws-iam/README.md b/packages/aws-cdk-lib/aws-iam/README.md index 8d4ad61d3243b..686c0b443172f 100644 --- a/packages/aws-cdk-lib/aws-iam/README.md +++ b/packages/aws-cdk-lib/aws-iam/README.md @@ -238,6 +238,72 @@ iam.Role.customizeRoles(this, { For more information on configuring permissions see the [Security And Safety Dev Guide](https://github.com/aws/aws-cdk/wiki/Security-And-Safety-Dev-Guide) +#### Policy report generation + +When `customizeRoles` is used, the `iam-policy-report.txt` report will contain a list +of IAM roles and associated permissions that would have been created. This report is +generated in an attempt to resolve and replace any references with a more user-friendly +value. + +The following are some examples of the value that will appear in the report: + +```json +"Resource": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/Role" + ] + ] +} +``` + +The policy report will instead get: + +```json +"Resource": "arn:(PARTITION):iam::(ACCOUNT):role/Role" +``` + +If IAM policy is referencing a resource attribute: + +```json +"Resource": [ + { + "Fn::GetAtt": [ + "SomeResource", + "Arn" + ] + }, + { + "Ref": "AWS::NoValue", + } +] +``` + +The policy report will instead get: + +```json +"Resource": [ + "(Path/To/SomeResource.Arn)" + "(NOVALUE)" +] +``` + +The following pseudo parameters will be converted: + +1. `{ 'Ref': 'AWS::AccountId' }` -> `(ACCOUNT) +2. `{ 'Ref': 'AWS::Partition' }` -> `(PARTITION) +3. `{ 'Ref': 'AWS::Region' }` -> `(REGION) +4. `{ 'Ref': 'AWS::NoValue' }` -> `(NOVALUE) + #### Generating a permissions report It is also possible to generate the report _without_ preventing the role/policy creation. diff --git a/packages/aws-cdk-lib/core/lib/helpers-internal/customize-roles.ts b/packages/aws-cdk-lib/core/lib/helpers-internal/customize-roles.ts index 67d81b5d85727..c456cfb2665db 100644 --- a/packages/aws-cdk-lib/core/lib/helpers-internal/customize-roles.ts +++ b/packages/aws-cdk-lib/core/lib/helpers-internal/customize-roles.ts @@ -4,7 +4,7 @@ import { Construct } from 'constructs'; import { Annotations } from '../annotations'; import { attachCustomSynthesis } from '../app'; import { Reference } from '../reference'; -import { IResolvable, DefaultTokenResolver, StringConcat } from '../resolvable'; +import { IResolvable, StringConcat, DefaultTokenResolver, IFragmentConcatenator } from '../resolvable'; import { ISynthesisSession } from '../stack-synthesizers'; import { Token, Tokenization } from '../token'; @@ -122,6 +122,48 @@ interface PolicyReportRole { readonly identityPolicyStatements?: string[]; } +/** + * PolicySynthesizer token resolver implementation + * + */ +export class PolicySynthesizerTokenResolver extends DefaultTokenResolver { + constructor(concat: IFragmentConcatenator) { + super(concat); + } + + /** + * PolicySynthesizer Token resolution + * + * Resolve the Token until the token can be resolved into + * "(Path/To/SomeResource.Arn)" format. Otherwise, recurse + * into whatever it returns, + */ + public resolveToken(t: IResolvable, context: any, postProcessor: any) { + try { + let resolved = t.resolve(context); + + // If the token value is resolvable into the format "(Path/To/SomeResource.Arn)", return it + // as this is the format expected by the Policy Synthesizer. + const resolvable = Tokenization.reverseString(resolved); + if (resolvable.length === 1 && Reference.isReference(resolvable.firstToken)) { + return `(${resolvable.firstToken.target.node.path}.${resolvable.firstToken.displayName})`; + } + // The token might have returned more values that need resolving, recurse + resolved = context.resolve(resolved); + resolved = postProcessor.postProcess(resolved, context); + return resolved; + } catch (e: any) { + let message = `Resolution error: ${e.message}.`; + if (t.creationStack && t.creationStack.length > 0) { + message += `\nObject creation stack:\n at ${t.creationStack.join('\n at ')}`; + } + + e.message = message; + throw e; + } + } +} + /** * A construct that is responsible for generating an IAM policy Report * for all IAM roles that are created as part of the CDK application. @@ -139,14 +181,17 @@ export class PolicySynthesizer extends Construct { if (synthesizer) { return synthesizer as PolicySynthesizer; } - return new PolicySynthesizer(scope.node.root); + return new PolicySynthesizer(scope); } + private readonly _scope: Construct; private readonly roleReport: { [rolePath: string]: RoleReportOptions } = {}; private readonly managedPolicyReport: { [policyPath: string]: ManagedPolicyReportOptions } = {}; constructor(scope: Construct) { - super(scope, POLICY_SYNTHESIZER_ID); + // PolicySynthesizer should be created under the `App` scope + super(scope.node.root, POLICY_SYNTHESIZER_ID); + this._scope = scope; attachCustomSynthesis(this, { onSynthesize: (session: ISynthesisSession) => { const report = this.createJsonReport(); @@ -195,7 +240,7 @@ export class PolicySynthesizer extends Construct { '', 'Identity Policy Statements:', this.toJsonString(role.identityPolicyStatements), - ].join('\n')).join(''); + ].join('\n')).join('\n\n'); } /** @@ -316,9 +361,11 @@ export class PolicySynthesizer extends Construct { if (Reference.isReference(r)) { return `(${r.target.node.path}.${r.displayName})`; } + // Token resolution requires a stack scope. We can't directly use 'this' scope + // because PolicySynthesizer is always created under 'App' scope. const resolved = Tokenization.resolve(r, { - scope: this, - resolver: new DefaultTokenResolver(new StringConcat()), + scope: this._scope, + resolver: new PolicySynthesizerTokenResolver(new StringConcat()), }); if (typeof resolved === 'object' && resolved.hasOwnProperty('Ref')) { switch (resolved.Ref) { @@ -328,10 +375,18 @@ export class PolicySynthesizer extends Construct { return '(PARTITION)'; case 'AWS::Region': return '(REGION)'; + case 'AWS::NoValue': + return '(NOVALUE)'; default: return r; } } + // If the original value is an unresolved Token and we have successfully + // resolve it through the above Token resolution process, we should + // return the resolved token instead. + if (Token.isUnresolved(r) && typeof resolved === 'string' && resolved) { + return resolved; + } return r; }, }); From b35adf1026689512be54c003da9fb2b73d825d26 Mon Sep 17 00:00:00 2001 From: Di Wu Date: Tue, 22 Oct 2024 12:14:06 -0700 Subject: [PATCH 11/33] chore(s3): update README to mention support for uppercase letters in legacy bucket names (#31852) ### Issue # (if applicable) Closes #. ### Reason for this change PR https://github.com/aws/aws-cdk/pull/31813 ### Description of changes - update s3 README to mention support for uppercase letters in legacy bucket names ### Description of how you validated changes preview of the README file ### Checklist - [x] My code adheres to the [CONTRIBUTING GUIDE](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and [DESIGN GUIDELINES](https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md) ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license* --- packages/aws-cdk-lib/aws-s3/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/aws-cdk-lib/aws-s3/README.md b/packages/aws-cdk-lib/aws-s3/README.md index c93aa152c1d58..c46cf34c3c43c 100644 --- a/packages/aws-cdk-lib/aws-s3/README.md +++ b/packages/aws-cdk-lib/aws-s3/README.md @@ -225,8 +225,8 @@ To import an existing bucket into your CDK application, use the `Bucket.fromBuck factory method. This method accepts `BucketAttributes` which describes the properties of an already existing bucket: -Note that this method allows importing buckets with legacy names containing underscores (`_`), which was -permitted for buckets created before March 1, 2018. For buckets created after this date, underscores +Note that this method allows importing buckets with legacy names containing uppercase letters (`A-Z`) or underscores (`_`), which were +permitted for buckets created before March 1, 2018. For buckets created after this date, uppercase letters and underscores are not allowed in the bucket name. ```ts From 21224618be7190542edbb53f7db455aaccf44bf3 Mon Sep 17 00:00:00 2001 From: Leonardo Gama <51037424+Leo10Gama@users.noreply.github.com> Date: Tue, 22 Oct 2024 12:57:58 -0700 Subject: [PATCH 12/33] chore(cognito-identitypool): update README to encourage least privilege (#31811) ### Issue # (if applicable) N/A ### Reason for this change To ensure customers are using the module securely, we want to encourage them to follow the best practice of the principal of least privilege. That is, customers are only providing as much access as necessary to complete the task, and no privileges greater than that. ### Description of changes * Updated the README to include sentences around the privilege and access granting sections encouraging only giving the least amount of privileges necessary. * Updated the README example to remove wildcard privilege. ### Description of how you validated changes `yarn rosetta:extract` passes. ### Checklist - [x] My code adheres to the [CONTRIBUTING GUIDE](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and [DESIGN GUIDELINES](https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md) ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license* --- .../aws-cognito-identitypool-alpha/README.md | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/packages/@aws-cdk/aws-cognito-identitypool-alpha/README.md b/packages/@aws-cdk/aws-cognito-identitypool-alpha/README.md index 1b465e96d1276..0d1953fe62fe5 100644 --- a/packages/@aws-cdk/aws-cognito-identitypool-alpha/README.md +++ b/packages/@aws-cdk/aws-cognito-identitypool-alpha/README.md @@ -74,7 +74,8 @@ unauthenticated (guest) roles applied to the identity pool: new IdentityPool(this, 'myIdentityPool'); ``` -By default, both the authenticated and unauthenticated roles will have no permissions attached. Grant permissions +By default, both the authenticated and unauthenticated roles will have no permissions attached. When granting permissions, +you should ensure that you are granting the least privileged permissions required for your use case. Grant permissions to roles using the public `authenticatedRole` and `unauthenticatedRole` properties: ```ts @@ -88,11 +89,11 @@ table.grantReadWriteData(identityPool.authenticatedRole); // Grant permissions to unauthenticated guest users table.grantReadData(identityPool.unauthenticatedRole); -//Or add policy statements straight to the role +// Or add policy statements straight to the role identityPool.authenticatedRole.addToPrincipalPolicy(new iam.PolicyStatement({ effect: iam.Effect.ALLOW, - actions: ['dynamodb:*'], - resources: ['*'], + actions: ['dynamodb:UpdateItem'], + resources: [table.tableArn], })); ``` @@ -253,7 +254,8 @@ new IdentityPool(this, 'myidentitypool', { In addition to setting default roles for authenticated and unauthenticated users, identity pools can also be used to define rules to choose the role for each user based on claims in the user's ID token by using Role Mapping. When using -role mapping, it's important to be aware of some of the permissions the role will need. An in depth +role mapping, it's important to be aware of some of the permissions the role will need, and that the least privileged +roles necessary are given for your specific use case. An in depth review of roles and role mapping can be found [here](https://docs.aws.amazon.com/cognito/latest/developerguide/role-based-access-control.html). Using a [token-based approach](https://docs.aws.amazon.com/cognito/latest/developerguide/role-based-access-control.html#using-tokens-to-assign-roles-to-users) to role mapping will allow mapped roles to be passed through the `cognito:roles` or From b22899f9dee04d5c446ebcdfff810a954ac08dc6 Mon Sep 17 00:00:00 2001 From: Leonardo Gama <51037424+Leo10Gama@users.noreply.github.com> Date: Tue, 22 Oct 2024 14:45:43 -0700 Subject: [PATCH 13/33] feat(cognito): the Cognito Identity Pools module is now in Developer Preview (#31854) ### Description of changes Updated the README stability banner as we move Cognito Identity Pools into developer preview, taking the next step towards being fully stabilized. ### Checklist - [x] My code adheres to the [CONTRIBUTING GUIDE](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and [DESIGN GUIDELINES](https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md) ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license* --- .../aws-cognito-identitypool-alpha/README.md | 22 +++++++++---------- .../package.json | 2 +- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/packages/@aws-cdk/aws-cognito-identitypool-alpha/README.md b/packages/@aws-cdk/aws-cognito-identitypool-alpha/README.md index 0d1953fe62fe5..a188ce4f0cd36 100644 --- a/packages/@aws-cdk/aws-cognito-identitypool-alpha/README.md +++ b/packages/@aws-cdk/aws-cognito-identitypool-alpha/README.md @@ -1,25 +1,25 @@ # Amazon Cognito Identity Pool Construct Library - -> **Identity Pools are in a separate module while the API is being stabilized. Once we stabilize the module, they will** -**be included into the stable [aws-cognito](../aws-cognito) library. Please provide feedback on this experience by** -**creating an [issue here](https://github.com/aws/aws-cdk/issues/new/choose)** - --- -![cdk-constructs: Experimental](https://img.shields.io/badge/cdk--constructs-experimental-important.svg?style=for-the-badge) +![cdk-constructs: Developer Preview](https://img.shields.io/badge/cdk--constructs-developer--preview-informational.svg?style=for-the-badge) -> The APIs of higher level constructs in this module are experimental and under active development. -> They are subject to non-backward compatible changes or removal in any future version. These are -> not subject to the [Semantic Versioning](https://semver.org/) model and breaking changes will be -> announced in the release notes. This means that while you may use them, you may need to update -> your source code when upgrading to a newer version of this package. +> The APIs of higher level constructs in this module are in **developer preview** before they +> become stable. We will only make breaking changes to address unforeseen API issues. Therefore, +> these APIs are not subject to [Semantic Versioning](https://semver.org/), and breaking changes +> will be announced in release notes. This means that while you may use them, you may need to +> update your source code when upgrading to a newer version of this package. --- + +> **Identity Pools are in a separate module while the API is being stabilized. Once we stabilize the module, they will** +**be included into the stable [aws-cognito](../aws-cognito) library. Please provide feedback on this experience by** +**creating an [issue here](https://github.com/aws/aws-cdk/issues/new/choose)** + [Amazon Cognito Identity Pools](https://docs.aws.amazon.com/cognito/latest/developerguide/cognito-identity.html) enable you to grant your users access to other AWS services. Identity Pools are one of the two main components of [Amazon Cognito](https://docs.aws.amazon.com/cognito/latest/developerguide/what-is-amazon-cognito.html), which provides authentication, authorization, and diff --git a/packages/@aws-cdk/aws-cognito-identitypool-alpha/package.json b/packages/@aws-cdk/aws-cognito-identitypool-alpha/package.json index c1279b90a11ab..44edd140bd4c0 100644 --- a/packages/@aws-cdk/aws-cognito-identitypool-alpha/package.json +++ b/packages/@aws-cdk/aws-cognito-identitypool-alpha/package.json @@ -99,7 +99,7 @@ "node": ">= 14.15.0" }, "stability": "experimental", - "maturity": "experimental", + "maturity": "developer-preview", "awscdkio": { "announce": false }, From e96b4ce4ae64076e4c2e688c649c69fb15a624d6 Mon Sep 17 00:00:00 2001 From: GZ Date: Tue, 22 Oct 2024 15:39:06 -0700 Subject: [PATCH 14/33] fix(ec2): allow NAT instance to associate public IP (#31812) ### Issue # (if applicable) Closes #31711 ### Reason for this change When we set mapPublicIpOnLaunch=false for public subnets, NAT instances does not get public IP addresses assigned, resulting in non-working NAT instances. Disabling mapPublicIpOnLaunch is recommended as AWS Config rule (and cdk-nag as well.) https://docs.aws.amazon.com/config/latest/developerguide/subnet-auto-assign-public-ip-disabled.html ### Description of changes Support `associatePublicIpAddress` ### Description of how you validated changes New unit and integ tests. ### Checklist - [ ] My code adheres to the [CONTRIBUTING GUIDE](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and [DESIGN GUIDELINES](https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md) ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license* --- ...at-instances-v2-with-public-ip.assets.json | 19 + ...-instances-v2-with-public-ip.template.json | 560 ++++++++++ .../cdk.out | 1 + .../integ.json | 12 + .../manifest.json | 271 +++++ ...efaultTestDeployAssertB63E4D9C.assets.json | 19 + ...aultTestDeployAssertB63E4D9C.template.json | 36 + .../tree.json | 975 ++++++++++++++++++ .../integ.nat-instances-with-public-ip.ts | 36 + packages/aws-cdk-lib/aws-ec2/README.md | 17 + packages/aws-cdk-lib/aws-ec2/lib/nat.ts | 8 + packages/aws-cdk-lib/aws-ec2/test/vpc.test.ts | 34 +- 12 files changed, 1987 insertions(+), 1 deletion(-) create mode 100644 packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.nat-instances-with-public-ip.js.snapshot/aws-cdk-vpc-nat-instances-v2-with-public-ip.assets.json create mode 100644 packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.nat-instances-with-public-ip.js.snapshot/aws-cdk-vpc-nat-instances-v2-with-public-ip.template.json create mode 100644 packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.nat-instances-with-public-ip.js.snapshot/cdk.out create mode 100644 packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.nat-instances-with-public-ip.js.snapshot/integ.json create mode 100644 packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.nat-instances-with-public-ip.js.snapshot/manifest.json create mode 100644 packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.nat-instances-with-public-ip.js.snapshot/natinstancev2withpublicipintegtestDefaultTestDeployAssertB63E4D9C.assets.json create mode 100644 packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.nat-instances-with-public-ip.js.snapshot/natinstancev2withpublicipintegtestDefaultTestDeployAssertB63E4D9C.template.json create mode 100644 packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.nat-instances-with-public-ip.js.snapshot/tree.json create mode 100644 packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.nat-instances-with-public-ip.ts diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.nat-instances-with-public-ip.js.snapshot/aws-cdk-vpc-nat-instances-v2-with-public-ip.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.nat-instances-with-public-ip.js.snapshot/aws-cdk-vpc-nat-instances-v2-with-public-ip.assets.json new file mode 100644 index 0000000000000..b496d562e5d2d --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.nat-instances-with-public-ip.js.snapshot/aws-cdk-vpc-nat-instances-v2-with-public-ip.assets.json @@ -0,0 +1,19 @@ +{ + "version": "38.0.1", + "files": { + "82c3f0a93612fe78dff80eaf1a5725700fc3f35af42e8e50793b634838d2c6eb": { + "source": { + "path": "aws-cdk-vpc-nat-instances-v2-with-public-ip.template.json", + "packaging": "file" + }, + "destinations": { + "current_account-current_region": { + "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", + "objectKey": "82c3f0a93612fe78dff80eaf1a5725700fc3f35af42e8e50793b634838d2c6eb.json", + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" + } + } + } + }, + "dockerImages": {} +} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.nat-instances-with-public-ip.js.snapshot/aws-cdk-vpc-nat-instances-v2-with-public-ip.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.nat-instances-with-public-ip.js.snapshot/aws-cdk-vpc-nat-instances-v2-with-public-ip.template.json new file mode 100644 index 0000000000000..8bd49b720a9f8 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.nat-instances-with-public-ip.js.snapshot/aws-cdk-vpc-nat-instances-v2-with-public-ip.template.json @@ -0,0 +1,560 @@ +{ + "Resources": { + "Vpc8378EB38": { + "Type": "AWS::EC2::VPC", + "Properties": { + "CidrBlock": "10.0.0.0/16", + "EnableDnsHostnames": true, + "EnableDnsSupport": true, + "InstanceTenancy": "default", + "Tags": [ + { + "Key": "Name", + "Value": "aws-cdk-vpc-nat-instances-v2-with-public-ip/Vpc" + } + ] + } + }, + "VpcPublicSubnet1Subnet5C2D37C4": { + "Type": "AWS::EC2::Subnet", + "Properties": { + "AvailabilityZone": { + "Fn::Select": [ + 0, + { + "Fn::GetAZs": "" + } + ] + }, + "CidrBlock": "10.0.0.0/18", + "MapPublicIpOnLaunch": false, + "Tags": [ + { + "Key": "aws-cdk:subnet-name", + "Value": "Public" + }, + { + "Key": "aws-cdk:subnet-type", + "Value": "Public" + }, + { + "Key": "Name", + "Value": "aws-cdk-vpc-nat-instances-v2-with-public-ip/Vpc/PublicSubnet1" + } + ], + "VpcId": { + "Ref": "Vpc8378EB38" + } + } + }, + "VpcPublicSubnet1RouteTable6C95E38E": { + "Type": "AWS::EC2::RouteTable", + "Properties": { + "Tags": [ + { + "Key": "Name", + "Value": "aws-cdk-vpc-nat-instances-v2-with-public-ip/Vpc/PublicSubnet1" + } + ], + "VpcId": { + "Ref": "Vpc8378EB38" + } + } + }, + "VpcPublicSubnet1RouteTableAssociation97140677": { + "Type": "AWS::EC2::SubnetRouteTableAssociation", + "Properties": { + "RouteTableId": { + "Ref": "VpcPublicSubnet1RouteTable6C95E38E" + }, + "SubnetId": { + "Ref": "VpcPublicSubnet1Subnet5C2D37C4" + } + } + }, + "VpcPublicSubnet1DefaultRoute3DA9E72A": { + "Type": "AWS::EC2::Route", + "Properties": { + "DestinationCidrBlock": "0.0.0.0/0", + "GatewayId": { + "Ref": "VpcIGWD7BA715C" + }, + "RouteTableId": { + "Ref": "VpcPublicSubnet1RouteTable6C95E38E" + } + }, + "DependsOn": [ + "VpcVPCGWBF912B6E" + ] + }, + "VpcPublicSubnet1NatInstanceInstanceRole9D835E32": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "ec2.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + }, + "Tags": [ + { + "Key": "Name", + "Value": "aws-cdk-vpc-nat-instances-v2-with-public-ip/Vpc/PublicSubnet1/NatInstance" + } + ] + } + }, + "VpcPublicSubnet1NatInstanceInstanceProfileEE10C485": { + "Type": "AWS::IAM::InstanceProfile", + "Properties": { + "Roles": [ + { + "Ref": "VpcPublicSubnet1NatInstanceInstanceRole9D835E32" + } + ] + } + }, + "VpcPublicSubnet1NatInstance57B636B8": { + "Type": "AWS::EC2::Instance", + "Properties": { + "AvailabilityZone": { + "Fn::Select": [ + 0, + { + "Fn::GetAZs": "" + } + ] + }, + "IamInstanceProfile": { + "Ref": "VpcPublicSubnet1NatInstanceInstanceProfileEE10C485" + }, + "ImageId": { + "Ref": "SsmParameterValueawsserviceamiamazonlinuxlatestal2023amikernel61arm64C96584B6F00A464EAD1953AFF4B05118Parameter" + }, + "InstanceType": "t4g.micro", + "NetworkInterfaces": [ + { + "AssociatePublicIpAddress": true, + "DeviceIndex": "0", + "GroupSet": [ + { + "Fn::GetAtt": [ + "VpcNatSecurityGroup8DA26EDC", + "GroupId" + ] + } + ], + "SubnetId": { + "Ref": "VpcPublicSubnet1Subnet5C2D37C4" + } + } + ], + "SourceDestCheck": false, + "Tags": [ + { + "Key": "Name", + "Value": "aws-cdk-vpc-nat-instances-v2-with-public-ip/Vpc/PublicSubnet1/NatInstance" + } + ], + "UserData": { + "Fn::Base64": "#!/bin/bash\nyum install iptables-services -y\nsystemctl enable iptables\nsystemctl start iptables\necho \"net.ipv4.ip_forward=1\" > /etc/sysctl.d/custom-ip-forwarding.conf\nsudo sysctl -p /etc/sysctl.d/custom-ip-forwarding.conf\nsudo /sbin/iptables -t nat -A POSTROUTING -o $(route | awk '/^default/{print $NF}') -j MASQUERADE\nsudo /sbin/iptables -F FORWARD\nsudo service iptables save" + } + }, + "DependsOn": [ + "VpcPublicSubnet1DefaultRoute3DA9E72A", + "VpcPublicSubnet1NatInstanceInstanceRole9D835E32", + "VpcPublicSubnet1RouteTableAssociation97140677" + ] + }, + "VpcPublicSubnet2Subnet691E08A3": { + "Type": "AWS::EC2::Subnet", + "Properties": { + "AvailabilityZone": { + "Fn::Select": [ + 1, + { + "Fn::GetAZs": "" + } + ] + }, + "CidrBlock": "10.0.64.0/18", + "MapPublicIpOnLaunch": false, + "Tags": [ + { + "Key": "aws-cdk:subnet-name", + "Value": "Public" + }, + { + "Key": "aws-cdk:subnet-type", + "Value": "Public" + }, + { + "Key": "Name", + "Value": "aws-cdk-vpc-nat-instances-v2-with-public-ip/Vpc/PublicSubnet2" + } + ], + "VpcId": { + "Ref": "Vpc8378EB38" + } + } + }, + "VpcPublicSubnet2RouteTable94F7E489": { + "Type": "AWS::EC2::RouteTable", + "Properties": { + "Tags": [ + { + "Key": "Name", + "Value": "aws-cdk-vpc-nat-instances-v2-with-public-ip/Vpc/PublicSubnet2" + } + ], + "VpcId": { + "Ref": "Vpc8378EB38" + } + } + }, + "VpcPublicSubnet2RouteTableAssociationDD5762D8": { + "Type": "AWS::EC2::SubnetRouteTableAssociation", + "Properties": { + "RouteTableId": { + "Ref": "VpcPublicSubnet2RouteTable94F7E489" + }, + "SubnetId": { + "Ref": "VpcPublicSubnet2Subnet691E08A3" + } + } + }, + "VpcPublicSubnet2DefaultRoute97F91067": { + "Type": "AWS::EC2::Route", + "Properties": { + "DestinationCidrBlock": "0.0.0.0/0", + "GatewayId": { + "Ref": "VpcIGWD7BA715C" + }, + "RouteTableId": { + "Ref": "VpcPublicSubnet2RouteTable94F7E489" + } + }, + "DependsOn": [ + "VpcVPCGWBF912B6E" + ] + }, + "VpcPublicSubnet2NatInstanceInstanceRoleB3D21235": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "ec2.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + }, + "Tags": [ + { + "Key": "Name", + "Value": "aws-cdk-vpc-nat-instances-v2-with-public-ip/Vpc/PublicSubnet2/NatInstance" + } + ] + } + }, + "VpcPublicSubnet2NatInstanceInstanceProfile549888F0": { + "Type": "AWS::IAM::InstanceProfile", + "Properties": { + "Roles": [ + { + "Ref": "VpcPublicSubnet2NatInstanceInstanceRoleB3D21235" + } + ] + } + }, + "VpcPublicSubnet2NatInstance746890A7": { + "Type": "AWS::EC2::Instance", + "Properties": { + "AvailabilityZone": { + "Fn::Select": [ + 1, + { + "Fn::GetAZs": "" + } + ] + }, + "IamInstanceProfile": { + "Ref": "VpcPublicSubnet2NatInstanceInstanceProfile549888F0" + }, + "ImageId": { + "Ref": "SsmParameterValueawsserviceamiamazonlinuxlatestal2023amikernel61arm64C96584B6F00A464EAD1953AFF4B05118Parameter" + }, + "InstanceType": "t4g.micro", + "NetworkInterfaces": [ + { + "AssociatePublicIpAddress": true, + "DeviceIndex": "0", + "GroupSet": [ + { + "Fn::GetAtt": [ + "VpcNatSecurityGroup8DA26EDC", + "GroupId" + ] + } + ], + "SubnetId": { + "Ref": "VpcPublicSubnet2Subnet691E08A3" + } + } + ], + "SourceDestCheck": false, + "Tags": [ + { + "Key": "Name", + "Value": "aws-cdk-vpc-nat-instances-v2-with-public-ip/Vpc/PublicSubnet2/NatInstance" + } + ], + "UserData": { + "Fn::Base64": "#!/bin/bash\nyum install iptables-services -y\nsystemctl enable iptables\nsystemctl start iptables\necho \"net.ipv4.ip_forward=1\" > /etc/sysctl.d/custom-ip-forwarding.conf\nsudo sysctl -p /etc/sysctl.d/custom-ip-forwarding.conf\nsudo /sbin/iptables -t nat -A POSTROUTING -o $(route | awk '/^default/{print $NF}') -j MASQUERADE\nsudo /sbin/iptables -F FORWARD\nsudo service iptables save" + } + }, + "DependsOn": [ + "VpcPublicSubnet2DefaultRoute97F91067", + "VpcPublicSubnet2NatInstanceInstanceRoleB3D21235", + "VpcPublicSubnet2RouteTableAssociationDD5762D8" + ] + }, + "VpcPrivateSubnet1Subnet536B997A": { + "Type": "AWS::EC2::Subnet", + "Properties": { + "AvailabilityZone": { + "Fn::Select": [ + 0, + { + "Fn::GetAZs": "" + } + ] + }, + "CidrBlock": "10.0.128.0/18", + "MapPublicIpOnLaunch": false, + "Tags": [ + { + "Key": "aws-cdk:subnet-name", + "Value": "Private" + }, + { + "Key": "aws-cdk:subnet-type", + "Value": "Private" + }, + { + "Key": "Name", + "Value": "aws-cdk-vpc-nat-instances-v2-with-public-ip/Vpc/PrivateSubnet1" + } + ], + "VpcId": { + "Ref": "Vpc8378EB38" + } + } + }, + "VpcPrivateSubnet1RouteTableB2C5B500": { + "Type": "AWS::EC2::RouteTable", + "Properties": { + "Tags": [ + { + "Key": "Name", + "Value": "aws-cdk-vpc-nat-instances-v2-with-public-ip/Vpc/PrivateSubnet1" + } + ], + "VpcId": { + "Ref": "Vpc8378EB38" + } + } + }, + "VpcPrivateSubnet1RouteTableAssociation70C59FA6": { + "Type": "AWS::EC2::SubnetRouteTableAssociation", + "Properties": { + "RouteTableId": { + "Ref": "VpcPrivateSubnet1RouteTableB2C5B500" + }, + "SubnetId": { + "Ref": "VpcPrivateSubnet1Subnet536B997A" + } + } + }, + "VpcPrivateSubnet1DefaultRouteBE02A9ED": { + "Type": "AWS::EC2::Route", + "Properties": { + "DestinationCidrBlock": "0.0.0.0/0", + "InstanceId": { + "Ref": "VpcPublicSubnet1NatInstance57B636B8" + }, + "RouteTableId": { + "Ref": "VpcPrivateSubnet1RouteTableB2C5B500" + } + } + }, + "VpcPrivateSubnet2Subnet3788AAA1": { + "Type": "AWS::EC2::Subnet", + "Properties": { + "AvailabilityZone": { + "Fn::Select": [ + 1, + { + "Fn::GetAZs": "" + } + ] + }, + "CidrBlock": "10.0.192.0/18", + "MapPublicIpOnLaunch": false, + "Tags": [ + { + "Key": "aws-cdk:subnet-name", + "Value": "Private" + }, + { + "Key": "aws-cdk:subnet-type", + "Value": "Private" + }, + { + "Key": "Name", + "Value": "aws-cdk-vpc-nat-instances-v2-with-public-ip/Vpc/PrivateSubnet2" + } + ], + "VpcId": { + "Ref": "Vpc8378EB38" + } + } + }, + "VpcPrivateSubnet2RouteTableA678073B": { + "Type": "AWS::EC2::RouteTable", + "Properties": { + "Tags": [ + { + "Key": "Name", + "Value": "aws-cdk-vpc-nat-instances-v2-with-public-ip/Vpc/PrivateSubnet2" + } + ], + "VpcId": { + "Ref": "Vpc8378EB38" + } + } + }, + "VpcPrivateSubnet2RouteTableAssociationA89CAD56": { + "Type": "AWS::EC2::SubnetRouteTableAssociation", + "Properties": { + "RouteTableId": { + "Ref": "VpcPrivateSubnet2RouteTableA678073B" + }, + "SubnetId": { + "Ref": "VpcPrivateSubnet2Subnet3788AAA1" + } + } + }, + "VpcPrivateSubnet2DefaultRoute060D2087": { + "Type": "AWS::EC2::Route", + "Properties": { + "DestinationCidrBlock": "0.0.0.0/0", + "InstanceId": { + "Ref": "VpcPublicSubnet2NatInstance746890A7" + }, + "RouteTableId": { + "Ref": "VpcPrivateSubnet2RouteTableA678073B" + } + } + }, + "VpcIGWD7BA715C": { + "Type": "AWS::EC2::InternetGateway", + "Properties": { + "Tags": [ + { + "Key": "Name", + "Value": "aws-cdk-vpc-nat-instances-v2-with-public-ip/Vpc" + } + ] + } + }, + "VpcVPCGWBF912B6E": { + "Type": "AWS::EC2::VPCGatewayAttachment", + "Properties": { + "InternetGatewayId": { + "Ref": "VpcIGWD7BA715C" + }, + "VpcId": { + "Ref": "Vpc8378EB38" + } + } + }, + "VpcNatSecurityGroup8DA26EDC": { + "Type": "AWS::EC2::SecurityGroup", + "Properties": { + "GroupDescription": "Security Group for NAT instances", + "SecurityGroupEgress": [ + { + "CidrIp": "0.0.0.0/0", + "Description": "Allow all outbound traffic by default", + "IpProtocol": "-1" + } + ], + "SecurityGroupIngress": [ + { + "CidrIp": "0.0.0.0/0", + "Description": "from 0.0.0.0/0:ALL TRAFFIC", + "IpProtocol": "-1" + } + ], + "Tags": [ + { + "Key": "Name", + "Value": "aws-cdk-vpc-nat-instances-v2-with-public-ip/Vpc" + } + ], + "VpcId": { + "Ref": "Vpc8378EB38" + } + } + } + }, + "Parameters": { + "SsmParameterValueawsserviceamiamazonlinuxlatestal2023amikernel61arm64C96584B6F00A464EAD1953AFF4B05118Parameter": { + "Type": "AWS::SSM::Parameter::Value", + "Default": "/aws/service/ami-amazon-linux-latest/al2023-ami-kernel-6.1-arm64" + }, + "BootstrapVersion": { + "Type": "AWS::SSM::Parameter::Value", + "Default": "/cdk-bootstrap/hnb659fds/version", + "Description": "Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]" + } + }, + "Rules": { + "CheckBootstrapVersion": { + "Assertions": [ + { + "Assert": { + "Fn::Not": [ + { + "Fn::Contains": [ + [ + "1", + "2", + "3", + "4", + "5" + ], + { + "Ref": "BootstrapVersion" + } + ] + } + ] + }, + "AssertDescription": "CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI." + } + ] + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.nat-instances-with-public-ip.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.nat-instances-with-public-ip.js.snapshot/cdk.out new file mode 100644 index 0000000000000..c6e612584e352 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.nat-instances-with-public-ip.js.snapshot/cdk.out @@ -0,0 +1 @@ +{"version":"38.0.1"} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.nat-instances-with-public-ip.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.nat-instances-with-public-ip.js.snapshot/integ.json new file mode 100644 index 0000000000000..e5655d6c6a448 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.nat-instances-with-public-ip.js.snapshot/integ.json @@ -0,0 +1,12 @@ +{ + "version": "38.0.1", + "testCases": { + "nat-instance-v2-with-public-ip-integ-test/DefaultTest": { + "stacks": [ + "aws-cdk-vpc-nat-instances-v2-with-public-ip" + ], + "assertionStack": "nat-instance-v2-with-public-ip-integ-test/DefaultTest/DeployAssert", + "assertionStackName": "natinstancev2withpublicipintegtestDefaultTestDeployAssertB63E4D9C" + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.nat-instances-with-public-ip.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.nat-instances-with-public-ip.js.snapshot/manifest.json new file mode 100644 index 0000000000000..33b12a7ce4614 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.nat-instances-with-public-ip.js.snapshot/manifest.json @@ -0,0 +1,271 @@ +{ + "version": "38.0.1", + "artifacts": { + "aws-cdk-vpc-nat-instances-v2-with-public-ip.assets": { + "type": "cdk:asset-manifest", + "properties": { + "file": "aws-cdk-vpc-nat-instances-v2-with-public-ip.assets.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "aws-cdk-vpc-nat-instances-v2-with-public-ip": { + "type": "aws:cloudformation:stack", + "environment": "aws://unknown-account/unknown-region", + "properties": { + "templateFile": "aws-cdk-vpc-nat-instances-v2-with-public-ip.template.json", + "terminationProtection": false, + "validateOnSynth": false, + "notificationArns": [], + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", + "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", + "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/82c3f0a93612fe78dff80eaf1a5725700fc3f35af42e8e50793b634838d2c6eb.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", + "additionalDependencies": [ + "aws-cdk-vpc-nat-instances-v2-with-public-ip.assets" + ], + "lookupRole": { + "arn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-lookup-role-${AWS::AccountId}-${AWS::Region}", + "requiresBootstrapStackVersion": 8, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "dependencies": [ + "aws-cdk-vpc-nat-instances-v2-with-public-ip.assets" + ], + "metadata": { + "/aws-cdk-vpc-nat-instances-v2-with-public-ip/Vpc/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "Vpc8378EB38" + } + ], + "/aws-cdk-vpc-nat-instances-v2-with-public-ip/Vpc/PublicSubnet1/Subnet": [ + { + "type": "aws:cdk:logicalId", + "data": "VpcPublicSubnet1Subnet5C2D37C4" + } + ], + "/aws-cdk-vpc-nat-instances-v2-with-public-ip/Vpc/PublicSubnet1/RouteTable": [ + { + "type": "aws:cdk:logicalId", + "data": "VpcPublicSubnet1RouteTable6C95E38E" + } + ], + "/aws-cdk-vpc-nat-instances-v2-with-public-ip/Vpc/PublicSubnet1/RouteTableAssociation": [ + { + "type": "aws:cdk:logicalId", + "data": "VpcPublicSubnet1RouteTableAssociation97140677" + } + ], + "/aws-cdk-vpc-nat-instances-v2-with-public-ip/Vpc/PublicSubnet1/DefaultRoute": [ + { + "type": "aws:cdk:logicalId", + "data": "VpcPublicSubnet1DefaultRoute3DA9E72A" + } + ], + "/aws-cdk-vpc-nat-instances-v2-with-public-ip/Vpc/PublicSubnet1/NatInstance/InstanceRole/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "VpcPublicSubnet1NatInstanceInstanceRole9D835E32" + } + ], + "/aws-cdk-vpc-nat-instances-v2-with-public-ip/Vpc/PublicSubnet1/NatInstance/InstanceProfile": [ + { + "type": "aws:cdk:logicalId", + "data": "VpcPublicSubnet1NatInstanceInstanceProfileEE10C485" + } + ], + "/aws-cdk-vpc-nat-instances-v2-with-public-ip/Vpc/PublicSubnet1/NatInstance/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "VpcPublicSubnet1NatInstance57B636B8" + } + ], + "/aws-cdk-vpc-nat-instances-v2-with-public-ip/Vpc/PublicSubnet2/Subnet": [ + { + "type": "aws:cdk:logicalId", + "data": "VpcPublicSubnet2Subnet691E08A3" + } + ], + "/aws-cdk-vpc-nat-instances-v2-with-public-ip/Vpc/PublicSubnet2/RouteTable": [ + { + "type": "aws:cdk:logicalId", + "data": "VpcPublicSubnet2RouteTable94F7E489" + } + ], + "/aws-cdk-vpc-nat-instances-v2-with-public-ip/Vpc/PublicSubnet2/RouteTableAssociation": [ + { + "type": "aws:cdk:logicalId", + "data": "VpcPublicSubnet2RouteTableAssociationDD5762D8" + } + ], + "/aws-cdk-vpc-nat-instances-v2-with-public-ip/Vpc/PublicSubnet2/DefaultRoute": [ + { + "type": "aws:cdk:logicalId", + "data": "VpcPublicSubnet2DefaultRoute97F91067" + } + ], + "/aws-cdk-vpc-nat-instances-v2-with-public-ip/Vpc/PublicSubnet2/NatInstance/InstanceRole/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "VpcPublicSubnet2NatInstanceInstanceRoleB3D21235" + } + ], + "/aws-cdk-vpc-nat-instances-v2-with-public-ip/Vpc/PublicSubnet2/NatInstance/InstanceProfile": [ + { + "type": "aws:cdk:logicalId", + "data": "VpcPublicSubnet2NatInstanceInstanceProfile549888F0" + } + ], + "/aws-cdk-vpc-nat-instances-v2-with-public-ip/Vpc/PublicSubnet2/NatInstance/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "VpcPublicSubnet2NatInstance746890A7" + } + ], + "/aws-cdk-vpc-nat-instances-v2-with-public-ip/Vpc/PrivateSubnet1/Subnet": [ + { + "type": "aws:cdk:logicalId", + "data": "VpcPrivateSubnet1Subnet536B997A" + } + ], + "/aws-cdk-vpc-nat-instances-v2-with-public-ip/Vpc/PrivateSubnet1/RouteTable": [ + { + "type": "aws:cdk:logicalId", + "data": "VpcPrivateSubnet1RouteTableB2C5B500" + } + ], + "/aws-cdk-vpc-nat-instances-v2-with-public-ip/Vpc/PrivateSubnet1/RouteTableAssociation": [ + { + "type": "aws:cdk:logicalId", + "data": "VpcPrivateSubnet1RouteTableAssociation70C59FA6" + } + ], + "/aws-cdk-vpc-nat-instances-v2-with-public-ip/Vpc/PrivateSubnet1/DefaultRoute": [ + { + "type": "aws:cdk:logicalId", + "data": "VpcPrivateSubnet1DefaultRouteBE02A9ED" + } + ], + "/aws-cdk-vpc-nat-instances-v2-with-public-ip/Vpc/PrivateSubnet2/Subnet": [ + { + "type": "aws:cdk:logicalId", + "data": "VpcPrivateSubnet2Subnet3788AAA1" + } + ], + "/aws-cdk-vpc-nat-instances-v2-with-public-ip/Vpc/PrivateSubnet2/RouteTable": [ + { + "type": "aws:cdk:logicalId", + "data": "VpcPrivateSubnet2RouteTableA678073B" + } + ], + "/aws-cdk-vpc-nat-instances-v2-with-public-ip/Vpc/PrivateSubnet2/RouteTableAssociation": [ + { + "type": "aws:cdk:logicalId", + "data": "VpcPrivateSubnet2RouteTableAssociationA89CAD56" + } + ], + "/aws-cdk-vpc-nat-instances-v2-with-public-ip/Vpc/PrivateSubnet2/DefaultRoute": [ + { + "type": "aws:cdk:logicalId", + "data": "VpcPrivateSubnet2DefaultRoute060D2087" + } + ], + "/aws-cdk-vpc-nat-instances-v2-with-public-ip/Vpc/IGW": [ + { + "type": "aws:cdk:logicalId", + "data": "VpcIGWD7BA715C" + } + ], + "/aws-cdk-vpc-nat-instances-v2-with-public-ip/Vpc/VPCGW": [ + { + "type": "aws:cdk:logicalId", + "data": "VpcVPCGWBF912B6E" + } + ], + "/aws-cdk-vpc-nat-instances-v2-with-public-ip/Vpc/NatSecurityGroup/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "VpcNatSecurityGroup8DA26EDC" + } + ], + "/aws-cdk-vpc-nat-instances-v2-with-public-ip/SsmParameterValue:--aws--service--ami-amazon-linux-latest--al2023-ami-kernel-6.1-arm64:C96584B6-F00A-464E-AD19-53AFF4B05118.Parameter": [ + { + "type": "aws:cdk:logicalId", + "data": "SsmParameterValueawsserviceamiamazonlinuxlatestal2023amikernel61arm64C96584B6F00A464EAD1953AFF4B05118Parameter" + } + ], + "/aws-cdk-vpc-nat-instances-v2-with-public-ip/BootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "BootstrapVersion" + } + ], + "/aws-cdk-vpc-nat-instances-v2-with-public-ip/CheckBootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "CheckBootstrapVersion" + } + ] + }, + "displayName": "aws-cdk-vpc-nat-instances-v2-with-public-ip" + }, + "natinstancev2withpublicipintegtestDefaultTestDeployAssertB63E4D9C.assets": { + "type": "cdk:asset-manifest", + "properties": { + "file": "natinstancev2withpublicipintegtestDefaultTestDeployAssertB63E4D9C.assets.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "natinstancev2withpublicipintegtestDefaultTestDeployAssertB63E4D9C": { + "type": "aws:cloudformation:stack", + "environment": "aws://unknown-account/unknown-region", + "properties": { + "templateFile": "natinstancev2withpublicipintegtestDefaultTestDeployAssertB63E4D9C.template.json", + "terminationProtection": false, + "validateOnSynth": false, + "notificationArns": [], + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", + "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", + "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", + "additionalDependencies": [ + "natinstancev2withpublicipintegtestDefaultTestDeployAssertB63E4D9C.assets" + ], + "lookupRole": { + "arn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-lookup-role-${AWS::AccountId}-${AWS::Region}", + "requiresBootstrapStackVersion": 8, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "dependencies": [ + "natinstancev2withpublicipintegtestDefaultTestDeployAssertB63E4D9C.assets" + ], + "metadata": { + "/nat-instance-v2-with-public-ip-integ-test/DefaultTest/DeployAssert/BootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "BootstrapVersion" + } + ], + "/nat-instance-v2-with-public-ip-integ-test/DefaultTest/DeployAssert/CheckBootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "CheckBootstrapVersion" + } + ] + }, + "displayName": "nat-instance-v2-with-public-ip-integ-test/DefaultTest/DeployAssert" + }, + "Tree": { + "type": "cdk:tree", + "properties": { + "file": "tree.json" + } + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.nat-instances-with-public-ip.js.snapshot/natinstancev2withpublicipintegtestDefaultTestDeployAssertB63E4D9C.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.nat-instances-with-public-ip.js.snapshot/natinstancev2withpublicipintegtestDefaultTestDeployAssertB63E4D9C.assets.json new file mode 100644 index 0000000000000..1cbaed7c67df9 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.nat-instances-with-public-ip.js.snapshot/natinstancev2withpublicipintegtestDefaultTestDeployAssertB63E4D9C.assets.json @@ -0,0 +1,19 @@ +{ + "version": "38.0.1", + "files": { + "21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22": { + "source": { + "path": "natinstancev2withpublicipintegtestDefaultTestDeployAssertB63E4D9C.template.json", + "packaging": "file" + }, + "destinations": { + "current_account-current_region": { + "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", + "objectKey": "21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22.json", + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" + } + } + } + }, + "dockerImages": {} +} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.nat-instances-with-public-ip.js.snapshot/natinstancev2withpublicipintegtestDefaultTestDeployAssertB63E4D9C.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.nat-instances-with-public-ip.js.snapshot/natinstancev2withpublicipintegtestDefaultTestDeployAssertB63E4D9C.template.json new file mode 100644 index 0000000000000..ad9d0fb73d1dd --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.nat-instances-with-public-ip.js.snapshot/natinstancev2withpublicipintegtestDefaultTestDeployAssertB63E4D9C.template.json @@ -0,0 +1,36 @@ +{ + "Parameters": { + "BootstrapVersion": { + "Type": "AWS::SSM::Parameter::Value", + "Default": "/cdk-bootstrap/hnb659fds/version", + "Description": "Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]" + } + }, + "Rules": { + "CheckBootstrapVersion": { + "Assertions": [ + { + "Assert": { + "Fn::Not": [ + { + "Fn::Contains": [ + [ + "1", + "2", + "3", + "4", + "5" + ], + { + "Ref": "BootstrapVersion" + } + ] + } + ] + }, + "AssertDescription": "CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI." + } + ] + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.nat-instances-with-public-ip.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.nat-instances-with-public-ip.js.snapshot/tree.json new file mode 100644 index 0000000000000..92d84359b1514 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.nat-instances-with-public-ip.js.snapshot/tree.json @@ -0,0 +1,975 @@ +{ + "version": "tree-0.1", + "tree": { + "id": "App", + "path": "", + "children": { + "aws-cdk-vpc-nat-instances-v2-with-public-ip": { + "id": "aws-cdk-vpc-nat-instances-v2-with-public-ip", + "path": "aws-cdk-vpc-nat-instances-v2-with-public-ip", + "children": { + "Vpc": { + "id": "Vpc", + "path": "aws-cdk-vpc-nat-instances-v2-with-public-ip/Vpc", + "children": { + "Resource": { + "id": "Resource", + "path": "aws-cdk-vpc-nat-instances-v2-with-public-ip/Vpc/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::VPC", + "aws:cdk:cloudformation:props": { + "cidrBlock": "10.0.0.0/16", + "enableDnsHostnames": true, + "enableDnsSupport": true, + "instanceTenancy": "default", + "tags": [ + { + "key": "Name", + "value": "aws-cdk-vpc-nat-instances-v2-with-public-ip/Vpc" + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.CfnVPC", + "version": "0.0.0" + } + }, + "PublicSubnet1": { + "id": "PublicSubnet1", + "path": "aws-cdk-vpc-nat-instances-v2-with-public-ip/Vpc/PublicSubnet1", + "children": { + "Subnet": { + "id": "Subnet", + "path": "aws-cdk-vpc-nat-instances-v2-with-public-ip/Vpc/PublicSubnet1/Subnet", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::Subnet", + "aws:cdk:cloudformation:props": { + "availabilityZone": { + "Fn::Select": [ + 0, + { + "Fn::GetAZs": "" + } + ] + }, + "cidrBlock": "10.0.0.0/18", + "mapPublicIpOnLaunch": false, + "tags": [ + { + "key": "aws-cdk:subnet-name", + "value": "Public" + }, + { + "key": "aws-cdk:subnet-type", + "value": "Public" + }, + { + "key": "Name", + "value": "aws-cdk-vpc-nat-instances-v2-with-public-ip/Vpc/PublicSubnet1" + } + ], + "vpcId": { + "Ref": "Vpc8378EB38" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.CfnSubnet", + "version": "0.0.0" + } + }, + "Acl": { + "id": "Acl", + "path": "aws-cdk-vpc-nat-instances-v2-with-public-ip/Vpc/PublicSubnet1/Acl", + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "0.0.0" + } + }, + "RouteTable": { + "id": "RouteTable", + "path": "aws-cdk-vpc-nat-instances-v2-with-public-ip/Vpc/PublicSubnet1/RouteTable", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::RouteTable", + "aws:cdk:cloudformation:props": { + "tags": [ + { + "key": "Name", + "value": "aws-cdk-vpc-nat-instances-v2-with-public-ip/Vpc/PublicSubnet1" + } + ], + "vpcId": { + "Ref": "Vpc8378EB38" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.CfnRouteTable", + "version": "0.0.0" + } + }, + "RouteTableAssociation": { + "id": "RouteTableAssociation", + "path": "aws-cdk-vpc-nat-instances-v2-with-public-ip/Vpc/PublicSubnet1/RouteTableAssociation", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::SubnetRouteTableAssociation", + "aws:cdk:cloudformation:props": { + "routeTableId": { + "Ref": "VpcPublicSubnet1RouteTable6C95E38E" + }, + "subnetId": { + "Ref": "VpcPublicSubnet1Subnet5C2D37C4" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.CfnSubnetRouteTableAssociation", + "version": "0.0.0" + } + }, + "DefaultRoute": { + "id": "DefaultRoute", + "path": "aws-cdk-vpc-nat-instances-v2-with-public-ip/Vpc/PublicSubnet1/DefaultRoute", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::Route", + "aws:cdk:cloudformation:props": { + "destinationCidrBlock": "0.0.0.0/0", + "gatewayId": { + "Ref": "VpcIGWD7BA715C" + }, + "routeTableId": { + "Ref": "VpcPublicSubnet1RouteTable6C95E38E" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.CfnRoute", + "version": "0.0.0" + } + }, + "NatInstance": { + "id": "NatInstance", + "path": "aws-cdk-vpc-nat-instances-v2-with-public-ip/Vpc/PublicSubnet1/NatInstance", + "children": { + "InstanceRole": { + "id": "InstanceRole", + "path": "aws-cdk-vpc-nat-instances-v2-with-public-ip/Vpc/PublicSubnet1/NatInstance/InstanceRole", + "children": { + "ImportInstanceRole": { + "id": "ImportInstanceRole", + "path": "aws-cdk-vpc-nat-instances-v2-with-public-ip/Vpc/PublicSubnet1/NatInstance/InstanceRole/ImportInstanceRole", + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "0.0.0" + } + }, + "Resource": { + "id": "Resource", + "path": "aws-cdk-vpc-nat-instances-v2-with-public-ip/Vpc/PublicSubnet1/NatInstance/InstanceRole/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Role", + "aws:cdk:cloudformation:props": { + "assumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "ec2.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + }, + "tags": [ + { + "key": "Name", + "value": "aws-cdk-vpc-nat-instances-v2-with-public-ip/Vpc/PublicSubnet1/NatInstance" + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.CfnRole", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.Role", + "version": "0.0.0" + } + }, + "InstanceProfile": { + "id": "InstanceProfile", + "path": "aws-cdk-vpc-nat-instances-v2-with-public-ip/Vpc/PublicSubnet1/NatInstance/InstanceProfile", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::InstanceProfile", + "aws:cdk:cloudformation:props": { + "roles": [ + { + "Ref": "VpcPublicSubnet1NatInstanceInstanceRole9D835E32" + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.CfnInstanceProfile", + "version": "0.0.0" + } + }, + "Resource": { + "id": "Resource", + "path": "aws-cdk-vpc-nat-instances-v2-with-public-ip/Vpc/PublicSubnet1/NatInstance/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::Instance", + "aws:cdk:cloudformation:props": { + "availabilityZone": { + "Fn::Select": [ + 0, + { + "Fn::GetAZs": "" + } + ] + }, + "iamInstanceProfile": { + "Ref": "VpcPublicSubnet1NatInstanceInstanceProfileEE10C485" + }, + "imageId": { + "Ref": "SsmParameterValueawsserviceamiamazonlinuxlatestal2023amikernel61arm64C96584B6F00A464EAD1953AFF4B05118Parameter" + }, + "instanceType": "t4g.micro", + "networkInterfaces": [ + { + "deviceIndex": "0", + "associatePublicIpAddress": true, + "subnetId": { + "Ref": "VpcPublicSubnet1Subnet5C2D37C4" + }, + "groupSet": [ + { + "Fn::GetAtt": [ + "VpcNatSecurityGroup8DA26EDC", + "GroupId" + ] + } + ] + } + ], + "sourceDestCheck": false, + "tags": [ + { + "key": "Name", + "value": "aws-cdk-vpc-nat-instances-v2-with-public-ip/Vpc/PublicSubnet1/NatInstance" + } + ], + "userData": { + "Fn::Base64": "#!/bin/bash\nyum install iptables-services -y\nsystemctl enable iptables\nsystemctl start iptables\necho \"net.ipv4.ip_forward=1\" > /etc/sysctl.d/custom-ip-forwarding.conf\nsudo sysctl -p /etc/sysctl.d/custom-ip-forwarding.conf\nsudo /sbin/iptables -t nat -A POSTROUTING -o $(route | awk '/^default/{print $NF}') -j MASQUERADE\nsudo /sbin/iptables -F FORWARD\nsudo service iptables save" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.CfnInstance", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.Instance", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.PublicSubnet", + "version": "0.0.0" + } + }, + "PublicSubnet2": { + "id": "PublicSubnet2", + "path": "aws-cdk-vpc-nat-instances-v2-with-public-ip/Vpc/PublicSubnet2", + "children": { + "Subnet": { + "id": "Subnet", + "path": "aws-cdk-vpc-nat-instances-v2-with-public-ip/Vpc/PublicSubnet2/Subnet", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::Subnet", + "aws:cdk:cloudformation:props": { + "availabilityZone": { + "Fn::Select": [ + 1, + { + "Fn::GetAZs": "" + } + ] + }, + "cidrBlock": "10.0.64.0/18", + "mapPublicIpOnLaunch": false, + "tags": [ + { + "key": "aws-cdk:subnet-name", + "value": "Public" + }, + { + "key": "aws-cdk:subnet-type", + "value": "Public" + }, + { + "key": "Name", + "value": "aws-cdk-vpc-nat-instances-v2-with-public-ip/Vpc/PublicSubnet2" + } + ], + "vpcId": { + "Ref": "Vpc8378EB38" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.CfnSubnet", + "version": "0.0.0" + } + }, + "Acl": { + "id": "Acl", + "path": "aws-cdk-vpc-nat-instances-v2-with-public-ip/Vpc/PublicSubnet2/Acl", + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "0.0.0" + } + }, + "RouteTable": { + "id": "RouteTable", + "path": "aws-cdk-vpc-nat-instances-v2-with-public-ip/Vpc/PublicSubnet2/RouteTable", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::RouteTable", + "aws:cdk:cloudformation:props": { + "tags": [ + { + "key": "Name", + "value": "aws-cdk-vpc-nat-instances-v2-with-public-ip/Vpc/PublicSubnet2" + } + ], + "vpcId": { + "Ref": "Vpc8378EB38" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.CfnRouteTable", + "version": "0.0.0" + } + }, + "RouteTableAssociation": { + "id": "RouteTableAssociation", + "path": "aws-cdk-vpc-nat-instances-v2-with-public-ip/Vpc/PublicSubnet2/RouteTableAssociation", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::SubnetRouteTableAssociation", + "aws:cdk:cloudformation:props": { + "routeTableId": { + "Ref": "VpcPublicSubnet2RouteTable94F7E489" + }, + "subnetId": { + "Ref": "VpcPublicSubnet2Subnet691E08A3" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.CfnSubnetRouteTableAssociation", + "version": "0.0.0" + } + }, + "DefaultRoute": { + "id": "DefaultRoute", + "path": "aws-cdk-vpc-nat-instances-v2-with-public-ip/Vpc/PublicSubnet2/DefaultRoute", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::Route", + "aws:cdk:cloudformation:props": { + "destinationCidrBlock": "0.0.0.0/0", + "gatewayId": { + "Ref": "VpcIGWD7BA715C" + }, + "routeTableId": { + "Ref": "VpcPublicSubnet2RouteTable94F7E489" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.CfnRoute", + "version": "0.0.0" + } + }, + "NatInstance": { + "id": "NatInstance", + "path": "aws-cdk-vpc-nat-instances-v2-with-public-ip/Vpc/PublicSubnet2/NatInstance", + "children": { + "InstanceRole": { + "id": "InstanceRole", + "path": "aws-cdk-vpc-nat-instances-v2-with-public-ip/Vpc/PublicSubnet2/NatInstance/InstanceRole", + "children": { + "ImportInstanceRole": { + "id": "ImportInstanceRole", + "path": "aws-cdk-vpc-nat-instances-v2-with-public-ip/Vpc/PublicSubnet2/NatInstance/InstanceRole/ImportInstanceRole", + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "0.0.0" + } + }, + "Resource": { + "id": "Resource", + "path": "aws-cdk-vpc-nat-instances-v2-with-public-ip/Vpc/PublicSubnet2/NatInstance/InstanceRole/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Role", + "aws:cdk:cloudformation:props": { + "assumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "ec2.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + }, + "tags": [ + { + "key": "Name", + "value": "aws-cdk-vpc-nat-instances-v2-with-public-ip/Vpc/PublicSubnet2/NatInstance" + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.CfnRole", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.Role", + "version": "0.0.0" + } + }, + "InstanceProfile": { + "id": "InstanceProfile", + "path": "aws-cdk-vpc-nat-instances-v2-with-public-ip/Vpc/PublicSubnet2/NatInstance/InstanceProfile", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::InstanceProfile", + "aws:cdk:cloudformation:props": { + "roles": [ + { + "Ref": "VpcPublicSubnet2NatInstanceInstanceRoleB3D21235" + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.CfnInstanceProfile", + "version": "0.0.0" + } + }, + "Resource": { + "id": "Resource", + "path": "aws-cdk-vpc-nat-instances-v2-with-public-ip/Vpc/PublicSubnet2/NatInstance/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::Instance", + "aws:cdk:cloudformation:props": { + "availabilityZone": { + "Fn::Select": [ + 1, + { + "Fn::GetAZs": "" + } + ] + }, + "iamInstanceProfile": { + "Ref": "VpcPublicSubnet2NatInstanceInstanceProfile549888F0" + }, + "imageId": { + "Ref": "SsmParameterValueawsserviceamiamazonlinuxlatestal2023amikernel61arm64C96584B6F00A464EAD1953AFF4B05118Parameter" + }, + "instanceType": "t4g.micro", + "networkInterfaces": [ + { + "deviceIndex": "0", + "associatePublicIpAddress": true, + "subnetId": { + "Ref": "VpcPublicSubnet2Subnet691E08A3" + }, + "groupSet": [ + { + "Fn::GetAtt": [ + "VpcNatSecurityGroup8DA26EDC", + "GroupId" + ] + } + ] + } + ], + "sourceDestCheck": false, + "tags": [ + { + "key": "Name", + "value": "aws-cdk-vpc-nat-instances-v2-with-public-ip/Vpc/PublicSubnet2/NatInstance" + } + ], + "userData": { + "Fn::Base64": "#!/bin/bash\nyum install iptables-services -y\nsystemctl enable iptables\nsystemctl start iptables\necho \"net.ipv4.ip_forward=1\" > /etc/sysctl.d/custom-ip-forwarding.conf\nsudo sysctl -p /etc/sysctl.d/custom-ip-forwarding.conf\nsudo /sbin/iptables -t nat -A POSTROUTING -o $(route | awk '/^default/{print $NF}') -j MASQUERADE\nsudo /sbin/iptables -F FORWARD\nsudo service iptables save" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.CfnInstance", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.Instance", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.PublicSubnet", + "version": "0.0.0" + } + }, + "PrivateSubnet1": { + "id": "PrivateSubnet1", + "path": "aws-cdk-vpc-nat-instances-v2-with-public-ip/Vpc/PrivateSubnet1", + "children": { + "Subnet": { + "id": "Subnet", + "path": "aws-cdk-vpc-nat-instances-v2-with-public-ip/Vpc/PrivateSubnet1/Subnet", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::Subnet", + "aws:cdk:cloudformation:props": { + "availabilityZone": { + "Fn::Select": [ + 0, + { + "Fn::GetAZs": "" + } + ] + }, + "cidrBlock": "10.0.128.0/18", + "mapPublicIpOnLaunch": false, + "tags": [ + { + "key": "aws-cdk:subnet-name", + "value": "Private" + }, + { + "key": "aws-cdk:subnet-type", + "value": "Private" + }, + { + "key": "Name", + "value": "aws-cdk-vpc-nat-instances-v2-with-public-ip/Vpc/PrivateSubnet1" + } + ], + "vpcId": { + "Ref": "Vpc8378EB38" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.CfnSubnet", + "version": "0.0.0" + } + }, + "Acl": { + "id": "Acl", + "path": "aws-cdk-vpc-nat-instances-v2-with-public-ip/Vpc/PrivateSubnet1/Acl", + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "0.0.0" + } + }, + "RouteTable": { + "id": "RouteTable", + "path": "aws-cdk-vpc-nat-instances-v2-with-public-ip/Vpc/PrivateSubnet1/RouteTable", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::RouteTable", + "aws:cdk:cloudformation:props": { + "tags": [ + { + "key": "Name", + "value": "aws-cdk-vpc-nat-instances-v2-with-public-ip/Vpc/PrivateSubnet1" + } + ], + "vpcId": { + "Ref": "Vpc8378EB38" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.CfnRouteTable", + "version": "0.0.0" + } + }, + "RouteTableAssociation": { + "id": "RouteTableAssociation", + "path": "aws-cdk-vpc-nat-instances-v2-with-public-ip/Vpc/PrivateSubnet1/RouteTableAssociation", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::SubnetRouteTableAssociation", + "aws:cdk:cloudformation:props": { + "routeTableId": { + "Ref": "VpcPrivateSubnet1RouteTableB2C5B500" + }, + "subnetId": { + "Ref": "VpcPrivateSubnet1Subnet536B997A" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.CfnSubnetRouteTableAssociation", + "version": "0.0.0" + } + }, + "DefaultRoute": { + "id": "DefaultRoute", + "path": "aws-cdk-vpc-nat-instances-v2-with-public-ip/Vpc/PrivateSubnet1/DefaultRoute", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::Route", + "aws:cdk:cloudformation:props": { + "destinationCidrBlock": "0.0.0.0/0", + "instanceId": { + "Ref": "VpcPublicSubnet1NatInstance57B636B8" + }, + "routeTableId": { + "Ref": "VpcPrivateSubnet1RouteTableB2C5B500" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.CfnRoute", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.PrivateSubnet", + "version": "0.0.0" + } + }, + "PrivateSubnet2": { + "id": "PrivateSubnet2", + "path": "aws-cdk-vpc-nat-instances-v2-with-public-ip/Vpc/PrivateSubnet2", + "children": { + "Subnet": { + "id": "Subnet", + "path": "aws-cdk-vpc-nat-instances-v2-with-public-ip/Vpc/PrivateSubnet2/Subnet", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::Subnet", + "aws:cdk:cloudformation:props": { + "availabilityZone": { + "Fn::Select": [ + 1, + { + "Fn::GetAZs": "" + } + ] + }, + "cidrBlock": "10.0.192.0/18", + "mapPublicIpOnLaunch": false, + "tags": [ + { + "key": "aws-cdk:subnet-name", + "value": "Private" + }, + { + "key": "aws-cdk:subnet-type", + "value": "Private" + }, + { + "key": "Name", + "value": "aws-cdk-vpc-nat-instances-v2-with-public-ip/Vpc/PrivateSubnet2" + } + ], + "vpcId": { + "Ref": "Vpc8378EB38" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.CfnSubnet", + "version": "0.0.0" + } + }, + "Acl": { + "id": "Acl", + "path": "aws-cdk-vpc-nat-instances-v2-with-public-ip/Vpc/PrivateSubnet2/Acl", + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "0.0.0" + } + }, + "RouteTable": { + "id": "RouteTable", + "path": "aws-cdk-vpc-nat-instances-v2-with-public-ip/Vpc/PrivateSubnet2/RouteTable", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::RouteTable", + "aws:cdk:cloudformation:props": { + "tags": [ + { + "key": "Name", + "value": "aws-cdk-vpc-nat-instances-v2-with-public-ip/Vpc/PrivateSubnet2" + } + ], + "vpcId": { + "Ref": "Vpc8378EB38" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.CfnRouteTable", + "version": "0.0.0" + } + }, + "RouteTableAssociation": { + "id": "RouteTableAssociation", + "path": "aws-cdk-vpc-nat-instances-v2-with-public-ip/Vpc/PrivateSubnet2/RouteTableAssociation", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::SubnetRouteTableAssociation", + "aws:cdk:cloudformation:props": { + "routeTableId": { + "Ref": "VpcPrivateSubnet2RouteTableA678073B" + }, + "subnetId": { + "Ref": "VpcPrivateSubnet2Subnet3788AAA1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.CfnSubnetRouteTableAssociation", + "version": "0.0.0" + } + }, + "DefaultRoute": { + "id": "DefaultRoute", + "path": "aws-cdk-vpc-nat-instances-v2-with-public-ip/Vpc/PrivateSubnet2/DefaultRoute", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::Route", + "aws:cdk:cloudformation:props": { + "destinationCidrBlock": "0.0.0.0/0", + "instanceId": { + "Ref": "VpcPublicSubnet2NatInstance746890A7" + }, + "routeTableId": { + "Ref": "VpcPrivateSubnet2RouteTableA678073B" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.CfnRoute", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.PrivateSubnet", + "version": "0.0.0" + } + }, + "IGW": { + "id": "IGW", + "path": "aws-cdk-vpc-nat-instances-v2-with-public-ip/Vpc/IGW", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::InternetGateway", + "aws:cdk:cloudformation:props": { + "tags": [ + { + "key": "Name", + "value": "aws-cdk-vpc-nat-instances-v2-with-public-ip/Vpc" + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.CfnInternetGateway", + "version": "0.0.0" + } + }, + "VPCGW": { + "id": "VPCGW", + "path": "aws-cdk-vpc-nat-instances-v2-with-public-ip/Vpc/VPCGW", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::VPCGatewayAttachment", + "aws:cdk:cloudformation:props": { + "internetGatewayId": { + "Ref": "VpcIGWD7BA715C" + }, + "vpcId": { + "Ref": "Vpc8378EB38" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.CfnVPCGatewayAttachment", + "version": "0.0.0" + } + }, + "NatSecurityGroup": { + "id": "NatSecurityGroup", + "path": "aws-cdk-vpc-nat-instances-v2-with-public-ip/Vpc/NatSecurityGroup", + "children": { + "Resource": { + "id": "Resource", + "path": "aws-cdk-vpc-nat-instances-v2-with-public-ip/Vpc/NatSecurityGroup/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::SecurityGroup", + "aws:cdk:cloudformation:props": { + "groupDescription": "Security Group for NAT instances", + "securityGroupEgress": [ + { + "cidrIp": "0.0.0.0/0", + "description": "Allow all outbound traffic by default", + "ipProtocol": "-1" + } + ], + "securityGroupIngress": [ + { + "cidrIp": "0.0.0.0/0", + "ipProtocol": "-1", + "description": "from 0.0.0.0/0:ALL TRAFFIC" + } + ], + "tags": [ + { + "key": "Name", + "value": "aws-cdk-vpc-nat-instances-v2-with-public-ip/Vpc" + } + ], + "vpcId": { + "Ref": "Vpc8378EB38" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.CfnSecurityGroup", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.SecurityGroup", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.Vpc", + "version": "0.0.0" + } + }, + "SsmParameterValue:--aws--service--ami-amazon-linux-latest--al2023-ami-kernel-6.1-arm64:C96584B6-F00A-464E-AD19-53AFF4B05118.Parameter": { + "id": "SsmParameterValue:--aws--service--ami-amazon-linux-latest--al2023-ami-kernel-6.1-arm64:C96584B6-F00A-464E-AD19-53AFF4B05118.Parameter", + "path": "aws-cdk-vpc-nat-instances-v2-with-public-ip/SsmParameterValue:--aws--service--ami-amazon-linux-latest--al2023-ami-kernel-6.1-arm64:C96584B6-F00A-464E-AD19-53AFF4B05118.Parameter", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnParameter", + "version": "0.0.0" + } + }, + "SsmParameterValue:--aws--service--ami-amazon-linux-latest--al2023-ami-kernel-6.1-arm64:C96584B6-F00A-464E-AD19-53AFF4B05118": { + "id": "SsmParameterValue:--aws--service--ami-amazon-linux-latest--al2023-ami-kernel-6.1-arm64:C96584B6-F00A-464E-AD19-53AFF4B05118", + "path": "aws-cdk-vpc-nat-instances-v2-with-public-ip/SsmParameterValue:--aws--service--ami-amazon-linux-latest--al2023-ami-kernel-6.1-arm64:C96584B6-F00A-464E-AD19-53AFF4B05118", + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "0.0.0" + } + }, + "BootstrapVersion": { + "id": "BootstrapVersion", + "path": "aws-cdk-vpc-nat-instances-v2-with-public-ip/BootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnParameter", + "version": "0.0.0" + } + }, + "CheckBootstrapVersion": { + "id": "CheckBootstrapVersion", + "path": "aws-cdk-vpc-nat-instances-v2-with-public-ip/CheckBootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnRule", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.Stack", + "version": "0.0.0" + } + }, + "nat-instance-v2-with-public-ip-integ-test": { + "id": "nat-instance-v2-with-public-ip-integ-test", + "path": "nat-instance-v2-with-public-ip-integ-test", + "children": { + "DefaultTest": { + "id": "DefaultTest", + "path": "nat-instance-v2-with-public-ip-integ-test/DefaultTest", + "children": { + "Default": { + "id": "Default", + "path": "nat-instance-v2-with-public-ip-integ-test/DefaultTest/Default", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.3.0" + } + }, + "DeployAssert": { + "id": "DeployAssert", + "path": "nat-instance-v2-with-public-ip-integ-test/DefaultTest/DeployAssert", + "children": { + "BootstrapVersion": { + "id": "BootstrapVersion", + "path": "nat-instance-v2-with-public-ip-integ-test/DefaultTest/DeployAssert/BootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnParameter", + "version": "0.0.0" + } + }, + "CheckBootstrapVersion": { + "id": "CheckBootstrapVersion", + "path": "nat-instance-v2-with-public-ip-integ-test/DefaultTest/DeployAssert/CheckBootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnRule", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.Stack", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/integ-tests-alpha.IntegTestCase", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/integ-tests-alpha.IntegTest", + "version": "0.0.0" + } + }, + "Tree": { + "id": "Tree", + "path": "Tree", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.3.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.App", + "version": "0.0.0" + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.nat-instances-with-public-ip.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.nat-instances-with-public-ip.ts new file mode 100644 index 0000000000000..5071a6e57a709 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.nat-instances-with-public-ip.ts @@ -0,0 +1,36 @@ +import { IntegTest } from '@aws-cdk/integ-tests-alpha'; +import * as cdk from 'aws-cdk-lib'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import { EC2_RESTRICT_DEFAULT_SECURITY_GROUP } from 'aws-cdk-lib/cx-api'; + +class NatInstanceStack extends cdk.Stack { + constructor(scope: cdk.App, id: string, props?: cdk.StackProps) { + super(scope, id, props); + this.node.setContext(EC2_RESTRICT_DEFAULT_SECURITY_GROUP, false); + + new ec2.Vpc(this, 'Vpc', { + natGatewayProvider: ec2.NatProvider.instanceV2({ + instanceType: ec2.InstanceType.of(ec2.InstanceClass.T4G, ec2.InstanceSize.MICRO), + associatePublicIpAddress: true, + }), + subnetConfiguration: [ + { + subnetType: ec2.SubnetType.PUBLIC, + name: 'Public', + mapPublicIpOnLaunch: false, + }, + { + subnetType: ec2.SubnetType.PRIVATE_WITH_EGRESS, + name: 'Private', + }, + ], + }); + } +} + +const app = new cdk.App(); +const stack = new NatInstanceStack(app, 'aws-cdk-vpc-nat-instances-v2-with-public-ip'); + +new IntegTest(app, 'nat-instance-v2-with-public-ip-integ-test', { + testCases: [stack], +}); diff --git a/packages/aws-cdk-lib/aws-ec2/README.md b/packages/aws-cdk-lib/aws-ec2/README.md index b22712631f0dd..bcc050b333be3 100644 --- a/packages/aws-cdk-lib/aws-ec2/README.md +++ b/packages/aws-cdk-lib/aws-ec2/README.md @@ -269,6 +269,23 @@ new ec2.Vpc(this, 'TheVPC', { provider.connections.allowFrom(ec2.Peer.ipv4('1.2.3.4/8'), ec2.Port.HTTP); ``` +### Associate Public IP Address to NAT Instance + +You can choose to associate public IP address to a NAT instance V2 by specifying `associatePublicIpAddress` +like the following: + +```ts +const natGatewayProvider = ec2.NatProvider.instanceV2({ + instanceType: new ec2.InstanceType('t3.small'), + associatePublicIpAddress: true, +}); +``` + +In certain scenarios where the public subnet has set `mapPublicIpOnLaunch` to `false`, NAT instances does not +get public IP addresses assigned which would result in non-working NAT instance as NAT instance requires a public +IP address to enable outbound internet connectivity. Users can specify `associatePublicIpAddress` to `true` to +solve this problem. + ### Ip Address Management The VPC spans a supernet IP range, which contains the non-overlapping IPs of its contained subnets. Possible sources for this IP range are: diff --git a/packages/aws-cdk-lib/aws-ec2/lib/nat.ts b/packages/aws-cdk-lib/aws-ec2/lib/nat.ts index 31dd8b9c73410..aef7e9cbac497 100644 --- a/packages/aws-cdk-lib/aws-ec2/lib/nat.ts +++ b/packages/aws-cdk-lib/aws-ec2/lib/nat.ts @@ -188,6 +188,13 @@ export interface NatInstanceProps { */ readonly instanceType: InstanceType; + /** + * Whether to associate a public IP address to the primary network interface attached to this instance. + * + * @default undefined - No public IP address associated + */ + readonly associatePublicIpAddress?: boolean; + /** * Name of SSH keypair to grant access to instance * @@ -539,6 +546,7 @@ export class NatInstanceProviderV2 extends NatProvider implements IConnectable { sourceDestCheck: false, // Required for NAT vpc: options.vpc, vpcSubnets: { subnets: [sub] }, + associatePublicIpAddress: this.props.associatePublicIpAddress, securityGroup: this._securityGroup, keyPair: this.props.keyPair, keyName: this.props.keyName, diff --git a/packages/aws-cdk-lib/aws-ec2/test/vpc.test.ts b/packages/aws-cdk-lib/aws-ec2/test/vpc.test.ts index b36225e0adde8..3682929aa4c4c 100644 --- a/packages/aws-cdk-lib/aws-ec2/test/vpc.test.ts +++ b/packages/aws-cdk-lib/aws-ec2/test/vpc.test.ts @@ -38,7 +38,6 @@ import { InstanceClass, InstanceSize, KeyPair, - SecurityGroup, UserData, } from '../lib'; @@ -1760,6 +1759,39 @@ describe('vpc', () => { Template.fromStack(stack).resourceCountIs('AWS::EC2::Instance', 1); }); + test.each([ + [true, true], + [false, false], + ])('Can instantiate NatInstanceProviderV2 with associatePublicIpAddress', (input, value) => { + const stack = getTestStack(); + new Vpc(stack, 'Vpc', { + natGatewayProvider: NatProvider.instanceV2({ + instanceType: InstanceType.of(InstanceClass.T4G, InstanceSize.MICRO), + associatePublicIpAddress: input, + }), + subnetConfiguration: [ + { + subnetType: SubnetType.PUBLIC, + name: 'Public', + // NAT instance does not work when this set to false. + mapPublicIpOnLaunch: false, + }, + { + subnetType: SubnetType.PRIVATE_WITH_EGRESS, + name: 'Private', + }, + ], + }); + + Template.fromStack(stack).hasResource('AWS::EC2::Instance', Match.objectLike({ + Properties: { + NetworkInterfaces: [{ + AssociatePublicIpAddress: value, + }], + }, + })); + }); + test('Can instantiate NatInstanceProvider directly with new', () => { // GIVEN const stack = getTestStack(); From f9d6eefd52d5bdc63ff2be844f567e8f1d0b4258 Mon Sep 17 00:00:00 2001 From: Matsuda Date: Wed, 23 Oct 2024 08:12:35 +0900 Subject: [PATCH 15/33] feat(cognito): support email based MFA (#31816) ### Issue # (if applicable) Closes #31815. ### Reason for this change To use email based MFA. ### Description of changes Add email option to [MfaSecondFactor](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_cognito.MfaSecondFactor.html). ### Description of how you validated changes Add unit tests and integ test. ### Checklist - [x] My code adheres to the [CONTRIBUTING GUIDE](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and [DESIGN GUIDELINES](https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md) ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license* --- .../cdk.out | 1 + .../integ-user-email-mfa.assets.json | 19 ++ .../integ-user-email-mfa.template.json | 152 +++++++++++ .../integ.json | 14 + ...efaultTestDeployAssertD4C43B3C.assets.json | 19 ++ ...aultTestDeployAssertD4C43B3C.template.json | 36 +++ .../manifest.json | 127 +++++++++ .../tree.json | 258 ++++++++++++++++++ .../test/integ.user-pool-mfa-email.ts | 41 +++ packages/aws-cdk-lib/aws-cognito/README.md | 4 + .../aws-cognito/lib/user-pool-email.ts | 2 +- .../aws-cdk-lib/aws-cognito/lib/user-pool.ts | 34 ++- .../aws-cognito/test/user-pool.test.ts | 80 ++++++ 13 files changed, 782 insertions(+), 5 deletions(-) create mode 100644 packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-mfa-email.js.snapshot/cdk.out create mode 100644 packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-mfa-email.js.snapshot/integ-user-email-mfa.assets.json create mode 100644 packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-mfa-email.js.snapshot/integ-user-email-mfa.template.json create mode 100644 packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-mfa-email.js.snapshot/integ.json create mode 100644 packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-mfa-email.js.snapshot/integuseremailmfatestDefaultTestDeployAssertD4C43B3C.assets.json create mode 100644 packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-mfa-email.js.snapshot/integuseremailmfatestDefaultTestDeployAssertD4C43B3C.template.json create mode 100644 packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-mfa-email.js.snapshot/manifest.json create mode 100644 packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-mfa-email.js.snapshot/tree.json create mode 100644 packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-mfa-email.ts diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-mfa-email.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-mfa-email.js.snapshot/cdk.out new file mode 100644 index 0000000000000..c6e612584e352 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-mfa-email.js.snapshot/cdk.out @@ -0,0 +1 @@ +{"version":"38.0.1"} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-mfa-email.js.snapshot/integ-user-email-mfa.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-mfa-email.js.snapshot/integ-user-email-mfa.assets.json new file mode 100644 index 0000000000000..c248f6865cf34 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-mfa-email.js.snapshot/integ-user-email-mfa.assets.json @@ -0,0 +1,19 @@ +{ + "version": "38.0.1", + "files": { + "57ebfe1ab6c8ce5faf8c2370ac901d380e8c968b793c3d82d66a3e6bd99983a8": { + "source": { + "path": "integ-user-email-mfa.template.json", + "packaging": "file" + }, + "destinations": { + "current_account-current_region": { + "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", + "objectKey": "57ebfe1ab6c8ce5faf8c2370ac901d380e8c968b793c3d82d66a3e6bd99983a8.json", + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" + } + } + } + }, + "dockerImages": {} +} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-mfa-email.js.snapshot/integ-user-email-mfa.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-mfa-email.js.snapshot/integ-user-email-mfa.template.json new file mode 100644 index 0000000000000..0c32599ce87ee --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-mfa-email.js.snapshot/integ-user-email-mfa.template.json @@ -0,0 +1,152 @@ +{ + "Resources": { + "myuserpoolsmsRole0E16FDD9": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Condition": { + "StringEquals": { + "sts:ExternalId": "integuseremailmfamyuserpool8F31F20B" + } + }, + "Effect": "Allow", + "Principal": { + "Service": "cognito-idp.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + }, + "Policies": [ + { + "PolicyDocument": { + "Statement": [ + { + "Action": "sns:Publish", + "Effect": "Allow", + "Resource": "*" + } + ], + "Version": "2012-10-17" + }, + "PolicyName": "sns-publish" + } + ] + } + }, + "myuserpool01998219": { + "Type": "AWS::Cognito::UserPool", + "Properties": { + "AccountRecoverySetting": { + "RecoveryMechanisms": [ + { + "Name": "verified_phone_number", + "Priority": 1 + }, + { + "Name": "verified_email", + "Priority": 2 + } + ] + }, + "AdminCreateUserConfig": { + "AllowAdminCreateUserOnly": true + }, + "EmailConfiguration": { + "EmailSendingAccount": "DEVELOPER", + "From": "\"myname@mycompany.com\" ", + "ReplyToEmailAddress": "support@*.example.com", + "SourceArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":ses:us-east-1:", + { + "Ref": "AWS::AccountId" + }, + ":identity/*.example.com" + ] + ] + } + }, + "EmailVerificationMessage": "The verification code to your new account is {####}", + "EmailVerificationSubject": "Verify your new account", + "EnabledMfas": [ + "SMS_MFA", + "EMAIL_OTP" + ], + "MfaConfiguration": "ON", + "SmsConfiguration": { + "ExternalId": "integuseremailmfamyuserpool8F31F20B", + "SnsCallerArn": { + "Fn::GetAtt": [ + "myuserpoolsmsRole0E16FDD9", + "Arn" + ] + } + }, + "SmsVerificationMessage": "The verification code to your new account is {####}", + "UserPoolAddOns": { + "AdvancedSecurityMode": "ENFORCED" + }, + "UserPoolName": "MyUserPool", + "VerificationMessageTemplate": { + "DefaultEmailOption": "CONFIRM_WITH_CODE", + "EmailMessage": "The verification code to your new account is {####}", + "EmailSubject": "Verify your new account", + "SmsMessage": "The verification code to your new account is {####}" + } + }, + "UpdateReplacePolicy": "Delete", + "DeletionPolicy": "Delete" + } + }, + "Outputs": { + "userpoolid": { + "Value": { + "Ref": "myuserpool01998219" + } + } + }, + "Parameters": { + "BootstrapVersion": { + "Type": "AWS::SSM::Parameter::Value", + "Default": "/cdk-bootstrap/hnb659fds/version", + "Description": "Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]" + } + }, + "Rules": { + "CheckBootstrapVersion": { + "Assertions": [ + { + "Assert": { + "Fn::Not": [ + { + "Fn::Contains": [ + [ + "1", + "2", + "3", + "4", + "5" + ], + { + "Ref": "BootstrapVersion" + } + ] + } + ] + }, + "AssertDescription": "CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI." + } + ] + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-mfa-email.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-mfa-email.js.snapshot/integ.json new file mode 100644 index 0000000000000..88212ea89f5c4 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-mfa-email.js.snapshot/integ.json @@ -0,0 +1,14 @@ +{ + "enableLookups": true, + "version": "38.0.1", + "testCases": { + "integ-user-email-mfa-test/DefaultTest": { + "stacks": [ + "integ-user-email-mfa" + ], + "stackUpdateWorkflow": false, + "assertionStack": "integ-user-email-mfa-test/DefaultTest/DeployAssert", + "assertionStackName": "integuseremailmfatestDefaultTestDeployAssertD4C43B3C" + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-mfa-email.js.snapshot/integuseremailmfatestDefaultTestDeployAssertD4C43B3C.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-mfa-email.js.snapshot/integuseremailmfatestDefaultTestDeployAssertD4C43B3C.assets.json new file mode 100644 index 0000000000000..e4126b91762e6 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-mfa-email.js.snapshot/integuseremailmfatestDefaultTestDeployAssertD4C43B3C.assets.json @@ -0,0 +1,19 @@ +{ + "version": "38.0.1", + "files": { + "21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22": { + "source": { + "path": "integuseremailmfatestDefaultTestDeployAssertD4C43B3C.template.json", + "packaging": "file" + }, + "destinations": { + "current_account-current_region": { + "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", + "objectKey": "21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22.json", + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" + } + } + } + }, + "dockerImages": {} +} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-mfa-email.js.snapshot/integuseremailmfatestDefaultTestDeployAssertD4C43B3C.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-mfa-email.js.snapshot/integuseremailmfatestDefaultTestDeployAssertD4C43B3C.template.json new file mode 100644 index 0000000000000..ad9d0fb73d1dd --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-mfa-email.js.snapshot/integuseremailmfatestDefaultTestDeployAssertD4C43B3C.template.json @@ -0,0 +1,36 @@ +{ + "Parameters": { + "BootstrapVersion": { + "Type": "AWS::SSM::Parameter::Value", + "Default": "/cdk-bootstrap/hnb659fds/version", + "Description": "Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]" + } + }, + "Rules": { + "CheckBootstrapVersion": { + "Assertions": [ + { + "Assert": { + "Fn::Not": [ + { + "Fn::Contains": [ + [ + "1", + "2", + "3", + "4", + "5" + ], + { + "Ref": "BootstrapVersion" + } + ] + } + ] + }, + "AssertDescription": "CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI." + } + ] + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-mfa-email.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-mfa-email.js.snapshot/manifest.json new file mode 100644 index 0000000000000..05c1c5dc19eee --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-mfa-email.js.snapshot/manifest.json @@ -0,0 +1,127 @@ +{ + "version": "38.0.1", + "artifacts": { + "integ-user-email-mfa.assets": { + "type": "cdk:asset-manifest", + "properties": { + "file": "integ-user-email-mfa.assets.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "integ-user-email-mfa": { + "type": "aws:cloudformation:stack", + "environment": "aws://unknown-account/unknown-region", + "properties": { + "templateFile": "integ-user-email-mfa.template.json", + "terminationProtection": false, + "validateOnSynth": false, + "notificationArns": [], + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", + "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", + "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/57ebfe1ab6c8ce5faf8c2370ac901d380e8c968b793c3d82d66a3e6bd99983a8.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", + "additionalDependencies": [ + "integ-user-email-mfa.assets" + ], + "lookupRole": { + "arn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-lookup-role-${AWS::AccountId}-${AWS::Region}", + "requiresBootstrapStackVersion": 8, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "dependencies": [ + "integ-user-email-mfa.assets" + ], + "metadata": { + "/integ-user-email-mfa/myuserpool/smsRole/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "myuserpoolsmsRole0E16FDD9" + } + ], + "/integ-user-email-mfa/myuserpool/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "myuserpool01998219" + } + ], + "/integ-user-email-mfa/user-pool-id": [ + { + "type": "aws:cdk:logicalId", + "data": "userpoolid" + } + ], + "/integ-user-email-mfa/BootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "BootstrapVersion" + } + ], + "/integ-user-email-mfa/CheckBootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "CheckBootstrapVersion" + } + ] + }, + "displayName": "integ-user-email-mfa" + }, + "integuseremailmfatestDefaultTestDeployAssertD4C43B3C.assets": { + "type": "cdk:asset-manifest", + "properties": { + "file": "integuseremailmfatestDefaultTestDeployAssertD4C43B3C.assets.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "integuseremailmfatestDefaultTestDeployAssertD4C43B3C": { + "type": "aws:cloudformation:stack", + "environment": "aws://unknown-account/unknown-region", + "properties": { + "templateFile": "integuseremailmfatestDefaultTestDeployAssertD4C43B3C.template.json", + "terminationProtection": false, + "validateOnSynth": false, + "notificationArns": [], + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", + "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", + "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", + "additionalDependencies": [ + "integuseremailmfatestDefaultTestDeployAssertD4C43B3C.assets" + ], + "lookupRole": { + "arn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-lookup-role-${AWS::AccountId}-${AWS::Region}", + "requiresBootstrapStackVersion": 8, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "dependencies": [ + "integuseremailmfatestDefaultTestDeployAssertD4C43B3C.assets" + ], + "metadata": { + "/integ-user-email-mfa-test/DefaultTest/DeployAssert/BootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "BootstrapVersion" + } + ], + "/integ-user-email-mfa-test/DefaultTest/DeployAssert/CheckBootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "CheckBootstrapVersion" + } + ] + }, + "displayName": "integ-user-email-mfa-test/DefaultTest/DeployAssert" + }, + "Tree": { + "type": "cdk:tree", + "properties": { + "file": "tree.json" + } + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-mfa-email.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-mfa-email.js.snapshot/tree.json new file mode 100644 index 0000000000000..a90269fcaff6c --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-mfa-email.js.snapshot/tree.json @@ -0,0 +1,258 @@ +{ + "version": "tree-0.1", + "tree": { + "id": "App", + "path": "", + "children": { + "integ-user-email-mfa": { + "id": "integ-user-email-mfa", + "path": "integ-user-email-mfa", + "children": { + "myuserpool": { + "id": "myuserpool", + "path": "integ-user-email-mfa/myuserpool", + "children": { + "smsRole": { + "id": "smsRole", + "path": "integ-user-email-mfa/myuserpool/smsRole", + "children": { + "ImportsmsRole": { + "id": "ImportsmsRole", + "path": "integ-user-email-mfa/myuserpool/smsRole/ImportsmsRole", + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "0.0.0" + } + }, + "Resource": { + "id": "Resource", + "path": "integ-user-email-mfa/myuserpool/smsRole/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Role", + "aws:cdk:cloudformation:props": { + "assumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Condition": { + "StringEquals": { + "sts:ExternalId": "integuseremailmfamyuserpool8F31F20B" + } + }, + "Effect": "Allow", + "Principal": { + "Service": "cognito-idp.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + }, + "policies": [ + { + "policyName": "sns-publish", + "policyDocument": { + "Statement": [ + { + "Action": "sns:Publish", + "Effect": "Allow", + "Resource": "*" + } + ], + "Version": "2012-10-17" + } + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.CfnRole", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.Role", + "version": "0.0.0" + } + }, + "Resource": { + "id": "Resource", + "path": "integ-user-email-mfa/myuserpool/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::Cognito::UserPool", + "aws:cdk:cloudformation:props": { + "accountRecoverySetting": { + "recoveryMechanisms": [ + { + "name": "verified_phone_number", + "priority": 1 + }, + { + "name": "verified_email", + "priority": 2 + } + ] + }, + "adminCreateUserConfig": { + "allowAdminCreateUserOnly": true + }, + "emailConfiguration": { + "from": "\"myname@mycompany.com\" ", + "replyToEmailAddress": "support@*.example.com", + "emailSendingAccount": "DEVELOPER", + "sourceArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":ses:us-east-1:", + { + "Ref": "AWS::AccountId" + }, + ":identity/*.example.com" + ] + ] + } + }, + "emailVerificationMessage": "The verification code to your new account is {####}", + "emailVerificationSubject": "Verify your new account", + "enabledMfas": [ + "SMS_MFA", + "EMAIL_OTP" + ], + "mfaConfiguration": "ON", + "smsConfiguration": { + "externalId": "integuseremailmfamyuserpool8F31F20B", + "snsCallerArn": { + "Fn::GetAtt": [ + "myuserpoolsmsRole0E16FDD9", + "Arn" + ] + } + }, + "smsVerificationMessage": "The verification code to your new account is {####}", + "userPoolAddOns": { + "advancedSecurityMode": "ENFORCED" + }, + "userPoolName": "MyUserPool", + "verificationMessageTemplate": { + "defaultEmailOption": "CONFIRM_WITH_CODE", + "emailMessage": "The verification code to your new account is {####}", + "emailSubject": "Verify your new account", + "smsMessage": "The verification code to your new account is {####}" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_cognito.CfnUserPool", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_cognito.UserPool", + "version": "0.0.0" + } + }, + "user-pool-id": { + "id": "user-pool-id", + "path": "integ-user-email-mfa/user-pool-id", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnOutput", + "version": "0.0.0" + } + }, + "BootstrapVersion": { + "id": "BootstrapVersion", + "path": "integ-user-email-mfa/BootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnParameter", + "version": "0.0.0" + } + }, + "CheckBootstrapVersion": { + "id": "CheckBootstrapVersion", + "path": "integ-user-email-mfa/CheckBootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnRule", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.Stack", + "version": "0.0.0" + } + }, + "integ-user-email-mfa-test": { + "id": "integ-user-email-mfa-test", + "path": "integ-user-email-mfa-test", + "children": { + "DefaultTest": { + "id": "DefaultTest", + "path": "integ-user-email-mfa-test/DefaultTest", + "children": { + "Default": { + "id": "Default", + "path": "integ-user-email-mfa-test/DefaultTest/Default", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.3.0" + } + }, + "DeployAssert": { + "id": "DeployAssert", + "path": "integ-user-email-mfa-test/DefaultTest/DeployAssert", + "children": { + "BootstrapVersion": { + "id": "BootstrapVersion", + "path": "integ-user-email-mfa-test/DefaultTest/DeployAssert/BootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnParameter", + "version": "0.0.0" + } + }, + "CheckBootstrapVersion": { + "id": "CheckBootstrapVersion", + "path": "integ-user-email-mfa-test/DefaultTest/DeployAssert/CheckBootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnRule", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.Stack", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/integ-tests-alpha.IntegTestCase", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/integ-tests-alpha.IntegTest", + "version": "0.0.0" + } + }, + "Tree": { + "id": "Tree", + "path": "Tree", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.3.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.App", + "version": "0.0.0" + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-mfa-email.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-mfa-email.ts new file mode 100644 index 0000000000000..417c70d5ecd2c --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-mfa-email.ts @@ -0,0 +1,41 @@ +import { App, CfnOutput, RemovalPolicy, Stack } from 'aws-cdk-lib'; +import { IntegTest } from '@aws-cdk/integ-tests-alpha'; +import { AdvancedSecurityMode, Mfa, UserPool, UserPoolEmail } from 'aws-cdk-lib/aws-cognito'; + +/** + * Before you run test, you must set up SES email identity and set domain to domainName. + */ +const domainName = process.env.CDK_INTEG_DOMAIN_NAME ?? process.env.DOMAIN_NAME; +if (!domainName) throw new Error('For this test you must provide your own DomainName as an env var "DOMAIN_NAME".'); + +const app = new App(); +const stack = new Stack(app, 'integ-user-email-mfa'); + +const userpool = new UserPool(stack, 'myuserpool', { + removalPolicy: RemovalPolicy.DESTROY, + userPoolName: 'MyUserPool', + email: UserPoolEmail.withSES({ + sesRegion: 'us-east-1', + fromEmail: `noreply@${domainName}`, + fromName: 'myname@mycompany.com', + replyTo: `support@${domainName}`, + sesVerifiedDomain: domainName, + }), + mfa: Mfa.REQUIRED, + mfaSecondFactor: { + sms: true, + otp: false, + email: true, + }, + advancedSecurityMode: AdvancedSecurityMode.ENFORCED, +}); + +new CfnOutput(stack, 'user-pool-id', { + value: userpool.userPoolId, +}); + +new IntegTest(app, 'integ-user-email-mfa-test', { + testCases: [stack], + enableLookups: true, + stackUpdateWorkflow: false, +}); diff --git a/packages/aws-cdk-lib/aws-cognito/README.md b/packages/aws-cdk-lib/aws-cognito/README.md index 35df1769e41ac..7a4ae282ace23 100644 --- a/packages/aws-cdk-lib/aws-cognito/README.md +++ b/packages/aws-cdk-lib/aws-cognito/README.md @@ -306,6 +306,9 @@ configure an MFA token and use it for sign in. It also allows for the users to u [time-based one time password (TOTP)](https://docs.aws.amazon.com/cognito/latest/developerguide/user-pool-settings-mfa-totp.html). +If you want to enable email-based MFA, set `email` propety to the Amazon SES email-sending configuration and set `advancedSecurityMode` to `AdvancedSecurity.ENFORCED` or `AdvancedSecurity.AUDIT`. +For more information, see [Email MFA](https://docs.aws.amazon.com/cognito/latest/developerguide/cognito-user-pool-settings-advanced-security-email-mfa.html). + ```ts new cognito.UserPool(this, 'myuserpool', { // ... @@ -313,6 +316,7 @@ new cognito.UserPool(this, 'myuserpool', { mfaSecondFactor: { sms: true, otp: true, + email: false, // email-based MFA }, }); ``` diff --git a/packages/aws-cdk-lib/aws-cognito/lib/user-pool-email.ts b/packages/aws-cdk-lib/aws-cognito/lib/user-pool-email.ts index 4941dff664b28..332570faadd74 100644 --- a/packages/aws-cdk-lib/aws-cognito/lib/user-pool-email.ts +++ b/packages/aws-cdk-lib/aws-cognito/lib/user-pool-email.ts @@ -66,7 +66,7 @@ export interface UserPoolSESOptions { /** * Result of binding email settings with a user pool */ -interface UserPoolEmailConfig { +export interface UserPoolEmailConfig { /** * The name of the configuration set in SES. * diff --git a/packages/aws-cdk-lib/aws-cognito/lib/user-pool.ts b/packages/aws-cdk-lib/aws-cognito/lib/user-pool.ts index ede93a84af1f0..8d8adfc65ba17 100644 --- a/packages/aws-cdk-lib/aws-cognito/lib/user-pool.ts +++ b/packages/aws-cdk-lib/aws-cognito/lib/user-pool.ts @@ -5,7 +5,7 @@ import { StandardAttributeNames } from './private/attr-names'; import { ICustomAttribute, StandardAttribute, StandardAttributes } from './user-pool-attr'; import { UserPoolClient, UserPoolClientOptions } from './user-pool-client'; import { UserPoolDomain, UserPoolDomainOptions } from './user-pool-domain'; -import { UserPoolEmail } from './user-pool-email'; +import { UserPoolEmail, UserPoolEmailConfig } from './user-pool-email'; import { IUserPoolIdentityProvider } from './user-pool-idp'; import { UserPoolResourceServer, UserPoolResourceServerOptions } from './user-pool-resource-server'; import { Grant, IGrantable, IRole, PolicyDocument, PolicyStatement, Role, ServicePrincipal } from '../../aws-iam'; @@ -391,7 +391,7 @@ export enum Mfa { export interface MfaSecondFactor { /** * The MFA token is sent to the user via SMS to their verified phone numbers - * @see https://docs.aws.amazon.com/cognito/latest/developerguide/user-pool-settings-mfa-sms-text-message.html + * @see https://docs.aws.amazon.com/cognito/latest/developerguide/user-pool-settings-mfa-sms-email-message.html * @default true */ readonly sms: boolean; @@ -402,6 +402,17 @@ export interface MfaSecondFactor { * @default false */ readonly otp: boolean; + + /** + * The MFA token is sent to the user via EMAIL + * + * To enable email-based MFA, set `email` property to the Amazon SES email-sending configuration + * and set `advancedSecurityMode` to `AdvancedSecurity.ENFORCED` or `AdvancedSecurity.AUDIT` + * + * @see https://docs.aws.amazon.com/cognito/latest/developerguide/user-pool-settings-mfa-sms-email-message.html + * @default false + */ + readonly email?: boolean; } /** @@ -671,8 +682,8 @@ export interface UserPoolProps { /** * Configure the MFA types that users can use in this user pool. Ignored if `mfa` is set to `OFF`. * - * @default - { sms: true, otp: false }, if `mfa` is set to `OPTIONAL` or `REQUIRED`. - * { sms: false, otp: false }, otherwise + * @default - { sms: true, otp: false, email: false }, if `mfa` is set to `OPTIONAL` or `REQUIRED`. + * { sms: false, otp: false, email:false }, otherwise */ readonly mfaSecondFactor?: MfaSecondFactor; @@ -920,6 +931,7 @@ export class UserPool extends UserPoolBase { public readonly userPoolProviderUrl: string; private triggers: CfnUserPool.LambdaConfigProperty = {}; + private emailConfiguration: UserPoolEmailConfig | undefined; constructor(scope: Construct, id: string, props: UserPoolProps = {}) { super(scope, id); @@ -989,6 +1001,7 @@ export class UserPool extends UserPoolBase { from: encodePuny(props.emailSettings?.from), replyToEmailAddress: encodePuny(props.emailSettings?.replyTo), }); + this.emailConfiguration = emailConfiguration; const userPool = new CfnUserPool(this, 'Resource', { userPoolName: props.userPoolName, @@ -1237,6 +1250,9 @@ export class UserPool extends UserPoolBase { } if (props.mfaSecondFactor!.otp) { enabledMfas.push('SOFTWARE_TOKEN_MFA'); + } if (props.mfaSecondFactor!.email) { + this.validateEmailMfa(props); + enabledMfas.push('EMAIL_OTP'); } return enabledMfas; } @@ -1364,6 +1380,16 @@ export class UserPool extends UserPoolBase { attributesRequireVerificationBeforeUpdate, }; } + + private validateEmailMfa(props: UserPoolProps) { + if (props.email === undefined || this.emailConfiguration?.emailSendingAccount !== 'DEVELOPER') { + throw new Error('To enable email-based MFA, set `email` property to the Amazon SES email-sending configuration.'); + } + + if (props.advancedSecurityMode === AdvancedSecurityMode.OFF) { + throw new Error('To enable email-based MFA, set `advancedSecurityMode` to `AdvancedSecurity.ENFORCED` or `AdvancedSecurity.AUDIT`.'); + } + } } function undefinedIfNoKeys(struct: object): object | undefined { diff --git a/packages/aws-cdk-lib/aws-cognito/test/user-pool.test.ts b/packages/aws-cdk-lib/aws-cognito/test/user-pool.test.ts index d44a0c4e35e61..bcf69ec7948e9 100644 --- a/packages/aws-cdk-lib/aws-cognito/test/user-pool.test.ts +++ b/packages/aws-cdk-lib/aws-cognito/test/user-pool.test.ts @@ -2223,6 +2223,86 @@ test('advanced security is not present if option is not provided', () => { }); }); +describe('email MFA test', () => { + test('email MFA enabled', () => { + // GIVEN + const stack = new Stack(); + + // WHEN + new UserPool(stack, 'myuserpool', { + email: UserPoolEmail.withSES({ + sesRegion: 'us-east-1', + fromEmail: 'noreply@example.com', + fromName: 'myname@mycompany.com', + replyTo: 'support@example.com', + sesVerifiedDomain: 'example.com', + }), + mfa: Mfa.REQUIRED, + mfaSecondFactor: { + sms: true, + otp: false, + email: true, + }, + advancedSecurityMode: AdvancedSecurityMode.ENFORCED, + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::Cognito::UserPool', { + EnabledMfas: ['SMS_MFA', 'EMAIL_OTP'], + }); + }); + + test('throws when email MFA is enabled with no email settings.', () => { + const stack = new Stack(); + + expect(() => new UserPool(stack, 'Pool1', { + mfa: Mfa.REQUIRED, + mfaSecondFactor: { + sms: true, + otp: false, + email: true, + }, + advancedSecurityMode: AdvancedSecurityMode.ENFORCED, + })).toThrow('To enable email-based MFA, set `email` property to the Amazon SES email-sending configuration.'); + }); + + test('throws when email MFA is enabled with not SES email settings.', () => { + const stack = new Stack(); + + expect(() => new UserPool(stack, 'Pool1', { + mfa: Mfa.REQUIRED, + email: UserPoolEmail.withCognito(), + mfaSecondFactor: { + sms: true, + otp: false, + email: true, + }, + advancedSecurityMode: AdvancedSecurityMode.ENFORCED, + })).toThrow('To enable email-based MFA, set `email` property to the Amazon SES email-sending configuration.'); + }); + + test('set Email MFA', () => { + const stack = new Stack(); + + expect(() => new UserPool(stack, 'Pool1', { + email: UserPoolEmail.withSES({ + sesRegion: 'us-east-1', + fromEmail: 'noreply@example.com', + fromName: 'myname@mycompany.com', + replyTo: 'support@example.com', + sesVerifiedDomain: 'example.com', + }), + mfa: Mfa.REQUIRED, + mfaSecondFactor: { + sms: true, + otp: false, + email: true, + }, + advancedSecurityMode: AdvancedSecurityMode.OFF, + })).toThrow('To enable email-based MFA, set `advancedSecurityMode` to `AdvancedSecurity.ENFORCED` or `AdvancedSecurity.AUDIT`.'); + }); +}); + function fooFunction(scope: Construct, name: string): lambda.IFunction { return new lambda.Function(scope, name, { functionName: name, From 2a48358fa7cb977961c19dd33cfa3985d8280326 Mon Sep 17 00:00:00 2001 From: Pahud Hsieh Date: Tue, 22 Oct 2024 19:44:51 -0400 Subject: [PATCH 16/33] chore(bedrock): add claude 3.5 sonnet v2 (#31857) Add Anthropic's Claude 3.5 Sonnet V2 model. - https://aws.amazon.com/blogs/aws/upgraded-claude-3-5-sonnet-from-anthropic-available-now-computer-use-public-beta-and-claude-3-5-haiku-coming-soon-in-amazon-bedrock/ - The upgraded [Claude 3.5 Sonnet](https://aws.amazon.com/bedrock/claude/) is available today in [Amazon Bedrock](https://aws.amazon.com/bedrock/) in the US West (Oregon). ``` % AWS_REGION=us-west-2 AWS_PROFILE=pahud aws bedrock li st-foundation-models | jq -r '.modelSummaries[] | select(.modelId | startswith("anthropic.claude-3-5")) | .modelId' anthropic.claude-3-5-sonnet-20241022-v2:0 anthropic.claude-3-5-sonnet-20240620-v1:0:18k anthropic.claude-3-5-sonnet-20240620-v1:0:51k anthropic.claude-3-5-sonnet-20240620-v1:0:200k anthropic.claude-3-5-sonnet-20240620-v1:0 ``` ### Checklist - [x] My code adheres to the [CONTRIBUTING GUIDE](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and [DESIGN GUIDELINES](https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md) ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license* --- packages/aws-cdk-lib/aws-bedrock/lib/foundation-model.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/aws-cdk-lib/aws-bedrock/lib/foundation-model.ts b/packages/aws-cdk-lib/aws-bedrock/lib/foundation-model.ts index effe57b512010..18de3869296b5 100644 --- a/packages/aws-cdk-lib/aws-bedrock/lib/foundation-model.ts +++ b/packages/aws-cdk-lib/aws-bedrock/lib/foundation-model.ts @@ -125,6 +125,9 @@ export class FoundationModelIdentifier { /** Base model "anthropic.claude-3-5-sonnet-20240620-v1:0" */ public static readonly ANTHROPIC_CLAUDE_3_5_SONNET_20240620_V1_0 = new FoundationModelIdentifier('anthropic.claude-3-5-sonnet-20240620-v1:0'); + /** Base model "anthropic.claude-3-5-sonnet-20241022-v2:0" */ + public static readonly ANTHROPIC_CLAUDE_3_5_SONNET_20241022_V2_0 = new FoundationModelIdentifier('anthropic.claude-3-5-sonnet-20241022-v2:0'); + /** Base model "anthropic.claude-3-haiku-20240307-v1:0". */ public static readonly ANTHROPIC_CLAUDE_3_HAIKU_20240307_V1_0 = new FoundationModelIdentifier('anthropic.claude-3-haiku-20240307-v1:0'); From d1d179f617f83bbb3bf44d3cc629be8eed0d4e2b Mon Sep 17 00:00:00 2001 From: Samson Keung Date: Tue, 22 Oct 2024 17:18:18 -0700 Subject: [PATCH 17/33] fix(scheduler-targets-alpha): imported lambda function as schedule target throws synth error (#31837) ### Issue # (if applicable) Closes #29284. ### Reason for this change Removed the same env check between the Schedule and the Lambda target to allow use of imported Lambda function as target. ### Description of changes Removed the check that forces the Schedule and the Lambda function to be in the same account and region. ### Description of how you validated changes - Unit test added to ensure no synth error when using imported Lambda function. - Integ test added to ensure imported function works. The test ensures the lambda is executed and did what it is supposed to do (i.e. added tag to itself). ### Checklist - [x] My code adheres to the [CONTRIBUTING GUIDE](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and [DESIGN GUIDELINES](https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md) ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license* --- .../lib/lambda-invoke.ts | 23 +- .../index.js | 43473 +++++++++------- .../aws-cdk-schedule-lambda.assets.json | 32 + .../aws-cdk-schedule-lambda.template.json | 139 + .../aws-cdk-schedule.assets.json | 6 +- .../aws-cdk-schedule.template.json | 239 +- .../integ.lambda-invoke.js.snapshot/cdk.out | 2 +- .../integ.json | 2 +- ...efaultTestDeployAssertEC6565E6.assets.json | 12 +- ...aultTestDeployAssertEC6565E6.template.json | 260 +- .../manifest.json | 167 +- .../integ.lambda-invoke.js.snapshot/tree.json | 545 +- .../test/integ.lambda-invoke.ts | 112 +- .../test/lambda-invoke.test.ts | 60 +- 14 files changed, 24903 insertions(+), 20169 deletions(-) rename packages/@aws-cdk/aws-scheduler-targets-alpha/test/integ.lambda-invoke.js.snapshot/{asset.eafc02f6925151c95ac6a6ae81a3e36d4cf4e77db52eec8e467ce2a69454a41a.bundle => asset.e77649078c9dea5bbb707b7fe68014cfa5d919a38d31b467f6a205b51ea63a83.bundle}/index.js (71%) create mode 100644 packages/@aws-cdk/aws-scheduler-targets-alpha/test/integ.lambda-invoke.js.snapshot/aws-cdk-schedule-lambda.assets.json create mode 100644 packages/@aws-cdk/aws-scheduler-targets-alpha/test/integ.lambda-invoke.js.snapshot/aws-cdk-schedule-lambda.template.json diff --git a/packages/@aws-cdk/aws-scheduler-targets-alpha/lib/lambda-invoke.ts b/packages/@aws-cdk/aws-scheduler-targets-alpha/lib/lambda-invoke.ts index 69c26048c701f..bbd986780b6bd 100644 --- a/packages/@aws-cdk/aws-scheduler-targets-alpha/lib/lambda-invoke.ts +++ b/packages/@aws-cdk/aws-scheduler-targets-alpha/lib/lambda-invoke.ts @@ -1,34 +1,23 @@ import { ISchedule, IScheduleTarget } from '@aws-cdk/aws-scheduler-alpha'; -import { Names } from 'aws-cdk-lib'; import { IRole } from 'aws-cdk-lib/aws-iam'; import * as lambda from 'aws-cdk-lib/aws-lambda'; import { ScheduleTargetBase, ScheduleTargetBaseProps } from './target'; -import { sameEnvDimension } from './util'; /** * Use an AWS Lambda function as a target for AWS EventBridge Scheduler. */ export class LambdaInvoke extends ScheduleTargetBase implements IScheduleTarget { + private readonly func: lambda.IFunction; + constructor( - private readonly func: lambda.IFunction, - private readonly props: ScheduleTargetBaseProps, + func: lambda.IFunction, + props: ScheduleTargetBaseProps, ) { super(props, func.functionArn); + this.func = func; } - protected addTargetActionToRole(schedule: ISchedule, role: IRole): void { - if (!sameEnvDimension(this.func.env.region, schedule.env.region)) { - throw new Error(`Cannot assign function in region ${this.func.env.region} to the schedule ${Names.nodeUniqueId(schedule.node)} in region ${schedule.env.region}. Both the schedule and the function must be in the same region.`); - } - - if (!sameEnvDimension(this.func.env.account, schedule.env.account)) { - throw new Error(`Cannot assign function in account ${this.func.env.account} to the schedule ${Names.nodeUniqueId(schedule.node)} in account ${schedule.env.region}. Both the schedule and the function must be in the same account.`); - } - - if (this.props.role && !sameEnvDimension(this.props.role.env.account, this.func.env.account)) { - throw new Error(`Cannot grant permission to execution role in account ${this.props.role.env.account} to invoke target ${Names.nodeUniqueId(this.func.node)} in account ${this.func.env.account}. Both the target and the execution role must be in the same account.`); - } - + protected addTargetActionToRole(_schedule: ISchedule, role: IRole): void { this.func.grantInvoke(role); } } \ No newline at end of file diff --git a/packages/@aws-cdk/aws-scheduler-targets-alpha/test/integ.lambda-invoke.js.snapshot/asset.eafc02f6925151c95ac6a6ae81a3e36d4cf4e77db52eec8e467ce2a69454a41a.bundle/index.js b/packages/@aws-cdk/aws-scheduler-targets-alpha/test/integ.lambda-invoke.js.snapshot/asset.e77649078c9dea5bbb707b7fe68014cfa5d919a38d31b467f6a205b51ea63a83.bundle/index.js similarity index 71% rename from packages/@aws-cdk/aws-scheduler-targets-alpha/test/integ.lambda-invoke.js.snapshot/asset.eafc02f6925151c95ac6a6ae81a3e36d4cf4e77db52eec8e467ce2a69454a41a.bundle/index.js rename to packages/@aws-cdk/aws-scheduler-targets-alpha/test/integ.lambda-invoke.js.snapshot/asset.e77649078c9dea5bbb707b7fe68014cfa5d919a38d31b467f6a205b51ea63a83.bundle/index.js index b29fadc70c1e6..30d89ca8b59e8 100644 --- a/packages/@aws-cdk/aws-scheduler-targets-alpha/test/integ.lambda-invoke.js.snapshot/asset.eafc02f6925151c95ac6a6ae81a3e36d4cf4e77db52eec8e467ce2a69454a41a.bundle/index.js +++ b/packages/@aws-cdk/aws-scheduler-targets-alpha/test/integ.lambda-invoke.js.snapshot/asset.e77649078c9dea5bbb707b7fe68014cfa5d919a38d31b467f6a205b51ea63a83.bundle/index.js @@ -1,3 +1,4 @@ +"use strict"; var __create = Object.create; var __defProp = Object.defineProperty; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; @@ -815,652 +816,154 @@ var require_helpers_internal = __commonJS({ } }); -// ../../../node_modules/tslib/tslib.es6.mjs -var tslib_es6_exports = {}; -__export(tslib_es6_exports, { - __addDisposableResource: () => __addDisposableResource, - __assign: () => __assign, - __asyncDelegator: () => __asyncDelegator, - __asyncGenerator: () => __asyncGenerator, - __asyncValues: () => __asyncValues, - __await: () => __await, - __awaiter: () => __awaiter, - __classPrivateFieldGet: () => __classPrivateFieldGet, - __classPrivateFieldIn: () => __classPrivateFieldIn, - __classPrivateFieldSet: () => __classPrivateFieldSet, - __createBinding: () => __createBinding, - __decorate: () => __decorate, - __disposeResources: () => __disposeResources, - __esDecorate: () => __esDecorate, - __exportStar: () => __exportStar, - __extends: () => __extends, - __generator: () => __generator, - __importDefault: () => __importDefault, - __importStar: () => __importStar, - __makeTemplateObject: () => __makeTemplateObject, - __metadata: () => __metadata, - __param: () => __param, - __propKey: () => __propKey, - __read: () => __read, - __rest: () => __rest, - __runInitializers: () => __runInitializers, - __setFunctionName: () => __setFunctionName, - __spread: () => __spread, - __spreadArray: () => __spreadArray, - __spreadArrays: () => __spreadArrays, - __values: () => __values, - default: () => tslib_es6_default -}); -function __extends(d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { - this.constructor = d; - } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -} -function __rest(s, e) { - var t = {}; - for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) - t[p] = s[p]; - if (s != null && typeof Object.getOwnPropertySymbols === "function") - for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { - if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) - t[p[i]] = s[p[i]]; - } - return t; -} -function __decorate(decorators, target, key, desc) { - var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; - if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); - else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; - return c > 3 && r && Object.defineProperty(target, key, r), r; -} -function __param(paramIndex, decorator) { - return function(target, key) { - decorator(target, key, paramIndex); - }; -} -function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) { - function accept(f) { - if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); - return f; - } - var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value"; - var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null; - var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {}); - var _, done = false; - for (var i = decorators.length - 1; i >= 0; i--) { - var context = {}; - for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p]; - for (var p in contextIn.access) context.access[p] = contextIn.access[p]; - context.addInitializer = function(f) { - if (done) throw new TypeError("Cannot add initializers after decoration has completed"); - extraInitializers.push(accept(f || null)); +// ../../../node_modules/@smithy/types/dist-cjs/index.js +var require_dist_cjs = __commonJS({ + "../../../node_modules/@smithy/types/dist-cjs/index.js"(exports2, module2) { + var __defProp2 = Object.defineProperty; + var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; + var __getOwnPropNames2 = Object.getOwnPropertyNames; + var __hasOwnProp2 = Object.prototype.hasOwnProperty; + var __name = (target, value) => __defProp2(target, "name", { value, configurable: true }); + var __export2 = (target, all) => { + for (var name in all) + __defProp2(target, name, { get: all[name], enumerable: true }); }; - var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context); - if (kind === "accessor") { - if (result === void 0) continue; - if (result === null || typeof result !== "object") throw new TypeError("Object expected"); - if (_ = accept(result.get)) descriptor.get = _; - if (_ = accept(result.set)) descriptor.set = _; - if (_ = accept(result.init)) initializers.unshift(_); - } else if (_ = accept(result)) { - if (kind === "field") initializers.unshift(_); - else descriptor[key] = _; - } - } - if (target) Object.defineProperty(target, contextIn.name, descriptor); - done = true; -} -function __runInitializers(thisArg, initializers, value) { - var useValue = arguments.length > 2; - for (var i = 0; i < initializers.length; i++) { - value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg); - } - return useValue ? value : void 0; -} -function __propKey(x) { - return typeof x === "symbol" ? x : "".concat(x); -} -function __setFunctionName(f, name, prefix) { - if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : ""; - return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name }); -} -function __metadata(metadataKey, metadataValue) { - if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue); -} -function __awaiter(thisArg, _arguments, P, generator) { - function adopt(value) { - return value instanceof P ? value : new P(function(resolve) { - resolve(value); + var __copyProps2 = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames2(from)) + if (!__hasOwnProp2.call(to, key) && key !== except) + __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable }); + } + return to; + }; + var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); + var src_exports = {}; + __export2(src_exports, { + AlgorithmId: () => AlgorithmId, + EndpointURLScheme: () => EndpointURLScheme, + FieldPosition: () => FieldPosition, + HttpApiKeyAuthLocation: () => HttpApiKeyAuthLocation2, + HttpAuthLocation: () => HttpAuthLocation, + IniSectionType: () => IniSectionType, + RequestHandlerProtocol: () => RequestHandlerProtocol, + SMITHY_CONTEXT_KEY: () => SMITHY_CONTEXT_KEY4, + getDefaultClientConfiguration: () => getDefaultClientConfiguration, + resolveDefaultRuntimeConfig: () => resolveDefaultRuntimeConfig }); - } - return new (P || (P = Promise))(function(resolve, reject) { - function fulfilled(value) { - try { - step(generator.next(value)); - } catch (e) { - reject(e); + module2.exports = __toCommonJS2(src_exports); + var HttpAuthLocation = /* @__PURE__ */ ((HttpAuthLocation2) => { + HttpAuthLocation2["HEADER"] = "header"; + HttpAuthLocation2["QUERY"] = "query"; + return HttpAuthLocation2; + })(HttpAuthLocation || {}); + var HttpApiKeyAuthLocation2 = /* @__PURE__ */ ((HttpApiKeyAuthLocation22) => { + HttpApiKeyAuthLocation22["HEADER"] = "header"; + HttpApiKeyAuthLocation22["QUERY"] = "query"; + return HttpApiKeyAuthLocation22; + })(HttpApiKeyAuthLocation2 || {}); + var EndpointURLScheme = /* @__PURE__ */ ((EndpointURLScheme2) => { + EndpointURLScheme2["HTTP"] = "http"; + EndpointURLScheme2["HTTPS"] = "https"; + return EndpointURLScheme2; + })(EndpointURLScheme || {}); + var AlgorithmId = /* @__PURE__ */ ((AlgorithmId2) => { + AlgorithmId2["MD5"] = "md5"; + AlgorithmId2["CRC32"] = "crc32"; + AlgorithmId2["CRC32C"] = "crc32c"; + AlgorithmId2["SHA1"] = "sha1"; + AlgorithmId2["SHA256"] = "sha256"; + return AlgorithmId2; + })(AlgorithmId || {}); + var getChecksumConfiguration = /* @__PURE__ */ __name((runtimeConfig) => { + const checksumAlgorithms = []; + if (runtimeConfig.sha256 !== void 0) { + checksumAlgorithms.push({ + algorithmId: () => "sha256", + checksumConstructor: () => runtimeConfig.sha256 + }); } - } - function rejected(value) { - try { - step(generator["throw"](value)); - } catch (e) { - reject(e); + if (runtimeConfig.md5 != void 0) { + checksumAlgorithms.push({ + algorithmId: () => "md5", + checksumConstructor: () => runtimeConfig.md5 + }); } - } - function step(result) { - result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); - } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -} -function __generator(thisArg, body) { - var _ = { label: 0, sent: function() { - if (t[0] & 1) throw t[1]; - return t[1]; - }, trys: [], ops: [] }, f, y, t, g; - return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { - return this; - }), g; - function verb(n) { - return function(v) { - return step([n, v]); - }; + return { + _checksumAlgorithms: checksumAlgorithms, + addChecksumAlgorithm(algo) { + this._checksumAlgorithms.push(algo); + }, + checksumAlgorithms() { + return this._checksumAlgorithms; + } + }; + }, "getChecksumConfiguration"); + var resolveChecksumRuntimeConfig = /* @__PURE__ */ __name((clientConfig) => { + const runtimeConfig = {}; + clientConfig.checksumAlgorithms().forEach((checksumAlgorithm) => { + runtimeConfig[checksumAlgorithm.algorithmId()] = checksumAlgorithm.checksumConstructor(); + }); + return runtimeConfig; + }, "resolveChecksumRuntimeConfig"); + var getDefaultClientConfiguration = /* @__PURE__ */ __name((runtimeConfig) => { + return { + ...getChecksumConfiguration(runtimeConfig) + }; + }, "getDefaultClientConfiguration"); + var resolveDefaultRuntimeConfig = /* @__PURE__ */ __name((config) => { + return { + ...resolveChecksumRuntimeConfig(config) + }; + }, "resolveDefaultRuntimeConfig"); + var FieldPosition = /* @__PURE__ */ ((FieldPosition2) => { + FieldPosition2[FieldPosition2["HEADER"] = 0] = "HEADER"; + FieldPosition2[FieldPosition2["TRAILER"] = 1] = "TRAILER"; + return FieldPosition2; + })(FieldPosition || {}); + var SMITHY_CONTEXT_KEY4 = "__smithy_context"; + var IniSectionType = /* @__PURE__ */ ((IniSectionType2) => { + IniSectionType2["PROFILE"] = "profile"; + IniSectionType2["SSO_SESSION"] = "sso-session"; + IniSectionType2["SERVICES"] = "services"; + return IniSectionType2; + })(IniSectionType || {}); + var RequestHandlerProtocol = /* @__PURE__ */ ((RequestHandlerProtocol2) => { + RequestHandlerProtocol2["HTTP_0_9"] = "http/0.9"; + RequestHandlerProtocol2["HTTP_1_0"] = "http/1.0"; + RequestHandlerProtocol2["TDS_8_0"] = "tds/8.0"; + return RequestHandlerProtocol2; + })(RequestHandlerProtocol || {}); } - function step(op) { - if (f) throw new TypeError("Generator is already executing."); - while (g && (g = 0, op[0] && (_ = 0)), _) try { - if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; - if (y = 0, t) op = [op[0] & 2, t.value]; - switch (op[0]) { - case 0: - case 1: - t = op; - break; - case 4: - _.label++; - return { value: op[1], done: false }; - case 5: - _.label++; - y = op[1]; - op = [0]; - continue; - case 7: - op = _.ops.pop(); - _.trys.pop(); - continue; - default: - if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { - _ = 0; - continue; - } - if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) { - _.label = op[1]; - break; - } - if (op[0] === 6 && _.label < t[1]) { - _.label = t[1]; - t = op; - break; - } - if (t && _.label < t[2]) { - _.label = t[2]; - _.ops.push(op); - break; - } - if (t[2]) _.ops.pop(); - _.trys.pop(); - continue; - } - op = body.call(thisArg, _); - } catch (e) { - op = [6, e]; - y = 0; - } finally { - f = t = 0; - } - if (op[0] & 5) throw op[1]; - return { value: op[0] ? op[1] : void 0, done: true }; - } -} -function __exportStar(m, o) { - for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p); -} -function __values(o) { - var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; - if (m) return m.call(o); - if (o && typeof o.length === "number") return { - next: function() { - if (o && i >= o.length) o = void 0; - return { value: o && o[i++], done: !o }; - } - }; - throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); -} -function __read(o, n) { - var m = typeof Symbol === "function" && o[Symbol.iterator]; - if (!m) return o; - var i = m.call(o), r, ar = [], e; - try { - while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); - } catch (error) { - e = { error }; - } finally { - try { - if (r && !r.done && (m = i["return"])) m.call(i); - } finally { - if (e) throw e.error; - } - } - return ar; -} -function __spread() { - for (var ar = [], i = 0; i < arguments.length; i++) - ar = ar.concat(__read(arguments[i])); - return ar; -} -function __spreadArrays() { - for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length; - for (var r = Array(s), k = 0, i = 0; i < il; i++) - for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) - r[k] = a[j]; - return r; -} -function __spreadArray(to, from, pack) { - if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { - if (ar || !(i in from)) { - if (!ar) ar = Array.prototype.slice.call(from, 0, i); - ar[i] = from[i]; - } - } - return to.concat(ar || Array.prototype.slice.call(from)); -} -function __await(v) { - return this instanceof __await ? (this.v = v, this) : new __await(v); -} -function __asyncGenerator(thisArg, _arguments, generator) { - if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); - var g = generator.apply(thisArg, _arguments || []), i, q = []; - return i = {}, verb("next"), verb("throw"), verb("return", awaitReturn), i[Symbol.asyncIterator] = function() { - return this; - }, i; - function awaitReturn(f) { - return function(v) { - return Promise.resolve(v).then(f, reject); - }; - } - function verb(n, f) { - if (g[n]) { - i[n] = function(v) { - return new Promise(function(a, b) { - q.push([n, v, a, b]) > 1 || resume(n, v); - }); - }; - if (f) i[n] = f(i[n]); - } - } - function resume(n, v) { - try { - step(g[n](v)); - } catch (e) { - settle(q[0][3], e); - } - } - function step(r) { - r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); - } - function fulfill(value) { - resume("next", value); - } - function reject(value) { - resume("throw", value); - } - function settle(f, v) { - if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); - } -} -function __asyncDelegator(o) { - var i, p; - return i = {}, verb("next"), verb("throw", function(e) { - throw e; - }), verb("return"), i[Symbol.iterator] = function() { - return this; - }, i; - function verb(n, f) { - i[n] = o[n] ? function(v) { - return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v; - } : f; - } -} -function __asyncValues(o) { - if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); - var m = o[Symbol.asyncIterator], i; - return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function() { - return this; - }, i); - function verb(n) { - i[n] = o[n] && function(v) { - return new Promise(function(resolve, reject) { - v = o[n](v), settle(resolve, reject, v.done, v.value); - }); +}); + +// ../../../node_modules/@smithy/protocol-http/dist-cjs/index.js +var require_dist_cjs2 = __commonJS({ + "../../../node_modules/@smithy/protocol-http/dist-cjs/index.js"(exports2, module2) { + var __defProp2 = Object.defineProperty; + var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; + var __getOwnPropNames2 = Object.getOwnPropertyNames; + var __hasOwnProp2 = Object.prototype.hasOwnProperty; + var __name = (target, value) => __defProp2(target, "name", { value, configurable: true }); + var __export2 = (target, all) => { + for (var name in all) + __defProp2(target, name, { get: all[name], enumerable: true }); }; - } - function settle(resolve, reject, d, v) { - Promise.resolve(v).then(function(v2) { - resolve({ value: v2, done: d }); - }, reject); - } -} -function __makeTemplateObject(cooked, raw) { - if (Object.defineProperty) { - Object.defineProperty(cooked, "raw", { value: raw }); - } else { - cooked.raw = raw; - } - return cooked; -} -function __importStar(mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) { - for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); - } - __setModuleDefault(result, mod); - return result; -} -function __importDefault(mod) { - return mod && mod.__esModule ? mod : { default: mod }; -} -function __classPrivateFieldGet(receiver, state, kind, f) { - if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); - if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); - return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); -} -function __classPrivateFieldSet(receiver, state, value, kind, f) { - if (kind === "m") throw new TypeError("Private method is not writable"); - if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); - if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); - return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value), value; -} -function __classPrivateFieldIn(state, receiver) { - if (receiver === null || typeof receiver !== "object" && typeof receiver !== "function") throw new TypeError("Cannot use 'in' operator on non-object"); - return typeof state === "function" ? receiver === state : state.has(receiver); -} -function __addDisposableResource(env, value, async) { - if (value !== null && value !== void 0) { - if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected."); - var dispose, inner; - if (async) { - if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined."); - dispose = value[Symbol.asyncDispose]; - } - if (dispose === void 0) { - if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined."); - dispose = value[Symbol.dispose]; - if (async) inner = dispose; - } - if (typeof dispose !== "function") throw new TypeError("Object not disposable."); - if (inner) dispose = function() { - try { - inner.call(this); - } catch (e) { - return Promise.reject(e); + var __copyProps2 = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames2(from)) + if (!__hasOwnProp2.call(to, key) && key !== except) + __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable }); } - }; - env.stack.push({ value, dispose, async }); - } else if (async) { - env.stack.push({ async: true }); - } - return value; -} -function __disposeResources(env) { - function fail(e) { - env.error = env.hasError ? new _SuppressedError(e, env.error, "An error was suppressed during disposal.") : e; - env.hasError = true; - } - function next() { - while (env.stack.length) { - var rec = env.stack.pop(); - try { - var result = rec.dispose && rec.dispose.call(rec.value); - if (rec.async) return Promise.resolve(result).then(next, function(e) { - fail(e); - return next(); - }); - } catch (e) { - fail(e); - } - } - if (env.hasError) throw env.error; - } - return next(); -} -var extendStatics, __assign, __createBinding, __setModuleDefault, _SuppressedError, tslib_es6_default; -var init_tslib_es6 = __esm({ - "../../../node_modules/tslib/tslib.es6.mjs"() { - extendStatics = function(d, b) { - extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) { - d2.__proto__ = b2; - } || function(d2, b2) { - for (var p in b2) if (Object.prototype.hasOwnProperty.call(b2, p)) d2[p] = b2[p]; - }; - return extendStatics(d, b); - }; - __assign = function() { - __assign = Object.assign || function __assign2(t) { - for (var s, i = 1, n = arguments.length; i < n; i++) { - s = arguments[i]; - for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; - } - return t; - }; - return __assign.apply(this, arguments); - }; - __createBinding = Object.create ? function(o, m, k, k2) { - if (k2 === void 0) k2 = k; - var desc = Object.getOwnPropertyDescriptor(m, k); - if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { - desc = { enumerable: true, get: function() { - return m[k]; - } }; - } - Object.defineProperty(o, k2, desc); - } : function(o, m, k, k2) { - if (k2 === void 0) k2 = k; - o[k2] = m[k]; - }; - __setModuleDefault = Object.create ? function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); - } : function(o, v) { - o["default"] = v; - }; - _SuppressedError = typeof SuppressedError === "function" ? SuppressedError : function(error, suppressed, message) { - var e = new Error(message); - return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e; - }; - tslib_es6_default = { - __extends, - __assign, - __rest, - __decorate, - __param, - __metadata, - __awaiter, - __generator, - __createBinding, - __exportStar, - __values, - __read, - __spread, - __spreadArrays, - __spreadArray, - __await, - __asyncGenerator, - __asyncDelegator, - __asyncValues, - __makeTemplateObject, - __importStar, - __importDefault, - __classPrivateFieldGet, - __classPrivateFieldSet, - __classPrivateFieldIn, - __addDisposableResource, - __disposeResources - }; - } -}); - -// ../../../node_modules/@smithy/types/dist-cjs/index.js -var require_dist_cjs = __commonJS({ - "../../../node_modules/@smithy/types/dist-cjs/index.js"(exports2, module2) { - var __defProp2 = Object.defineProperty; - var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; - var __getOwnPropNames2 = Object.getOwnPropertyNames; - var __hasOwnProp2 = Object.prototype.hasOwnProperty; - var __name = (target, value) => __defProp2(target, "name", { value, configurable: true }); - var __export2 = (target, all) => { - for (var name in all) - __defProp2(target, name, { get: all[name], enumerable: true }); - }; - var __copyProps2 = (to, from, except, desc) => { - if (from && typeof from === "object" || typeof from === "function") { - for (let key of __getOwnPropNames2(from)) - if (!__hasOwnProp2.call(to, key) && key !== except) - __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable }); - } - return to; - }; - var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); - var src_exports = {}; - __export2(src_exports, { - AlgorithmId: () => AlgorithmId, - EndpointURLScheme: () => EndpointURLScheme, - FieldPosition: () => FieldPosition, - HttpApiKeyAuthLocation: () => HttpApiKeyAuthLocation, - HttpAuthLocation: () => HttpAuthLocation, - IniSectionType: () => IniSectionType, - RequestHandlerProtocol: () => RequestHandlerProtocol, - SMITHY_CONTEXT_KEY: () => SMITHY_CONTEXT_KEY, - getDefaultClientConfiguration: () => getDefaultClientConfiguration, - resolveDefaultRuntimeConfig: () => resolveDefaultRuntimeConfig - }); - module2.exports = __toCommonJS2(src_exports); - var HttpAuthLocation = /* @__PURE__ */ ((HttpAuthLocation2) => { - HttpAuthLocation2["HEADER"] = "header"; - HttpAuthLocation2["QUERY"] = "query"; - return HttpAuthLocation2; - })(HttpAuthLocation || {}); - var HttpApiKeyAuthLocation = /* @__PURE__ */ ((HttpApiKeyAuthLocation2) => { - HttpApiKeyAuthLocation2["HEADER"] = "header"; - HttpApiKeyAuthLocation2["QUERY"] = "query"; - return HttpApiKeyAuthLocation2; - })(HttpApiKeyAuthLocation || {}); - var EndpointURLScheme = /* @__PURE__ */ ((EndpointURLScheme2) => { - EndpointURLScheme2["HTTP"] = "http"; - EndpointURLScheme2["HTTPS"] = "https"; - return EndpointURLScheme2; - })(EndpointURLScheme || {}); - var AlgorithmId = /* @__PURE__ */ ((AlgorithmId2) => { - AlgorithmId2["MD5"] = "md5"; - AlgorithmId2["CRC32"] = "crc32"; - AlgorithmId2["CRC32C"] = "crc32c"; - AlgorithmId2["SHA1"] = "sha1"; - AlgorithmId2["SHA256"] = "sha256"; - return AlgorithmId2; - })(AlgorithmId || {}); - var getChecksumConfiguration = /* @__PURE__ */ __name((runtimeConfig) => { - const checksumAlgorithms = []; - if (runtimeConfig.sha256 !== void 0) { - checksumAlgorithms.push({ - algorithmId: () => "sha256", - checksumConstructor: () => runtimeConfig.sha256 - }); - } - if (runtimeConfig.md5 != void 0) { - checksumAlgorithms.push({ - algorithmId: () => "md5", - checksumConstructor: () => runtimeConfig.md5 - }); - } - return { - _checksumAlgorithms: checksumAlgorithms, - addChecksumAlgorithm(algo) { - this._checksumAlgorithms.push(algo); - }, - checksumAlgorithms() { - return this._checksumAlgorithms; - } - }; - }, "getChecksumConfiguration"); - var resolveChecksumRuntimeConfig = /* @__PURE__ */ __name((clientConfig) => { - const runtimeConfig = {}; - clientConfig.checksumAlgorithms().forEach((checksumAlgorithm) => { - runtimeConfig[checksumAlgorithm.algorithmId()] = checksumAlgorithm.checksumConstructor(); - }); - return runtimeConfig; - }, "resolveChecksumRuntimeConfig"); - var getDefaultClientConfiguration = /* @__PURE__ */ __name((runtimeConfig) => { - return { - ...getChecksumConfiguration(runtimeConfig) - }; - }, "getDefaultClientConfiguration"); - var resolveDefaultRuntimeConfig = /* @__PURE__ */ __name((config) => { - return { - ...resolveChecksumRuntimeConfig(config) - }; - }, "resolveDefaultRuntimeConfig"); - var FieldPosition = /* @__PURE__ */ ((FieldPosition2) => { - FieldPosition2[FieldPosition2["HEADER"] = 0] = "HEADER"; - FieldPosition2[FieldPosition2["TRAILER"] = 1] = "TRAILER"; - return FieldPosition2; - })(FieldPosition || {}); - var SMITHY_CONTEXT_KEY = "__smithy_context"; - var IniSectionType = /* @__PURE__ */ ((IniSectionType2) => { - IniSectionType2["PROFILE"] = "profile"; - IniSectionType2["SSO_SESSION"] = "sso-session"; - IniSectionType2["SERVICES"] = "services"; - return IniSectionType2; - })(IniSectionType || {}); - var RequestHandlerProtocol = /* @__PURE__ */ ((RequestHandlerProtocol2) => { - RequestHandlerProtocol2["HTTP_0_9"] = "http/0.9"; - RequestHandlerProtocol2["HTTP_1_0"] = "http/1.0"; - RequestHandlerProtocol2["TDS_8_0"] = "tds/8.0"; - return RequestHandlerProtocol2; - })(RequestHandlerProtocol || {}); - } -}); - -// ../../../node_modules/@smithy/protocol-http/dist-cjs/index.js -var require_dist_cjs2 = __commonJS({ - "../../../node_modules/@smithy/protocol-http/dist-cjs/index.js"(exports2, module2) { - var __defProp2 = Object.defineProperty; - var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; - var __getOwnPropNames2 = Object.getOwnPropertyNames; - var __hasOwnProp2 = Object.prototype.hasOwnProperty; - var __name = (target, value) => __defProp2(target, "name", { value, configurable: true }); - var __export2 = (target, all) => { - for (var name in all) - __defProp2(target, name, { get: all[name], enumerable: true }); - }; - var __copyProps2 = (to, from, except, desc) => { - if (from && typeof from === "object" || typeof from === "function") { - for (let key of __getOwnPropNames2(from)) - if (!__hasOwnProp2.call(to, key) && key !== except) - __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable }); - } - return to; + return to; }; var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); var src_exports = {}; __export2(src_exports, { Field: () => Field, Fields: () => Fields, - HttpRequest: () => HttpRequest, - HttpResponse: () => HttpResponse, + HttpRequest: () => HttpRequest7, + HttpResponse: () => HttpResponse2, + IHttpRequest: () => import_types5.HttpRequest, getHttpHandlerExtensionConfiguration: () => getHttpHandlerExtensionConfiguration, isValidHostname: () => isValidHostname, resolveHttpHandlerRuntimeConfig: () => resolveHttpHandlerRuntimeConfig @@ -1488,9 +991,9 @@ var require_dist_cjs2 = __commonJS({ httpHandler: httpHandlerExtensionConfiguration.httpHandler() }; }, "resolveHttpHandlerRuntimeConfig"); - var import_types = require_dist_cjs(); + var import_types5 = require_dist_cjs(); var _Field = class _Field { - constructor({ name, kind = import_types.FieldPosition.HEADER, values = [] }) { + constructor({ name, kind = import_types5.FieldPosition.HEADER, values = [] }) { this.name = name; this.kind = kind; this.values = values; @@ -1599,24 +1102,44 @@ var require_dist_cjs2 = __commonJS({ this.password = options.password; this.fragment = options.fragment; } + /** + * Note: this does not deep-clone the body. + */ + static clone(request2) { + const cloned = new _HttpRequest2({ + ...request2, + headers: { ...request2.headers } + }); + if (cloned.query) { + cloned.query = cloneQuery(cloned.query); + } + return cloned; + } + /** + * This method only actually asserts that request is the interface {@link IHttpRequest}, + * and not necessarily this concrete class. Left in place for API stability. + * + * Do not call instance methods on the input of this function, and + * do not assume it has the HttpRequest prototype. + */ static isInstance(request2) { - if (!request2) + if (!request2) { return false; + } const req = request2; return "method" in req && "protocol" in req && "hostname" in req && "path" in req && typeof req["query"] === "object" && typeof req["headers"] === "object"; } + /** + * @deprecated use static HttpRequest.clone(request) instead. It's not safe to call + * this method because {@link HttpRequest.isInstance} incorrectly + * asserts that IHttpRequest (interface) objects are of type HttpRequest (class). + */ clone() { - const cloned = new _HttpRequest2({ - ...this, - headers: { ...this.headers } - }); - if (cloned.query) - cloned.query = cloneQuery(cloned.query); - return cloned; + return _HttpRequest2.clone(this); } }; __name(_HttpRequest, "HttpRequest"); - var HttpRequest = _HttpRequest; + var HttpRequest7 = _HttpRequest; function cloneQuery(query) { return Object.keys(query).reduce((carry, paramName) => { const param = query[paramName]; @@ -1642,7 +1165,7 @@ var require_dist_cjs2 = __commonJS({ } }; __name(_HttpResponse, "HttpResponse"); - var HttpResponse = _HttpResponse; + var HttpResponse2 = _HttpResponse; function isValidHostname(hostname) { const hostPattern = /^[a-z0-9][a-z0-9\.\-]*[a-z0-9]$/; return hostPattern.test(hostname); @@ -1653,64 +1176,109 @@ var require_dist_cjs2 = __commonJS({ // ../../../node_modules/@aws-sdk/middleware-host-header/dist-cjs/index.js var require_dist_cjs3 = __commonJS({ - "../../../node_modules/@aws-sdk/middleware-host-header/dist-cjs/index.js"(exports2) { + "../../../node_modules/@aws-sdk/middleware-host-header/dist-cjs/index.js"(exports2, module2) { "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.getHostHeaderPlugin = exports2.hostHeaderMiddlewareOptions = exports2.hostHeaderMiddleware = exports2.resolveHostHeaderConfig = void 0; - var protocol_http_1 = require_dist_cjs2(); - function resolveHostHeaderConfig(input) { - return input; - } - exports2.resolveHostHeaderConfig = resolveHostHeaderConfig; - var hostHeaderMiddleware = (options) => (next) => async (args) => { - if (!protocol_http_1.HttpRequest.isInstance(args.request)) - return next(args); - const { request: request2 } = args; - const { handlerProtocol = "" } = options.requestHandler.metadata || {}; - if (handlerProtocol.indexOf("h2") >= 0 && !request2.headers[":authority"]) { - delete request2.headers["host"]; - request2.headers[":authority"] = ""; - } else if (!request2.headers["host"]) { - let host = request2.hostname; + var __defProp2 = Object.defineProperty; + var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; + var __getOwnPropNames2 = Object.getOwnPropertyNames; + var __hasOwnProp2 = Object.prototype.hasOwnProperty; + var __name = (target, value) => __defProp2(target, "name", { value, configurable: true }); + var __export2 = (target, all) => { + for (var name in all) + __defProp2(target, name, { get: all[name], enumerable: true }); + }; + var __copyProps2 = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames2(from)) + if (!__hasOwnProp2.call(to, key) && key !== except) + __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable }); + } + return to; + }; + var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); + var src_exports = {}; + __export2(src_exports, { + getHostHeaderPlugin: () => getHostHeaderPlugin, + hostHeaderMiddleware: () => hostHeaderMiddleware, + hostHeaderMiddlewareOptions: () => hostHeaderMiddlewareOptions, + resolveHostHeaderConfig: () => resolveHostHeaderConfig + }); + module2.exports = __toCommonJS2(src_exports); + var import_protocol_http8 = require_dist_cjs2(); + function resolveHostHeaderConfig(input) { + return input; + } + __name(resolveHostHeaderConfig, "resolveHostHeaderConfig"); + var hostHeaderMiddleware = /* @__PURE__ */ __name((options) => (next) => async (args) => { + if (!import_protocol_http8.HttpRequest.isInstance(args.request)) + return next(args); + const { request: request2 } = args; + const { handlerProtocol = "" } = options.requestHandler.metadata || {}; + if (handlerProtocol.indexOf("h2") >= 0 && !request2.headers[":authority"]) { + delete request2.headers["host"]; + request2.headers[":authority"] = request2.hostname + (request2.port ? ":" + request2.port : ""); + } else if (!request2.headers["host"]) { + let host = request2.hostname; if (request2.port != null) host += `:${request2.port}`; request2.headers["host"] = host; } return next(args); - }; - exports2.hostHeaderMiddleware = hostHeaderMiddleware; - exports2.hostHeaderMiddlewareOptions = { + }, "hostHeaderMiddleware"); + var hostHeaderMiddlewareOptions = { name: "hostHeaderMiddleware", step: "build", priority: "low", tags: ["HOST"], override: true }; - var getHostHeaderPlugin = (options) => ({ + var getHostHeaderPlugin = /* @__PURE__ */ __name((options) => ({ applyToStack: (clientStack) => { - clientStack.add((0, exports2.hostHeaderMiddleware)(options), exports2.hostHeaderMiddlewareOptions); + clientStack.add(hostHeaderMiddleware(options), hostHeaderMiddlewareOptions); } - }); - exports2.getHostHeaderPlugin = getHostHeaderPlugin; + }), "getHostHeaderPlugin"); } }); -// ../../../node_modules/@aws-sdk/middleware-logger/dist-cjs/loggerMiddleware.js -var require_loggerMiddleware = __commonJS({ - "../../../node_modules/@aws-sdk/middleware-logger/dist-cjs/loggerMiddleware.js"(exports2) { +// ../../../node_modules/@aws-sdk/middleware-logger/dist-cjs/index.js +var require_dist_cjs4 = __commonJS({ + "../../../node_modules/@aws-sdk/middleware-logger/dist-cjs/index.js"(exports2, module2) { "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.getLoggerPlugin = exports2.loggerMiddlewareOptions = exports2.loggerMiddleware = void 0; - var loggerMiddleware = () => (next, context) => async (args) => { + var __defProp2 = Object.defineProperty; + var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; + var __getOwnPropNames2 = Object.getOwnPropertyNames; + var __hasOwnProp2 = Object.prototype.hasOwnProperty; + var __name = (target, value) => __defProp2(target, "name", { value, configurable: true }); + var __export2 = (target, all) => { + for (var name in all) + __defProp2(target, name, { get: all[name], enumerable: true }); + }; + var __copyProps2 = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames2(from)) + if (!__hasOwnProp2.call(to, key) && key !== except) + __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable }); + } + return to; + }; + var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); + var src_exports = {}; + __export2(src_exports, { + getLoggerPlugin: () => getLoggerPlugin, + loggerMiddleware: () => loggerMiddleware, + loggerMiddlewareOptions: () => loggerMiddlewareOptions + }); + module2.exports = __toCommonJS2(src_exports); + var loggerMiddleware = /* @__PURE__ */ __name(() => (next, context) => async (args) => { var _a, _b; try { const response = await next(args); const { clientName, commandName, logger, dynamoDbDocumentClientOptions = {} } = context; const { overrideInputFilterSensitiveLog, overrideOutputFilterSensitiveLog } = dynamoDbDocumentClientOptions; - const inputFilterSensitiveLog = overrideInputFilterSensitiveLog !== null && overrideInputFilterSensitiveLog !== void 0 ? overrideInputFilterSensitiveLog : context.inputFilterSensitiveLog; - const outputFilterSensitiveLog = overrideOutputFilterSensitiveLog !== null && overrideOutputFilterSensitiveLog !== void 0 ? overrideOutputFilterSensitiveLog : context.outputFilterSensitiveLog; + const inputFilterSensitiveLog = overrideInputFilterSensitiveLog ?? context.inputFilterSensitiveLog; + const outputFilterSensitiveLog = overrideOutputFilterSensitiveLog ?? context.outputFilterSensitiveLog; const { $metadata, ...outputWithoutMetadata } = response.output; - (_a = logger === null || logger === void 0 ? void 0 : logger.info) === null || _a === void 0 ? void 0 : _a.call(logger, { + (_a = logger == null ? void 0 : logger.info) == null ? void 0 : _a.call(logger, { clientName, commandName, input: inputFilterSensitiveLog(args.input), @@ -1721,8 +1289,8 @@ var require_loggerMiddleware = __commonJS({ } catch (error) { const { clientName, commandName, logger, dynamoDbDocumentClientOptions = {} } = context; const { overrideInputFilterSensitiveLog } = dynamoDbDocumentClientOptions; - const inputFilterSensitiveLog = overrideInputFilterSensitiveLog !== null && overrideInputFilterSensitiveLog !== void 0 ? overrideInputFilterSensitiveLog : context.inputFilterSensitiveLog; - (_b = logger === null || logger === void 0 ? void 0 : logger.error) === null || _b === void 0 ? void 0 : _b.call(logger, { + const inputFilterSensitiveLog = overrideInputFilterSensitiveLog ?? context.inputFilterSensitiveLog; + (_b = logger == null ? void 0 : logger.error) == null ? void 0 : _b.call(logger, { clientName, commandName, input: inputFilterSensitiveLog(args.input), @@ -1731,51 +1299,62 @@ var require_loggerMiddleware = __commonJS({ }); throw error; } - }; - exports2.loggerMiddleware = loggerMiddleware; - exports2.loggerMiddlewareOptions = { + }, "loggerMiddleware"); + var loggerMiddlewareOptions = { name: "loggerMiddleware", tags: ["LOGGER"], step: "initialize", override: true }; - var getLoggerPlugin = (options) => ({ + var getLoggerPlugin = /* @__PURE__ */ __name((options) => ({ applyToStack: (clientStack) => { - clientStack.add((0, exports2.loggerMiddleware)(), exports2.loggerMiddlewareOptions); + clientStack.add(loggerMiddleware(), loggerMiddlewareOptions); } - }); - exports2.getLoggerPlugin = getLoggerPlugin; - } -}); - -// ../../../node_modules/@aws-sdk/middleware-logger/dist-cjs/index.js -var require_dist_cjs4 = __commonJS({ - "../../../node_modules/@aws-sdk/middleware-logger/dist-cjs/index.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports)); - tslib_1.__exportStar(require_loggerMiddleware(), exports2); + }), "getLoggerPlugin"); } }); // ../../../node_modules/@aws-sdk/middleware-recursion-detection/dist-cjs/index.js var require_dist_cjs5 = __commonJS({ - "../../../node_modules/@aws-sdk/middleware-recursion-detection/dist-cjs/index.js"(exports2) { + "../../../node_modules/@aws-sdk/middleware-recursion-detection/dist-cjs/index.js"(exports2, module2) { "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.getRecursionDetectionPlugin = exports2.addRecursionDetectionMiddlewareOptions = exports2.recursionDetectionMiddleware = void 0; - var protocol_http_1 = require_dist_cjs2(); + var __defProp2 = Object.defineProperty; + var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; + var __getOwnPropNames2 = Object.getOwnPropertyNames; + var __hasOwnProp2 = Object.prototype.hasOwnProperty; + var __name = (target, value) => __defProp2(target, "name", { value, configurable: true }); + var __export2 = (target, all) => { + for (var name in all) + __defProp2(target, name, { get: all[name], enumerable: true }); + }; + var __copyProps2 = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames2(from)) + if (!__hasOwnProp2.call(to, key) && key !== except) + __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable }); + } + return to; + }; + var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); + var src_exports = {}; + __export2(src_exports, { + addRecursionDetectionMiddlewareOptions: () => addRecursionDetectionMiddlewareOptions, + getRecursionDetectionPlugin: () => getRecursionDetectionPlugin, + recursionDetectionMiddleware: () => recursionDetectionMiddleware + }); + module2.exports = __toCommonJS2(src_exports); + var import_protocol_http8 = require_dist_cjs2(); var TRACE_ID_HEADER_NAME = "X-Amzn-Trace-Id"; var ENV_LAMBDA_FUNCTION_NAME = "AWS_LAMBDA_FUNCTION_NAME"; var ENV_TRACE_ID = "_X_AMZN_TRACE_ID"; - var recursionDetectionMiddleware = (options) => (next) => async (args) => { + var recursionDetectionMiddleware = /* @__PURE__ */ __name((options) => (next) => async (args) => { const { request: request2 } = args; - if (!protocol_http_1.HttpRequest.isInstance(request2) || options.runtime !== "node" || request2.headers.hasOwnProperty(TRACE_ID_HEADER_NAME)) { + if (!import_protocol_http8.HttpRequest.isInstance(request2) || options.runtime !== "node" || request2.headers.hasOwnProperty(TRACE_ID_HEADER_NAME)) { return next(args); } const functionName = process.env[ENV_LAMBDA_FUNCTION_NAME]; const traceId = process.env[ENV_TRACE_ID]; - const nonEmptyString = (str) => typeof str === "string" && str.length > 0; + const nonEmptyString = /* @__PURE__ */ __name((str) => typeof str === "string" && str.length > 0, "nonEmptyString"); if (nonEmptyString(functionName) && nonEmptyString(traceId)) { request2.headers[TRACE_ID_HEADER_NAME] = traceId; } @@ -1783,27 +1362,25 @@ var require_dist_cjs5 = __commonJS({ ...args, request: request2 }); - }; - exports2.recursionDetectionMiddleware = recursionDetectionMiddleware; - exports2.addRecursionDetectionMiddlewareOptions = { + }, "recursionDetectionMiddleware"); + var addRecursionDetectionMiddlewareOptions = { step: "build", tags: ["RECURSION_DETECTION"], name: "recursionDetectionMiddleware", override: true, priority: "low" }; - var getRecursionDetectionPlugin = (options) => ({ + var getRecursionDetectionPlugin = /* @__PURE__ */ __name((options) => ({ applyToStack: (clientStack) => { - clientStack.add((0, exports2.recursionDetectionMiddleware)(options), exports2.addRecursionDetectionMiddlewareOptions); + clientStack.add(recursionDetectionMiddleware(options), addRecursionDetectionMiddlewareOptions); } - }); - exports2.getRecursionDetectionPlugin = getRecursionDetectionPlugin; + }), "getRecursionDetectionPlugin"); } }); -// ../../../node_modules/@smithy/property-provider/dist-cjs/index.js +// ../../../node_modules/@smithy/util-endpoints/dist-cjs/index.js var require_dist_cjs6 = __commonJS({ - "../../../node_modules/@smithy/property-provider/dist-cjs/index.js"(exports2, module2) { + "../../../node_modules/@smithy/util-endpoints/dist-cjs/index.js"(exports2, module2) { var __defProp2 = Object.defineProperty; var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; var __getOwnPropNames2 = Object.getOwnPropertyNames; @@ -1824,185 +1401,462 @@ var require_dist_cjs6 = __commonJS({ var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); var src_exports = {}; __export2(src_exports, { - CredentialsProviderError: () => CredentialsProviderError, - ProviderError: () => ProviderError, - TokenProviderError: () => TokenProviderError, - chain: () => chain, - fromStatic: () => fromStatic, - memoize: () => memoize + EndpointCache: () => EndpointCache, + EndpointError: () => EndpointError2, + customEndpointFunctions: () => customEndpointFunctions, + isIpAddress: () => isIpAddress2, + isValidHostLabel: () => isValidHostLabel, + resolveEndpoint: () => resolveEndpoint2 }); module2.exports = __toCommonJS2(src_exports); - var _ProviderError = class _ProviderError2 extends Error { - constructor(message, tryNextLink = true) { - super(message); - this.tryNextLink = tryNextLink; - this.name = "ProviderError"; - Object.setPrototypeOf(this, _ProviderError2.prototype); + var _EndpointCache = class _EndpointCache { + /** + * @param [size] - desired average maximum capacity. A buffer of 10 additional keys will be allowed + * before keys are dropped. + * @param [params] - list of params to consider as part of the cache key. + * + * If the params list is not populated, no caching will happen. + * This may be out of order depending on how the object is created and arrives to this class. + */ + constructor({ size, params }) { + this.data = /* @__PURE__ */ new Map(); + this.parameters = []; + this.capacity = size ?? 50; + if (params) { + this.parameters = params; + } } - static from(error, tryNextLink = true) { - return Object.assign(new this(error.message, tryNextLink), error); + /** + * @param endpointParams - query for endpoint. + * @param resolver - provider of the value if not present. + * @returns endpoint corresponding to the query. + */ + get(endpointParams, resolver) { + const key = this.hash(endpointParams); + if (key === false) { + return resolver(); + } + if (!this.data.has(key)) { + if (this.data.size > this.capacity + 10) { + const keys = this.data.keys(); + let i = 0; + while (true) { + const { value, done } = keys.next(); + this.data.delete(value); + if (done || ++i > 10) { + break; + } + } + } + this.data.set(key, resolver()); + } + return this.data.get(key); } - }; - __name(_ProviderError, "ProviderError"); - var ProviderError = _ProviderError; - var _CredentialsProviderError = class _CredentialsProviderError2 extends ProviderError { - constructor(message, tryNextLink = true) { - super(message, tryNextLink); - this.tryNextLink = tryNextLink; - this.name = "CredentialsProviderError"; - Object.setPrototypeOf(this, _CredentialsProviderError2.prototype); + size() { + return this.data.size; } - }; - __name(_CredentialsProviderError, "CredentialsProviderError"); - var CredentialsProviderError = _CredentialsProviderError; - var _TokenProviderError = class _TokenProviderError2 extends ProviderError { - constructor(message, tryNextLink = true) { - super(message, tryNextLink); - this.tryNextLink = tryNextLink; - this.name = "TokenProviderError"; - Object.setPrototypeOf(this, _TokenProviderError2.prototype); + /** + * @returns cache key or false if not cachable. + */ + hash(endpointParams) { + let buffer = ""; + const { parameters } = this; + if (parameters.length === 0) { + return false; + } + for (const param of parameters) { + const val2 = String(endpointParams[param] ?? ""); + if (val2.includes("|;")) { + return false; + } + buffer += val2 + "|;"; + } + return buffer; } }; - __name(_TokenProviderError, "TokenProviderError"); - var TokenProviderError = _TokenProviderError; - var chain = /* @__PURE__ */ __name((...providers) => async () => { - if (providers.length === 0) { - throw new ProviderError("No providers in chain"); + __name(_EndpointCache, "EndpointCache"); + var EndpointCache = _EndpointCache; + var IP_V4_REGEX = new RegExp( + `^(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3}$` + ); + var isIpAddress2 = /* @__PURE__ */ __name((value) => IP_V4_REGEX.test(value) || value.startsWith("[") && value.endsWith("]"), "isIpAddress"); + var VALID_HOST_LABEL_REGEX = new RegExp(`^(?!.*-$)(?!-)[a-zA-Z0-9-]{1,63}$`); + var isValidHostLabel = /* @__PURE__ */ __name((value, allowSubDomains = false) => { + if (!allowSubDomains) { + return VALID_HOST_LABEL_REGEX.test(value); } - let lastProviderError; - for (const provider of providers) { - try { - const credentials = await provider(); - return credentials; - } catch (err) { - lastProviderError = err; - if (err == null ? void 0 : err.tryNextLink) { - continue; - } - throw err; + const labels = value.split("."); + for (const label of labels) { + if (!isValidHostLabel(label)) { + return false; } } - throw lastProviderError; - }, "chain"); - var fromStatic = /* @__PURE__ */ __name((staticValue) => () => Promise.resolve(staticValue), "fromStatic"); - var memoize = /* @__PURE__ */ __name((provider, isExpired, requiresRefresh) => { - let resolved; - let pending; - let hasResult; - let isConstant = false; - const coalesceProvider = /* @__PURE__ */ __name(async () => { - if (!pending) { - pending = provider(); + return true; + }, "isValidHostLabel"); + var customEndpointFunctions = {}; + var debugId = "endpoints"; + function toDebugString(input) { + if (typeof input !== "object" || input == null) { + return input; + } + if ("ref" in input) { + return `$${toDebugString(input.ref)}`; + } + if ("fn" in input) { + return `${input.fn}(${(input.argv || []).map(toDebugString).join(", ")})`; + } + return JSON.stringify(input, null, 2); + } + __name(toDebugString, "toDebugString"); + var _EndpointError = class _EndpointError extends Error { + constructor(message) { + super(message); + this.name = "EndpointError"; + } + }; + __name(_EndpointError, "EndpointError"); + var EndpointError2 = _EndpointError; + var booleanEquals = /* @__PURE__ */ __name((value1, value2) => value1 === value2, "booleanEquals"); + var getAttrPathList = /* @__PURE__ */ __name((path) => { + const parts = path.split("."); + const pathList = []; + for (const part of parts) { + const squareBracketIndex = part.indexOf("["); + if (squareBracketIndex !== -1) { + if (part.indexOf("]") !== part.length - 1) { + throw new EndpointError2(`Path: '${path}' does not end with ']'`); + } + const arrayIndex = part.slice(squareBracketIndex + 1, -1); + if (Number.isNaN(parseInt(arrayIndex))) { + throw new EndpointError2(`Invalid array index: '${arrayIndex}' in path: '${path}'`); + } + if (squareBracketIndex !== 0) { + pathList.push(part.slice(0, squareBracketIndex)); + } + pathList.push(arrayIndex); + } else { + pathList.push(part); } + } + return pathList; + }, "getAttrPathList"); + var getAttr = /* @__PURE__ */ __name((value, path) => getAttrPathList(path).reduce((acc, index) => { + if (typeof acc !== "object") { + throw new EndpointError2(`Index '${index}' in '${path}' not found in '${JSON.stringify(value)}'`); + } else if (Array.isArray(acc)) { + return acc[parseInt(index)]; + } + return acc[index]; + }, value), "getAttr"); + var isSet = /* @__PURE__ */ __name((value) => value != null, "isSet"); + var not = /* @__PURE__ */ __name((value) => !value, "not"); + var import_types32 = require_dist_cjs(); + var DEFAULT_PORTS = { + [import_types32.EndpointURLScheme.HTTP]: 80, + [import_types32.EndpointURLScheme.HTTPS]: 443 + }; + var parseURL = /* @__PURE__ */ __name((value) => { + const whatwgURL = (() => { try { - resolved = await pending; - hasResult = true; - isConstant = false; - } finally { - pending = void 0; - } - return resolved; - }, "coalesceProvider"); - if (isExpired === void 0) { - return async (options) => { - if (!hasResult || (options == null ? void 0 : options.forceRefresh)) { - resolved = await coalesceProvider(); + if (value instanceof URL) { + return value; } - return resolved; - }; - } - return async (options) => { - if (!hasResult || (options == null ? void 0 : options.forceRefresh)) { - resolved = await coalesceProvider(); - } - if (isConstant) { - return resolved; - } - if (requiresRefresh && !requiresRefresh(resolved)) { - isConstant = true; - return resolved; + if (typeof value === "object" && "hostname" in value) { + const { hostname: hostname2, port, protocol: protocol2 = "", path = "", query = {} } = value; + const url2 = new URL(`${protocol2}//${hostname2}${port ? `:${port}` : ""}${path}`); + url2.search = Object.entries(query).map(([k, v]) => `${k}=${v}`).join("&"); + return url2; + } + return new URL(value); + } catch (error) { + return null; } - if (isExpired(resolved)) { - await coalesceProvider(); - return resolved; + })(); + if (!whatwgURL) { + console.error(`Unable to parse ${JSON.stringify(value)} as a whatwg URL.`); + return null; + } + const urlString = whatwgURL.href; + const { host, hostname, pathname, protocol, search } = whatwgURL; + if (search) { + return null; + } + const scheme = protocol.slice(0, -1); + if (!Object.values(import_types32.EndpointURLScheme).includes(scheme)) { + return null; + } + const isIp = isIpAddress2(hostname); + const inputContainsDefaultPort = urlString.includes(`${host}:${DEFAULT_PORTS[scheme]}`) || typeof value === "string" && value.includes(`${host}:${DEFAULT_PORTS[scheme]}`); + const authority = `${host}${inputContainsDefaultPort ? `:${DEFAULT_PORTS[scheme]}` : ``}`; + return { + scheme, + authority, + path: pathname, + normalizedPath: pathname.endsWith("/") ? pathname : `${pathname}/`, + isIp + }; + }, "parseURL"); + var stringEquals = /* @__PURE__ */ __name((value1, value2) => value1 === value2, "stringEquals"); + var substring = /* @__PURE__ */ __name((input, start, stop, reverse) => { + if (start >= stop || input.length < stop) { + return null; + } + if (!reverse) { + return input.substring(start, stop); + } + return input.substring(input.length - stop, input.length - start); + }, "substring"); + var uriEncode = /* @__PURE__ */ __name((value) => encodeURIComponent(value).replace(/[!*'()]/g, (c) => `%${c.charCodeAt(0).toString(16).toUpperCase()}`), "uriEncode"); + var endpointFunctions = { + booleanEquals, + getAttr, + isSet, + isValidHostLabel, + not, + parseURL, + stringEquals, + substring, + uriEncode + }; + var evaluateTemplate = /* @__PURE__ */ __name((template, options) => { + const evaluatedTemplateArr = []; + const templateContext = { + ...options.endpointParams, + ...options.referenceRecord + }; + let currentIndex = 0; + while (currentIndex < template.length) { + const openingBraceIndex = template.indexOf("{", currentIndex); + if (openingBraceIndex === -1) { + evaluatedTemplateArr.push(template.slice(currentIndex)); + break; } - return resolved; + evaluatedTemplateArr.push(template.slice(currentIndex, openingBraceIndex)); + const closingBraceIndex = template.indexOf("}", openingBraceIndex); + if (closingBraceIndex === -1) { + evaluatedTemplateArr.push(template.slice(openingBraceIndex)); + break; + } + if (template[openingBraceIndex + 1] === "{" && template[closingBraceIndex + 1] === "}") { + evaluatedTemplateArr.push(template.slice(openingBraceIndex + 1, closingBraceIndex)); + currentIndex = closingBraceIndex + 2; + } + const parameterName = template.substring(openingBraceIndex + 1, closingBraceIndex); + if (parameterName.includes("#")) { + const [refName, attrName] = parameterName.split("#"); + evaluatedTemplateArr.push(getAttr(templateContext[refName], attrName)); + } else { + evaluatedTemplateArr.push(templateContext[parameterName]); + } + currentIndex = closingBraceIndex + 1; + } + return evaluatedTemplateArr.join(""); + }, "evaluateTemplate"); + var getReferenceValue = /* @__PURE__ */ __name(({ ref }, options) => { + const referenceRecord = { + ...options.endpointParams, + ...options.referenceRecord }; - }, "memoize"); - } -}); - -// ../../../node_modules/@smithy/util-middleware/dist-cjs/index.js -var require_dist_cjs7 = __commonJS({ - "../../../node_modules/@smithy/util-middleware/dist-cjs/index.js"(exports2, module2) { - var __defProp2 = Object.defineProperty; - var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; - var __getOwnPropNames2 = Object.getOwnPropertyNames; - var __hasOwnProp2 = Object.prototype.hasOwnProperty; - var __name = (target, value) => __defProp2(target, "name", { value, configurable: true }); - var __export2 = (target, all) => { - for (var name in all) - __defProp2(target, name, { get: all[name], enumerable: true }); - }; - var __copyProps2 = (to, from, except, desc) => { - if (from && typeof from === "object" || typeof from === "function") { - for (let key of __getOwnPropNames2(from)) - if (!__hasOwnProp2.call(to, key) && key !== except) - __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable }); + return referenceRecord[ref]; + }, "getReferenceValue"); + var evaluateExpression = /* @__PURE__ */ __name((obj, keyName, options) => { + if (typeof obj === "string") { + return evaluateTemplate(obj, options); + } else if (obj["fn"]) { + return callFunction(obj, options); + } else if (obj["ref"]) { + return getReferenceValue(obj, options); } - return to; - }; - var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); - var src_exports = {}; - __export2(src_exports, { - getSmithyContext: () => getSmithyContext, - normalizeProvider: () => normalizeProvider - }); - module2.exports = __toCommonJS2(src_exports); - var import_types = require_dist_cjs(); - var getSmithyContext = /* @__PURE__ */ __name((context) => context[import_types.SMITHY_CONTEXT_KEY] || (context[import_types.SMITHY_CONTEXT_KEY] = {}), "getSmithyContext"); - var normalizeProvider = /* @__PURE__ */ __name((input) => { - if (typeof input === "function") - return input; - const promisified = Promise.resolve(input); - return () => promisified; - }, "normalizeProvider"); - } -}); - -// ../../../node_modules/@smithy/is-array-buffer/dist-cjs/index.js -var require_dist_cjs8 = __commonJS({ - "../../../node_modules/@smithy/is-array-buffer/dist-cjs/index.js"(exports2, module2) { - var __defProp2 = Object.defineProperty; - var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; - var __getOwnPropNames2 = Object.getOwnPropertyNames; - var __hasOwnProp2 = Object.prototype.hasOwnProperty; - var __name = (target, value) => __defProp2(target, "name", { value, configurable: true }); - var __export2 = (target, all) => { - for (var name in all) - __defProp2(target, name, { get: all[name], enumerable: true }); - }; - var __copyProps2 = (to, from, except, desc) => { - if (from && typeof from === "object" || typeof from === "function") { - for (let key of __getOwnPropNames2(from)) - if (!__hasOwnProp2.call(to, key) && key !== except) - __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable }); + throw new EndpointError2(`'${keyName}': ${String(obj)} is not a string, function or reference.`); + }, "evaluateExpression"); + var callFunction = /* @__PURE__ */ __name(({ fn, argv }, options) => { + const evaluatedArgs = argv.map( + (arg) => ["boolean", "number"].includes(typeof arg) ? arg : evaluateExpression(arg, "arg", options) + ); + const fnSegments = fn.split("."); + if (fnSegments[0] in customEndpointFunctions && fnSegments[1] != null) { + return customEndpointFunctions[fnSegments[0]][fnSegments[1]](...evaluatedArgs); } - return to; - }; - var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); - var src_exports = {}; - __export2(src_exports, { - isArrayBuffer: () => isArrayBuffer - }); - module2.exports = __toCommonJS2(src_exports); - var isArrayBuffer = /* @__PURE__ */ __name((arg) => typeof ArrayBuffer === "function" && arg instanceof ArrayBuffer || Object.prototype.toString.call(arg) === "[object ArrayBuffer]", "isArrayBuffer"); + return endpointFunctions[fn](...evaluatedArgs); + }, "callFunction"); + var evaluateCondition = /* @__PURE__ */ __name(({ assign, ...fnArgs }, options) => { + var _a, _b; + if (assign && assign in options.referenceRecord) { + throw new EndpointError2(`'${assign}' is already defined in Reference Record.`); + } + const value = callFunction(fnArgs, options); + (_b = (_a = options.logger) == null ? void 0 : _a.debug) == null ? void 0 : _b.call(_a, `${debugId} evaluateCondition: ${toDebugString(fnArgs)} = ${toDebugString(value)}`); + return { + result: value === "" ? true : !!value, + ...assign != null && { toAssign: { name: assign, value } } + }; + }, "evaluateCondition"); + var evaluateConditions = /* @__PURE__ */ __name((conditions = [], options) => { + var _a, _b; + const conditionsReferenceRecord = {}; + for (const condition of conditions) { + const { result, toAssign } = evaluateCondition(condition, { + ...options, + referenceRecord: { + ...options.referenceRecord, + ...conditionsReferenceRecord + } + }); + if (!result) { + return { result }; + } + if (toAssign) { + conditionsReferenceRecord[toAssign.name] = toAssign.value; + (_b = (_a = options.logger) == null ? void 0 : _a.debug) == null ? void 0 : _b.call(_a, `${debugId} assign: ${toAssign.name} := ${toDebugString(toAssign.value)}`); + } + } + return { result: true, referenceRecord: conditionsReferenceRecord }; + }, "evaluateConditions"); + var getEndpointHeaders = /* @__PURE__ */ __name((headers, options) => Object.entries(headers).reduce( + (acc, [headerKey, headerVal]) => ({ + ...acc, + [headerKey]: headerVal.map((headerValEntry) => { + const processedExpr = evaluateExpression(headerValEntry, "Header value entry", options); + if (typeof processedExpr !== "string") { + throw new EndpointError2(`Header '${headerKey}' value '${processedExpr}' is not a string`); + } + return processedExpr; + }) + }), + {} + ), "getEndpointHeaders"); + var getEndpointProperty = /* @__PURE__ */ __name((property, options) => { + if (Array.isArray(property)) { + return property.map((propertyEntry) => getEndpointProperty(propertyEntry, options)); + } + switch (typeof property) { + case "string": + return evaluateTemplate(property, options); + case "object": + if (property === null) { + throw new EndpointError2(`Unexpected endpoint property: ${property}`); + } + return getEndpointProperties(property, options); + case "boolean": + return property; + default: + throw new EndpointError2(`Unexpected endpoint property type: ${typeof property}`); + } + }, "getEndpointProperty"); + var getEndpointProperties = /* @__PURE__ */ __name((properties, options) => Object.entries(properties).reduce( + (acc, [propertyKey, propertyVal]) => ({ + ...acc, + [propertyKey]: getEndpointProperty(propertyVal, options) + }), + {} + ), "getEndpointProperties"); + var getEndpointUrl = /* @__PURE__ */ __name((endpointUrl, options) => { + const expression = evaluateExpression(endpointUrl, "Endpoint URL", options); + if (typeof expression === "string") { + try { + return new URL(expression); + } catch (error) { + console.error(`Failed to construct URL with ${expression}`, error); + throw error; + } + } + throw new EndpointError2(`Endpoint URL must be a string, got ${typeof expression}`); + }, "getEndpointUrl"); + var evaluateEndpointRule = /* @__PURE__ */ __name((endpointRule, options) => { + var _a, _b; + const { conditions, endpoint } = endpointRule; + const { result, referenceRecord } = evaluateConditions(conditions, options); + if (!result) { + return; + } + const endpointRuleOptions = { + ...options, + referenceRecord: { ...options.referenceRecord, ...referenceRecord } + }; + const { url: url2, properties, headers } = endpoint; + (_b = (_a = options.logger) == null ? void 0 : _a.debug) == null ? void 0 : _b.call(_a, `${debugId} Resolving endpoint from template: ${toDebugString(endpoint)}`); + return { + ...headers != void 0 && { + headers: getEndpointHeaders(headers, endpointRuleOptions) + }, + ...properties != void 0 && { + properties: getEndpointProperties(properties, endpointRuleOptions) + }, + url: getEndpointUrl(url2, endpointRuleOptions) + }; + }, "evaluateEndpointRule"); + var evaluateErrorRule = /* @__PURE__ */ __name((errorRule, options) => { + const { conditions, error } = errorRule; + const { result, referenceRecord } = evaluateConditions(conditions, options); + if (!result) { + return; + } + throw new EndpointError2( + evaluateExpression(error, "Error", { + ...options, + referenceRecord: { ...options.referenceRecord, ...referenceRecord } + }) + ); + }, "evaluateErrorRule"); + var evaluateTreeRule = /* @__PURE__ */ __name((treeRule, options) => { + const { conditions, rules } = treeRule; + const { result, referenceRecord } = evaluateConditions(conditions, options); + if (!result) { + return; + } + return evaluateRules(rules, { + ...options, + referenceRecord: { ...options.referenceRecord, ...referenceRecord } + }); + }, "evaluateTreeRule"); + var evaluateRules = /* @__PURE__ */ __name((rules, options) => { + for (const rule of rules) { + if (rule.type === "endpoint") { + const endpointOrUndefined = evaluateEndpointRule(rule, options); + if (endpointOrUndefined) { + return endpointOrUndefined; + } + } else if (rule.type === "error") { + evaluateErrorRule(rule, options); + } else if (rule.type === "tree") { + const endpointOrUndefined = evaluateTreeRule(rule, options); + if (endpointOrUndefined) { + return endpointOrUndefined; + } + } else { + throw new EndpointError2(`Unknown endpoint rule: ${rule}`); + } + } + throw new EndpointError2(`Rules evaluation failed`); + }, "evaluateRules"); + var resolveEndpoint2 = /* @__PURE__ */ __name((ruleSetObject, options) => { + var _a, _b, _c, _d; + const { endpointParams, logger } = options; + const { parameters, rules } = ruleSetObject; + (_b = (_a = options.logger) == null ? void 0 : _a.debug) == null ? void 0 : _b.call(_a, `${debugId} Initial EndpointParams: ${toDebugString(endpointParams)}`); + const paramsWithDefault = Object.entries(parameters).filter(([, v]) => v.default != null).map(([k, v]) => [k, v.default]); + if (paramsWithDefault.length > 0) { + for (const [paramKey, paramDefaultValue] of paramsWithDefault) { + endpointParams[paramKey] = endpointParams[paramKey] ?? paramDefaultValue; + } + } + const requiredParams = Object.entries(parameters).filter(([, v]) => v.required).map(([k]) => k); + for (const requiredParam of requiredParams) { + if (endpointParams[requiredParam] == null) { + throw new EndpointError2(`Missing required parameter: '${requiredParam}'`); + } + } + const endpoint = evaluateRules(rules, { endpointParams, logger, referenceRecord: {} }); + (_d = (_c = options.logger) == null ? void 0 : _c.debug) == null ? void 0 : _d.call(_c, `${debugId} Resolved endpoint: ${toDebugString(endpoint)}`); + return endpoint; + }, "resolveEndpoint"); } }); -// ../../../node_modules/@smithy/util-buffer-from/dist-cjs/index.js -var require_dist_cjs9 = __commonJS({ - "../../../node_modules/@smithy/util-buffer-from/dist-cjs/index.js"(exports2, module2) { +// ../../../node_modules/@aws-sdk/util-endpoints/dist-cjs/index.js +var require_dist_cjs7 = __commonJS({ + "../../../node_modules/@aws-sdk/util-endpoints/dist-cjs/index.js"(exports2, module2) { + "use strict"; var __defProp2 = Object.defineProperty; var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; var __getOwnPropNames2 = Object.getOwnPropertyNames; @@ -2023,184 +1877,352 @@ var require_dist_cjs9 = __commonJS({ var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); var src_exports = {}; __export2(src_exports, { - fromArrayBuffer: () => fromArrayBuffer, - fromString: () => fromString + ConditionObject: () => import_util_endpoints.ConditionObject, + DeprecatedObject: () => import_util_endpoints.DeprecatedObject, + EndpointError: () => import_util_endpoints.EndpointError, + EndpointObject: () => import_util_endpoints.EndpointObject, + EndpointObjectHeaders: () => import_util_endpoints.EndpointObjectHeaders, + EndpointObjectProperties: () => import_util_endpoints.EndpointObjectProperties, + EndpointParams: () => import_util_endpoints.EndpointParams, + EndpointResolverOptions: () => import_util_endpoints.EndpointResolverOptions, + EndpointRuleObject: () => import_util_endpoints.EndpointRuleObject, + ErrorRuleObject: () => import_util_endpoints.ErrorRuleObject, + EvaluateOptions: () => import_util_endpoints.EvaluateOptions, + Expression: () => import_util_endpoints.Expression, + FunctionArgv: () => import_util_endpoints.FunctionArgv, + FunctionObject: () => import_util_endpoints.FunctionObject, + FunctionReturn: () => import_util_endpoints.FunctionReturn, + ParameterObject: () => import_util_endpoints.ParameterObject, + ReferenceObject: () => import_util_endpoints.ReferenceObject, + ReferenceRecord: () => import_util_endpoints.ReferenceRecord, + RuleSetObject: () => import_util_endpoints.RuleSetObject, + RuleSetRules: () => import_util_endpoints.RuleSetRules, + TreeRuleObject: () => import_util_endpoints.TreeRuleObject, + awsEndpointFunctions: () => awsEndpointFunctions, + getUserAgentPrefix: () => getUserAgentPrefix, + isIpAddress: () => import_util_endpoints.isIpAddress, + partition: () => partition, + resolveEndpoint: () => import_util_endpoints.resolveEndpoint, + setPartitionInfo: () => setPartitionInfo, + useDefaultPartitionInfo: () => useDefaultPartitionInfo }); module2.exports = __toCommonJS2(src_exports); - var import_is_array_buffer = require_dist_cjs8(); - var import_buffer = require("buffer"); - var fromArrayBuffer = /* @__PURE__ */ __name((input, offset = 0, length = input.byteLength - offset) => { - if (!(0, import_is_array_buffer.isArrayBuffer)(input)) { - throw new TypeError(`The "input" argument must be ArrayBuffer. Received type ${typeof input} (${input})`); + var import_util_endpoints = require_dist_cjs6(); + var isVirtualHostableS3Bucket = /* @__PURE__ */ __name((value, allowSubDomains = false) => { + if (allowSubDomains) { + for (const label of value.split(".")) { + if (!isVirtualHostableS3Bucket(label)) { + return false; + } + } + return true; } - return import_buffer.Buffer.from(input, offset, length); - }, "fromArrayBuffer"); - var fromString = /* @__PURE__ */ __name((input, encoding) => { - if (typeof input !== "string") { - throw new TypeError(`The "input" argument must be of type string. Received type ${typeof input} (${input})`); + if (!(0, import_util_endpoints.isValidHostLabel)(value)) { + return false; } - return encoding ? import_buffer.Buffer.from(input, encoding) : import_buffer.Buffer.from(input); - }, "fromString"); - } -}); - -// ../../../node_modules/@smithy/util-utf8/dist-cjs/index.js -var require_dist_cjs10 = __commonJS({ - "../../../node_modules/@smithy/util-utf8/dist-cjs/index.js"(exports2, module2) { - var __defProp2 = Object.defineProperty; - var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; - var __getOwnPropNames2 = Object.getOwnPropertyNames; - var __hasOwnProp2 = Object.prototype.hasOwnProperty; - var __name = (target, value) => __defProp2(target, "name", { value, configurable: true }); - var __export2 = (target, all) => { - for (var name in all) - __defProp2(target, name, { get: all[name], enumerable: true }); - }; - var __copyProps2 = (to, from, except, desc) => { - if (from && typeof from === "object" || typeof from === "function") { - for (let key of __getOwnPropNames2(from)) - if (!__hasOwnProp2.call(to, key) && key !== except) - __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable }); - } - return to; - }; - var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); - var src_exports = {}; - __export2(src_exports, { - fromUtf8: () => fromUtf8, - toUint8Array: () => toUint8Array, - toUtf8: () => toUtf8 - }); - module2.exports = __toCommonJS2(src_exports); - var import_util_buffer_from = require_dist_cjs9(); - var fromUtf8 = /* @__PURE__ */ __name((input) => { - const buf = (0, import_util_buffer_from.fromString)(input, "utf8"); - return new Uint8Array(buf.buffer, buf.byteOffset, buf.byteLength / Uint8Array.BYTES_PER_ELEMENT); - }, "fromUtf8"); - var toUint8Array = /* @__PURE__ */ __name((data) => { - if (typeof data === "string") { - return fromUtf8(data); - } - if (ArrayBuffer.isView(data)) { - return new Uint8Array(data.buffer, data.byteOffset, data.byteLength / Uint8Array.BYTES_PER_ELEMENT); - } - return new Uint8Array(data); - }, "toUint8Array"); - var toUtf8 = /* @__PURE__ */ __name((input) => { - if (typeof input === "string") { - return input; - } - if (typeof input !== "object" || typeof input.byteOffset !== "number" || typeof input.byteLength !== "number") { - throw new Error("@smithy/util-utf8: toUtf8 encoder function only accepts string | Uint8Array."); - } - return (0, import_util_buffer_from.fromArrayBuffer)(input.buffer, input.byteOffset, input.byteLength).toString("utf8"); - }, "toUtf8"); - } -}); - -// ../../../node_modules/@smithy/util-hex-encoding/dist-cjs/index.js -var require_dist_cjs11 = __commonJS({ - "../../../node_modules/@smithy/util-hex-encoding/dist-cjs/index.js"(exports2, module2) { - var __defProp2 = Object.defineProperty; - var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; - var __getOwnPropNames2 = Object.getOwnPropertyNames; - var __hasOwnProp2 = Object.prototype.hasOwnProperty; - var __name = (target, value) => __defProp2(target, "name", { value, configurable: true }); - var __export2 = (target, all) => { - for (var name in all) - __defProp2(target, name, { get: all[name], enumerable: true }); - }; - var __copyProps2 = (to, from, except, desc) => { - if (from && typeof from === "object" || typeof from === "function") { - for (let key of __getOwnPropNames2(from)) - if (!__hasOwnProp2.call(to, key) && key !== except) - __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable }); + if (value.length < 3 || value.length > 63) { + return false; } - return to; - }; - var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); - var src_exports = {}; - __export2(src_exports, { - fromHex: () => fromHex, - toHex: () => toHex - }); - module2.exports = __toCommonJS2(src_exports); - var SHORT_TO_HEX = {}; - var HEX_TO_SHORT = {}; - for (let i = 0; i < 256; i++) { - let encodedByte = i.toString(16).toLowerCase(); - if (encodedByte.length === 1) { - encodedByte = `0${encodedByte}`; + if (value !== value.toLowerCase()) { + return false; } - SHORT_TO_HEX[i] = encodedByte; - HEX_TO_SHORT[encodedByte] = i; - } - function fromHex(encoded) { - if (encoded.length % 2 !== 0) { - throw new Error("Hex encoded strings must have an even number length"); + if ((0, import_util_endpoints.isIpAddress)(value)) { + return false; } - const out = new Uint8Array(encoded.length / 2); - for (let i = 0; i < encoded.length; i += 2) { - const encodedByte = encoded.slice(i, i + 2).toLowerCase(); - if (encodedByte in HEX_TO_SHORT) { - out[i / 2] = HEX_TO_SHORT[encodedByte]; - } else { - throw new Error(`Cannot decode unrecognized sequence ${encodedByte} as hexadecimal`); + return true; + }, "isVirtualHostableS3Bucket"); + var ARN_DELIMITER = ":"; + var RESOURCE_DELIMITER = "/"; + var parseArn = /* @__PURE__ */ __name((value) => { + const segments = value.split(ARN_DELIMITER); + if (segments.length < 6) + return null; + const [arn, partition2, service, region, accountId, ...resourcePath] = segments; + if (arn !== "arn" || partition2 === "" || service === "" || resourcePath.join(ARN_DELIMITER) === "") + return null; + const resourceId = resourcePath.map((resource) => resource.split(RESOURCE_DELIMITER)).flat(); + return { + partition: partition2, + service, + region, + accountId, + resourceId + }; + }, "parseArn"); + var partitions_default = { + partitions: [{ + id: "aws", + outputs: { + dnsSuffix: "amazonaws.com", + dualStackDnsSuffix: "api.aws", + implicitGlobalRegion: "us-east-1", + name: "aws", + supportsDualStack: true, + supportsFIPS: true + }, + regionRegex: "^(us|eu|ap|sa|ca|me|af|il)\\-\\w+\\-\\d+$", + regions: { + "af-south-1": { + description: "Africa (Cape Town)" + }, + "ap-east-1": { + description: "Asia Pacific (Hong Kong)" + }, + "ap-northeast-1": { + description: "Asia Pacific (Tokyo)" + }, + "ap-northeast-2": { + description: "Asia Pacific (Seoul)" + }, + "ap-northeast-3": { + description: "Asia Pacific (Osaka)" + }, + "ap-south-1": { + description: "Asia Pacific (Mumbai)" + }, + "ap-south-2": { + description: "Asia Pacific (Hyderabad)" + }, + "ap-southeast-1": { + description: "Asia Pacific (Singapore)" + }, + "ap-southeast-2": { + description: "Asia Pacific (Sydney)" + }, + "ap-southeast-3": { + description: "Asia Pacific (Jakarta)" + }, + "ap-southeast-4": { + description: "Asia Pacific (Melbourne)" + }, + "aws-global": { + description: "AWS Standard global region" + }, + "ca-central-1": { + description: "Canada (Central)" + }, + "ca-west-1": { + description: "Canada West (Calgary)" + }, + "eu-central-1": { + description: "Europe (Frankfurt)" + }, + "eu-central-2": { + description: "Europe (Zurich)" + }, + "eu-north-1": { + description: "Europe (Stockholm)" + }, + "eu-south-1": { + description: "Europe (Milan)" + }, + "eu-south-2": { + description: "Europe (Spain)" + }, + "eu-west-1": { + description: "Europe (Ireland)" + }, + "eu-west-2": { + description: "Europe (London)" + }, + "eu-west-3": { + description: "Europe (Paris)" + }, + "il-central-1": { + description: "Israel (Tel Aviv)" + }, + "me-central-1": { + description: "Middle East (UAE)" + }, + "me-south-1": { + description: "Middle East (Bahrain)" + }, + "sa-east-1": { + description: "South America (Sao Paulo)" + }, + "us-east-1": { + description: "US East (N. Virginia)" + }, + "us-east-2": { + description: "US East (Ohio)" + }, + "us-west-1": { + description: "US West (N. California)" + }, + "us-west-2": { + description: "US West (Oregon)" + } } - } - return out; - } - __name(fromHex, "fromHex"); - function toHex(bytes) { - let out = ""; - for (let i = 0; i < bytes.byteLength; i++) { - out += SHORT_TO_HEX[bytes[i]]; - } - return out; - } - __name(toHex, "toHex"); - } -}); - -// ../../../node_modules/@smithy/util-uri-escape/dist-cjs/index.js -var require_dist_cjs12 = __commonJS({ - "../../../node_modules/@smithy/util-uri-escape/dist-cjs/index.js"(exports2, module2) { - var __defProp2 = Object.defineProperty; - var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; - var __getOwnPropNames2 = Object.getOwnPropertyNames; - var __hasOwnProp2 = Object.prototype.hasOwnProperty; - var __name = (target, value) => __defProp2(target, "name", { value, configurable: true }); - var __export2 = (target, all) => { - for (var name in all) - __defProp2(target, name, { get: all[name], enumerable: true }); - }; - var __copyProps2 = (to, from, except, desc) => { - if (from && typeof from === "object" || typeof from === "function") { - for (let key of __getOwnPropNames2(from)) - if (!__hasOwnProp2.call(to, key) && key !== except) - __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable }); - } - return to; - }; - var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); - var src_exports = {}; - __export2(src_exports, { - escapeUri: () => escapeUri, - escapeUriPath: () => escapeUriPath - }); - module2.exports = __toCommonJS2(src_exports); - var escapeUri = /* @__PURE__ */ __name((uri) => ( - // AWS percent-encodes some extra non-standard characters in a URI - encodeURIComponent(uri).replace(/[!'()*]/g, hexEncode) - ), "escapeUri"); - var hexEncode = /* @__PURE__ */ __name((c) => `%${c.charCodeAt(0).toString(16).toUpperCase()}`, "hexEncode"); - var escapeUriPath = /* @__PURE__ */ __name((uri) => uri.split("/").map(escapeUri).join("/"), "escapeUriPath"); + }, { + id: "aws-cn", + outputs: { + dnsSuffix: "amazonaws.com.cn", + dualStackDnsSuffix: "api.amazonwebservices.com.cn", + implicitGlobalRegion: "cn-northwest-1", + name: "aws-cn", + supportsDualStack: true, + supportsFIPS: true + }, + regionRegex: "^cn\\-\\w+\\-\\d+$", + regions: { + "aws-cn-global": { + description: "AWS China global region" + }, + "cn-north-1": { + description: "China (Beijing)" + }, + "cn-northwest-1": { + description: "China (Ningxia)" + } + } + }, { + id: "aws-us-gov", + outputs: { + dnsSuffix: "amazonaws.com", + dualStackDnsSuffix: "api.aws", + implicitGlobalRegion: "us-gov-west-1", + name: "aws-us-gov", + supportsDualStack: true, + supportsFIPS: true + }, + regionRegex: "^us\\-gov\\-\\w+\\-\\d+$", + regions: { + "aws-us-gov-global": { + description: "AWS GovCloud (US) global region" + }, + "us-gov-east-1": { + description: "AWS GovCloud (US-East)" + }, + "us-gov-west-1": { + description: "AWS GovCloud (US-West)" + } + } + }, { + id: "aws-iso", + outputs: { + dnsSuffix: "c2s.ic.gov", + dualStackDnsSuffix: "c2s.ic.gov", + implicitGlobalRegion: "us-iso-east-1", + name: "aws-iso", + supportsDualStack: false, + supportsFIPS: true + }, + regionRegex: "^us\\-iso\\-\\w+\\-\\d+$", + regions: { + "aws-iso-global": { + description: "AWS ISO (US) global region" + }, + "us-iso-east-1": { + description: "US ISO East" + }, + "us-iso-west-1": { + description: "US ISO WEST" + } + } + }, { + id: "aws-iso-b", + outputs: { + dnsSuffix: "sc2s.sgov.gov", + dualStackDnsSuffix: "sc2s.sgov.gov", + implicitGlobalRegion: "us-isob-east-1", + name: "aws-iso-b", + supportsDualStack: false, + supportsFIPS: true + }, + regionRegex: "^us\\-isob\\-\\w+\\-\\d+$", + regions: { + "aws-iso-b-global": { + description: "AWS ISOB (US) global region" + }, + "us-isob-east-1": { + description: "US ISOB East (Ohio)" + } + } + }, { + id: "aws-iso-e", + outputs: { + dnsSuffix: "cloud.adc-e.uk", + dualStackDnsSuffix: "cloud.adc-e.uk", + implicitGlobalRegion: "eu-isoe-west-1", + name: "aws-iso-e", + supportsDualStack: false, + supportsFIPS: true + }, + regionRegex: "^eu\\-isoe\\-\\w+\\-\\d+$", + regions: { + "eu-isoe-west-1": { + description: "EU ISOE West" + } + } + }, { + id: "aws-iso-f", + outputs: { + dnsSuffix: "csp.hci.ic.gov", + dualStackDnsSuffix: "csp.hci.ic.gov", + implicitGlobalRegion: "us-isof-south-1", + name: "aws-iso-f", + supportsDualStack: false, + supportsFIPS: true + }, + regionRegex: "^us\\-isof\\-\\w+\\-\\d+$", + regions: {} + }], + version: "1.1" + }; + var selectedPartitionsInfo = partitions_default; + var selectedUserAgentPrefix = ""; + var partition = /* @__PURE__ */ __name((value) => { + const { partitions } = selectedPartitionsInfo; + for (const partition2 of partitions) { + const { regions, outputs } = partition2; + for (const [region, regionData] of Object.entries(regions)) { + if (region === value) { + return { + ...outputs, + ...regionData + }; + } + } + } + for (const partition2 of partitions) { + const { regionRegex, outputs } = partition2; + if (new RegExp(regionRegex).test(value)) { + return { + ...outputs + }; + } + } + const DEFAULT_PARTITION = partitions.find((partition2) => partition2.id === "aws"); + if (!DEFAULT_PARTITION) { + throw new Error( + "Provided region was not found in the partition array or regex, and default partition with id 'aws' doesn't exist." + ); + } + return { + ...DEFAULT_PARTITION.outputs + }; + }, "partition"); + var setPartitionInfo = /* @__PURE__ */ __name((partitionsInfo, userAgentPrefix = "") => { + selectedPartitionsInfo = partitionsInfo; + selectedUserAgentPrefix = userAgentPrefix; + }, "setPartitionInfo"); + var useDefaultPartitionInfo = /* @__PURE__ */ __name(() => { + setPartitionInfo(partitions_default, ""); + }, "useDefaultPartitionInfo"); + var getUserAgentPrefix = /* @__PURE__ */ __name(() => selectedUserAgentPrefix, "getUserAgentPrefix"); + var awsEndpointFunctions = { + isVirtualHostableS3Bucket, + parseArn, + partition + }; + import_util_endpoints.customEndpointFunctions.aws = awsEndpointFunctions; } }); -// ../../../node_modules/@smithy/signature-v4/dist-cjs/index.js -var require_dist_cjs13 = __commonJS({ - "../../../node_modules/@smithy/signature-v4/dist-cjs/index.js"(exports2, module2) { +// ../../../node_modules/@aws-sdk/middleware-user-agent/dist-cjs/index.js +var require_dist_cjs8 = __commonJS({ + "../../../node_modules/@aws-sdk/middleware-user-agent/dist-cjs/index.js"(exports2, module2) { + "use strict"; var __defProp2 = Object.defineProperty; var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; var __getOwnPropNames2 = Object.getOwnPropertyNames; @@ -2221,2442 +2243,1766 @@ var require_dist_cjs13 = __commonJS({ var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); var src_exports = {}; __export2(src_exports, { - SignatureV4: () => SignatureV4, - clearCredentialCache: () => clearCredentialCache, - createScope: () => createScope, - getCanonicalHeaders: () => getCanonicalHeaders, - getCanonicalQuery: () => getCanonicalQuery, - getPayloadHash: () => getPayloadHash, - getSigningKey: () => getSigningKey, - moveHeadersToQuery: () => moveHeadersToQuery, - prepareRequest: () => prepareRequest + getUserAgentMiddlewareOptions: () => getUserAgentMiddlewareOptions, + getUserAgentPlugin: () => getUserAgentPlugin, + resolveUserAgentConfig: () => resolveUserAgentConfig, + userAgentMiddleware: () => userAgentMiddleware }); module2.exports = __toCommonJS2(src_exports); - var import_util_middleware = require_dist_cjs7(); - var import_util_utf84 = require_dist_cjs10(); - var ALGORITHM_QUERY_PARAM = "X-Amz-Algorithm"; - var CREDENTIAL_QUERY_PARAM = "X-Amz-Credential"; - var AMZ_DATE_QUERY_PARAM = "X-Amz-Date"; - var SIGNED_HEADERS_QUERY_PARAM = "X-Amz-SignedHeaders"; - var EXPIRES_QUERY_PARAM = "X-Amz-Expires"; - var SIGNATURE_QUERY_PARAM = "X-Amz-Signature"; - var TOKEN_QUERY_PARAM = "X-Amz-Security-Token"; - var AUTH_HEADER = "authorization"; - var AMZ_DATE_HEADER = AMZ_DATE_QUERY_PARAM.toLowerCase(); - var DATE_HEADER = "date"; - var GENERATED_HEADERS = [AUTH_HEADER, AMZ_DATE_HEADER, DATE_HEADER]; - var SIGNATURE_HEADER = SIGNATURE_QUERY_PARAM.toLowerCase(); - var SHA256_HEADER = "x-amz-content-sha256"; - var TOKEN_HEADER = TOKEN_QUERY_PARAM.toLowerCase(); - var ALWAYS_UNSIGNABLE_HEADERS = { - authorization: true, - "cache-control": true, - connection: true, - expect: true, - from: true, - "keep-alive": true, - "max-forwards": true, - pragma: true, - referer: true, - te: true, - trailer: true, - "transfer-encoding": true, - upgrade: true, - "user-agent": true, - "x-amzn-trace-id": true - }; - var PROXY_HEADER_PATTERN = /^proxy-/; - var SEC_HEADER_PATTERN = /^sec-/; - var ALGORITHM_IDENTIFIER = "AWS4-HMAC-SHA256"; - var EVENT_ALGORITHM_IDENTIFIER = "AWS4-HMAC-SHA256-PAYLOAD"; - var UNSIGNED_PAYLOAD = "UNSIGNED-PAYLOAD"; - var MAX_CACHE_SIZE = 50; - var KEY_TYPE_IDENTIFIER = "aws4_request"; - var MAX_PRESIGNED_TTL = 60 * 60 * 24 * 7; - var import_util_hex_encoding = require_dist_cjs11(); - var import_util_utf8 = require_dist_cjs10(); - var signingKeyCache = {}; - var cacheQueue = []; - var createScope = /* @__PURE__ */ __name((shortDate, region, service) => `${shortDate}/${region}/${service}/${KEY_TYPE_IDENTIFIER}`, "createScope"); - var getSigningKey = /* @__PURE__ */ __name(async (sha256Constructor, credentials, shortDate, region, service) => { - const credsHash = await hmac(sha256Constructor, credentials.secretAccessKey, credentials.accessKeyId); - const cacheKey = `${shortDate}:${region}:${service}:${(0, import_util_hex_encoding.toHex)(credsHash)}:${credentials.sessionToken}`; - if (cacheKey in signingKeyCache) { - return signingKeyCache[cacheKey]; - } - cacheQueue.push(cacheKey); - while (cacheQueue.length > MAX_CACHE_SIZE) { - delete signingKeyCache[cacheQueue.shift()]; - } - let key = `AWS4${credentials.secretAccessKey}`; - for (const signable of [shortDate, region, service, KEY_TYPE_IDENTIFIER]) { - key = await hmac(sha256Constructor, key, signable); + function resolveUserAgentConfig(input) { + return { + ...input, + customUserAgent: typeof input.customUserAgent === "string" ? [[input.customUserAgent]] : input.customUserAgent + }; + } + __name(resolveUserAgentConfig, "resolveUserAgentConfig"); + var import_util_endpoints = require_dist_cjs7(); + var import_protocol_http8 = require_dist_cjs2(); + var USER_AGENT = "user-agent"; + var X_AMZ_USER_AGENT = "x-amz-user-agent"; + var SPACE = " "; + var UA_NAME_SEPARATOR = "/"; + var UA_NAME_ESCAPE_REGEX = /[^\!\$\%\&\'\*\+\-\.\^\_\`\|\~\d\w]/g; + var UA_VALUE_ESCAPE_REGEX = /[^\!\$\%\&\'\*\+\-\.\^\_\`\|\~\d\w\#]/g; + var UA_ESCAPE_CHAR = "-"; + var userAgentMiddleware = /* @__PURE__ */ __name((options) => (next, context) => async (args) => { + var _a, _b; + const { request: request2 } = args; + if (!import_protocol_http8.HttpRequest.isInstance(request2)) + return next(args); + const { headers } = request2; + const userAgent = ((_a = context == null ? void 0 : context.userAgent) == null ? void 0 : _a.map(escapeUserAgent)) || []; + const defaultUserAgent = (await options.defaultUserAgentProvider()).map(escapeUserAgent); + const customUserAgent = ((_b = options == null ? void 0 : options.customUserAgent) == null ? void 0 : _b.map(escapeUserAgent)) || []; + const prefix = (0, import_util_endpoints.getUserAgentPrefix)(); + const sdkUserAgentValue = (prefix ? [prefix] : []).concat([...defaultUserAgent, ...userAgent, ...customUserAgent]).join(SPACE); + const normalUAValue = [ + ...defaultUserAgent.filter((section) => section.startsWith("aws-sdk-")), + ...customUserAgent + ].join(SPACE); + if (options.runtime !== "browser") { + if (normalUAValue) { + headers[X_AMZ_USER_AGENT] = headers[X_AMZ_USER_AGENT] ? `${headers[USER_AGENT]} ${normalUAValue}` : normalUAValue; + } + headers[USER_AGENT] = sdkUserAgentValue; + } else { + headers[X_AMZ_USER_AGENT] = sdkUserAgentValue; } - return signingKeyCache[cacheKey] = key; - }, "getSigningKey"); - var clearCredentialCache = /* @__PURE__ */ __name(() => { - cacheQueue.length = 0; - Object.keys(signingKeyCache).forEach((cacheKey) => { - delete signingKeyCache[cacheKey]; + return next({ + ...args, + request: request2 }); - }, "clearCredentialCache"); - var hmac = /* @__PURE__ */ __name((ctor, secret, data) => { - const hash = new ctor(secret); - hash.update((0, import_util_utf8.toUint8Array)(data)); - return hash.digest(); - }, "hmac"); - var getCanonicalHeaders = /* @__PURE__ */ __name(({ headers }, unsignableHeaders, signableHeaders) => { - const canonical = {}; - for (const headerName of Object.keys(headers).sort()) { - if (headers[headerName] == void 0) { - continue; - } - const canonicalHeaderName = headerName.toLowerCase(); - if (canonicalHeaderName in ALWAYS_UNSIGNABLE_HEADERS || (unsignableHeaders == null ? void 0 : unsignableHeaders.has(canonicalHeaderName)) || PROXY_HEADER_PATTERN.test(canonicalHeaderName) || SEC_HEADER_PATTERN.test(canonicalHeaderName)) { - if (!signableHeaders || signableHeaders && !signableHeaders.has(canonicalHeaderName)) { - continue; - } - } - canonical[canonicalHeaderName] = headers[headerName].trim().replace(/\s+/g, " "); + }, "userAgentMiddleware"); + var escapeUserAgent = /* @__PURE__ */ __name((userAgentPair) => { + var _a; + const name = userAgentPair[0].split(UA_NAME_SEPARATOR).map((part) => part.replace(UA_NAME_ESCAPE_REGEX, UA_ESCAPE_CHAR)).join(UA_NAME_SEPARATOR); + const version2 = (_a = userAgentPair[1]) == null ? void 0 : _a.replace(UA_VALUE_ESCAPE_REGEX, UA_ESCAPE_CHAR); + const prefixSeparatorIndex = name.indexOf(UA_NAME_SEPARATOR); + const prefix = name.substring(0, prefixSeparatorIndex); + let uaName = name.substring(prefixSeparatorIndex + 1); + if (prefix === "api") { + uaName = uaName.toLowerCase(); } - return canonical; - }, "getCanonicalHeaders"); - var import_util_uri_escape = require_dist_cjs12(); - var getCanonicalQuery = /* @__PURE__ */ __name(({ query = {} }) => { - const keys = []; - const serialized = {}; - for (const key of Object.keys(query).sort()) { - if (key.toLowerCase() === SIGNATURE_HEADER) { - continue; - } - keys.push(key); - const value = query[key]; - if (typeof value === "string") { - serialized[key] = `${(0, import_util_uri_escape.escapeUri)(key)}=${(0, import_util_uri_escape.escapeUri)(value)}`; - } else if (Array.isArray(value)) { - serialized[key] = value.slice(0).reduce( - (encoded, value2) => encoded.concat([`${(0, import_util_uri_escape.escapeUri)(key)}=${(0, import_util_uri_escape.escapeUri)(value2)}`]), - [] - ).sort().join("&"); + return [prefix, uaName, version2].filter((item) => item && item.length > 0).reduce((acc, item, index) => { + switch (index) { + case 0: + return item; + case 1: + return `${acc}/${item}`; + default: + return `${acc}#${item}`; } + }, ""); + }, "escapeUserAgent"); + var getUserAgentMiddlewareOptions = { + name: "getUserAgentMiddleware", + step: "build", + priority: "low", + tags: ["SET_USER_AGENT", "USER_AGENT"], + override: true + }; + var getUserAgentPlugin = /* @__PURE__ */ __name((config) => ({ + applyToStack: (clientStack) => { + clientStack.add(userAgentMiddleware(config), getUserAgentMiddlewareOptions); } - return keys.map((key) => serialized[key]).filter((serialized2) => serialized2).join("&"); - }, "getCanonicalQuery"); - var import_is_array_buffer = require_dist_cjs8(); - var import_util_utf82 = require_dist_cjs10(); - var getPayloadHash = /* @__PURE__ */ __name(async ({ headers, body }, hashConstructor) => { - for (const headerName of Object.keys(headers)) { - if (headerName.toLowerCase() === SHA256_HEADER) { - return headers[headerName]; - } + }), "getUserAgentPlugin"); + } +}); + +// ../../../node_modules/@smithy/util-config-provider/dist-cjs/index.js +var require_dist_cjs9 = __commonJS({ + "../../../node_modules/@smithy/util-config-provider/dist-cjs/index.js"(exports2, module2) { + var __defProp2 = Object.defineProperty; + var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; + var __getOwnPropNames2 = Object.getOwnPropertyNames; + var __hasOwnProp2 = Object.prototype.hasOwnProperty; + var __name = (target, value) => __defProp2(target, "name", { value, configurable: true }); + var __export2 = (target, all) => { + for (var name in all) + __defProp2(target, name, { get: all[name], enumerable: true }); + }; + var __copyProps2 = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames2(from)) + if (!__hasOwnProp2.call(to, key) && key !== except) + __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable }); } - if (body == void 0) { - return "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"; - } else if (typeof body === "string" || ArrayBuffer.isView(body) || (0, import_is_array_buffer.isArrayBuffer)(body)) { - const hashCtor = new hashConstructor(); - hashCtor.update((0, import_util_utf82.toUint8Array)(body)); - return (0, import_util_hex_encoding.toHex)(await hashCtor.digest()); + return to; + }; + var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); + var src_exports = {}; + __export2(src_exports, { + SelectorType: () => SelectorType, + booleanSelector: () => booleanSelector, + numberSelector: () => numberSelector + }); + module2.exports = __toCommonJS2(src_exports); + var booleanSelector = /* @__PURE__ */ __name((obj, key, type) => { + if (!(key in obj)) + return void 0; + if (obj[key] === "true") + return true; + if (obj[key] === "false") + return false; + throw new Error(`Cannot load ${type} "${key}". Expected "true" or "false", got ${obj[key]}.`); + }, "booleanSelector"); + var numberSelector = /* @__PURE__ */ __name((obj, key, type) => { + if (!(key in obj)) + return void 0; + const numberValue = parseInt(obj[key], 10); + if (Number.isNaN(numberValue)) { + throw new TypeError(`Cannot load ${type} '${key}'. Expected number, got '${obj[key]}'.`); } - return UNSIGNED_PAYLOAD; - }, "getPayloadHash"); - var import_util_utf83 = require_dist_cjs10(); - var _HeaderFormatter = class _HeaderFormatter { - format(headers) { - const chunks = []; - for (const headerName of Object.keys(headers)) { - const bytes = (0, import_util_utf83.fromUtf8)(headerName); - chunks.push(Uint8Array.from([bytes.byteLength]), bytes, this.formatHeaderValue(headers[headerName])); - } - const out = new Uint8Array(chunks.reduce((carry, bytes) => carry + bytes.byteLength, 0)); - let position = 0; - for (const chunk of chunks) { - out.set(chunk, position); - position += chunk.byteLength; - } - return out; + return numberValue; + }, "numberSelector"); + var SelectorType = /* @__PURE__ */ ((SelectorType2) => { + SelectorType2["ENV"] = "env"; + SelectorType2["CONFIG"] = "shared config entry"; + return SelectorType2; + })(SelectorType || {}); + } +}); + +// ../../../node_modules/@smithy/util-middleware/dist-cjs/index.js +var require_dist_cjs10 = __commonJS({ + "../../../node_modules/@smithy/util-middleware/dist-cjs/index.js"(exports2, module2) { + var __defProp2 = Object.defineProperty; + var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; + var __getOwnPropNames2 = Object.getOwnPropertyNames; + var __hasOwnProp2 = Object.prototype.hasOwnProperty; + var __name = (target, value) => __defProp2(target, "name", { value, configurable: true }); + var __export2 = (target, all) => { + for (var name in all) + __defProp2(target, name, { get: all[name], enumerable: true }); + }; + var __copyProps2 = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames2(from)) + if (!__hasOwnProp2.call(to, key) && key !== except) + __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable }); } - formatHeaderValue(header) { - switch (header.type) { - case "boolean": - return Uint8Array.from([ - header.value ? 0 : 1 - /* boolFalse */ - ]); - case "byte": - return Uint8Array.from([2, header.value]); - case "short": - const shortView = new DataView(new ArrayBuffer(3)); - shortView.setUint8( - 0, - 3 - /* short */ - ); - shortView.setInt16(1, header.value, false); - return new Uint8Array(shortView.buffer); - case "integer": - const intView = new DataView(new ArrayBuffer(5)); - intView.setUint8( - 0, - 4 - /* integer */ - ); - intView.setInt32(1, header.value, false); - return new Uint8Array(intView.buffer); - case "long": - const longBytes = new Uint8Array(9); - longBytes[0] = 5; - longBytes.set(header.value.bytes, 1); - return longBytes; - case "binary": - const binView = new DataView(new ArrayBuffer(3 + header.value.byteLength)); - binView.setUint8( - 0, - 6 - /* byteArray */ - ); - binView.setUint16(1, header.value.byteLength, false); - const binBytes = new Uint8Array(binView.buffer); - binBytes.set(header.value, 3); - return binBytes; - case "string": - const utf8Bytes = (0, import_util_utf83.fromUtf8)(header.value); - const strView = new DataView(new ArrayBuffer(3 + utf8Bytes.byteLength)); - strView.setUint8( - 0, - 7 - /* string */ - ); - strView.setUint16(1, utf8Bytes.byteLength, false); - const strBytes = new Uint8Array(strView.buffer); - strBytes.set(utf8Bytes, 3); - return strBytes; - case "timestamp": - const tsBytes = new Uint8Array(9); - tsBytes[0] = 8; - tsBytes.set(Int64.fromNumber(header.value.valueOf()).bytes, 1); - return tsBytes; - case "uuid": - if (!UUID_PATTERN.test(header.value)) { - throw new Error(`Invalid UUID received: ${header.value}`); - } - const uuidBytes = new Uint8Array(17); - uuidBytes[0] = 9; - uuidBytes.set((0, import_util_hex_encoding.fromHex)(header.value.replace(/\-/g, "")), 1); - return uuidBytes; - } + return to; + }; + var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); + var src_exports = {}; + __export2(src_exports, { + getSmithyContext: () => getSmithyContext4, + normalizeProvider: () => normalizeProvider2 + }); + module2.exports = __toCommonJS2(src_exports); + var import_types5 = require_dist_cjs(); + var getSmithyContext4 = /* @__PURE__ */ __name((context) => context[import_types5.SMITHY_CONTEXT_KEY] || (context[import_types5.SMITHY_CONTEXT_KEY] = {}), "getSmithyContext"); + var normalizeProvider2 = /* @__PURE__ */ __name((input) => { + if (typeof input === "function") + return input; + const promisified = Promise.resolve(input); + return () => promisified; + }, "normalizeProvider"); + } +}); + +// ../../../node_modules/@smithy/config-resolver/dist-cjs/index.js +var require_dist_cjs11 = __commonJS({ + "../../../node_modules/@smithy/config-resolver/dist-cjs/index.js"(exports2, module2) { + var __defProp2 = Object.defineProperty; + var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; + var __getOwnPropNames2 = Object.getOwnPropertyNames; + var __hasOwnProp2 = Object.prototype.hasOwnProperty; + var __name = (target, value) => __defProp2(target, "name", { value, configurable: true }); + var __export2 = (target, all) => { + for (var name in all) + __defProp2(target, name, { get: all[name], enumerable: true }); + }; + var __copyProps2 = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames2(from)) + if (!__hasOwnProp2.call(to, key) && key !== except) + __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable }); } + return to; }; - __name(_HeaderFormatter, "HeaderFormatter"); - var HeaderFormatter = _HeaderFormatter; - var UUID_PATTERN = /^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/; - var _Int64 = class _Int642 { - constructor(bytes) { - this.bytes = bytes; - if (bytes.byteLength !== 8) { - throw new Error("Int64 buffers must be exactly 8 bytes"); - } - } - static fromNumber(number) { - if (number > 9223372036854776e3 || number < -9223372036854776e3) { - throw new Error(`${number} is too large (or, if negative, too small) to represent as an Int64`); - } - const bytes = new Uint8Array(8); - for (let i = 7, remaining = Math.abs(Math.round(number)); i > -1 && remaining > 0; i--, remaining /= 256) { - bytes[i] = remaining; - } - if (number < 0) { - negate(bytes); - } - return new _Int642(bytes); + var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); + var src_exports = {}; + __export2(src_exports, { + CONFIG_USE_DUALSTACK_ENDPOINT: () => CONFIG_USE_DUALSTACK_ENDPOINT, + CONFIG_USE_FIPS_ENDPOINT: () => CONFIG_USE_FIPS_ENDPOINT, + DEFAULT_USE_DUALSTACK_ENDPOINT: () => DEFAULT_USE_DUALSTACK_ENDPOINT, + DEFAULT_USE_FIPS_ENDPOINT: () => DEFAULT_USE_FIPS_ENDPOINT, + ENV_USE_DUALSTACK_ENDPOINT: () => ENV_USE_DUALSTACK_ENDPOINT, + ENV_USE_FIPS_ENDPOINT: () => ENV_USE_FIPS_ENDPOINT, + NODE_REGION_CONFIG_FILE_OPTIONS: () => NODE_REGION_CONFIG_FILE_OPTIONS, + NODE_REGION_CONFIG_OPTIONS: () => NODE_REGION_CONFIG_OPTIONS, + NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS: () => NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS, + NODE_USE_FIPS_ENDPOINT_CONFIG_OPTIONS: () => NODE_USE_FIPS_ENDPOINT_CONFIG_OPTIONS, + REGION_ENV_NAME: () => REGION_ENV_NAME, + REGION_INI_NAME: () => REGION_INI_NAME, + getRegionInfo: () => getRegionInfo, + resolveCustomEndpointsConfig: () => resolveCustomEndpointsConfig, + resolveEndpointsConfig: () => resolveEndpointsConfig, + resolveRegionConfig: () => resolveRegionConfig + }); + module2.exports = __toCommonJS2(src_exports); + var import_util_config_provider = require_dist_cjs9(); + var ENV_USE_DUALSTACK_ENDPOINT = "AWS_USE_DUALSTACK_ENDPOINT"; + var CONFIG_USE_DUALSTACK_ENDPOINT = "use_dualstack_endpoint"; + var DEFAULT_USE_DUALSTACK_ENDPOINT = false; + var NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS = { + environmentVariableSelector: (env) => (0, import_util_config_provider.booleanSelector)(env, ENV_USE_DUALSTACK_ENDPOINT, import_util_config_provider.SelectorType.ENV), + configFileSelector: (profile) => (0, import_util_config_provider.booleanSelector)(profile, CONFIG_USE_DUALSTACK_ENDPOINT, import_util_config_provider.SelectorType.CONFIG), + default: false + }; + var ENV_USE_FIPS_ENDPOINT = "AWS_USE_FIPS_ENDPOINT"; + var CONFIG_USE_FIPS_ENDPOINT = "use_fips_endpoint"; + var DEFAULT_USE_FIPS_ENDPOINT = false; + var NODE_USE_FIPS_ENDPOINT_CONFIG_OPTIONS = { + environmentVariableSelector: (env) => (0, import_util_config_provider.booleanSelector)(env, ENV_USE_FIPS_ENDPOINT, import_util_config_provider.SelectorType.ENV), + configFileSelector: (profile) => (0, import_util_config_provider.booleanSelector)(profile, CONFIG_USE_FIPS_ENDPOINT, import_util_config_provider.SelectorType.CONFIG), + default: false + }; + var import_util_middleware3 = require_dist_cjs10(); + var resolveCustomEndpointsConfig = /* @__PURE__ */ __name((input) => { + const { endpoint, urlParser } = input; + return { + ...input, + tls: input.tls ?? true, + endpoint: (0, import_util_middleware3.normalizeProvider)(typeof endpoint === "string" ? urlParser(endpoint) : endpoint), + isCustomEndpoint: true, + useDualstackEndpoint: (0, import_util_middleware3.normalizeProvider)(input.useDualstackEndpoint ?? false) + }; + }, "resolveCustomEndpointsConfig"); + var getEndpointFromRegion = /* @__PURE__ */ __name(async (input) => { + const { tls = true } = input; + const region = await input.region(); + const dnsHostRegex = new RegExp(/^([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9-]{0,61}[a-zA-Z0-9])$/); + if (!dnsHostRegex.test(region)) { + throw new Error("Invalid region in client config"); } - /** - * Called implicitly by infix arithmetic operators. - */ - valueOf() { - const bytes = this.bytes.slice(0); - const negative = bytes[0] & 128; - if (negative) { - negate(bytes); - } - return parseInt((0, import_util_hex_encoding.toHex)(bytes), 16) * (negative ? -1 : 1); + const useDualstackEndpoint = await input.useDualstackEndpoint(); + const useFipsEndpoint = await input.useFipsEndpoint(); + const { hostname } = await input.regionInfoProvider(region, { useDualstackEndpoint, useFipsEndpoint }) ?? {}; + if (!hostname) { + throw new Error("Cannot resolve hostname from client config"); } - toString() { - return String(this.valueOf()); + return input.urlParser(`${tls ? "https:" : "http:"}//${hostname}`); + }, "getEndpointFromRegion"); + var resolveEndpointsConfig = /* @__PURE__ */ __name((input) => { + const useDualstackEndpoint = (0, import_util_middleware3.normalizeProvider)(input.useDualstackEndpoint ?? false); + const { endpoint, useFipsEndpoint, urlParser } = input; + return { + ...input, + tls: input.tls ?? true, + endpoint: endpoint ? (0, import_util_middleware3.normalizeProvider)(typeof endpoint === "string" ? urlParser(endpoint) : endpoint) : () => getEndpointFromRegion({ ...input, useDualstackEndpoint, useFipsEndpoint }), + isCustomEndpoint: !!endpoint, + useDualstackEndpoint + }; + }, "resolveEndpointsConfig"); + var REGION_ENV_NAME = "AWS_REGION"; + var REGION_INI_NAME = "region"; + var NODE_REGION_CONFIG_OPTIONS = { + environmentVariableSelector: (env) => env[REGION_ENV_NAME], + configFileSelector: (profile) => profile[REGION_INI_NAME], + default: () => { + throw new Error("Region is missing"); } }; - __name(_Int64, "Int64"); - var Int64 = _Int64; - function negate(bytes) { - for (let i = 0; i < 8; i++) { - bytes[i] ^= 255; - } - for (let i = 7; i > -1; i--) { - bytes[i]++; - if (bytes[i] !== 0) - break; - } - } - __name(negate, "negate"); - var hasHeader = /* @__PURE__ */ __name((soughtHeader, headers) => { - soughtHeader = soughtHeader.toLowerCase(); - for (const headerName of Object.keys(headers)) { - if (soughtHeader === headerName.toLowerCase()) { - return true; - } + var NODE_REGION_CONFIG_FILE_OPTIONS = { + preferredFile: "credentials" + }; + var isFipsRegion = /* @__PURE__ */ __name((region) => typeof region === "string" && (region.startsWith("fips-") || region.endsWith("-fips")), "isFipsRegion"); + var getRealRegion = /* @__PURE__ */ __name((region) => isFipsRegion(region) ? ["fips-aws-global", "aws-fips"].includes(region) ? "us-east-1" : region.replace(/fips-(dkr-|prod-)?|-fips/, "") : region, "getRealRegion"); + var resolveRegionConfig = /* @__PURE__ */ __name((input) => { + const { region, useFipsEndpoint } = input; + if (!region) { + throw new Error("Region is missing"); } - return false; - }, "hasHeader"); - var cloneRequest = /* @__PURE__ */ __name(({ headers, query, ...rest }) => ({ - ...rest, - headers: { ...headers }, - query: query ? cloneQuery(query) : void 0 - }), "cloneRequest"); - var cloneQuery = /* @__PURE__ */ __name((query) => Object.keys(query).reduce((carry, paramName) => { - const param = query[paramName]; return { - ...carry, - [paramName]: Array.isArray(param) ? [...param] : param + ...input, + region: async () => { + if (typeof region === "string") { + return getRealRegion(region); + } + const providedRegion = await region(); + return getRealRegion(providedRegion); + }, + useFipsEndpoint: async () => { + const providedRegion = typeof region === "string" ? region : await region(); + if (isFipsRegion(providedRegion)) { + return true; + } + return typeof useFipsEndpoint !== "function" ? Promise.resolve(!!useFipsEndpoint) : useFipsEndpoint(); + } }; - }, {}), "cloneQuery"); - var moveHeadersToQuery = /* @__PURE__ */ __name((request2, options = {}) => { + }, "resolveRegionConfig"); + var getHostnameFromVariants = /* @__PURE__ */ __name((variants = [], { useFipsEndpoint, useDualstackEndpoint }) => { var _a; - const { headers, query = {} } = typeof request2.clone === "function" ? request2.clone() : cloneRequest(request2); - for (const name of Object.keys(headers)) { - const lname = name.toLowerCase(); - if (lname.slice(0, 6) === "x-amz-" && !((_a = options.unhoistableHeaders) == null ? void 0 : _a.has(lname))) { - query[name] = headers[name]; - delete headers[name]; + return (_a = variants.find( + ({ tags }) => useFipsEndpoint === tags.includes("fips") && useDualstackEndpoint === tags.includes("dualstack") + )) == null ? void 0 : _a.hostname; + }, "getHostnameFromVariants"); + var getResolvedHostname = /* @__PURE__ */ __name((resolvedRegion, { regionHostname, partitionHostname }) => regionHostname ? regionHostname : partitionHostname ? partitionHostname.replace("{region}", resolvedRegion) : void 0, "getResolvedHostname"); + var getResolvedPartition = /* @__PURE__ */ __name((region, { partitionHash }) => Object.keys(partitionHash || {}).find((key) => partitionHash[key].regions.includes(region)) ?? "aws", "getResolvedPartition"); + var getResolvedSigningRegion = /* @__PURE__ */ __name((hostname, { signingRegion, regionRegex, useFipsEndpoint }) => { + if (signingRegion) { + return signingRegion; + } else if (useFipsEndpoint) { + const regionRegexJs = regionRegex.replace("\\\\", "\\").replace(/^\^/g, "\\.").replace(/\$$/g, "\\."); + const regionRegexmatchArray = hostname.match(regionRegexJs); + if (regionRegexmatchArray) { + return regionRegexmatchArray[0].slice(1, -1); } } + }, "getResolvedSigningRegion"); + var getRegionInfo = /* @__PURE__ */ __name((region, { + useFipsEndpoint = false, + useDualstackEndpoint = false, + signingService, + regionHash, + partitionHash + }) => { + var _a, _b, _c, _d, _e; + const partition = getResolvedPartition(region, { partitionHash }); + const resolvedRegion = region in regionHash ? region : ((_a = partitionHash[partition]) == null ? void 0 : _a.endpoint) ?? region; + const hostnameOptions = { useFipsEndpoint, useDualstackEndpoint }; + const regionHostname = getHostnameFromVariants((_b = regionHash[resolvedRegion]) == null ? void 0 : _b.variants, hostnameOptions); + const partitionHostname = getHostnameFromVariants((_c = partitionHash[partition]) == null ? void 0 : _c.variants, hostnameOptions); + const hostname = getResolvedHostname(resolvedRegion, { regionHostname, partitionHostname }); + if (hostname === void 0) { + throw new Error(`Endpoint resolution failed for: ${{ resolvedRegion, useFipsEndpoint, useDualstackEndpoint }}`); + } + const signingRegion = getResolvedSigningRegion(hostname, { + signingRegion: (_d = regionHash[resolvedRegion]) == null ? void 0 : _d.signingRegion, + regionRegex: partitionHash[partition].regionRegex, + useFipsEndpoint + }); return { - ...request2, - headers, - query + partition, + signingService, + hostname, + ...signingRegion && { signingRegion }, + ...((_e = regionHash[resolvedRegion]) == null ? void 0 : _e.signingService) && { + signingService: regionHash[resolvedRegion].signingService + } }; - }, "moveHeadersToQuery"); - var prepareRequest = /* @__PURE__ */ __name((request2) => { - request2 = typeof request2.clone === "function" ? request2.clone() : cloneRequest(request2); - for (const headerName of Object.keys(request2.headers)) { - if (GENERATED_HEADERS.indexOf(headerName.toLowerCase()) > -1) { - delete request2.headers[headerName]; + }, "getRegionInfo"); + } +}); + +// ../../../node_modules/@smithy/core/node_modules/@smithy/util-middleware/dist-cjs/index.js +var require_dist_cjs12 = __commonJS({ + "../../../node_modules/@smithy/core/node_modules/@smithy/util-middleware/dist-cjs/index.js"(exports2, module2) { + var __defProp2 = Object.defineProperty; + var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; + var __getOwnPropNames2 = Object.getOwnPropertyNames; + var __hasOwnProp2 = Object.prototype.hasOwnProperty; + var __name = (target, value) => __defProp2(target, "name", { value, configurable: true }); + var __export2 = (target, all) => { + for (var name in all) + __defProp2(target, name, { get: all[name], enumerable: true }); + }; + var __copyProps2 = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames2(from)) + if (!__hasOwnProp2.call(to, key) && key !== except) + __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable }); + } + return to; + }; + var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); + var src_exports = {}; + __export2(src_exports, { + getSmithyContext: () => getSmithyContext4, + normalizeProvider: () => normalizeProvider2 + }); + module2.exports = __toCommonJS2(src_exports); + var import_types5 = require_dist_cjs(); + var getSmithyContext4 = /* @__PURE__ */ __name((context) => context[import_types5.SMITHY_CONTEXT_KEY] || (context[import_types5.SMITHY_CONTEXT_KEY] = {}), "getSmithyContext"); + var normalizeProvider2 = /* @__PURE__ */ __name((input) => { + if (typeof input === "function") + return input; + const promisified = Promise.resolve(input); + return () => promisified; + }, "normalizeProvider"); + } +}); + +// ../../../node_modules/@smithy/core/dist-es/middleware-http-auth-scheme/httpAuthSchemeMiddleware.js +function convertHttpAuthSchemesToMap(httpAuthSchemes) { + const map = /* @__PURE__ */ new Map(); + for (const scheme of httpAuthSchemes) { + map.set(scheme.schemeId, scheme); + } + return map; +} +var import_types, import_util_middleware, httpAuthSchemeMiddleware; +var init_httpAuthSchemeMiddleware = __esm({ + "../../../node_modules/@smithy/core/dist-es/middleware-http-auth-scheme/httpAuthSchemeMiddleware.js"() { + import_types = __toESM(require_dist_cjs()); + import_util_middleware = __toESM(require_dist_cjs12()); + httpAuthSchemeMiddleware = (config, mwOptions) => (next, context) => async (args) => { + const options = config.httpAuthSchemeProvider(await mwOptions.httpAuthSchemeParametersProvider(config, context, args.input)); + const authSchemes = convertHttpAuthSchemesToMap(config.httpAuthSchemes); + const smithyContext = (0, import_util_middleware.getSmithyContext)(context); + const failureReasons = []; + for (const option of options) { + const scheme = authSchemes.get(option.schemeId); + if (!scheme) { + failureReasons.push(`HttpAuthScheme \`${option.schemeId}\` was not enabled for this service.`); + continue; + } + const identityProvider = scheme.identityProvider(await mwOptions.identityProviderConfigProvider(config)); + if (!identityProvider) { + failureReasons.push(`HttpAuthScheme \`${option.schemeId}\` did not have an IdentityProvider configured.`); + continue; } + const { identityProperties = {}, signingProperties = {} } = option.propertiesExtractor?.(config, context) || {}; + option.identityProperties = Object.assign(option.identityProperties || {}, identityProperties); + option.signingProperties = Object.assign(option.signingProperties || {}, signingProperties); + smithyContext.selectedHttpAuthScheme = { + httpAuthOption: option, + identity: await identityProvider(option.identityProperties), + signer: scheme.signer + }; + break; } - return request2; - }, "prepareRequest"); - var iso8601 = /* @__PURE__ */ __name((time) => toDate(time).toISOString().replace(/\.\d{3}Z$/, "Z"), "iso8601"); - var toDate = /* @__PURE__ */ __name((time) => { - if (typeof time === "number") { - return new Date(time * 1e3); + if (!smithyContext.selectedHttpAuthScheme) { + throw new Error(failureReasons.join("\n")); } - if (typeof time === "string") { - if (Number(time)) { - return new Date(Number(time) * 1e3); + return next(args); + }; + } +}); + +// ../../../node_modules/@smithy/core/node_modules/@smithy/property-provider/dist-cjs/index.js +var require_dist_cjs13 = __commonJS({ + "../../../node_modules/@smithy/core/node_modules/@smithy/property-provider/dist-cjs/index.js"(exports2, module2) { + var __defProp2 = Object.defineProperty; + var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; + var __getOwnPropNames2 = Object.getOwnPropertyNames; + var __hasOwnProp2 = Object.prototype.hasOwnProperty; + var __name = (target, value) => __defProp2(target, "name", { value, configurable: true }); + var __export2 = (target, all) => { + for (var name in all) + __defProp2(target, name, { get: all[name], enumerable: true }); + }; + var __copyProps2 = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames2(from)) + if (!__hasOwnProp2.call(to, key) && key !== except) + __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable }); + } + return to; + }; + var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); + var src_exports = {}; + __export2(src_exports, { + CredentialsProviderError: () => CredentialsProviderError, + ProviderError: () => ProviderError2, + TokenProviderError: () => TokenProviderError, + chain: () => chain, + fromStatic: () => fromStatic, + memoize: () => memoize + }); + module2.exports = __toCommonJS2(src_exports); + var _ProviderError = class _ProviderError2 extends Error { + constructor(message, options = true) { + var _a; + let logger; + let tryNextLink = true; + if (typeof options === "boolean") { + logger = void 0; + tryNextLink = options; + } else if (options != null && typeof options === "object") { + logger = options.logger; + tryNextLink = options.tryNextLink ?? true; } - return new Date(time); + super(message); + this.name = "ProviderError"; + this.tryNextLink = tryNextLink; + Object.setPrototypeOf(this, _ProviderError2.prototype); + (_a = logger == null ? void 0 : logger.debug) == null ? void 0 : _a.call(logger, `@smithy/property-provider ${tryNextLink ? "->" : "(!)"} ${message}`); } - return time; - }, "toDate"); - var _SignatureV4 = class _SignatureV4 { - constructor({ - applyChecksum, - credentials, - region, - service, - sha256, - uriEscapePath = true - }) { - this.headerFormatter = new HeaderFormatter(); - this.service = service; - this.sha256 = sha256; - this.uriEscapePath = uriEscapePath; - this.applyChecksum = typeof applyChecksum === "boolean" ? applyChecksum : true; - this.regionProvider = (0, import_util_middleware.normalizeProvider)(region); - this.credentialProvider = (0, import_util_middleware.normalizeProvider)(credentials); + /** + * @deprecated use new operator. + */ + static from(error, options = true) { + return Object.assign(new this(error.message, options), error); } - async presign(originalRequest, options = {}) { - const { - signingDate = /* @__PURE__ */ new Date(), - expiresIn = 3600, - unsignableHeaders, - unhoistableHeaders, - signableHeaders, - signingRegion, - signingService - } = options; - const credentials = await this.credentialProvider(); - this.validateResolvedCredentials(credentials); - const region = signingRegion ?? await this.regionProvider(); - const { longDate, shortDate } = formatDate(signingDate); - if (expiresIn > MAX_PRESIGNED_TTL) { - return Promise.reject( - "Signature version 4 presigned URLs must have an expiration date less than one week in the future" - ); - } - const scope = createScope(shortDate, region, signingService ?? this.service); - const request2 = moveHeadersToQuery(prepareRequest(originalRequest), { unhoistableHeaders }); - if (credentials.sessionToken) { - request2.query[TOKEN_QUERY_PARAM] = credentials.sessionToken; - } - request2.query[ALGORITHM_QUERY_PARAM] = ALGORITHM_IDENTIFIER; - request2.query[CREDENTIAL_QUERY_PARAM] = `${credentials.accessKeyId}/${scope}`; - request2.query[AMZ_DATE_QUERY_PARAM] = longDate; - request2.query[EXPIRES_QUERY_PARAM] = expiresIn.toString(10); - const canonicalHeaders = getCanonicalHeaders(request2, unsignableHeaders, signableHeaders); - request2.query[SIGNED_HEADERS_QUERY_PARAM] = getCanonicalHeaderList(canonicalHeaders); - request2.query[SIGNATURE_QUERY_PARAM] = await this.getSignature( - longDate, - scope, - this.getSigningKey(credentials, region, shortDate, signingService), - this.createCanonicalRequest(request2, canonicalHeaders, await getPayloadHash(originalRequest, this.sha256)) - ); - return request2; + }; + __name(_ProviderError, "ProviderError"); + var ProviderError2 = _ProviderError; + var _CredentialsProviderError = class _CredentialsProviderError2 extends ProviderError2 { + /** + * @override + */ + constructor(message, options = true) { + super(message, options); + this.name = "CredentialsProviderError"; + Object.setPrototypeOf(this, _CredentialsProviderError2.prototype); } - async sign(toSign, options) { - if (typeof toSign === "string") { - return this.signString(toSign, options); - } else if (toSign.headers && toSign.payload) { - return this.signEvent(toSign, options); - } else if (toSign.message) { - return this.signMessage(toSign, options); - } else { - return this.signRequest(toSign, options); - } + }; + __name(_CredentialsProviderError, "CredentialsProviderError"); + var CredentialsProviderError = _CredentialsProviderError; + var _TokenProviderError = class _TokenProviderError2 extends ProviderError2 { + /** + * @override + */ + constructor(message, options = true) { + super(message, options); + this.name = "TokenProviderError"; + Object.setPrototypeOf(this, _TokenProviderError2.prototype); } - async signEvent({ headers, payload }, { signingDate = /* @__PURE__ */ new Date(), priorSignature, signingRegion, signingService }) { - const region = signingRegion ?? await this.regionProvider(); - const { shortDate, longDate } = formatDate(signingDate); - const scope = createScope(shortDate, region, signingService ?? this.service); - const hashedPayload = await getPayloadHash({ headers: {}, body: payload }, this.sha256); - const hash = new this.sha256(); - hash.update(headers); - const hashedHeaders = (0, import_util_hex_encoding.toHex)(await hash.digest()); - const stringToSign = [ - EVENT_ALGORITHM_IDENTIFIER, - longDate, - scope, - priorSignature, - hashedHeaders, - hashedPayload - ].join("\n"); - return this.signString(stringToSign, { signingDate, signingRegion: region, signingService }); + }; + __name(_TokenProviderError, "TokenProviderError"); + var TokenProviderError = _TokenProviderError; + var chain = /* @__PURE__ */ __name((...providers) => async () => { + if (providers.length === 0) { + throw new ProviderError2("No providers in chain"); } - async signMessage(signableMessage, { signingDate = /* @__PURE__ */ new Date(), signingRegion, signingService }) { - const promise = this.signEvent( - { - headers: this.headerFormatter.format(signableMessage.message.headers), - payload: signableMessage.message.body - }, - { - signingDate, - signingRegion, - signingService, - priorSignature: signableMessage.priorSignature + let lastProviderError; + for (const provider of providers) { + try { + const credentials = await provider(); + return credentials; + } catch (err) { + lastProviderError = err; + if (err == null ? void 0 : err.tryNextLink) { + continue; } - ); - return promise.then((signature) => { - return { message: signableMessage.message, signature }; - }); - } - async signString(stringToSign, { signingDate = /* @__PURE__ */ new Date(), signingRegion, signingService } = {}) { - const credentials = await this.credentialProvider(); - this.validateResolvedCredentials(credentials); - const region = signingRegion ?? await this.regionProvider(); - const { shortDate } = formatDate(signingDate); - const hash = new this.sha256(await this.getSigningKey(credentials, region, shortDate, signingService)); - hash.update((0, import_util_utf84.toUint8Array)(stringToSign)); - return (0, import_util_hex_encoding.toHex)(await hash.digest()); + throw err; + } } - async signRequest(requestToSign, { - signingDate = /* @__PURE__ */ new Date(), - signableHeaders, - unsignableHeaders, - signingRegion, - signingService - } = {}) { - const credentials = await this.credentialProvider(); - this.validateResolvedCredentials(credentials); - const region = signingRegion ?? await this.regionProvider(); - const request2 = prepareRequest(requestToSign); - const { longDate, shortDate } = formatDate(signingDate); - const scope = createScope(shortDate, region, signingService ?? this.service); - request2.headers[AMZ_DATE_HEADER] = longDate; - if (credentials.sessionToken) { - request2.headers[TOKEN_HEADER] = credentials.sessionToken; + throw lastProviderError; + }, "chain"); + var fromStatic = /* @__PURE__ */ __name((staticValue) => () => Promise.resolve(staticValue), "fromStatic"); + var memoize = /* @__PURE__ */ __name((provider, isExpired, requiresRefresh) => { + let resolved; + let pending; + let hasResult; + let isConstant = false; + const coalesceProvider = /* @__PURE__ */ __name(async () => { + if (!pending) { + pending = provider(); } - const payloadHash = await getPayloadHash(request2, this.sha256); - if (!hasHeader(SHA256_HEADER, request2.headers) && this.applyChecksum) { - request2.headers[SHA256_HEADER] = payloadHash; + try { + resolved = await pending; + hasResult = true; + isConstant = false; + } finally { + pending = void 0; } - const canonicalHeaders = getCanonicalHeaders(request2, unsignableHeaders, signableHeaders); - const signature = await this.getSignature( - longDate, - scope, - this.getSigningKey(credentials, region, shortDate, signingService), - this.createCanonicalRequest(request2, canonicalHeaders, payloadHash) - ); - request2.headers[AUTH_HEADER] = `${ALGORITHM_IDENTIFIER} Credential=${credentials.accessKeyId}/${scope}, SignedHeaders=${getCanonicalHeaderList(canonicalHeaders)}, Signature=${signature}`; - return request2; - } - createCanonicalRequest(request2, canonicalHeaders, payloadHash) { - const sortedHeaders = Object.keys(canonicalHeaders).sort(); - return `${request2.method} -${this.getCanonicalPath(request2)} -${getCanonicalQuery(request2)} -${sortedHeaders.map((name) => `${name}:${canonicalHeaders[name]}`).join("\n")} - -${sortedHeaders.join(";")} -${payloadHash}`; - } - async createStringToSign(longDate, credentialScope, canonicalRequest) { - const hash = new this.sha256(); - hash.update((0, import_util_utf84.toUint8Array)(canonicalRequest)); - const hashedRequest = await hash.digest(); - return `${ALGORITHM_IDENTIFIER} -${longDate} -${credentialScope} -${(0, import_util_hex_encoding.toHex)(hashedRequest)}`; + return resolved; + }, "coalesceProvider"); + if (isExpired === void 0) { + return async (options) => { + if (!hasResult || (options == null ? void 0 : options.forceRefresh)) { + resolved = await coalesceProvider(); + } + return resolved; + }; } - getCanonicalPath({ path }) { - if (this.uriEscapePath) { - const normalizedPathSegments = []; - for (const pathSegment of path.split("/")) { - if ((pathSegment == null ? void 0 : pathSegment.length) === 0) - continue; - if (pathSegment === ".") - continue; - if (pathSegment === "..") { - normalizedPathSegments.pop(); - } else { - normalizedPathSegments.push(pathSegment); - } - } - const normalizedPath = `${(path == null ? void 0 : path.startsWith("/")) ? "/" : ""}${normalizedPathSegments.join("/")}${normalizedPathSegments.length > 0 && (path == null ? void 0 : path.endsWith("/")) ? "/" : ""}`; - const doubleEncoded = (0, import_util_uri_escape.escapeUri)(normalizedPath); - return doubleEncoded.replace(/%2F/g, "/"); + return async (options) => { + if (!hasResult || (options == null ? void 0 : options.forceRefresh)) { + resolved = await coalesceProvider(); } - return path; - } - async getSignature(longDate, credentialScope, keyPromise, canonicalRequest) { - const stringToSign = await this.createStringToSign(longDate, credentialScope, canonicalRequest); - const hash = new this.sha256(await keyPromise); - hash.update((0, import_util_utf84.toUint8Array)(stringToSign)); - return (0, import_util_hex_encoding.toHex)(await hash.digest()); - } - getSigningKey(credentials, region, shortDate, service) { - return getSigningKey(this.sha256, credentials, shortDate, region, service || this.service); - } - validateResolvedCredentials(credentials) { - if (typeof credentials !== "object" || // @ts-expect-error: Property 'accessKeyId' does not exist on type 'object'.ts(2339) - typeof credentials.accessKeyId !== "string" || // @ts-expect-error: Property 'secretAccessKey' does not exist on type 'object'.ts(2339) - typeof credentials.secretAccessKey !== "string") { - throw new Error("Resolved credential object is not valid"); + if (isConstant) { + return resolved; } - } - }; - __name(_SignatureV4, "SignatureV4"); - var SignatureV4 = _SignatureV4; - var formatDate = /* @__PURE__ */ __name((now) => { - const longDate = iso8601(now).replace(/[\-:]/g, ""); - return { - longDate, - shortDate: longDate.slice(0, 8) + if (requiresRefresh && !requiresRefresh(resolved)) { + isConstant = true; + return resolved; + } + if (isExpired(resolved)) { + await coalesceProvider(); + return resolved; + } + return resolved; }; - }, "formatDate"); - var getCanonicalHeaderList = /* @__PURE__ */ __name((headers) => Object.keys(headers).sort().join(";"), "getCanonicalHeaderList"); + }, "memoize"); } }); -// ../../../node_modules/@aws-sdk/middleware-signing/dist-cjs/awsAuthConfiguration.js -var require_awsAuthConfiguration = __commonJS({ - "../../../node_modules/@aws-sdk/middleware-signing/dist-cjs/awsAuthConfiguration.js"(exports2) { +// ../../../node_modules/@smithy/core/node_modules/@smithy/shared-ini-file-loader/dist-cjs/getHomeDir.js +var require_getHomeDir = __commonJS({ + "../../../node_modules/@smithy/core/node_modules/@smithy/shared-ini-file-loader/dist-cjs/getHomeDir.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.resolveSigV4AuthConfig = exports2.resolveAwsAuthConfig = void 0; - var property_provider_1 = require_dist_cjs6(); - var signature_v4_1 = require_dist_cjs13(); - var util_middleware_1 = require_dist_cjs7(); - var CREDENTIAL_EXPIRE_WINDOW = 3e5; - var resolveAwsAuthConfig = (input) => { - const normalizedCreds = input.credentials ? normalizeCredentialProvider(input.credentials) : input.credentialDefaultProvider(input); - const { signingEscapePath = true, systemClockOffset = input.systemClockOffset || 0, sha256 } = input; - let signer; - if (input.signer) { - signer = (0, util_middleware_1.normalizeProvider)(input.signer); - } else if (input.regionInfoProvider) { - signer = () => (0, util_middleware_1.normalizeProvider)(input.region)().then(async (region) => [ - await input.regionInfoProvider(region, { - useFipsEndpoint: await input.useFipsEndpoint(), - useDualstackEndpoint: await input.useDualstackEndpoint() - }) || {}, - region - ]).then(([regionInfo, region]) => { - const { signingRegion, signingService } = regionInfo; - input.signingRegion = input.signingRegion || signingRegion || region; - input.signingName = input.signingName || signingService || input.serviceId; - const params = { - ...input, - credentials: normalizedCreds, - region: input.signingRegion, - service: input.signingName, - sha256, - uriEscapePath: signingEscapePath - }; - const SignerCtor = input.signerConstructor || signature_v4_1.SignatureV4; - return new SignerCtor(params); - }); - } else { - signer = async (authScheme) => { - authScheme = Object.assign({}, { - name: "sigv4", - signingName: input.signingName || input.defaultSigningName, - signingRegion: await (0, util_middleware_1.normalizeProvider)(input.region)(), - properties: {} - }, authScheme); - const signingRegion = authScheme.signingRegion; - const signingService = authScheme.signingName; - input.signingRegion = input.signingRegion || signingRegion; - input.signingName = input.signingName || signingService || input.serviceId; - const params = { - ...input, - credentials: normalizedCreds, - region: input.signingRegion, - service: input.signingName, - sha256, - uriEscapePath: signingEscapePath - }; - const SignerCtor = input.signerConstructor || signature_v4_1.SignatureV4; - return new SignerCtor(params); - }; - } - return { - ...input, - systemClockOffset, - signingEscapePath, - credentials: normalizedCreds, - signer - }; - }; - exports2.resolveAwsAuthConfig = resolveAwsAuthConfig; - var resolveSigV4AuthConfig = (input) => { - const normalizedCreds = input.credentials ? normalizeCredentialProvider(input.credentials) : input.credentialDefaultProvider(input); - const { signingEscapePath = true, systemClockOffset = input.systemClockOffset || 0, sha256 } = input; - let signer; - if (input.signer) { - signer = (0, util_middleware_1.normalizeProvider)(input.signer); - } else { - signer = (0, util_middleware_1.normalizeProvider)(new signature_v4_1.SignatureV4({ - credentials: normalizedCreds, - region: input.region, - service: input.signingName, - sha256, - uriEscapePath: signingEscapePath - })); + exports2.getHomeDir = void 0; + var os_1 = require("os"); + var path_1 = require("path"); + var homeDirCache = {}; + var getHomeDirCacheKey = () => { + if (process && process.geteuid) { + return `${process.geteuid()}`; } - return { - ...input, - systemClockOffset, - signingEscapePath, - credentials: normalizedCreds, - signer - }; + return "DEFAULT"; }; - exports2.resolveSigV4AuthConfig = resolveSigV4AuthConfig; - var normalizeCredentialProvider = (credentials) => { - if (typeof credentials === "function") { - return (0, property_provider_1.memoize)(credentials, (credentials2) => credentials2.expiration !== void 0 && credentials2.expiration.getTime() - Date.now() < CREDENTIAL_EXPIRE_WINDOW, (credentials2) => credentials2.expiration !== void 0); - } - return (0, util_middleware_1.normalizeProvider)(credentials); + var getHomeDir2 = () => { + const { HOME, USERPROFILE, HOMEPATH, HOMEDRIVE = `C:${path_1.sep}` } = process.env; + if (HOME) + return HOME; + if (USERPROFILE) + return USERPROFILE; + if (HOMEPATH) + return `${HOMEDRIVE}${HOMEPATH}`; + const homeDirCacheKey = getHomeDirCacheKey(); + if (!homeDirCache[homeDirCacheKey]) + homeDirCache[homeDirCacheKey] = (0, os_1.homedir)(); + return homeDirCache[homeDirCacheKey]; }; + exports2.getHomeDir = getHomeDir2; } }); -// ../../../node_modules/@aws-sdk/middleware-signing/dist-cjs/utils/getSkewCorrectedDate.js -var require_getSkewCorrectedDate = __commonJS({ - "../../../node_modules/@aws-sdk/middleware-signing/dist-cjs/utils/getSkewCorrectedDate.js"(exports2) { +// ../../../node_modules/@smithy/core/node_modules/@smithy/shared-ini-file-loader/dist-cjs/getSSOTokenFilepath.js +var require_getSSOTokenFilepath = __commonJS({ + "../../../node_modules/@smithy/core/node_modules/@smithy/shared-ini-file-loader/dist-cjs/getSSOTokenFilepath.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.getSkewCorrectedDate = void 0; - var getSkewCorrectedDate = (systemClockOffset) => new Date(Date.now() + systemClockOffset); - exports2.getSkewCorrectedDate = getSkewCorrectedDate; + exports2.getSSOTokenFilepath = void 0; + var crypto_1 = require("crypto"); + var path_1 = require("path"); + var getHomeDir_1 = require_getHomeDir(); + var getSSOTokenFilepath2 = (id) => { + const hasher = (0, crypto_1.createHash)("sha1"); + const cacheName = hasher.update(id).digest("hex"); + return (0, path_1.join)((0, getHomeDir_1.getHomeDir)(), ".aws", "sso", "cache", `${cacheName}.json`); + }; + exports2.getSSOTokenFilepath = getSSOTokenFilepath2; } }); -// ../../../node_modules/@aws-sdk/middleware-signing/dist-cjs/utils/isClockSkewed.js -var require_isClockSkewed = __commonJS({ - "../../../node_modules/@aws-sdk/middleware-signing/dist-cjs/utils/isClockSkewed.js"(exports2) { +// ../../../node_modules/@smithy/core/node_modules/@smithy/shared-ini-file-loader/dist-cjs/getSSOTokenFromFile.js +var require_getSSOTokenFromFile = __commonJS({ + "../../../node_modules/@smithy/core/node_modules/@smithy/shared-ini-file-loader/dist-cjs/getSSOTokenFromFile.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.isClockSkewed = void 0; - var getSkewCorrectedDate_1 = require_getSkewCorrectedDate(); - var isClockSkewed = (clockTime, systemClockOffset) => Math.abs((0, getSkewCorrectedDate_1.getSkewCorrectedDate)(systemClockOffset).getTime() - clockTime) >= 3e5; - exports2.isClockSkewed = isClockSkewed; + exports2.getSSOTokenFromFile = void 0; + var fs_1 = require("fs"); + var getSSOTokenFilepath_1 = require_getSSOTokenFilepath(); + var { readFile } = fs_1.promises; + var getSSOTokenFromFile2 = async (id) => { + const ssoTokenFilepath = (0, getSSOTokenFilepath_1.getSSOTokenFilepath)(id); + const ssoTokenText = await readFile(ssoTokenFilepath, "utf8"); + return JSON.parse(ssoTokenText); + }; + exports2.getSSOTokenFromFile = getSSOTokenFromFile2; } }); -// ../../../node_modules/@aws-sdk/middleware-signing/dist-cjs/utils/getUpdatedSystemClockOffset.js -var require_getUpdatedSystemClockOffset = __commonJS({ - "../../../node_modules/@aws-sdk/middleware-signing/dist-cjs/utils/getUpdatedSystemClockOffset.js"(exports2) { +// ../../../node_modules/@smithy/core/node_modules/@smithy/shared-ini-file-loader/dist-cjs/slurpFile.js +var require_slurpFile = __commonJS({ + "../../../node_modules/@smithy/core/node_modules/@smithy/shared-ini-file-loader/dist-cjs/slurpFile.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.getUpdatedSystemClockOffset = void 0; - var isClockSkewed_1 = require_isClockSkewed(); - var getUpdatedSystemClockOffset = (clockTime, currentSystemClockOffset) => { - const clockTimeInMs = Date.parse(clockTime); - if ((0, isClockSkewed_1.isClockSkewed)(clockTimeInMs, currentSystemClockOffset)) { - return clockTimeInMs - Date.now(); + exports2.slurpFile = void 0; + var fs_1 = require("fs"); + var { readFile } = fs_1.promises; + var filePromisesHash = {}; + var slurpFile = (path, options) => { + if (!filePromisesHash[path] || (options === null || options === void 0 ? void 0 : options.ignoreCache)) { + filePromisesHash[path] = readFile(path, "utf8"); } - return currentSystemClockOffset; + return filePromisesHash[path]; }; - exports2.getUpdatedSystemClockOffset = getUpdatedSystemClockOffset; + exports2.slurpFile = slurpFile; } }); -// ../../../node_modules/@aws-sdk/middleware-signing/dist-cjs/awsAuthMiddleware.js -var require_awsAuthMiddleware = __commonJS({ - "../../../node_modules/@aws-sdk/middleware-signing/dist-cjs/awsAuthMiddleware.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.getSigV4AuthPlugin = exports2.getAwsAuthPlugin = exports2.awsAuthMiddlewareOptions = exports2.awsAuthMiddleware = void 0; - var protocol_http_1 = require_dist_cjs2(); - var getSkewCorrectedDate_1 = require_getSkewCorrectedDate(); - var getUpdatedSystemClockOffset_1 = require_getUpdatedSystemClockOffset(); - var awsAuthMiddleware = (options) => (next, context) => async function(args) { - var _a, _b, _c, _d; - if (!protocol_http_1.HttpRequest.isInstance(args.request)) - return next(args); - const authScheme = (_c = (_b = (_a = context.endpointV2) === null || _a === void 0 ? void 0 : _a.properties) === null || _b === void 0 ? void 0 : _b.authSchemes) === null || _c === void 0 ? void 0 : _c[0]; - const multiRegionOverride = (authScheme === null || authScheme === void 0 ? void 0 : authScheme.name) === "sigv4a" ? (_d = authScheme === null || authScheme === void 0 ? void 0 : authScheme.signingRegionSet) === null || _d === void 0 ? void 0 : _d.join(",") : void 0; - const signer = await options.signer(authScheme); - const output = await next({ - ...args, - request: await signer.sign(args.request, { - signingDate: (0, getSkewCorrectedDate_1.getSkewCorrectedDate)(options.systemClockOffset), - signingRegion: multiRegionOverride || context["signing_region"], - signingService: context["signing_service"] - }) - }).catch((error) => { - var _a2; - const serverTime = (_a2 = error.ServerTime) !== null && _a2 !== void 0 ? _a2 : getDateHeader(error.$response); - if (serverTime) { - options.systemClockOffset = (0, getUpdatedSystemClockOffset_1.getUpdatedSystemClockOffset)(serverTime, options.systemClockOffset); - } - throw error; - }); - const dateHeader = getDateHeader(output.response); - if (dateHeader) { - options.systemClockOffset = (0, getUpdatedSystemClockOffset_1.getUpdatedSystemClockOffset)(dateHeader, options.systemClockOffset); - } - return output; - }; - exports2.awsAuthMiddleware = awsAuthMiddleware; - var getDateHeader = (response) => { - var _a, _b, _c; - return protocol_http_1.HttpResponse.isInstance(response) ? (_b = (_a = response.headers) === null || _a === void 0 ? void 0 : _a.date) !== null && _b !== void 0 ? _b : (_c = response.headers) === null || _c === void 0 ? void 0 : _c.Date : void 0; - }; - exports2.awsAuthMiddlewareOptions = { - name: "awsAuthMiddleware", - tags: ["SIGNATURE", "AWSAUTH"], - relation: "after", - toMiddleware: "retryMiddleware", - override: true +// ../../../node_modules/@smithy/core/node_modules/@smithy/shared-ini-file-loader/dist-cjs/index.js +var require_dist_cjs14 = __commonJS({ + "../../../node_modules/@smithy/core/node_modules/@smithy/shared-ini-file-loader/dist-cjs/index.js"(exports2, module2) { + var __defProp2 = Object.defineProperty; + var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; + var __getOwnPropNames2 = Object.getOwnPropertyNames; + var __hasOwnProp2 = Object.prototype.hasOwnProperty; + var __name = (target, value) => __defProp2(target, "name", { value, configurable: true }); + var __export2 = (target, all) => { + for (var name in all) + __defProp2(target, name, { get: all[name], enumerable: true }); }; - var getAwsAuthPlugin = (options) => ({ - applyToStack: (clientStack) => { - clientStack.addRelativeTo((0, exports2.awsAuthMiddleware)(options), exports2.awsAuthMiddlewareOptions); + var __copyProps2 = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames2(from)) + if (!__hasOwnProp2.call(to, key) && key !== except) + __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable }); } + return to; + }; + var __reExport = (target, mod, secondTarget) => (__copyProps2(target, mod, "default"), secondTarget && __copyProps2(secondTarget, mod, "default")); + var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); + var src_exports = {}; + __export2(src_exports, { + CONFIG_PREFIX_SEPARATOR: () => CONFIG_PREFIX_SEPARATOR, + DEFAULT_PROFILE: () => DEFAULT_PROFILE, + ENV_PROFILE: () => ENV_PROFILE, + getProfileName: () => getProfileName, + loadSharedConfigFiles: () => loadSharedConfigFiles, + loadSsoSessionData: () => loadSsoSessionData, + parseKnownFiles: () => parseKnownFiles }); - exports2.getAwsAuthPlugin = getAwsAuthPlugin; - exports2.getSigV4AuthPlugin = exports2.getAwsAuthPlugin; - } -}); - -// ../../../node_modules/@aws-sdk/middleware-signing/dist-cjs/index.js -var require_dist_cjs14 = __commonJS({ - "../../../node_modules/@aws-sdk/middleware-signing/dist-cjs/index.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports)); - tslib_1.__exportStar(require_awsAuthConfiguration(), exports2); - tslib_1.__exportStar(require_awsAuthMiddleware(), exports2); - } -}); - -// ../../../node_modules/@aws-sdk/middleware-user-agent/dist-cjs/configurations.js -var require_configurations = __commonJS({ - "../../../node_modules/@aws-sdk/middleware-user-agent/dist-cjs/configurations.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.resolveUserAgentConfig = void 0; - function resolveUserAgentConfig(input) { - return { - ...input, - customUserAgent: typeof input.customUserAgent === "string" ? [[input.customUserAgent]] : input.customUserAgent - }; - } - exports2.resolveUserAgentConfig = resolveUserAgentConfig; - } -}); - -// ../../../node_modules/@aws-sdk/util-endpoints/dist-cjs/lib/aws/partitions.json -var require_partitions = __commonJS({ - "../../../node_modules/@aws-sdk/util-endpoints/dist-cjs/lib/aws/partitions.json"(exports2, module2) { - module2.exports = { - partitions: [{ - id: "aws", - outputs: { - dnsSuffix: "amazonaws.com", - dualStackDnsSuffix: "api.aws", - implicitGlobalRegion: "us-east-1", - name: "aws", - supportsDualStack: true, - supportsFIPS: true - }, - regionRegex: "^(us|eu|ap|sa|ca|me|af|il)\\-\\w+\\-\\d+$", - regions: { - "af-south-1": { - description: "Africa (Cape Town)" - }, - "ap-east-1": { - description: "Asia Pacific (Hong Kong)" - }, - "ap-northeast-1": { - description: "Asia Pacific (Tokyo)" - }, - "ap-northeast-2": { - description: "Asia Pacific (Seoul)" - }, - "ap-northeast-3": { - description: "Asia Pacific (Osaka)" - }, - "ap-south-1": { - description: "Asia Pacific (Mumbai)" - }, - "ap-south-2": { - description: "Asia Pacific (Hyderabad)" - }, - "ap-southeast-1": { - description: "Asia Pacific (Singapore)" - }, - "ap-southeast-2": { - description: "Asia Pacific (Sydney)" - }, - "ap-southeast-3": { - description: "Asia Pacific (Jakarta)" - }, - "ap-southeast-4": { - description: "Asia Pacific (Melbourne)" - }, - "aws-global": { - description: "AWS Standard global region" - }, - "ca-central-1": { - description: "Canada (Central)" - }, - "eu-central-1": { - description: "Europe (Frankfurt)" - }, - "eu-central-2": { - description: "Europe (Zurich)" - }, - "eu-north-1": { - description: "Europe (Stockholm)" - }, - "eu-south-1": { - description: "Europe (Milan)" - }, - "eu-south-2": { - description: "Europe (Spain)" - }, - "eu-west-1": { - description: "Europe (Ireland)" - }, - "eu-west-2": { - description: "Europe (London)" - }, - "eu-west-3": { - description: "Europe (Paris)" - }, - "il-central-1": { - description: "Israel (Tel Aviv)" - }, - "me-central-1": { - description: "Middle East (UAE)" - }, - "me-south-1": { - description: "Middle East (Bahrain)" - }, - "sa-east-1": { - description: "South America (Sao Paulo)" - }, - "us-east-1": { - description: "US East (N. Virginia)" - }, - "us-east-2": { - description: "US East (Ohio)" - }, - "us-west-1": { - description: "US West (N. California)" - }, - "us-west-2": { - description: "US West (Oregon)" - } - } - }, { - id: "aws-cn", - outputs: { - dnsSuffix: "amazonaws.com.cn", - dualStackDnsSuffix: "api.amazonwebservices.com.cn", - implicitGlobalRegion: "cn-northwest-1", - name: "aws-cn", - supportsDualStack: true, - supportsFIPS: true - }, - regionRegex: "^cn\\-\\w+\\-\\d+$", - regions: { - "aws-cn-global": { - description: "AWS China global region" - }, - "cn-north-1": { - description: "China (Beijing)" - }, - "cn-northwest-1": { - description: "China (Ningxia)" + module2.exports = __toCommonJS2(src_exports); + __reExport(src_exports, require_getHomeDir(), module2.exports); + var ENV_PROFILE = "AWS_PROFILE"; + var DEFAULT_PROFILE = "default"; + var getProfileName = /* @__PURE__ */ __name((init) => init.profile || process.env[ENV_PROFILE] || DEFAULT_PROFILE, "getProfileName"); + __reExport(src_exports, require_getSSOTokenFilepath(), module2.exports); + __reExport(src_exports, require_getSSOTokenFromFile(), module2.exports); + var import_types5 = require_dist_cjs(); + var getConfigData = /* @__PURE__ */ __name((data) => Object.entries(data).filter(([key]) => { + const indexOfSeparator = key.indexOf(CONFIG_PREFIX_SEPARATOR); + if (indexOfSeparator === -1) { + return false; + } + return Object.values(import_types5.IniSectionType).includes(key.substring(0, indexOfSeparator)); + }).reduce( + (acc, [key, value]) => { + const indexOfSeparator = key.indexOf(CONFIG_PREFIX_SEPARATOR); + const updatedKey = key.substring(0, indexOfSeparator) === import_types5.IniSectionType.PROFILE ? key.substring(indexOfSeparator + 1) : key; + acc[updatedKey] = value; + return acc; + }, + { + // Populate default profile, if present. + ...data.default && { default: data.default } + } + ), "getConfigData"); + var import_path = require("path"); + var import_getHomeDir = require_getHomeDir(); + var ENV_CONFIG_PATH = "AWS_CONFIG_FILE"; + var getConfigFilepath = /* @__PURE__ */ __name(() => process.env[ENV_CONFIG_PATH] || (0, import_path.join)((0, import_getHomeDir.getHomeDir)(), ".aws", "config"), "getConfigFilepath"); + var import_getHomeDir2 = require_getHomeDir(); + var ENV_CREDENTIALS_PATH = "AWS_SHARED_CREDENTIALS_FILE"; + var getCredentialsFilepath = /* @__PURE__ */ __name(() => process.env[ENV_CREDENTIALS_PATH] || (0, import_path.join)((0, import_getHomeDir2.getHomeDir)(), ".aws", "credentials"), "getCredentialsFilepath"); + var import_getHomeDir3 = require_getHomeDir(); + var prefixKeyRegex = /^([\w-]+)\s(["'])?([\w-@\+\.%:/]+)\2$/; + var profileNameBlockList = ["__proto__", "profile __proto__"]; + var parseIni = /* @__PURE__ */ __name((iniData) => { + const map = {}; + let currentSection; + let currentSubSection; + for (const iniLine of iniData.split(/\r?\n/)) { + const trimmedLine = iniLine.split(/(^|\s)[;#]/)[0].trim(); + const isSection = trimmedLine[0] === "[" && trimmedLine[trimmedLine.length - 1] === "]"; + if (isSection) { + currentSection = void 0; + currentSubSection = void 0; + const sectionName = trimmedLine.substring(1, trimmedLine.length - 1); + const matches = prefixKeyRegex.exec(sectionName); + if (matches) { + const [, prefix, , name] = matches; + if (Object.values(import_types5.IniSectionType).includes(prefix)) { + currentSection = [prefix, name].join(CONFIG_PREFIX_SEPARATOR); + } + } else { + currentSection = sectionName; } - } - }, { - id: "aws-us-gov", - outputs: { - dnsSuffix: "amazonaws.com", - dualStackDnsSuffix: "api.aws", - implicitGlobalRegion: "us-gov-west-1", - name: "aws-us-gov", - supportsDualStack: true, - supportsFIPS: true - }, - regionRegex: "^us\\-gov\\-\\w+\\-\\d+$", - regions: { - "aws-us-gov-global": { - description: "AWS GovCloud (US) global region" - }, - "us-gov-east-1": { - description: "AWS GovCloud (US-East)" - }, - "us-gov-west-1": { - description: "AWS GovCloud (US-West)" + if (profileNameBlockList.includes(sectionName)) { + throw new Error(`Found invalid profile name "${sectionName}"`); } - } - }, { - id: "aws-iso", - outputs: { - dnsSuffix: "c2s.ic.gov", - dualStackDnsSuffix: "c2s.ic.gov", - implicitGlobalRegion: "us-iso-east-1", - name: "aws-iso", - supportsDualStack: false, - supportsFIPS: true - }, - regionRegex: "^us\\-iso\\-\\w+\\-\\d+$", - regions: { - "aws-iso-global": { - description: "AWS ISO (US) global region" - }, - "us-iso-east-1": { - description: "US ISO East" - }, - "us-iso-west-1": { - description: "US ISO WEST" + } else if (currentSection) { + const indexOfEqualsSign = trimmedLine.indexOf("="); + if (![0, -1].includes(indexOfEqualsSign)) { + const [name, value] = [ + trimmedLine.substring(0, indexOfEqualsSign).trim(), + trimmedLine.substring(indexOfEqualsSign + 1).trim() + ]; + if (value === "") { + currentSubSection = name; + } else { + if (currentSubSection && iniLine.trimStart() === iniLine) { + currentSubSection = void 0; + } + map[currentSection] = map[currentSection] || {}; + const key = currentSubSection ? [currentSubSection, name].join(CONFIG_PREFIX_SEPARATOR) : name; + map[currentSection][key] = value; + } } } - }, { - id: "aws-iso-b", - outputs: { - dnsSuffix: "sc2s.sgov.gov", - dualStackDnsSuffix: "sc2s.sgov.gov", - implicitGlobalRegion: "us-isob-east-1", - name: "aws-iso-b", - supportsDualStack: false, - supportsFIPS: true - }, - regionRegex: "^us\\-isob\\-\\w+\\-\\d+$", - regions: { - "aws-iso-b-global": { - description: "AWS ISOB (US) global region" - }, - "us-isob-east-1": { - description: "US ISOB East (Ohio)" + } + return map; + }, "parseIni"); + var import_slurpFile = require_slurpFile(); + var swallowError = /* @__PURE__ */ __name(() => ({}), "swallowError"); + var CONFIG_PREFIX_SEPARATOR = "."; + var loadSharedConfigFiles = /* @__PURE__ */ __name(async (init = {}) => { + const { filepath = getCredentialsFilepath(), configFilepath = getConfigFilepath() } = init; + const homeDir = (0, import_getHomeDir3.getHomeDir)(); + const relativeHomeDirPrefix = "~/"; + let resolvedFilepath = filepath; + if (filepath.startsWith(relativeHomeDirPrefix)) { + resolvedFilepath = (0, import_path.join)(homeDir, filepath.slice(2)); + } + let resolvedConfigFilepath = configFilepath; + if (configFilepath.startsWith(relativeHomeDirPrefix)) { + resolvedConfigFilepath = (0, import_path.join)(homeDir, configFilepath.slice(2)); + } + const parsedFiles = await Promise.all([ + (0, import_slurpFile.slurpFile)(resolvedConfigFilepath, { + ignoreCache: init.ignoreCache + }).then(parseIni).then(getConfigData).catch(swallowError), + (0, import_slurpFile.slurpFile)(resolvedFilepath, { + ignoreCache: init.ignoreCache + }).then(parseIni).catch(swallowError) + ]); + return { + configFile: parsedFiles[0], + credentialsFile: parsedFiles[1] + }; + }, "loadSharedConfigFiles"); + var getSsoSessionData = /* @__PURE__ */ __name((data) => Object.entries(data).filter(([key]) => key.startsWith(import_types5.IniSectionType.SSO_SESSION + CONFIG_PREFIX_SEPARATOR)).reduce((acc, [key, value]) => ({ ...acc, [key.substring(key.indexOf(CONFIG_PREFIX_SEPARATOR) + 1)]: value }), {}), "getSsoSessionData"); + var import_slurpFile2 = require_slurpFile(); + var swallowError2 = /* @__PURE__ */ __name(() => ({}), "swallowError"); + var loadSsoSessionData = /* @__PURE__ */ __name(async (init = {}) => (0, import_slurpFile2.slurpFile)(init.configFilepath ?? getConfigFilepath()).then(parseIni).then(getSsoSessionData).catch(swallowError2), "loadSsoSessionData"); + var mergeConfigFiles = /* @__PURE__ */ __name((...files) => { + const merged = {}; + for (const file of files) { + for (const [key, values] of Object.entries(file)) { + if (merged[key] !== void 0) { + Object.assign(merged[key], values); + } else { + merged[key] = values; } } - }, { - id: "aws-iso-e", - outputs: { - dnsSuffix: "cloud.adc-e.uk", - dualStackDnsSuffix: "cloud.adc-e.uk", - implicitGlobalRegion: "eu-isoe-west-1", - name: "aws-iso-e", - supportsDualStack: false, - supportsFIPS: true - }, - regionRegex: "^eu\\-isoe\\-\\w+\\-\\d+$", - regions: {} - }, { - id: "aws-iso-f", - outputs: { - dnsSuffix: "csp.hci.ic.gov", - dualStackDnsSuffix: "csp.hci.ic.gov", - implicitGlobalRegion: "us-isof-south-1", - name: "aws-iso-f", - supportsDualStack: false, - supportsFIPS: true - }, - regionRegex: "^us\\-isof\\-\\w+\\-\\d+$", - regions: {} - }], - version: "1.1" - }; + } + return merged; + }, "mergeConfigFiles"); + var parseKnownFiles = /* @__PURE__ */ __name(async (init) => { + const parsedFiles = await loadSharedConfigFiles(init); + return mergeConfigFiles(parsedFiles.configFile, parsedFiles.credentialsFile); + }, "parseKnownFiles"); } }); -// ../../../node_modules/@aws-sdk/util-endpoints/dist-cjs/lib/aws/partition.js -var require_partition = __commonJS({ - "../../../node_modules/@aws-sdk/util-endpoints/dist-cjs/lib/aws/partition.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.getUserAgentPrefix = exports2.useDefaultPartitionInfo = exports2.setPartitionInfo = exports2.partition = void 0; - var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports)); - var partitions_json_1 = tslib_1.__importDefault(require_partitions()); - var selectedPartitionsInfo = partitions_json_1.default; - var selectedUserAgentPrefix = ""; - var partition = (value) => { - const { partitions } = selectedPartitionsInfo; - for (const partition2 of partitions) { - const { regions, outputs } = partition2; - for (const [region, regionData] of Object.entries(regions)) { - if (region === value) { - return { - ...outputs, - ...regionData - }; - } - } +// ../../../node_modules/@smithy/core/node_modules/@smithy/node-config-provider/dist-cjs/index.js +var require_dist_cjs15 = __commonJS({ + "../../../node_modules/@smithy/core/node_modules/@smithy/node-config-provider/dist-cjs/index.js"(exports2, module2) { + var __defProp2 = Object.defineProperty; + var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; + var __getOwnPropNames2 = Object.getOwnPropertyNames; + var __hasOwnProp2 = Object.prototype.hasOwnProperty; + var __name = (target, value) => __defProp2(target, "name", { value, configurable: true }); + var __export2 = (target, all) => { + for (var name in all) + __defProp2(target, name, { get: all[name], enumerable: true }); + }; + var __copyProps2 = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames2(from)) + if (!__hasOwnProp2.call(to, key) && key !== except) + __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable }); } - for (const partition2 of partitions) { - const { regionRegex, outputs } = partition2; - if (new RegExp(regionRegex).test(value)) { - return { - ...outputs - }; + return to; + }; + var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); + var src_exports = {}; + __export2(src_exports, { + loadConfig: () => loadConfig + }); + module2.exports = __toCommonJS2(src_exports); + var import_property_provider2 = require_dist_cjs13(); + function getSelectorName(functionString) { + try { + const constants = new Set(Array.from(functionString.match(/([A-Z_]){3,}/g) ?? [])); + constants.delete("CONFIG"); + constants.delete("CONFIG_PREFIX_SEPARATOR"); + constants.delete("ENV"); + return [...constants].join(", "); + } catch (e) { + return functionString; + } + } + __name(getSelectorName, "getSelectorName"); + var fromEnv = /* @__PURE__ */ __name((envVarSelector, logger) => async () => { + try { + const config = envVarSelector(process.env); + if (config === void 0) { + throw new Error(); } + return config; + } catch (e) { + throw new import_property_provider2.CredentialsProviderError( + e.message || `Not found in ENV: ${getSelectorName(envVarSelector.toString())}`, + { logger } + ); } - const DEFAULT_PARTITION = partitions.find((partition2) => partition2.id === "aws"); - if (!DEFAULT_PARTITION) { - throw new Error("Provided region was not found in the partition array or regex, and default partition with id 'aws' doesn't exist."); + }, "fromEnv"); + var import_shared_ini_file_loader = require_dist_cjs14(); + var fromSharedConfigFiles = /* @__PURE__ */ __name((configSelector, { preferredFile = "config", ...init } = {}) => async () => { + const profile = (0, import_shared_ini_file_loader.getProfileName)(init); + const { configFile, credentialsFile } = await (0, import_shared_ini_file_loader.loadSharedConfigFiles)(init); + const profileFromCredentials = credentialsFile[profile] || {}; + const profileFromConfig = configFile[profile] || {}; + const mergedProfile = preferredFile === "config" ? { ...profileFromCredentials, ...profileFromConfig } : { ...profileFromConfig, ...profileFromCredentials }; + try { + const cfgFile = preferredFile === "config" ? configFile : credentialsFile; + const configValue = configSelector(mergedProfile, cfgFile); + if (configValue === void 0) { + throw new Error(); + } + return configValue; + } catch (e) { + throw new import_property_provider2.CredentialsProviderError( + e.message || `Not found in config files w/ profile [${profile}]: ${getSelectorName(configSelector.toString())}`, + { logger: init.logger } + ); } - return { - ...DEFAULT_PARTITION.outputs - }; - }; - exports2.partition = partition; - var setPartitionInfo = (partitionsInfo, userAgentPrefix = "") => { - selectedPartitionsInfo = partitionsInfo; - selectedUserAgentPrefix = userAgentPrefix; - }; - exports2.setPartitionInfo = setPartitionInfo; - var useDefaultPartitionInfo = () => { - (0, exports2.setPartitionInfo)(partitions_json_1.default, ""); - }; - exports2.useDefaultPartitionInfo = useDefaultPartitionInfo; - var getUserAgentPrefix = () => selectedUserAgentPrefix; - exports2.getUserAgentPrefix = getUserAgentPrefix; + }, "fromSharedConfigFiles"); + var isFunction = /* @__PURE__ */ __name((func) => typeof func === "function", "isFunction"); + var fromStatic = /* @__PURE__ */ __name((defaultValue) => isFunction(defaultValue) ? async () => await defaultValue() : (0, import_property_provider2.fromStatic)(defaultValue), "fromStatic"); + var loadConfig = /* @__PURE__ */ __name(({ environmentVariableSelector, configFileSelector, default: defaultValue }, configuration = {}) => (0, import_property_provider2.memoize)( + (0, import_property_provider2.chain)( + fromEnv(environmentVariableSelector), + fromSharedConfigFiles(configFileSelector, configuration), + fromStatic(defaultValue) + ) + ), "loadConfig"); } }); -// ../../../node_modules/@aws-sdk/util-endpoints/dist-cjs/lib/isIpAddress.js -var require_isIpAddress = __commonJS({ - "../../../node_modules/@aws-sdk/util-endpoints/dist-cjs/lib/isIpAddress.js"(exports2) { +// ../../../node_modules/@smithy/core/node_modules/@smithy/middleware-endpoint/dist-cjs/adaptors/getEndpointUrlConfig.js +var require_getEndpointUrlConfig = __commonJS({ + "../../../node_modules/@smithy/core/node_modules/@smithy/middleware-endpoint/dist-cjs/adaptors/getEndpointUrlConfig.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.isIpAddress = void 0; - var IP_V4_REGEX = new RegExp(`^(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3}$`); - var isIpAddress = (value) => IP_V4_REGEX.test(value) || value.startsWith("[") && value.endsWith("]"); - exports2.isIpAddress = isIpAddress; + exports2.getEndpointUrlConfig = void 0; + var shared_ini_file_loader_1 = require_dist_cjs14(); + var ENV_ENDPOINT_URL = "AWS_ENDPOINT_URL"; + var CONFIG_ENDPOINT_URL = "endpoint_url"; + var getEndpointUrlConfig = (serviceId) => ({ + environmentVariableSelector: (env) => { + const serviceSuffixParts = serviceId.split(" ").map((w) => w.toUpperCase()); + const serviceEndpointUrl = env[[ENV_ENDPOINT_URL, ...serviceSuffixParts].join("_")]; + if (serviceEndpointUrl) + return serviceEndpointUrl; + const endpointUrl = env[ENV_ENDPOINT_URL]; + if (endpointUrl) + return endpointUrl; + return void 0; + }, + configFileSelector: (profile, config) => { + if (config && profile.services) { + const servicesSection = config[["services", profile.services].join(shared_ini_file_loader_1.CONFIG_PREFIX_SEPARATOR)]; + if (servicesSection) { + const servicePrefixParts = serviceId.split(" ").map((w) => w.toLowerCase()); + const endpointUrl2 = servicesSection[[servicePrefixParts.join("_"), CONFIG_ENDPOINT_URL].join(shared_ini_file_loader_1.CONFIG_PREFIX_SEPARATOR)]; + if (endpointUrl2) + return endpointUrl2; + } + } + const endpointUrl = profile[CONFIG_ENDPOINT_URL]; + if (endpointUrl) + return endpointUrl; + return void 0; + }, + default: void 0 + }); + exports2.getEndpointUrlConfig = getEndpointUrlConfig; } }); -// ../../../node_modules/@aws-sdk/util-endpoints/dist-cjs/debug/debugId.js -var require_debugId = __commonJS({ - "../../../node_modules/@aws-sdk/util-endpoints/dist-cjs/debug/debugId.js"(exports2) { +// ../../../node_modules/@smithy/core/node_modules/@smithy/middleware-endpoint/dist-cjs/adaptors/getEndpointFromConfig.js +var require_getEndpointFromConfig = __commonJS({ + "../../../node_modules/@smithy/core/node_modules/@smithy/middleware-endpoint/dist-cjs/adaptors/getEndpointFromConfig.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.debugId = void 0; - exports2.debugId = "endpoints"; + exports2.getEndpointFromConfig = void 0; + var node_config_provider_1 = require_dist_cjs15(); + var getEndpointUrlConfig_1 = require_getEndpointUrlConfig(); + var getEndpointFromConfig = async (serviceId) => (0, node_config_provider_1.loadConfig)((0, getEndpointUrlConfig_1.getEndpointUrlConfig)(serviceId !== null && serviceId !== void 0 ? serviceId : ""))(); + exports2.getEndpointFromConfig = getEndpointFromConfig; } }); -// ../../../node_modules/@aws-sdk/util-endpoints/dist-cjs/debug/toDebugString.js -var require_toDebugString = __commonJS({ - "../../../node_modules/@aws-sdk/util-endpoints/dist-cjs/debug/toDebugString.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.toDebugString = void 0; - function toDebugString(input) { - if (typeof input !== "object" || input == null) { - return input; - } - if ("ref" in input) { - return `$${toDebugString(input.ref)}`; +// ../../../node_modules/@smithy/core/node_modules/@smithy/querystring-parser/dist-cjs/index.js +var require_dist_cjs16 = __commonJS({ + "../../../node_modules/@smithy/core/node_modules/@smithy/querystring-parser/dist-cjs/index.js"(exports2, module2) { + var __defProp2 = Object.defineProperty; + var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; + var __getOwnPropNames2 = Object.getOwnPropertyNames; + var __hasOwnProp2 = Object.prototype.hasOwnProperty; + var __name = (target, value) => __defProp2(target, "name", { value, configurable: true }); + var __export2 = (target, all) => { + for (var name in all) + __defProp2(target, name, { get: all[name], enumerable: true }); + }; + var __copyProps2 = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames2(from)) + if (!__hasOwnProp2.call(to, key) && key !== except) + __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable }); } - if ("fn" in input) { - return `${input.fn}(${(input.argv || []).map(toDebugString).join(", ")})`; + return to; + }; + var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); + var src_exports = {}; + __export2(src_exports, { + parseQueryString: () => parseQueryString + }); + module2.exports = __toCommonJS2(src_exports); + function parseQueryString(querystring) { + const query = {}; + querystring = querystring.replace(/^\?/, ""); + if (querystring) { + for (const pair of querystring.split("&")) { + let [key, value = null] = pair.split("="); + key = decodeURIComponent(key); + if (value) { + value = decodeURIComponent(value); + } + if (!(key in query)) { + query[key] = value; + } else if (Array.isArray(query[key])) { + query[key].push(value); + } else { + query[key] = [query[key], value]; + } + } } - return JSON.stringify(input, null, 2); + return query; } - exports2.toDebugString = toDebugString; + __name(parseQueryString, "parseQueryString"); } }); -// ../../../node_modules/@aws-sdk/util-endpoints/dist-cjs/debug/index.js -var require_debug = __commonJS({ - "../../../node_modules/@aws-sdk/util-endpoints/dist-cjs/debug/index.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports)); - tslib_1.__exportStar(require_debugId(), exports2); - tslib_1.__exportStar(require_toDebugString(), exports2); +// ../../../node_modules/@smithy/core/node_modules/@smithy/url-parser/dist-cjs/index.js +var require_dist_cjs17 = __commonJS({ + "../../../node_modules/@smithy/core/node_modules/@smithy/url-parser/dist-cjs/index.js"(exports2, module2) { + var __defProp2 = Object.defineProperty; + var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; + var __getOwnPropNames2 = Object.getOwnPropertyNames; + var __hasOwnProp2 = Object.prototype.hasOwnProperty; + var __name = (target, value) => __defProp2(target, "name", { value, configurable: true }); + var __export2 = (target, all) => { + for (var name in all) + __defProp2(target, name, { get: all[name], enumerable: true }); + }; + var __copyProps2 = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames2(from)) + if (!__hasOwnProp2.call(to, key) && key !== except) + __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable }); + } + return to; + }; + var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); + var src_exports = {}; + __export2(src_exports, { + parseUrl: () => parseUrl + }); + module2.exports = __toCommonJS2(src_exports); + var import_querystring_parser = require_dist_cjs16(); + var parseUrl = /* @__PURE__ */ __name((url2) => { + if (typeof url2 === "string") { + return parseUrl(new URL(url2)); + } + const { hostname, pathname, port, protocol, search } = url2; + let query; + if (search) { + query = (0, import_querystring_parser.parseQueryString)(search); + } + return { + hostname, + port: port ? parseInt(port) : void 0, + protocol, + path: pathname, + query + }; + }, "parseUrl"); } }); -// ../../../node_modules/@aws-sdk/util-endpoints/dist-cjs/types/EndpointError.js -var require_EndpointError = __commonJS({ - "../../../node_modules/@aws-sdk/util-endpoints/dist-cjs/types/EndpointError.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.EndpointError = void 0; - var EndpointError = class extends Error { - constructor(message) { - super(message); - this.name = "EndpointError"; - } +// ../../../node_modules/@smithy/core/node_modules/@smithy/middleware-serde/dist-cjs/index.js +var require_dist_cjs18 = __commonJS({ + "../../../node_modules/@smithy/core/node_modules/@smithy/middleware-serde/dist-cjs/index.js"(exports2, module2) { + var __defProp2 = Object.defineProperty; + var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; + var __getOwnPropNames2 = Object.getOwnPropertyNames; + var __hasOwnProp2 = Object.prototype.hasOwnProperty; + var __name = (target, value) => __defProp2(target, "name", { value, configurable: true }); + var __export2 = (target, all) => { + for (var name in all) + __defProp2(target, name, { get: all[name], enumerable: true }); }; - exports2.EndpointError = EndpointError; - } -}); - -// ../../../node_modules/@aws-sdk/util-endpoints/dist-cjs/types/EndpointRuleObject.js -var require_EndpointRuleObject = __commonJS({ - "../../../node_modules/@aws-sdk/util-endpoints/dist-cjs/types/EndpointRuleObject.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - } -}); - -// ../../../node_modules/@aws-sdk/util-endpoints/dist-cjs/types/ErrorRuleObject.js -var require_ErrorRuleObject = __commonJS({ - "../../../node_modules/@aws-sdk/util-endpoints/dist-cjs/types/ErrorRuleObject.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - } -}); - -// ../../../node_modules/@aws-sdk/util-endpoints/dist-cjs/types/RuleSetObject.js -var require_RuleSetObject = __commonJS({ - "../../../node_modules/@aws-sdk/util-endpoints/dist-cjs/types/RuleSetObject.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - } -}); - -// ../../../node_modules/@aws-sdk/util-endpoints/dist-cjs/types/TreeRuleObject.js -var require_TreeRuleObject = __commonJS({ - "../../../node_modules/@aws-sdk/util-endpoints/dist-cjs/types/TreeRuleObject.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - } -}); - -// ../../../node_modules/@aws-sdk/util-endpoints/dist-cjs/types/shared.js -var require_shared = __commonJS({ - "../../../node_modules/@aws-sdk/util-endpoints/dist-cjs/types/shared.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - } -}); - -// ../../../node_modules/@aws-sdk/util-endpoints/dist-cjs/types/index.js -var require_types = __commonJS({ - "../../../node_modules/@aws-sdk/util-endpoints/dist-cjs/types/index.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports)); - tslib_1.__exportStar(require_EndpointError(), exports2); - tslib_1.__exportStar(require_EndpointRuleObject(), exports2); - tslib_1.__exportStar(require_ErrorRuleObject(), exports2); - tslib_1.__exportStar(require_RuleSetObject(), exports2); - tslib_1.__exportStar(require_TreeRuleObject(), exports2); - tslib_1.__exportStar(require_shared(), exports2); - } -}); - -// ../../../node_modules/@aws-sdk/util-endpoints/dist-cjs/lib/isValidHostLabel.js -var require_isValidHostLabel = __commonJS({ - "../../../node_modules/@aws-sdk/util-endpoints/dist-cjs/lib/isValidHostLabel.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.isValidHostLabel = void 0; - var VALID_HOST_LABEL_REGEX = new RegExp(`^(?!.*-$)(?!-)[a-zA-Z0-9-]{1,63}$`); - var isValidHostLabel = (value, allowSubDomains = false) => { - if (!allowSubDomains) { - return VALID_HOST_LABEL_REGEX.test(value); - } - const labels = value.split("."); - for (const label of labels) { - if (!(0, exports2.isValidHostLabel)(label)) { - return false; - } + var __copyProps2 = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames2(from)) + if (!__hasOwnProp2.call(to, key) && key !== except) + __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable }); } - return true; + return to; }; - exports2.isValidHostLabel = isValidHostLabel; - } -}); - -// ../../../node_modules/@aws-sdk/util-endpoints/dist-cjs/lib/aws/isVirtualHostableS3Bucket.js -var require_isVirtualHostableS3Bucket = __commonJS({ - "../../../node_modules/@aws-sdk/util-endpoints/dist-cjs/lib/aws/isVirtualHostableS3Bucket.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.isVirtualHostableS3Bucket = void 0; - var isIpAddress_1 = require_isIpAddress(); - var isValidHostLabel_1 = require_isValidHostLabel(); - var isVirtualHostableS3Bucket = (value, allowSubDomains = false) => { - if (allowSubDomains) { - for (const label of value.split(".")) { - if (!(0, exports2.isVirtualHostableS3Bucket)(label)) { - return false; + var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); + var src_exports = {}; + __export2(src_exports, { + deserializerMiddleware: () => deserializerMiddleware, + deserializerMiddlewareOption: () => deserializerMiddlewareOption, + getSerdePlugin: () => getSerdePlugin, + serializerMiddleware: () => serializerMiddleware, + serializerMiddlewareOption: () => serializerMiddlewareOption2 + }); + module2.exports = __toCommonJS2(src_exports); + var deserializerMiddleware = /* @__PURE__ */ __name((options, deserializer) => (next) => async (args) => { + const { response } = await next(args); + try { + const parsed = await deserializer(response, options); + return { + response, + output: parsed + }; + } catch (error) { + Object.defineProperty(error, "$response", { + value: response + }); + if (!("$metadata" in error)) { + const hint = `Deserialization error: to see the raw response, inspect the hidden field {error}.$response on this object.`; + error.message += "\n " + hint; + if (typeof error.$responseBodyText !== "undefined") { + if (error.$response) { + error.$response.body = error.$responseBodyText; + } } } - return true; - } - if (!(0, isValidHostLabel_1.isValidHostLabel)(value)) { - return false; - } - if (value.length < 3 || value.length > 63) { - return false; - } - if (value !== value.toLowerCase()) { - return false; + throw error; } - if ((0, isIpAddress_1.isIpAddress)(value)) { - return false; + }, "deserializerMiddleware"); + var serializerMiddleware = /* @__PURE__ */ __name((options, serializer) => (next, context) => async (args) => { + var _a; + const endpoint = ((_a = context.endpointV2) == null ? void 0 : _a.url) && options.urlParser ? async () => options.urlParser(context.endpointV2.url) : options.endpoint; + if (!endpoint) { + throw new Error("No valid endpoint provider available."); } - return true; + const request2 = await serializer(args.input, { ...options, endpoint }); + return next({ + ...args, + request: request2 + }); + }, "serializerMiddleware"); + var deserializerMiddlewareOption = { + name: "deserializerMiddleware", + step: "deserialize", + tags: ["DESERIALIZER"], + override: true }; - exports2.isVirtualHostableS3Bucket = isVirtualHostableS3Bucket; - } -}); - -// ../../../node_modules/@aws-sdk/util-endpoints/dist-cjs/lib/aws/parseArn.js -var require_parseArn = __commonJS({ - "../../../node_modules/@aws-sdk/util-endpoints/dist-cjs/lib/aws/parseArn.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.parseArn = void 0; - var parseArn = (value) => { - const segments = value.split(":"); - if (segments.length < 6) - return null; - const [arn, partition, service, region, accountId, ...resourceId] = segments; - if (arn !== "arn" || partition === "" || service === "" || resourceId[0] === "") - return null; + var serializerMiddlewareOption2 = { + name: "serializerMiddleware", + step: "serialize", + tags: ["SERIALIZER"], + override: true + }; + function getSerdePlugin(config, serializer, deserializer) { return { - partition, - service, - region, - accountId, - resourceId: resourceId[0].includes("/") ? resourceId[0].split("/") : resourceId + applyToStack: (commandStack) => { + commandStack.add(deserializerMiddleware(config, deserializer), deserializerMiddlewareOption); + commandStack.add(serializerMiddleware(config, serializer), serializerMiddlewareOption2); + } }; - }; - exports2.parseArn = parseArn; - } -}); - -// ../../../node_modules/@aws-sdk/util-endpoints/dist-cjs/lib/aws/index.js -var require_aws = __commonJS({ - "../../../node_modules/@aws-sdk/util-endpoints/dist-cjs/lib/aws/index.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports)); - tslib_1.__exportStar(require_isVirtualHostableS3Bucket(), exports2); - tslib_1.__exportStar(require_parseArn(), exports2); - tslib_1.__exportStar(require_partition(), exports2); - } -}); - -// ../../../node_modules/@aws-sdk/util-endpoints/dist-cjs/lib/booleanEquals.js -var require_booleanEquals = __commonJS({ - "../../../node_modules/@aws-sdk/util-endpoints/dist-cjs/lib/booleanEquals.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.booleanEquals = void 0; - var booleanEquals = (value1, value2) => value1 === value2; - exports2.booleanEquals = booleanEquals; + } + __name(getSerdePlugin, "getSerdePlugin"); } }); -// ../../../node_modules/@aws-sdk/util-endpoints/dist-cjs/lib/getAttrPathList.js -var require_getAttrPathList = __commonJS({ - "../../../node_modules/@aws-sdk/util-endpoints/dist-cjs/lib/getAttrPathList.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.getAttrPathList = void 0; - var types_1 = require_types(); - var getAttrPathList = (path) => { - const parts = path.split("."); - const pathList = []; - for (const part of parts) { - const squareBracketIndex = part.indexOf("["); - if (squareBracketIndex !== -1) { - if (part.indexOf("]") !== part.length - 1) { - throw new types_1.EndpointError(`Path: '${path}' does not end with ']'`); - } - const arrayIndex = part.slice(squareBracketIndex + 1, -1); - if (Number.isNaN(parseInt(arrayIndex))) { - throw new types_1.EndpointError(`Invalid array index: '${arrayIndex}' in path: '${path}'`); - } - if (squareBracketIndex !== 0) { - pathList.push(part.slice(0, squareBracketIndex)); - } - pathList.push(arrayIndex); - } else { - pathList.push(part); - } +// ../../../node_modules/@smithy/core/node_modules/@smithy/middleware-endpoint/dist-cjs/index.js +var require_dist_cjs19 = __commonJS({ + "../../../node_modules/@smithy/core/node_modules/@smithy/middleware-endpoint/dist-cjs/index.js"(exports2, module2) { + var __defProp2 = Object.defineProperty; + var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; + var __getOwnPropNames2 = Object.getOwnPropertyNames; + var __hasOwnProp2 = Object.prototype.hasOwnProperty; + var __name = (target, value) => __defProp2(target, "name", { value, configurable: true }); + var __export2 = (target, all) => { + for (var name in all) + __defProp2(target, name, { get: all[name], enumerable: true }); + }; + var __copyProps2 = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames2(from)) + if (!__hasOwnProp2.call(to, key) && key !== except) + __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable }); } - return pathList; + return to; }; - exports2.getAttrPathList = getAttrPathList; - } -}); - -// ../../../node_modules/@aws-sdk/util-endpoints/dist-cjs/lib/getAttr.js -var require_getAttr = __commonJS({ - "../../../node_modules/@aws-sdk/util-endpoints/dist-cjs/lib/getAttr.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.getAttr = void 0; - var types_1 = require_types(); - var getAttrPathList_1 = require_getAttrPathList(); - var getAttr = (value, path) => (0, getAttrPathList_1.getAttrPathList)(path).reduce((acc, index) => { - if (typeof acc !== "object") { - throw new types_1.EndpointError(`Index '${index}' in '${path}' not found in '${JSON.stringify(value)}'`); - } else if (Array.isArray(acc)) { - return acc[parseInt(index)]; + var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); + var src_exports = {}; + __export2(src_exports, { + endpointMiddleware: () => endpointMiddleware, + endpointMiddlewareOptions: () => endpointMiddlewareOptions2, + getEndpointFromInstructions: () => getEndpointFromInstructions, + getEndpointPlugin: () => getEndpointPlugin, + resolveEndpointConfig: () => resolveEndpointConfig, + resolveParams: () => resolveParams, + toEndpointV1: () => toEndpointV1 + }); + module2.exports = __toCommonJS2(src_exports); + var resolveParamsForS3 = /* @__PURE__ */ __name(async (endpointParams) => { + const bucket = (endpointParams == null ? void 0 : endpointParams.Bucket) || ""; + if (typeof endpointParams.Bucket === "string") { + endpointParams.Bucket = bucket.replace(/#/g, encodeURIComponent("#")).replace(/\?/g, encodeURIComponent("?")); } - return acc[index]; - }, value); - exports2.getAttr = getAttr; - } -}); - -// ../../../node_modules/@aws-sdk/util-endpoints/dist-cjs/lib/isSet.js -var require_isSet = __commonJS({ - "../../../node_modules/@aws-sdk/util-endpoints/dist-cjs/lib/isSet.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.isSet = void 0; - var isSet = (value) => value != null; - exports2.isSet = isSet; - } -}); - -// ../../../node_modules/@aws-sdk/util-endpoints/dist-cjs/lib/not.js -var require_not = __commonJS({ - "../../../node_modules/@aws-sdk/util-endpoints/dist-cjs/lib/not.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.not = void 0; - var not = (value) => !value; - exports2.not = not; - } -}); - -// ../../../node_modules/@aws-sdk/types/dist-cjs/abort.js -var require_abort = __commonJS({ - "../../../node_modules/@aws-sdk/types/dist-cjs/abort.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - } -}); - -// ../../../node_modules/@aws-sdk/types/dist-cjs/auth.js -var require_auth = __commonJS({ - "../../../node_modules/@aws-sdk/types/dist-cjs/auth.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.HttpAuthLocation = void 0; - var types_1 = require_dist_cjs(); - Object.defineProperty(exports2, "HttpAuthLocation", { enumerable: true, get: function() { - return types_1.HttpAuthLocation; - } }); - } -}); - -// ../../../node_modules/@aws-sdk/types/dist-cjs/blob/blob-types.js -var require_blob_types = __commonJS({ - "../../../node_modules/@aws-sdk/types/dist-cjs/blob/blob-types.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - } -}); - -// ../../../node_modules/@aws-sdk/types/dist-cjs/checksum.js -var require_checksum = __commonJS({ - "../../../node_modules/@aws-sdk/types/dist-cjs/checksum.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - } -}); - -// ../../../node_modules/@aws-sdk/types/dist-cjs/client.js -var require_client = __commonJS({ - "../../../node_modules/@aws-sdk/types/dist-cjs/client.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - } -}); - -// ../../../node_modules/@aws-sdk/types/dist-cjs/command.js -var require_command = __commonJS({ - "../../../node_modules/@aws-sdk/types/dist-cjs/command.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - } -}); - -// ../../../node_modules/@aws-sdk/types/dist-cjs/connection.js -var require_connection = __commonJS({ - "../../../node_modules/@aws-sdk/types/dist-cjs/connection.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - } -}); - -// ../../../node_modules/@aws-sdk/types/dist-cjs/credentials.js -var require_credentials = __commonJS({ - "../../../node_modules/@aws-sdk/types/dist-cjs/credentials.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - } -}); - -// ../../../node_modules/@aws-sdk/types/dist-cjs/crypto.js -var require_crypto = __commonJS({ - "../../../node_modules/@aws-sdk/types/dist-cjs/crypto.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - } -}); - -// ../../../node_modules/@aws-sdk/types/dist-cjs/dns.js -var require_dns = __commonJS({ - "../../../node_modules/@aws-sdk/types/dist-cjs/dns.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.HostAddressType = void 0; - var HostAddressType; - (function(HostAddressType2) { - HostAddressType2["AAAA"] = "AAAA"; - HostAddressType2["A"] = "A"; - })(HostAddressType = exports2.HostAddressType || (exports2.HostAddressType = {})); - } -}); - -// ../../../node_modules/@aws-sdk/types/dist-cjs/encode.js -var require_encode = __commonJS({ - "../../../node_modules/@aws-sdk/types/dist-cjs/encode.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - } -}); - -// ../../../node_modules/@aws-sdk/types/dist-cjs/endpoint.js -var require_endpoint = __commonJS({ - "../../../node_modules/@aws-sdk/types/dist-cjs/endpoint.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.EndpointURLScheme = void 0; - var types_1 = require_dist_cjs(); - Object.defineProperty(exports2, "EndpointURLScheme", { enumerable: true, get: function() { - return types_1.EndpointURLScheme; - } }); - } -}); - -// ../../../node_modules/@aws-sdk/types/dist-cjs/eventStream.js -var require_eventStream = __commonJS({ - "../../../node_modules/@aws-sdk/types/dist-cjs/eventStream.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - } -}); - -// ../../../node_modules/@aws-sdk/types/dist-cjs/extensions/index.js -var require_extensions = __commonJS({ - "../../../node_modules/@aws-sdk/types/dist-cjs/extensions/index.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); + if (isArnBucketName(bucket)) { + if (endpointParams.ForcePathStyle === true) { + throw new Error("Path-style addressing cannot be used with ARN buckets"); + } + } else if (!isDnsCompatibleBucketName(bucket) || bucket.indexOf(".") !== -1 && !String(endpointParams.Endpoint).startsWith("http:") || bucket.toLowerCase() !== bucket || bucket.length < 3) { + endpointParams.ForcePathStyle = true; + } + if (endpointParams.DisableMultiRegionAccessPoints) { + endpointParams.disableMultiRegionAccessPoints = true; + endpointParams.DisableMRAP = true; + } + return endpointParams; + }, "resolveParamsForS3"); + var DOMAIN_PATTERN = /^[a-z0-9][a-z0-9\.\-]{1,61}[a-z0-9]$/; + var IP_ADDRESS_PATTERN = /(\d+\.){3}\d+/; + var DOTS_PATTERN = /\.\./; + var isDnsCompatibleBucketName = /* @__PURE__ */ __name((bucketName) => DOMAIN_PATTERN.test(bucketName) && !IP_ADDRESS_PATTERN.test(bucketName) && !DOTS_PATTERN.test(bucketName), "isDnsCompatibleBucketName"); + var isArnBucketName = /* @__PURE__ */ __name((bucketName) => { + const [arn, partition, service, , , bucket] = bucketName.split(":"); + const isArn = arn === "arn" && bucketName.split(":").length >= 6; + const isValidArn = Boolean(isArn && partition && service && bucket); + if (isArn && !isValidArn) { + throw new Error(`Invalid ARN: ${bucketName} was an invalid ARN.`); + } + return isValidArn; + }, "isArnBucketName"); + var createConfigValueProvider = /* @__PURE__ */ __name((configKey, canonicalEndpointParamKey, config) => { + const configProvider = /* @__PURE__ */ __name(async () => { + const configValue = config[configKey] ?? config[canonicalEndpointParamKey]; + if (typeof configValue === "function") { + return configValue(); + } + return configValue; + }, "configProvider"); + if (configKey === "credentialScope" || canonicalEndpointParamKey === "CredentialScope") { + return async () => { + const credentials = typeof config.credentials === "function" ? await config.credentials() : config.credentials; + const configValue = (credentials == null ? void 0 : credentials.credentialScope) ?? (credentials == null ? void 0 : credentials.CredentialScope); + return configValue; + }; + } + if (configKey === "accountId" || canonicalEndpointParamKey === "AccountId") { + return async () => { + const credentials = typeof config.credentials === "function" ? await config.credentials() : config.credentials; + const configValue = (credentials == null ? void 0 : credentials.accountId) ?? (credentials == null ? void 0 : credentials.AccountId); + return configValue; + }; + } + if (configKey === "endpoint" || canonicalEndpointParamKey === "endpoint") { + return async () => { + const endpoint = await configProvider(); + if (endpoint && typeof endpoint === "object") { + if ("url" in endpoint) { + return endpoint.url.href; + } + if ("hostname" in endpoint) { + const { protocol, hostname, port, path } = endpoint; + return `${protocol}//${hostname}${port ? ":" + port : ""}${path}`; + } + } + return endpoint; + }; + } + return configProvider; + }, "createConfigValueProvider"); + var import_getEndpointFromConfig = require_getEndpointFromConfig(); + var import_url_parser = require_dist_cjs17(); + var toEndpointV1 = /* @__PURE__ */ __name((endpoint) => { + if (typeof endpoint === "object") { + if ("url" in endpoint) { + return (0, import_url_parser.parseUrl)(endpoint.url); + } + return endpoint; + } + return (0, import_url_parser.parseUrl)(endpoint); + }, "toEndpointV1"); + var getEndpointFromInstructions = /* @__PURE__ */ __name(async (commandInput, instructionsSupplier, clientConfig, context) => { + if (!clientConfig.endpoint) { + let endpointFromConfig; + if (clientConfig.serviceConfiguredEndpoint) { + endpointFromConfig = await clientConfig.serviceConfiguredEndpoint(); + } else { + endpointFromConfig = await (0, import_getEndpointFromConfig.getEndpointFromConfig)(clientConfig.serviceId); + } + if (endpointFromConfig) { + clientConfig.endpoint = () => Promise.resolve(toEndpointV1(endpointFromConfig)); + } + } + const endpointParams = await resolveParams(commandInput, instructionsSupplier, clientConfig); + if (typeof clientConfig.endpointProvider !== "function") { + throw new Error("config.endpointProvider is not set."); + } + const endpoint = clientConfig.endpointProvider(endpointParams, context); + return endpoint; + }, "getEndpointFromInstructions"); + var resolveParams = /* @__PURE__ */ __name(async (commandInput, instructionsSupplier, clientConfig) => { + var _a; + const endpointParams = {}; + const instructions = ((_a = instructionsSupplier == null ? void 0 : instructionsSupplier.getEndpointParameterInstructions) == null ? void 0 : _a.call(instructionsSupplier)) || {}; + for (const [name, instruction] of Object.entries(instructions)) { + switch (instruction.type) { + case "staticContextParams": + endpointParams[name] = instruction.value; + break; + case "contextParams": + endpointParams[name] = commandInput[instruction.name]; + break; + case "clientContextParams": + case "builtInParams": + endpointParams[name] = await createConfigValueProvider(instruction.name, name, clientConfig)(); + break; + default: + throw new Error("Unrecognized endpoint parameter instruction: " + JSON.stringify(instruction)); + } + } + if (Object.keys(instructions).length === 0) { + Object.assign(endpointParams, clientConfig); + } + if (String(clientConfig.serviceId).toLowerCase() === "s3") { + await resolveParamsForS3(endpointParams); + } + return endpointParams; + }, "resolveParams"); + var import_util_middleware3 = require_dist_cjs12(); + var endpointMiddleware = /* @__PURE__ */ __name(({ + config, + instructions + }) => { + return (next, context) => async (args) => { + var _a, _b, _c; + const endpoint = await getEndpointFromInstructions( + args.input, + { + getEndpointParameterInstructions() { + return instructions; + } + }, + { ...config }, + context + ); + context.endpointV2 = endpoint; + context.authSchemes = (_a = endpoint.properties) == null ? void 0 : _a.authSchemes; + const authScheme = (_b = context.authSchemes) == null ? void 0 : _b[0]; + if (authScheme) { + context["signing_region"] = authScheme.signingRegion; + context["signing_service"] = authScheme.signingName; + const smithyContext = (0, import_util_middleware3.getSmithyContext)(context); + const httpAuthOption = (_c = smithyContext == null ? void 0 : smithyContext.selectedHttpAuthScheme) == null ? void 0 : _c.httpAuthOption; + if (httpAuthOption) { + httpAuthOption.signingProperties = Object.assign( + httpAuthOption.signingProperties || {}, + { + signing_region: authScheme.signingRegion, + signingRegion: authScheme.signingRegion, + signing_service: authScheme.signingName, + signingName: authScheme.signingName, + signingRegionSet: authScheme.signingRegionSet + }, + authScheme.properties + ); + } + } + return next({ + ...args + }); + }; + }, "endpointMiddleware"); + var import_middleware_serde2 = require_dist_cjs18(); + var endpointMiddlewareOptions2 = { + step: "serialize", + tags: ["ENDPOINT_PARAMETERS", "ENDPOINT_V2", "ENDPOINT"], + name: "endpointV2Middleware", + override: true, + relation: "before", + toMiddleware: import_middleware_serde2.serializerMiddlewareOption.name + }; + var getEndpointPlugin = /* @__PURE__ */ __name((config, instructions) => ({ + applyToStack: (clientStack) => { + clientStack.addRelativeTo( + endpointMiddleware({ + config, + instructions + }), + endpointMiddlewareOptions2 + ); + } + }), "getEndpointPlugin"); + var import_getEndpointFromConfig2 = require_getEndpointFromConfig(); + var resolveEndpointConfig = /* @__PURE__ */ __name((input) => { + const tls = input.tls ?? true; + const { endpoint } = input; + const customEndpointProvider = endpoint != null ? async () => toEndpointV1(await (0, import_util_middleware3.normalizeProvider)(endpoint)()) : void 0; + const isCustomEndpoint = !!endpoint; + const resolvedConfig = { + ...input, + endpoint: customEndpointProvider, + tls, + isCustomEndpoint, + useDualstackEndpoint: (0, import_util_middleware3.normalizeProvider)(input.useDualstackEndpoint ?? false), + useFipsEndpoint: (0, import_util_middleware3.normalizeProvider)(input.useFipsEndpoint ?? false) + }; + let configuredEndpointPromise = void 0; + resolvedConfig.serviceConfiguredEndpoint = async () => { + if (input.serviceId && !configuredEndpointPromise) { + configuredEndpointPromise = (0, import_getEndpointFromConfig2.getEndpointFromConfig)(input.serviceId); + } + return configuredEndpointPromise; + }; + return resolvedConfig; + }, "resolveEndpointConfig"); } }); -// ../../../node_modules/@aws-sdk/types/dist-cjs/http.js -var require_http = __commonJS({ - "../../../node_modules/@aws-sdk/types/dist-cjs/http.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); +// ../../../node_modules/@smithy/core/dist-es/middleware-http-auth-scheme/getHttpAuthSchemeEndpointRuleSetPlugin.js +var import_middleware_endpoint, httpAuthSchemeEndpointRuleSetMiddlewareOptions, getHttpAuthSchemeEndpointRuleSetPlugin; +var init_getHttpAuthSchemeEndpointRuleSetPlugin = __esm({ + "../../../node_modules/@smithy/core/dist-es/middleware-http-auth-scheme/getHttpAuthSchemeEndpointRuleSetPlugin.js"() { + import_middleware_endpoint = __toESM(require_dist_cjs19()); + init_httpAuthSchemeMiddleware(); + httpAuthSchemeEndpointRuleSetMiddlewareOptions = { + step: "serialize", + tags: ["HTTP_AUTH_SCHEME"], + name: "httpAuthSchemeMiddleware", + override: true, + relation: "before", + toMiddleware: import_middleware_endpoint.endpointMiddlewareOptions.name + }; + getHttpAuthSchemeEndpointRuleSetPlugin = (config, { httpAuthSchemeParametersProvider, identityProviderConfigProvider }) => ({ + applyToStack: (clientStack) => { + clientStack.addRelativeTo(httpAuthSchemeMiddleware(config, { + httpAuthSchemeParametersProvider, + identityProviderConfigProvider + }), httpAuthSchemeEndpointRuleSetMiddlewareOptions); + } + }); } }); -// ../../../node_modules/@aws-sdk/types/dist-cjs/identity/AnonymousIdentity.js -var require_AnonymousIdentity = __commonJS({ - "../../../node_modules/@aws-sdk/types/dist-cjs/identity/AnonymousIdentity.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); +// ../../../node_modules/@smithy/core/dist-es/middleware-http-auth-scheme/getHttpAuthSchemePlugin.js +var import_middleware_serde, httpAuthSchemeMiddlewareOptions, getHttpAuthSchemePlugin; +var init_getHttpAuthSchemePlugin = __esm({ + "../../../node_modules/@smithy/core/dist-es/middleware-http-auth-scheme/getHttpAuthSchemePlugin.js"() { + import_middleware_serde = __toESM(require_dist_cjs18()); + init_httpAuthSchemeMiddleware(); + httpAuthSchemeMiddlewareOptions = { + step: "serialize", + tags: ["HTTP_AUTH_SCHEME"], + name: "httpAuthSchemeMiddleware", + override: true, + relation: "before", + toMiddleware: import_middleware_serde.serializerMiddlewareOption.name + }; + getHttpAuthSchemePlugin = (config, { httpAuthSchemeParametersProvider, identityProviderConfigProvider }) => ({ + applyToStack: (clientStack) => { + clientStack.addRelativeTo(httpAuthSchemeMiddleware(config, { + httpAuthSchemeParametersProvider, + identityProviderConfigProvider + }), httpAuthSchemeMiddlewareOptions); + } + }); } }); -// ../../../node_modules/@aws-sdk/types/dist-cjs/identity/AwsCredentialIdentity.js -var require_AwsCredentialIdentity = __commonJS({ - "../../../node_modules/@aws-sdk/types/dist-cjs/identity/AwsCredentialIdentity.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); +// ../../../node_modules/@smithy/core/dist-es/middleware-http-auth-scheme/index.js +var init_middleware_http_auth_scheme = __esm({ + "../../../node_modules/@smithy/core/dist-es/middleware-http-auth-scheme/index.js"() { + init_httpAuthSchemeMiddleware(); + init_getHttpAuthSchemeEndpointRuleSetPlugin(); + init_getHttpAuthSchemePlugin(); } }); -// ../../../node_modules/@aws-sdk/types/dist-cjs/identity/Identity.js -var require_Identity = __commonJS({ - "../../../node_modules/@aws-sdk/types/dist-cjs/identity/Identity.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - } -}); - -// ../../../node_modules/@aws-sdk/types/dist-cjs/identity/LoginIdentity.js -var require_LoginIdentity = __commonJS({ - "../../../node_modules/@aws-sdk/types/dist-cjs/identity/LoginIdentity.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - } -}); - -// ../../../node_modules/@aws-sdk/types/dist-cjs/identity/TokenIdentity.js -var require_TokenIdentity = __commonJS({ - "../../../node_modules/@aws-sdk/types/dist-cjs/identity/TokenIdentity.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - } -}); - -// ../../../node_modules/@aws-sdk/types/dist-cjs/identity/index.js -var require_identity = __commonJS({ - "../../../node_modules/@aws-sdk/types/dist-cjs/identity/index.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports)); - tslib_1.__exportStar(require_AnonymousIdentity(), exports2); - tslib_1.__exportStar(require_AwsCredentialIdentity(), exports2); - tslib_1.__exportStar(require_Identity(), exports2); - tslib_1.__exportStar(require_LoginIdentity(), exports2); - tslib_1.__exportStar(require_TokenIdentity(), exports2); - } -}); - -// ../../../node_modules/@aws-sdk/types/dist-cjs/logger.js -var require_logger = __commonJS({ - "../../../node_modules/@aws-sdk/types/dist-cjs/logger.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - } -}); - -// ../../../node_modules/@aws-sdk/types/dist-cjs/middleware.js -var require_middleware = __commonJS({ - "../../../node_modules/@aws-sdk/types/dist-cjs/middleware.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - } -}); - -// ../../../node_modules/@aws-sdk/types/dist-cjs/pagination.js -var require_pagination = __commonJS({ - "../../../node_modules/@aws-sdk/types/dist-cjs/pagination.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - } -}); - -// ../../../node_modules/@aws-sdk/types/dist-cjs/profile.js -var require_profile = __commonJS({ - "../../../node_modules/@aws-sdk/types/dist-cjs/profile.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - } -}); - -// ../../../node_modules/@aws-sdk/types/dist-cjs/request.js -var require_request = __commonJS({ - "../../../node_modules/@aws-sdk/types/dist-cjs/request.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - } -}); - -// ../../../node_modules/@aws-sdk/types/dist-cjs/response.js -var require_response = __commonJS({ - "../../../node_modules/@aws-sdk/types/dist-cjs/response.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - } -}); - -// ../../../node_modules/@aws-sdk/types/dist-cjs/retry.js -var require_retry = __commonJS({ - "../../../node_modules/@aws-sdk/types/dist-cjs/retry.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - } -}); - -// ../../../node_modules/@aws-sdk/types/dist-cjs/serde.js -var require_serde = __commonJS({ - "../../../node_modules/@aws-sdk/types/dist-cjs/serde.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - } -}); - -// ../../../node_modules/@aws-sdk/types/dist-cjs/shapes.js -var require_shapes = __commonJS({ - "../../../node_modules/@aws-sdk/types/dist-cjs/shapes.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - } -}); - -// ../../../node_modules/@aws-sdk/types/dist-cjs/signature.js -var require_signature = __commonJS({ - "../../../node_modules/@aws-sdk/types/dist-cjs/signature.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - } -}); - -// ../../../node_modules/@aws-sdk/types/dist-cjs/stream.js -var require_stream = __commonJS({ - "../../../node_modules/@aws-sdk/types/dist-cjs/stream.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - } -}); - -// ../../../node_modules/@aws-sdk/types/dist-cjs/token.js -var require_token = __commonJS({ - "../../../node_modules/@aws-sdk/types/dist-cjs/token.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - } -}); - -// ../../../node_modules/@aws-sdk/types/dist-cjs/transfer.js -var require_transfer = __commonJS({ - "../../../node_modules/@aws-sdk/types/dist-cjs/transfer.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.RequestHandlerProtocol = void 0; - var types_1 = require_dist_cjs(); - Object.defineProperty(exports2, "RequestHandlerProtocol", { enumerable: true, get: function() { - return types_1.RequestHandlerProtocol; - } }); - } -}); - -// ../../../node_modules/@aws-sdk/types/dist-cjs/uri.js -var require_uri = __commonJS({ - "../../../node_modules/@aws-sdk/types/dist-cjs/uri.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - } -}); - -// ../../../node_modules/@aws-sdk/types/dist-cjs/util.js -var require_util = __commonJS({ - "../../../node_modules/@aws-sdk/types/dist-cjs/util.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - } -}); - -// ../../../node_modules/@aws-sdk/types/dist-cjs/waiter.js -var require_waiter = __commonJS({ - "../../../node_modules/@aws-sdk/types/dist-cjs/waiter.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - } -}); - -// ../../../node_modules/@aws-sdk/types/dist-cjs/index.js -var require_dist_cjs15 = __commonJS({ - "../../../node_modules/@aws-sdk/types/dist-cjs/index.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports)); - tslib_1.__exportStar(require_abort(), exports2); - tslib_1.__exportStar(require_auth(), exports2); - tslib_1.__exportStar(require_blob_types(), exports2); - tslib_1.__exportStar(require_checksum(), exports2); - tslib_1.__exportStar(require_client(), exports2); - tslib_1.__exportStar(require_command(), exports2); - tslib_1.__exportStar(require_connection(), exports2); - tslib_1.__exportStar(require_credentials(), exports2); - tslib_1.__exportStar(require_crypto(), exports2); - tslib_1.__exportStar(require_dns(), exports2); - tslib_1.__exportStar(require_encode(), exports2); - tslib_1.__exportStar(require_endpoint(), exports2); - tslib_1.__exportStar(require_eventStream(), exports2); - tslib_1.__exportStar(require_extensions(), exports2); - tslib_1.__exportStar(require_http(), exports2); - tslib_1.__exportStar(require_identity(), exports2); - tslib_1.__exportStar(require_logger(), exports2); - tslib_1.__exportStar(require_middleware(), exports2); - tslib_1.__exportStar(require_pagination(), exports2); - tslib_1.__exportStar(require_profile(), exports2); - tslib_1.__exportStar(require_request(), exports2); - tslib_1.__exportStar(require_response(), exports2); - tslib_1.__exportStar(require_retry(), exports2); - tslib_1.__exportStar(require_serde(), exports2); - tslib_1.__exportStar(require_shapes(), exports2); - tslib_1.__exportStar(require_signature(), exports2); - tslib_1.__exportStar(require_stream(), exports2); - tslib_1.__exportStar(require_token(), exports2); - tslib_1.__exportStar(require_transfer(), exports2); - tslib_1.__exportStar(require_uri(), exports2); - tslib_1.__exportStar(require_util(), exports2); - tslib_1.__exportStar(require_waiter(), exports2); - } -}); - -// ../../../node_modules/@aws-sdk/util-endpoints/dist-cjs/lib/parseURL.js -var require_parseURL = __commonJS({ - "../../../node_modules/@aws-sdk/util-endpoints/dist-cjs/lib/parseURL.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.parseURL = void 0; - var types_1 = require_dist_cjs15(); - var isIpAddress_1 = require_isIpAddress(); - var DEFAULT_PORTS = { - [types_1.EndpointURLScheme.HTTP]: 80, - [types_1.EndpointURLScheme.HTTPS]: 443 +// ../../../node_modules/@smithy/core/node_modules/@smithy/protocol-http/dist-cjs/index.js +var require_dist_cjs20 = __commonJS({ + "../../../node_modules/@smithy/core/node_modules/@smithy/protocol-http/dist-cjs/index.js"(exports2, module2) { + var __defProp2 = Object.defineProperty; + var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; + var __getOwnPropNames2 = Object.getOwnPropertyNames; + var __hasOwnProp2 = Object.prototype.hasOwnProperty; + var __name = (target, value) => __defProp2(target, "name", { value, configurable: true }); + var __export2 = (target, all) => { + for (var name in all) + __defProp2(target, name, { get: all[name], enumerable: true }); }; - var parseURL = (value) => { - const whatwgURL = (() => { - try { - if (value instanceof URL) { - return value; - } - if (typeof value === "object" && "hostname" in value) { - const { hostname: hostname2, port, protocol: protocol2 = "", path = "", query = {} } = value; - const url2 = new URL(`${protocol2}//${hostname2}${port ? `:${port}` : ""}${path}`); - url2.search = Object.entries(query).map(([k, v]) => `${k}=${v}`).join("&"); - return url2; - } - return new URL(value); - } catch (error) { - return null; + var __copyProps2 = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames2(from)) + if (!__hasOwnProp2.call(to, key) && key !== except) + __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable }); + } + return to; + }; + var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); + var src_exports = {}; + __export2(src_exports, { + Field: () => Field, + Fields: () => Fields, + HttpRequest: () => HttpRequest7, + HttpResponse: () => HttpResponse2, + IHttpRequest: () => import_types5.HttpRequest, + getHttpHandlerExtensionConfiguration: () => getHttpHandlerExtensionConfiguration, + isValidHostname: () => isValidHostname, + resolveHttpHandlerRuntimeConfig: () => resolveHttpHandlerRuntimeConfig + }); + module2.exports = __toCommonJS2(src_exports); + var getHttpHandlerExtensionConfiguration = /* @__PURE__ */ __name((runtimeConfig) => { + let httpHandler = runtimeConfig.httpHandler; + return { + setHttpHandler(handler2) { + httpHandler = handler2; + }, + httpHandler() { + return httpHandler; + }, + updateHttpClientConfig(key, value) { + httpHandler.updateHttpClientConfig(key, value); + }, + httpHandlerConfigs() { + return httpHandler.httpHandlerConfigs(); } - })(); - if (!whatwgURL) { - console.error(`Unable to parse ${JSON.stringify(value)} as a whatwg URL.`); - return null; + }; + }, "getHttpHandlerExtensionConfiguration"); + var resolveHttpHandlerRuntimeConfig = /* @__PURE__ */ __name((httpHandlerExtensionConfiguration) => { + return { + httpHandler: httpHandlerExtensionConfiguration.httpHandler() + }; + }, "resolveHttpHandlerRuntimeConfig"); + var import_types5 = require_dist_cjs(); + var _Field = class _Field { + constructor({ name, kind = import_types5.FieldPosition.HEADER, values = [] }) { + this.name = name; + this.kind = kind; + this.values = values; } - const urlString = whatwgURL.href; - const { host, hostname, pathname, protocol, search } = whatwgURL; - if (search) { - return null; + /** + * Appends a value to the field. + * + * @param value The value to append. + */ + add(value) { + this.values.push(value); } - const scheme = protocol.slice(0, -1); - if (!Object.values(types_1.EndpointURLScheme).includes(scheme)) { - return null; + /** + * Overwrite existing field values. + * + * @param values The new field values. + */ + set(values) { + this.values = values; } - const isIp = (0, isIpAddress_1.isIpAddress)(hostname); - const inputContainsDefaultPort = urlString.includes(`${host}:${DEFAULT_PORTS[scheme]}`) || typeof value === "string" && value.includes(`${host}:${DEFAULT_PORTS[scheme]}`); - const authority = `${host}${inputContainsDefaultPort ? `:${DEFAULT_PORTS[scheme]}` : ``}`; - return { - scheme, - authority, - path: pathname, - normalizedPath: pathname.endsWith("/") ? pathname : `${pathname}/`, - isIp - }; - }; - exports2.parseURL = parseURL; - } -}); - -// ../../../node_modules/@aws-sdk/util-endpoints/dist-cjs/lib/stringEquals.js -var require_stringEquals = __commonJS({ - "../../../node_modules/@aws-sdk/util-endpoints/dist-cjs/lib/stringEquals.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.stringEquals = void 0; - var stringEquals = (value1, value2) => value1 === value2; - exports2.stringEquals = stringEquals; - } -}); - -// ../../../node_modules/@aws-sdk/util-endpoints/dist-cjs/lib/substring.js -var require_substring = __commonJS({ - "../../../node_modules/@aws-sdk/util-endpoints/dist-cjs/lib/substring.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.substring = void 0; - var substring = (input, start, stop, reverse) => { - if (start >= stop || input.length < stop) { - return null; + /** + * Remove all matching entries from list. + * + * @param value Value to remove. + */ + remove(value) { + this.values = this.values.filter((v) => v !== value); } - if (!reverse) { - return input.substring(start, stop); + /** + * Get comma-delimited string. + * + * @returns String representation of {@link Field}. + */ + toString() { + return this.values.map((v) => v.includes(",") || v.includes(" ") ? `"${v}"` : v).join(", "); + } + /** + * Get string values as a list + * + * @returns Values in {@link Field} as a list. + */ + get() { + return this.values; } - return input.substring(input.length - stop, input.length - start); }; - exports2.substring = substring; - } -}); - -// ../../../node_modules/@aws-sdk/util-endpoints/dist-cjs/lib/uriEncode.js -var require_uriEncode = __commonJS({ - "../../../node_modules/@aws-sdk/util-endpoints/dist-cjs/lib/uriEncode.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.uriEncode = void 0; - var uriEncode = (value) => encodeURIComponent(value).replace(/[!*'()]/g, (c) => `%${c.charCodeAt(0).toString(16).toUpperCase()}`); - exports2.uriEncode = uriEncode; - } -}); - -// ../../../node_modules/@aws-sdk/util-endpoints/dist-cjs/lib/index.js -var require_lib = __commonJS({ - "../../../node_modules/@aws-sdk/util-endpoints/dist-cjs/lib/index.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.aws = void 0; - var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports)); - exports2.aws = tslib_1.__importStar(require_aws()); - tslib_1.__exportStar(require_booleanEquals(), exports2); - tslib_1.__exportStar(require_getAttr(), exports2); - tslib_1.__exportStar(require_isSet(), exports2); - tslib_1.__exportStar(require_isValidHostLabel(), exports2); - tslib_1.__exportStar(require_not(), exports2); - tslib_1.__exportStar(require_parseURL(), exports2); - tslib_1.__exportStar(require_stringEquals(), exports2); - tslib_1.__exportStar(require_substring(), exports2); - tslib_1.__exportStar(require_uriEncode(), exports2); - } -}); - -// ../../../node_modules/@aws-sdk/util-endpoints/dist-cjs/utils/evaluateTemplate.js -var require_evaluateTemplate = __commonJS({ - "../../../node_modules/@aws-sdk/util-endpoints/dist-cjs/utils/evaluateTemplate.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.evaluateTemplate = void 0; - var lib_1 = require_lib(); - var evaluateTemplate = (template, options) => { - const evaluatedTemplateArr = []; - const templateContext = { - ...options.endpointParams, - ...options.referenceRecord - }; - let currentIndex = 0; - while (currentIndex < template.length) { - const openingBraceIndex = template.indexOf("{", currentIndex); - if (openingBraceIndex === -1) { - evaluatedTemplateArr.push(template.slice(currentIndex)); - break; - } - evaluatedTemplateArr.push(template.slice(currentIndex, openingBraceIndex)); - const closingBraceIndex = template.indexOf("}", openingBraceIndex); - if (closingBraceIndex === -1) { - evaluatedTemplateArr.push(template.slice(openingBraceIndex)); - break; - } - if (template[openingBraceIndex + 1] === "{" && template[closingBraceIndex + 1] === "}") { - evaluatedTemplateArr.push(template.slice(openingBraceIndex + 1, closingBraceIndex)); - currentIndex = closingBraceIndex + 2; - } - const parameterName = template.substring(openingBraceIndex + 1, closingBraceIndex); - if (parameterName.includes("#")) { - const [refName, attrName] = parameterName.split("#"); - evaluatedTemplateArr.push((0, lib_1.getAttr)(templateContext[refName], attrName)); - } else { - evaluatedTemplateArr.push(templateContext[parameterName]); - } - currentIndex = closingBraceIndex + 1; + __name(_Field, "Field"); + var Field = _Field; + var _Fields = class _Fields { + constructor({ fields = [], encoding = "utf-8" }) { + this.entries = {}; + fields.forEach(this.setField.bind(this)); + this.encoding = encoding; } - return evaluatedTemplateArr.join(""); - }; - exports2.evaluateTemplate = evaluateTemplate; - } -}); - -// ../../../node_modules/@aws-sdk/util-endpoints/dist-cjs/utils/getReferenceValue.js -var require_getReferenceValue = __commonJS({ - "../../../node_modules/@aws-sdk/util-endpoints/dist-cjs/utils/getReferenceValue.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.getReferenceValue = void 0; - var getReferenceValue = ({ ref }, options) => { - const referenceRecord = { - ...options.endpointParams, - ...options.referenceRecord - }; - return referenceRecord[ref]; - }; - exports2.getReferenceValue = getReferenceValue; - } -}); - -// ../../../node_modules/@aws-sdk/util-endpoints/dist-cjs/utils/evaluateExpression.js -var require_evaluateExpression = __commonJS({ - "../../../node_modules/@aws-sdk/util-endpoints/dist-cjs/utils/evaluateExpression.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.evaluateExpression = void 0; - var types_1 = require_types(); - var callFunction_1 = require_callFunction(); - var evaluateTemplate_1 = require_evaluateTemplate(); - var getReferenceValue_1 = require_getReferenceValue(); - var evaluateExpression = (obj, keyName, options) => { - if (typeof obj === "string") { - return (0, evaluateTemplate_1.evaluateTemplate)(obj, options); - } else if (obj["fn"]) { - return (0, callFunction_1.callFunction)(obj, options); - } else if (obj["ref"]) { - return (0, getReferenceValue_1.getReferenceValue)(obj, options); + /** + * Set entry for a {@link Field} name. The `name` + * attribute will be used to key the collection. + * + * @param field The {@link Field} to set. + */ + setField(field) { + this.entries[field.name.toLowerCase()] = field; } - throw new types_1.EndpointError(`'${keyName}': ${String(obj)} is not a string, function or reference.`); - }; - exports2.evaluateExpression = evaluateExpression; - } -}); - -// ../../../node_modules/@aws-sdk/util-endpoints/dist-cjs/utils/callFunction.js -var require_callFunction = __commonJS({ - "../../../node_modules/@aws-sdk/util-endpoints/dist-cjs/utils/callFunction.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.callFunction = void 0; - var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports)); - var lib = tslib_1.__importStar(require_lib()); - var evaluateExpression_1 = require_evaluateExpression(); - var callFunction = ({ fn, argv }, options) => { - const evaluatedArgs = argv.map((arg) => ["boolean", "number"].includes(typeof arg) ? arg : (0, evaluateExpression_1.evaluateExpression)(arg, "arg", options)); - return fn.split(".").reduce((acc, key) => acc[key], lib)(...evaluatedArgs); - }; - exports2.callFunction = callFunction; - } -}); - -// ../../../node_modules/@aws-sdk/util-endpoints/dist-cjs/utils/evaluateCondition.js -var require_evaluateCondition = __commonJS({ - "../../../node_modules/@aws-sdk/util-endpoints/dist-cjs/utils/evaluateCondition.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.evaluateCondition = void 0; - var debug_1 = require_debug(); - var types_1 = require_types(); - var callFunction_1 = require_callFunction(); - var evaluateCondition = ({ assign, ...fnArgs }, options) => { - var _a, _b; - if (assign && assign in options.referenceRecord) { - throw new types_1.EndpointError(`'${assign}' is already defined in Reference Record.`); + /** + * Retrieve {@link Field} entry by name. + * + * @param name The name of the {@link Field} entry + * to retrieve + * @returns The {@link Field} if it exists. + */ + getField(name) { + return this.entries[name.toLowerCase()]; + } + /** + * Delete entry from collection. + * + * @param name Name of the entry to delete. + */ + removeField(name) { + delete this.entries[name.toLowerCase()]; + } + /** + * Helper function for retrieving specific types of fields. + * Used to grab all headers or all trailers. + * + * @param kind {@link FieldPosition} of entries to retrieve. + * @returns The {@link Field} entries with the specified + * {@link FieldPosition}. + */ + getByType(kind) { + return Object.values(this.entries).filter((field) => field.kind === kind); } - const value = (0, callFunction_1.callFunction)(fnArgs, options); - (_b = (_a = options.logger) === null || _a === void 0 ? void 0 : _a.debug) === null || _b === void 0 ? void 0 : _b.call(_a, debug_1.debugId, `evaluateCondition: ${(0, debug_1.toDebugString)(fnArgs)} = ${(0, debug_1.toDebugString)(value)}`); - return { - result: value === "" ? true : !!value, - ...assign != null && { toAssign: { name: assign, value } } - }; }; - exports2.evaluateCondition = evaluateCondition; - } -}); - -// ../../../node_modules/@aws-sdk/util-endpoints/dist-cjs/utils/evaluateConditions.js -var require_evaluateConditions = __commonJS({ - "../../../node_modules/@aws-sdk/util-endpoints/dist-cjs/utils/evaluateConditions.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.evaluateConditions = void 0; - var debug_1 = require_debug(); - var evaluateCondition_1 = require_evaluateCondition(); - var evaluateConditions = (conditions = [], options) => { - var _a, _b; - const conditionsReferenceRecord = {}; - for (const condition of conditions) { - const { result, toAssign } = (0, evaluateCondition_1.evaluateCondition)(condition, { - ...options, - referenceRecord: { - ...options.referenceRecord, - ...conditionsReferenceRecord - } + __name(_Fields, "Fields"); + var Fields = _Fields; + var _HttpRequest = class _HttpRequest2 { + constructor(options) { + this.method = options.method || "GET"; + this.hostname = options.hostname || "localhost"; + this.port = options.port; + this.query = options.query || {}; + this.headers = options.headers || {}; + this.body = options.body; + this.protocol = options.protocol ? options.protocol.slice(-1) !== ":" ? `${options.protocol}:` : options.protocol : "https:"; + this.path = options.path ? options.path.charAt(0) !== "/" ? `/${options.path}` : options.path : "/"; + this.username = options.username; + this.password = options.password; + this.fragment = options.fragment; + } + /** + * Note: this does not deep-clone the body. + */ + static clone(request2) { + const cloned = new _HttpRequest2({ + ...request2, + headers: { ...request2.headers } }); - if (!result) { - return { result }; + if (cloned.query) { + cloned.query = cloneQuery(cloned.query); } - if (toAssign) { - conditionsReferenceRecord[toAssign.name] = toAssign.value; - (_b = (_a = options.logger) === null || _a === void 0 ? void 0 : _a.debug) === null || _b === void 0 ? void 0 : _b.call(_a, debug_1.debugId, `assign: ${toAssign.name} := ${(0, debug_1.toDebugString)(toAssign.value)}`); + return cloned; + } + /** + * This method only actually asserts that request is the interface {@link IHttpRequest}, + * and not necessarily this concrete class. Left in place for API stability. + * + * Do not call instance methods on the input of this function, and + * do not assume it has the HttpRequest prototype. + */ + static isInstance(request2) { + if (!request2) { + return false; } + const req = request2; + return "method" in req && "protocol" in req && "hostname" in req && "path" in req && typeof req["query"] === "object" && typeof req["headers"] === "object"; + } + /** + * @deprecated use static HttpRequest.clone(request) instead. It's not safe to call + * this method because {@link HttpRequest.isInstance} incorrectly + * asserts that IHttpRequest (interface) objects are of type HttpRequest (class). + */ + clone() { + return _HttpRequest2.clone(this); } - return { result: true, referenceRecord: conditionsReferenceRecord }; }; - exports2.evaluateConditions = evaluateConditions; - } -}); - -// ../../../node_modules/@aws-sdk/util-endpoints/dist-cjs/utils/getEndpointHeaders.js -var require_getEndpointHeaders = __commonJS({ - "../../../node_modules/@aws-sdk/util-endpoints/dist-cjs/utils/getEndpointHeaders.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.getEndpointHeaders = void 0; - var types_1 = require_types(); - var evaluateExpression_1 = require_evaluateExpression(); - var getEndpointHeaders = (headers, options) => Object.entries(headers).reduce((acc, [headerKey, headerVal]) => ({ - ...acc, - [headerKey]: headerVal.map((headerValEntry) => { - const processedExpr = (0, evaluateExpression_1.evaluateExpression)(headerValEntry, "Header value entry", options); - if (typeof processedExpr !== "string") { - throw new types_1.EndpointError(`Header '${headerKey}' value '${processedExpr}' is not a string`); - } - return processedExpr; - }) - }), {}); - exports2.getEndpointHeaders = getEndpointHeaders; - } -}); - -// ../../../node_modules/@aws-sdk/util-endpoints/dist-cjs/utils/getEndpointProperty.js -var require_getEndpointProperty = __commonJS({ - "../../../node_modules/@aws-sdk/util-endpoints/dist-cjs/utils/getEndpointProperty.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.getEndpointProperty = void 0; - var types_1 = require_types(); - var evaluateTemplate_1 = require_evaluateTemplate(); - var getEndpointProperties_1 = require_getEndpointProperties(); - var getEndpointProperty = (property, options) => { - if (Array.isArray(property)) { - return property.map((propertyEntry) => (0, exports2.getEndpointProperty)(propertyEntry, options)); + __name(_HttpRequest, "HttpRequest"); + var HttpRequest7 = _HttpRequest; + function cloneQuery(query) { + return Object.keys(query).reduce((carry, paramName) => { + const param = query[paramName]; + return { + ...carry, + [paramName]: Array.isArray(param) ? [...param] : param + }; + }, {}); + } + __name(cloneQuery, "cloneQuery"); + var _HttpResponse = class _HttpResponse { + constructor(options) { + this.statusCode = options.statusCode; + this.reason = options.reason; + this.headers = options.headers || {}; + this.body = options.body; } - switch (typeof property) { - case "string": - return (0, evaluateTemplate_1.evaluateTemplate)(property, options); - case "object": - if (property === null) { - throw new types_1.EndpointError(`Unexpected endpoint property: ${property}`); - } - return (0, getEndpointProperties_1.getEndpointProperties)(property, options); - case "boolean": - return property; - default: - throw new types_1.EndpointError(`Unexpected endpoint property type: ${typeof property}`); + static isInstance(response) { + if (!response) + return false; + const resp = response; + return typeof resp.statusCode === "number" && typeof resp.headers === "object"; } }; - exports2.getEndpointProperty = getEndpointProperty; - } -}); - -// ../../../node_modules/@aws-sdk/util-endpoints/dist-cjs/utils/getEndpointProperties.js -var require_getEndpointProperties = __commonJS({ - "../../../node_modules/@aws-sdk/util-endpoints/dist-cjs/utils/getEndpointProperties.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.getEndpointProperties = void 0; - var getEndpointProperty_1 = require_getEndpointProperty(); - var getEndpointProperties = (properties, options) => Object.entries(properties).reduce((acc, [propertyKey, propertyVal]) => ({ - ...acc, - [propertyKey]: (0, getEndpointProperty_1.getEndpointProperty)(propertyVal, options) - }), {}); - exports2.getEndpointProperties = getEndpointProperties; + __name(_HttpResponse, "HttpResponse"); + var HttpResponse2 = _HttpResponse; + function isValidHostname(hostname) { + const hostPattern = /^[a-z0-9][a-z0-9\.\-]*[a-z0-9]$/; + return hostPattern.test(hostname); + } + __name(isValidHostname, "isValidHostname"); } }); -// ../../../node_modules/@aws-sdk/util-endpoints/dist-cjs/utils/getEndpointUrl.js -var require_getEndpointUrl = __commonJS({ - "../../../node_modules/@aws-sdk/util-endpoints/dist-cjs/utils/getEndpointUrl.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.getEndpointUrl = void 0; - var types_1 = require_types(); - var evaluateExpression_1 = require_evaluateExpression(); - var getEndpointUrl = (endpointUrl, options) => { - const expression = (0, evaluateExpression_1.evaluateExpression)(endpointUrl, "Endpoint URL", options); - if (typeof expression === "string") { - try { - return new URL(expression); - } catch (error) { - console.error(`Failed to construct URL with ${expression}`, error); - throw error; - } - } - throw new types_1.EndpointError(`Endpoint URL must be a string, got ${typeof expression}`); +// ../../../node_modules/@smithy/core/dist-es/middleware-http-signing/httpSigningMiddleware.js +var import_protocol_http, import_types2, import_util_middleware2, defaultErrorHandler, defaultSuccessHandler, httpSigningMiddleware; +var init_httpSigningMiddleware = __esm({ + "../../../node_modules/@smithy/core/dist-es/middleware-http-signing/httpSigningMiddleware.js"() { + import_protocol_http = __toESM(require_dist_cjs20()); + import_types2 = __toESM(require_dist_cjs()); + import_util_middleware2 = __toESM(require_dist_cjs12()); + defaultErrorHandler = (signingProperties) => (error) => { + throw error; }; - exports2.getEndpointUrl = getEndpointUrl; - } -}); - -// ../../../node_modules/@aws-sdk/util-endpoints/dist-cjs/utils/evaluateEndpointRule.js -var require_evaluateEndpointRule = __commonJS({ - "../../../node_modules/@aws-sdk/util-endpoints/dist-cjs/utils/evaluateEndpointRule.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.evaluateEndpointRule = void 0; - var debug_1 = require_debug(); - var evaluateConditions_1 = require_evaluateConditions(); - var getEndpointHeaders_1 = require_getEndpointHeaders(); - var getEndpointProperties_1 = require_getEndpointProperties(); - var getEndpointUrl_1 = require_getEndpointUrl(); - var evaluateEndpointRule = (endpointRule, options) => { - var _a, _b; - const { conditions, endpoint } = endpointRule; - const { result, referenceRecord } = (0, evaluateConditions_1.evaluateConditions)(conditions, options); - if (!result) { - return; + defaultSuccessHandler = (httpResponse, signingProperties) => { + }; + httpSigningMiddleware = (config) => (next, context) => async (args) => { + if (!import_protocol_http.HttpRequest.isInstance(args.request)) { + return next(args); } - const endpointRuleOptions = { - ...options, - referenceRecord: { ...options.referenceRecord, ...referenceRecord } - }; - const { url: url2, properties, headers } = endpoint; - (_b = (_a = options.logger) === null || _a === void 0 ? void 0 : _a.debug) === null || _b === void 0 ? void 0 : _b.call(_a, debug_1.debugId, `Resolving endpoint from template: ${(0, debug_1.toDebugString)(endpoint)}`); - return { - ...headers != void 0 && { - headers: (0, getEndpointHeaders_1.getEndpointHeaders)(headers, endpointRuleOptions) - }, - ...properties != void 0 && { - properties: (0, getEndpointProperties_1.getEndpointProperties)(properties, endpointRuleOptions) - }, - url: (0, getEndpointUrl_1.getEndpointUrl)(url2, endpointRuleOptions) - }; + const smithyContext = (0, import_util_middleware2.getSmithyContext)(context); + const scheme = smithyContext.selectedHttpAuthScheme; + if (!scheme) { + throw new Error(`No HttpAuthScheme was selected: unable to sign request`); + } + const { httpAuthOption: { signingProperties = {} }, identity, signer } = scheme; + const output = await next({ + ...args, + request: await signer.sign(args.request, identity, signingProperties) + }).catch((signer.errorHandler || defaultErrorHandler)(signingProperties)); + (signer.successHandler || defaultSuccessHandler)(output.response, signingProperties); + return output; }; - exports2.evaluateEndpointRule = evaluateEndpointRule; } }); -// ../../../node_modules/@aws-sdk/util-endpoints/dist-cjs/utils/evaluateErrorRule.js -var require_evaluateErrorRule = __commonJS({ - "../../../node_modules/@aws-sdk/util-endpoints/dist-cjs/utils/evaluateErrorRule.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.evaluateErrorRule = void 0; - var types_1 = require_types(); - var evaluateConditions_1 = require_evaluateConditions(); - var evaluateExpression_1 = require_evaluateExpression(); - var evaluateErrorRule = (errorRule, options) => { - const { conditions, error } = errorRule; - const { result, referenceRecord } = (0, evaluateConditions_1.evaluateConditions)(conditions, options); - if (!result) { - return; - } - throw new types_1.EndpointError((0, evaluateExpression_1.evaluateExpression)(error, "Error", { - ...options, - referenceRecord: { ...options.referenceRecord, ...referenceRecord } - })); - }; - exports2.evaluateErrorRule = evaluateErrorRule; - } -}); - -// ../../../node_modules/@aws-sdk/util-endpoints/dist-cjs/utils/evaluateTreeRule.js -var require_evaluateTreeRule = __commonJS({ - "../../../node_modules/@aws-sdk/util-endpoints/dist-cjs/utils/evaluateTreeRule.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.evaluateTreeRule = void 0; - var evaluateConditions_1 = require_evaluateConditions(); - var evaluateRules_1 = require_evaluateRules(); - var evaluateTreeRule = (treeRule, options) => { - const { conditions, rules } = treeRule; - const { result, referenceRecord } = (0, evaluateConditions_1.evaluateConditions)(conditions, options); - if (!result) { - return; - } - return (0, evaluateRules_1.evaluateRules)(rules, { - ...options, - referenceRecord: { ...options.referenceRecord, ...referenceRecord } - }); - }; - exports2.evaluateTreeRule = evaluateTreeRule; - } -}); - -// ../../../node_modules/@aws-sdk/util-endpoints/dist-cjs/utils/evaluateRules.js -var require_evaluateRules = __commonJS({ - "../../../node_modules/@aws-sdk/util-endpoints/dist-cjs/utils/evaluateRules.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.evaluateRules = void 0; - var types_1 = require_types(); - var evaluateEndpointRule_1 = require_evaluateEndpointRule(); - var evaluateErrorRule_1 = require_evaluateErrorRule(); - var evaluateTreeRule_1 = require_evaluateTreeRule(); - var evaluateRules = (rules, options) => { - for (const rule of rules) { - if (rule.type === "endpoint") { - const endpointOrUndefined = (0, evaluateEndpointRule_1.evaluateEndpointRule)(rule, options); - if (endpointOrUndefined) { - return endpointOrUndefined; - } - } else if (rule.type === "error") { - (0, evaluateErrorRule_1.evaluateErrorRule)(rule, options); - } else if (rule.type === "tree") { - const endpointOrUndefined = (0, evaluateTreeRule_1.evaluateTreeRule)(rule, options); - if (endpointOrUndefined) { - return endpointOrUndefined; - } - } else { - throw new types_1.EndpointError(`Unknown endpoint rule: ${rule}`); - } - } - throw new types_1.EndpointError(`Rules evaluation failed`); - }; - exports2.evaluateRules = evaluateRules; - } -}); - -// ../../../node_modules/@aws-sdk/util-endpoints/dist-cjs/utils/index.js -var require_utils = __commonJS({ - "../../../node_modules/@aws-sdk/util-endpoints/dist-cjs/utils/index.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports)); - tslib_1.__exportStar(require_evaluateRules(), exports2); - } -}); - -// ../../../node_modules/@aws-sdk/util-endpoints/dist-cjs/resolveEndpoint.js -var require_resolveEndpoint = __commonJS({ - "../../../node_modules/@aws-sdk/util-endpoints/dist-cjs/resolveEndpoint.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.resolveEndpoint = void 0; - var debug_1 = require_debug(); - var types_1 = require_types(); - var utils_1 = require_utils(); - var resolveEndpoint = (ruleSetObject, options) => { - var _a, _b, _c, _d, _e, _f; - const { endpointParams, logger } = options; - const { parameters, rules } = ruleSetObject; - (_b = (_a = options.logger) === null || _a === void 0 ? void 0 : _a.debug) === null || _b === void 0 ? void 0 : _b.call(_a, `${debug_1.debugId} Initial EndpointParams: ${(0, debug_1.toDebugString)(endpointParams)}`); - const paramsWithDefault = Object.entries(parameters).filter(([, v]) => v.default != null).map(([k, v]) => [k, v.default]); - if (paramsWithDefault.length > 0) { - for (const [paramKey, paramDefaultValue] of paramsWithDefault) { - endpointParams[paramKey] = (_c = endpointParams[paramKey]) !== null && _c !== void 0 ? _c : paramDefaultValue; - } - } - const requiredParams = Object.entries(parameters).filter(([, v]) => v.required).map(([k]) => k); - for (const requiredParam of requiredParams) { - if (endpointParams[requiredParam] == null) { - throw new types_1.EndpointError(`Missing required parameter: '${requiredParam}'`); - } - } - const endpoint = (0, utils_1.evaluateRules)(rules, { endpointParams, logger, referenceRecord: {} }); - if ((_d = options.endpointParams) === null || _d === void 0 ? void 0 : _d.Endpoint) { - try { - const givenEndpoint = new URL(options.endpointParams.Endpoint); - const { protocol, port } = givenEndpoint; - endpoint.url.protocol = protocol; - endpoint.url.port = port; - } catch (e) { - } - } - (_f = (_e = options.logger) === null || _e === void 0 ? void 0 : _e.debug) === null || _f === void 0 ? void 0 : _f.call(_e, `${debug_1.debugId} Resolved endpoint: ${(0, debug_1.toDebugString)(endpoint)}`); - return endpoint; - }; - exports2.resolveEndpoint = resolveEndpoint; - } -}); - -// ../../../node_modules/@aws-sdk/util-endpoints/dist-cjs/index.js -var require_dist_cjs16 = __commonJS({ - "../../../node_modules/@aws-sdk/util-endpoints/dist-cjs/index.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports)); - tslib_1.__exportStar(require_partition(), exports2); - tslib_1.__exportStar(require_isIpAddress(), exports2); - tslib_1.__exportStar(require_resolveEndpoint(), exports2); - tslib_1.__exportStar(require_types(), exports2); - } -}); - -// ../../../node_modules/@aws-sdk/middleware-user-agent/dist-cjs/constants.js -var require_constants = __commonJS({ - "../../../node_modules/@aws-sdk/middleware-user-agent/dist-cjs/constants.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.UA_ESCAPE_CHAR = exports2.UA_VALUE_ESCAPE_REGEX = exports2.UA_NAME_ESCAPE_REGEX = exports2.UA_NAME_SEPARATOR = exports2.SPACE = exports2.X_AMZ_USER_AGENT = exports2.USER_AGENT = void 0; - exports2.USER_AGENT = "user-agent"; - exports2.X_AMZ_USER_AGENT = "x-amz-user-agent"; - exports2.SPACE = " "; - exports2.UA_NAME_SEPARATOR = "/"; - exports2.UA_NAME_ESCAPE_REGEX = /[^\!\$\%\&\'\*\+\-\.\^\_\`\|\~\d\w]/g; - exports2.UA_VALUE_ESCAPE_REGEX = /[^\!\$\%\&\'\*\+\-\.\^\_\`\|\~\d\w\#]/g; - exports2.UA_ESCAPE_CHAR = "-"; - } -}); - -// ../../../node_modules/@aws-sdk/middleware-user-agent/dist-cjs/user-agent-middleware.js -var require_user_agent_middleware = __commonJS({ - "../../../node_modules/@aws-sdk/middleware-user-agent/dist-cjs/user-agent-middleware.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.getUserAgentPlugin = exports2.getUserAgentMiddlewareOptions = exports2.userAgentMiddleware = void 0; - var util_endpoints_1 = require_dist_cjs16(); - var protocol_http_1 = require_dist_cjs2(); - var constants_1 = require_constants(); - var userAgentMiddleware = (options) => (next, context) => async (args) => { - var _a, _b; - const { request: request2 } = args; - if (!protocol_http_1.HttpRequest.isInstance(request2)) - return next(args); - const { headers } = request2; - const userAgent = ((_a = context === null || context === void 0 ? void 0 : context.userAgent) === null || _a === void 0 ? void 0 : _a.map(escapeUserAgent)) || []; - const defaultUserAgent = (await options.defaultUserAgentProvider()).map(escapeUserAgent); - const customUserAgent = ((_b = options === null || options === void 0 ? void 0 : options.customUserAgent) === null || _b === void 0 ? void 0 : _b.map(escapeUserAgent)) || []; - const prefix = (0, util_endpoints_1.getUserAgentPrefix)(); - const sdkUserAgentValue = (prefix ? [prefix] : []).concat([...defaultUserAgent, ...userAgent, ...customUserAgent]).join(constants_1.SPACE); - const normalUAValue = [ - ...defaultUserAgent.filter((section) => section.startsWith("aws-sdk-")), - ...customUserAgent - ].join(constants_1.SPACE); - if (options.runtime !== "browser") { - if (normalUAValue) { - headers[constants_1.X_AMZ_USER_AGENT] = headers[constants_1.X_AMZ_USER_AGENT] ? `${headers[constants_1.USER_AGENT]} ${normalUAValue}` : normalUAValue; - } - headers[constants_1.USER_AGENT] = sdkUserAgentValue; - } else { - headers[constants_1.X_AMZ_USER_AGENT] = sdkUserAgentValue; - } - return next({ - ...args, - request: request2 - }); - }; - exports2.userAgentMiddleware = userAgentMiddleware; - var escapeUserAgent = (userAgentPair) => { - var _a; - const name = userAgentPair[0].split(constants_1.UA_NAME_SEPARATOR).map((part) => part.replace(constants_1.UA_NAME_ESCAPE_REGEX, constants_1.UA_ESCAPE_CHAR)).join(constants_1.UA_NAME_SEPARATOR); - const version2 = (_a = userAgentPair[1]) === null || _a === void 0 ? void 0 : _a.replace(constants_1.UA_VALUE_ESCAPE_REGEX, constants_1.UA_ESCAPE_CHAR); - const prefixSeparatorIndex = name.indexOf(constants_1.UA_NAME_SEPARATOR); - const prefix = name.substring(0, prefixSeparatorIndex); - let uaName = name.substring(prefixSeparatorIndex + 1); - if (prefix === "api") { - uaName = uaName.toLowerCase(); - } - return [prefix, uaName, version2].filter((item) => item && item.length > 0).reduce((acc, item, index) => { - switch (index) { - case 0: - return item; - case 1: - return `${acc}/${item}`; - default: - return `${acc}#${item}`; - } - }, ""); - }; - exports2.getUserAgentMiddlewareOptions = { - name: "getUserAgentMiddleware", - step: "build", - priority: "low", - tags: ["SET_USER_AGENT", "USER_AGENT"], - override: true - }; - var getUserAgentPlugin = (config) => ({ - applyToStack: (clientStack) => { - clientStack.add((0, exports2.userAgentMiddleware)(config), exports2.getUserAgentMiddlewareOptions); - } - }); - exports2.getUserAgentPlugin = getUserAgentPlugin; - } -}); - -// ../../../node_modules/@aws-sdk/middleware-user-agent/dist-cjs/index.js -var require_dist_cjs17 = __commonJS({ - "../../../node_modules/@aws-sdk/middleware-user-agent/dist-cjs/index.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports)); - tslib_1.__exportStar(require_configurations(), exports2); - tslib_1.__exportStar(require_user_agent_middleware(), exports2); - } -}); - -// ../../../node_modules/@smithy/util-config-provider/dist-cjs/index.js -var require_dist_cjs18 = __commonJS({ - "../../../node_modules/@smithy/util-config-provider/dist-cjs/index.js"(exports2, module2) { - var __defProp2 = Object.defineProperty; - var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; - var __getOwnPropNames2 = Object.getOwnPropertyNames; - var __hasOwnProp2 = Object.prototype.hasOwnProperty; - var __name = (target, value) => __defProp2(target, "name", { value, configurable: true }); - var __export2 = (target, all) => { - for (var name in all) - __defProp2(target, name, { get: all[name], enumerable: true }); - }; - var __copyProps2 = (to, from, except, desc) => { - if (from && typeof from === "object" || typeof from === "function") { - for (let key of __getOwnPropNames2(from)) - if (!__hasOwnProp2.call(to, key) && key !== except) - __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable }); - } - return to; - }; - var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); - var src_exports = {}; - __export2(src_exports, { - SelectorType: () => SelectorType, - booleanSelector: () => booleanSelector, - numberSelector: () => numberSelector - }); - module2.exports = __toCommonJS2(src_exports); - var booleanSelector = /* @__PURE__ */ __name((obj, key, type) => { - if (!(key in obj)) - return void 0; - if (obj[key] === "true") - return true; - if (obj[key] === "false") - return false; - throw new Error(`Cannot load ${type} "${key}". Expected "true" or "false", got ${obj[key]}.`); - }, "booleanSelector"); - var numberSelector = /* @__PURE__ */ __name((obj, key, type) => { - if (!(key in obj)) - return void 0; - const numberValue = parseInt(obj[key], 10); - if (Number.isNaN(numberValue)) { - throw new TypeError(`Cannot load ${type} '${key}'. Expected number, got '${obj[key]}'.`); - } - return numberValue; - }, "numberSelector"); - var SelectorType = /* @__PURE__ */ ((SelectorType2) => { - SelectorType2["ENV"] = "env"; - SelectorType2["CONFIG"] = "shared config entry"; - return SelectorType2; - })(SelectorType || {}); - } -}); - -// ../../../node_modules/@smithy/config-resolver/dist-cjs/index.js -var require_dist_cjs19 = __commonJS({ - "../../../node_modules/@smithy/config-resolver/dist-cjs/index.js"(exports2, module2) { +// ../../../node_modules/@smithy/middleware-retry/node_modules/@smithy/protocol-http/dist-cjs/index.js +var require_dist_cjs21 = __commonJS({ + "../../../node_modules/@smithy/middleware-retry/node_modules/@smithy/protocol-http/dist-cjs/index.js"(exports2, module2) { var __defProp2 = Object.defineProperty; var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; var __getOwnPropNames2 = Object.getOwnPropertyNames; @@ -4677,657 +4023,576 @@ var require_dist_cjs19 = __commonJS({ var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); var src_exports = {}; __export2(src_exports, { - CONFIG_USE_DUALSTACK_ENDPOINT: () => CONFIG_USE_DUALSTACK_ENDPOINT, - CONFIG_USE_FIPS_ENDPOINT: () => CONFIG_USE_FIPS_ENDPOINT, - DEFAULT_USE_DUALSTACK_ENDPOINT: () => DEFAULT_USE_DUALSTACK_ENDPOINT, - DEFAULT_USE_FIPS_ENDPOINT: () => DEFAULT_USE_FIPS_ENDPOINT, - ENV_USE_DUALSTACK_ENDPOINT: () => ENV_USE_DUALSTACK_ENDPOINT, - ENV_USE_FIPS_ENDPOINT: () => ENV_USE_FIPS_ENDPOINT, - NODE_REGION_CONFIG_FILE_OPTIONS: () => NODE_REGION_CONFIG_FILE_OPTIONS, - NODE_REGION_CONFIG_OPTIONS: () => NODE_REGION_CONFIG_OPTIONS, - NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS: () => NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS, - NODE_USE_FIPS_ENDPOINT_CONFIG_OPTIONS: () => NODE_USE_FIPS_ENDPOINT_CONFIG_OPTIONS, - REGION_ENV_NAME: () => REGION_ENV_NAME, - REGION_INI_NAME: () => REGION_INI_NAME, - getRegionInfo: () => getRegionInfo, - resolveCustomEndpointsConfig: () => resolveCustomEndpointsConfig, - resolveEndpointsConfig: () => resolveEndpointsConfig, - resolveRegionConfig: () => resolveRegionConfig + Field: () => Field, + Fields: () => Fields, + HttpRequest: () => HttpRequest7, + HttpResponse: () => HttpResponse2, + IHttpRequest: () => import_types5.HttpRequest, + getHttpHandlerExtensionConfiguration: () => getHttpHandlerExtensionConfiguration, + isValidHostname: () => isValidHostname, + resolveHttpHandlerRuntimeConfig: () => resolveHttpHandlerRuntimeConfig }); module2.exports = __toCommonJS2(src_exports); - var import_util_config_provider = require_dist_cjs18(); - var ENV_USE_DUALSTACK_ENDPOINT = "AWS_USE_DUALSTACK_ENDPOINT"; - var CONFIG_USE_DUALSTACK_ENDPOINT = "use_dualstack_endpoint"; - var DEFAULT_USE_DUALSTACK_ENDPOINT = false; - var NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS = { - environmentVariableSelector: (env) => (0, import_util_config_provider.booleanSelector)(env, ENV_USE_DUALSTACK_ENDPOINT, import_util_config_provider.SelectorType.ENV), - configFileSelector: (profile) => (0, import_util_config_provider.booleanSelector)(profile, CONFIG_USE_DUALSTACK_ENDPOINT, import_util_config_provider.SelectorType.CONFIG), - default: false - }; - var ENV_USE_FIPS_ENDPOINT = "AWS_USE_FIPS_ENDPOINT"; - var CONFIG_USE_FIPS_ENDPOINT = "use_fips_endpoint"; - var DEFAULT_USE_FIPS_ENDPOINT = false; - var NODE_USE_FIPS_ENDPOINT_CONFIG_OPTIONS = { - environmentVariableSelector: (env) => (0, import_util_config_provider.booleanSelector)(env, ENV_USE_FIPS_ENDPOINT, import_util_config_provider.SelectorType.ENV), - configFileSelector: (profile) => (0, import_util_config_provider.booleanSelector)(profile, CONFIG_USE_FIPS_ENDPOINT, import_util_config_provider.SelectorType.CONFIG), - default: false - }; - var import_util_middleware = require_dist_cjs7(); - var resolveCustomEndpointsConfig = /* @__PURE__ */ __name((input) => { - const { endpoint, urlParser } = input; + var getHttpHandlerExtensionConfiguration = /* @__PURE__ */ __name((runtimeConfig) => { + let httpHandler = runtimeConfig.httpHandler; return { - ...input, - tls: input.tls ?? true, - endpoint: (0, import_util_middleware.normalizeProvider)(typeof endpoint === "string" ? urlParser(endpoint) : endpoint), - isCustomEndpoint: true, - useDualstackEndpoint: (0, import_util_middleware.normalizeProvider)(input.useDualstackEndpoint ?? false) + setHttpHandler(handler2) { + httpHandler = handler2; + }, + httpHandler() { + return httpHandler; + }, + updateHttpClientConfig(key, value) { + httpHandler.updateHttpClientConfig(key, value); + }, + httpHandlerConfigs() { + return httpHandler.httpHandlerConfigs(); + } }; - }, "resolveCustomEndpointsConfig"); - var getEndpointFromRegion = /* @__PURE__ */ __name(async (input) => { - const { tls = true } = input; - const region = await input.region(); - const dnsHostRegex = new RegExp(/^([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9-]{0,61}[a-zA-Z0-9])$/); - if (!dnsHostRegex.test(region)) { - throw new Error("Invalid region in client config"); - } - const useDualstackEndpoint = await input.useDualstackEndpoint(); - const useFipsEndpoint = await input.useFipsEndpoint(); - const { hostname } = await input.regionInfoProvider(region, { useDualstackEndpoint, useFipsEndpoint }) ?? {}; - if (!hostname) { - throw new Error("Cannot resolve hostname from client config"); - } - return input.urlParser(`${tls ? "https:" : "http:"}//${hostname}`); - }, "getEndpointFromRegion"); - var resolveEndpointsConfig = /* @__PURE__ */ __name((input) => { - const useDualstackEndpoint = (0, import_util_middleware.normalizeProvider)(input.useDualstackEndpoint ?? false); - const { endpoint, useFipsEndpoint, urlParser } = input; + }, "getHttpHandlerExtensionConfiguration"); + var resolveHttpHandlerRuntimeConfig = /* @__PURE__ */ __name((httpHandlerExtensionConfiguration) => { return { - ...input, - tls: input.tls ?? true, - endpoint: endpoint ? (0, import_util_middleware.normalizeProvider)(typeof endpoint === "string" ? urlParser(endpoint) : endpoint) : () => getEndpointFromRegion({ ...input, useDualstackEndpoint, useFipsEndpoint }), - isCustomEndpoint: !!endpoint, - useDualstackEndpoint + httpHandler: httpHandlerExtensionConfiguration.httpHandler() }; - }, "resolveEndpointsConfig"); - var REGION_ENV_NAME = "AWS_REGION"; - var REGION_INI_NAME = "region"; - var NODE_REGION_CONFIG_OPTIONS = { - environmentVariableSelector: (env) => env[REGION_ENV_NAME], - configFileSelector: (profile) => profile[REGION_INI_NAME], - default: () => { - throw new Error("Region is missing"); + }, "resolveHttpHandlerRuntimeConfig"); + var import_types5 = require_dist_cjs(); + var _Field = class _Field { + constructor({ name, kind = import_types5.FieldPosition.HEADER, values = [] }) { + this.name = name; + this.kind = kind; + this.values = values; + } + /** + * Appends a value to the field. + * + * @param value The value to append. + */ + add(value) { + this.values.push(value); + } + /** + * Overwrite existing field values. + * + * @param values The new field values. + */ + set(values) { + this.values = values; + } + /** + * Remove all matching entries from list. + * + * @param value Value to remove. + */ + remove(value) { + this.values = this.values.filter((v) => v !== value); + } + /** + * Get comma-delimited string. + * + * @returns String representation of {@link Field}. + */ + toString() { + return this.values.map((v) => v.includes(",") || v.includes(" ") ? `"${v}"` : v).join(", "); + } + /** + * Get string values as a list + * + * @returns Values in {@link Field} as a list. + */ + get() { + return this.values; } }; - var NODE_REGION_CONFIG_FILE_OPTIONS = { - preferredFile: "credentials" + __name(_Field, "Field"); + var Field = _Field; + var _Fields = class _Fields { + constructor({ fields = [], encoding = "utf-8" }) { + this.entries = {}; + fields.forEach(this.setField.bind(this)); + this.encoding = encoding; + } + /** + * Set entry for a {@link Field} name. The `name` + * attribute will be used to key the collection. + * + * @param field The {@link Field} to set. + */ + setField(field) { + this.entries[field.name.toLowerCase()] = field; + } + /** + * Retrieve {@link Field} entry by name. + * + * @param name The name of the {@link Field} entry + * to retrieve + * @returns The {@link Field} if it exists. + */ + getField(name) { + return this.entries[name.toLowerCase()]; + } + /** + * Delete entry from collection. + * + * @param name Name of the entry to delete. + */ + removeField(name) { + delete this.entries[name.toLowerCase()]; + } + /** + * Helper function for retrieving specific types of fields. + * Used to grab all headers or all trailers. + * + * @param kind {@link FieldPosition} of entries to retrieve. + * @returns The {@link Field} entries with the specified + * {@link FieldPosition}. + */ + getByType(kind) { + return Object.values(this.entries).filter((field) => field.kind === kind); + } }; - var isFipsRegion = /* @__PURE__ */ __name((region) => typeof region === "string" && (region.startsWith("fips-") || region.endsWith("-fips")), "isFipsRegion"); - var getRealRegion = /* @__PURE__ */ __name((region) => isFipsRegion(region) ? ["fips-aws-global", "aws-fips"].includes(region) ? "us-east-1" : region.replace(/fips-(dkr-|prod-)?|-fips/, "") : region, "getRealRegion"); - var resolveRegionConfig = /* @__PURE__ */ __name((input) => { - const { region, useFipsEndpoint } = input; - if (!region) { - throw new Error("Region is missing"); + __name(_Fields, "Fields"); + var Fields = _Fields; + var _HttpRequest = class _HttpRequest2 { + constructor(options) { + this.method = options.method || "GET"; + this.hostname = options.hostname || "localhost"; + this.port = options.port; + this.query = options.query || {}; + this.headers = options.headers || {}; + this.body = options.body; + this.protocol = options.protocol ? options.protocol.slice(-1) !== ":" ? `${options.protocol}:` : options.protocol : "https:"; + this.path = options.path ? options.path.charAt(0) !== "/" ? `/${options.path}` : options.path : "/"; + this.username = options.username; + this.password = options.password; + this.fragment = options.fragment; } - return { - ...input, - region: async () => { - if (typeof region === "string") { - return getRealRegion(region); - } - const providedRegion = await region(); - return getRealRegion(providedRegion); - }, - useFipsEndpoint: async () => { - const providedRegion = typeof region === "string" ? region : await region(); - if (isFipsRegion(providedRegion)) { - return true; - } - return typeof useFipsEndpoint !== "function" ? Promise.resolve(!!useFipsEndpoint) : useFipsEndpoint(); - } - }; - }, "resolveRegionConfig"); - var getHostnameFromVariants = /* @__PURE__ */ __name((variants = [], { useFipsEndpoint, useDualstackEndpoint }) => { - var _a; - return (_a = variants.find( - ({ tags }) => useFipsEndpoint === tags.includes("fips") && useDualstackEndpoint === tags.includes("dualstack") - )) == null ? void 0 : _a.hostname; - }, "getHostnameFromVariants"); - var getResolvedHostname = /* @__PURE__ */ __name((resolvedRegion, { regionHostname, partitionHostname }) => regionHostname ? regionHostname : partitionHostname ? partitionHostname.replace("{region}", resolvedRegion) : void 0, "getResolvedHostname"); - var getResolvedPartition = /* @__PURE__ */ __name((region, { partitionHash }) => Object.keys(partitionHash || {}).find((key) => partitionHash[key].regions.includes(region)) ?? "aws", "getResolvedPartition"); - var getResolvedSigningRegion = /* @__PURE__ */ __name((hostname, { signingRegion, regionRegex, useFipsEndpoint }) => { - if (signingRegion) { - return signingRegion; - } else if (useFipsEndpoint) { - const regionRegexJs = regionRegex.replace("\\\\", "\\").replace(/^\^/g, "\\.").replace(/\$$/g, "\\."); - const regionRegexmatchArray = hostname.match(regionRegexJs); - if (regionRegexmatchArray) { - return regionRegexmatchArray[0].slice(1, -1); + /** + * Note: this does not deep-clone the body. + */ + static clone(request2) { + const cloned = new _HttpRequest2({ + ...request2, + headers: { ...request2.headers } + }); + if (cloned.query) { + cloned.query = cloneQuery(cloned.query); } + return cloned; } - }, "getResolvedSigningRegion"); - var getRegionInfo = /* @__PURE__ */ __name((region, { - useFipsEndpoint = false, - useDualstackEndpoint = false, - signingService, - regionHash, - partitionHash - }) => { - var _a, _b, _c, _d, _e; - const partition = getResolvedPartition(region, { partitionHash }); - const resolvedRegion = region in regionHash ? region : ((_a = partitionHash[partition]) == null ? void 0 : _a.endpoint) ?? region; - const hostnameOptions = { useFipsEndpoint, useDualstackEndpoint }; - const regionHostname = getHostnameFromVariants((_b = regionHash[resolvedRegion]) == null ? void 0 : _b.variants, hostnameOptions); - const partitionHostname = getHostnameFromVariants((_c = partitionHash[partition]) == null ? void 0 : _c.variants, hostnameOptions); - const hostname = getResolvedHostname(resolvedRegion, { regionHostname, partitionHostname }); - if (hostname === void 0) { - throw new Error(`Endpoint resolution failed for: ${{ resolvedRegion, useFipsEndpoint, useDualstackEndpoint }}`); - } - const signingRegion = getResolvedSigningRegion(hostname, { - signingRegion: (_d = regionHash[resolvedRegion]) == null ? void 0 : _d.signingRegion, - regionRegex: partitionHash[partition].regionRegex, - useFipsEndpoint - }); - return { - partition, - signingService, - hostname, - ...signingRegion && { signingRegion }, - ...((_e = regionHash[resolvedRegion]) == null ? void 0 : _e.signingService) && { - signingService: regionHash[resolvedRegion].signingService + /** + * This method only actually asserts that request is the interface {@link IHttpRequest}, + * and not necessarily this concrete class. Left in place for API stability. + * + * Do not call instance methods on the input of this function, and + * do not assume it has the HttpRequest prototype. + */ + static isInstance(request2) { + if (!request2) { + return false; } - }; - }, "getRegionInfo"); - } -}); - -// ../../../node_modules/@smithy/middleware-content-length/dist-cjs/index.js -var require_dist_cjs20 = __commonJS({ - "../../../node_modules/@smithy/middleware-content-length/dist-cjs/index.js"(exports2, module2) { - var __defProp2 = Object.defineProperty; - var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; - var __getOwnPropNames2 = Object.getOwnPropertyNames; - var __hasOwnProp2 = Object.prototype.hasOwnProperty; - var __name = (target, value) => __defProp2(target, "name", { value, configurable: true }); - var __export2 = (target, all) => { - for (var name in all) - __defProp2(target, name, { get: all[name], enumerable: true }); - }; - var __copyProps2 = (to, from, except, desc) => { - if (from && typeof from === "object" || typeof from === "function") { - for (let key of __getOwnPropNames2(from)) - if (!__hasOwnProp2.call(to, key) && key !== except) - __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable }); + const req = request2; + return "method" in req && "protocol" in req && "hostname" in req && "path" in req && typeof req["query"] === "object" && typeof req["headers"] === "object"; + } + /** + * @deprecated use static HttpRequest.clone(request) instead. It's not safe to call + * this method because {@link HttpRequest.isInstance} incorrectly + * asserts that IHttpRequest (interface) objects are of type HttpRequest (class). + */ + clone() { + return _HttpRequest2.clone(this); } - return to; }; - var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); - var src_exports = {}; - __export2(src_exports, { - contentLengthMiddleware: () => contentLengthMiddleware, - contentLengthMiddlewareOptions: () => contentLengthMiddlewareOptions, - getContentLengthPlugin: () => getContentLengthPlugin - }); - module2.exports = __toCommonJS2(src_exports); - var import_protocol_http = require_dist_cjs2(); - var CONTENT_LENGTH_HEADER = "content-length"; - function contentLengthMiddleware(bodyLengthChecker) { - return (next) => async (args) => { - const request2 = args.request; - if (import_protocol_http.HttpRequest.isInstance(request2)) { - const { body, headers } = request2; - if (body && Object.keys(headers).map((str) => str.toLowerCase()).indexOf(CONTENT_LENGTH_HEADER) === -1) { - try { - const length = bodyLengthChecker(body); - request2.headers = { - ...request2.headers, - [CONTENT_LENGTH_HEADER]: String(length) - }; - } catch (error) { - } - } - } - return next({ - ...args, - request: request2 - }); - }; + __name(_HttpRequest, "HttpRequest"); + var HttpRequest7 = _HttpRequest; + function cloneQuery(query) { + return Object.keys(query).reduce((carry, paramName) => { + const param = query[paramName]; + return { + ...carry, + [paramName]: Array.isArray(param) ? [...param] : param + }; + }, {}); } - __name(contentLengthMiddleware, "contentLengthMiddleware"); - var contentLengthMiddlewareOptions = { - step: "build", - tags: ["SET_CONTENT_LENGTH", "CONTENT_LENGTH"], - name: "contentLengthMiddleware", - override: true - }; - var getContentLengthPlugin = /* @__PURE__ */ __name((options) => ({ - applyToStack: (clientStack) => { - clientStack.add(contentLengthMiddleware(options.bodyLengthChecker), contentLengthMiddlewareOptions); + __name(cloneQuery, "cloneQuery"); + var _HttpResponse = class _HttpResponse { + constructor(options) { + this.statusCode = options.statusCode; + this.reason = options.reason; + this.headers = options.headers || {}; + this.body = options.body; } - }), "getContentLengthPlugin"); + static isInstance(response) { + if (!response) + return false; + const resp = response; + return typeof resp.statusCode === "number" && typeof resp.headers === "object"; + } + }; + __name(_HttpResponse, "HttpResponse"); + var HttpResponse2 = _HttpResponse; + function isValidHostname(hostname) { + const hostPattern = /^[a-z0-9][a-z0-9\.\-]*[a-z0-9]$/; + return hostPattern.test(hostname); + } + __name(isValidHostname, "isValidHostname"); } }); -// ../../../node_modules/@smithy/shared-ini-file-loader/dist-cjs/getHomeDir.js -var require_getHomeDir = __commonJS({ - "../../../node_modules/@smithy/shared-ini-file-loader/dist-cjs/getHomeDir.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.getHomeDir = void 0; - var os_1 = require("os"); - var path_1 = require("path"); - var homeDirCache = {}; - var getHomeDirCacheKey = () => { - if (process && process.geteuid) { - return `${process.geteuid()}`; - } - return "DEFAULT"; - }; - var getHomeDir2 = () => { - const { HOME, USERPROFILE, HOMEPATH, HOMEDRIVE = `C:${path_1.sep}` } = process.env; - if (HOME) - return HOME; - if (USERPROFILE) - return USERPROFILE; - if (HOMEPATH) - return `${HOMEDRIVE}${HOMEPATH}`; - const homeDirCacheKey = getHomeDirCacheKey(); - if (!homeDirCache[homeDirCacheKey]) - homeDirCache[homeDirCacheKey] = (0, os_1.homedir)(); - return homeDirCache[homeDirCacheKey]; - }; - exports2.getHomeDir = getHomeDir2; +// ../../../node_modules/uuid/dist/esm-node/rng.js +function rng() { + if (poolPtr > rnds8Pool.length - 16) { + import_crypto.default.randomFillSync(rnds8Pool); + poolPtr = 0; + } + return rnds8Pool.slice(poolPtr, poolPtr += 16); +} +var import_crypto, rnds8Pool, poolPtr; +var init_rng = __esm({ + "../../../node_modules/uuid/dist/esm-node/rng.js"() { + import_crypto = __toESM(require("crypto")); + rnds8Pool = new Uint8Array(256); + poolPtr = rnds8Pool.length; } }); -// ../../../node_modules/@smithy/shared-ini-file-loader/dist-cjs/getSSOTokenFilepath.js -var require_getSSOTokenFilepath = __commonJS({ - "../../../node_modules/@smithy/shared-ini-file-loader/dist-cjs/getSSOTokenFilepath.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.getSSOTokenFilepath = void 0; - var crypto_1 = require("crypto"); - var path_1 = require("path"); - var getHomeDir_1 = require_getHomeDir(); - var getSSOTokenFilepath2 = (id) => { - const hasher = (0, crypto_1.createHash)("sha1"); - const cacheName = hasher.update(id).digest("hex"); - return (0, path_1.join)((0, getHomeDir_1.getHomeDir)(), ".aws", "sso", "cache", `${cacheName}.json`); - }; - exports2.getSSOTokenFilepath = getSSOTokenFilepath2; +// ../../../node_modules/uuid/dist/esm-node/regex.js +var regex_default; +var init_regex = __esm({ + "../../../node_modules/uuid/dist/esm-node/regex.js"() { + regex_default = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i; } }); -// ../../../node_modules/@smithy/shared-ini-file-loader/dist-cjs/getSSOTokenFromFile.js -var require_getSSOTokenFromFile = __commonJS({ - "../../../node_modules/@smithy/shared-ini-file-loader/dist-cjs/getSSOTokenFromFile.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.getSSOTokenFromFile = void 0; - var fs_1 = require("fs"); - var getSSOTokenFilepath_1 = require_getSSOTokenFilepath(); - var { readFile } = fs_1.promises; - var getSSOTokenFromFile2 = async (id) => { - const ssoTokenFilepath = (0, getSSOTokenFilepath_1.getSSOTokenFilepath)(id); - const ssoTokenText = await readFile(ssoTokenFilepath, "utf8"); - return JSON.parse(ssoTokenText); - }; - exports2.getSSOTokenFromFile = getSSOTokenFromFile2; +// ../../../node_modules/uuid/dist/esm-node/validate.js +function validate(uuid) { + return typeof uuid === "string" && regex_default.test(uuid); +} +var validate_default; +var init_validate = __esm({ + "../../../node_modules/uuid/dist/esm-node/validate.js"() { + init_regex(); + validate_default = validate; } }); -// ../../../node_modules/@smithy/shared-ini-file-loader/dist-cjs/slurpFile.js -var require_slurpFile = __commonJS({ - "../../../node_modules/@smithy/shared-ini-file-loader/dist-cjs/slurpFile.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.slurpFile = void 0; - var fs_1 = require("fs"); - var { readFile } = fs_1.promises; - var filePromisesHash = {}; - var slurpFile = (path, options) => { - if (!filePromisesHash[path] || (options === null || options === void 0 ? void 0 : options.ignoreCache)) { - filePromisesHash[path] = readFile(path, "utf8"); - } - return filePromisesHash[path]; - }; - exports2.slurpFile = slurpFile; +// ../../../node_modules/uuid/dist/esm-node/stringify.js +function unsafeStringify(arr, offset = 0) { + return byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + "-" + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + "-" + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + "-" + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + "-" + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]]; +} +function stringify(arr, offset = 0) { + const uuid = unsafeStringify(arr, offset); + if (!validate_default(uuid)) { + throw TypeError("Stringified UUID is invalid"); + } + return uuid; +} +var byteToHex, stringify_default; +var init_stringify = __esm({ + "../../../node_modules/uuid/dist/esm-node/stringify.js"() { + init_validate(); + byteToHex = []; + for (let i = 0; i < 256; ++i) { + byteToHex.push((i + 256).toString(16).slice(1)); + } + stringify_default = stringify; } }); -// ../../../node_modules/@smithy/shared-ini-file-loader/dist-cjs/index.js -var require_dist_cjs21 = __commonJS({ - "../../../node_modules/@smithy/shared-ini-file-loader/dist-cjs/index.js"(exports2, module2) { - var __defProp2 = Object.defineProperty; - var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; - var __getOwnPropNames2 = Object.getOwnPropertyNames; - var __hasOwnProp2 = Object.prototype.hasOwnProperty; - var __name = (target, value) => __defProp2(target, "name", { value, configurable: true }); - var __export2 = (target, all) => { - for (var name in all) - __defProp2(target, name, { get: all[name], enumerable: true }); - }; - var __copyProps2 = (to, from, except, desc) => { - if (from && typeof from === "object" || typeof from === "function") { - for (let key of __getOwnPropNames2(from)) - if (!__hasOwnProp2.call(to, key) && key !== except) - __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable }); - } - return to; - }; - var __reExport = (target, mod, secondTarget) => (__copyProps2(target, mod, "default"), secondTarget && __copyProps2(secondTarget, mod, "default")); - var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); - var src_exports = {}; - __export2(src_exports, { - CONFIG_PREFIX_SEPARATOR: () => CONFIG_PREFIX_SEPARATOR, - DEFAULT_PROFILE: () => DEFAULT_PROFILE, - ENV_PROFILE: () => ENV_PROFILE, - getProfileName: () => getProfileName, - loadSharedConfigFiles: () => loadSharedConfigFiles, - loadSsoSessionData: () => loadSsoSessionData, - parseKnownFiles: () => parseKnownFiles - }); - module2.exports = __toCommonJS2(src_exports); - __reExport(src_exports, require_getHomeDir(), module2.exports); - var ENV_PROFILE = "AWS_PROFILE"; - var DEFAULT_PROFILE = "default"; - var getProfileName = /* @__PURE__ */ __name((init) => init.profile || process.env[ENV_PROFILE] || DEFAULT_PROFILE, "getProfileName"); - __reExport(src_exports, require_getSSOTokenFilepath(), module2.exports); - __reExport(src_exports, require_getSSOTokenFromFile(), module2.exports); - var import_types = require_dist_cjs(); - var getConfigData = /* @__PURE__ */ __name((data) => Object.entries(data).filter(([key]) => { - const indexOfSeparator = key.indexOf(CONFIG_PREFIX_SEPARATOR); - if (indexOfSeparator === -1) { - return false; - } - return Object.values(import_types.IniSectionType).includes(key.substring(0, indexOfSeparator)); - }).reduce( - (acc, [key, value]) => { - const indexOfSeparator = key.indexOf(CONFIG_PREFIX_SEPARATOR); - const updatedKey = key.substring(0, indexOfSeparator) === import_types.IniSectionType.PROFILE ? key.substring(indexOfSeparator + 1) : key; - acc[updatedKey] = value; - return acc; - }, - { - // Populate default profile, if present. - ...data.default && { default: data.default } - } - ), "getConfigData"); - var import_path = require("path"); - var import_getHomeDir = require_getHomeDir(); - var ENV_CONFIG_PATH = "AWS_CONFIG_FILE"; - var getConfigFilepath = /* @__PURE__ */ __name(() => process.env[ENV_CONFIG_PATH] || (0, import_path.join)((0, import_getHomeDir.getHomeDir)(), ".aws", "config"), "getConfigFilepath"); - var import_getHomeDir2 = require_getHomeDir(); - var ENV_CREDENTIALS_PATH = "AWS_SHARED_CREDENTIALS_FILE"; - var getCredentialsFilepath = /* @__PURE__ */ __name(() => process.env[ENV_CREDENTIALS_PATH] || (0, import_path.join)((0, import_getHomeDir2.getHomeDir)(), ".aws", "credentials"), "getCredentialsFilepath"); - var prefixKeyRegex = /^([\w-]+)\s(["'])?([\w-@\+\.%:/]+)\2$/; - var profileNameBlockList = ["__proto__", "profile __proto__"]; - var parseIni = /* @__PURE__ */ __name((iniData) => { - const map = {}; - let currentSection; - let currentSubSection; - for (const iniLine of iniData.split(/\r?\n/)) { - const trimmedLine = iniLine.split(/(^|\s)[;#]/)[0].trim(); - const isSection = trimmedLine[0] === "[" && trimmedLine[trimmedLine.length - 1] === "]"; - if (isSection) { - currentSection = void 0; - currentSubSection = void 0; - const sectionName = trimmedLine.substring(1, trimmedLine.length - 1); - const matches = prefixKeyRegex.exec(sectionName); - if (matches) { - const [, prefix, , name] = matches; - if (Object.values(import_types.IniSectionType).includes(prefix)) { - currentSection = [prefix, name].join(CONFIG_PREFIX_SEPARATOR); - } - } else { - currentSection = sectionName; - } - if (profileNameBlockList.includes(sectionName)) { - throw new Error(`Found invalid profile name "${sectionName}"`); - } - } else if (currentSection) { - const indexOfEqualsSign = trimmedLine.indexOf("="); - if (![0, -1].includes(indexOfEqualsSign)) { - const [name, value] = [ - trimmedLine.substring(0, indexOfEqualsSign).trim(), - trimmedLine.substring(indexOfEqualsSign + 1).trim() - ]; - if (value === "") { - currentSubSection = name; - } else { - if (currentSubSection && iniLine.trimStart() === iniLine) { - currentSubSection = void 0; - } - map[currentSection] = map[currentSection] || {}; - const key = currentSubSection ? [currentSubSection, name].join(CONFIG_PREFIX_SEPARATOR) : name; - map[currentSection][key] = value; - } - } - } - } - return map; - }, "parseIni"); - var import_slurpFile = require_slurpFile(); - var swallowError = /* @__PURE__ */ __name(() => ({}), "swallowError"); - var CONFIG_PREFIX_SEPARATOR = "."; - var loadSharedConfigFiles = /* @__PURE__ */ __name(async (init = {}) => { - const { filepath = getCredentialsFilepath(), configFilepath = getConfigFilepath() } = init; - const parsedFiles = await Promise.all([ - (0, import_slurpFile.slurpFile)(configFilepath, { - ignoreCache: init.ignoreCache - }).then(parseIni).then(getConfigData).catch(swallowError), - (0, import_slurpFile.slurpFile)(filepath, { - ignoreCache: init.ignoreCache - }).then(parseIni).catch(swallowError) - ]); - return { - configFile: parsedFiles[0], - credentialsFile: parsedFiles[1] - }; - }, "loadSharedConfigFiles"); - var getSsoSessionData = /* @__PURE__ */ __name((data) => Object.entries(data).filter(([key]) => key.startsWith(import_types.IniSectionType.SSO_SESSION + CONFIG_PREFIX_SEPARATOR)).reduce((acc, [key, value]) => ({ ...acc, [key.substring(key.indexOf(CONFIG_PREFIX_SEPARATOR) + 1)]: value }), {}), "getSsoSessionData"); - var import_slurpFile2 = require_slurpFile(); - var swallowError2 = /* @__PURE__ */ __name(() => ({}), "swallowError"); - var loadSsoSessionData = /* @__PURE__ */ __name(async (init = {}) => (0, import_slurpFile2.slurpFile)(init.configFilepath ?? getConfigFilepath()).then(parseIni).then(getSsoSessionData).catch(swallowError2), "loadSsoSessionData"); - var mergeConfigFiles = /* @__PURE__ */ __name((...files) => { - const merged = {}; - for (const file of files) { - for (const [key, values] of Object.entries(file)) { - if (merged[key] !== void 0) { - Object.assign(merged[key], values); - } else { - merged[key] = values; - } - } - } - return merged; - }, "mergeConfigFiles"); - var parseKnownFiles = /* @__PURE__ */ __name(async (init) => { - const parsedFiles = await loadSharedConfigFiles(init); - return mergeConfigFiles(parsedFiles.configFile, parsedFiles.credentialsFile); - }, "parseKnownFiles"); +// ../../../node_modules/uuid/dist/esm-node/v1.js +function v1(options, buf, offset) { + let i = buf && offset || 0; + const b = buf || new Array(16); + options = options || {}; + let node = options.node || _nodeId; + let clockseq = options.clockseq !== void 0 ? options.clockseq : _clockseq; + if (node == null || clockseq == null) { + const seedBytes = options.random || (options.rng || rng)(); + if (node == null) { + node = _nodeId = [seedBytes[0] | 1, seedBytes[1], seedBytes[2], seedBytes[3], seedBytes[4], seedBytes[5]]; + } + if (clockseq == null) { + clockseq = _clockseq = (seedBytes[6] << 8 | seedBytes[7]) & 16383; + } } -}); - -// ../../../node_modules/@smithy/node-config-provider/dist-cjs/index.js -var require_dist_cjs22 = __commonJS({ - "../../../node_modules/@smithy/node-config-provider/dist-cjs/index.js"(exports2, module2) { - var __defProp2 = Object.defineProperty; - var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; - var __getOwnPropNames2 = Object.getOwnPropertyNames; - var __hasOwnProp2 = Object.prototype.hasOwnProperty; - var __name = (target, value) => __defProp2(target, "name", { value, configurable: true }); - var __export2 = (target, all) => { - for (var name in all) - __defProp2(target, name, { get: all[name], enumerable: true }); - }; - var __copyProps2 = (to, from, except, desc) => { - if (from && typeof from === "object" || typeof from === "function") { - for (let key of __getOwnPropNames2(from)) - if (!__hasOwnProp2.call(to, key) && key !== except) - __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable }); - } - return to; - }; - var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); - var src_exports = {}; - __export2(src_exports, { - loadConfig: () => loadConfig - }); - module2.exports = __toCommonJS2(src_exports); - var import_property_provider = require_dist_cjs6(); - var fromEnv = /* @__PURE__ */ __name((envVarSelector) => async () => { - try { - const config = envVarSelector(process.env); - if (config === void 0) { - throw new Error(); - } - return config; - } catch (e) { - throw new import_property_provider.CredentialsProviderError( - e.message || `Cannot load config from environment variables with getter: ${envVarSelector}` - ); - } - }, "fromEnv"); - var import_shared_ini_file_loader = require_dist_cjs21(); - var fromSharedConfigFiles = /* @__PURE__ */ __name((configSelector, { preferredFile = "config", ...init } = {}) => async () => { - const profile = (0, import_shared_ini_file_loader.getProfileName)(init); - const { configFile, credentialsFile } = await (0, import_shared_ini_file_loader.loadSharedConfigFiles)(init); - const profileFromCredentials = credentialsFile[profile] || {}; - const profileFromConfig = configFile[profile] || {}; - const mergedProfile = preferredFile === "config" ? { ...profileFromCredentials, ...profileFromConfig } : { ...profileFromConfig, ...profileFromCredentials }; - try { - const cfgFile = preferredFile === "config" ? configFile : credentialsFile; - const configValue = configSelector(mergedProfile, cfgFile); - if (configValue === void 0) { - throw new Error(); - } - return configValue; - } catch (e) { - throw new import_property_provider.CredentialsProviderError( - e.message || `Cannot load config for profile ${profile} in SDK configuration files with getter: ${configSelector}` - ); - } - }, "fromSharedConfigFiles"); - var isFunction = /* @__PURE__ */ __name((func) => typeof func === "function", "isFunction"); - var fromStatic = /* @__PURE__ */ __name((defaultValue) => isFunction(defaultValue) ? async () => await defaultValue() : (0, import_property_provider.fromStatic)(defaultValue), "fromStatic"); - var loadConfig = /* @__PURE__ */ __name(({ environmentVariableSelector, configFileSelector, default: defaultValue }, configuration = {}) => (0, import_property_provider.memoize)( - (0, import_property_provider.chain)( - fromEnv(environmentVariableSelector), - fromSharedConfigFiles(configFileSelector, configuration), - fromStatic(defaultValue) - ) - ), "loadConfig"); + let msecs = options.msecs !== void 0 ? options.msecs : Date.now(); + let nsecs = options.nsecs !== void 0 ? options.nsecs : _lastNSecs + 1; + const dt = msecs - _lastMSecs + (nsecs - _lastNSecs) / 1e4; + if (dt < 0 && options.clockseq === void 0) { + clockseq = clockseq + 1 & 16383; } -}); - -// ../../../node_modules/@smithy/middleware-endpoint/dist-cjs/adaptors/getEndpointUrlConfig.js -var require_getEndpointUrlConfig = __commonJS({ - "../../../node_modules/@smithy/middleware-endpoint/dist-cjs/adaptors/getEndpointUrlConfig.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.getEndpointUrlConfig = void 0; - var shared_ini_file_loader_1 = require_dist_cjs21(); - var ENV_ENDPOINT_URL = "AWS_ENDPOINT_URL"; - var CONFIG_ENDPOINT_URL = "endpoint_url"; - var getEndpointUrlConfig = (serviceId) => ({ - environmentVariableSelector: (env) => { - const serviceSuffixParts = serviceId.split(" ").map((w) => w.toUpperCase()); - const serviceEndpointUrl = env[[ENV_ENDPOINT_URL, ...serviceSuffixParts].join("_")]; - if (serviceEndpointUrl) - return serviceEndpointUrl; - const endpointUrl = env[ENV_ENDPOINT_URL]; - if (endpointUrl) - return endpointUrl; - return void 0; - }, - configFileSelector: (profile, config) => { - if (config && profile.services) { - const servicesSection = config[["services", profile.services].join(shared_ini_file_loader_1.CONFIG_PREFIX_SEPARATOR)]; - if (servicesSection) { - const servicePrefixParts = serviceId.split(" ").map((w) => w.toLowerCase()); - const endpointUrl2 = servicesSection[[servicePrefixParts.join("_"), CONFIG_ENDPOINT_URL].join(shared_ini_file_loader_1.CONFIG_PREFIX_SEPARATOR)]; - if (endpointUrl2) - return endpointUrl2; - } - } - const endpointUrl = profile[CONFIG_ENDPOINT_URL]; - if (endpointUrl) - return endpointUrl; - return void 0; - }, - default: void 0 - }); - exports2.getEndpointUrlConfig = getEndpointUrlConfig; + if ((dt < 0 || msecs > _lastMSecs) && options.nsecs === void 0) { + nsecs = 0; + } + if (nsecs >= 1e4) { + throw new Error("uuid.v1(): Can't create more than 10M uuids/sec"); + } + _lastMSecs = msecs; + _lastNSecs = nsecs; + _clockseq = clockseq; + msecs += 122192928e5; + const tl = ((msecs & 268435455) * 1e4 + nsecs) % 4294967296; + b[i++] = tl >>> 24 & 255; + b[i++] = tl >>> 16 & 255; + b[i++] = tl >>> 8 & 255; + b[i++] = tl & 255; + const tmh = msecs / 4294967296 * 1e4 & 268435455; + b[i++] = tmh >>> 8 & 255; + b[i++] = tmh & 255; + b[i++] = tmh >>> 24 & 15 | 16; + b[i++] = tmh >>> 16 & 255; + b[i++] = clockseq >>> 8 | 128; + b[i++] = clockseq & 255; + for (let n = 0; n < 6; ++n) { + b[i + n] = node[n]; + } + return buf || unsafeStringify(b); +} +var _nodeId, _clockseq, _lastMSecs, _lastNSecs, v1_default; +var init_v1 = __esm({ + "../../../node_modules/uuid/dist/esm-node/v1.js"() { + init_rng(); + init_stringify(); + _lastMSecs = 0; + _lastNSecs = 0; + v1_default = v1; } }); -// ../../../node_modules/@smithy/middleware-endpoint/dist-cjs/adaptors/getEndpointFromConfig.js -var require_getEndpointFromConfig = __commonJS({ - "../../../node_modules/@smithy/middleware-endpoint/dist-cjs/adaptors/getEndpointFromConfig.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.getEndpointFromConfig = void 0; - var node_config_provider_1 = require_dist_cjs22(); - var getEndpointUrlConfig_1 = require_getEndpointUrlConfig(); - var getEndpointFromConfig = async (serviceId) => (0, node_config_provider_1.loadConfig)((0, getEndpointUrlConfig_1.getEndpointUrlConfig)(serviceId))(); - exports2.getEndpointFromConfig = getEndpointFromConfig; +// ../../../node_modules/uuid/dist/esm-node/parse.js +function parse(uuid) { + if (!validate_default(uuid)) { + throw TypeError("Invalid UUID"); + } + let v; + const arr = new Uint8Array(16); + arr[0] = (v = parseInt(uuid.slice(0, 8), 16)) >>> 24; + arr[1] = v >>> 16 & 255; + arr[2] = v >>> 8 & 255; + arr[3] = v & 255; + arr[4] = (v = parseInt(uuid.slice(9, 13), 16)) >>> 8; + arr[5] = v & 255; + arr[6] = (v = parseInt(uuid.slice(14, 18), 16)) >>> 8; + arr[7] = v & 255; + arr[8] = (v = parseInt(uuid.slice(19, 23), 16)) >>> 8; + arr[9] = v & 255; + arr[10] = (v = parseInt(uuid.slice(24, 36), 16)) / 1099511627776 & 255; + arr[11] = v / 4294967296 & 255; + arr[12] = v >>> 24 & 255; + arr[13] = v >>> 16 & 255; + arr[14] = v >>> 8 & 255; + arr[15] = v & 255; + return arr; +} +var parse_default; +var init_parse = __esm({ + "../../../node_modules/uuid/dist/esm-node/parse.js"() { + init_validate(); + parse_default = parse; } }); -// ../../../node_modules/@smithy/querystring-parser/dist-cjs/index.js -var require_dist_cjs23 = __commonJS({ - "../../../node_modules/@smithy/querystring-parser/dist-cjs/index.js"(exports2, module2) { - var __defProp2 = Object.defineProperty; - var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; - var __getOwnPropNames2 = Object.getOwnPropertyNames; - var __hasOwnProp2 = Object.prototype.hasOwnProperty; - var __name = (target, value) => __defProp2(target, "name", { value, configurable: true }); - var __export2 = (target, all) => { - for (var name in all) - __defProp2(target, name, { get: all[name], enumerable: true }); - }; - var __copyProps2 = (to, from, except, desc) => { - if (from && typeof from === "object" || typeof from === "function") { - for (let key of __getOwnPropNames2(from)) - if (!__hasOwnProp2.call(to, key) && key !== except) - __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable }); +// ../../../node_modules/uuid/dist/esm-node/v35.js +function stringToBytes(str) { + str = unescape(encodeURIComponent(str)); + const bytes = []; + for (let i = 0; i < str.length; ++i) { + bytes.push(str.charCodeAt(i)); + } + return bytes; +} +function v35(name, version2, hashfunc) { + function generateUUID(value, namespace, buf, offset) { + var _namespace; + if (typeof value === "string") { + value = stringToBytes(value); + } + if (typeof namespace === "string") { + namespace = parse_default(namespace); + } + if (((_namespace = namespace) === null || _namespace === void 0 ? void 0 : _namespace.length) !== 16) { + throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)"); + } + let bytes = new Uint8Array(16 + value.length); + bytes.set(namespace); + bytes.set(value, namespace.length); + bytes = hashfunc(bytes); + bytes[6] = bytes[6] & 15 | version2; + bytes[8] = bytes[8] & 63 | 128; + if (buf) { + offset = offset || 0; + for (let i = 0; i < 16; ++i) { + buf[offset + i] = bytes[i]; } - return to; + return buf; + } + return unsafeStringify(bytes); + } + try { + generateUUID.name = name; + } catch (err) { + } + generateUUID.DNS = DNS; + generateUUID.URL = URL2; + return generateUUID; +} +var DNS, URL2; +var init_v35 = __esm({ + "../../../node_modules/uuid/dist/esm-node/v35.js"() { + init_stringify(); + init_parse(); + DNS = "6ba7b810-9dad-11d1-80b4-00c04fd430c8"; + URL2 = "6ba7b811-9dad-11d1-80b4-00c04fd430c8"; + } +}); + +// ../../../node_modules/uuid/dist/esm-node/md5.js +function md5(bytes) { + if (Array.isArray(bytes)) { + bytes = Buffer.from(bytes); + } else if (typeof bytes === "string") { + bytes = Buffer.from(bytes, "utf8"); + } + return import_crypto2.default.createHash("md5").update(bytes).digest(); +} +var import_crypto2, md5_default; +var init_md5 = __esm({ + "../../../node_modules/uuid/dist/esm-node/md5.js"() { + import_crypto2 = __toESM(require("crypto")); + md5_default = md5; + } +}); + +// ../../../node_modules/uuid/dist/esm-node/v3.js +var v3, v3_default; +var init_v3 = __esm({ + "../../../node_modules/uuid/dist/esm-node/v3.js"() { + init_v35(); + init_md5(); + v3 = v35("v3", 48, md5_default); + v3_default = v3; + } +}); + +// ../../../node_modules/uuid/dist/esm-node/native.js +var import_crypto3, native_default; +var init_native = __esm({ + "../../../node_modules/uuid/dist/esm-node/native.js"() { + import_crypto3 = __toESM(require("crypto")); + native_default = { + randomUUID: import_crypto3.default.randomUUID }; - var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); - var src_exports = {}; - __export2(src_exports, { - parseQueryString: () => parseQueryString - }); - module2.exports = __toCommonJS2(src_exports); - function parseQueryString(querystring) { - const query = {}; - querystring = querystring.replace(/^\?/, ""); - if (querystring) { - for (const pair of querystring.split("&")) { - let [key, value = null] = pair.split("="); - key = decodeURIComponent(key); - if (value) { - value = decodeURIComponent(value); - } - if (!(key in query)) { - query[key] = value; - } else if (Array.isArray(query[key])) { - query[key].push(value); - } else { - query[key] = [query[key], value]; - } - } - } - return query; + } +}); + +// ../../../node_modules/uuid/dist/esm-node/v4.js +function v4(options, buf, offset) { + if (native_default.randomUUID && !buf && !options) { + return native_default.randomUUID(); + } + options = options || {}; + const rnds = options.random || (options.rng || rng)(); + rnds[6] = rnds[6] & 15 | 64; + rnds[8] = rnds[8] & 63 | 128; + if (buf) { + offset = offset || 0; + for (let i = 0; i < 16; ++i) { + buf[offset + i] = rnds[i]; } - __name(parseQueryString, "parseQueryString"); + return buf; + } + return unsafeStringify(rnds); +} +var v4_default; +var init_v4 = __esm({ + "../../../node_modules/uuid/dist/esm-node/v4.js"() { + init_native(); + init_rng(); + init_stringify(); + v4_default = v4; } }); -// ../../../node_modules/@smithy/url-parser/dist-cjs/index.js -var require_dist_cjs24 = __commonJS({ - "../../../node_modules/@smithy/url-parser/dist-cjs/index.js"(exports2, module2) { +// ../../../node_modules/uuid/dist/esm-node/sha1.js +function sha1(bytes) { + if (Array.isArray(bytes)) { + bytes = Buffer.from(bytes); + } else if (typeof bytes === "string") { + bytes = Buffer.from(bytes, "utf8"); + } + return import_crypto4.default.createHash("sha1").update(bytes).digest(); +} +var import_crypto4, sha1_default; +var init_sha1 = __esm({ + "../../../node_modules/uuid/dist/esm-node/sha1.js"() { + import_crypto4 = __toESM(require("crypto")); + sha1_default = sha1; + } +}); + +// ../../../node_modules/uuid/dist/esm-node/v5.js +var v5, v5_default; +var init_v5 = __esm({ + "../../../node_modules/uuid/dist/esm-node/v5.js"() { + init_v35(); + init_sha1(); + v5 = v35("v5", 80, sha1_default); + v5_default = v5; + } +}); + +// ../../../node_modules/uuid/dist/esm-node/nil.js +var nil_default; +var init_nil = __esm({ + "../../../node_modules/uuid/dist/esm-node/nil.js"() { + nil_default = "00000000-0000-0000-0000-000000000000"; + } +}); + +// ../../../node_modules/uuid/dist/esm-node/version.js +function version(uuid) { + if (!validate_default(uuid)) { + throw TypeError("Invalid UUID"); + } + return parseInt(uuid.slice(14, 15), 16); +} +var version_default; +var init_version = __esm({ + "../../../node_modules/uuid/dist/esm-node/version.js"() { + init_validate(); + version_default = version; + } +}); + +// ../../../node_modules/uuid/dist/esm-node/index.js +var esm_node_exports = {}; +__export(esm_node_exports, { + NIL: () => nil_default, + parse: () => parse_default, + stringify: () => stringify_default, + v1: () => v1_default, + v3: () => v3_default, + v4: () => v4_default, + v5: () => v5_default, + validate: () => validate_default, + version: () => version_default +}); +var init_esm_node = __esm({ + "../../../node_modules/uuid/dist/esm-node/index.js"() { + init_v1(); + init_v3(); + init_v4(); + init_v5(); + init_nil(); + init_version(); + init_validate(); + init_stringify(); + init_parse(); + } +}); + +// ../../../node_modules/@smithy/service-error-classification/dist-cjs/index.js +var require_dist_cjs22 = __commonJS({ + "../../../node_modules/@smithy/service-error-classification/dist-cjs/index.js"(exports2, module2) { var __defProp2 = Object.defineProperty; var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; var __getOwnPropNames2 = Object.getOwnPropertyNames; @@ -5348,123 +4613,73 @@ var require_dist_cjs24 = __commonJS({ var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); var src_exports = {}; __export2(src_exports, { - parseUrl: () => parseUrl + isClockSkewCorrectedError: () => isClockSkewCorrectedError, + isClockSkewError: () => isClockSkewError, + isRetryableByTrait: () => isRetryableByTrait, + isServerError: () => isServerError, + isThrottlingError: () => isThrottlingError, + isTransientError: () => isTransientError }); module2.exports = __toCommonJS2(src_exports); - var import_querystring_parser = require_dist_cjs23(); - var parseUrl = /* @__PURE__ */ __name((url2) => { - if (typeof url2 === "string") { - return parseUrl(new URL(url2)); - } - const { hostname, pathname, port, protocol, search } = url2; - let query; - if (search) { - query = (0, import_querystring_parser.parseQueryString)(search); - } - return { - hostname, - port: port ? parseInt(port) : void 0, - protocol, - path: pathname, - query - }; - }, "parseUrl"); - } -}); - -// ../../../node_modules/@smithy/middleware-serde/dist-cjs/index.js -var require_dist_cjs25 = __commonJS({ - "../../../node_modules/@smithy/middleware-serde/dist-cjs/index.js"(exports2, module2) { - var __defProp2 = Object.defineProperty; - var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; - var __getOwnPropNames2 = Object.getOwnPropertyNames; - var __hasOwnProp2 = Object.prototype.hasOwnProperty; - var __name = (target, value) => __defProp2(target, "name", { value, configurable: true }); - var __export2 = (target, all) => { - for (var name in all) - __defProp2(target, name, { get: all[name], enumerable: true }); - }; - var __copyProps2 = (to, from, except, desc) => { - if (from && typeof from === "object" || typeof from === "function") { - for (let key of __getOwnPropNames2(from)) - if (!__hasOwnProp2.call(to, key) && key !== except) - __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable }); - } - return to; - }; - var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); - var src_exports = {}; - __export2(src_exports, { - deserializerMiddleware: () => deserializerMiddleware, - deserializerMiddlewareOption: () => deserializerMiddlewareOption, - getSerdePlugin: () => getSerdePlugin, - serializerMiddleware: () => serializerMiddleware, - serializerMiddlewareOption: () => serializerMiddlewareOption - }); - module2.exports = __toCommonJS2(src_exports); - var deserializerMiddleware = /* @__PURE__ */ __name((options, deserializer) => (next, context) => async (args) => { - const { response } = await next(args); - try { - const parsed = await deserializer(response, options); - return { - response, - output: parsed - }; - } catch (error) { - Object.defineProperty(error, "$response", { - value: response - }); - if (!("$metadata" in error)) { - const hint = `Deserialization error: to see the raw response, inspect the hidden field {error}.$response on this object.`; - error.message += "\n " + hint; - if (typeof error.$responseBodyText !== "undefined") { - if (error.$response) { - error.$response.body = error.$responseBodyText; - } - } - } - throw error; - } - }, "deserializerMiddleware"); - var serializerMiddleware = /* @__PURE__ */ __name((options, serializer) => (next, context) => async (args) => { + var CLOCK_SKEW_ERROR_CODES = [ + "AuthFailure", + "InvalidSignatureException", + "RequestExpired", + "RequestInTheFuture", + "RequestTimeTooSkewed", + "SignatureDoesNotMatch" + ]; + var THROTTLING_ERROR_CODES = [ + "BandwidthLimitExceeded", + "EC2ThrottledException", + "LimitExceededException", + "PriorRequestNotComplete", + "ProvisionedThroughputExceededException", + "RequestLimitExceeded", + "RequestThrottled", + "RequestThrottledException", + "SlowDown", + "ThrottledException", + "Throttling", + "ThrottlingException", + "TooManyRequestsException", + "TransactionInProgressException" + // DynamoDB + ]; + var TRANSIENT_ERROR_CODES = ["TimeoutError", "RequestTimeout", "RequestTimeoutException"]; + var TRANSIENT_ERROR_STATUS_CODES = [500, 502, 503, 504]; + var NODEJS_TIMEOUT_ERROR_CODES = ["ECONNRESET", "ECONNREFUSED", "EPIPE", "ETIMEDOUT"]; + var isRetryableByTrait = /* @__PURE__ */ __name((error) => error.$retryable !== void 0, "isRetryableByTrait"); + var isClockSkewError = /* @__PURE__ */ __name((error) => CLOCK_SKEW_ERROR_CODES.includes(error.name), "isClockSkewError"); + var isClockSkewCorrectedError = /* @__PURE__ */ __name((error) => { var _a; - const endpoint = ((_a = context.endpointV2) == null ? void 0 : _a.url) && options.urlParser ? async () => options.urlParser(context.endpointV2.url) : options.endpoint; - if (!endpoint) { - throw new Error("No valid endpoint provider available."); - } - const request2 = await serializer(args.input, { ...options, endpoint }); - return next({ - ...args, - request: request2 - }); - }, "serializerMiddleware"); - var deserializerMiddlewareOption = { - name: "deserializerMiddleware", - step: "deserialize", - tags: ["DESERIALIZER"], - override: true - }; - var serializerMiddlewareOption = { - name: "serializerMiddleware", - step: "serialize", - tags: ["SERIALIZER"], - override: true - }; - function getSerdePlugin(config, serializer, deserializer) { - return { - applyToStack: (commandStack) => { - commandStack.add(deserializerMiddleware(config, deserializer), deserializerMiddlewareOption); - commandStack.add(serializerMiddleware(config, serializer), serializerMiddlewareOption); + return (_a = error.$metadata) == null ? void 0 : _a.clockSkewCorrected; + }, "isClockSkewCorrectedError"); + var isThrottlingError = /* @__PURE__ */ __name((error) => { + var _a, _b; + return ((_a = error.$metadata) == null ? void 0 : _a.httpStatusCode) === 429 || THROTTLING_ERROR_CODES.includes(error.name) || ((_b = error.$retryable) == null ? void 0 : _b.throttling) == true; + }, "isThrottlingError"); + var isTransientError = /* @__PURE__ */ __name((error) => { + var _a; + return isClockSkewCorrectedError(error) || TRANSIENT_ERROR_CODES.includes(error.name) || NODEJS_TIMEOUT_ERROR_CODES.includes((error == null ? void 0 : error.code) || "") || TRANSIENT_ERROR_STATUS_CODES.includes(((_a = error.$metadata) == null ? void 0 : _a.httpStatusCode) || 0); + }, "isTransientError"); + var isServerError = /* @__PURE__ */ __name((error) => { + var _a; + if (((_a = error.$metadata) == null ? void 0 : _a.httpStatusCode) !== void 0) { + const statusCode = error.$metadata.httpStatusCode; + if (500 <= statusCode && statusCode <= 599 && !isTransientError(error)) { + return true; } - }; - } - __name(getSerdePlugin, "getSerdePlugin"); + return false; + } + return false; + }, "isServerError"); } }); -// ../../../node_modules/@smithy/middleware-endpoint/dist-cjs/index.js -var require_dist_cjs26 = __commonJS({ - "../../../node_modules/@smithy/middleware-endpoint/dist-cjs/index.js"(exports2, module2) { +// ../../../node_modules/@smithy/middleware-retry/node_modules/@smithy/util-retry/dist-cjs/index.js +var require_dist_cjs23 = __commonJS({ + "../../../node_modules/@smithy/middleware-retry/node_modules/@smithy/util-retry/dist-cjs/index.js"(exports2, module2) { var __defProp2 = Object.defineProperty; var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; var __getOwnPropNames2 = Object.getOwnPropertyNames; @@ -5485,567 +4700,338 @@ var require_dist_cjs26 = __commonJS({ var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); var src_exports = {}; __export2(src_exports, { - endpointMiddleware: () => endpointMiddleware, - endpointMiddlewareOptions: () => endpointMiddlewareOptions, - getEndpointFromInstructions: () => getEndpointFromInstructions, - getEndpointPlugin: () => getEndpointPlugin, - resolveEndpointConfig: () => resolveEndpointConfig, - resolveParams: () => resolveParams, - toEndpointV1: () => toEndpointV1 + AdaptiveRetryStrategy: () => AdaptiveRetryStrategy, + ConfiguredRetryStrategy: () => ConfiguredRetryStrategy, + DEFAULT_MAX_ATTEMPTS: () => DEFAULT_MAX_ATTEMPTS, + DEFAULT_RETRY_DELAY_BASE: () => DEFAULT_RETRY_DELAY_BASE, + DEFAULT_RETRY_MODE: () => DEFAULT_RETRY_MODE, + DefaultRateLimiter: () => DefaultRateLimiter, + INITIAL_RETRY_TOKENS: () => INITIAL_RETRY_TOKENS, + INVOCATION_ID_HEADER: () => INVOCATION_ID_HEADER, + MAXIMUM_RETRY_DELAY: () => MAXIMUM_RETRY_DELAY, + NO_RETRY_INCREMENT: () => NO_RETRY_INCREMENT, + REQUEST_HEADER: () => REQUEST_HEADER, + RETRY_COST: () => RETRY_COST, + RETRY_MODES: () => RETRY_MODES, + StandardRetryStrategy: () => StandardRetryStrategy, + THROTTLING_RETRY_DELAY_BASE: () => THROTTLING_RETRY_DELAY_BASE, + TIMEOUT_RETRY_COST: () => TIMEOUT_RETRY_COST }); module2.exports = __toCommonJS2(src_exports); - var resolveParamsForS3 = /* @__PURE__ */ __name(async (endpointParams) => { - const bucket = (endpointParams == null ? void 0 : endpointParams.Bucket) || ""; - if (typeof endpointParams.Bucket === "string") { - endpointParams.Bucket = bucket.replace(/#/g, encodeURIComponent("#")).replace(/\?/g, encodeURIComponent("?")); - } - if (isArnBucketName(bucket)) { - if (endpointParams.ForcePathStyle === true) { - throw new Error("Path-style addressing cannot be used with ARN buckets"); - } - } else if (!isDnsCompatibleBucketName(bucket) || bucket.indexOf(".") !== -1 && !String(endpointParams.Endpoint).startsWith("http:") || bucket.toLowerCase() !== bucket || bucket.length < 3) { - endpointParams.ForcePathStyle = true; + var RETRY_MODES = /* @__PURE__ */ ((RETRY_MODES2) => { + RETRY_MODES2["STANDARD"] = "standard"; + RETRY_MODES2["ADAPTIVE"] = "adaptive"; + return RETRY_MODES2; + })(RETRY_MODES || {}); + var DEFAULT_MAX_ATTEMPTS = 3; + var DEFAULT_RETRY_MODE = "standard"; + var import_service_error_classification = require_dist_cjs22(); + var _DefaultRateLimiter = class _DefaultRateLimiter { + constructor(options) { + this.currentCapacity = 0; + this.enabled = false; + this.lastMaxRate = 0; + this.measuredTxRate = 0; + this.requestCount = 0; + this.lastTimestamp = 0; + this.timeWindow = 0; + this.beta = (options == null ? void 0 : options.beta) ?? 0.7; + this.minCapacity = (options == null ? void 0 : options.minCapacity) ?? 1; + this.minFillRate = (options == null ? void 0 : options.minFillRate) ?? 0.5; + this.scaleConstant = (options == null ? void 0 : options.scaleConstant) ?? 0.4; + this.smooth = (options == null ? void 0 : options.smooth) ?? 0.8; + const currentTimeInSeconds = this.getCurrentTimeInSeconds(); + this.lastThrottleTime = currentTimeInSeconds; + this.lastTxRateBucket = Math.floor(this.getCurrentTimeInSeconds()); + this.fillRate = this.minFillRate; + this.maxCapacity = this.minCapacity; } - if (endpointParams.DisableMultiRegionAccessPoints) { - endpointParams.disableMultiRegionAccessPoints = true; - endpointParams.DisableMRAP = true; + getCurrentTimeInSeconds() { + return Date.now() / 1e3; } - return endpointParams; - }, "resolveParamsForS3"); - var DOMAIN_PATTERN = /^[a-z0-9][a-z0-9\.\-]{1,61}[a-z0-9]$/; - var IP_ADDRESS_PATTERN = /(\d+\.){3}\d+/; - var DOTS_PATTERN = /\.\./; - var isDnsCompatibleBucketName = /* @__PURE__ */ __name((bucketName) => DOMAIN_PATTERN.test(bucketName) && !IP_ADDRESS_PATTERN.test(bucketName) && !DOTS_PATTERN.test(bucketName), "isDnsCompatibleBucketName"); - var isArnBucketName = /* @__PURE__ */ __name((bucketName) => { - const [arn, partition, service, , , bucket] = bucketName.split(":"); - const isArn = arn === "arn" && bucketName.split(":").length >= 6; - const isValidArn = Boolean(isArn && partition && service && bucket); - if (isArn && !isValidArn) { - throw new Error(`Invalid ARN: ${bucketName} was an invalid ARN.`); + async getSendToken() { + return this.acquireTokenBucket(1); } - return isValidArn; - }, "isArnBucketName"); - var createConfigValueProvider = /* @__PURE__ */ __name((configKey, canonicalEndpointParamKey, config) => { - const configProvider = /* @__PURE__ */ __name(async () => { - const configValue = config[configKey] ?? config[canonicalEndpointParamKey]; - if (typeof configValue === "function") { - return configValue(); + async acquireTokenBucket(amount) { + if (!this.enabled) { + return; } - return configValue; - }, "configProvider"); - if (configKey === "credentialScope" || canonicalEndpointParamKey === "CredentialScope") { - return async () => { - const credentials = typeof config.credentials === "function" ? await config.credentials() : config.credentials; - const configValue = (credentials == null ? void 0 : credentials.credentialScope) ?? (credentials == null ? void 0 : credentials.CredentialScope); - return configValue; - }; - } - if (configKey === "endpoint" || canonicalEndpointParamKey === "endpoint") { - return async () => { - const endpoint = await configProvider(); - if (endpoint && typeof endpoint === "object") { - if ("url" in endpoint) { - return endpoint.url.href; - } - if ("hostname" in endpoint) { - const { protocol, hostname, port, path } = endpoint; - return `${protocol}//${hostname}${port ? ":" + port : ""}${path}`; - } - } - return endpoint; - }; - } - return configProvider; - }, "createConfigValueProvider"); - var import_getEndpointFromConfig = require_getEndpointFromConfig(); - var import_url_parser = require_dist_cjs24(); - var toEndpointV1 = /* @__PURE__ */ __name((endpoint) => { - if (typeof endpoint === "object") { - if ("url" in endpoint) { - return (0, import_url_parser.parseUrl)(endpoint.url); + this.refillTokenBucket(); + if (amount > this.currentCapacity) { + const delay = (amount - this.currentCapacity) / this.fillRate * 1e3; + await new Promise((resolve) => setTimeout(resolve, delay)); } - return endpoint; + this.currentCapacity = this.currentCapacity - amount; } - return (0, import_url_parser.parseUrl)(endpoint); - }, "toEndpointV1"); - var getEndpointFromInstructions = /* @__PURE__ */ __name(async (commandInput, instructionsSupplier, clientConfig, context) => { - if (!clientConfig.endpoint) { - const endpointFromConfig = await (0, import_getEndpointFromConfig.getEndpointFromConfig)(clientConfig.serviceId || ""); - if (endpointFromConfig) { - clientConfig.endpoint = () => Promise.resolve(toEndpointV1(endpointFromConfig)); + refillTokenBucket() { + const timestamp = this.getCurrentTimeInSeconds(); + if (!this.lastTimestamp) { + this.lastTimestamp = timestamp; + return; } + const fillAmount = (timestamp - this.lastTimestamp) * this.fillRate; + this.currentCapacity = Math.min(this.maxCapacity, this.currentCapacity + fillAmount); + this.lastTimestamp = timestamp; } - const endpointParams = await resolveParams(commandInput, instructionsSupplier, clientConfig); - if (typeof clientConfig.endpointProvider !== "function") { - throw new Error("config.endpointProvider is not set."); - } - const endpoint = clientConfig.endpointProvider(endpointParams, context); - return endpoint; - }, "getEndpointFromInstructions"); - var resolveParams = /* @__PURE__ */ __name(async (commandInput, instructionsSupplier, clientConfig) => { - var _a; - const endpointParams = {}; - const instructions = ((_a = instructionsSupplier == null ? void 0 : instructionsSupplier.getEndpointParameterInstructions) == null ? void 0 : _a.call(instructionsSupplier)) || {}; - for (const [name, instruction] of Object.entries(instructions)) { - switch (instruction.type) { - case "staticContextParams": - endpointParams[name] = instruction.value; - break; - case "contextParams": - endpointParams[name] = commandInput[instruction.name]; - break; - case "clientContextParams": - case "builtInParams": - endpointParams[name] = await createConfigValueProvider(instruction.name, name, clientConfig)(); - break; - default: - throw new Error("Unrecognized endpoint parameter instruction: " + JSON.stringify(instruction)); + updateClientSendingRate(response) { + let calculatedRate; + this.updateMeasuredRate(); + if ((0, import_service_error_classification.isThrottlingError)(response)) { + const rateToUse = !this.enabled ? this.measuredTxRate : Math.min(this.measuredTxRate, this.fillRate); + this.lastMaxRate = rateToUse; + this.calculateTimeWindow(); + this.lastThrottleTime = this.getCurrentTimeInSeconds(); + calculatedRate = this.cubicThrottle(rateToUse); + this.enableTokenBucket(); + } else { + this.calculateTimeWindow(); + calculatedRate = this.cubicSuccess(this.getCurrentTimeInSeconds()); } + const newRate = Math.min(calculatedRate, 2 * this.measuredTxRate); + this.updateTokenBucketRate(newRate); } - if (Object.keys(instructions).length === 0) { - Object.assign(endpointParams, clientConfig); + calculateTimeWindow() { + this.timeWindow = this.getPrecise(Math.pow(this.lastMaxRate * (1 - this.beta) / this.scaleConstant, 1 / 3)); } - if (String(clientConfig.serviceId).toLowerCase() === "s3") { - await resolveParamsForS3(endpointParams); + cubicThrottle(rateToUse) { + return this.getPrecise(rateToUse * this.beta); } - return endpointParams; - }, "resolveParams"); - var import_util_middleware = require_dist_cjs7(); - var endpointMiddleware = /* @__PURE__ */ __name(({ - config, - instructions - }) => { - return (next, context) => async (args) => { - var _a, _b, _c; - const endpoint = await getEndpointFromInstructions( - args.input, - { - getEndpointParameterInstructions() { - return instructions; - } - }, - { ...config }, - context + cubicSuccess(timestamp) { + return this.getPrecise( + this.scaleConstant * Math.pow(timestamp - this.lastThrottleTime - this.timeWindow, 3) + this.lastMaxRate ); - context.endpointV2 = endpoint; - context.authSchemes = (_a = endpoint.properties) == null ? void 0 : _a.authSchemes; - const authScheme = (_b = context.authSchemes) == null ? void 0 : _b[0]; - if (authScheme) { - context["signing_region"] = authScheme.signingRegion; - context["signing_service"] = authScheme.signingName; - const smithyContext = (0, import_util_middleware.getSmithyContext)(context); - const httpAuthOption = (_c = smithyContext == null ? void 0 : smithyContext.selectedHttpAuthScheme) == null ? void 0 : _c.httpAuthOption; - if (httpAuthOption) { - httpAuthOption.signingProperties = Object.assign( - httpAuthOption.signingProperties || {}, - { - signing_region: authScheme.signingRegion, - signingRegion: authScheme.signingRegion, - signing_service: authScheme.signingName, - signingName: authScheme.signingName, - signingRegionSet: authScheme.signingRegionSet - }, - authScheme.properties - ); - } + } + enableTokenBucket() { + this.enabled = true; + } + updateTokenBucketRate(newRate) { + this.refillTokenBucket(); + this.fillRate = Math.max(newRate, this.minFillRate); + this.maxCapacity = Math.max(newRate, this.minCapacity); + this.currentCapacity = Math.min(this.currentCapacity, this.maxCapacity); + } + updateMeasuredRate() { + const t = this.getCurrentTimeInSeconds(); + const timeBucket = Math.floor(t * 2) / 2; + this.requestCount++; + if (timeBucket > this.lastTxRateBucket) { + const currentRate = this.requestCount / (timeBucket - this.lastTxRateBucket); + this.measuredTxRate = this.getPrecise(currentRate * this.smooth + this.measuredTxRate * (1 - this.smooth)); + this.requestCount = 0; + this.lastTxRateBucket = timeBucket; } - return next({ - ...args - }); - }; - }, "endpointMiddleware"); - var import_middleware_serde = require_dist_cjs25(); - var endpointMiddlewareOptions = { - step: "serialize", - tags: ["ENDPOINT_PARAMETERS", "ENDPOINT_V2", "ENDPOINT"], - name: "endpointV2Middleware", - override: true, - relation: "before", - toMiddleware: import_middleware_serde.serializerMiddlewareOption.name - }; - var getEndpointPlugin = /* @__PURE__ */ __name((config, instructions) => ({ - applyToStack: (clientStack) => { - clientStack.addRelativeTo( - endpointMiddleware({ - config, - instructions - }), - endpointMiddlewareOptions - ); } - }), "getEndpointPlugin"); - var resolveEndpointConfig = /* @__PURE__ */ __name((input) => { - const tls = input.tls ?? true; - const { endpoint } = input; - const customEndpointProvider = endpoint != null ? async () => toEndpointV1(await (0, import_util_middleware.normalizeProvider)(endpoint)()) : void 0; - const isCustomEndpoint = !!endpoint; + getPrecise(num) { + return parseFloat(num.toFixed(8)); + } + }; + __name(_DefaultRateLimiter, "DefaultRateLimiter"); + var DefaultRateLimiter = _DefaultRateLimiter; + var DEFAULT_RETRY_DELAY_BASE = 100; + var MAXIMUM_RETRY_DELAY = 20 * 1e3; + var THROTTLING_RETRY_DELAY_BASE = 500; + var INITIAL_RETRY_TOKENS = 500; + var RETRY_COST = 5; + var TIMEOUT_RETRY_COST = 10; + var NO_RETRY_INCREMENT = 1; + var INVOCATION_ID_HEADER = "amz-sdk-invocation-id"; + var REQUEST_HEADER = "amz-sdk-request"; + var getDefaultRetryBackoffStrategy = /* @__PURE__ */ __name(() => { + let delayBase = DEFAULT_RETRY_DELAY_BASE; + const computeNextBackoffDelay = /* @__PURE__ */ __name((attempts) => { + return Math.floor(Math.min(MAXIMUM_RETRY_DELAY, Math.random() * 2 ** attempts * delayBase)); + }, "computeNextBackoffDelay"); + const setDelayBase = /* @__PURE__ */ __name((delay) => { + delayBase = delay; + }, "setDelayBase"); return { - ...input, - endpoint: customEndpointProvider, - tls, - isCustomEndpoint, - useDualstackEndpoint: (0, import_util_middleware.normalizeProvider)(input.useDualstackEndpoint ?? false), - useFipsEndpoint: (0, import_util_middleware.normalizeProvider)(input.useFipsEndpoint ?? false) + computeNextBackoffDelay, + setDelayBase }; - }, "resolveEndpointConfig"); - } -}); - -// ../../../node_modules/@smithy/middleware-retry/node_modules/uuid/dist/esm-node/rng.js -function rng() { - if (poolPtr > rnds8Pool.length - 16) { - import_crypto.default.randomFillSync(rnds8Pool); - poolPtr = 0; - } - return rnds8Pool.slice(poolPtr, poolPtr += 16); -} -var import_crypto, rnds8Pool, poolPtr; -var init_rng = __esm({ - "../../../node_modules/@smithy/middleware-retry/node_modules/uuid/dist/esm-node/rng.js"() { - import_crypto = __toESM(require("crypto")); - rnds8Pool = new Uint8Array(256); - poolPtr = rnds8Pool.length; - } -}); - -// ../../../node_modules/@smithy/middleware-retry/node_modules/uuid/dist/esm-node/regex.js -var regex_default; -var init_regex = __esm({ - "../../../node_modules/@smithy/middleware-retry/node_modules/uuid/dist/esm-node/regex.js"() { - regex_default = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i; - } -}); - -// ../../../node_modules/@smithy/middleware-retry/node_modules/uuid/dist/esm-node/validate.js -function validate(uuid) { - return typeof uuid === "string" && regex_default.test(uuid); -} -var validate_default; -var init_validate = __esm({ - "../../../node_modules/@smithy/middleware-retry/node_modules/uuid/dist/esm-node/validate.js"() { - init_regex(); - validate_default = validate; - } -}); - -// ../../../node_modules/@smithy/middleware-retry/node_modules/uuid/dist/esm-node/stringify.js -function unsafeStringify(arr, offset = 0) { - return byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + "-" + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + "-" + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + "-" + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + "-" + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]]; -} -function stringify(arr, offset = 0) { - const uuid = unsafeStringify(arr, offset); - if (!validate_default(uuid)) { - throw TypeError("Stringified UUID is invalid"); - } - return uuid; -} -var byteToHex, stringify_default; -var init_stringify = __esm({ - "../../../node_modules/@smithy/middleware-retry/node_modules/uuid/dist/esm-node/stringify.js"() { - init_validate(); - byteToHex = []; - for (let i = 0; i < 256; ++i) { - byteToHex.push((i + 256).toString(16).slice(1)); - } - stringify_default = stringify; - } -}); - -// ../../../node_modules/@smithy/middleware-retry/node_modules/uuid/dist/esm-node/v1.js -function v1(options, buf, offset) { - let i = buf && offset || 0; - const b = buf || new Array(16); - options = options || {}; - let node = options.node || _nodeId; - let clockseq = options.clockseq !== void 0 ? options.clockseq : _clockseq; - if (node == null || clockseq == null) { - const seedBytes = options.random || (options.rng || rng)(); - if (node == null) { - node = _nodeId = [seedBytes[0] | 1, seedBytes[1], seedBytes[2], seedBytes[3], seedBytes[4], seedBytes[5]]; - } - if (clockseq == null) { - clockseq = _clockseq = (seedBytes[6] << 8 | seedBytes[7]) & 16383; - } - } - let msecs = options.msecs !== void 0 ? options.msecs : Date.now(); - let nsecs = options.nsecs !== void 0 ? options.nsecs : _lastNSecs + 1; - const dt = msecs - _lastMSecs + (nsecs - _lastNSecs) / 1e4; - if (dt < 0 && options.clockseq === void 0) { - clockseq = clockseq + 1 & 16383; - } - if ((dt < 0 || msecs > _lastMSecs) && options.nsecs === void 0) { - nsecs = 0; - } - if (nsecs >= 1e4) { - throw new Error("uuid.v1(): Can't create more than 10M uuids/sec"); - } - _lastMSecs = msecs; - _lastNSecs = nsecs; - _clockseq = clockseq; - msecs += 122192928e5; - const tl = ((msecs & 268435455) * 1e4 + nsecs) % 4294967296; - b[i++] = tl >>> 24 & 255; - b[i++] = tl >>> 16 & 255; - b[i++] = tl >>> 8 & 255; - b[i++] = tl & 255; - const tmh = msecs / 4294967296 * 1e4 & 268435455; - b[i++] = tmh >>> 8 & 255; - b[i++] = tmh & 255; - b[i++] = tmh >>> 24 & 15 | 16; - b[i++] = tmh >>> 16 & 255; - b[i++] = clockseq >>> 8 | 128; - b[i++] = clockseq & 255; - for (let n = 0; n < 6; ++n) { - b[i + n] = node[n]; - } - return buf || unsafeStringify(b); -} -var _nodeId, _clockseq, _lastMSecs, _lastNSecs, v1_default; -var init_v1 = __esm({ - "../../../node_modules/@smithy/middleware-retry/node_modules/uuid/dist/esm-node/v1.js"() { - init_rng(); - init_stringify(); - _lastMSecs = 0; - _lastNSecs = 0; - v1_default = v1; + }, "getDefaultRetryBackoffStrategy"); + var createDefaultRetryToken = /* @__PURE__ */ __name(({ + retryDelay, + retryCount, + retryCost + }) => { + const getRetryCount = /* @__PURE__ */ __name(() => retryCount, "getRetryCount"); + const getRetryDelay = /* @__PURE__ */ __name(() => Math.min(MAXIMUM_RETRY_DELAY, retryDelay), "getRetryDelay"); + const getRetryCost = /* @__PURE__ */ __name(() => retryCost, "getRetryCost"); + return { + getRetryCount, + getRetryDelay, + getRetryCost + }; + }, "createDefaultRetryToken"); + var _StandardRetryStrategy = class _StandardRetryStrategy { + constructor(maxAttempts) { + this.maxAttempts = maxAttempts; + this.mode = "standard"; + this.capacity = INITIAL_RETRY_TOKENS; + this.retryBackoffStrategy = getDefaultRetryBackoffStrategy(); + this.maxAttemptsProvider = typeof maxAttempts === "function" ? maxAttempts : async () => maxAttempts; + } + // eslint-disable-next-line @typescript-eslint/no-unused-vars + async acquireInitialRetryToken(retryTokenScope) { + return createDefaultRetryToken({ + retryDelay: DEFAULT_RETRY_DELAY_BASE, + retryCount: 0 + }); + } + async refreshRetryTokenForRetry(token, errorInfo) { + const maxAttempts = await this.getMaxAttempts(); + if (this.shouldRetry(token, errorInfo, maxAttempts)) { + const errorType = errorInfo.errorType; + this.retryBackoffStrategy.setDelayBase( + errorType === "THROTTLING" ? THROTTLING_RETRY_DELAY_BASE : DEFAULT_RETRY_DELAY_BASE + ); + const delayFromErrorType = this.retryBackoffStrategy.computeNextBackoffDelay(token.getRetryCount()); + const retryDelay = errorInfo.retryAfterHint ? Math.max(errorInfo.retryAfterHint.getTime() - Date.now() || 0, delayFromErrorType) : delayFromErrorType; + const capacityCost = this.getCapacityCost(errorType); + this.capacity -= capacityCost; + return createDefaultRetryToken({ + retryDelay, + retryCount: token.getRetryCount() + 1, + retryCost: capacityCost + }); + } + throw new Error("No retry token available"); + } + recordSuccess(token) { + this.capacity = Math.max(INITIAL_RETRY_TOKENS, this.capacity + (token.getRetryCost() ?? NO_RETRY_INCREMENT)); + } + /** + * @returns the current available retry capacity. + * + * This number decreases when retries are executed and refills when requests or retries succeed. + */ + getCapacity() { + return this.capacity; + } + async getMaxAttempts() { + try { + return await this.maxAttemptsProvider(); + } catch (error) { + console.warn(`Max attempts provider could not resolve. Using default of ${DEFAULT_MAX_ATTEMPTS}`); + return DEFAULT_MAX_ATTEMPTS; + } + } + shouldRetry(tokenToRenew, errorInfo, maxAttempts) { + const attempts = tokenToRenew.getRetryCount() + 1; + return attempts < maxAttempts && this.capacity >= this.getCapacityCost(errorInfo.errorType) && this.isRetryableError(errorInfo.errorType); + } + getCapacityCost(errorType) { + return errorType === "TRANSIENT" ? TIMEOUT_RETRY_COST : RETRY_COST; + } + isRetryableError(errorType) { + return errorType === "THROTTLING" || errorType === "TRANSIENT"; + } + }; + __name(_StandardRetryStrategy, "StandardRetryStrategy"); + var StandardRetryStrategy = _StandardRetryStrategy; + var _AdaptiveRetryStrategy = class _AdaptiveRetryStrategy { + constructor(maxAttemptsProvider, options) { + this.maxAttemptsProvider = maxAttemptsProvider; + this.mode = "adaptive"; + const { rateLimiter } = options ?? {}; + this.rateLimiter = rateLimiter ?? new DefaultRateLimiter(); + this.standardRetryStrategy = new StandardRetryStrategy(maxAttemptsProvider); + } + async acquireInitialRetryToken(retryTokenScope) { + await this.rateLimiter.getSendToken(); + return this.standardRetryStrategy.acquireInitialRetryToken(retryTokenScope); + } + async refreshRetryTokenForRetry(tokenToRenew, errorInfo) { + this.rateLimiter.updateClientSendingRate(errorInfo); + return this.standardRetryStrategy.refreshRetryTokenForRetry(tokenToRenew, errorInfo); + } + recordSuccess(token) { + this.rateLimiter.updateClientSendingRate({}); + this.standardRetryStrategy.recordSuccess(token); + } + }; + __name(_AdaptiveRetryStrategy, "AdaptiveRetryStrategy"); + var AdaptiveRetryStrategy = _AdaptiveRetryStrategy; + var _ConfiguredRetryStrategy = class _ConfiguredRetryStrategy extends StandardRetryStrategy { + /** + * @param maxAttempts - the maximum number of retry attempts allowed. + * e.g., if set to 3, then 4 total requests are possible. + * @param computeNextBackoffDelay - a millisecond delay for each retry or a function that takes the retry attempt + * and returns the delay. + * + * @example exponential backoff. + * ```js + * new Client({ + * retryStrategy: new ConfiguredRetryStrategy(3, (attempt) => attempt ** 2) + * }); + * ``` + * @example constant delay. + * ```js + * new Client({ + * retryStrategy: new ConfiguredRetryStrategy(3, 2000) + * }); + * ``` + */ + constructor(maxAttempts, computeNextBackoffDelay = DEFAULT_RETRY_DELAY_BASE) { + super(typeof maxAttempts === "function" ? maxAttempts : async () => maxAttempts); + if (typeof computeNextBackoffDelay === "number") { + this.computeNextBackoffDelay = () => computeNextBackoffDelay; + } else { + this.computeNextBackoffDelay = computeNextBackoffDelay; + } + } + async refreshRetryTokenForRetry(tokenToRenew, errorInfo) { + const token = await super.refreshRetryTokenForRetry(tokenToRenew, errorInfo); + token.getRetryDelay = () => this.computeNextBackoffDelay(token.getRetryCount()); + return token; + } + }; + __name(_ConfiguredRetryStrategy, "ConfiguredRetryStrategy"); + var ConfiguredRetryStrategy = _ConfiguredRetryStrategy; } }); -// ../../../node_modules/@smithy/middleware-retry/node_modules/uuid/dist/esm-node/parse.js -function parse(uuid) { - if (!validate_default(uuid)) { - throw TypeError("Invalid UUID"); - } - let v; - const arr = new Uint8Array(16); - arr[0] = (v = parseInt(uuid.slice(0, 8), 16)) >>> 24; - arr[1] = v >>> 16 & 255; - arr[2] = v >>> 8 & 255; - arr[3] = v & 255; - arr[4] = (v = parseInt(uuid.slice(9, 13), 16)) >>> 8; - arr[5] = v & 255; - arr[6] = (v = parseInt(uuid.slice(14, 18), 16)) >>> 8; - arr[7] = v & 255; - arr[8] = (v = parseInt(uuid.slice(19, 23), 16)) >>> 8; - arr[9] = v & 255; - arr[10] = (v = parseInt(uuid.slice(24, 36), 16)) / 1099511627776 & 255; - arr[11] = v / 4294967296 & 255; - arr[12] = v >>> 24 & 255; - arr[13] = v >>> 16 & 255; - arr[14] = v >>> 8 & 255; - arr[15] = v & 255; - return arr; -} -var parse_default; -var init_parse = __esm({ - "../../../node_modules/@smithy/middleware-retry/node_modules/uuid/dist/esm-node/parse.js"() { - init_validate(); - parse_default = parse; +// ../../../node_modules/@smithy/middleware-retry/node_modules/@smithy/util-middleware/dist-cjs/index.js +var require_dist_cjs24 = __commonJS({ + "../../../node_modules/@smithy/middleware-retry/node_modules/@smithy/util-middleware/dist-cjs/index.js"(exports2, module2) { + var __defProp2 = Object.defineProperty; + var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; + var __getOwnPropNames2 = Object.getOwnPropertyNames; + var __hasOwnProp2 = Object.prototype.hasOwnProperty; + var __name = (target, value) => __defProp2(target, "name", { value, configurable: true }); + var __export2 = (target, all) => { + for (var name in all) + __defProp2(target, name, { get: all[name], enumerable: true }); + }; + var __copyProps2 = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames2(from)) + if (!__hasOwnProp2.call(to, key) && key !== except) + __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable }); + } + return to; + }; + var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); + var src_exports = {}; + __export2(src_exports, { + getSmithyContext: () => getSmithyContext4, + normalizeProvider: () => normalizeProvider2 + }); + module2.exports = __toCommonJS2(src_exports); + var import_types5 = require_dist_cjs(); + var getSmithyContext4 = /* @__PURE__ */ __name((context) => context[import_types5.SMITHY_CONTEXT_KEY] || (context[import_types5.SMITHY_CONTEXT_KEY] = {}), "getSmithyContext"); + var normalizeProvider2 = /* @__PURE__ */ __name((input) => { + if (typeof input === "function") + return input; + const promisified = Promise.resolve(input); + return () => promisified; + }, "normalizeProvider"); } }); -// ../../../node_modules/@smithy/middleware-retry/node_modules/uuid/dist/esm-node/v35.js -function stringToBytes(str) { - str = unescape(encodeURIComponent(str)); - const bytes = []; - for (let i = 0; i < str.length; ++i) { - bytes.push(str.charCodeAt(i)); - } - return bytes; -} -function v35(name, version2, hashfunc) { - function generateUUID(value, namespace, buf, offset) { - var _namespace; - if (typeof value === "string") { - value = stringToBytes(value); - } - if (typeof namespace === "string") { - namespace = parse_default(namespace); - } - if (((_namespace = namespace) === null || _namespace === void 0 ? void 0 : _namespace.length) !== 16) { - throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)"); - } - let bytes = new Uint8Array(16 + value.length); - bytes.set(namespace); - bytes.set(value, namespace.length); - bytes = hashfunc(bytes); - bytes[6] = bytes[6] & 15 | version2; - bytes[8] = bytes[8] & 63 | 128; - if (buf) { - offset = offset || 0; - for (let i = 0; i < 16; ++i) { - buf[offset + i] = bytes[i]; - } - return buf; - } - return unsafeStringify(bytes); - } - try { - generateUUID.name = name; - } catch (err) { - } - generateUUID.DNS = DNS; - generateUUID.URL = URL2; - return generateUUID; -} -var DNS, URL2; -var init_v35 = __esm({ - "../../../node_modules/@smithy/middleware-retry/node_modules/uuid/dist/esm-node/v35.js"() { - init_stringify(); - init_parse(); - DNS = "6ba7b810-9dad-11d1-80b4-00c04fd430c8"; - URL2 = "6ba7b811-9dad-11d1-80b4-00c04fd430c8"; - } -}); - -// ../../../node_modules/@smithy/middleware-retry/node_modules/uuid/dist/esm-node/md5.js -function md5(bytes) { - if (Array.isArray(bytes)) { - bytes = Buffer.from(bytes); - } else if (typeof bytes === "string") { - bytes = Buffer.from(bytes, "utf8"); - } - return import_crypto2.default.createHash("md5").update(bytes).digest(); -} -var import_crypto2, md5_default; -var init_md5 = __esm({ - "../../../node_modules/@smithy/middleware-retry/node_modules/uuid/dist/esm-node/md5.js"() { - import_crypto2 = __toESM(require("crypto")); - md5_default = md5; - } -}); - -// ../../../node_modules/@smithy/middleware-retry/node_modules/uuid/dist/esm-node/v3.js -var v3, v3_default; -var init_v3 = __esm({ - "../../../node_modules/@smithy/middleware-retry/node_modules/uuid/dist/esm-node/v3.js"() { - init_v35(); - init_md5(); - v3 = v35("v3", 48, md5_default); - v3_default = v3; - } -}); - -// ../../../node_modules/@smithy/middleware-retry/node_modules/uuid/dist/esm-node/native.js -var import_crypto3, native_default; -var init_native = __esm({ - "../../../node_modules/@smithy/middleware-retry/node_modules/uuid/dist/esm-node/native.js"() { - import_crypto3 = __toESM(require("crypto")); - native_default = { - randomUUID: import_crypto3.default.randomUUID - }; - } -}); - -// ../../../node_modules/@smithy/middleware-retry/node_modules/uuid/dist/esm-node/v4.js -function v4(options, buf, offset) { - if (native_default.randomUUID && !buf && !options) { - return native_default.randomUUID(); - } - options = options || {}; - const rnds = options.random || (options.rng || rng)(); - rnds[6] = rnds[6] & 15 | 64; - rnds[8] = rnds[8] & 63 | 128; - if (buf) { - offset = offset || 0; - for (let i = 0; i < 16; ++i) { - buf[offset + i] = rnds[i]; - } - return buf; - } - return unsafeStringify(rnds); -} -var v4_default; -var init_v4 = __esm({ - "../../../node_modules/@smithy/middleware-retry/node_modules/uuid/dist/esm-node/v4.js"() { - init_native(); - init_rng(); - init_stringify(); - v4_default = v4; - } -}); - -// ../../../node_modules/@smithy/middleware-retry/node_modules/uuid/dist/esm-node/sha1.js -function sha1(bytes) { - if (Array.isArray(bytes)) { - bytes = Buffer.from(bytes); - } else if (typeof bytes === "string") { - bytes = Buffer.from(bytes, "utf8"); - } - return import_crypto4.default.createHash("sha1").update(bytes).digest(); -} -var import_crypto4, sha1_default; -var init_sha1 = __esm({ - "../../../node_modules/@smithy/middleware-retry/node_modules/uuid/dist/esm-node/sha1.js"() { - import_crypto4 = __toESM(require("crypto")); - sha1_default = sha1; - } -}); - -// ../../../node_modules/@smithy/middleware-retry/node_modules/uuid/dist/esm-node/v5.js -var v5, v5_default; -var init_v5 = __esm({ - "../../../node_modules/@smithy/middleware-retry/node_modules/uuid/dist/esm-node/v5.js"() { - init_v35(); - init_sha1(); - v5 = v35("v5", 80, sha1_default); - v5_default = v5; - } -}); - -// ../../../node_modules/@smithy/middleware-retry/node_modules/uuid/dist/esm-node/nil.js -var nil_default; -var init_nil = __esm({ - "../../../node_modules/@smithy/middleware-retry/node_modules/uuid/dist/esm-node/nil.js"() { - nil_default = "00000000-0000-0000-0000-000000000000"; - } -}); - -// ../../../node_modules/@smithy/middleware-retry/node_modules/uuid/dist/esm-node/version.js -function version(uuid) { - if (!validate_default(uuid)) { - throw TypeError("Invalid UUID"); - } - return parseInt(uuid.slice(14, 15), 16); -} -var version_default; -var init_version = __esm({ - "../../../node_modules/@smithy/middleware-retry/node_modules/uuid/dist/esm-node/version.js"() { - init_validate(); - version_default = version; - } -}); - -// ../../../node_modules/@smithy/middleware-retry/node_modules/uuid/dist/esm-node/index.js -var esm_node_exports = {}; -__export(esm_node_exports, { - NIL: () => nil_default, - parse: () => parse_default, - stringify: () => stringify_default, - v1: () => v1_default, - v3: () => v3_default, - v4: () => v4_default, - v5: () => v5_default, - validate: () => validate_default, - version: () => version_default -}); -var init_esm_node = __esm({ - "../../../node_modules/@smithy/middleware-retry/node_modules/uuid/dist/esm-node/index.js"() { - init_v1(); - init_v3(); - init_v4(); - init_v5(); - init_nil(); - init_version(); - init_validate(); - init_stringify(); - init_parse(); - } -}); - -// ../../../node_modules/@smithy/service-error-classification/dist-cjs/index.js -var require_dist_cjs27 = __commonJS({ - "../../../node_modules/@smithy/service-error-classification/dist-cjs/index.js"(exports2, module2) { +// ../../../node_modules/@smithy/smithy-client/node_modules/@smithy/middleware-stack/dist-cjs/index.js +var require_dist_cjs25 = __commonJS({ + "../../../node_modules/@smithy/smithy-client/node_modules/@smithy/middleware-stack/dist-cjs/index.js"(exports2, module2) { var __defProp2 = Object.defineProperty; var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; var __getOwnPropNames2 = Object.getOwnPropertyNames; @@ -6066,1561 +5052,399 @@ var require_dist_cjs27 = __commonJS({ var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); var src_exports = {}; __export2(src_exports, { - isClockSkewCorrectedError: () => isClockSkewCorrectedError, - isClockSkewError: () => isClockSkewError, - isRetryableByTrait: () => isRetryableByTrait, - isServerError: () => isServerError, - isThrottlingError: () => isThrottlingError, - isTransientError: () => isTransientError + constructStack: () => constructStack }); module2.exports = __toCommonJS2(src_exports); - var CLOCK_SKEW_ERROR_CODES = [ - "AuthFailure", - "InvalidSignatureException", - "RequestExpired", - "RequestInTheFuture", - "RequestTimeTooSkewed", - "SignatureDoesNotMatch" - ]; - var THROTTLING_ERROR_CODES = [ - "BandwidthLimitExceeded", - "EC2ThrottledException", - "LimitExceededException", - "PriorRequestNotComplete", - "ProvisionedThroughputExceededException", - "RequestLimitExceeded", - "RequestThrottled", - "RequestThrottledException", - "SlowDown", - "ThrottledException", - "Throttling", - "ThrottlingException", - "TooManyRequestsException", - "TransactionInProgressException" - // DynamoDB - ]; - var TRANSIENT_ERROR_CODES = ["TimeoutError", "RequestTimeout", "RequestTimeoutException"]; - var TRANSIENT_ERROR_STATUS_CODES = [500, 502, 503, 504]; - var NODEJS_TIMEOUT_ERROR_CODES = ["ECONNRESET", "ECONNREFUSED", "EPIPE", "ETIMEDOUT"]; - var isRetryableByTrait = /* @__PURE__ */ __name((error) => error.$retryable !== void 0, "isRetryableByTrait"); - var isClockSkewError = /* @__PURE__ */ __name((error) => CLOCK_SKEW_ERROR_CODES.includes(error.name), "isClockSkewError"); - var isClockSkewCorrectedError = /* @__PURE__ */ __name((error) => { - var _a; - return (_a = error.$metadata) == null ? void 0 : _a.clockSkewCorrected; - }, "isClockSkewCorrectedError"); - var isThrottlingError = /* @__PURE__ */ __name((error) => { - var _a, _b; - return ((_a = error.$metadata) == null ? void 0 : _a.httpStatusCode) === 429 || THROTTLING_ERROR_CODES.includes(error.name) || ((_b = error.$retryable) == null ? void 0 : _b.throttling) == true; - }, "isThrottlingError"); - var isTransientError = /* @__PURE__ */ __name((error) => { - var _a; - return isClockSkewCorrectedError(error) || TRANSIENT_ERROR_CODES.includes(error.name) || NODEJS_TIMEOUT_ERROR_CODES.includes((error == null ? void 0 : error.code) || "") || TRANSIENT_ERROR_STATUS_CODES.includes(((_a = error.$metadata) == null ? void 0 : _a.httpStatusCode) || 0); - }, "isTransientError"); - var isServerError = /* @__PURE__ */ __name((error) => { - var _a; - if (((_a = error.$metadata) == null ? void 0 : _a.httpStatusCode) !== void 0) { - const statusCode = error.$metadata.httpStatusCode; - if (500 <= statusCode && statusCode <= 599 && !isTransientError(error)) { - return true; - } - return false; + var getAllAliases = /* @__PURE__ */ __name((name, aliases) => { + const _aliases = []; + if (name) { + _aliases.push(name); } - return false; - }, "isServerError"); - } -}); - -// ../../../node_modules/@smithy/util-retry/dist-cjs/index.js -var require_dist_cjs28 = __commonJS({ - "../../../node_modules/@smithy/util-retry/dist-cjs/index.js"(exports2, module2) { - var __defProp2 = Object.defineProperty; - var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; - var __getOwnPropNames2 = Object.getOwnPropertyNames; - var __hasOwnProp2 = Object.prototype.hasOwnProperty; - var __name = (target, value) => __defProp2(target, "name", { value, configurable: true }); - var __export2 = (target, all) => { - for (var name in all) - __defProp2(target, name, { get: all[name], enumerable: true }); - }; - var __copyProps2 = (to, from, except, desc) => { - if (from && typeof from === "object" || typeof from === "function") { - for (let key of __getOwnPropNames2(from)) - if (!__hasOwnProp2.call(to, key) && key !== except) - __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable }); + if (aliases) { + for (const alias of aliases) { + _aliases.push(alias); + } } - return to; - }; - var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); - var src_exports = {}; - __export2(src_exports, { - AdaptiveRetryStrategy: () => AdaptiveRetryStrategy, - ConfiguredRetryStrategy: () => ConfiguredRetryStrategy, - DEFAULT_MAX_ATTEMPTS: () => DEFAULT_MAX_ATTEMPTS, - DEFAULT_RETRY_DELAY_BASE: () => DEFAULT_RETRY_DELAY_BASE, - DEFAULT_RETRY_MODE: () => DEFAULT_RETRY_MODE, - DefaultRateLimiter: () => DefaultRateLimiter, - INITIAL_RETRY_TOKENS: () => INITIAL_RETRY_TOKENS, - INVOCATION_ID_HEADER: () => INVOCATION_ID_HEADER, - MAXIMUM_RETRY_DELAY: () => MAXIMUM_RETRY_DELAY, - NO_RETRY_INCREMENT: () => NO_RETRY_INCREMENT, - REQUEST_HEADER: () => REQUEST_HEADER, - RETRY_COST: () => RETRY_COST, - RETRY_MODES: () => RETRY_MODES, - StandardRetryStrategy: () => StandardRetryStrategy, - THROTTLING_RETRY_DELAY_BASE: () => THROTTLING_RETRY_DELAY_BASE, - TIMEOUT_RETRY_COST: () => TIMEOUT_RETRY_COST - }); - module2.exports = __toCommonJS2(src_exports); - var RETRY_MODES = /* @__PURE__ */ ((RETRY_MODES2) => { - RETRY_MODES2["STANDARD"] = "standard"; - RETRY_MODES2["ADAPTIVE"] = "adaptive"; - return RETRY_MODES2; - })(RETRY_MODES || {}); - var DEFAULT_MAX_ATTEMPTS = 3; - var DEFAULT_RETRY_MODE = "standard"; - var import_service_error_classification = require_dist_cjs27(); - var _DefaultRateLimiter = class _DefaultRateLimiter { - constructor(options) { - this.currentCapacity = 0; - this.enabled = false; - this.lastMaxRate = 0; - this.measuredTxRate = 0; - this.requestCount = 0; - this.lastTimestamp = 0; - this.timeWindow = 0; - this.beta = (options == null ? void 0 : options.beta) ?? 0.7; - this.minCapacity = (options == null ? void 0 : options.minCapacity) ?? 1; - this.minFillRate = (options == null ? void 0 : options.minFillRate) ?? 0.5; - this.scaleConstant = (options == null ? void 0 : options.scaleConstant) ?? 0.4; - this.smooth = (options == null ? void 0 : options.smooth) ?? 0.8; - const currentTimeInSeconds = this.getCurrentTimeInSeconds(); - this.lastThrottleTime = currentTimeInSeconds; - this.lastTxRateBucket = Math.floor(this.getCurrentTimeInSeconds()); - this.fillRate = this.minFillRate; - this.maxCapacity = this.minCapacity; - } - getCurrentTimeInSeconds() { - return Date.now() / 1e3; - } - async getSendToken() { - return this.acquireTokenBucket(1); - } - async acquireTokenBucket(amount) { - if (!this.enabled) { - return; - } - this.refillTokenBucket(); - if (amount > this.currentCapacity) { - const delay = (amount - this.currentCapacity) / this.fillRate * 1e3; - await new Promise((resolve) => setTimeout(resolve, delay)); - } - this.currentCapacity = this.currentCapacity - amount; - } - refillTokenBucket() { - const timestamp = this.getCurrentTimeInSeconds(); - if (!this.lastTimestamp) { - this.lastTimestamp = timestamp; - return; - } - const fillAmount = (timestamp - this.lastTimestamp) * this.fillRate; - this.currentCapacity = Math.min(this.maxCapacity, this.currentCapacity + fillAmount); - this.lastTimestamp = timestamp; - } - updateClientSendingRate(response) { - let calculatedRate; - this.updateMeasuredRate(); - if ((0, import_service_error_classification.isThrottlingError)(response)) { - const rateToUse = !this.enabled ? this.measuredTxRate : Math.min(this.measuredTxRate, this.fillRate); - this.lastMaxRate = rateToUse; - this.calculateTimeWindow(); - this.lastThrottleTime = this.getCurrentTimeInSeconds(); - calculatedRate = this.cubicThrottle(rateToUse); - this.enableTokenBucket(); - } else { - this.calculateTimeWindow(); - calculatedRate = this.cubicSuccess(this.getCurrentTimeInSeconds()); - } - const newRate = Math.min(calculatedRate, 2 * this.measuredTxRate); - this.updateTokenBucketRate(newRate); - } - calculateTimeWindow() { - this.timeWindow = this.getPrecise(Math.pow(this.lastMaxRate * (1 - this.beta) / this.scaleConstant, 1 / 3)); - } - cubicThrottle(rateToUse) { - return this.getPrecise(rateToUse * this.beta); - } - cubicSuccess(timestamp) { - return this.getPrecise( - this.scaleConstant * Math.pow(timestamp - this.lastThrottleTime - this.timeWindow, 3) + this.lastMaxRate - ); - } - enableTokenBucket() { - this.enabled = true; - } - updateTokenBucketRate(newRate) { - this.refillTokenBucket(); - this.fillRate = Math.max(newRate, this.minFillRate); - this.maxCapacity = Math.max(newRate, this.minCapacity); - this.currentCapacity = Math.min(this.currentCapacity, this.maxCapacity); - } - updateMeasuredRate() { - const t = this.getCurrentTimeInSeconds(); - const timeBucket = Math.floor(t * 2) / 2; - this.requestCount++; - if (timeBucket > this.lastTxRateBucket) { - const currentRate = this.requestCount / (timeBucket - this.lastTxRateBucket); - this.measuredTxRate = this.getPrecise(currentRate * this.smooth + this.measuredTxRate * (1 - this.smooth)); - this.requestCount = 0; - this.lastTxRateBucket = timeBucket; - } - } - getPrecise(num) { - return parseFloat(num.toFixed(8)); - } - }; - __name(_DefaultRateLimiter, "DefaultRateLimiter"); - var DefaultRateLimiter = _DefaultRateLimiter; - var DEFAULT_RETRY_DELAY_BASE = 100; - var MAXIMUM_RETRY_DELAY = 20 * 1e3; - var THROTTLING_RETRY_DELAY_BASE = 500; - var INITIAL_RETRY_TOKENS = 500; - var RETRY_COST = 5; - var TIMEOUT_RETRY_COST = 10; - var NO_RETRY_INCREMENT = 1; - var INVOCATION_ID_HEADER = "amz-sdk-invocation-id"; - var REQUEST_HEADER = "amz-sdk-request"; - var getDefaultRetryBackoffStrategy = /* @__PURE__ */ __name(() => { - let delayBase = DEFAULT_RETRY_DELAY_BASE; - const computeNextBackoffDelay = /* @__PURE__ */ __name((attempts) => { - return Math.floor(Math.min(MAXIMUM_RETRY_DELAY, Math.random() * 2 ** attempts * delayBase)); - }, "computeNextBackoffDelay"); - const setDelayBase = /* @__PURE__ */ __name((delay) => { - delayBase = delay; - }, "setDelayBase"); - return { - computeNextBackoffDelay, - setDelayBase - }; - }, "getDefaultRetryBackoffStrategy"); - var createDefaultRetryToken = /* @__PURE__ */ __name(({ - retryDelay, - retryCount, - retryCost - }) => { - const getRetryCount = /* @__PURE__ */ __name(() => retryCount, "getRetryCount"); - const getRetryDelay = /* @__PURE__ */ __name(() => Math.min(MAXIMUM_RETRY_DELAY, retryDelay), "getRetryDelay"); - const getRetryCost = /* @__PURE__ */ __name(() => retryCost, "getRetryCost"); - return { - getRetryCount, - getRetryDelay, - getRetryCost - }; - }, "createDefaultRetryToken"); - var _StandardRetryStrategy = class _StandardRetryStrategy { - constructor(maxAttempts) { - this.maxAttempts = maxAttempts; - this.mode = "standard"; - this.capacity = INITIAL_RETRY_TOKENS; - this.retryBackoffStrategy = getDefaultRetryBackoffStrategy(); - this.maxAttemptsProvider = typeof maxAttempts === "function" ? maxAttempts : async () => maxAttempts; - } - async acquireInitialRetryToken(retryTokenScope) { - return createDefaultRetryToken({ - retryDelay: DEFAULT_RETRY_DELAY_BASE, - retryCount: 0 - }); - } - async refreshRetryTokenForRetry(token, errorInfo) { - const maxAttempts = await this.getMaxAttempts(); - if (this.shouldRetry(token, errorInfo, maxAttempts)) { - const errorType = errorInfo.errorType; - this.retryBackoffStrategy.setDelayBase( - errorType === "THROTTLING" ? THROTTLING_RETRY_DELAY_BASE : DEFAULT_RETRY_DELAY_BASE - ); - const delayFromErrorType = this.retryBackoffStrategy.computeNextBackoffDelay(token.getRetryCount()); - const retryDelay = errorInfo.retryAfterHint ? Math.max(errorInfo.retryAfterHint.getTime() - Date.now() || 0, delayFromErrorType) : delayFromErrorType; - const capacityCost = this.getCapacityCost(errorType); - this.capacity -= capacityCost; - return createDefaultRetryToken({ - retryDelay, - retryCount: token.getRetryCount() + 1, - retryCost: capacityCost - }); - } - throw new Error("No retry token available"); - } - recordSuccess(token) { - this.capacity = Math.max(INITIAL_RETRY_TOKENS, this.capacity + (token.getRetryCost() ?? NO_RETRY_INCREMENT)); - } - /** - * @returns the current available retry capacity. - * - * This number decreases when retries are executed and refills when requests or retries succeed. - */ - getCapacity() { - return this.capacity; - } - async getMaxAttempts() { - try { - return await this.maxAttemptsProvider(); - } catch (error) { - console.warn(`Max attempts provider could not resolve. Using default of ${DEFAULT_MAX_ATTEMPTS}`); - return DEFAULT_MAX_ATTEMPTS; - } - } - shouldRetry(tokenToRenew, errorInfo, maxAttempts) { - const attempts = tokenToRenew.getRetryCount() + 1; - return attempts < maxAttempts && this.capacity >= this.getCapacityCost(errorInfo.errorType) && this.isRetryableError(errorInfo.errorType); - } - getCapacityCost(errorType) { - return errorType === "TRANSIENT" ? TIMEOUT_RETRY_COST : RETRY_COST; - } - isRetryableError(errorType) { - return errorType === "THROTTLING" || errorType === "TRANSIENT"; - } - }; - __name(_StandardRetryStrategy, "StandardRetryStrategy"); - var StandardRetryStrategy = _StandardRetryStrategy; - var _AdaptiveRetryStrategy = class _AdaptiveRetryStrategy { - constructor(maxAttemptsProvider, options) { - this.maxAttemptsProvider = maxAttemptsProvider; - this.mode = "adaptive"; - const { rateLimiter } = options ?? {}; - this.rateLimiter = rateLimiter ?? new DefaultRateLimiter(); - this.standardRetryStrategy = new StandardRetryStrategy(maxAttemptsProvider); - } - async acquireInitialRetryToken(retryTokenScope) { - await this.rateLimiter.getSendToken(); - return this.standardRetryStrategy.acquireInitialRetryToken(retryTokenScope); - } - async refreshRetryTokenForRetry(tokenToRenew, errorInfo) { - this.rateLimiter.updateClientSendingRate(errorInfo); - return this.standardRetryStrategy.refreshRetryTokenForRetry(tokenToRenew, errorInfo); - } - recordSuccess(token) { - this.rateLimiter.updateClientSendingRate({}); - this.standardRetryStrategy.recordSuccess(token); - } - }; - __name(_AdaptiveRetryStrategy, "AdaptiveRetryStrategy"); - var AdaptiveRetryStrategy = _AdaptiveRetryStrategy; - var _ConfiguredRetryStrategy = class _ConfiguredRetryStrategy extends StandardRetryStrategy { - /** - * @param maxAttempts - the maximum number of retry attempts allowed. - * e.g., if set to 3, then 4 total requests are possible. - * @param computeNextBackoffDelay - a millisecond delay for each retry or a function that takes the retry attempt - * and returns the delay. - * - * @example exponential backoff. - * ```js - * new Client({ - * retryStrategy: new ConfiguredRetryStrategy(3, (attempt) => attempt ** 2) - * }); - * ``` - * @example constant delay. - * ```js - * new Client({ - * retryStrategy: new ConfiguredRetryStrategy(3, 2000) - * }); - * ``` - */ - constructor(maxAttempts, computeNextBackoffDelay = DEFAULT_RETRY_DELAY_BASE) { - super(typeof maxAttempts === "function" ? maxAttempts : async () => maxAttempts); - if (typeof computeNextBackoffDelay === "number") { - this.computeNextBackoffDelay = () => computeNextBackoffDelay; - } else { - this.computeNextBackoffDelay = computeNextBackoffDelay; - } - } - async refreshRetryTokenForRetry(tokenToRenew, errorInfo) { - const token = await super.refreshRetryTokenForRetry(tokenToRenew, errorInfo); - token.getRetryDelay = () => this.computeNextBackoffDelay(token.getRetryCount()); - return token; - } - }; - __name(_ConfiguredRetryStrategy, "ConfiguredRetryStrategy"); - var ConfiguredRetryStrategy = _ConfiguredRetryStrategy; - } -}); - -// ../../../node_modules/@smithy/middleware-stack/dist-cjs/index.js -var require_dist_cjs29 = __commonJS({ - "../../../node_modules/@smithy/middleware-stack/dist-cjs/index.js"(exports2, module2) { - var __defProp2 = Object.defineProperty; - var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; - var __getOwnPropNames2 = Object.getOwnPropertyNames; - var __hasOwnProp2 = Object.prototype.hasOwnProperty; - var __name = (target, value) => __defProp2(target, "name", { value, configurable: true }); - var __export2 = (target, all) => { - for (var name in all) - __defProp2(target, name, { get: all[name], enumerable: true }); - }; - var __copyProps2 = (to, from, except, desc) => { - if (from && typeof from === "object" || typeof from === "function") { - for (let key of __getOwnPropNames2(from)) - if (!__hasOwnProp2.call(to, key) && key !== except) - __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable }); - } - return to; - }; - var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); - var src_exports = {}; - __export2(src_exports, { - constructStack: () => constructStack - }); - module2.exports = __toCommonJS2(src_exports); - var getAllAliases = /* @__PURE__ */ __name((name, aliases) => { - const _aliases = []; - if (name) { - _aliases.push(name); - } - if (aliases) { - for (const alias of aliases) { - _aliases.push(alias); - } - } - return _aliases; - }, "getAllAliases"); - var getMiddlewareNameWithAliases = /* @__PURE__ */ __name((name, aliases) => { - return `${name || "anonymous"}${aliases && aliases.length > 0 ? ` (a.k.a. ${aliases.join(",")})` : ""}`; - }, "getMiddlewareNameWithAliases"); - var constructStack = /* @__PURE__ */ __name(() => { - let absoluteEntries = []; - let relativeEntries = []; - let identifyOnResolve = false; - const entriesNameSet = /* @__PURE__ */ new Set(); - const sort = /* @__PURE__ */ __name((entries) => entries.sort( - (a, b) => stepWeights[b.step] - stepWeights[a.step] || priorityWeights[b.priority || "normal"] - priorityWeights[a.priority || "normal"] - ), "sort"); - const removeByName = /* @__PURE__ */ __name((toRemove) => { - let isRemoved = false; - const filterCb = /* @__PURE__ */ __name((entry) => { - const aliases = getAllAliases(entry.name, entry.aliases); - if (aliases.includes(toRemove)) { - isRemoved = true; - for (const alias of aliases) { - entriesNameSet.delete(alias); - } - return false; - } - return true; - }, "filterCb"); - absoluteEntries = absoluteEntries.filter(filterCb); - relativeEntries = relativeEntries.filter(filterCb); - return isRemoved; - }, "removeByName"); - const removeByReference = /* @__PURE__ */ __name((toRemove) => { - let isRemoved = false; - const filterCb = /* @__PURE__ */ __name((entry) => { - if (entry.middleware === toRemove) { - isRemoved = true; - for (const alias of getAllAliases(entry.name, entry.aliases)) { - entriesNameSet.delete(alias); - } - return false; - } - return true; - }, "filterCb"); - absoluteEntries = absoluteEntries.filter(filterCb); - relativeEntries = relativeEntries.filter(filterCb); - return isRemoved; - }, "removeByReference"); - const cloneTo = /* @__PURE__ */ __name((toStack) => { - var _a; - absoluteEntries.forEach((entry) => { - toStack.add(entry.middleware, { ...entry }); - }); - relativeEntries.forEach((entry) => { - toStack.addRelativeTo(entry.middleware, { ...entry }); - }); - (_a = toStack.identifyOnResolve) == null ? void 0 : _a.call(toStack, stack.identifyOnResolve()); - return toStack; - }, "cloneTo"); - const expandRelativeMiddlewareList = /* @__PURE__ */ __name((from) => { - const expandedMiddlewareList = []; - from.before.forEach((entry) => { - if (entry.before.length === 0 && entry.after.length === 0) { - expandedMiddlewareList.push(entry); - } else { - expandedMiddlewareList.push(...expandRelativeMiddlewareList(entry)); - } - }); - expandedMiddlewareList.push(from); - from.after.reverse().forEach((entry) => { - if (entry.before.length === 0 && entry.after.length === 0) { - expandedMiddlewareList.push(entry); - } else { - expandedMiddlewareList.push(...expandRelativeMiddlewareList(entry)); - } - }); - return expandedMiddlewareList; - }, "expandRelativeMiddlewareList"); - const getMiddlewareList = /* @__PURE__ */ __name((debug = false) => { - const normalizedAbsoluteEntries = []; - const normalizedRelativeEntries = []; - const normalizedEntriesNameMap = {}; - absoluteEntries.forEach((entry) => { - const normalizedEntry = { - ...entry, - before: [], - after: [] - }; - for (const alias of getAllAliases(normalizedEntry.name, normalizedEntry.aliases)) { - normalizedEntriesNameMap[alias] = normalizedEntry; - } - normalizedAbsoluteEntries.push(normalizedEntry); - }); - relativeEntries.forEach((entry) => { - const normalizedEntry = { - ...entry, - before: [], - after: [] - }; - for (const alias of getAllAliases(normalizedEntry.name, normalizedEntry.aliases)) { - normalizedEntriesNameMap[alias] = normalizedEntry; - } - normalizedRelativeEntries.push(normalizedEntry); - }); - normalizedRelativeEntries.forEach((entry) => { - if (entry.toMiddleware) { - const toMiddleware = normalizedEntriesNameMap[entry.toMiddleware]; - if (toMiddleware === void 0) { - if (debug) { - return; - } - throw new Error( - `${entry.toMiddleware} is not found when adding ${getMiddlewareNameWithAliases(entry.name, entry.aliases)} middleware ${entry.relation} ${entry.toMiddleware}` - ); - } - if (entry.relation === "after") { - toMiddleware.after.push(entry); - } - if (entry.relation === "before") { - toMiddleware.before.push(entry); - } - } - }); - const mainChain = sort(normalizedAbsoluteEntries).map(expandRelativeMiddlewareList).reduce((wholeList, expandedMiddlewareList) => { - wholeList.push(...expandedMiddlewareList); - return wholeList; - }, []); - return mainChain; - }, "getMiddlewareList"); - const stack = { - add: (middleware, options = {}) => { - const { name, override, aliases: _aliases } = options; - const entry = { - step: "initialize", - priority: "normal", - middleware, - ...options - }; - const aliases = getAllAliases(name, _aliases); - if (aliases.length > 0) { - if (aliases.some((alias) => entriesNameSet.has(alias))) { - if (!override) - throw new Error(`Duplicate middleware name '${getMiddlewareNameWithAliases(name, _aliases)}'`); - for (const alias of aliases) { - const toOverrideIndex = absoluteEntries.findIndex( - (entry2) => { - var _a; - return entry2.name === alias || ((_a = entry2.aliases) == null ? void 0 : _a.some((a) => a === alias)); - } - ); - if (toOverrideIndex === -1) { - continue; - } - const toOverride = absoluteEntries[toOverrideIndex]; - if (toOverride.step !== entry.step || entry.priority !== toOverride.priority) { - throw new Error( - `"${getMiddlewareNameWithAliases(toOverride.name, toOverride.aliases)}" middleware with ${toOverride.priority} priority in ${toOverride.step} step cannot be overridden by "${getMiddlewareNameWithAliases(name, _aliases)}" middleware with ${entry.priority} priority in ${entry.step} step.` - ); - } - absoluteEntries.splice(toOverrideIndex, 1); - } - } - for (const alias of aliases) { - entriesNameSet.add(alias); - } - } - absoluteEntries.push(entry); - }, - addRelativeTo: (middleware, options) => { - const { name, override, aliases: _aliases } = options; - const entry = { - middleware, - ...options - }; - const aliases = getAllAliases(name, _aliases); - if (aliases.length > 0) { - if (aliases.some((alias) => entriesNameSet.has(alias))) { - if (!override) - throw new Error(`Duplicate middleware name '${getMiddlewareNameWithAliases(name, _aliases)}'`); - for (const alias of aliases) { - const toOverrideIndex = relativeEntries.findIndex( - (entry2) => { - var _a; - return entry2.name === alias || ((_a = entry2.aliases) == null ? void 0 : _a.some((a) => a === alias)); - } - ); - if (toOverrideIndex === -1) { - continue; - } - const toOverride = relativeEntries[toOverrideIndex]; - if (toOverride.toMiddleware !== entry.toMiddleware || toOverride.relation !== entry.relation) { - throw new Error( - `"${getMiddlewareNameWithAliases(toOverride.name, toOverride.aliases)}" middleware ${toOverride.relation} "${toOverride.toMiddleware}" middleware cannot be overridden by "${getMiddlewareNameWithAliases(name, _aliases)}" middleware ${entry.relation} "${entry.toMiddleware}" middleware.` - ); - } - relativeEntries.splice(toOverrideIndex, 1); - } - } - for (const alias of aliases) { - entriesNameSet.add(alias); - } - } - relativeEntries.push(entry); - }, - clone: () => cloneTo(constructStack()), - use: (plugin) => { - plugin.applyToStack(stack); - }, - remove: (toRemove) => { - if (typeof toRemove === "string") - return removeByName(toRemove); - else - return removeByReference(toRemove); - }, - removeByTag: (toRemove) => { - let isRemoved = false; - const filterCb = /* @__PURE__ */ __name((entry) => { - const { tags, name, aliases: _aliases } = entry; - if (tags && tags.includes(toRemove)) { - const aliases = getAllAliases(name, _aliases); - for (const alias of aliases) { - entriesNameSet.delete(alias); - } - isRemoved = true; - return false; - } - return true; - }, "filterCb"); - absoluteEntries = absoluteEntries.filter(filterCb); - relativeEntries = relativeEntries.filter(filterCb); - return isRemoved; - }, - concat: (from) => { - var _a; - const cloned = cloneTo(constructStack()); - cloned.use(from); - cloned.identifyOnResolve( - identifyOnResolve || cloned.identifyOnResolve() || (((_a = from.identifyOnResolve) == null ? void 0 : _a.call(from)) ?? false) - ); - return cloned; - }, - applyToStack: cloneTo, - identify: () => { - return getMiddlewareList(true).map((mw) => { - const step = mw.step ?? mw.relation + " " + mw.toMiddleware; - return getMiddlewareNameWithAliases(mw.name, mw.aliases) + " - " + step; - }); - }, - identifyOnResolve(toggle) { - if (typeof toggle === "boolean") - identifyOnResolve = toggle; - return identifyOnResolve; - }, - resolve: (handler2, context) => { - for (const middleware of getMiddlewareList().map((entry) => entry.middleware).reverse()) { - handler2 = middleware(handler2, context); - } - if (identifyOnResolve) { - console.log(stack.identify()); - } - return handler2; - } - }; - return stack; - }, "constructStack"); - var stepWeights = { - initialize: 5, - serialize: 4, - build: 3, - finalizeRequest: 2, - deserialize: 1 - }; - var priorityWeights = { - high: 3, - normal: 2, - low: 1 - }; - } -}); - -// ../../../node_modules/@smithy/util-base64/dist-cjs/fromBase64.js -var require_fromBase64 = __commonJS({ - "../../../node_modules/@smithy/util-base64/dist-cjs/fromBase64.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.fromBase64 = void 0; - var util_buffer_from_1 = require_dist_cjs9(); - var BASE64_REGEX = /^[A-Za-z0-9+/]*={0,2}$/; - var fromBase642 = (input) => { - if (input.length * 3 % 4 !== 0) { - throw new TypeError(`Incorrect padding on base64 string.`); - } - if (!BASE64_REGEX.exec(input)) { - throw new TypeError(`Invalid base64 string.`); - } - const buffer = (0, util_buffer_from_1.fromString)(input, "base64"); - return new Uint8Array(buffer.buffer, buffer.byteOffset, buffer.byteLength); - }; - exports2.fromBase64 = fromBase642; - } -}); - -// ../../../node_modules/@smithy/util-base64/dist-cjs/toBase64.js -var require_toBase64 = __commonJS({ - "../../../node_modules/@smithy/util-base64/dist-cjs/toBase64.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.toBase64 = void 0; - var util_buffer_from_1 = require_dist_cjs9(); - var util_utf8_1 = require_dist_cjs10(); - var toBase642 = (_input) => { - let input; - if (typeof _input === "string") { - input = (0, util_utf8_1.fromUtf8)(_input); - } else { - input = _input; - } - if (typeof input !== "object" || typeof input.byteOffset !== "number" || typeof input.byteLength !== "number") { - throw new Error("@smithy/util-base64: toBase64 encoder function only accepts string | Uint8Array."); - } - return (0, util_buffer_from_1.fromArrayBuffer)(input.buffer, input.byteOffset, input.byteLength).toString("base64"); - }; - exports2.toBase64 = toBase642; - } -}); - -// ../../../node_modules/@smithy/util-base64/dist-cjs/index.js -var require_dist_cjs30 = __commonJS({ - "../../../node_modules/@smithy/util-base64/dist-cjs/index.js"(exports2, module2) { - var __defProp2 = Object.defineProperty; - var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; - var __getOwnPropNames2 = Object.getOwnPropertyNames; - var __hasOwnProp2 = Object.prototype.hasOwnProperty; - var __copyProps2 = (to, from, except, desc) => { - if (from && typeof from === "object" || typeof from === "function") { - for (let key of __getOwnPropNames2(from)) - if (!__hasOwnProp2.call(to, key) && key !== except) - __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable }); - } - return to; - }; - var __reExport = (target, mod, secondTarget) => (__copyProps2(target, mod, "default"), secondTarget && __copyProps2(secondTarget, mod, "default")); - var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); - var src_exports = {}; - module2.exports = __toCommonJS2(src_exports); - __reExport(src_exports, require_fromBase64(), module2.exports); - __reExport(src_exports, require_toBase64(), module2.exports); - } -}); - -// ../../../node_modules/@smithy/util-stream/dist-cjs/getAwsChunkedEncodingStream.js -var require_getAwsChunkedEncodingStream = __commonJS({ - "../../../node_modules/@smithy/util-stream/dist-cjs/getAwsChunkedEncodingStream.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.getAwsChunkedEncodingStream = void 0; - var stream_1 = require("stream"); - var getAwsChunkedEncodingStream2 = (readableStream, options) => { - const { base64Encoder, bodyLengthChecker, checksumAlgorithmFn, checksumLocationName, streamHasher } = options; - const checksumRequired = base64Encoder !== void 0 && checksumAlgorithmFn !== void 0 && checksumLocationName !== void 0 && streamHasher !== void 0; - const digest = checksumRequired ? streamHasher(checksumAlgorithmFn, readableStream) : void 0; - const awsChunkedEncodingStream = new stream_1.Readable({ read: () => { - } }); - readableStream.on("data", (data) => { - const length = bodyLengthChecker(data) || 0; - awsChunkedEncodingStream.push(`${length.toString(16)}\r -`); - awsChunkedEncodingStream.push(data); - awsChunkedEncodingStream.push("\r\n"); - }); - readableStream.on("end", async () => { - awsChunkedEncodingStream.push(`0\r -`); - if (checksumRequired) { - const checksum = base64Encoder(await digest); - awsChunkedEncodingStream.push(`${checksumLocationName}:${checksum}\r -`); - awsChunkedEncodingStream.push(`\r -`); - } - awsChunkedEncodingStream.push(null); - }); - return awsChunkedEncodingStream; - }; - exports2.getAwsChunkedEncodingStream = getAwsChunkedEncodingStream2; - } -}); - -// ../../../node_modules/@smithy/querystring-builder/dist-cjs/index.js -var require_dist_cjs31 = __commonJS({ - "../../../node_modules/@smithy/querystring-builder/dist-cjs/index.js"(exports2, module2) { - var __defProp2 = Object.defineProperty; - var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; - var __getOwnPropNames2 = Object.getOwnPropertyNames; - var __hasOwnProp2 = Object.prototype.hasOwnProperty; - var __name = (target, value) => __defProp2(target, "name", { value, configurable: true }); - var __export2 = (target, all) => { - for (var name in all) - __defProp2(target, name, { get: all[name], enumerable: true }); - }; - var __copyProps2 = (to, from, except, desc) => { - if (from && typeof from === "object" || typeof from === "function") { - for (let key of __getOwnPropNames2(from)) - if (!__hasOwnProp2.call(to, key) && key !== except) - __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable }); - } - return to; - }; - var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); - var src_exports = {}; - __export2(src_exports, { - buildQueryString: () => buildQueryString - }); - module2.exports = __toCommonJS2(src_exports); - var import_util_uri_escape = require_dist_cjs12(); - function buildQueryString(query) { - const parts = []; - for (let key of Object.keys(query).sort()) { - const value = query[key]; - key = (0, import_util_uri_escape.escapeUri)(key); - if (Array.isArray(value)) { - for (let i = 0, iLen = value.length; i < iLen; i++) { - parts.push(`${key}=${(0, import_util_uri_escape.escapeUri)(value[i])}`); - } - } else { - let qsEntry = key; - if (value || typeof value === "string") { - qsEntry += `=${(0, import_util_uri_escape.escapeUri)(value)}`; - } - parts.push(qsEntry); - } - } - return parts.join("&"); - } - __name(buildQueryString, "buildQueryString"); - } -}); - -// ../../../node_modules/@smithy/node-http-handler/dist-cjs/index.js -var require_dist_cjs32 = __commonJS({ - "../../../node_modules/@smithy/node-http-handler/dist-cjs/index.js"(exports2, module2) { - var __create2 = Object.create; - var __defProp2 = Object.defineProperty; - var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; - var __getOwnPropNames2 = Object.getOwnPropertyNames; - var __getProtoOf2 = Object.getPrototypeOf; - var __hasOwnProp2 = Object.prototype.hasOwnProperty; - var __name = (target, value) => __defProp2(target, "name", { value, configurable: true }); - var __export2 = (target, all) => { - for (var name in all) - __defProp2(target, name, { get: all[name], enumerable: true }); - }; - var __copyProps2 = (to, from, except, desc) => { - if (from && typeof from === "object" || typeof from === "function") { - for (let key of __getOwnPropNames2(from)) - if (!__hasOwnProp2.call(to, key) && key !== except) - __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable }); - } - return to; - }; - var __toESM2 = (mod, isNodeMode, target) => (target = mod != null ? __create2(__getProtoOf2(mod)) : {}, __copyProps2( - // If the importer is in node compatibility mode or this is not an ESM - // file that has been converted to a CommonJS file using a Babel- - // compatible transform (i.e. "__esModule" has not been set), then set - // "default" to the CommonJS "module.exports" for node compatibility. - isNodeMode || !mod || !mod.__esModule ? __defProp2(target, "default", { value: mod, enumerable: true }) : target, - mod - )); - var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); - var src_exports = {}; - __export2(src_exports, { - DEFAULT_REQUEST_TIMEOUT: () => DEFAULT_REQUEST_TIMEOUT, - NodeHttp2Handler: () => NodeHttp2Handler, - NodeHttpHandler: () => NodeHttpHandler, - streamCollector: () => streamCollector - }); - module2.exports = __toCommonJS2(src_exports); - var import_protocol_http = require_dist_cjs2(); - var import_querystring_builder = require_dist_cjs31(); - var import_http2 = require("http"); - var import_https = require("https"); - var NODEJS_TIMEOUT_ERROR_CODES = ["ECONNRESET", "EPIPE", "ETIMEDOUT"]; - var getTransformedHeaders = /* @__PURE__ */ __name((headers) => { - const transformedHeaders = {}; - for (const name of Object.keys(headers)) { - const headerValues = headers[name]; - transformedHeaders[name] = Array.isArray(headerValues) ? headerValues.join(",") : headerValues; - } - return transformedHeaders; - }, "getTransformedHeaders"); - var setConnectionTimeout = /* @__PURE__ */ __name((request2, reject, timeoutInMs = 0) => { - if (!timeoutInMs) { - return; - } - const timeoutId = setTimeout(() => { - request2.destroy(); - reject( - Object.assign(new Error(`Socket timed out without establishing a connection within ${timeoutInMs} ms`), { - name: "TimeoutError" - }) - ); - }, timeoutInMs); - request2.on("socket", (socket) => { - if (socket.connecting) { - socket.on("connect", () => { - clearTimeout(timeoutId); - }); - } else { - clearTimeout(timeoutId); - } - }); - }, "setConnectionTimeout"); - var setSocketKeepAlive = /* @__PURE__ */ __name((request2, { keepAlive, keepAliveMsecs }) => { - if (keepAlive !== true) { - return; - } - request2.on("socket", (socket) => { - socket.setKeepAlive(keepAlive, keepAliveMsecs || 0); - }); - }, "setSocketKeepAlive"); - var setSocketTimeout = /* @__PURE__ */ __name((request2, reject, timeoutInMs = 0) => { - request2.setTimeout(timeoutInMs, () => { - request2.destroy(); - reject(Object.assign(new Error(`Connection timed out after ${timeoutInMs} ms`), { name: "TimeoutError" })); - }); - }, "setSocketTimeout"); - var import_stream = require("stream"); - var MIN_WAIT_TIME = 1e3; - async function writeRequestBody(httpRequest, request2, maxContinueTimeoutMs = MIN_WAIT_TIME) { - const headers = request2.headers ?? {}; - const expect = headers["Expect"] || headers["expect"]; - let timeoutId = -1; - let hasError = false; - if (expect === "100-continue") { - await Promise.race([ - new Promise((resolve) => { - timeoutId = Number(setTimeout(resolve, Math.max(MIN_WAIT_TIME, maxContinueTimeoutMs))); - }), - new Promise((resolve) => { - httpRequest.on("continue", () => { - clearTimeout(timeoutId); - resolve(); - }); - httpRequest.on("error", () => { - hasError = true; - clearTimeout(timeoutId); - resolve(); - }); - }) - ]); - } - if (!hasError) { - writeBody(httpRequest, request2.body); - } - } - __name(writeRequestBody, "writeRequestBody"); - function writeBody(httpRequest, body) { - if (body instanceof import_stream.Readable) { - body.pipe(httpRequest); - return; - } - if (body) { - if (Buffer.isBuffer(body) || typeof body === "string") { - httpRequest.end(body); - return; - } - const uint8 = body; - if (typeof uint8 === "object" && uint8.buffer && typeof uint8.byteOffset === "number" && typeof uint8.byteLength === "number") { - httpRequest.end(Buffer.from(uint8.buffer, uint8.byteOffset, uint8.byteLength)); - return; - } - httpRequest.end(Buffer.from(body)); - return; - } - httpRequest.end(); - } - __name(writeBody, "writeBody"); - var DEFAULT_REQUEST_TIMEOUT = 0; - var _NodeHttpHandler = class _NodeHttpHandler2 { - constructor(options) { - this.socketWarningTimestamp = 0; - this.metadata = { handlerProtocol: "http/1.1" }; - this.configProvider = new Promise((resolve, reject) => { - if (typeof options === "function") { - options().then((_options) => { - resolve(this.resolveDefaultConfig(_options)); - }).catch(reject); - } else { - resolve(this.resolveDefaultConfig(options)); - } - }); - } - /** - * @returns the input if it is an HttpHandler of any class, - * or instantiates a new instance of this handler. - */ - static create(instanceOrOptions) { - if (typeof (instanceOrOptions == null ? void 0 : instanceOrOptions.handle) === "function") { - return instanceOrOptions; - } - return new _NodeHttpHandler2(instanceOrOptions); - } - /** - * @internal - * - * @param agent - http(s) agent in use by the NodeHttpHandler instance. - * @returns timestamp of last emitted warning. - */ - static checkSocketUsage(agent, socketWarningTimestamp) { - var _a, _b; - const { sockets, requests, maxSockets } = agent; - if (typeof maxSockets !== "number" || maxSockets === Infinity) { - return socketWarningTimestamp; - } - const interval = 15e3; - if (Date.now() - interval < socketWarningTimestamp) { - return socketWarningTimestamp; - } - if (sockets && requests) { - for (const origin in sockets) { - const socketsInUse = ((_a = sockets[origin]) == null ? void 0 : _a.length) ?? 0; - const requestsEnqueued = ((_b = requests[origin]) == null ? void 0 : _b.length) ?? 0; - if (socketsInUse >= maxSockets && requestsEnqueued >= 2 * maxSockets) { - console.warn( - "@smithy/node-http-handler:WARN", - `socket usage at capacity=${socketsInUse} and ${requestsEnqueued} additional requests are enqueued.`, - "See https://docs.aws.amazon.com/sdk-for-javascript/v3/developer-guide/node-configuring-maxsockets.html", - "or increase socketAcquisitionWarningTimeout=(millis) in the NodeHttpHandler config." - ); - return Date.now(); - } - } - } - return socketWarningTimestamp; - } - resolveDefaultConfig(options) { - const { requestTimeout, connectionTimeout, socketTimeout, httpAgent, httpsAgent } = options || {}; - const keepAlive = true; - const maxSockets = 50; - return { - connectionTimeout, - requestTimeout: requestTimeout ?? socketTimeout, - httpAgent: (() => { - if (httpAgent instanceof import_http2.Agent || typeof (httpAgent == null ? void 0 : httpAgent.destroy) === "function") { - return httpAgent; - } - return new import_http2.Agent({ keepAlive, maxSockets, ...httpAgent }); - })(), - httpsAgent: (() => { - if (httpsAgent instanceof import_https.Agent || typeof (httpsAgent == null ? void 0 : httpsAgent.destroy) === "function") { - return httpsAgent; - } - return new import_https.Agent({ keepAlive, maxSockets, ...httpsAgent }); - })() - }; - } - destroy() { - var _a, _b, _c, _d; - (_b = (_a = this.config) == null ? void 0 : _a.httpAgent) == null ? void 0 : _b.destroy(); - (_d = (_c = this.config) == null ? void 0 : _c.httpsAgent) == null ? void 0 : _d.destroy(); - } - async handle(request2, { abortSignal } = {}) { - if (!this.config) { - this.config = await this.configProvider; - } - let socketCheckTimeoutId; - return new Promise((_resolve, _reject) => { - let writeRequestBodyPromise = void 0; - const resolve = /* @__PURE__ */ __name(async (arg) => { - await writeRequestBodyPromise; - clearTimeout(socketCheckTimeoutId); - _resolve(arg); - }, "resolve"); - const reject = /* @__PURE__ */ __name(async (arg) => { - await writeRequestBodyPromise; - _reject(arg); - }, "reject"); - if (!this.config) { - throw new Error("Node HTTP request handler config is not resolved"); - } - if (abortSignal == null ? void 0 : abortSignal.aborted) { - const abortError = new Error("Request aborted"); - abortError.name = "AbortError"; - reject(abortError); - return; - } - const isSSL = request2.protocol === "https:"; - const agent = isSSL ? this.config.httpsAgent : this.config.httpAgent; - socketCheckTimeoutId = setTimeout(() => { - this.socketWarningTimestamp = _NodeHttpHandler2.checkSocketUsage(agent, this.socketWarningTimestamp); - }, this.config.socketAcquisitionWarningTimeout ?? (this.config.requestTimeout ?? 2e3) + (this.config.connectionTimeout ?? 1e3)); - const queryString = (0, import_querystring_builder.buildQueryString)(request2.query || {}); - let auth = void 0; - if (request2.username != null || request2.password != null) { - const username = request2.username ?? ""; - const password = request2.password ?? ""; - auth = `${username}:${password}`; - } - let path = request2.path; - if (queryString) { - path += `?${queryString}`; - } - if (request2.fragment) { - path += `#${request2.fragment}`; - } - const nodeHttpsOptions = { - headers: request2.headers, - host: request2.hostname, - method: request2.method, - path, - port: request2.port, - agent, - auth - }; - const requestFunc = isSSL ? import_https.request : import_http2.request; - const req = requestFunc(nodeHttpsOptions, (res) => { - const httpResponse = new import_protocol_http.HttpResponse({ - statusCode: res.statusCode || -1, - reason: res.statusMessage, - headers: getTransformedHeaders(res.headers), - body: res - }); - resolve({ response: httpResponse }); - }); - req.on("error", (err) => { - if (NODEJS_TIMEOUT_ERROR_CODES.includes(err.code)) { - reject(Object.assign(err, { name: "TimeoutError" })); - } else { - reject(err); - } - }); - setConnectionTimeout(req, reject, this.config.connectionTimeout); - setSocketTimeout(req, reject, this.config.requestTimeout); - if (abortSignal) { - abortSignal.onabort = () => { - req.abort(); - const abortError = new Error("Request aborted"); - abortError.name = "AbortError"; - reject(abortError); - }; - } - const httpAgent = nodeHttpsOptions.agent; - if (typeof httpAgent === "object" && "keepAlive" in httpAgent) { - setSocketKeepAlive(req, { - // @ts-expect-error keepAlive is not public on httpAgent. - keepAlive: httpAgent.keepAlive, - // @ts-expect-error keepAliveMsecs is not public on httpAgent. - keepAliveMsecs: httpAgent.keepAliveMsecs - }); - } - writeRequestBodyPromise = writeRequestBody(req, request2, this.config.requestTimeout).catch(_reject); - }); - } - updateHttpClientConfig(key, value) { - this.config = void 0; - this.configProvider = this.configProvider.then((config) => { - return { - ...config, - [key]: value - }; - }); - } - httpHandlerConfigs() { - return this.config ?? {}; - } - }; - __name(_NodeHttpHandler, "NodeHttpHandler"); - var NodeHttpHandler = _NodeHttpHandler; - var import_http22 = require("http2"); - var import_http23 = __toESM2(require("http2")); - var _NodeHttp2ConnectionPool = class _NodeHttp2ConnectionPool { - constructor(sessions) { - this.sessions = []; - this.sessions = sessions ?? []; - } - poll() { - if (this.sessions.length > 0) { - return this.sessions.shift(); - } - } - offerLast(session) { - this.sessions.push(session); - } - contains(session) { - return this.sessions.includes(session); - } - remove(session) { - this.sessions = this.sessions.filter((s) => s !== session); - } - [Symbol.iterator]() { - return this.sessions[Symbol.iterator](); - } - destroy(connection) { - for (const session of this.sessions) { - if (session === connection) { - if (!session.destroyed) { - session.destroy(); + return _aliases; + }, "getAllAliases"); + var getMiddlewareNameWithAliases = /* @__PURE__ */ __name((name, aliases) => { + return `${name || "anonymous"}${aliases && aliases.length > 0 ? ` (a.k.a. ${aliases.join(",")})` : ""}`; + }, "getMiddlewareNameWithAliases"); + var constructStack = /* @__PURE__ */ __name(() => { + let absoluteEntries = []; + let relativeEntries = []; + let identifyOnResolve = false; + const entriesNameSet = /* @__PURE__ */ new Set(); + const sort = /* @__PURE__ */ __name((entries) => entries.sort( + (a, b) => stepWeights[b.step] - stepWeights[a.step] || priorityWeights[b.priority || "normal"] - priorityWeights[a.priority || "normal"] + ), "sort"); + const removeByName = /* @__PURE__ */ __name((toRemove) => { + let isRemoved = false; + const filterCb = /* @__PURE__ */ __name((entry) => { + const aliases = getAllAliases(entry.name, entry.aliases); + if (aliases.includes(toRemove)) { + isRemoved = true; + for (const alias of aliases) { + entriesNameSet.delete(alias); } + return false; } - } - } - }; - __name(_NodeHttp2ConnectionPool, "NodeHttp2ConnectionPool"); - var NodeHttp2ConnectionPool = _NodeHttp2ConnectionPool; - var _NodeHttp2ConnectionManager = class _NodeHttp2ConnectionManager { - constructor(config) { - this.sessionCache = /* @__PURE__ */ new Map(); - this.config = config; - if (this.config.maxConcurrency && this.config.maxConcurrency <= 0) { - throw new RangeError("maxConcurrency must be greater than zero."); - } - } - lease(requestContext, connectionConfiguration) { - const url2 = this.getUrlString(requestContext); - const existingPool = this.sessionCache.get(url2); - if (existingPool) { - const existingSession = existingPool.poll(); - if (existingSession && !this.config.disableConcurrency) { - return existingSession; - } - } - const session = import_http23.default.connect(url2); - if (this.config.maxConcurrency) { - session.settings({ maxConcurrentStreams: this.config.maxConcurrency }, (err) => { - if (err) { - throw new Error( - "Fail to set maxConcurrentStreams to " + this.config.maxConcurrency + "when creating new session for " + requestContext.destination.toString() - ); - } - }); - } - session.unref(); - const destroySessionCb = /* @__PURE__ */ __name(() => { - session.destroy(); - this.deleteSession(url2, session); - }, "destroySessionCb"); - session.on("goaway", destroySessionCb); - session.on("error", destroySessionCb); - session.on("frameError", destroySessionCb); - session.on("close", () => this.deleteSession(url2, session)); - if (connectionConfiguration.requestTimeout) { - session.setTimeout(connectionConfiguration.requestTimeout, destroySessionCb); - } - const connectionPool = this.sessionCache.get(url2) || new NodeHttp2ConnectionPool(); - connectionPool.offerLast(session); - this.sessionCache.set(url2, connectionPool); - return session; - } - /** - * Delete a session from the connection pool. - * @param authority The authority of the session to delete. - * @param session The session to delete. - */ - deleteSession(authority, session) { - const existingConnectionPool = this.sessionCache.get(authority); - if (!existingConnectionPool) { - return; - } - if (!existingConnectionPool.contains(session)) { - return; - } - existingConnectionPool.remove(session); - this.sessionCache.set(authority, existingConnectionPool); - } - release(requestContext, session) { - var _a; - const cacheKey = this.getUrlString(requestContext); - (_a = this.sessionCache.get(cacheKey)) == null ? void 0 : _a.offerLast(session); - } - destroy() { - for (const [key, connectionPool] of this.sessionCache) { - for (const session of connectionPool) { - if (!session.destroyed) { - session.destroy(); + return true; + }, "filterCb"); + absoluteEntries = absoluteEntries.filter(filterCb); + relativeEntries = relativeEntries.filter(filterCb); + return isRemoved; + }, "removeByName"); + const removeByReference = /* @__PURE__ */ __name((toRemove) => { + let isRemoved = false; + const filterCb = /* @__PURE__ */ __name((entry) => { + if (entry.middleware === toRemove) { + isRemoved = true; + for (const alias of getAllAliases(entry.name, entry.aliases)) { + entriesNameSet.delete(alias); } - connectionPool.remove(session); - } - this.sessionCache.delete(key); - } - } - setMaxConcurrentStreams(maxConcurrentStreams) { - if (this.config.maxConcurrency && this.config.maxConcurrency <= 0) { - throw new RangeError("maxConcurrentStreams must be greater than zero."); - } - this.config.maxConcurrency = maxConcurrentStreams; - } - setDisableConcurrentStreams(disableConcurrentStreams) { - this.config.disableConcurrency = disableConcurrentStreams; - } - getUrlString(request2) { - return request2.destination.toString(); - } - }; - __name(_NodeHttp2ConnectionManager, "NodeHttp2ConnectionManager"); - var NodeHttp2ConnectionManager = _NodeHttp2ConnectionManager; - var _NodeHttp2Handler = class _NodeHttp2Handler2 { - constructor(options) { - this.metadata = { handlerProtocol: "h2" }; - this.connectionManager = new NodeHttp2ConnectionManager({}); - this.configProvider = new Promise((resolve, reject) => { - if (typeof options === "function") { - options().then((opts) => { - resolve(opts || {}); - }).catch(reject); - } else { - resolve(options || {}); - } - }); - } - /** - * @returns the input if it is an HttpHandler of any class, - * or instantiates a new instance of this handler. - */ - static create(instanceOrOptions) { - if (typeof (instanceOrOptions == null ? void 0 : instanceOrOptions.handle) === "function") { - return instanceOrOptions; - } - return new _NodeHttp2Handler2(instanceOrOptions); - } - destroy() { - this.connectionManager.destroy(); - } - async handle(request2, { abortSignal } = {}) { - if (!this.config) { - this.config = await this.configProvider; - this.connectionManager.setDisableConcurrentStreams(this.config.disableConcurrentStreams || false); - if (this.config.maxConcurrentStreams) { - this.connectionManager.setMaxConcurrentStreams(this.config.maxConcurrentStreams); + return false; } - } - const { requestTimeout, disableConcurrentStreams } = this.config; - return new Promise((_resolve, _reject) => { - var _a; - let fulfilled = false; - let writeRequestBodyPromise = void 0; - const resolve = /* @__PURE__ */ __name(async (arg) => { - await writeRequestBodyPromise; - _resolve(arg); - }, "resolve"); - const reject = /* @__PURE__ */ __name(async (arg) => { - await writeRequestBodyPromise; - _reject(arg); - }, "reject"); - if (abortSignal == null ? void 0 : abortSignal.aborted) { - fulfilled = true; - const abortError = new Error("Request aborted"); - abortError.name = "AbortError"; - reject(abortError); - return; + return true; + }, "filterCb"); + absoluteEntries = absoluteEntries.filter(filterCb); + relativeEntries = relativeEntries.filter(filterCb); + return isRemoved; + }, "removeByReference"); + const cloneTo = /* @__PURE__ */ __name((toStack) => { + var _a; + absoluteEntries.forEach((entry) => { + toStack.add(entry.middleware, { ...entry }); + }); + relativeEntries.forEach((entry) => { + toStack.addRelativeTo(entry.middleware, { ...entry }); + }); + (_a = toStack.identifyOnResolve) == null ? void 0 : _a.call(toStack, stack.identifyOnResolve()); + return toStack; + }, "cloneTo"); + const expandRelativeMiddlewareList = /* @__PURE__ */ __name((from) => { + const expandedMiddlewareList = []; + from.before.forEach((entry) => { + if (entry.before.length === 0 && entry.after.length === 0) { + expandedMiddlewareList.push(entry); + } else { + expandedMiddlewareList.push(...expandRelativeMiddlewareList(entry)); } - const { hostname, method, port, protocol, query } = request2; - let auth = ""; - if (request2.username != null || request2.password != null) { - const username = request2.username ?? ""; - const password = request2.password ?? ""; - auth = `${username}:${password}@`; + }); + expandedMiddlewareList.push(from); + from.after.reverse().forEach((entry) => { + if (entry.before.length === 0 && entry.after.length === 0) { + expandedMiddlewareList.push(entry); + } else { + expandedMiddlewareList.push(...expandRelativeMiddlewareList(entry)); } - const authority = `${protocol}//${auth}${hostname}${port ? `:${port}` : ""}`; - const requestContext = { destination: new URL(authority) }; - const session = this.connectionManager.lease(requestContext, { - requestTimeout: (_a = this.config) == null ? void 0 : _a.sessionTimeout, - disableConcurrentStreams: disableConcurrentStreams || false - }); - const rejectWithDestroy = /* @__PURE__ */ __name((err) => { - if (disableConcurrentStreams) { - this.destroySession(session); - } - fulfilled = true; - reject(err); - }, "rejectWithDestroy"); - const queryString = (0, import_querystring_builder.buildQueryString)(query || {}); - let path = request2.path; - if (queryString) { - path += `?${queryString}`; + }); + return expandedMiddlewareList; + }, "expandRelativeMiddlewareList"); + const getMiddlewareList = /* @__PURE__ */ __name((debug = false) => { + const normalizedAbsoluteEntries = []; + const normalizedRelativeEntries = []; + const normalizedEntriesNameMap = {}; + absoluteEntries.forEach((entry) => { + const normalizedEntry = { + ...entry, + before: [], + after: [] + }; + for (const alias of getAllAliases(normalizedEntry.name, normalizedEntry.aliases)) { + normalizedEntriesNameMap[alias] = normalizedEntry; } - if (request2.fragment) { - path += `#${request2.fragment}`; + normalizedAbsoluteEntries.push(normalizedEntry); + }); + relativeEntries.forEach((entry) => { + const normalizedEntry = { + ...entry, + before: [], + after: [] + }; + for (const alias of getAllAliases(normalizedEntry.name, normalizedEntry.aliases)) { + normalizedEntriesNameMap[alias] = normalizedEntry; } - const req = session.request({ - ...request2.headers, - [import_http22.constants.HTTP2_HEADER_PATH]: path, - [import_http22.constants.HTTP2_HEADER_METHOD]: method - }); - session.ref(); - req.on("response", (headers) => { - const httpResponse = new import_protocol_http.HttpResponse({ - statusCode: headers[":status"] || -1, - headers: getTransformedHeaders(headers), - body: req - }); - fulfilled = true; - resolve({ response: httpResponse }); - if (disableConcurrentStreams) { - session.close(); - this.connectionManager.deleteSession(authority, session); + normalizedRelativeEntries.push(normalizedEntry); + }); + normalizedRelativeEntries.forEach((entry) => { + if (entry.toMiddleware) { + const toMiddleware = normalizedEntriesNameMap[entry.toMiddleware]; + if (toMiddleware === void 0) { + if (debug) { + return; + } + throw new Error( + `${entry.toMiddleware} is not found when adding ${getMiddlewareNameWithAliases(entry.name, entry.aliases)} middleware ${entry.relation} ${entry.toMiddleware}` + ); + } + if (entry.relation === "after") { + toMiddleware.after.push(entry); + } + if (entry.relation === "before") { + toMiddleware.before.push(entry); } - }); - if (requestTimeout) { - req.setTimeout(requestTimeout, () => { - req.close(); - const timeoutError = new Error(`Stream timed out because of no activity for ${requestTimeout} ms`); - timeoutError.name = "TimeoutError"; - rejectWithDestroy(timeoutError); - }); } - if (abortSignal) { - abortSignal.onabort = () => { - req.close(); - const abortError = new Error("Request aborted"); - abortError.name = "AbortError"; - rejectWithDestroy(abortError); - }; + }); + const mainChain = sort(normalizedAbsoluteEntries).map(expandRelativeMiddlewareList).reduce( + (wholeList, expandedMiddlewareList) => { + wholeList.push(...expandedMiddlewareList); + return wholeList; + }, + [] + ); + return mainChain; + }, "getMiddlewareList"); + const stack = { + add: (middleware, options = {}) => { + const { name, override, aliases: _aliases } = options; + const entry = { + step: "initialize", + priority: "normal", + middleware, + ...options + }; + const aliases = getAllAliases(name, _aliases); + if (aliases.length > 0) { + if (aliases.some((alias) => entriesNameSet.has(alias))) { + if (!override) + throw new Error(`Duplicate middleware name '${getMiddlewareNameWithAliases(name, _aliases)}'`); + for (const alias of aliases) { + const toOverrideIndex = absoluteEntries.findIndex( + (entry2) => { + var _a; + return entry2.name === alias || ((_a = entry2.aliases) == null ? void 0 : _a.some((a) => a === alias)); + } + ); + if (toOverrideIndex === -1) { + continue; + } + const toOverride = absoluteEntries[toOverrideIndex]; + if (toOverride.step !== entry.step || entry.priority !== toOverride.priority) { + throw new Error( + `"${getMiddlewareNameWithAliases(toOverride.name, toOverride.aliases)}" middleware with ${toOverride.priority} priority in ${toOverride.step} step cannot be overridden by "${getMiddlewareNameWithAliases(name, _aliases)}" middleware with ${entry.priority} priority in ${entry.step} step.` + ); + } + absoluteEntries.splice(toOverrideIndex, 1); + } + } + for (const alias of aliases) { + entriesNameSet.add(alias); + } } - req.on("frameError", (type, code, id) => { - rejectWithDestroy(new Error(`Frame type id ${type} in stream id ${id} has failed with code ${code}.`)); - }); - req.on("error", rejectWithDestroy); - req.on("aborted", () => { - rejectWithDestroy( - new Error(`HTTP/2 stream is abnormally aborted in mid-communication with result code ${req.rstCode}.`) - ); - }); - req.on("close", () => { - session.unref(); - if (disableConcurrentStreams) { - session.destroy(); + absoluteEntries.push(entry); + }, + addRelativeTo: (middleware, options) => { + const { name, override, aliases: _aliases } = options; + const entry = { + middleware, + ...options + }; + const aliases = getAllAliases(name, _aliases); + if (aliases.length > 0) { + if (aliases.some((alias) => entriesNameSet.has(alias))) { + if (!override) + throw new Error(`Duplicate middleware name '${getMiddlewareNameWithAliases(name, _aliases)}'`); + for (const alias of aliases) { + const toOverrideIndex = relativeEntries.findIndex( + (entry2) => { + var _a; + return entry2.name === alias || ((_a = entry2.aliases) == null ? void 0 : _a.some((a) => a === alias)); + } + ); + if (toOverrideIndex === -1) { + continue; + } + const toOverride = relativeEntries[toOverrideIndex]; + if (toOverride.toMiddleware !== entry.toMiddleware || toOverride.relation !== entry.relation) { + throw new Error( + `"${getMiddlewareNameWithAliases(toOverride.name, toOverride.aliases)}" middleware ${toOverride.relation} "${toOverride.toMiddleware}" middleware cannot be overridden by "${getMiddlewareNameWithAliases(name, _aliases)}" middleware ${entry.relation} "${entry.toMiddleware}" middleware.` + ); + } + relativeEntries.splice(toOverrideIndex, 1); + } } - if (!fulfilled) { - rejectWithDestroy(new Error("Unexpected error: http2 request did not get a response")); + for (const alias of aliases) { + entriesNameSet.add(alias); + } + } + relativeEntries.push(entry); + }, + clone: () => cloneTo(constructStack()), + use: (plugin) => { + plugin.applyToStack(stack); + }, + remove: (toRemove) => { + if (typeof toRemove === "string") + return removeByName(toRemove); + else + return removeByReference(toRemove); + }, + removeByTag: (toRemove) => { + let isRemoved = false; + const filterCb = /* @__PURE__ */ __name((entry) => { + const { tags, name, aliases: _aliases } = entry; + if (tags && tags.includes(toRemove)) { + const aliases = getAllAliases(name, _aliases); + for (const alias of aliases) { + entriesNameSet.delete(alias); + } + isRemoved = true; + return false; } + return true; + }, "filterCb"); + absoluteEntries = absoluteEntries.filter(filterCb); + relativeEntries = relativeEntries.filter(filterCb); + return isRemoved; + }, + concat: (from) => { + var _a; + const cloned = cloneTo(constructStack()); + cloned.use(from); + cloned.identifyOnResolve( + identifyOnResolve || cloned.identifyOnResolve() || (((_a = from.identifyOnResolve) == null ? void 0 : _a.call(from)) ?? false) + ); + return cloned; + }, + applyToStack: cloneTo, + identify: () => { + return getMiddlewareList(true).map((mw) => { + const step = mw.step ?? mw.relation + " " + mw.toMiddleware; + return getMiddlewareNameWithAliases(mw.name, mw.aliases) + " - " + step; }); - writeRequestBodyPromise = writeRequestBody(req, request2, requestTimeout); - }); - } - updateHttpClientConfig(key, value) { - this.config = void 0; - this.configProvider = this.configProvider.then((config) => { - return { - ...config, - [key]: value - }; - }); - } - httpHandlerConfigs() { - return this.config ?? {}; - } - /** - * Destroys a session. - * @param session The session to destroy. - */ - destroySession(session) { - if (!session.destroyed) { - session.destroy(); + }, + identifyOnResolve(toggle) { + if (typeof toggle === "boolean") + identifyOnResolve = toggle; + return identifyOnResolve; + }, + resolve: (handler2, context) => { + for (const middleware of getMiddlewareList().map((entry) => entry.middleware).reverse()) { + handler2 = middleware(handler2, context); + } + if (identifyOnResolve) { + console.log(stack.identify()); + } + return handler2; } - } + }; + return stack; + }, "constructStack"); + var stepWeights = { + initialize: 5, + serialize: 4, + build: 3, + finalizeRequest: 2, + deserialize: 1 }; - __name(_NodeHttp2Handler, "NodeHttp2Handler"); - var NodeHttp2Handler = _NodeHttp2Handler; - var _Collector = class _Collector extends import_stream.Writable { - constructor() { - super(...arguments); - this.bufferedBytes = []; + var priorityWeights = { + high: 3, + normal: 2, + low: 1 + }; + } +}); + +// ../../../node_modules/@smithy/is-array-buffer/dist-cjs/index.js +var require_dist_cjs26 = __commonJS({ + "../../../node_modules/@smithy/is-array-buffer/dist-cjs/index.js"(exports2, module2) { + var __defProp2 = Object.defineProperty; + var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; + var __getOwnPropNames2 = Object.getOwnPropertyNames; + var __hasOwnProp2 = Object.prototype.hasOwnProperty; + var __name = (target, value) => __defProp2(target, "name", { value, configurable: true }); + var __export2 = (target, all) => { + for (var name in all) + __defProp2(target, name, { get: all[name], enumerable: true }); + }; + var __copyProps2 = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames2(from)) + if (!__hasOwnProp2.call(to, key) && key !== except) + __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable }); } - _write(chunk, encoding, callback) { - this.bufferedBytes.push(chunk); - callback(); + return to; + }; + var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); + var src_exports = {}; + __export2(src_exports, { + isArrayBuffer: () => isArrayBuffer + }); + module2.exports = __toCommonJS2(src_exports); + var isArrayBuffer = /* @__PURE__ */ __name((arg) => typeof ArrayBuffer === "function" && arg instanceof ArrayBuffer || Object.prototype.toString.call(arg) === "[object ArrayBuffer]", "isArrayBuffer"); + } +}); + +// ../../../node_modules/@smithy/util-buffer-from/dist-cjs/index.js +var require_dist_cjs27 = __commonJS({ + "../../../node_modules/@smithy/util-buffer-from/dist-cjs/index.js"(exports2, module2) { + var __defProp2 = Object.defineProperty; + var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; + var __getOwnPropNames2 = Object.getOwnPropertyNames; + var __hasOwnProp2 = Object.prototype.hasOwnProperty; + var __name = (target, value) => __defProp2(target, "name", { value, configurable: true }); + var __export2 = (target, all) => { + for (var name in all) + __defProp2(target, name, { get: all[name], enumerable: true }); + }; + var __copyProps2 = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames2(from)) + if (!__hasOwnProp2.call(to, key) && key !== except) + __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable }); } + return to; }; - __name(_Collector, "Collector"); - var Collector = _Collector; - var streamCollector = /* @__PURE__ */ __name((stream) => new Promise((resolve, reject) => { - const collector = new Collector(); - stream.pipe(collector); - stream.on("error", (err) => { - collector.end(); - reject(err); - }); - collector.on("error", reject); - collector.on("finish", function() { - const bytes = new Uint8Array(Buffer.concat(this.bufferedBytes)); - resolve(bytes); - }); - }), "streamCollector"); + var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); + var src_exports = {}; + __export2(src_exports, { + fromArrayBuffer: () => fromArrayBuffer, + fromString: () => fromString + }); + module2.exports = __toCommonJS2(src_exports); + var import_is_array_buffer = require_dist_cjs26(); + var import_buffer = require("buffer"); + var fromArrayBuffer = /* @__PURE__ */ __name((input, offset = 0, length = input.byteLength - offset) => { + if (!(0, import_is_array_buffer.isArrayBuffer)(input)) { + throw new TypeError(`The "input" argument must be ArrayBuffer. Received type ${typeof input} (${input})`); + } + return import_buffer.Buffer.from(input, offset, length); + }, "fromArrayBuffer"); + var fromString = /* @__PURE__ */ __name((input, encoding) => { + if (typeof input !== "string") { + throw new TypeError(`The "input" argument must be of type string. Received type ${typeof input} (${input})`); + } + return encoding ? import_buffer.Buffer.from(input, encoding) : import_buffer.Buffer.from(input); + }, "fromString"); } }); -// ../../../node_modules/@smithy/util-stream/dist-cjs/sdk-stream-mixin.js -var require_sdk_stream_mixin = __commonJS({ - "../../../node_modules/@smithy/util-stream/dist-cjs/sdk-stream-mixin.js"(exports2) { +// ../../../node_modules/@smithy/util-base64/dist-cjs/fromBase64.js +var require_fromBase64 = __commonJS({ + "../../../node_modules/@smithy/util-base64/dist-cjs/fromBase64.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.sdkStreamMixin = void 0; - var node_http_handler_1 = require_dist_cjs32(); - var util_buffer_from_1 = require_dist_cjs9(); - var stream_1 = require("stream"); - var util_1 = require("util"); - var ERR_MSG_STREAM_HAS_BEEN_TRANSFORMED = "The stream has already been transformed."; - var sdkStreamMixin2 = (stream) => { - var _a, _b; - if (!(stream instanceof stream_1.Readable)) { - const name = ((_b = (_a = stream === null || stream === void 0 ? void 0 : stream.__proto__) === null || _a === void 0 ? void 0 : _a.constructor) === null || _b === void 0 ? void 0 : _b.name) || stream; - throw new Error(`Unexpected stream implementation, expect Stream.Readable instance, got ${name}`); + exports2.fromBase64 = void 0; + var util_buffer_from_1 = require_dist_cjs27(); + var BASE64_REGEX = /^[A-Za-z0-9+/]*={0,2}$/; + var fromBase642 = (input) => { + if (input.length * 3 % 4 !== 0) { + throw new TypeError(`Incorrect padding on base64 string.`); } - let transformed = false; - const transformToByteArray = async () => { - if (transformed) { - throw new Error(ERR_MSG_STREAM_HAS_BEEN_TRANSFORMED); - } - transformed = true; - return await (0, node_http_handler_1.streamCollector)(stream); - }; - return Object.assign(stream, { - transformToByteArray, - transformToString: async (encoding) => { - const buf = await transformToByteArray(); - if (encoding === void 0 || Buffer.isEncoding(encoding)) { - return (0, util_buffer_from_1.fromArrayBuffer)(buf.buffer, buf.byteOffset, buf.byteLength).toString(encoding); - } else { - const decoder2 = new util_1.TextDecoder(encoding); - return decoder2.decode(buf); - } - }, - transformToWebStream: () => { - if (transformed) { - throw new Error(ERR_MSG_STREAM_HAS_BEEN_TRANSFORMED); - } - if (stream.readableFlowing !== null) { - throw new Error("The stream has been consumed by other callbacks."); - } - if (typeof stream_1.Readable.toWeb !== "function") { - throw new Error("Readable.toWeb() is not supported. Please make sure you are using Node.js >= 17.0.0, or polyfill is available."); - } - transformed = true; - return stream_1.Readable.toWeb(stream); - } - }); + if (!BASE64_REGEX.exec(input)) { + throw new TypeError(`Invalid base64 string.`); + } + const buffer = (0, util_buffer_from_1.fromString)(input, "base64"); + return new Uint8Array(buffer.buffer, buffer.byteOffset, buffer.byteLength); }; - exports2.sdkStreamMixin = sdkStreamMixin2; + exports2.fromBase64 = fromBase642; } }); -// ../../../node_modules/@smithy/util-stream/dist-cjs/index.js -var require_dist_cjs33 = __commonJS({ - "../../../node_modules/@smithy/util-stream/dist-cjs/index.js"(exports2, module2) { +// ../../../node_modules/@smithy/util-utf8/dist-cjs/index.js +var require_dist_cjs28 = __commonJS({ + "../../../node_modules/@smithy/util-utf8/dist-cjs/index.js"(exports2, module2) { var __defProp2 = Object.defineProperty; var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; var __getOwnPropNames2 = Object.getOwnPropertyNames; @@ -7638,77 +5462,71 @@ var require_dist_cjs33 = __commonJS({ } return to; }; - var __reExport = (target, mod, secondTarget) => (__copyProps2(target, mod, "default"), secondTarget && __copyProps2(secondTarget, mod, "default")); var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); var src_exports = {}; __export2(src_exports, { - Uint8ArrayBlobAdapter: () => Uint8ArrayBlobAdapter + fromUtf8: () => fromUtf8, + toUint8Array: () => toUint8Array, + toUtf8: () => toUtf8 }); module2.exports = __toCommonJS2(src_exports); - var import_util_base64 = require_dist_cjs30(); - var import_util_utf8 = require_dist_cjs10(); - function transformToString(payload, encoding = "utf-8") { - if (encoding === "base64") { - return (0, import_util_base64.toBase64)(payload); + var import_util_buffer_from = require_dist_cjs27(); + var fromUtf8 = /* @__PURE__ */ __name((input) => { + const buf = (0, import_util_buffer_from.fromString)(input, "utf8"); + return new Uint8Array(buf.buffer, buf.byteOffset, buf.byteLength / Uint8Array.BYTES_PER_ELEMENT); + }, "fromUtf8"); + var toUint8Array = /* @__PURE__ */ __name((data) => { + if (typeof data === "string") { + return fromUtf8(data); } - return (0, import_util_utf8.toUtf8)(payload); - } - __name(transformToString, "transformToString"); - function transformFromString(str, encoding) { - if (encoding === "base64") { - return Uint8ArrayBlobAdapter.mutate((0, import_util_base64.fromBase64)(str)); + if (ArrayBuffer.isView(data)) { + return new Uint8Array(data.buffer, data.byteOffset, data.byteLength / Uint8Array.BYTES_PER_ELEMENT); } - return Uint8ArrayBlobAdapter.mutate((0, import_util_utf8.fromUtf8)(str)); - } - __name(transformFromString, "transformFromString"); - var _Uint8ArrayBlobAdapter = class _Uint8ArrayBlobAdapter2 extends Uint8Array { - /** - * @param source - such as a string or Stream. - * @returns a new Uint8ArrayBlobAdapter extending Uint8Array. - */ - static fromString(source, encoding = "utf-8") { - switch (typeof source) { - case "string": - return transformFromString(source, encoding); - default: - throw new Error(`Unsupported conversion from ${typeof source} to Uint8ArrayBlobAdapter.`); - } + return new Uint8Array(data); + }, "toUint8Array"); + var toUtf8 = /* @__PURE__ */ __name((input) => { + if (typeof input === "string") { + return input; } - /** - * @param source - Uint8Array to be mutated. - * @returns the same Uint8Array but with prototype switched to Uint8ArrayBlobAdapter. - */ - static mutate(source) { - Object.setPrototypeOf(source, _Uint8ArrayBlobAdapter2.prototype); - return source; + if (typeof input !== "object" || typeof input.byteOffset !== "number" || typeof input.byteLength !== "number") { + throw new Error("@smithy/util-utf8: toUtf8 encoder function only accepts string | Uint8Array."); } - /** - * @param encoding - default 'utf-8'. - * @returns the blob as string. - */ - transformToString(encoding = "utf-8") { - return transformToString(this, encoding); + return (0, import_util_buffer_from.fromArrayBuffer)(input.buffer, input.byteOffset, input.byteLength).toString("utf8"); + }, "toUtf8"); + } +}); + +// ../../../node_modules/@smithy/util-base64/dist-cjs/toBase64.js +var require_toBase64 = __commonJS({ + "../../../node_modules/@smithy/util-base64/dist-cjs/toBase64.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.toBase64 = void 0; + var util_buffer_from_1 = require_dist_cjs27(); + var util_utf8_1 = require_dist_cjs28(); + var toBase642 = (_input) => { + let input; + if (typeof _input === "string") { + input = (0, util_utf8_1.fromUtf8)(_input); + } else { + input = _input; + } + if (typeof input !== "object" || typeof input.byteOffset !== "number" || typeof input.byteLength !== "number") { + throw new Error("@smithy/util-base64: toBase64 encoder function only accepts string | Uint8Array."); } + return (0, util_buffer_from_1.fromArrayBuffer)(input.buffer, input.byteOffset, input.byteLength).toString("base64"); }; - __name(_Uint8ArrayBlobAdapter, "Uint8ArrayBlobAdapter"); - var Uint8ArrayBlobAdapter = _Uint8ArrayBlobAdapter; - __reExport(src_exports, require_getAwsChunkedEncodingStream(), module2.exports); - __reExport(src_exports, require_sdk_stream_mixin(), module2.exports); + exports2.toBase64 = toBase642; } }); -// ../../../node_modules/@smithy/smithy-client/dist-cjs/index.js -var require_dist_cjs34 = __commonJS({ - "../../../node_modules/@smithy/smithy-client/dist-cjs/index.js"(exports2, module2) { +// ../../../node_modules/@smithy/util-base64/dist-cjs/index.js +var require_dist_cjs29 = __commonJS({ + "../../../node_modules/@smithy/util-base64/dist-cjs/index.js"(exports2, module2) { var __defProp2 = Object.defineProperty; var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; var __getOwnPropNames2 = Object.getOwnPropertyNames; var __hasOwnProp2 = Object.prototype.hasOwnProperty; - var __name = (target, value) => __defProp2(target, "name", { value, configurable: true }); - var __export2 = (target, all) => { - for (var name in all) - __defProp2(target, name, { get: all[name], enumerable: true }); - }; var __copyProps2 = (to, from, except, desc) => { if (from && typeof from === "object" || typeof from === "function") { for (let key of __getOwnPropNames2(from)) @@ -7717,11293 +5535,13107 @@ var require_dist_cjs34 = __commonJS({ } return to; }; + var __reExport = (target, mod, secondTarget) => (__copyProps2(target, mod, "default"), secondTarget && __copyProps2(secondTarget, mod, "default")); var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); var src_exports = {}; - __export2(src_exports, { - Client: () => Client, - Command: () => Command, - LazyJsonString: () => LazyJsonString, - NoOpLogger: () => NoOpLogger, - SENSITIVE_STRING: () => SENSITIVE_STRING, - ServiceException: () => ServiceException, - StringWrapper: () => StringWrapper, - _json: () => _json, - collectBody: () => collectBody, - convertMap: () => convertMap, - createAggregatedClient: () => createAggregatedClient, - dateToUtcString: () => dateToUtcString, - decorateServiceException: () => decorateServiceException, - emitWarningIfUnsupportedVersion: () => emitWarningIfUnsupportedVersion, - expectBoolean: () => expectBoolean, - expectByte: () => expectByte, - expectFloat32: () => expectFloat32, - expectInt: () => expectInt, - expectInt32: () => expectInt32, - expectLong: () => expectLong, - expectNonNull: () => expectNonNull, - expectNumber: () => expectNumber, - expectObject: () => expectObject, - expectShort: () => expectShort, - expectString: () => expectString, - expectUnion: () => expectUnion, - extendedEncodeURIComponent: () => extendedEncodeURIComponent, - getArrayIfSingleItem: () => getArrayIfSingleItem, - getDefaultClientConfiguration: () => getDefaultClientConfiguration, - getDefaultExtensionConfiguration: () => getDefaultExtensionConfiguration, - getValueFromTextNode: () => getValueFromTextNode, - handleFloat: () => handleFloat, - limitedParseDouble: () => limitedParseDouble, - limitedParseFloat: () => limitedParseFloat, - limitedParseFloat32: () => limitedParseFloat32, - loadConfigsForDefaultMode: () => loadConfigsForDefaultMode, - logger: () => logger, - map: () => map, - parseBoolean: () => parseBoolean, - parseEpochTimestamp: () => parseEpochTimestamp, - parseRfc3339DateTime: () => parseRfc3339DateTime, - parseRfc3339DateTimeWithOffset: () => parseRfc3339DateTimeWithOffset, - parseRfc7231DateTime: () => parseRfc7231DateTime, - resolveDefaultRuntimeConfig: () => resolveDefaultRuntimeConfig, - resolvedPath: () => resolvedPath, - serializeFloat: () => serializeFloat, - splitEvery: () => splitEvery, - strictParseByte: () => strictParseByte, - strictParseDouble: () => strictParseDouble, - strictParseFloat: () => strictParseFloat, - strictParseFloat32: () => strictParseFloat32, - strictParseInt: () => strictParseInt, - strictParseInt32: () => strictParseInt32, - strictParseLong: () => strictParseLong, - strictParseShort: () => strictParseShort, - take: () => take, - throwDefaultError: () => throwDefaultError, - withBaseException: () => withBaseException - }); module2.exports = __toCommonJS2(src_exports); - var _NoOpLogger = class _NoOpLogger { - trace() { - } - debug() { - } - info() { - } - warn() { - } - error() { - } - }; - __name(_NoOpLogger, "NoOpLogger"); - var NoOpLogger = _NoOpLogger; - var import_middleware_stack = require_dist_cjs29(); - var _Client = class _Client { - constructor(config) { - this.middlewareStack = (0, import_middleware_stack.constructStack)(); - this.config = config; - } - send(command, optionsOrCb, cb) { - const options = typeof optionsOrCb !== "function" ? optionsOrCb : void 0; - const callback = typeof optionsOrCb === "function" ? optionsOrCb : cb; - const handler2 = command.resolveMiddleware(this.middlewareStack, this.config, options); - if (callback) { - handler2(command).then( - (result) => callback(null, result.output), - (err) => callback(err) - ).catch( - // prevent any errors thrown in the callback from triggering an - // unhandled promise rejection - () => { - } - ); - } else { - return handler2(command).then((result) => result.output); - } - } - destroy() { - if (this.config.requestHandler.destroy) - this.config.requestHandler.destroy(); - } - }; - __name(_Client, "Client"); - var Client = _Client; - var import_util_stream = require_dist_cjs33(); - var collectBody = /* @__PURE__ */ __name(async (streamBody = new Uint8Array(), context) => { - if (streamBody instanceof Uint8Array) { - return import_util_stream.Uint8ArrayBlobAdapter.mutate(streamBody); - } - if (!streamBody) { - return import_util_stream.Uint8ArrayBlobAdapter.mutate(new Uint8Array()); - } - const fromContext = context.streamCollector(streamBody); - return import_util_stream.Uint8ArrayBlobAdapter.mutate(await fromContext); - }, "collectBody"); - var import_types = require_dist_cjs(); - var _Command = class _Command { - constructor() { - this.middlewareStack = (0, import_middleware_stack.constructStack)(); - } - /** - * Factory for Command ClassBuilder. - * @internal - */ - static classBuilder() { - return new ClassBuilder(); - } - /** - * @internal - */ - resolveMiddlewareWithContext(clientStack, configuration, options, { - middlewareFn, - clientName, - commandName, - inputFilterSensitiveLog, - outputFilterSensitiveLog, - smithyContext, - additionalContext, - CommandCtor - }) { - for (const mw of middlewareFn.bind(this)(CommandCtor, clientStack, configuration, options)) { - this.middlewareStack.use(mw); + __reExport(src_exports, require_fromBase64(), module2.exports); + __reExport(src_exports, require_toBase64(), module2.exports); + } +}); + +// ../../../node_modules/@smithy/smithy-client/node_modules/@smithy/util-stream/dist-cjs/getAwsChunkedEncodingStream.js +var require_getAwsChunkedEncodingStream = __commonJS({ + "../../../node_modules/@smithy/smithy-client/node_modules/@smithy/util-stream/dist-cjs/getAwsChunkedEncodingStream.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.getAwsChunkedEncodingStream = void 0; + var stream_1 = require("stream"); + var getAwsChunkedEncodingStream2 = (readableStream, options) => { + const { base64Encoder, bodyLengthChecker, checksumAlgorithmFn, checksumLocationName, streamHasher } = options; + const checksumRequired = base64Encoder !== void 0 && checksumAlgorithmFn !== void 0 && checksumLocationName !== void 0 && streamHasher !== void 0; + const digest = checksumRequired ? streamHasher(checksumAlgorithmFn, readableStream) : void 0; + const awsChunkedEncodingStream = new stream_1.Readable({ read: () => { + } }); + readableStream.on("data", (data) => { + const length = bodyLengthChecker(data) || 0; + awsChunkedEncodingStream.push(`${length.toString(16)}\r +`); + awsChunkedEncodingStream.push(data); + awsChunkedEncodingStream.push("\r\n"); + }); + readableStream.on("end", async () => { + awsChunkedEncodingStream.push(`0\r +`); + if (checksumRequired) { + const checksum = base64Encoder(await digest); + awsChunkedEncodingStream.push(`${checksumLocationName}:${checksum}\r +`); + awsChunkedEncodingStream.push(`\r +`); } - const stack = clientStack.concat(this.middlewareStack); - const { logger: logger2 } = configuration; - const handlerExecutionContext = { - logger: logger2, - clientName, - commandName, - inputFilterSensitiveLog, - outputFilterSensitiveLog, - [import_types.SMITHY_CONTEXT_KEY]: { - ...smithyContext - }, - ...additionalContext - }; - const { requestHandler } = configuration; - return stack.resolve( - (request2) => requestHandler.handle(request2.request, options || {}), - handlerExecutionContext - ); - } + awsChunkedEncodingStream.push(null); + }); + return awsChunkedEncodingStream; }; - __name(_Command, "Command"); - var Command = _Command; - var _ClassBuilder = class _ClassBuilder { - constructor() { - this._init = () => { - }; - this._ep = {}; - this._middlewareFn = () => []; - this._commandName = ""; - this._clientName = ""; - this._additionalContext = {}; - this._smithyContext = {}; - this._inputFilterSensitiveLog = (_) => _; - this._outputFilterSensitiveLog = (_) => _; - this._serializer = null; - this._deserializer = null; - } - /** - * Optional init callback. - */ - init(cb) { - this._init = cb; + exports2.getAwsChunkedEncodingStream = getAwsChunkedEncodingStream2; + } +}); + +// ../../../node_modules/@smithy/smithy-client/node_modules/@smithy/protocol-http/dist-cjs/index.js +var require_dist_cjs30 = __commonJS({ + "../../../node_modules/@smithy/smithy-client/node_modules/@smithy/protocol-http/dist-cjs/index.js"(exports2, module2) { + var __defProp2 = Object.defineProperty; + var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; + var __getOwnPropNames2 = Object.getOwnPropertyNames; + var __hasOwnProp2 = Object.prototype.hasOwnProperty; + var __name = (target, value) => __defProp2(target, "name", { value, configurable: true }); + var __export2 = (target, all) => { + for (var name in all) + __defProp2(target, name, { get: all[name], enumerable: true }); + }; + var __copyProps2 = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames2(from)) + if (!__hasOwnProp2.call(to, key) && key !== except) + __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable }); } - /** - * Set the endpoint parameter instructions. - */ - ep(endpointParameterInstructions) { - this._ep = endpointParameterInstructions; - return this; + return to; + }; + var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); + var src_exports = {}; + __export2(src_exports, { + Field: () => Field, + Fields: () => Fields, + HttpRequest: () => HttpRequest7, + HttpResponse: () => HttpResponse2, + IHttpRequest: () => import_types5.HttpRequest, + getHttpHandlerExtensionConfiguration: () => getHttpHandlerExtensionConfiguration, + isValidHostname: () => isValidHostname, + resolveHttpHandlerRuntimeConfig: () => resolveHttpHandlerRuntimeConfig + }); + module2.exports = __toCommonJS2(src_exports); + var getHttpHandlerExtensionConfiguration = /* @__PURE__ */ __name((runtimeConfig) => { + let httpHandler = runtimeConfig.httpHandler; + return { + setHttpHandler(handler2) { + httpHandler = handler2; + }, + httpHandler() { + return httpHandler; + }, + updateHttpClientConfig(key, value) { + httpHandler.updateHttpClientConfig(key, value); + }, + httpHandlerConfigs() { + return httpHandler.httpHandlerConfigs(); + } + }; + }, "getHttpHandlerExtensionConfiguration"); + var resolveHttpHandlerRuntimeConfig = /* @__PURE__ */ __name((httpHandlerExtensionConfiguration) => { + return { + httpHandler: httpHandlerExtensionConfiguration.httpHandler() + }; + }, "resolveHttpHandlerRuntimeConfig"); + var import_types5 = require_dist_cjs(); + var _Field = class _Field { + constructor({ name, kind = import_types5.FieldPosition.HEADER, values = [] }) { + this.name = name; + this.kind = kind; + this.values = values; } /** - * Add any number of middleware. + * Appends a value to the field. + * + * @param value The value to append. */ - m(middlewareSupplier) { - this._middlewareFn = middlewareSupplier; - return this; + add(value) { + this.values.push(value); } /** - * Set the initial handler execution context Smithy field. + * Overwrite existing field values. + * + * @param values The new field values. */ - s(service, operation, smithyContext = {}) { - this._smithyContext = { - service, - operation, - ...smithyContext - }; - return this; + set(values) { + this.values = values; } /** - * Set the initial handler execution context. + * Remove all matching entries from list. + * + * @param value Value to remove. */ - c(additionalContext = {}) { - this._additionalContext = additionalContext; - return this; + remove(value) { + this.values = this.values.filter((v) => v !== value); } /** - * Set constant string identifiers for the operation. + * Get comma-delimited string. + * + * @returns String representation of {@link Field}. */ - n(clientName, commandName) { - this._clientName = clientName; - this._commandName = commandName; - return this; + toString() { + return this.values.map((v) => v.includes(",") || v.includes(" ") ? `"${v}"` : v).join(", "); } /** - * Set the input and output sensistive log filters. + * Get string values as a list + * + * @returns Values in {@link Field} as a list. */ - f(inputFilter = (_) => _, outputFilter = (_) => _) { - this._inputFilterSensitiveLog = inputFilter; - this._outputFilterSensitiveLog = outputFilter; - return this; + get() { + return this.values; } - /** - * Sets the serializer. - */ - ser(serializer) { - this._serializer = serializer; - return this; + }; + __name(_Field, "Field"); + var Field = _Field; + var _Fields = class _Fields { + constructor({ fields = [], encoding = "utf-8" }) { + this.entries = {}; + fields.forEach(this.setField.bind(this)); + this.encoding = encoding; } /** - * Sets the deserializer. + * Set entry for a {@link Field} name. The `name` + * attribute will be used to key the collection. + * + * @param field The {@link Field} to set. */ - de(deserializer) { - this._deserializer = deserializer; - return this; + setField(field) { + this.entries[field.name.toLowerCase()] = field; } /** - * @returns a Command class with the classBuilder properties. + * Retrieve {@link Field} entry by name. + * + * @param name The name of the {@link Field} entry + * to retrieve + * @returns The {@link Field} if it exists. */ - build() { - var _a; - const closure = this; - let CommandRef; - return CommandRef = (_a = class extends Command { - /** - * @public - */ - constructor(...[input]) { - super(); - this.serialize = closure._serializer; - this.deserialize = closure._deserializer; - this.input = input ?? {}; - closure._init(this); - } - /** - * @public - */ - static getEndpointParameterInstructions() { - return closure._ep; - } - /** - * @internal - */ - resolveMiddleware(stack, configuration, options) { - return this.resolveMiddlewareWithContext(stack, configuration, options, { - CommandCtor: CommandRef, - middlewareFn: closure._middlewareFn, - clientName: closure._clientName, - commandName: closure._commandName, - inputFilterSensitiveLog: closure._inputFilterSensitiveLog, - outputFilterSensitiveLog: closure._outputFilterSensitiveLog, - smithyContext: closure._smithyContext, - additionalContext: closure._additionalContext - }); - } - }, __name(_a, "CommandRef"), _a); - } - }; - __name(_ClassBuilder, "ClassBuilder"); - var ClassBuilder = _ClassBuilder; - var SENSITIVE_STRING = "***SensitiveInformation***"; - var createAggregatedClient = /* @__PURE__ */ __name((commands, Client2) => { - for (const command of Object.keys(commands)) { - const CommandCtor = commands[command]; - const methodImpl = /* @__PURE__ */ __name(async function(args, optionsOrCb, cb) { - const command2 = new CommandCtor(args); - if (typeof optionsOrCb === "function") { - this.send(command2, optionsOrCb); - } else if (typeof cb === "function") { - if (typeof optionsOrCb !== "object") - throw new Error(`Expected http options but got ${typeof optionsOrCb}`); - this.send(command2, optionsOrCb || {}, cb); - } else { - return this.send(command2, optionsOrCb); - } - }, "methodImpl"); - const methodName = (command[0].toLowerCase() + command.slice(1)).replace(/Command$/, ""); - Client2.prototype[methodName] = methodImpl; - } - }, "createAggregatedClient"); - var parseBoolean = /* @__PURE__ */ __name((value) => { - switch (value) { - case "true": - return true; - case "false": - return false; - default: - throw new Error(`Unable to parse boolean value "${value}"`); - } - }, "parseBoolean"); - var expectBoolean = /* @__PURE__ */ __name((value) => { - if (value === null || value === void 0) { - return void 0; - } - if (typeof value === "number") { - if (value === 0 || value === 1) { - logger.warn(stackTraceWarning(`Expected boolean, got ${typeof value}: ${value}`)); - } - if (value === 0) { - return false; - } - if (value === 1) { - return true; - } - } - if (typeof value === "string") { - const lower = value.toLowerCase(); - if (lower === "false" || lower === "true") { - logger.warn(stackTraceWarning(`Expected boolean, got ${typeof value}: ${value}`)); - } - if (lower === "false") { - return false; - } - if (lower === "true") { - return true; - } - } - if (typeof value === "boolean") { - return value; - } - throw new TypeError(`Expected boolean, got ${typeof value}: ${value}`); - }, "expectBoolean"); - var expectNumber = /* @__PURE__ */ __name((value) => { - if (value === null || value === void 0) { - return void 0; - } - if (typeof value === "string") { - const parsed = parseFloat(value); - if (!Number.isNaN(parsed)) { - if (String(parsed) !== String(value)) { - logger.warn(stackTraceWarning(`Expected number but observed string: ${value}`)); - } - return parsed; - } + getField(name) { + return this.entries[name.toLowerCase()]; } - if (typeof value === "number") { - return value; + /** + * Delete entry from collection. + * + * @param name Name of the entry to delete. + */ + removeField(name) { + delete this.entries[name.toLowerCase()]; } - throw new TypeError(`Expected number, got ${typeof value}: ${value}`); - }, "expectNumber"); - var MAX_FLOAT = Math.ceil(2 ** 127 * (2 - 2 ** -23)); - var expectFloat32 = /* @__PURE__ */ __name((value) => { - const expected = expectNumber(value); - if (expected !== void 0 && !Number.isNaN(expected) && expected !== Infinity && expected !== -Infinity) { - if (Math.abs(expected) > MAX_FLOAT) { - throw new TypeError(`Expected 32-bit float, got ${value}`); - } + /** + * Helper function for retrieving specific types of fields. + * Used to grab all headers or all trailers. + * + * @param kind {@link FieldPosition} of entries to retrieve. + * @returns The {@link Field} entries with the specified + * {@link FieldPosition}. + */ + getByType(kind) { + return Object.values(this.entries).filter((field) => field.kind === kind); } - return expected; - }, "expectFloat32"); - var expectLong = /* @__PURE__ */ __name((value) => { - if (value === null || value === void 0) { - return void 0; + }; + __name(_Fields, "Fields"); + var Fields = _Fields; + var _HttpRequest = class _HttpRequest2 { + constructor(options) { + this.method = options.method || "GET"; + this.hostname = options.hostname || "localhost"; + this.port = options.port; + this.query = options.query || {}; + this.headers = options.headers || {}; + this.body = options.body; + this.protocol = options.protocol ? options.protocol.slice(-1) !== ":" ? `${options.protocol}:` : options.protocol : "https:"; + this.path = options.path ? options.path.charAt(0) !== "/" ? `/${options.path}` : options.path : "/"; + this.username = options.username; + this.password = options.password; + this.fragment = options.fragment; } - if (Number.isInteger(value) && !Number.isNaN(value)) { - return value; + /** + * Note: this does not deep-clone the body. + */ + static clone(request2) { + const cloned = new _HttpRequest2({ + ...request2, + headers: { ...request2.headers } + }); + if (cloned.query) { + cloned.query = cloneQuery(cloned.query); + } + return cloned; } - throw new TypeError(`Expected integer, got ${typeof value}: ${value}`); - }, "expectLong"); - var expectInt = expectLong; - var expectInt32 = /* @__PURE__ */ __name((value) => expectSizedInt(value, 32), "expectInt32"); - var expectShort = /* @__PURE__ */ __name((value) => expectSizedInt(value, 16), "expectShort"); - var expectByte = /* @__PURE__ */ __name((value) => expectSizedInt(value, 8), "expectByte"); - var expectSizedInt = /* @__PURE__ */ __name((value, size) => { - const expected = expectLong(value); - if (expected !== void 0 && castInt(expected, size) !== expected) { - throw new TypeError(`Expected ${size}-bit integer, got ${value}`); + /** + * This method only actually asserts that request is the interface {@link IHttpRequest}, + * and not necessarily this concrete class. Left in place for API stability. + * + * Do not call instance methods on the input of this function, and + * do not assume it has the HttpRequest prototype. + */ + static isInstance(request2) { + if (!request2) { + return false; + } + const req = request2; + return "method" in req && "protocol" in req && "hostname" in req && "path" in req && typeof req["query"] === "object" && typeof req["headers"] === "object"; } - return expected; - }, "expectSizedInt"); - var castInt = /* @__PURE__ */ __name((value, size) => { - switch (size) { - case 32: - return Int32Array.of(value)[0]; - case 16: - return Int16Array.of(value)[0]; - case 8: - return Int8Array.of(value)[0]; + /** + * @deprecated use static HttpRequest.clone(request) instead. It's not safe to call + * this method because {@link HttpRequest.isInstance} incorrectly + * asserts that IHttpRequest (interface) objects are of type HttpRequest (class). + */ + clone() { + return _HttpRequest2.clone(this); } - }, "castInt"); - var expectNonNull = /* @__PURE__ */ __name((value, location) => { - if (value === null || value === void 0) { - if (location) { - throw new TypeError(`Expected a non-null value for ${location}`); - } - throw new TypeError("Expected a non-null value"); + }; + __name(_HttpRequest, "HttpRequest"); + var HttpRequest7 = _HttpRequest; + function cloneQuery(query) { + return Object.keys(query).reduce((carry, paramName) => { + const param = query[paramName]; + return { + ...carry, + [paramName]: Array.isArray(param) ? [...param] : param + }; + }, {}); + } + __name(cloneQuery, "cloneQuery"); + var _HttpResponse = class _HttpResponse { + constructor(options) { + this.statusCode = options.statusCode; + this.reason = options.reason; + this.headers = options.headers || {}; + this.body = options.body; } - return value; - }, "expectNonNull"); - var expectObject = /* @__PURE__ */ __name((value) => { - if (value === null || value === void 0) { - return void 0; + static isInstance(response) { + if (!response) + return false; + const resp = response; + return typeof resp.statusCode === "number" && typeof resp.headers === "object"; } - if (typeof value === "object" && !Array.isArray(value)) { - return value; + }; + __name(_HttpResponse, "HttpResponse"); + var HttpResponse2 = _HttpResponse; + function isValidHostname(hostname) { + const hostPattern = /^[a-z0-9][a-z0-9\.\-]*[a-z0-9]$/; + return hostPattern.test(hostname); + } + __name(isValidHostname, "isValidHostname"); + } +}); + +// ../../../node_modules/@smithy/util-uri-escape/dist-cjs/index.js +var require_dist_cjs31 = __commonJS({ + "../../../node_modules/@smithy/util-uri-escape/dist-cjs/index.js"(exports2, module2) { + var __defProp2 = Object.defineProperty; + var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; + var __getOwnPropNames2 = Object.getOwnPropertyNames; + var __hasOwnProp2 = Object.prototype.hasOwnProperty; + var __name = (target, value) => __defProp2(target, "name", { value, configurable: true }); + var __export2 = (target, all) => { + for (var name in all) + __defProp2(target, name, { get: all[name], enumerable: true }); + }; + var __copyProps2 = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames2(from)) + if (!__hasOwnProp2.call(to, key) && key !== except) + __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable }); } - const receivedType = Array.isArray(value) ? "array" : typeof value; - throw new TypeError(`Expected object, got ${receivedType}: ${value}`); - }, "expectObject"); - var expectString = /* @__PURE__ */ __name((value) => { - if (value === null || value === void 0) { - return void 0; + return to; + }; + var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); + var src_exports = {}; + __export2(src_exports, { + escapeUri: () => escapeUri, + escapeUriPath: () => escapeUriPath + }); + module2.exports = __toCommonJS2(src_exports); + var escapeUri = /* @__PURE__ */ __name((uri) => ( + // AWS percent-encodes some extra non-standard characters in a URI + encodeURIComponent(uri).replace(/[!'()*]/g, hexEncode) + ), "escapeUri"); + var hexEncode = /* @__PURE__ */ __name((c) => `%${c.charCodeAt(0).toString(16).toUpperCase()}`, "hexEncode"); + var escapeUriPath = /* @__PURE__ */ __name((uri) => uri.split("/").map(escapeUri).join("/"), "escapeUriPath"); + } +}); + +// ../../../node_modules/@smithy/querystring-builder/dist-cjs/index.js +var require_dist_cjs32 = __commonJS({ + "../../../node_modules/@smithy/querystring-builder/dist-cjs/index.js"(exports2, module2) { + var __defProp2 = Object.defineProperty; + var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; + var __getOwnPropNames2 = Object.getOwnPropertyNames; + var __hasOwnProp2 = Object.prototype.hasOwnProperty; + var __name = (target, value) => __defProp2(target, "name", { value, configurable: true }); + var __export2 = (target, all) => { + for (var name in all) + __defProp2(target, name, { get: all[name], enumerable: true }); + }; + var __copyProps2 = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames2(from)) + if (!__hasOwnProp2.call(to, key) && key !== except) + __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable }); } - if (typeof value === "string") { - return value; + return to; + }; + var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); + var src_exports = {}; + __export2(src_exports, { + buildQueryString: () => buildQueryString + }); + module2.exports = __toCommonJS2(src_exports); + var import_util_uri_escape = require_dist_cjs31(); + function buildQueryString(query) { + const parts = []; + for (let key of Object.keys(query).sort()) { + const value = query[key]; + key = (0, import_util_uri_escape.escapeUri)(key); + if (Array.isArray(value)) { + for (let i = 0, iLen = value.length; i < iLen; i++) { + parts.push(`${key}=${(0, import_util_uri_escape.escapeUri)(value[i])}`); + } + } else { + let qsEntry = key; + if (value || typeof value === "string") { + qsEntry += `=${(0, import_util_uri_escape.escapeUri)(value)}`; + } + parts.push(qsEntry); + } } - if (["boolean", "number", "bigint"].includes(typeof value)) { - logger.warn(stackTraceWarning(`Expected string, got ${typeof value}: ${value}`)); - return String(value); + return parts.join("&"); + } + __name(buildQueryString, "buildQueryString"); + } +}); + +// ../../../node_modules/@smithy/smithy-client/node_modules/@smithy/node-http-handler/dist-cjs/index.js +var require_dist_cjs33 = __commonJS({ + "../../../node_modules/@smithy/smithy-client/node_modules/@smithy/node-http-handler/dist-cjs/index.js"(exports2, module2) { + var __create2 = Object.create; + var __defProp2 = Object.defineProperty; + var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; + var __getOwnPropNames2 = Object.getOwnPropertyNames; + var __getProtoOf2 = Object.getPrototypeOf; + var __hasOwnProp2 = Object.prototype.hasOwnProperty; + var __name = (target, value) => __defProp2(target, "name", { value, configurable: true }); + var __export2 = (target, all) => { + for (var name in all) + __defProp2(target, name, { get: all[name], enumerable: true }); + }; + var __copyProps2 = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames2(from)) + if (!__hasOwnProp2.call(to, key) && key !== except) + __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable }); } - throw new TypeError(`Expected string, got ${typeof value}: ${value}`); - }, "expectString"); - var expectUnion = /* @__PURE__ */ __name((value) => { - if (value === null || value === void 0) { - return void 0; + return to; + }; + var __toESM2 = (mod, isNodeMode, target) => (target = mod != null ? __create2(__getProtoOf2(mod)) : {}, __copyProps2( + // If the importer is in node compatibility mode or this is not an ESM + // file that has been converted to a CommonJS file using a Babel- + // compatible transform (i.e. "__esModule" has not been set), then set + // "default" to the CommonJS "module.exports" for node compatibility. + isNodeMode || !mod || !mod.__esModule ? __defProp2(target, "default", { value: mod, enumerable: true }) : target, + mod + )); + var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); + var src_exports = {}; + __export2(src_exports, { + DEFAULT_REQUEST_TIMEOUT: () => DEFAULT_REQUEST_TIMEOUT, + NodeHttp2Handler: () => NodeHttp2Handler, + NodeHttpHandler: () => NodeHttpHandler, + streamCollector: () => streamCollector + }); + module2.exports = __toCommonJS2(src_exports); + var import_protocol_http8 = require_dist_cjs30(); + var import_querystring_builder = require_dist_cjs32(); + var import_http2 = require("http"); + var import_https = require("https"); + var NODEJS_TIMEOUT_ERROR_CODES = ["ECONNRESET", "EPIPE", "ETIMEDOUT"]; + var getTransformedHeaders = /* @__PURE__ */ __name((headers) => { + const transformedHeaders = {}; + for (const name of Object.keys(headers)) { + const headerValues = headers[name]; + transformedHeaders[name] = Array.isArray(headerValues) ? headerValues.join(",") : headerValues; } - const asObject = expectObject(value); - const setKeys = Object.entries(asObject).filter(([, v]) => v != null).map(([k]) => k); - if (setKeys.length === 0) { - throw new TypeError(`Unions must have exactly one non-null member. None were found.`); + return transformedHeaders; + }, "getTransformedHeaders"); + var DEFER_EVENT_LISTENER_TIME = 1e3; + var setConnectionTimeout = /* @__PURE__ */ __name((request2, reject, timeoutInMs = 0) => { + if (!timeoutInMs) { + return -1; } - if (setKeys.length > 1) { - throw new TypeError(`Unions must have exactly one non-null member. Keys ${setKeys} were not null.`); + const registerTimeout = /* @__PURE__ */ __name((offset) => { + const timeoutId = setTimeout(() => { + request2.destroy(); + reject( + Object.assign(new Error(`Socket timed out without establishing a connection within ${timeoutInMs} ms`), { + name: "TimeoutError" + }) + ); + }, timeoutInMs - offset); + const doWithSocket = /* @__PURE__ */ __name((socket) => { + if (socket == null ? void 0 : socket.connecting) { + socket.on("connect", () => { + clearTimeout(timeoutId); + }); + } else { + clearTimeout(timeoutId); + } + }, "doWithSocket"); + if (request2.socket) { + doWithSocket(request2.socket); + } else { + request2.on("socket", doWithSocket); + } + }, "registerTimeout"); + if (timeoutInMs < 2e3) { + registerTimeout(0); + return 0; } - return asObject; - }, "expectUnion"); - var strictParseDouble = /* @__PURE__ */ __name((value) => { - if (typeof value == "string") { - return expectNumber(parseNumber(value)); + return setTimeout(registerTimeout.bind(null, DEFER_EVENT_LISTENER_TIME), DEFER_EVENT_LISTENER_TIME); + }, "setConnectionTimeout"); + var DEFER_EVENT_LISTENER_TIME2 = 3e3; + var setSocketKeepAlive = /* @__PURE__ */ __name((request2, { keepAlive, keepAliveMsecs }, deferTimeMs = DEFER_EVENT_LISTENER_TIME2) => { + if (keepAlive !== true) { + return -1; } - return expectNumber(value); - }, "strictParseDouble"); - var strictParseFloat = strictParseDouble; - var strictParseFloat32 = /* @__PURE__ */ __name((value) => { - if (typeof value == "string") { - return expectFloat32(parseNumber(value)); + const registerListener = /* @__PURE__ */ __name(() => { + if (request2.socket) { + request2.socket.setKeepAlive(keepAlive, keepAliveMsecs || 0); + } else { + request2.on("socket", (socket) => { + socket.setKeepAlive(keepAlive, keepAliveMsecs || 0); + }); + } + }, "registerListener"); + if (deferTimeMs === 0) { + registerListener(); + return 0; } - return expectFloat32(value); - }, "strictParseFloat32"); - var NUMBER_REGEX = /(-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?)|(-?Infinity)|(NaN)/g; - var parseNumber = /* @__PURE__ */ __name((value) => { - const matches = value.match(NUMBER_REGEX); - if (matches === null || matches[0].length !== value.length) { - throw new TypeError(`Expected real number, got implicit NaN`); + return setTimeout(registerListener, deferTimeMs); + }, "setSocketKeepAlive"); + var DEFER_EVENT_LISTENER_TIME3 = 3e3; + var setSocketTimeout = /* @__PURE__ */ __name((request2, reject, timeoutInMs = 0) => { + const registerTimeout = /* @__PURE__ */ __name((offset) => { + request2.setTimeout(timeoutInMs - offset, () => { + request2.destroy(); + reject(Object.assign(new Error(`Connection timed out after ${timeoutInMs} ms`), { name: "TimeoutError" })); + }); + }, "registerTimeout"); + if (0 < timeoutInMs && timeoutInMs < 6e3) { + registerTimeout(0); + return 0; } - return parseFloat(value); - }, "parseNumber"); - var limitedParseDouble = /* @__PURE__ */ __name((value) => { - if (typeof value == "string") { - return parseFloatString(value); + return setTimeout( + registerTimeout.bind(null, timeoutInMs === 0 ? 0 : DEFER_EVENT_LISTENER_TIME3), + DEFER_EVENT_LISTENER_TIME3 + ); + }, "setSocketTimeout"); + var import_stream = require("stream"); + var MIN_WAIT_TIME = 1e3; + async function writeRequestBody(httpRequest, request2, maxContinueTimeoutMs = MIN_WAIT_TIME) { + const headers = request2.headers ?? {}; + const expect = headers["Expect"] || headers["expect"]; + let timeoutId = -1; + let hasError = false; + if (expect === "100-continue") { + await Promise.race([ + new Promise((resolve) => { + timeoutId = Number(setTimeout(resolve, Math.max(MIN_WAIT_TIME, maxContinueTimeoutMs))); + }), + new Promise((resolve) => { + httpRequest.on("continue", () => { + clearTimeout(timeoutId); + resolve(); + }); + httpRequest.on("error", () => { + hasError = true; + clearTimeout(timeoutId); + resolve(); + }); + }) + ]); } - return expectNumber(value); - }, "limitedParseDouble"); - var handleFloat = limitedParseDouble; - var limitedParseFloat = limitedParseDouble; - var limitedParseFloat32 = /* @__PURE__ */ __name((value) => { - if (typeof value == "string") { - return parseFloatString(value); + if (!hasError) { + writeBody(httpRequest, request2.body); } - return expectFloat32(value); - }, "limitedParseFloat32"); - var parseFloatString = /* @__PURE__ */ __name((value) => { - switch (value) { - case "NaN": - return NaN; - case "Infinity": - return Infinity; - case "-Infinity": - return -Infinity; - default: - throw new Error(`Unable to parse float value: ${value}`); + } + __name(writeRequestBody, "writeRequestBody"); + function writeBody(httpRequest, body) { + if (body instanceof import_stream.Readable) { + body.pipe(httpRequest); + return; } - }, "parseFloatString"); - var strictParseLong = /* @__PURE__ */ __name((value) => { - if (typeof value === "string") { - return expectLong(parseNumber(value)); + if (body) { + if (Buffer.isBuffer(body) || typeof body === "string") { + httpRequest.end(body); + return; + } + const uint8 = body; + if (typeof uint8 === "object" && uint8.buffer && typeof uint8.byteOffset === "number" && typeof uint8.byteLength === "number") { + httpRequest.end(Buffer.from(uint8.buffer, uint8.byteOffset, uint8.byteLength)); + return; + } + httpRequest.end(Buffer.from(body)); + return; } - return expectLong(value); - }, "strictParseLong"); - var strictParseInt = strictParseLong; - var strictParseInt32 = /* @__PURE__ */ __name((value) => { - if (typeof value === "string") { - return expectInt32(parseNumber(value)); + httpRequest.end(); + } + __name(writeBody, "writeBody"); + var DEFAULT_REQUEST_TIMEOUT = 0; + var _NodeHttpHandler = class _NodeHttpHandler2 { + constructor(options) { + this.socketWarningTimestamp = 0; + this.metadata = { handlerProtocol: "http/1.1" }; + this.configProvider = new Promise((resolve, reject) => { + if (typeof options === "function") { + options().then((_options) => { + resolve(this.resolveDefaultConfig(_options)); + }).catch(reject); + } else { + resolve(this.resolveDefaultConfig(options)); + } + }); } - return expectInt32(value); - }, "strictParseInt32"); - var strictParseShort = /* @__PURE__ */ __name((value) => { - if (typeof value === "string") { - return expectShort(parseNumber(value)); + /** + * @returns the input if it is an HttpHandler of any class, + * or instantiates a new instance of this handler. + */ + static create(instanceOrOptions) { + if (typeof (instanceOrOptions == null ? void 0 : instanceOrOptions.handle) === "function") { + return instanceOrOptions; + } + return new _NodeHttpHandler2(instanceOrOptions); } - return expectShort(value); - }, "strictParseShort"); - var strictParseByte = /* @__PURE__ */ __name((value) => { - if (typeof value === "string") { - return expectByte(parseNumber(value)); + /** + * @internal + * + * @param agent - http(s) agent in use by the NodeHttpHandler instance. + * @param socketWarningTimestamp - last socket usage check timestamp. + * @param logger - channel for the warning. + * @returns timestamp of last emitted warning. + */ + static checkSocketUsage(agent, socketWarningTimestamp, logger = console) { + var _a, _b, _c; + const { sockets, requests, maxSockets } = agent; + if (typeof maxSockets !== "number" || maxSockets === Infinity) { + return socketWarningTimestamp; + } + const interval = 15e3; + if (Date.now() - interval < socketWarningTimestamp) { + return socketWarningTimestamp; + } + if (sockets && requests) { + for (const origin in sockets) { + const socketsInUse = ((_a = sockets[origin]) == null ? void 0 : _a.length) ?? 0; + const requestsEnqueued = ((_b = requests[origin]) == null ? void 0 : _b.length) ?? 0; + if (socketsInUse >= maxSockets && requestsEnqueued >= 2 * maxSockets) { + (_c = logger == null ? void 0 : logger.warn) == null ? void 0 : _c.call( + logger, + `@smithy/node-http-handler:WARN - socket usage at capacity=${socketsInUse} and ${requestsEnqueued} additional requests are enqueued. +See https://docs.aws.amazon.com/sdk-for-javascript/v3/developer-guide/node-configuring-maxsockets.html +or increase socketAcquisitionWarningTimeout=(millis) in the NodeHttpHandler config.` + ); + return Date.now(); + } + } + } + return socketWarningTimestamp; } - return expectByte(value); - }, "strictParseByte"); - var stackTraceWarning = /* @__PURE__ */ __name((message) => { - return String(new TypeError(message).stack || message).split("\n").slice(0, 5).filter((s) => !s.includes("stackTraceWarning")).join("\n"); - }, "stackTraceWarning"); - var logger = { - warn: console.warn - }; - var DAYS = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"]; - var MONTHS = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]; - function dateToUtcString(date) { - const year = date.getUTCFullYear(); - const month = date.getUTCMonth(); - const dayOfWeek = date.getUTCDay(); - const dayOfMonthInt = date.getUTCDate(); - const hoursInt = date.getUTCHours(); - const minutesInt = date.getUTCMinutes(); - const secondsInt = date.getUTCSeconds(); - const dayOfMonthString = dayOfMonthInt < 10 ? `0${dayOfMonthInt}` : `${dayOfMonthInt}`; - const hoursString = hoursInt < 10 ? `0${hoursInt}` : `${hoursInt}`; - const minutesString = minutesInt < 10 ? `0${minutesInt}` : `${minutesInt}`; - const secondsString = secondsInt < 10 ? `0${secondsInt}` : `${secondsInt}`; - return `${DAYS[dayOfWeek]}, ${dayOfMonthString} ${MONTHS[month]} ${year} ${hoursString}:${minutesString}:${secondsString} GMT`; - } - __name(dateToUtcString, "dateToUtcString"); - var RFC3339 = new RegExp(/^(\d{4})-(\d{2})-(\d{2})[tT](\d{2}):(\d{2}):(\d{2})(?:\.(\d+))?[zZ]$/); - var parseRfc3339DateTime = /* @__PURE__ */ __name((value) => { - if (value === null || value === void 0) { - return void 0; + resolveDefaultConfig(options) { + const { requestTimeout, connectionTimeout, socketTimeout, httpAgent, httpsAgent } = options || {}; + const keepAlive = true; + const maxSockets = 50; + return { + connectionTimeout, + requestTimeout: requestTimeout ?? socketTimeout, + httpAgent: (() => { + if (httpAgent instanceof import_http2.Agent || typeof (httpAgent == null ? void 0 : httpAgent.destroy) === "function") { + return httpAgent; + } + return new import_http2.Agent({ keepAlive, maxSockets, ...httpAgent }); + })(), + httpsAgent: (() => { + if (httpsAgent instanceof import_https.Agent || typeof (httpsAgent == null ? void 0 : httpsAgent.destroy) === "function") { + return httpsAgent; + } + return new import_https.Agent({ keepAlive, maxSockets, ...httpsAgent }); + })(), + logger: console + }; } - if (typeof value !== "string") { - throw new TypeError("RFC-3339 date-times must be expressed as strings"); + destroy() { + var _a, _b, _c, _d; + (_b = (_a = this.config) == null ? void 0 : _a.httpAgent) == null ? void 0 : _b.destroy(); + (_d = (_c = this.config) == null ? void 0 : _c.httpsAgent) == null ? void 0 : _d.destroy(); } - const match = RFC3339.exec(value); - if (!match) { - throw new TypeError("Invalid RFC-3339 date-time value"); + async handle(request2, { abortSignal } = {}) { + if (!this.config) { + this.config = await this.configProvider; + } + return new Promise((_resolve, _reject) => { + let writeRequestBodyPromise = void 0; + const timeouts = []; + const resolve = /* @__PURE__ */ __name(async (arg) => { + await writeRequestBodyPromise; + timeouts.forEach(clearTimeout); + _resolve(arg); + }, "resolve"); + const reject = /* @__PURE__ */ __name(async (arg) => { + await writeRequestBodyPromise; + timeouts.forEach(clearTimeout); + _reject(arg); + }, "reject"); + if (!this.config) { + throw new Error("Node HTTP request handler config is not resolved"); + } + if (abortSignal == null ? void 0 : abortSignal.aborted) { + const abortError = new Error("Request aborted"); + abortError.name = "AbortError"; + reject(abortError); + return; + } + const isSSL = request2.protocol === "https:"; + const agent = isSSL ? this.config.httpsAgent : this.config.httpAgent; + timeouts.push( + setTimeout( + () => { + this.socketWarningTimestamp = _NodeHttpHandler2.checkSocketUsage( + agent, + this.socketWarningTimestamp, + this.config.logger + ); + }, + this.config.socketAcquisitionWarningTimeout ?? (this.config.requestTimeout ?? 2e3) + (this.config.connectionTimeout ?? 1e3) + ) + ); + const queryString = (0, import_querystring_builder.buildQueryString)(request2.query || {}); + let auth = void 0; + if (request2.username != null || request2.password != null) { + const username = request2.username ?? ""; + const password = request2.password ?? ""; + auth = `${username}:${password}`; + } + let path = request2.path; + if (queryString) { + path += `?${queryString}`; + } + if (request2.fragment) { + path += `#${request2.fragment}`; + } + let hostname = request2.hostname ?? ""; + if (hostname[0] === "[" && hostname.endsWith("]")) { + hostname = request2.hostname.slice(1, -1); + } else { + hostname = request2.hostname; + } + const nodeHttpsOptions = { + headers: request2.headers, + host: hostname, + method: request2.method, + path, + port: request2.port, + agent, + auth + }; + const requestFunc = isSSL ? import_https.request : import_http2.request; + const req = requestFunc(nodeHttpsOptions, (res) => { + const httpResponse = new import_protocol_http8.HttpResponse({ + statusCode: res.statusCode || -1, + reason: res.statusMessage, + headers: getTransformedHeaders(res.headers), + body: res + }); + resolve({ response: httpResponse }); + }); + req.on("error", (err) => { + if (NODEJS_TIMEOUT_ERROR_CODES.includes(err.code)) { + reject(Object.assign(err, { name: "TimeoutError" })); + } else { + reject(err); + } + }); + if (abortSignal) { + const onAbort = /* @__PURE__ */ __name(() => { + req.destroy(); + const abortError = new Error("Request aborted"); + abortError.name = "AbortError"; + reject(abortError); + }, "onAbort"); + if (typeof abortSignal.addEventListener === "function") { + const signal = abortSignal; + signal.addEventListener("abort", onAbort, { once: true }); + req.once("close", () => signal.removeEventListener("abort", onAbort)); + } else { + abortSignal.onabort = onAbort; + } + } + timeouts.push(setConnectionTimeout(req, reject, this.config.connectionTimeout)); + timeouts.push(setSocketTimeout(req, reject, this.config.requestTimeout)); + const httpAgent = nodeHttpsOptions.agent; + if (typeof httpAgent === "object" && "keepAlive" in httpAgent) { + timeouts.push( + setSocketKeepAlive(req, { + // @ts-expect-error keepAlive is not public on httpAgent. + keepAlive: httpAgent.keepAlive, + // @ts-expect-error keepAliveMsecs is not public on httpAgent. + keepAliveMsecs: httpAgent.keepAliveMsecs + }) + ); + } + writeRequestBodyPromise = writeRequestBody(req, request2, this.config.requestTimeout).catch((e) => { + timeouts.forEach(clearTimeout); + return _reject(e); + }); + }); } - const [_, yearStr, monthStr, dayStr, hours, minutes, seconds, fractionalMilliseconds] = match; - const year = strictParseShort(stripLeadingZeroes(yearStr)); - const month = parseDateValue(monthStr, "month", 1, 12); - const day = parseDateValue(dayStr, "day", 1, 31); - return buildDate(year, month, day, { hours, minutes, seconds, fractionalMilliseconds }); - }, "parseRfc3339DateTime"); - var RFC3339_WITH_OFFSET = new RegExp( - /^(\d{4})-(\d{2})-(\d{2})[tT](\d{2}):(\d{2}):(\d{2})(?:\.(\d+))?(([-+]\d{2}\:\d{2})|[zZ])$/ - ); - var parseRfc3339DateTimeWithOffset = /* @__PURE__ */ __name((value) => { - if (value === null || value === void 0) { - return void 0; + updateHttpClientConfig(key, value) { + this.config = void 0; + this.configProvider = this.configProvider.then((config) => { + return { + ...config, + [key]: value + }; + }); } - if (typeof value !== "string") { - throw new TypeError("RFC-3339 date-times must be expressed as strings"); + httpHandlerConfigs() { + return this.config ?? {}; } - const match = RFC3339_WITH_OFFSET.exec(value); - if (!match) { - throw new TypeError("Invalid RFC-3339 date-time value"); + }; + __name(_NodeHttpHandler, "NodeHttpHandler"); + var NodeHttpHandler = _NodeHttpHandler; + var import_http22 = require("http2"); + var import_http23 = __toESM2(require("http2")); + var _NodeHttp2ConnectionPool = class _NodeHttp2ConnectionPool { + constructor(sessions) { + this.sessions = []; + this.sessions = sessions ?? []; } - const [_, yearStr, monthStr, dayStr, hours, minutes, seconds, fractionalMilliseconds, offsetStr] = match; - const year = strictParseShort(stripLeadingZeroes(yearStr)); - const month = parseDateValue(monthStr, "month", 1, 12); - const day = parseDateValue(dayStr, "day", 1, 31); - const date = buildDate(year, month, day, { hours, minutes, seconds, fractionalMilliseconds }); - if (offsetStr.toUpperCase() != "Z") { - date.setTime(date.getTime() - parseOffsetToMilliseconds(offsetStr)); + poll() { + if (this.sessions.length > 0) { + return this.sessions.shift(); + } } - return date; - }, "parseRfc3339DateTimeWithOffset"); - var IMF_FIXDATE = new RegExp( - /^(?:Mon|Tue|Wed|Thu|Fri|Sat|Sun), (\d{2}) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) (\d{4}) (\d{1,2}):(\d{2}):(\d{2})(?:\.(\d+))? GMT$/ - ); - var RFC_850_DATE = new RegExp( - /^(?:Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday), (\d{2})-(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)-(\d{2}) (\d{1,2}):(\d{2}):(\d{2})(?:\.(\d+))? GMT$/ - ); - var ASC_TIME = new RegExp( - /^(?:Mon|Tue|Wed|Thu|Fri|Sat|Sun) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) ( [1-9]|\d{2}) (\d{1,2}):(\d{2}):(\d{2})(?:\.(\d+))? (\d{4})$/ - ); - var parseRfc7231DateTime = /* @__PURE__ */ __name((value) => { - if (value === null || value === void 0) { - return void 0; + offerLast(session) { + this.sessions.push(session); } - if (typeof value !== "string") { - throw new TypeError("RFC-7231 date-times must be expressed as strings"); + contains(session) { + return this.sessions.includes(session); } - let match = IMF_FIXDATE.exec(value); - if (match) { - const [_, dayStr, monthStr, yearStr, hours, minutes, seconds, fractionalMilliseconds] = match; - return buildDate( - strictParseShort(stripLeadingZeroes(yearStr)), - parseMonthByShortName(monthStr), - parseDateValue(dayStr, "day", 1, 31), - { hours, minutes, seconds, fractionalMilliseconds } - ); + remove(session) { + this.sessions = this.sessions.filter((s) => s !== session); } - match = RFC_850_DATE.exec(value); - if (match) { - const [_, dayStr, monthStr, yearStr, hours, minutes, seconds, fractionalMilliseconds] = match; - return adjustRfc850Year( - buildDate(parseTwoDigitYear(yearStr), parseMonthByShortName(monthStr), parseDateValue(dayStr, "day", 1, 31), { - hours, - minutes, - seconds, - fractionalMilliseconds - }) - ); + [Symbol.iterator]() { + return this.sessions[Symbol.iterator](); } - match = ASC_TIME.exec(value); - if (match) { - const [_, monthStr, dayStr, hours, minutes, seconds, fractionalMilliseconds, yearStr] = match; - return buildDate( - strictParseShort(stripLeadingZeroes(yearStr)), - parseMonthByShortName(monthStr), - parseDateValue(dayStr.trimLeft(), "day", 1, 31), - { hours, minutes, seconds, fractionalMilliseconds } - ); + destroy(connection) { + for (const session of this.sessions) { + if (session === connection) { + if (!session.destroyed) { + session.destroy(); + } + } + } } - throw new TypeError("Invalid RFC-7231 date-time value"); - }, "parseRfc7231DateTime"); - var parseEpochTimestamp = /* @__PURE__ */ __name((value) => { - if (value === null || value === void 0) { - return void 0; + }; + __name(_NodeHttp2ConnectionPool, "NodeHttp2ConnectionPool"); + var NodeHttp2ConnectionPool = _NodeHttp2ConnectionPool; + var _NodeHttp2ConnectionManager = class _NodeHttp2ConnectionManager { + constructor(config) { + this.sessionCache = /* @__PURE__ */ new Map(); + this.config = config; + if (this.config.maxConcurrency && this.config.maxConcurrency <= 0) { + throw new RangeError("maxConcurrency must be greater than zero."); + } } - let valueAsDouble; - if (typeof value === "number") { - valueAsDouble = value; - } else if (typeof value === "string") { - valueAsDouble = strictParseDouble(value); - } else { - throw new TypeError("Epoch timestamps must be expressed as floating point numbers or their string representation"); + lease(requestContext, connectionConfiguration) { + const url2 = this.getUrlString(requestContext); + const existingPool = this.sessionCache.get(url2); + if (existingPool) { + const existingSession = existingPool.poll(); + if (existingSession && !this.config.disableConcurrency) { + return existingSession; + } + } + const session = import_http23.default.connect(url2); + if (this.config.maxConcurrency) { + session.settings({ maxConcurrentStreams: this.config.maxConcurrency }, (err) => { + if (err) { + throw new Error( + "Fail to set maxConcurrentStreams to " + this.config.maxConcurrency + "when creating new session for " + requestContext.destination.toString() + ); + } + }); + } + session.unref(); + const destroySessionCb = /* @__PURE__ */ __name(() => { + session.destroy(); + this.deleteSession(url2, session); + }, "destroySessionCb"); + session.on("goaway", destroySessionCb); + session.on("error", destroySessionCb); + session.on("frameError", destroySessionCb); + session.on("close", () => this.deleteSession(url2, session)); + if (connectionConfiguration.requestTimeout) { + session.setTimeout(connectionConfiguration.requestTimeout, destroySessionCb); + } + const connectionPool = this.sessionCache.get(url2) || new NodeHttp2ConnectionPool(); + connectionPool.offerLast(session); + this.sessionCache.set(url2, connectionPool); + return session; } - if (Number.isNaN(valueAsDouble) || valueAsDouble === Infinity || valueAsDouble === -Infinity) { - throw new TypeError("Epoch timestamps must be valid, non-Infinite, non-NaN numerics"); + /** + * Delete a session from the connection pool. + * @param authority The authority of the session to delete. + * @param session The session to delete. + */ + deleteSession(authority, session) { + const existingConnectionPool = this.sessionCache.get(authority); + if (!existingConnectionPool) { + return; + } + if (!existingConnectionPool.contains(session)) { + return; + } + existingConnectionPool.remove(session); + this.sessionCache.set(authority, existingConnectionPool); } - return new Date(Math.round(valueAsDouble * 1e3)); - }, "parseEpochTimestamp"); - var buildDate = /* @__PURE__ */ __name((year, month, day, time) => { - const adjustedMonth = month - 1; - validateDayOfMonth(year, adjustedMonth, day); - return new Date( - Date.UTC( - year, - adjustedMonth, - day, - parseDateValue(time.hours, "hour", 0, 23), - parseDateValue(time.minutes, "minute", 0, 59), - // seconds can go up to 60 for leap seconds - parseDateValue(time.seconds, "seconds", 0, 60), - parseMilliseconds(time.fractionalMilliseconds) - ) - ); - }, "buildDate"); - var parseTwoDigitYear = /* @__PURE__ */ __name((value) => { - const thisYear = (/* @__PURE__ */ new Date()).getUTCFullYear(); - const valueInThisCentury = Math.floor(thisYear / 100) * 100 + strictParseShort(stripLeadingZeroes(value)); - if (valueInThisCentury < thisYear) { - return valueInThisCentury + 100; + release(requestContext, session) { + var _a; + const cacheKey = this.getUrlString(requestContext); + (_a = this.sessionCache.get(cacheKey)) == null ? void 0 : _a.offerLast(session); } - return valueInThisCentury; - }, "parseTwoDigitYear"); - var FIFTY_YEARS_IN_MILLIS = 50 * 365 * 24 * 60 * 60 * 1e3; - var adjustRfc850Year = /* @__PURE__ */ __name((input) => { - if (input.getTime() - (/* @__PURE__ */ new Date()).getTime() > FIFTY_YEARS_IN_MILLIS) { - return new Date( - Date.UTC( - input.getUTCFullYear() - 100, - input.getUTCMonth(), - input.getUTCDate(), - input.getUTCHours(), - input.getUTCMinutes(), - input.getUTCSeconds(), - input.getUTCMilliseconds() - ) - ); + destroy() { + for (const [key, connectionPool] of this.sessionCache) { + for (const session of connectionPool) { + if (!session.destroyed) { + session.destroy(); + } + connectionPool.remove(session); + } + this.sessionCache.delete(key); + } } - return input; - }, "adjustRfc850Year"); - var parseMonthByShortName = /* @__PURE__ */ __name((value) => { - const monthIdx = MONTHS.indexOf(value); - if (monthIdx < 0) { - throw new TypeError(`Invalid month: ${value}`); + setMaxConcurrentStreams(maxConcurrentStreams) { + if (this.config.maxConcurrency && this.config.maxConcurrency <= 0) { + throw new RangeError("maxConcurrentStreams must be greater than zero."); + } + this.config.maxConcurrency = maxConcurrentStreams; } - return monthIdx + 1; - }, "parseMonthByShortName"); - var DAYS_IN_MONTH = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]; - var validateDayOfMonth = /* @__PURE__ */ __name((year, month, day) => { - let maxDays = DAYS_IN_MONTH[month]; - if (month === 1 && isLeapYear(year)) { - maxDays = 29; + setDisableConcurrentStreams(disableConcurrentStreams) { + this.config.disableConcurrency = disableConcurrentStreams; } - if (day > maxDays) { - throw new TypeError(`Invalid day for ${MONTHS[month]} in ${year}: ${day}`); + getUrlString(request2) { + return request2.destination.toString(); } - }, "validateDayOfMonth"); - var isLeapYear = /* @__PURE__ */ __name((year) => { - return year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0); - }, "isLeapYear"); - var parseDateValue = /* @__PURE__ */ __name((value, type, lower, upper) => { - const dateVal = strictParseByte(stripLeadingZeroes(value)); - if (dateVal < lower || dateVal > upper) { - throw new TypeError(`${type} must be between ${lower} and ${upper}, inclusive`); + }; + __name(_NodeHttp2ConnectionManager, "NodeHttp2ConnectionManager"); + var NodeHttp2ConnectionManager = _NodeHttp2ConnectionManager; + var _NodeHttp2Handler = class _NodeHttp2Handler2 { + constructor(options) { + this.metadata = { handlerProtocol: "h2" }; + this.connectionManager = new NodeHttp2ConnectionManager({}); + this.configProvider = new Promise((resolve, reject) => { + if (typeof options === "function") { + options().then((opts) => { + resolve(opts || {}); + }).catch(reject); + } else { + resolve(options || {}); + } + }); } - return dateVal; - }, "parseDateValue"); - var parseMilliseconds = /* @__PURE__ */ __name((value) => { - if (value === null || value === void 0) { - return 0; + /** + * @returns the input if it is an HttpHandler of any class, + * or instantiates a new instance of this handler. + */ + static create(instanceOrOptions) { + if (typeof (instanceOrOptions == null ? void 0 : instanceOrOptions.handle) === "function") { + return instanceOrOptions; + } + return new _NodeHttp2Handler2(instanceOrOptions); } - return strictParseFloat32("0." + value) * 1e3; - }, "parseMilliseconds"); - var parseOffsetToMilliseconds = /* @__PURE__ */ __name((value) => { - const directionStr = value[0]; - let direction = 1; - if (directionStr == "+") { - direction = 1; - } else if (directionStr == "-") { - direction = -1; - } else { - throw new TypeError(`Offset direction, ${directionStr}, must be "+" or "-"`); + destroy() { + this.connectionManager.destroy(); + } + async handle(request2, { abortSignal } = {}) { + if (!this.config) { + this.config = await this.configProvider; + this.connectionManager.setDisableConcurrentStreams(this.config.disableConcurrentStreams || false); + if (this.config.maxConcurrentStreams) { + this.connectionManager.setMaxConcurrentStreams(this.config.maxConcurrentStreams); + } + } + const { requestTimeout, disableConcurrentStreams } = this.config; + return new Promise((_resolve, _reject) => { + var _a; + let fulfilled = false; + let writeRequestBodyPromise = void 0; + const resolve = /* @__PURE__ */ __name(async (arg) => { + await writeRequestBodyPromise; + _resolve(arg); + }, "resolve"); + const reject = /* @__PURE__ */ __name(async (arg) => { + await writeRequestBodyPromise; + _reject(arg); + }, "reject"); + if (abortSignal == null ? void 0 : abortSignal.aborted) { + fulfilled = true; + const abortError = new Error("Request aborted"); + abortError.name = "AbortError"; + reject(abortError); + return; + } + const { hostname, method, port, protocol, query } = request2; + let auth = ""; + if (request2.username != null || request2.password != null) { + const username = request2.username ?? ""; + const password = request2.password ?? ""; + auth = `${username}:${password}@`; + } + const authority = `${protocol}//${auth}${hostname}${port ? `:${port}` : ""}`; + const requestContext = { destination: new URL(authority) }; + const session = this.connectionManager.lease(requestContext, { + requestTimeout: (_a = this.config) == null ? void 0 : _a.sessionTimeout, + disableConcurrentStreams: disableConcurrentStreams || false + }); + const rejectWithDestroy = /* @__PURE__ */ __name((err) => { + if (disableConcurrentStreams) { + this.destroySession(session); + } + fulfilled = true; + reject(err); + }, "rejectWithDestroy"); + const queryString = (0, import_querystring_builder.buildQueryString)(query || {}); + let path = request2.path; + if (queryString) { + path += `?${queryString}`; + } + if (request2.fragment) { + path += `#${request2.fragment}`; + } + const req = session.request({ + ...request2.headers, + [import_http22.constants.HTTP2_HEADER_PATH]: path, + [import_http22.constants.HTTP2_HEADER_METHOD]: method + }); + session.ref(); + req.on("response", (headers) => { + const httpResponse = new import_protocol_http8.HttpResponse({ + statusCode: headers[":status"] || -1, + headers: getTransformedHeaders(headers), + body: req + }); + fulfilled = true; + resolve({ response: httpResponse }); + if (disableConcurrentStreams) { + session.close(); + this.connectionManager.deleteSession(authority, session); + } + }); + if (requestTimeout) { + req.setTimeout(requestTimeout, () => { + req.close(); + const timeoutError = new Error(`Stream timed out because of no activity for ${requestTimeout} ms`); + timeoutError.name = "TimeoutError"; + rejectWithDestroy(timeoutError); + }); + } + if (abortSignal) { + const onAbort = /* @__PURE__ */ __name(() => { + req.close(); + const abortError = new Error("Request aborted"); + abortError.name = "AbortError"; + rejectWithDestroy(abortError); + }, "onAbort"); + if (typeof abortSignal.addEventListener === "function") { + const signal = abortSignal; + signal.addEventListener("abort", onAbort, { once: true }); + req.once("close", () => signal.removeEventListener("abort", onAbort)); + } else { + abortSignal.onabort = onAbort; + } + } + req.on("frameError", (type, code, id) => { + rejectWithDestroy(new Error(`Frame type id ${type} in stream id ${id} has failed with code ${code}.`)); + }); + req.on("error", rejectWithDestroy); + req.on("aborted", () => { + rejectWithDestroy( + new Error(`HTTP/2 stream is abnormally aborted in mid-communication with result code ${req.rstCode}.`) + ); + }); + req.on("close", () => { + session.unref(); + if (disableConcurrentStreams) { + session.destroy(); + } + if (!fulfilled) { + rejectWithDestroy(new Error("Unexpected error: http2 request did not get a response")); + } + }); + writeRequestBodyPromise = writeRequestBody(req, request2, requestTimeout); + }); } - const hour = Number(value.substring(1, 3)); - const minute = Number(value.substring(4, 6)); - return direction * (hour * 60 + minute) * 60 * 1e3; - }, "parseOffsetToMilliseconds"); - var stripLeadingZeroes = /* @__PURE__ */ __name((value) => { - let idx = 0; - while (idx < value.length - 1 && value.charAt(idx) === "0") { - idx++; + updateHttpClientConfig(key, value) { + this.config = void 0; + this.configProvider = this.configProvider.then((config) => { + return { + ...config, + [key]: value + }; + }); } - if (idx === 0) { - return value; + httpHandlerConfigs() { + return this.config ?? {}; } - return value.slice(idx); - }, "stripLeadingZeroes"); - var _ServiceException = class _ServiceException2 extends Error { - constructor(options) { - super(options.message); - Object.setPrototypeOf(this, _ServiceException2.prototype); - this.name = options.name; - this.$fault = options.$fault; - this.$metadata = options.$metadata; + /** + * Destroys a session. + * @param session The session to destroy. + */ + destroySession(session) { + if (!session.destroyed) { + session.destroy(); + } } }; - __name(_ServiceException, "ServiceException"); - var ServiceException = _ServiceException; - var decorateServiceException = /* @__PURE__ */ __name((exception, additions = {}) => { - Object.entries(additions).filter(([, v]) => v !== void 0).forEach(([k, v]) => { - if (exception[k] == void 0 || exception[k] === "") { - exception[k] = v; - } - }); - const message = exception.message || exception.Message || "UnknownError"; - exception.message = message; - delete exception.Message; - return exception; - }, "decorateServiceException"); - var throwDefaultError = /* @__PURE__ */ __name(({ output, parsedBody, exceptionCtor, errorCode }) => { - const $metadata = deserializeMetadata(output); - const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : void 0; - const response = new exceptionCtor({ - name: (parsedBody == null ? void 0 : parsedBody.code) || (parsedBody == null ? void 0 : parsedBody.Code) || errorCode || statusCode || "UnknownError", - $fault: "client", - $metadata - }); - throw decorateServiceException(response, parsedBody); - }, "throwDefaultError"); - var withBaseException = /* @__PURE__ */ __name((ExceptionCtor) => { - return ({ output, parsedBody, errorCode }) => { - throwDefaultError({ output, parsedBody, exceptionCtor: ExceptionCtor, errorCode }); - }; - }, "withBaseException"); - var deserializeMetadata = /* @__PURE__ */ __name((output) => ({ - httpStatusCode: output.statusCode, - requestId: output.headers["x-amzn-requestid"] ?? output.headers["x-amzn-request-id"] ?? output.headers["x-amz-request-id"], - extendedRequestId: output.headers["x-amz-id-2"], - cfId: output.headers["x-amz-cf-id"] - }), "deserializeMetadata"); - var loadConfigsForDefaultMode = /* @__PURE__ */ __name((mode) => { - switch (mode) { - case "standard": - return { - retryMode: "standard", - connectionTimeout: 3100 - }; - case "in-region": - return { - retryMode: "standard", - connectionTimeout: 1100 - }; - case "cross-region": - return { - retryMode: "standard", - connectionTimeout: 3100 - }; - case "mobile": - return { - retryMode: "standard", - connectionTimeout: 3e4 - }; - default: - return {}; + __name(_NodeHttp2Handler, "NodeHttp2Handler"); + var NodeHttp2Handler = _NodeHttp2Handler; + var _Collector = class _Collector extends import_stream.Writable { + constructor() { + super(...arguments); + this.bufferedBytes = []; } - }, "loadConfigsForDefaultMode"); - var warningEmitted = false; - var emitWarningIfUnsupportedVersion = /* @__PURE__ */ __name((version2) => { - if (version2 && !warningEmitted && parseInt(version2.substring(1, version2.indexOf("."))) < 14) { - warningEmitted = true; + _write(chunk, encoding, callback) { + this.bufferedBytes.push(chunk); + callback(); } - }, "emitWarningIfUnsupportedVersion"); - var getChecksumConfiguration = /* @__PURE__ */ __name((runtimeConfig) => { - const checksumAlgorithms = []; - for (const id in import_types.AlgorithmId) { - const algorithmId = import_types.AlgorithmId[id]; - if (runtimeConfig[algorithmId] === void 0) { - continue; - } - checksumAlgorithms.push({ - algorithmId: () => algorithmId, - checksumConstructor: () => runtimeConfig[algorithmId] - }); + }; + __name(_Collector, "Collector"); + var Collector = _Collector; + var streamCollector = /* @__PURE__ */ __name((stream) => { + if (isReadableStreamInstance(stream)) { + return collectReadableStream(stream); } - return { - _checksumAlgorithms: checksumAlgorithms, - addChecksumAlgorithm(algo) { - this._checksumAlgorithms.push(algo); - }, - checksumAlgorithms() { - return this._checksumAlgorithms; - } - }; - }, "getChecksumConfiguration"); - var resolveChecksumRuntimeConfig = /* @__PURE__ */ __name((clientConfig) => { - const runtimeConfig = {}; - clientConfig.checksumAlgorithms().forEach((checksumAlgorithm) => { - runtimeConfig[checksumAlgorithm.algorithmId()] = checksumAlgorithm.checksumConstructor(); + return new Promise((resolve, reject) => { + const collector = new Collector(); + stream.pipe(collector); + stream.on("error", (err) => { + collector.end(); + reject(err); + }); + collector.on("error", reject); + collector.on("finish", function() { + const bytes = new Uint8Array(Buffer.concat(this.bufferedBytes)); + resolve(bytes); + }); }); - return runtimeConfig; - }, "resolveChecksumRuntimeConfig"); - var getRetryConfiguration = /* @__PURE__ */ __name((runtimeConfig) => { - let _retryStrategy = runtimeConfig.retryStrategy; - return { - setRetryStrategy(retryStrategy) { - _retryStrategy = retryStrategy; - }, - retryStrategy() { - return _retryStrategy; + }, "streamCollector"); + var isReadableStreamInstance = /* @__PURE__ */ __name((stream) => typeof ReadableStream === "function" && stream instanceof ReadableStream, "isReadableStreamInstance"); + async function collectReadableStream(stream) { + const chunks = []; + const reader = stream.getReader(); + let isDone = false; + let length = 0; + while (!isDone) { + const { done, value } = await reader.read(); + if (value) { + chunks.push(value); + length += value.length; + } + isDone = done; + } + const collected = new Uint8Array(length); + let offset = 0; + for (const chunk of chunks) { + collected.set(chunk, offset); + offset += chunk.length; + } + return collected; + } + __name(collectReadableStream, "collectReadableStream"); + } +}); + +// ../../../node_modules/@smithy/smithy-client/node_modules/@smithy/fetch-http-handler/dist-cjs/index.js +var require_dist_cjs34 = __commonJS({ + "../../../node_modules/@smithy/smithy-client/node_modules/@smithy/fetch-http-handler/dist-cjs/index.js"(exports2, module2) { + var __defProp2 = Object.defineProperty; + var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; + var __getOwnPropNames2 = Object.getOwnPropertyNames; + var __hasOwnProp2 = Object.prototype.hasOwnProperty; + var __name = (target, value) => __defProp2(target, "name", { value, configurable: true }); + var __export2 = (target, all) => { + for (var name in all) + __defProp2(target, name, { get: all[name], enumerable: true }); + }; + var __copyProps2 = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames2(from)) + if (!__hasOwnProp2.call(to, key) && key !== except) + __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable }); + } + return to; + }; + var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); + var src_exports = {}; + __export2(src_exports, { + FetchHttpHandler: () => FetchHttpHandler, + keepAliveSupport: () => keepAliveSupport, + streamCollector: () => streamCollector + }); + module2.exports = __toCommonJS2(src_exports); + var import_protocol_http8 = require_dist_cjs30(); + var import_querystring_builder = require_dist_cjs32(); + function requestTimeout(timeoutInMs = 0) { + return new Promise((resolve, reject) => { + if (timeoutInMs) { + setTimeout(() => { + const timeoutError = new Error(`Request did not complete within ${timeoutInMs} ms`); + timeoutError.name = "TimeoutError"; + reject(timeoutError); + }, timeoutInMs); } - }; - }, "getRetryConfiguration"); - var resolveRetryRuntimeConfig = /* @__PURE__ */ __name((retryStrategyConfiguration) => { - const runtimeConfig = {}; - runtimeConfig.retryStrategy = retryStrategyConfiguration.retryStrategy(); - return runtimeConfig; - }, "resolveRetryRuntimeConfig"); - var getDefaultExtensionConfiguration = /* @__PURE__ */ __name((runtimeConfig) => { - return { - ...getChecksumConfiguration(runtimeConfig), - ...getRetryConfiguration(runtimeConfig) - }; - }, "getDefaultExtensionConfiguration"); - var getDefaultClientConfiguration = getDefaultExtensionConfiguration; - var resolveDefaultRuntimeConfig = /* @__PURE__ */ __name((config) => { - return { - ...resolveChecksumRuntimeConfig(config), - ...resolveRetryRuntimeConfig(config) - }; - }, "resolveDefaultRuntimeConfig"); - function extendedEncodeURIComponent(str) { - return encodeURIComponent(str).replace(/[!'()*]/g, function(c) { - return "%" + c.charCodeAt(0).toString(16).toUpperCase(); }); } - __name(extendedEncodeURIComponent, "extendedEncodeURIComponent"); - var getArrayIfSingleItem = /* @__PURE__ */ __name((mayBeArray) => Array.isArray(mayBeArray) ? mayBeArray : [mayBeArray], "getArrayIfSingleItem"); - var getValueFromTextNode = /* @__PURE__ */ __name((obj) => { - const textNodeName = "#text"; - for (const key in obj) { - if (obj.hasOwnProperty(key) && obj[key][textNodeName] !== void 0) { - obj[key] = obj[key][textNodeName]; - } else if (typeof obj[key] === "object" && obj[key] !== null) { - obj[key] = getValueFromTextNode(obj[key]); + __name(requestTimeout, "requestTimeout"); + var keepAliveSupport = { + supported: void 0 + }; + var _FetchHttpHandler = class _FetchHttpHandler2 { + /** + * @returns the input if it is an HttpHandler of any class, + * or instantiates a new instance of this handler. + */ + static create(instanceOrOptions) { + if (typeof (instanceOrOptions == null ? void 0 : instanceOrOptions.handle) === "function") { + return instanceOrOptions; } + return new _FetchHttpHandler2(instanceOrOptions); } - return obj; - }, "getValueFromTextNode"); - var StringWrapper = /* @__PURE__ */ __name(function() { - const Class = Object.getPrototypeOf(this).constructor; - const Constructor = Function.bind.apply(String, [null, ...arguments]); - const instance = new Constructor(); - Object.setPrototypeOf(instance, Class.prototype); - return instance; - }, "StringWrapper"); - StringWrapper.prototype = Object.create(String.prototype, { - constructor: { - value: StringWrapper, - enumerable: false, - writable: true, - configurable: true + constructor(options) { + if (typeof options === "function") { + this.configProvider = options().then((opts) => opts || {}); + } else { + this.config = options ?? {}; + this.configProvider = Promise.resolve(this.config); + } + if (keepAliveSupport.supported === void 0) { + keepAliveSupport.supported = Boolean( + typeof Request !== "undefined" && "keepalive" in new Request("https://[::1]") + ); + } + } + destroy() { + } + async handle(request2, { abortSignal } = {}) { + var _a; + if (!this.config) { + this.config = await this.configProvider; + } + const requestTimeoutInMs = this.config.requestTimeout; + const keepAlive = this.config.keepAlive === true; + const credentials = this.config.credentials; + if (abortSignal == null ? void 0 : abortSignal.aborted) { + const abortError = new Error("Request aborted"); + abortError.name = "AbortError"; + return Promise.reject(abortError); + } + let path = request2.path; + const queryString = (0, import_querystring_builder.buildQueryString)(request2.query || {}); + if (queryString) { + path += `?${queryString}`; + } + if (request2.fragment) { + path += `#${request2.fragment}`; + } + let auth = ""; + if (request2.username != null || request2.password != null) { + const username = request2.username ?? ""; + const password = request2.password ?? ""; + auth = `${username}:${password}@`; + } + const { port, method } = request2; + const url2 = `${request2.protocol}//${auth}${request2.hostname}${port ? `:${port}` : ""}${path}`; + const body = method === "GET" || method === "HEAD" ? void 0 : request2.body; + const requestOptions = { + body, + headers: new Headers(request2.headers), + method, + credentials + }; + if ((_a = this.config) == null ? void 0 : _a.cache) { + requestOptions.cache = this.config.cache; + } + if (body) { + requestOptions.duplex = "half"; + } + if (typeof AbortController !== "undefined") { + requestOptions.signal = abortSignal; + } + if (keepAliveSupport.supported) { + requestOptions.keepalive = keepAlive; + } + if (typeof this.config.requestInit === "function") { + Object.assign(requestOptions, this.config.requestInit(request2)); + } + let removeSignalEventListener = /* @__PURE__ */ __name(() => { + }, "removeSignalEventListener"); + const fetchRequest = new Request(url2, requestOptions); + const raceOfPromises = [ + fetch(fetchRequest).then((response) => { + const fetchHeaders = response.headers; + const transformedHeaders = {}; + for (const pair of fetchHeaders.entries()) { + transformedHeaders[pair[0]] = pair[1]; + } + const hasReadableStream = response.body != void 0; + if (!hasReadableStream) { + return response.blob().then((body2) => ({ + response: new import_protocol_http8.HttpResponse({ + headers: transformedHeaders, + reason: response.statusText, + statusCode: response.status, + body: body2 + }) + })); + } + return { + response: new import_protocol_http8.HttpResponse({ + headers: transformedHeaders, + reason: response.statusText, + statusCode: response.status, + body: response.body + }) + }; + }), + requestTimeout(requestTimeoutInMs) + ]; + if (abortSignal) { + raceOfPromises.push( + new Promise((resolve, reject) => { + const onAbort = /* @__PURE__ */ __name(() => { + const abortError = new Error("Request aborted"); + abortError.name = "AbortError"; + reject(abortError); + }, "onAbort"); + if (typeof abortSignal.addEventListener === "function") { + const signal = abortSignal; + signal.addEventListener("abort", onAbort, { once: true }); + removeSignalEventListener = /* @__PURE__ */ __name(() => signal.removeEventListener("abort", onAbort), "removeSignalEventListener"); + } else { + abortSignal.onabort = onAbort; + } + }) + ); + } + return Promise.race(raceOfPromises).finally(removeSignalEventListener); } - }); - Object.setPrototypeOf(StringWrapper, String); - var _LazyJsonString = class _LazyJsonString2 extends StringWrapper { - deserializeJSON() { - return JSON.parse(super.toString()); + updateHttpClientConfig(key, value) { + this.config = void 0; + this.configProvider = this.configProvider.then((config) => { + config[key] = value; + return config; + }); } - toJSON() { - return super.toString(); + httpHandlerConfigs() { + return this.config ?? {}; } - static fromObject(object) { - if (object instanceof _LazyJsonString2) { - return object; - } else if (object instanceof String || typeof object === "string") { - return new _LazyJsonString2(object); - } - return new _LazyJsonString2(JSON.stringify(object)); + }; + __name(_FetchHttpHandler, "FetchHttpHandler"); + var FetchHttpHandler = _FetchHttpHandler; + var import_util_base64 = require_dist_cjs29(); + var streamCollector = /* @__PURE__ */ __name((stream) => { + if (typeof Blob === "function" && stream instanceof Blob) { + return collectBlob(stream); } + return collectStream(stream); + }, "streamCollector"); + async function collectBlob(blob) { + const base64 = await readToBase64(blob); + const arrayBuffer = (0, import_util_base64.fromBase64)(base64); + return new Uint8Array(arrayBuffer); + } + __name(collectBlob, "collectBlob"); + async function collectStream(stream) { + const chunks = []; + const reader = stream.getReader(); + let isDone = false; + let length = 0; + while (!isDone) { + const { done, value } = await reader.read(); + if (value) { + chunks.push(value); + length += value.length; + } + isDone = done; + } + const collected = new Uint8Array(length); + let offset = 0; + for (const chunk of chunks) { + collected.set(chunk, offset); + offset += chunk.length; + } + return collected; + } + __name(collectStream, "collectStream"); + function readToBase64(blob) { + return new Promise((resolve, reject) => { + const reader = new FileReader(); + reader.onloadend = () => { + if (reader.readyState !== 2) { + return reject(new Error("Reader aborted too early")); + } + const result = reader.result ?? ""; + const commaIndex = result.indexOf(","); + const dataOffset = commaIndex > -1 ? commaIndex + 1 : result.length; + resolve(result.substring(dataOffset)); + }; + reader.onabort = () => reject(new Error("Read aborted")); + reader.onerror = () => reject(reader.error); + reader.readAsDataURL(blob); + }); + } + __name(readToBase64, "readToBase64"); + } +}); + +// ../../../node_modules/@smithy/util-hex-encoding/dist-cjs/index.js +var require_dist_cjs35 = __commonJS({ + "../../../node_modules/@smithy/util-hex-encoding/dist-cjs/index.js"(exports2, module2) { + var __defProp2 = Object.defineProperty; + var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; + var __getOwnPropNames2 = Object.getOwnPropertyNames; + var __hasOwnProp2 = Object.prototype.hasOwnProperty; + var __name = (target, value) => __defProp2(target, "name", { value, configurable: true }); + var __export2 = (target, all) => { + for (var name in all) + __defProp2(target, name, { get: all[name], enumerable: true }); }; - __name(_LazyJsonString, "LazyJsonString"); - var LazyJsonString = _LazyJsonString; - function map(arg0, arg1, arg2) { - let target; - let filter; - let instructions; - if (typeof arg1 === "undefined" && typeof arg2 === "undefined") { - target = {}; - instructions = arg0; - } else { - target = arg0; - if (typeof arg1 === "function") { - filter = arg1; - instructions = arg2; - return mapWithFilter(target, filter, instructions); + var __copyProps2 = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames2(from)) + if (!__hasOwnProp2.call(to, key) && key !== except) + __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable }); + } + return to; + }; + var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); + var src_exports = {}; + __export2(src_exports, { + fromHex: () => fromHex, + toHex: () => toHex + }); + module2.exports = __toCommonJS2(src_exports); + var SHORT_TO_HEX = {}; + var HEX_TO_SHORT = {}; + for (let i = 0; i < 256; i++) { + let encodedByte = i.toString(16).toLowerCase(); + if (encodedByte.length === 1) { + encodedByte = `0${encodedByte}`; + } + SHORT_TO_HEX[i] = encodedByte; + HEX_TO_SHORT[encodedByte] = i; + } + function fromHex(encoded) { + if (encoded.length % 2 !== 0) { + throw new Error("Hex encoded strings must have an even number length"); + } + const out = new Uint8Array(encoded.length / 2); + for (let i = 0; i < encoded.length; i += 2) { + const encodedByte = encoded.slice(i, i + 2).toLowerCase(); + if (encodedByte in HEX_TO_SHORT) { + out[i / 2] = HEX_TO_SHORT[encodedByte]; } else { - instructions = arg1; + throw new Error(`Cannot decode unrecognized sequence ${encodedByte} as hexadecimal`); } } - for (const key of Object.keys(instructions)) { - if (!Array.isArray(instructions[key])) { - target[key] = instructions[key]; - continue; - } - applyInstruction(target, null, instructions, key); + return out; + } + __name(fromHex, "fromHex"); + function toHex(bytes) { + let out = ""; + for (let i = 0; i < bytes.byteLength; i++) { + out += SHORT_TO_HEX[bytes[i]]; } - return target; + return out; } - __name(map, "map"); - var convertMap = /* @__PURE__ */ __name((target) => { - const output = {}; - for (const [k, v] of Object.entries(target || {})) { - output[k] = [, v]; + __name(toHex, "toHex"); + } +}); + +// ../../../node_modules/@smithy/smithy-client/node_modules/@smithy/util-stream/dist-cjs/stream-type-check.js +var require_stream_type_check = __commonJS({ + "../../../node_modules/@smithy/smithy-client/node_modules/@smithy/util-stream/dist-cjs/stream-type-check.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.isReadableStream = void 0; + var isReadableStream2 = (stream) => { + var _a; + return typeof ReadableStream === "function" && (((_a = stream === null || stream === void 0 ? void 0 : stream.constructor) === null || _a === void 0 ? void 0 : _a.name) === ReadableStream.name || stream instanceof ReadableStream); + }; + exports2.isReadableStream = isReadableStream2; + } +}); + +// ../../../node_modules/@smithy/smithy-client/node_modules/@smithy/util-stream/dist-cjs/sdk-stream-mixin.browser.js +var require_sdk_stream_mixin_browser = __commonJS({ + "../../../node_modules/@smithy/smithy-client/node_modules/@smithy/util-stream/dist-cjs/sdk-stream-mixin.browser.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.sdkStreamMixin = void 0; + var fetch_http_handler_1 = require_dist_cjs34(); + var util_base64_1 = require_dist_cjs29(); + var util_hex_encoding_1 = require_dist_cjs35(); + var util_utf8_1 = require_dist_cjs28(); + var stream_type_check_1 = require_stream_type_check(); + var ERR_MSG_STREAM_HAS_BEEN_TRANSFORMED = "The stream has already been transformed."; + var sdkStreamMixin2 = (stream) => { + var _a, _b; + if (!isBlobInstance(stream) && !(0, stream_type_check_1.isReadableStream)(stream)) { + const name = ((_b = (_a = stream === null || stream === void 0 ? void 0 : stream.__proto__) === null || _a === void 0 ? void 0 : _a.constructor) === null || _b === void 0 ? void 0 : _b.name) || stream; + throw new Error(`Unexpected stream implementation, expect Blob or ReadableStream, got ${name}`); } - return output; - }, "convertMap"); - var take = /* @__PURE__ */ __name((source, instructions) => { - const out = {}; - for (const key in instructions) { - applyInstruction(out, source, instructions, key); + let transformed = false; + const transformToByteArray = async () => { + if (transformed) { + throw new Error(ERR_MSG_STREAM_HAS_BEEN_TRANSFORMED); + } + transformed = true; + return await (0, fetch_http_handler_1.streamCollector)(stream); + }; + const blobToWebStream = (blob) => { + if (typeof blob.stream !== "function") { + throw new Error("Cannot transform payload Blob to web stream. Please make sure the Blob.stream() is polyfilled.\nIf you are using React Native, this API is not yet supported, see: https://react-native.canny.io/feature-requests/p/fetch-streaming-body"); + } + return blob.stream(); + }; + return Object.assign(stream, { + transformToByteArray, + transformToString: async (encoding) => { + const buf = await transformToByteArray(); + if (encoding === "base64") { + return (0, util_base64_1.toBase64)(buf); + } else if (encoding === "hex") { + return (0, util_hex_encoding_1.toHex)(buf); + } else if (encoding === void 0 || encoding === "utf8" || encoding === "utf-8") { + return (0, util_utf8_1.toUtf8)(buf); + } else if (typeof TextDecoder === "function") { + return new TextDecoder(encoding).decode(buf); + } else { + throw new Error("TextDecoder is not available, please make sure polyfill is provided."); + } + }, + transformToWebStream: () => { + if (transformed) { + throw new Error(ERR_MSG_STREAM_HAS_BEEN_TRANSFORMED); + } + transformed = true; + if (isBlobInstance(stream)) { + return blobToWebStream(stream); + } else if ((0, stream_type_check_1.isReadableStream)(stream)) { + return stream; + } else { + throw new Error(`Cannot transform payload to web stream, got ${stream}`); + } + } + }); + }; + exports2.sdkStreamMixin = sdkStreamMixin2; + var isBlobInstance = (stream) => typeof Blob === "function" && stream instanceof Blob; + } +}); + +// ../../../node_modules/@smithy/smithy-client/node_modules/@smithy/util-stream/dist-cjs/sdk-stream-mixin.js +var require_sdk_stream_mixin = __commonJS({ + "../../../node_modules/@smithy/smithy-client/node_modules/@smithy/util-stream/dist-cjs/sdk-stream-mixin.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.sdkStreamMixin = void 0; + var node_http_handler_1 = require_dist_cjs33(); + var util_buffer_from_1 = require_dist_cjs27(); + var stream_1 = require("stream"); + var util_1 = require("util"); + var sdk_stream_mixin_browser_1 = require_sdk_stream_mixin_browser(); + var ERR_MSG_STREAM_HAS_BEEN_TRANSFORMED = "The stream has already been transformed."; + var sdkStreamMixin2 = (stream) => { + var _a, _b; + if (!(stream instanceof stream_1.Readable)) { + try { + return (0, sdk_stream_mixin_browser_1.sdkStreamMixin)(stream); + } catch (e) { + const name = ((_b = (_a = stream === null || stream === void 0 ? void 0 : stream.__proto__) === null || _a === void 0 ? void 0 : _a.constructor) === null || _b === void 0 ? void 0 : _b.name) || stream; + throw new Error(`Unexpected stream implementation, expect Stream.Readable instance, got ${name}`); + } } - return out; - }, "take"); - var mapWithFilter = /* @__PURE__ */ __name((target, filter, instructions) => { - return map( - target, - Object.entries(instructions).reduce( - (_instructions, [key, value]) => { - if (Array.isArray(value)) { - _instructions[key] = value; - } else { - if (typeof value === "function") { - _instructions[key] = [filter, value()]; - } else { - _instructions[key] = [filter, value]; - } - } - return _instructions; - }, - {} - ) - ); - }, "mapWithFilter"); - var applyInstruction = /* @__PURE__ */ __name((target, source, instructions, targetKey) => { - if (source !== null) { - let instruction = instructions[targetKey]; - if (typeof instruction === "function") { - instruction = [, instruction]; + let transformed = false; + const transformToByteArray = async () => { + if (transformed) { + throw new Error(ERR_MSG_STREAM_HAS_BEEN_TRANSFORMED); } - const [filter2 = nonNullish, valueFn = pass, sourceKey = targetKey] = instruction; - if (typeof filter2 === "function" && filter2(source[sourceKey]) || typeof filter2 !== "function" && !!filter2) { - target[targetKey] = valueFn(source[sourceKey]); + transformed = true; + return await (0, node_http_handler_1.streamCollector)(stream); + }; + return Object.assign(stream, { + transformToByteArray, + transformToString: async (encoding) => { + const buf = await transformToByteArray(); + if (encoding === void 0 || Buffer.isEncoding(encoding)) { + return (0, util_buffer_from_1.fromArrayBuffer)(buf.buffer, buf.byteOffset, buf.byteLength).toString(encoding); + } else { + const decoder2 = new util_1.TextDecoder(encoding); + return decoder2.decode(buf); + } + }, + transformToWebStream: () => { + if (transformed) { + throw new Error(ERR_MSG_STREAM_HAS_BEEN_TRANSFORMED); + } + if (stream.readableFlowing !== null) { + throw new Error("The stream has been consumed by other callbacks."); + } + if (typeof stream_1.Readable.toWeb !== "function") { + throw new Error("Readable.toWeb() is not supported. Please make sure you are using Node.js >= 17.0.0, or polyfill is available."); + } + transformed = true; + return stream_1.Readable.toWeb(stream); + } + }); + }; + exports2.sdkStreamMixin = sdkStreamMixin2; + } +}); + +// ../../../node_modules/@smithy/smithy-client/node_modules/@smithy/util-stream/dist-cjs/splitStream.browser.js +var require_splitStream_browser = __commonJS({ + "../../../node_modules/@smithy/smithy-client/node_modules/@smithy/util-stream/dist-cjs/splitStream.browser.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.splitStream = void 0; + async function splitStream2(stream) { + if (typeof stream.stream === "function") { + stream = stream.stream(); + } + const readableStream = stream; + return readableStream.tee(); + } + exports2.splitStream = splitStream2; + } +}); + +// ../../../node_modules/@smithy/smithy-client/node_modules/@smithy/util-stream/dist-cjs/splitStream.js +var require_splitStream = __commonJS({ + "../../../node_modules/@smithy/smithy-client/node_modules/@smithy/util-stream/dist-cjs/splitStream.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.splitStream = void 0; + var stream_1 = require("stream"); + var splitStream_browser_1 = require_splitStream_browser(); + var stream_type_check_1 = require_stream_type_check(); + async function splitStream2(stream) { + if ((0, stream_type_check_1.isReadableStream)(stream)) { + return (0, splitStream_browser_1.splitStream)(stream); + } + const stream1 = new stream_1.PassThrough(); + const stream2 = new stream_1.PassThrough(); + stream.pipe(stream1); + stream.pipe(stream2); + return [stream1, stream2]; + } + exports2.splitStream = splitStream2; + } +}); + +// ../../../node_modules/@smithy/smithy-client/node_modules/@smithy/util-stream/dist-cjs/headStream.browser.js +var require_headStream_browser = __commonJS({ + "../../../node_modules/@smithy/smithy-client/node_modules/@smithy/util-stream/dist-cjs/headStream.browser.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.headStream = void 0; + async function headStream2(stream, bytes) { + var _a; + let byteLengthCounter = 0; + const chunks = []; + const reader = stream.getReader(); + let isDone = false; + while (!isDone) { + const { done, value } = await reader.read(); + if (value) { + chunks.push(value); + byteLengthCounter += (_a = value === null || value === void 0 ? void 0 : value.byteLength) !== null && _a !== void 0 ? _a : 0; + } + if (byteLengthCounter >= bytes) { + break; } - return; + isDone = done; } - let [filter, value] = instructions[targetKey]; - if (typeof value === "function") { - let _value; - const defaultFilterPassed = filter === void 0 && (_value = value()) != null; - const customFilterPassed = typeof filter === "function" && !!filter(void 0) || typeof filter !== "function" && !!filter; - if (defaultFilterPassed) { - target[targetKey] = _value; - } else if (customFilterPassed) { - target[targetKey] = value(); - } - } else { - const defaultFilterPassed = filter === void 0 && value != null; - const customFilterPassed = typeof filter === "function" && !!filter(value) || typeof filter !== "function" && !!filter; - if (defaultFilterPassed || customFilterPassed) { - target[targetKey] = value; + reader.releaseLock(); + const collected = new Uint8Array(Math.min(bytes, byteLengthCounter)); + let offset = 0; + for (const chunk of chunks) { + if (chunk.byteLength > collected.byteLength - offset) { + collected.set(chunk.subarray(0, collected.byteLength - offset), offset); + break; + } else { + collected.set(chunk, offset); } + offset += chunk.length; } - }, "applyInstruction"); - var nonNullish = /* @__PURE__ */ __name((_) => _ != null, "nonNullish"); - var pass = /* @__PURE__ */ __name((_) => _, "pass"); - var resolvedPath = /* @__PURE__ */ __name((resolvedPath2, input, memberName, labelValueProvider, uriLabel, isGreedyLabel) => { - if (input != null && input[memberName] !== void 0) { - const labelValue = labelValueProvider(); - if (labelValue.length <= 0) { - throw new Error("Empty value provided for input HTTP label: " + memberName + "."); - } - resolvedPath2 = resolvedPath2.replace( - uriLabel, - isGreedyLabel ? labelValue.split("/").map((segment) => extendedEncodeURIComponent(segment)).join("/") : extendedEncodeURIComponent(labelValue) - ); - } else { - throw new Error("No value provided for input HTTP label: " + memberName + "."); + return collected; + } + exports2.headStream = headStream2; + } +}); + +// ../../../node_modules/@smithy/smithy-client/node_modules/@smithy/util-stream/dist-cjs/headStream.js +var require_headStream = __commonJS({ + "../../../node_modules/@smithy/smithy-client/node_modules/@smithy/util-stream/dist-cjs/headStream.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.headStream = void 0; + var stream_1 = require("stream"); + var headStream_browser_1 = require_headStream_browser(); + var stream_type_check_1 = require_stream_type_check(); + var headStream2 = (stream, bytes) => { + if ((0, stream_type_check_1.isReadableStream)(stream)) { + return (0, headStream_browser_1.headStream)(stream, bytes); } - return resolvedPath2; - }, "resolvedPath"); - var serializeFloat = /* @__PURE__ */ __name((value) => { - if (value !== value) { - return "NaN"; + return new Promise((resolve, reject) => { + const collector = new Collector(); + collector.limit = bytes; + stream.pipe(collector); + stream.on("error", (err) => { + collector.end(); + reject(err); + }); + collector.on("error", reject); + collector.on("finish", function() { + const bytes2 = new Uint8Array(Buffer.concat(this.buffers)); + resolve(bytes2); + }); + }); + }; + exports2.headStream = headStream2; + var Collector = class extends stream_1.Writable { + constructor() { + super(...arguments); + this.buffers = []; + this.limit = Infinity; + this.bytesBuffered = 0; } - switch (value) { - case Infinity: - return "Infinity"; - case -Infinity: - return "-Infinity"; - default: - return value; + _write(chunk, encoding, callback) { + var _a; + this.buffers.push(chunk); + this.bytesBuffered += (_a = chunk.byteLength) !== null && _a !== void 0 ? _a : 0; + if (this.bytesBuffered >= this.limit) { + const excess = this.bytesBuffered - this.limit; + const tailBuffer = this.buffers[this.buffers.length - 1]; + this.buffers[this.buffers.length - 1] = tailBuffer.subarray(0, tailBuffer.byteLength - excess); + this.emit("finish"); + } + callback(); } - }, "serializeFloat"); - var _json = /* @__PURE__ */ __name((obj) => { - if (obj == null) { - return {}; + }; + } +}); + +// ../../../node_modules/@smithy/smithy-client/node_modules/@smithy/util-stream/dist-cjs/index.js +var require_dist_cjs36 = __commonJS({ + "../../../node_modules/@smithy/smithy-client/node_modules/@smithy/util-stream/dist-cjs/index.js"(exports2, module2) { + var __defProp2 = Object.defineProperty; + var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; + var __getOwnPropNames2 = Object.getOwnPropertyNames; + var __hasOwnProp2 = Object.prototype.hasOwnProperty; + var __name = (target, value) => __defProp2(target, "name", { value, configurable: true }); + var __export2 = (target, all) => { + for (var name in all) + __defProp2(target, name, { get: all[name], enumerable: true }); + }; + var __copyProps2 = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames2(from)) + if (!__hasOwnProp2.call(to, key) && key !== except) + __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable }); } - if (Array.isArray(obj)) { - return obj.filter((_) => _ != null).map(_json); + return to; + }; + var __reExport = (target, mod, secondTarget) => (__copyProps2(target, mod, "default"), secondTarget && __copyProps2(secondTarget, mod, "default")); + var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); + var src_exports = {}; + __export2(src_exports, { + Uint8ArrayBlobAdapter: () => Uint8ArrayBlobAdapter + }); + module2.exports = __toCommonJS2(src_exports); + var import_util_base64 = require_dist_cjs29(); + var import_util_utf8 = require_dist_cjs28(); + function transformToString(payload, encoding = "utf-8") { + if (encoding === "base64") { + return (0, import_util_base64.toBase64)(payload); } - if (typeof obj === "object") { - const target = {}; - for (const key of Object.keys(obj)) { - if (obj[key] == null) { - continue; - } - target[key] = _json(obj[key]); + return (0, import_util_utf8.toUtf8)(payload); + } + __name(transformToString, "transformToString"); + function transformFromString(str, encoding) { + if (encoding === "base64") { + return Uint8ArrayBlobAdapter.mutate((0, import_util_base64.fromBase64)(str)); + } + return Uint8ArrayBlobAdapter.mutate((0, import_util_utf8.fromUtf8)(str)); + } + __name(transformFromString, "transformFromString"); + var _Uint8ArrayBlobAdapter = class _Uint8ArrayBlobAdapter2 extends Uint8Array { + /** + * @param source - such as a string or Stream. + * @returns a new Uint8ArrayBlobAdapter extending Uint8Array. + */ + static fromString(source, encoding = "utf-8") { + switch (typeof source) { + case "string": + return transformFromString(source, encoding); + default: + throw new Error(`Unsupported conversion from ${typeof source} to Uint8ArrayBlobAdapter.`); } - return target; } - return obj; - }, "_json"); - function splitEvery(value, delimiter, numDelimiters) { - if (numDelimiters <= 0 || !Number.isInteger(numDelimiters)) { - throw new Error("Invalid number of delimiters (" + numDelimiters + ") for splitEvery."); + /** + * @param source - Uint8Array to be mutated. + * @returns the same Uint8Array but with prototype switched to Uint8ArrayBlobAdapter. + */ + static mutate(source) { + Object.setPrototypeOf(source, _Uint8ArrayBlobAdapter2.prototype); + return source; } - const segments = value.split(delimiter); - if (numDelimiters === 1) { - return segments; + /** + * @param encoding - default 'utf-8'. + * @returns the blob as string. + */ + transformToString(encoding = "utf-8") { + return transformToString(this, encoding); } - const compoundSegments = []; - let currentSegment = ""; - for (let i = 0; i < segments.length; i++) { - if (currentSegment === "") { - currentSegment = segments[i]; + }; + __name(_Uint8ArrayBlobAdapter, "Uint8ArrayBlobAdapter"); + var Uint8ArrayBlobAdapter = _Uint8ArrayBlobAdapter; + __reExport(src_exports, require_getAwsChunkedEncodingStream(), module2.exports); + __reExport(src_exports, require_sdk_stream_mixin(), module2.exports); + __reExport(src_exports, require_splitStream(), module2.exports); + __reExport(src_exports, require_headStream(), module2.exports); + __reExport(src_exports, require_stream_type_check(), module2.exports); + } +}); + +// ../../../node_modules/@smithy/smithy-client/dist-cjs/index.js +var require_dist_cjs37 = __commonJS({ + "../../../node_modules/@smithy/smithy-client/dist-cjs/index.js"(exports2, module2) { + var __defProp2 = Object.defineProperty; + var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; + var __getOwnPropNames2 = Object.getOwnPropertyNames; + var __hasOwnProp2 = Object.prototype.hasOwnProperty; + var __name = (target, value) => __defProp2(target, "name", { value, configurable: true }); + var __export2 = (target, all) => { + for (var name in all) + __defProp2(target, name, { get: all[name], enumerable: true }); + }; + var __copyProps2 = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames2(from)) + if (!__hasOwnProp2.call(to, key) && key !== except) + __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable }); + } + return to; + }; + var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); + var src_exports = {}; + __export2(src_exports, { + Client: () => Client, + Command: () => Command, + LazyJsonString: () => LazyJsonString, + NoOpLogger: () => NoOpLogger, + SENSITIVE_STRING: () => SENSITIVE_STRING, + ServiceException: () => ServiceException, + StringWrapper: () => StringWrapper, + _json: () => _json, + collectBody: () => collectBody2, + convertMap: () => convertMap, + createAggregatedClient: () => createAggregatedClient, + dateToUtcString: () => dateToUtcString, + decorateServiceException: () => decorateServiceException, + emitWarningIfUnsupportedVersion: () => emitWarningIfUnsupportedVersion2, + expectBoolean: () => expectBoolean, + expectByte: () => expectByte, + expectFloat32: () => expectFloat32, + expectInt: () => expectInt, + expectInt32: () => expectInt32, + expectLong: () => expectLong, + expectNonNull: () => expectNonNull, + expectNumber: () => expectNumber, + expectObject: () => expectObject, + expectShort: () => expectShort, + expectString: () => expectString, + expectUnion: () => expectUnion2, + extendedEncodeURIComponent: () => extendedEncodeURIComponent, + getArrayIfSingleItem: () => getArrayIfSingleItem, + getDefaultClientConfiguration: () => getDefaultClientConfiguration, + getDefaultExtensionConfiguration: () => getDefaultExtensionConfiguration, + getValueFromTextNode: () => getValueFromTextNode2, + handleFloat: () => handleFloat, + isSerializableHeaderValue: () => isSerializableHeaderValue, + limitedParseDouble: () => limitedParseDouble, + limitedParseFloat: () => limitedParseFloat, + limitedParseFloat32: () => limitedParseFloat32, + loadConfigsForDefaultMode: () => loadConfigsForDefaultMode, + logger: () => logger, + map: () => map, + parseBoolean: () => parseBoolean, + parseEpochTimestamp: () => parseEpochTimestamp, + parseRfc3339DateTime: () => parseRfc3339DateTime, + parseRfc3339DateTimeWithOffset: () => parseRfc3339DateTimeWithOffset, + parseRfc7231DateTime: () => parseRfc7231DateTime, + quoteHeader: () => quoteHeader, + resolveDefaultRuntimeConfig: () => resolveDefaultRuntimeConfig, + resolvedPath: () => resolvedPath2, + serializeDateTime: () => serializeDateTime, + serializeFloat: () => serializeFloat, + splitEvery: () => splitEvery, + splitHeader: () => splitHeader, + strictParseByte: () => strictParseByte, + strictParseDouble: () => strictParseDouble, + strictParseFloat: () => strictParseFloat, + strictParseFloat32: () => strictParseFloat32, + strictParseInt: () => strictParseInt, + strictParseInt32: () => strictParseInt32, + strictParseLong: () => strictParseLong, + strictParseShort: () => strictParseShort, + take: () => take, + throwDefaultError: () => throwDefaultError, + withBaseException: () => withBaseException + }); + module2.exports = __toCommonJS2(src_exports); + var import_middleware_stack = require_dist_cjs25(); + var _Client = class _Client { + constructor(config) { + this.config = config; + this.middlewareStack = (0, import_middleware_stack.constructStack)(); + } + send(command, optionsOrCb, cb) { + const options = typeof optionsOrCb !== "function" ? optionsOrCb : void 0; + const callback = typeof optionsOrCb === "function" ? optionsOrCb : cb; + const useHandlerCache = options === void 0 && this.config.cacheMiddleware === true; + let handler2; + if (useHandlerCache) { + if (!this.handlers) { + this.handlers = /* @__PURE__ */ new WeakMap(); + } + const handlers = this.handlers; + if (handlers.has(command.constructor)) { + handler2 = handlers.get(command.constructor); + } else { + handler2 = command.resolveMiddleware(this.middlewareStack, this.config, options); + handlers.set(command.constructor, handler2); + } } else { - currentSegment += delimiter + segments[i]; + delete this.handlers; + handler2 = command.resolveMiddleware(this.middlewareStack, this.config, options); } - if ((i + 1) % numDelimiters === 0) { - compoundSegments.push(currentSegment); - currentSegment = ""; + if (callback) { + handler2(command).then( + (result) => callback(null, result.output), + (err) => callback(err) + ).catch( + // prevent any errors thrown in the callback from triggering an + // unhandled promise rejection + () => { + } + ); + } else { + return handler2(command).then((result) => result.output); } } - if (currentSegment !== "") { - compoundSegments.push(currentSegment); + destroy() { + var _a, _b, _c; + (_c = (_b = (_a = this.config) == null ? void 0 : _a.requestHandler) == null ? void 0 : _b.destroy) == null ? void 0 : _c.call(_b); + delete this.handlers; } - return compoundSegments; - } - __name(splitEvery, "splitEvery"); - } -}); - -// ../../../node_modules/@smithy/middleware-retry/dist-cjs/isStreamingPayload/isStreamingPayload.js -var require_isStreamingPayload = __commonJS({ - "../../../node_modules/@smithy/middleware-retry/dist-cjs/isStreamingPayload/isStreamingPayload.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.isStreamingPayload = void 0; - var stream_1 = require("stream"); - var isStreamingPayload = (request2) => (request2 === null || request2 === void 0 ? void 0 : request2.body) instanceof stream_1.Readable || typeof ReadableStream !== "undefined" && (request2 === null || request2 === void 0 ? void 0 : request2.body) instanceof ReadableStream; - exports2.isStreamingPayload = isStreamingPayload; - } -}); - -// ../../../node_modules/@smithy/middleware-retry/dist-cjs/index.js -var require_dist_cjs35 = __commonJS({ - "../../../node_modules/@smithy/middleware-retry/dist-cjs/index.js"(exports2, module2) { - var __defProp2 = Object.defineProperty; - var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; - var __getOwnPropNames2 = Object.getOwnPropertyNames; - var __hasOwnProp2 = Object.prototype.hasOwnProperty; - var __name = (target, value) => __defProp2(target, "name", { value, configurable: true }); - var __export2 = (target, all) => { - for (var name in all) - __defProp2(target, name, { get: all[name], enumerable: true }); }; - var __copyProps2 = (to, from, except, desc) => { - if (from && typeof from === "object" || typeof from === "function") { - for (let key of __getOwnPropNames2(from)) - if (!__hasOwnProp2.call(to, key) && key !== except) - __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable }); + __name(_Client, "Client"); + var Client = _Client; + var import_util_stream = require_dist_cjs36(); + var collectBody2 = /* @__PURE__ */ __name(async (streamBody = new Uint8Array(), context) => { + if (streamBody instanceof Uint8Array) { + return import_util_stream.Uint8ArrayBlobAdapter.mutate(streamBody); } - return to; - }; - var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); - var src_exports = {}; - __export2(src_exports, { - AdaptiveRetryStrategy: () => AdaptiveRetryStrategy, - CONFIG_MAX_ATTEMPTS: () => CONFIG_MAX_ATTEMPTS, - CONFIG_RETRY_MODE: () => CONFIG_RETRY_MODE, - ENV_MAX_ATTEMPTS: () => ENV_MAX_ATTEMPTS, - ENV_RETRY_MODE: () => ENV_RETRY_MODE, - NODE_MAX_ATTEMPT_CONFIG_OPTIONS: () => NODE_MAX_ATTEMPT_CONFIG_OPTIONS, - NODE_RETRY_MODE_CONFIG_OPTIONS: () => NODE_RETRY_MODE_CONFIG_OPTIONS, - StandardRetryStrategy: () => StandardRetryStrategy, - defaultDelayDecider: () => defaultDelayDecider, - defaultRetryDecider: () => defaultRetryDecider, - getOmitRetryHeadersPlugin: () => getOmitRetryHeadersPlugin, - getRetryAfterHint: () => getRetryAfterHint, - getRetryPlugin: () => getRetryPlugin, - omitRetryHeadersMiddleware: () => omitRetryHeadersMiddleware, - omitRetryHeadersMiddlewareOptions: () => omitRetryHeadersMiddlewareOptions, - resolveRetryConfig: () => resolveRetryConfig, - retryMiddleware: () => retryMiddleware, - retryMiddlewareOptions: () => retryMiddlewareOptions - }); - module2.exports = __toCommonJS2(src_exports); - var import_protocol_http = require_dist_cjs2(); - var import_uuid = (init_esm_node(), __toCommonJS(esm_node_exports)); - var import_util_retry = require_dist_cjs28(); - var getDefaultRetryQuota = /* @__PURE__ */ __name((initialRetryTokens, options) => { - const MAX_CAPACITY = initialRetryTokens; - const noRetryIncrement = (options == null ? void 0 : options.noRetryIncrement) ?? import_util_retry.NO_RETRY_INCREMENT; - const retryCost = (options == null ? void 0 : options.retryCost) ?? import_util_retry.RETRY_COST; - const timeoutRetryCost = (options == null ? void 0 : options.timeoutRetryCost) ?? import_util_retry.TIMEOUT_RETRY_COST; - let availableCapacity = initialRetryTokens; - const getCapacityAmount = /* @__PURE__ */ __name((error) => error.name === "TimeoutError" ? timeoutRetryCost : retryCost, "getCapacityAmount"); - const hasRetryTokens = /* @__PURE__ */ __name((error) => getCapacityAmount(error) <= availableCapacity, "hasRetryTokens"); - const retrieveRetryTokens = /* @__PURE__ */ __name((error) => { - if (!hasRetryTokens(error)) { - throw new Error("No retry token available"); - } - const capacityAmount = getCapacityAmount(error); - availableCapacity -= capacityAmount; - return capacityAmount; - }, "retrieveRetryTokens"); - const releaseRetryTokens = /* @__PURE__ */ __name((capacityReleaseAmount) => { - availableCapacity += capacityReleaseAmount ?? noRetryIncrement; - availableCapacity = Math.min(availableCapacity, MAX_CAPACITY); - }, "releaseRetryTokens"); - return Object.freeze({ - hasRetryTokens, - retrieveRetryTokens, - releaseRetryTokens - }); - }, "getDefaultRetryQuota"); - var defaultDelayDecider = /* @__PURE__ */ __name((delayBase, attempts) => Math.floor(Math.min(import_util_retry.MAXIMUM_RETRY_DELAY, Math.random() * 2 ** attempts * delayBase)), "defaultDelayDecider"); - var import_service_error_classification = require_dist_cjs27(); - var defaultRetryDecider = /* @__PURE__ */ __name((error) => { - if (!error) { - return false; + if (!streamBody) { + return import_util_stream.Uint8ArrayBlobAdapter.mutate(new Uint8Array()); } - return (0, import_service_error_classification.isRetryableByTrait)(error) || (0, import_service_error_classification.isClockSkewError)(error) || (0, import_service_error_classification.isThrottlingError)(error) || (0, import_service_error_classification.isTransientError)(error); - }, "defaultRetryDecider"); - var asSdkError = /* @__PURE__ */ __name((error) => { - if (error instanceof Error) - return error; - if (error instanceof Object) - return Object.assign(new Error(), error); - if (typeof error === "string") - return new Error(error); - return new Error(`AWS SDK error wrapper for ${error}`); - }, "asSdkError"); - var _StandardRetryStrategy = class _StandardRetryStrategy { - constructor(maxAttemptsProvider, options) { - this.maxAttemptsProvider = maxAttemptsProvider; - this.mode = import_util_retry.RETRY_MODES.STANDARD; - this.retryDecider = (options == null ? void 0 : options.retryDecider) ?? defaultRetryDecider; - this.delayDecider = (options == null ? void 0 : options.delayDecider) ?? defaultDelayDecider; - this.retryQuota = (options == null ? void 0 : options.retryQuota) ?? getDefaultRetryQuota(import_util_retry.INITIAL_RETRY_TOKENS); + const fromContext = context.streamCollector(streamBody); + return import_util_stream.Uint8ArrayBlobAdapter.mutate(await fromContext); + }, "collectBody"); + var import_types5 = require_dist_cjs(); + var _Command = class _Command { + constructor() { + this.middlewareStack = (0, import_middleware_stack.constructStack)(); } - shouldRetry(error, attempts, maxAttempts) { - return attempts < maxAttempts && this.retryDecider(error) && this.retryQuota.hasRetryTokens(error); + /** + * Factory for Command ClassBuilder. + * @internal + */ + static classBuilder() { + return new ClassBuilder(); } - async getMaxAttempts() { - let maxAttempts; - try { - maxAttempts = await this.maxAttemptsProvider(); - } catch (error) { - maxAttempts = import_util_retry.DEFAULT_MAX_ATTEMPTS; + /** + * @internal + */ + resolveMiddlewareWithContext(clientStack, configuration, options, { + middlewareFn, + clientName, + commandName, + inputFilterSensitiveLog, + outputFilterSensitiveLog, + smithyContext, + additionalContext, + CommandCtor + }) { + for (const mw of middlewareFn.bind(this)(CommandCtor, clientStack, configuration, options)) { + this.middlewareStack.use(mw); } - return maxAttempts; + const stack = clientStack.concat(this.middlewareStack); + const { logger: logger2 } = configuration; + const handlerExecutionContext = { + logger: logger2, + clientName, + commandName, + inputFilterSensitiveLog, + outputFilterSensitiveLog, + [import_types5.SMITHY_CONTEXT_KEY]: { + commandInstance: this, + ...smithyContext + }, + ...additionalContext + }; + const { requestHandler } = configuration; + return stack.resolve( + (request2) => requestHandler.handle(request2.request, options || {}), + handlerExecutionContext + ); + } + }; + __name(_Command, "Command"); + var Command = _Command; + var _ClassBuilder = class _ClassBuilder { + constructor() { + this._init = () => { + }; + this._ep = {}; + this._middlewareFn = () => []; + this._commandName = ""; + this._clientName = ""; + this._additionalContext = {}; + this._smithyContext = {}; + this._inputFilterSensitiveLog = (_) => _; + this._outputFilterSensitiveLog = (_) => _; + this._serializer = null; + this._deserializer = null; + } + /** + * Optional init callback. + */ + init(cb) { + this._init = cb; + } + /** + * Set the endpoint parameter instructions. + */ + ep(endpointParameterInstructions) { + this._ep = endpointParameterInstructions; + return this; + } + /** + * Add any number of middleware. + */ + m(middlewareSupplier) { + this._middlewareFn = middlewareSupplier; + return this; + } + /** + * Set the initial handler execution context Smithy field. + */ + s(service, operation, smithyContext = {}) { + this._smithyContext = { + service, + operation, + ...smithyContext + }; + return this; + } + /** + * Set the initial handler execution context. + */ + c(additionalContext = {}) { + this._additionalContext = additionalContext; + return this; + } + /** + * Set constant string identifiers for the operation. + */ + n(clientName, commandName) { + this._clientName = clientName; + this._commandName = commandName; + return this; + } + /** + * Set the input and output sensistive log filters. + */ + f(inputFilter = (_) => _, outputFilter = (_) => _) { + this._inputFilterSensitiveLog = inputFilter; + this._outputFilterSensitiveLog = outputFilter; + return this; } - async retry(next, args, options) { - let retryTokenAmount; - let attempts = 0; - let totalDelay = 0; - const maxAttempts = await this.getMaxAttempts(); - const { request: request2 } = args; - if (import_protocol_http.HttpRequest.isInstance(request2)) { - request2.headers[import_util_retry.INVOCATION_ID_HEADER] = (0, import_uuid.v4)(); - } - while (true) { - try { - if (import_protocol_http.HttpRequest.isInstance(request2)) { - request2.headers[import_util_retry.REQUEST_HEADER] = `attempt=${attempts + 1}; max=${maxAttempts}`; - } - if (options == null ? void 0 : options.beforeRequest) { - await options.beforeRequest(); - } - const { response, output } = await next(args); - if (options == null ? void 0 : options.afterRequest) { - options.afterRequest(response); - } - this.retryQuota.releaseRetryTokens(retryTokenAmount); - output.$metadata.attempts = attempts + 1; - output.$metadata.totalRetryDelay = totalDelay; - return { response, output }; - } catch (e) { - const err = asSdkError(e); - attempts++; - if (this.shouldRetry(err, attempts, maxAttempts)) { - retryTokenAmount = this.retryQuota.retrieveRetryTokens(err); - const delayFromDecider = this.delayDecider( - (0, import_service_error_classification.isThrottlingError)(err) ? import_util_retry.THROTTLING_RETRY_DELAY_BASE : import_util_retry.DEFAULT_RETRY_DELAY_BASE, - attempts - ); - const delayFromResponse = getDelayFromRetryAfterHeader(err.$response); - const delay = Math.max(delayFromResponse || 0, delayFromDecider); - totalDelay += delay; - await new Promise((resolve) => setTimeout(resolve, delay)); - continue; - } - if (!err.$metadata) { - err.$metadata = {}; - } - err.$metadata.attempts = attempts; - err.$metadata.totalRetryDelay = totalDelay; - throw err; - } - } + /** + * Sets the serializer. + */ + ser(serializer) { + this._serializer = serializer; + return this; } - }; - __name(_StandardRetryStrategy, "StandardRetryStrategy"); - var StandardRetryStrategy = _StandardRetryStrategy; - var getDelayFromRetryAfterHeader = /* @__PURE__ */ __name((response) => { - if (!import_protocol_http.HttpResponse.isInstance(response)) - return; - const retryAfterHeaderName = Object.keys(response.headers).find((key) => key.toLowerCase() === "retry-after"); - if (!retryAfterHeaderName) - return; - const retryAfter = response.headers[retryAfterHeaderName]; - const retryAfterSeconds = Number(retryAfter); - if (!Number.isNaN(retryAfterSeconds)) - return retryAfterSeconds * 1e3; - const retryAfterDate = new Date(retryAfter); - return retryAfterDate.getTime() - Date.now(); - }, "getDelayFromRetryAfterHeader"); - var _AdaptiveRetryStrategy = class _AdaptiveRetryStrategy extends StandardRetryStrategy { - constructor(maxAttemptsProvider, options) { - const { rateLimiter, ...superOptions } = options ?? {}; - super(maxAttemptsProvider, superOptions); - this.rateLimiter = rateLimiter ?? new import_util_retry.DefaultRateLimiter(); - this.mode = import_util_retry.RETRY_MODES.ADAPTIVE; + /** + * Sets the deserializer. + */ + de(deserializer) { + this._deserializer = deserializer; + return this; } - async retry(next, args) { - return super.retry(next, args, { - beforeRequest: async () => { - return this.rateLimiter.getSendToken(); - }, - afterRequest: (response) => { - this.rateLimiter.updateClientSendingRate(response); + /** + * @returns a Command class with the classBuilder properties. + */ + build() { + var _a; + const closure = this; + let CommandRef; + return CommandRef = (_a = class extends Command { + /** + * @public + */ + constructor(...[input]) { + super(); + this.serialize = closure._serializer; + this.deserialize = closure._deserializer; + this.input = input ?? {}; + closure._init(this); } - }); - } - }; - __name(_AdaptiveRetryStrategy, "AdaptiveRetryStrategy"); - var AdaptiveRetryStrategy = _AdaptiveRetryStrategy; - var import_util_middleware = require_dist_cjs7(); - var ENV_MAX_ATTEMPTS = "AWS_MAX_ATTEMPTS"; - var CONFIG_MAX_ATTEMPTS = "max_attempts"; - var NODE_MAX_ATTEMPT_CONFIG_OPTIONS = { - environmentVariableSelector: (env) => { - const value = env[ENV_MAX_ATTEMPTS]; - if (!value) - return void 0; - const maxAttempt = parseInt(value); - if (Number.isNaN(maxAttempt)) { - throw new Error(`Environment variable ${ENV_MAX_ATTEMPTS} mast be a number, got "${value}"`); - } - return maxAttempt; - }, - configFileSelector: (profile) => { - const value = profile[CONFIG_MAX_ATTEMPTS]; - if (!value) - return void 0; - const maxAttempt = parseInt(value); - if (Number.isNaN(maxAttempt)) { - throw new Error(`Shared config file entry ${CONFIG_MAX_ATTEMPTS} mast be a number, got "${value}"`); - } - return maxAttempt; - }, - default: import_util_retry.DEFAULT_MAX_ATTEMPTS - }; - var resolveRetryConfig = /* @__PURE__ */ __name((input) => { - const { retryStrategy } = input; - const maxAttempts = (0, import_util_middleware.normalizeProvider)(input.maxAttempts ?? import_util_retry.DEFAULT_MAX_ATTEMPTS); - return { - ...input, - maxAttempts, - retryStrategy: async () => { - if (retryStrategy) { - return retryStrategy; + /** + * @public + */ + static getEndpointParameterInstructions() { + return closure._ep; } - const retryMode = await (0, import_util_middleware.normalizeProvider)(input.retryMode)(); - if (retryMode === import_util_retry.RETRY_MODES.ADAPTIVE) { - return new import_util_retry.AdaptiveRetryStrategy(maxAttempts); + /** + * @internal + */ + resolveMiddleware(stack, configuration, options) { + return this.resolveMiddlewareWithContext(stack, configuration, options, { + CommandCtor: CommandRef, + middlewareFn: closure._middlewareFn, + clientName: closure._clientName, + commandName: closure._commandName, + inputFilterSensitiveLog: closure._inputFilterSensitiveLog, + outputFilterSensitiveLog: closure._outputFilterSensitiveLog, + smithyContext: closure._smithyContext, + additionalContext: closure._additionalContext + }); } - return new import_util_retry.StandardRetryStrategy(maxAttempts); - } - }; - }, "resolveRetryConfig"); - var ENV_RETRY_MODE = "AWS_RETRY_MODE"; - var CONFIG_RETRY_MODE = "retry_mode"; - var NODE_RETRY_MODE_CONFIG_OPTIONS = { - environmentVariableSelector: (env) => env[ENV_RETRY_MODE], - configFileSelector: (profile) => profile[CONFIG_RETRY_MODE], - default: import_util_retry.DEFAULT_RETRY_MODE - }; - var omitRetryHeadersMiddleware = /* @__PURE__ */ __name(() => (next) => async (args) => { - const { request: request2 } = args; - if (import_protocol_http.HttpRequest.isInstance(request2)) { - delete request2.headers[import_util_retry.INVOCATION_ID_HEADER]; - delete request2.headers[import_util_retry.REQUEST_HEADER]; + }, __name(_a, "CommandRef"), _a); } - return next(args); - }, "omitRetryHeadersMiddleware"); - var omitRetryHeadersMiddlewareOptions = { - name: "omitRetryHeadersMiddleware", - tags: ["RETRY", "HEADERS", "OMIT_RETRY_HEADERS"], - relation: "before", - toMiddleware: "awsAuthMiddleware", - override: true }; - var getOmitRetryHeadersPlugin = /* @__PURE__ */ __name((options) => ({ - applyToStack: (clientStack) => { - clientStack.addRelativeTo(omitRetryHeadersMiddleware(), omitRetryHeadersMiddlewareOptions); - } - }), "getOmitRetryHeadersPlugin"); - var import_smithy_client = require_dist_cjs34(); - var import_isStreamingPayload = require_isStreamingPayload(); - var retryMiddleware = /* @__PURE__ */ __name((options) => (next, context) => async (args) => { - var _a; - let retryStrategy = await options.retryStrategy(); - const maxAttempts = await options.maxAttempts(); - if (isRetryStrategyV2(retryStrategy)) { - retryStrategy = retryStrategy; - let retryToken = await retryStrategy.acquireInitialRetryToken(context["partition_id"]); - let lastError = new Error(); - let attempts = 0; - let totalRetryDelay = 0; - const { request: request2 } = args; - const isRequest = import_protocol_http.HttpRequest.isInstance(request2); - if (isRequest) { - request2.headers[import_util_retry.INVOCATION_ID_HEADER] = (0, import_uuid.v4)(); - } - while (true) { - try { - if (isRequest) { - request2.headers[import_util_retry.REQUEST_HEADER] = `attempt=${attempts + 1}; max=${maxAttempts}`; - } - const { response, output } = await next(args); - retryStrategy.recordSuccess(retryToken); - output.$metadata.attempts = attempts + 1; - output.$metadata.totalRetryDelay = totalRetryDelay; - return { response, output }; - } catch (e) { - const retryErrorInfo = getRetryErrorInfo(e); - lastError = asSdkError(e); - if (isRequest && (0, import_isStreamingPayload.isStreamingPayload)(request2)) { - (_a = context.logger instanceof import_smithy_client.NoOpLogger ? console : context.logger) == null ? void 0 : _a.warn( - "An error was encountered in a non-retryable streaming request." - ); - throw lastError; - } - try { - retryToken = await retryStrategy.refreshRetryTokenForRetry(retryToken, retryErrorInfo); - } catch (refreshError) { - if (!lastError.$metadata) { - lastError.$metadata = {}; - } - lastError.$metadata.attempts = attempts + 1; - lastError.$metadata.totalRetryDelay = totalRetryDelay; - throw lastError; - } - attempts = retryToken.getRetryCount(); - const delay = retryToken.getRetryDelay(); - totalRetryDelay += delay; - await new Promise((resolve) => setTimeout(resolve, delay)); + __name(_ClassBuilder, "ClassBuilder"); + var ClassBuilder = _ClassBuilder; + var SENSITIVE_STRING = "***SensitiveInformation***"; + var createAggregatedClient = /* @__PURE__ */ __name((commands, Client2) => { + for (const command of Object.keys(commands)) { + const CommandCtor = commands[command]; + const methodImpl = /* @__PURE__ */ __name(async function(args, optionsOrCb, cb) { + const command2 = new CommandCtor(args); + if (typeof optionsOrCb === "function") { + this.send(command2, optionsOrCb); + } else if (typeof cb === "function") { + if (typeof optionsOrCb !== "object") + throw new Error(`Expected http options but got ${typeof optionsOrCb}`); + this.send(command2, optionsOrCb || {}, cb); + } else { + return this.send(command2, optionsOrCb); } + }, "methodImpl"); + const methodName = (command[0].toLowerCase() + command.slice(1)).replace(/Command$/, ""); + Client2.prototype[methodName] = methodImpl; + } + }, "createAggregatedClient"); + var parseBoolean = /* @__PURE__ */ __name((value) => { + switch (value) { + case "true": + return true; + case "false": + return false; + default: + throw new Error(`Unable to parse boolean value "${value}"`); + } + }, "parseBoolean"); + var expectBoolean = /* @__PURE__ */ __name((value) => { + if (value === null || value === void 0) { + return void 0; + } + if (typeof value === "number") { + if (value === 0 || value === 1) { + logger.warn(stackTraceWarning(`Expected boolean, got ${typeof value}: ${value}`)); + } + if (value === 0) { + return false; + } + if (value === 1) { + return true; } - } else { - retryStrategy = retryStrategy; - if (retryStrategy == null ? void 0 : retryStrategy.mode) - context.userAgent = [...context.userAgent || [], ["cfg/retry-mode", retryStrategy.mode]]; - return retryStrategy.retry(next, args); } - }, "retryMiddleware"); - var isRetryStrategyV2 = /* @__PURE__ */ __name((retryStrategy) => typeof retryStrategy.acquireInitialRetryToken !== "undefined" && typeof retryStrategy.refreshRetryTokenForRetry !== "undefined" && typeof retryStrategy.recordSuccess !== "undefined", "isRetryStrategyV2"); - var getRetryErrorInfo = /* @__PURE__ */ __name((error) => { - const errorInfo = { - error, - errorType: getRetryErrorType(error) - }; - const retryAfterHint = getRetryAfterHint(error.$response); - if (retryAfterHint) { - errorInfo.retryAfterHint = retryAfterHint; + if (typeof value === "string") { + const lower = value.toLowerCase(); + if (lower === "false" || lower === "true") { + logger.warn(stackTraceWarning(`Expected boolean, got ${typeof value}: ${value}`)); + } + if (lower === "false") { + return false; + } + if (lower === "true") { + return true; + } } - return errorInfo; - }, "getRetryErrorInfo"); - var getRetryErrorType = /* @__PURE__ */ __name((error) => { - if ((0, import_service_error_classification.isThrottlingError)(error)) - return "THROTTLING"; - if ((0, import_service_error_classification.isTransientError)(error)) - return "TRANSIENT"; - if ((0, import_service_error_classification.isServerError)(error)) - return "SERVER_ERROR"; - return "CLIENT_ERROR"; - }, "getRetryErrorType"); - var retryMiddlewareOptions = { - name: "retryMiddleware", - tags: ["RETRY"], - step: "finalizeRequest", - priority: "high", - override: true - }; - var getRetryPlugin = /* @__PURE__ */ __name((options) => ({ - applyToStack: (clientStack) => { - clientStack.add(retryMiddleware(options), retryMiddlewareOptions); + if (typeof value === "boolean") { + return value; } - }), "getRetryPlugin"); - var getRetryAfterHint = /* @__PURE__ */ __name((response) => { - if (!import_protocol_http.HttpResponse.isInstance(response)) - return; - const retryAfterHeaderName = Object.keys(response.headers).find((key) => key.toLowerCase() === "retry-after"); - if (!retryAfterHeaderName) - return; - const retryAfter = response.headers[retryAfterHeaderName]; - const retryAfterSeconds = Number(retryAfter); - if (!Number.isNaN(retryAfterSeconds)) - return new Date(retryAfterSeconds * 1e3); - const retryAfterDate = new Date(retryAfter); - return retryAfterDate; - }, "getRetryAfterHint"); - } -}); - -// ../../../node_modules/@aws-sdk/client-sfn/dist-cjs/endpoint/EndpointParameters.js -var require_EndpointParameters = __commonJS({ - "../../../node_modules/@aws-sdk/client-sfn/dist-cjs/endpoint/EndpointParameters.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.resolveClientEndpointParameters = void 0; - var resolveClientEndpointParameters = (options) => { - return { - ...options, - useDualstackEndpoint: options.useDualstackEndpoint ?? false, - useFipsEndpoint: options.useFipsEndpoint ?? false, - defaultSigningName: "states" - }; - }; - exports2.resolveClientEndpointParameters = resolveClientEndpointParameters; - } -}); - -// ../../../node_modules/@aws-sdk/client-sfn/package.json -var require_package = __commonJS({ - "../../../node_modules/@aws-sdk/client-sfn/package.json"(exports2, module2) { - module2.exports = { - name: "@aws-sdk/client-sfn", - description: "AWS SDK for JavaScript Sfn Client for Node.js, Browser and React Native", - version: "3.421.0", - scripts: { - build: "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'", - "build:cjs": "tsc -p tsconfig.cjs.json", - "build:docs": "typedoc", - "build:es": "tsc -p tsconfig.es.json", - "build:include:deps": "lerna run --scope $npm_package_name --include-dependencies build", - "build:types": "tsc -p tsconfig.types.json", - "build:types:downlevel": "downlevel-dts dist-types dist-types/ts3.4", - clean: "rimraf ./dist-* && rimraf *.tsbuildinfo", - "extract:docs": "api-extractor run --local", - "generate:client": "node ../../scripts/generate-clients/single-service --solo sfn" - }, - main: "./dist-cjs/index.js", - types: "./dist-types/index.d.ts", - module: "./dist-es/index.js", - sideEffects: false, - dependencies: { - "@aws-crypto/sha256-browser": "3.0.0", - "@aws-crypto/sha256-js": "3.0.0", - "@aws-sdk/client-sts": "3.421.0", - "@aws-sdk/credential-provider-node": "3.421.0", - "@aws-sdk/middleware-host-header": "3.418.0", - "@aws-sdk/middleware-logger": "3.418.0", - "@aws-sdk/middleware-recursion-detection": "3.418.0", - "@aws-sdk/middleware-signing": "3.418.0", - "@aws-sdk/middleware-user-agent": "3.418.0", - "@aws-sdk/region-config-resolver": "3.418.0", - "@aws-sdk/types": "3.418.0", - "@aws-sdk/util-endpoints": "3.418.0", - "@aws-sdk/util-user-agent-browser": "3.418.0", - "@aws-sdk/util-user-agent-node": "3.418.0", - "@smithy/config-resolver": "^2.0.10", - "@smithy/fetch-http-handler": "^2.1.5", - "@smithy/hash-node": "^2.0.9", - "@smithy/invalid-dependency": "^2.0.9", - "@smithy/middleware-content-length": "^2.0.11", - "@smithy/middleware-endpoint": "^2.0.9", - "@smithy/middleware-retry": "^2.0.12", - "@smithy/middleware-serde": "^2.0.9", - "@smithy/middleware-stack": "^2.0.2", - "@smithy/node-config-provider": "^2.0.12", - "@smithy/node-http-handler": "^2.1.5", - "@smithy/protocol-http": "^3.0.5", - "@smithy/smithy-client": "^2.1.6", - "@smithy/types": "^2.3.3", - "@smithy/url-parser": "^2.0.9", - "@smithy/util-base64": "^2.0.0", - "@smithy/util-body-length-browser": "^2.0.0", - "@smithy/util-body-length-node": "^2.1.0", - "@smithy/util-defaults-mode-browser": "^2.0.10", - "@smithy/util-defaults-mode-node": "^2.0.12", - "@smithy/util-retry": "^2.0.2", - "@smithy/util-utf8": "^2.0.0", - tslib: "^2.5.0" - }, - devDependencies: { - "@smithy/service-client-documentation-generator": "^2.0.0", - "@tsconfig/node14": "1.0.3", - "@types/node": "^14.14.31", - concurrently: "7.0.0", - "downlevel-dts": "0.10.1", - rimraf: "3.0.2", - typedoc: "0.23.23", - typescript: "~4.9.5" - }, - engines: { - node: ">=14.0.0" - }, - typesVersions: { - "<4.0": { - "dist-types/*": [ - "dist-types/ts3.4/*" - ] + throw new TypeError(`Expected boolean, got ${typeof value}: ${value}`); + }, "expectBoolean"); + var expectNumber = /* @__PURE__ */ __name((value) => { + if (value === null || value === void 0) { + return void 0; + } + if (typeof value === "string") { + const parsed = parseFloat(value); + if (!Number.isNaN(parsed)) { + if (String(parsed) !== String(value)) { + logger.warn(stackTraceWarning(`Expected number but observed string: ${value}`)); + } + return parsed; } - }, - files: [ - "dist-*/**" - ], - author: { - name: "AWS SDK for JavaScript Team", - url: "https://aws.amazon.com/javascript/" - }, - license: "Apache-2.0", - browser: { - "./dist-es/runtimeConfig": "./dist-es/runtimeConfig.browser" - }, - "react-native": { - "./dist-es/runtimeConfig": "./dist-es/runtimeConfig.native" - }, - homepage: "https://github.com/aws/aws-sdk-js-v3/tree/main/clients/client-sfn", - repository: { - type: "git", - url: "https://github.com/aws/aws-sdk-js-v3.git", - directory: "clients/client-sfn" } - }; - } -}); - -// ../../../node_modules/@aws-sdk/middleware-sdk-sts/dist-cjs/index.js -var require_dist_cjs36 = __commonJS({ - "../../../node_modules/@aws-sdk/middleware-sdk-sts/dist-cjs/index.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.resolveStsAuthConfig = void 0; - var middleware_signing_1 = require_dist_cjs14(); - var resolveStsAuthConfig = (input, { stsClientCtor }) => (0, middleware_signing_1.resolveAwsAuthConfig)({ - ...input, - stsClientCtor - }); - exports2.resolveStsAuthConfig = resolveStsAuthConfig; - } -}); - -// ../../../node_modules/@aws-sdk/client-sts/dist-cjs/endpoint/EndpointParameters.js -var require_EndpointParameters2 = __commonJS({ - "../../../node_modules/@aws-sdk/client-sts/dist-cjs/endpoint/EndpointParameters.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.resolveClientEndpointParameters = void 0; - var resolveClientEndpointParameters = (options) => { - return { - ...options, - useDualstackEndpoint: options.useDualstackEndpoint ?? false, - useFipsEndpoint: options.useFipsEndpoint ?? false, - useGlobalEndpoint: options.useGlobalEndpoint ?? false, - defaultSigningName: "sts" - }; - }; - exports2.resolveClientEndpointParameters = resolveClientEndpointParameters; - } -}); - -// ../../../node_modules/@aws-sdk/client-sts/package.json -var require_package2 = __commonJS({ - "../../../node_modules/@aws-sdk/client-sts/package.json"(exports2, module2) { - module2.exports = { - name: "@aws-sdk/client-sts", - description: "AWS SDK for JavaScript Sts Client for Node.js, Browser and React Native", - version: "3.421.0", - scripts: { - build: "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'", - "build:cjs": "tsc -p tsconfig.cjs.json", - "build:docs": "typedoc", - "build:es": "tsc -p tsconfig.es.json", - "build:include:deps": "lerna run --scope $npm_package_name --include-dependencies build", - "build:types": "tsc -p tsconfig.types.json", - "build:types:downlevel": "downlevel-dts dist-types dist-types/ts3.4", - clean: "rimraf ./dist-* && rimraf *.tsbuildinfo", - "extract:docs": "api-extractor run --local", - "generate:client": "node ../../scripts/generate-clients/single-service --solo sts", - test: "yarn test:unit", - "test:unit": "jest" - }, - main: "./dist-cjs/index.js", - types: "./dist-types/index.d.ts", - module: "./dist-es/index.js", - sideEffects: false, - dependencies: { - "@aws-crypto/sha256-browser": "3.0.0", - "@aws-crypto/sha256-js": "3.0.0", - "@aws-sdk/credential-provider-node": "3.421.0", - "@aws-sdk/middleware-host-header": "3.418.0", - "@aws-sdk/middleware-logger": "3.418.0", - "@aws-sdk/middleware-recursion-detection": "3.418.0", - "@aws-sdk/middleware-sdk-sts": "3.418.0", - "@aws-sdk/middleware-signing": "3.418.0", - "@aws-sdk/middleware-user-agent": "3.418.0", - "@aws-sdk/region-config-resolver": "3.418.0", - "@aws-sdk/types": "3.418.0", - "@aws-sdk/util-endpoints": "3.418.0", - "@aws-sdk/util-user-agent-browser": "3.418.0", - "@aws-sdk/util-user-agent-node": "3.418.0", - "@smithy/config-resolver": "^2.0.10", - "@smithy/fetch-http-handler": "^2.1.5", - "@smithy/hash-node": "^2.0.9", - "@smithy/invalid-dependency": "^2.0.9", - "@smithy/middleware-content-length": "^2.0.11", - "@smithy/middleware-endpoint": "^2.0.9", - "@smithy/middleware-retry": "^2.0.12", - "@smithy/middleware-serde": "^2.0.9", - "@smithy/middleware-stack": "^2.0.2", - "@smithy/node-config-provider": "^2.0.12", - "@smithy/node-http-handler": "^2.1.5", - "@smithy/protocol-http": "^3.0.5", - "@smithy/smithy-client": "^2.1.6", - "@smithy/types": "^2.3.3", - "@smithy/url-parser": "^2.0.9", - "@smithy/util-base64": "^2.0.0", - "@smithy/util-body-length-browser": "^2.0.0", - "@smithy/util-body-length-node": "^2.1.0", - "@smithy/util-defaults-mode-browser": "^2.0.10", - "@smithy/util-defaults-mode-node": "^2.0.12", - "@smithy/util-retry": "^2.0.2", - "@smithy/util-utf8": "^2.0.0", - "fast-xml-parser": "4.2.5", - tslib: "^2.5.0" - }, - devDependencies: { - "@smithy/service-client-documentation-generator": "^2.0.0", - "@tsconfig/node14": "1.0.3", - "@types/node": "^14.14.31", - concurrently: "7.0.0", - "downlevel-dts": "0.10.1", - rimraf: "3.0.2", - typedoc: "0.23.23", - typescript: "~4.9.5" - }, - engines: { - node: ">=14.0.0" - }, - typesVersions: { - "<4.0": { - "dist-types/*": [ - "dist-types/ts3.4/*" - ] + if (typeof value === "number") { + return value; + } + throw new TypeError(`Expected number, got ${typeof value}: ${value}`); + }, "expectNumber"); + var MAX_FLOAT = Math.ceil(2 ** 127 * (2 - 2 ** -23)); + var expectFloat32 = /* @__PURE__ */ __name((value) => { + const expected = expectNumber(value); + if (expected !== void 0 && !Number.isNaN(expected) && expected !== Infinity && expected !== -Infinity) { + if (Math.abs(expected) > MAX_FLOAT) { + throw new TypeError(`Expected 32-bit float, got ${value}`); + } + } + return expected; + }, "expectFloat32"); + var expectLong = /* @__PURE__ */ __name((value) => { + if (value === null || value === void 0) { + return void 0; + } + if (Number.isInteger(value) && !Number.isNaN(value)) { + return value; + } + throw new TypeError(`Expected integer, got ${typeof value}: ${value}`); + }, "expectLong"); + var expectInt = expectLong; + var expectInt32 = /* @__PURE__ */ __name((value) => expectSizedInt(value, 32), "expectInt32"); + var expectShort = /* @__PURE__ */ __name((value) => expectSizedInt(value, 16), "expectShort"); + var expectByte = /* @__PURE__ */ __name((value) => expectSizedInt(value, 8), "expectByte"); + var expectSizedInt = /* @__PURE__ */ __name((value, size) => { + const expected = expectLong(value); + if (expected !== void 0 && castInt(expected, size) !== expected) { + throw new TypeError(`Expected ${size}-bit integer, got ${value}`); + } + return expected; + }, "expectSizedInt"); + var castInt = /* @__PURE__ */ __name((value, size) => { + switch (size) { + case 32: + return Int32Array.of(value)[0]; + case 16: + return Int16Array.of(value)[0]; + case 8: + return Int8Array.of(value)[0]; + } + }, "castInt"); + var expectNonNull = /* @__PURE__ */ __name((value, location) => { + if (value === null || value === void 0) { + if (location) { + throw new TypeError(`Expected a non-null value for ${location}`); } - }, - files: [ - "dist-*/**" - ], - author: { - name: "AWS SDK for JavaScript Team", - url: "https://aws.amazon.com/javascript/" - }, - license: "Apache-2.0", - browser: { - "./dist-es/runtimeConfig": "./dist-es/runtimeConfig.browser" - }, - "react-native": { - "./dist-es/runtimeConfig": "./dist-es/runtimeConfig.native" - }, - homepage: "https://github.com/aws/aws-sdk-js-v3/tree/main/clients/client-sts", - repository: { - type: "git", - url: "https://github.com/aws/aws-sdk-js-v3.git", - directory: "clients/client-sts" + throw new TypeError("Expected a non-null value"); } - }; - } -}); - -// ../../../node_modules/@aws-sdk/client-sts/dist-cjs/models/STSServiceException.js -var require_STSServiceException = __commonJS({ - "../../../node_modules/@aws-sdk/client-sts/dist-cjs/models/STSServiceException.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.STSServiceException = exports2.__ServiceException = void 0; - var smithy_client_1 = require_dist_cjs34(); - Object.defineProperty(exports2, "__ServiceException", { enumerable: true, get: function() { - return smithy_client_1.ServiceException; - } }); - var STSServiceException = class _STSServiceException extends smithy_client_1.ServiceException { - constructor(options) { - super(options); - Object.setPrototypeOf(this, _STSServiceException.prototype); + return value; + }, "expectNonNull"); + var expectObject = /* @__PURE__ */ __name((value) => { + if (value === null || value === void 0) { + return void 0; } - }; - exports2.STSServiceException = STSServiceException; - } -}); - -// ../../../node_modules/@aws-sdk/client-sts/dist-cjs/models/models_0.js -var require_models_0 = __commonJS({ - "../../../node_modules/@aws-sdk/client-sts/dist-cjs/models/models_0.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.GetSessionTokenResponseFilterSensitiveLog = exports2.GetFederationTokenResponseFilterSensitiveLog = exports2.AssumeRoleWithWebIdentityResponseFilterSensitiveLog = exports2.AssumeRoleWithWebIdentityRequestFilterSensitiveLog = exports2.AssumeRoleWithSAMLResponseFilterSensitiveLog = exports2.AssumeRoleWithSAMLRequestFilterSensitiveLog = exports2.AssumeRoleResponseFilterSensitiveLog = exports2.CredentialsFilterSensitiveLog = exports2.InvalidAuthorizationMessageException = exports2.IDPCommunicationErrorException = exports2.InvalidIdentityTokenException = exports2.IDPRejectedClaimException = exports2.RegionDisabledException = exports2.PackedPolicyTooLargeException = exports2.MalformedPolicyDocumentException = exports2.ExpiredTokenException = void 0; - var smithy_client_1 = require_dist_cjs34(); - var STSServiceException_1 = require_STSServiceException(); - var ExpiredTokenException = class _ExpiredTokenException extends STSServiceException_1.STSServiceException { - constructor(opts) { - super({ - name: "ExpiredTokenException", - $fault: "client", - ...opts - }); - this.name = "ExpiredTokenException"; - this.$fault = "client"; - Object.setPrototypeOf(this, _ExpiredTokenException.prototype); + if (typeof value === "object" && !Array.isArray(value)) { + return value; } - }; - exports2.ExpiredTokenException = ExpiredTokenException; - var MalformedPolicyDocumentException = class _MalformedPolicyDocumentException extends STSServiceException_1.STSServiceException { - constructor(opts) { - super({ - name: "MalformedPolicyDocumentException", - $fault: "client", - ...opts - }); - this.name = "MalformedPolicyDocumentException"; - this.$fault = "client"; - Object.setPrototypeOf(this, _MalformedPolicyDocumentException.prototype); + const receivedType = Array.isArray(value) ? "array" : typeof value; + throw new TypeError(`Expected object, got ${receivedType}: ${value}`); + }, "expectObject"); + var expectString = /* @__PURE__ */ __name((value) => { + if (value === null || value === void 0) { + return void 0; } - }; - exports2.MalformedPolicyDocumentException = MalformedPolicyDocumentException; - var PackedPolicyTooLargeException = class _PackedPolicyTooLargeException extends STSServiceException_1.STSServiceException { - constructor(opts) { - super({ - name: "PackedPolicyTooLargeException", - $fault: "client", - ...opts - }); - this.name = "PackedPolicyTooLargeException"; - this.$fault = "client"; - Object.setPrototypeOf(this, _PackedPolicyTooLargeException.prototype); + if (typeof value === "string") { + return value; } - }; - exports2.PackedPolicyTooLargeException = PackedPolicyTooLargeException; - var RegionDisabledException = class _RegionDisabledException extends STSServiceException_1.STSServiceException { - constructor(opts) { - super({ - name: "RegionDisabledException", - $fault: "client", - ...opts - }); - this.name = "RegionDisabledException"; - this.$fault = "client"; - Object.setPrototypeOf(this, _RegionDisabledException.prototype); + if (["boolean", "number", "bigint"].includes(typeof value)) { + logger.warn(stackTraceWarning(`Expected string, got ${typeof value}: ${value}`)); + return String(value); } - }; - exports2.RegionDisabledException = RegionDisabledException; - var IDPRejectedClaimException = class _IDPRejectedClaimException extends STSServiceException_1.STSServiceException { - constructor(opts) { - super({ - name: "IDPRejectedClaimException", - $fault: "client", - ...opts - }); - this.name = "IDPRejectedClaimException"; - this.$fault = "client"; - Object.setPrototypeOf(this, _IDPRejectedClaimException.prototype); + throw new TypeError(`Expected string, got ${typeof value}: ${value}`); + }, "expectString"); + var expectUnion2 = /* @__PURE__ */ __name((value) => { + if (value === null || value === void 0) { + return void 0; } - }; - exports2.IDPRejectedClaimException = IDPRejectedClaimException; - var InvalidIdentityTokenException = class _InvalidIdentityTokenException extends STSServiceException_1.STSServiceException { - constructor(opts) { - super({ - name: "InvalidIdentityTokenException", - $fault: "client", - ...opts - }); - this.name = "InvalidIdentityTokenException"; - this.$fault = "client"; - Object.setPrototypeOf(this, _InvalidIdentityTokenException.prototype); + const asObject = expectObject(value); + const setKeys = Object.entries(asObject).filter(([, v]) => v != null).map(([k]) => k); + if (setKeys.length === 0) { + throw new TypeError(`Unions must have exactly one non-null member. None were found.`); + } + if (setKeys.length > 1) { + throw new TypeError(`Unions must have exactly one non-null member. Keys ${setKeys} were not null.`); + } + return asObject; + }, "expectUnion"); + var strictParseDouble = /* @__PURE__ */ __name((value) => { + if (typeof value == "string") { + return expectNumber(parseNumber(value)); + } + return expectNumber(value); + }, "strictParseDouble"); + var strictParseFloat = strictParseDouble; + var strictParseFloat32 = /* @__PURE__ */ __name((value) => { + if (typeof value == "string") { + return expectFloat32(parseNumber(value)); + } + return expectFloat32(value); + }, "strictParseFloat32"); + var NUMBER_REGEX = /(-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?)|(-?Infinity)|(NaN)/g; + var parseNumber = /* @__PURE__ */ __name((value) => { + const matches = value.match(NUMBER_REGEX); + if (matches === null || matches[0].length !== value.length) { + throw new TypeError(`Expected real number, got implicit NaN`); + } + return parseFloat(value); + }, "parseNumber"); + var limitedParseDouble = /* @__PURE__ */ __name((value) => { + if (typeof value == "string") { + return parseFloatString(value); + } + return expectNumber(value); + }, "limitedParseDouble"); + var handleFloat = limitedParseDouble; + var limitedParseFloat = limitedParseDouble; + var limitedParseFloat32 = /* @__PURE__ */ __name((value) => { + if (typeof value == "string") { + return parseFloatString(value); + } + return expectFloat32(value); + }, "limitedParseFloat32"); + var parseFloatString = /* @__PURE__ */ __name((value) => { + switch (value) { + case "NaN": + return NaN; + case "Infinity": + return Infinity; + case "-Infinity": + return -Infinity; + default: + throw new Error(`Unable to parse float value: ${value}`); + } + }, "parseFloatString"); + var strictParseLong = /* @__PURE__ */ __name((value) => { + if (typeof value === "string") { + return expectLong(parseNumber(value)); + } + return expectLong(value); + }, "strictParseLong"); + var strictParseInt = strictParseLong; + var strictParseInt32 = /* @__PURE__ */ __name((value) => { + if (typeof value === "string") { + return expectInt32(parseNumber(value)); + } + return expectInt32(value); + }, "strictParseInt32"); + var strictParseShort = /* @__PURE__ */ __name((value) => { + if (typeof value === "string") { + return expectShort(parseNumber(value)); + } + return expectShort(value); + }, "strictParseShort"); + var strictParseByte = /* @__PURE__ */ __name((value) => { + if (typeof value === "string") { + return expectByte(parseNumber(value)); } + return expectByte(value); + }, "strictParseByte"); + var stackTraceWarning = /* @__PURE__ */ __name((message) => { + return String(new TypeError(message).stack || message).split("\n").slice(0, 5).filter((s) => !s.includes("stackTraceWarning")).join("\n"); + }, "stackTraceWarning"); + var logger = { + warn: console.warn }; - exports2.InvalidIdentityTokenException = InvalidIdentityTokenException; - var IDPCommunicationErrorException = class _IDPCommunicationErrorException extends STSServiceException_1.STSServiceException { - constructor(opts) { - super({ - name: "IDPCommunicationErrorException", - $fault: "client", - ...opts - }); - this.name = "IDPCommunicationErrorException"; - this.$fault = "client"; - Object.setPrototypeOf(this, _IDPCommunicationErrorException.prototype); + var DAYS = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"]; + var MONTHS = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]; + function dateToUtcString(date) { + const year = date.getUTCFullYear(); + const month = date.getUTCMonth(); + const dayOfWeek = date.getUTCDay(); + const dayOfMonthInt = date.getUTCDate(); + const hoursInt = date.getUTCHours(); + const minutesInt = date.getUTCMinutes(); + const secondsInt = date.getUTCSeconds(); + const dayOfMonthString = dayOfMonthInt < 10 ? `0${dayOfMonthInt}` : `${dayOfMonthInt}`; + const hoursString = hoursInt < 10 ? `0${hoursInt}` : `${hoursInt}`; + const minutesString = minutesInt < 10 ? `0${minutesInt}` : `${minutesInt}`; + const secondsString = secondsInt < 10 ? `0${secondsInt}` : `${secondsInt}`; + return `${DAYS[dayOfWeek]}, ${dayOfMonthString} ${MONTHS[month]} ${year} ${hoursString}:${minutesString}:${secondsString} GMT`; + } + __name(dateToUtcString, "dateToUtcString"); + var RFC3339 = new RegExp(/^(\d{4})-(\d{2})-(\d{2})[tT](\d{2}):(\d{2}):(\d{2})(?:\.(\d+))?[zZ]$/); + var parseRfc3339DateTime = /* @__PURE__ */ __name((value) => { + if (value === null || value === void 0) { + return void 0; } - }; - exports2.IDPCommunicationErrorException = IDPCommunicationErrorException; - var InvalidAuthorizationMessageException = class _InvalidAuthorizationMessageException extends STSServiceException_1.STSServiceException { - constructor(opts) { - super({ - name: "InvalidAuthorizationMessageException", - $fault: "client", - ...opts - }); - this.name = "InvalidAuthorizationMessageException"; - this.$fault = "client"; - Object.setPrototypeOf(this, _InvalidAuthorizationMessageException.prototype); + if (typeof value !== "string") { + throw new TypeError("RFC-3339 date-times must be expressed as strings"); } - }; - exports2.InvalidAuthorizationMessageException = InvalidAuthorizationMessageException; - var CredentialsFilterSensitiveLog = (obj) => ({ - ...obj, - ...obj.SecretAccessKey && { SecretAccessKey: smithy_client_1.SENSITIVE_STRING } - }); - exports2.CredentialsFilterSensitiveLog = CredentialsFilterSensitiveLog; - var AssumeRoleResponseFilterSensitiveLog = (obj) => ({ - ...obj, - ...obj.Credentials && { Credentials: (0, exports2.CredentialsFilterSensitiveLog)(obj.Credentials) } - }); - exports2.AssumeRoleResponseFilterSensitiveLog = AssumeRoleResponseFilterSensitiveLog; - var AssumeRoleWithSAMLRequestFilterSensitiveLog = (obj) => ({ - ...obj, - ...obj.SAMLAssertion && { SAMLAssertion: smithy_client_1.SENSITIVE_STRING } - }); - exports2.AssumeRoleWithSAMLRequestFilterSensitiveLog = AssumeRoleWithSAMLRequestFilterSensitiveLog; - var AssumeRoleWithSAMLResponseFilterSensitiveLog = (obj) => ({ - ...obj, - ...obj.Credentials && { Credentials: (0, exports2.CredentialsFilterSensitiveLog)(obj.Credentials) } - }); - exports2.AssumeRoleWithSAMLResponseFilterSensitiveLog = AssumeRoleWithSAMLResponseFilterSensitiveLog; - var AssumeRoleWithWebIdentityRequestFilterSensitiveLog = (obj) => ({ - ...obj, - ...obj.WebIdentityToken && { WebIdentityToken: smithy_client_1.SENSITIVE_STRING } - }); - exports2.AssumeRoleWithWebIdentityRequestFilterSensitiveLog = AssumeRoleWithWebIdentityRequestFilterSensitiveLog; - var AssumeRoleWithWebIdentityResponseFilterSensitiveLog = (obj) => ({ - ...obj, - ...obj.Credentials && { Credentials: (0, exports2.CredentialsFilterSensitiveLog)(obj.Credentials) } - }); - exports2.AssumeRoleWithWebIdentityResponseFilterSensitiveLog = AssumeRoleWithWebIdentityResponseFilterSensitiveLog; - var GetFederationTokenResponseFilterSensitiveLog = (obj) => ({ - ...obj, - ...obj.Credentials && { Credentials: (0, exports2.CredentialsFilterSensitiveLog)(obj.Credentials) } - }); - exports2.GetFederationTokenResponseFilterSensitiveLog = GetFederationTokenResponseFilterSensitiveLog; - var GetSessionTokenResponseFilterSensitiveLog = (obj) => ({ - ...obj, - ...obj.Credentials && { Credentials: (0, exports2.CredentialsFilterSensitiveLog)(obj.Credentials) } - }); - exports2.GetSessionTokenResponseFilterSensitiveLog = GetSessionTokenResponseFilterSensitiveLog; - } -}); - -// ../../../node_modules/fast-xml-parser/src/util.js -var require_util2 = __commonJS({ - "../../../node_modules/fast-xml-parser/src/util.js"(exports2) { - "use strict"; - var nameStartChar = ":A-Za-z_\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD"; - var nameChar = nameStartChar + "\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040"; - var nameRegexp = "[" + nameStartChar + "][" + nameChar + "]*"; - var regexName = new RegExp("^" + nameRegexp + "$"); - var getAllMatches = function(string, regex) { - const matches = []; - let match = regex.exec(string); - while (match) { - const allmatches = []; - allmatches.startIndex = regex.lastIndex - match[0].length; - const len = match.length; - for (let index = 0; index < len; index++) { - allmatches.push(match[index]); - } - matches.push(allmatches); - match = regex.exec(string); + const match = RFC3339.exec(value); + if (!match) { + throw new TypeError("Invalid RFC-3339 date-time value"); } - return matches; - }; - var isName = function(string) { - const match = regexName.exec(string); - return !(match === null || typeof match === "undefined"); - }; - exports2.isExist = function(v) { - return typeof v !== "undefined"; - }; - exports2.isEmptyObject = function(obj) { - return Object.keys(obj).length === 0; - }; - exports2.merge = function(target, a, arrayMode) { - if (a) { - const keys = Object.keys(a); - const len = keys.length; - for (let i = 0; i < len; i++) { - if (arrayMode === "strict") { - target[keys[i]] = [a[keys[i]]]; - } else { - target[keys[i]] = a[keys[i]]; - } - } + const [_, yearStr, monthStr, dayStr, hours, minutes, seconds, fractionalMilliseconds] = match; + const year = strictParseShort(stripLeadingZeroes(yearStr)); + const month = parseDateValue(monthStr, "month", 1, 12); + const day = parseDateValue(dayStr, "day", 1, 31); + return buildDate(year, month, day, { hours, minutes, seconds, fractionalMilliseconds }); + }, "parseRfc3339DateTime"); + var RFC3339_WITH_OFFSET = new RegExp( + /^(\d{4})-(\d{2})-(\d{2})[tT](\d{2}):(\d{2}):(\d{2})(?:\.(\d+))?(([-+]\d{2}\:\d{2})|[zZ])$/ + ); + var parseRfc3339DateTimeWithOffset = /* @__PURE__ */ __name((value) => { + if (value === null || value === void 0) { + return void 0; } - }; - exports2.getValue = function(v) { - if (exports2.isExist(v)) { - return v; - } else { - return ""; + if (typeof value !== "string") { + throw new TypeError("RFC-3339 date-times must be expressed as strings"); } - }; - exports2.isName = isName; - exports2.getAllMatches = getAllMatches; - exports2.nameRegexp = nameRegexp; - } -}); - -// ../../../node_modules/fast-xml-parser/src/validator.js -var require_validator = __commonJS({ - "../../../node_modules/fast-xml-parser/src/validator.js"(exports2) { - "use strict"; - var util = require_util2(); - var defaultOptions = { - allowBooleanAttributes: false, - //A tag can have attributes without any value - unpairedTags: [] - }; - exports2.validate = function(xmlData, options) { - options = Object.assign({}, defaultOptions, options); - const tags = []; - let tagFound = false; - let reachedRoot = false; - if (xmlData[0] === "\uFEFF") { - xmlData = xmlData.substr(1); + const match = RFC3339_WITH_OFFSET.exec(value); + if (!match) { + throw new TypeError("Invalid RFC-3339 date-time value"); } - for (let i = 0; i < xmlData.length; i++) { - if (xmlData[i] === "<" && xmlData[i + 1] === "?") { - i += 2; - i = readPI(xmlData, i); - if (i.err) return i; - } else if (xmlData[i] === "<") { - let tagStartPos = i; - i++; - if (xmlData[i] === "!") { - i = readCommentAndCDATA(xmlData, i); - continue; - } else { - let closingTag = false; - if (xmlData[i] === "/") { - closingTag = true; - i++; - } - let tagName = ""; - for (; i < xmlData.length && xmlData[i] !== ">" && xmlData[i] !== " " && xmlData[i] !== " " && xmlData[i] !== "\n" && xmlData[i] !== "\r"; i++) { - tagName += xmlData[i]; - } - tagName = tagName.trim(); - if (tagName[tagName.length - 1] === "/") { - tagName = tagName.substring(0, tagName.length - 1); - i--; - } - if (!validateTagName(tagName)) { - let msg; - if (tagName.trim().length === 0) { - msg = "Invalid space after '<'."; - } else { - msg = "Tag '" + tagName + "' is an invalid name."; - } - return getErrorObject("InvalidTag", msg, getLineNumberForPosition(xmlData, i)); - } - const result = readAttributeStr(xmlData, i); - if (result === false) { - return getErrorObject("InvalidAttr", "Attributes for '" + tagName + "' have open quote.", getLineNumberForPosition(xmlData, i)); - } - let attrStr = result.value; - i = result.index; - if (attrStr[attrStr.length - 1] === "/") { - const attrStrStart = i - attrStr.length; - attrStr = attrStr.substring(0, attrStr.length - 1); - const isValid = validateAttributeString(attrStr, options); - if (isValid === true) { - tagFound = true; - } else { - return getErrorObject(isValid.err.code, isValid.err.msg, getLineNumberForPosition(xmlData, attrStrStart + isValid.err.line)); - } - } else if (closingTag) { - if (!result.tagClosed) { - return getErrorObject("InvalidTag", "Closing tag '" + tagName + "' doesn't have proper closing.", getLineNumberForPosition(xmlData, i)); - } else if (attrStr.trim().length > 0) { - return getErrorObject("InvalidTag", "Closing tag '" + tagName + "' can't have attributes or invalid starting.", getLineNumberForPosition(xmlData, tagStartPos)); - } else { - const otg = tags.pop(); - if (tagName !== otg.tagName) { - let openPos = getLineNumberForPosition(xmlData, otg.tagStartPos); - return getErrorObject( - "InvalidTag", - "Expected closing tag '" + otg.tagName + "' (opened in line " + openPos.line + ", col " + openPos.col + ") instead of closing tag '" + tagName + "'.", - getLineNumberForPosition(xmlData, tagStartPos) - ); - } - if (tags.length == 0) { - reachedRoot = true; - } - } - } else { - const isValid = validateAttributeString(attrStr, options); - if (isValid !== true) { - return getErrorObject(isValid.err.code, isValid.err.msg, getLineNumberForPosition(xmlData, i - attrStr.length + isValid.err.line)); - } - if (reachedRoot === true) { - return getErrorObject("InvalidXml", "Multiple possible root nodes found.", getLineNumberForPosition(xmlData, i)); - } else if (options.unpairedTags.indexOf(tagName) !== -1) { - } else { - tags.push({ tagName, tagStartPos }); - } - tagFound = true; - } - for (i++; i < xmlData.length; i++) { - if (xmlData[i] === "<") { - if (xmlData[i + 1] === "!") { - i++; - i = readCommentAndCDATA(xmlData, i); - continue; - } else if (xmlData[i + 1] === "?") { - i = readPI(xmlData, ++i); - if (i.err) return i; - } else { - break; - } - } else if (xmlData[i] === "&") { - const afterAmp = validateAmpersand(xmlData, i); - if (afterAmp == -1) - return getErrorObject("InvalidChar", "char '&' is not expected.", getLineNumberForPosition(xmlData, i)); - i = afterAmp; - } else { - if (reachedRoot === true && !isWhiteSpace(xmlData[i])) { - return getErrorObject("InvalidXml", "Extra text at the end", getLineNumberForPosition(xmlData, i)); - } - } - } - if (xmlData[i] === "<") { - i--; - } - } - } else { - if (isWhiteSpace(xmlData[i])) { - continue; - } - return getErrorObject("InvalidChar", "char '" + xmlData[i] + "' is not expected.", getLineNumberForPosition(xmlData, i)); - } + const [_, yearStr, monthStr, dayStr, hours, minutes, seconds, fractionalMilliseconds, offsetStr] = match; + const year = strictParseShort(stripLeadingZeroes(yearStr)); + const month = parseDateValue(monthStr, "month", 1, 12); + const day = parseDateValue(dayStr, "day", 1, 31); + const date = buildDate(year, month, day, { hours, minutes, seconds, fractionalMilliseconds }); + if (offsetStr.toUpperCase() != "Z") { + date.setTime(date.getTime() - parseOffsetToMilliseconds(offsetStr)); + } + return date; + }, "parseRfc3339DateTimeWithOffset"); + var IMF_FIXDATE = new RegExp( + /^(?:Mon|Tue|Wed|Thu|Fri|Sat|Sun), (\d{2}) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) (\d{4}) (\d{1,2}):(\d{2}):(\d{2})(?:\.(\d+))? GMT$/ + ); + var RFC_850_DATE = new RegExp( + /^(?:Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday), (\d{2})-(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)-(\d{2}) (\d{1,2}):(\d{2}):(\d{2})(?:\.(\d+))? GMT$/ + ); + var ASC_TIME = new RegExp( + /^(?:Mon|Tue|Wed|Thu|Fri|Sat|Sun) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) ( [1-9]|\d{2}) (\d{1,2}):(\d{2}):(\d{2})(?:\.(\d+))? (\d{4})$/ + ); + var parseRfc7231DateTime = /* @__PURE__ */ __name((value) => { + if (value === null || value === void 0) { + return void 0; } - if (!tagFound) { - return getErrorObject("InvalidXml", "Start tag expected.", 1); - } else if (tags.length == 1) { - return getErrorObject("InvalidTag", "Unclosed tag '" + tags[0].tagName + "'.", getLineNumberForPosition(xmlData, tags[0].tagStartPos)); - } else if (tags.length > 0) { - return getErrorObject("InvalidXml", "Invalid '" + JSON.stringify(tags.map((t) => t.tagName), null, 4).replace(/\r?\n/g, "") + "' found.", { line: 1, col: 1 }); + if (typeof value !== "string") { + throw new TypeError("RFC-7231 date-times must be expressed as strings"); } - return true; - }; - function isWhiteSpace(char) { - return char === " " || char === " " || char === "\n" || char === "\r"; - } - function readPI(xmlData, i) { - const start = i; - for (; i < xmlData.length; i++) { - if (xmlData[i] == "?" || xmlData[i] == " ") { - const tagname = xmlData.substr(start, i - start); - if (i > 5 && tagname === "xml") { - return getErrorObject("InvalidXml", "XML declaration allowed only at the start of the document.", getLineNumberForPosition(xmlData, i)); - } else if (xmlData[i] == "?" && xmlData[i + 1] == ">") { - i++; - break; - } else { - continue; - } - } + let match = IMF_FIXDATE.exec(value); + if (match) { + const [_, dayStr, monthStr, yearStr, hours, minutes, seconds, fractionalMilliseconds] = match; + return buildDate( + strictParseShort(stripLeadingZeroes(yearStr)), + parseMonthByShortName(monthStr), + parseDateValue(dayStr, "day", 1, 31), + { hours, minutes, seconds, fractionalMilliseconds } + ); } - return i; - } - function readCommentAndCDATA(xmlData, i) { - if (xmlData.length > i + 5 && xmlData[i + 1] === "-" && xmlData[i + 2] === "-") { - for (i += 3; i < xmlData.length; i++) { - if (xmlData[i] === "-" && xmlData[i + 1] === "-" && xmlData[i + 2] === ">") { - i += 2; - break; - } - } - } else if (xmlData.length > i + 8 && xmlData[i + 1] === "D" && xmlData[i + 2] === "O" && xmlData[i + 3] === "C" && xmlData[i + 4] === "T" && xmlData[i + 5] === "Y" && xmlData[i + 6] === "P" && xmlData[i + 7] === "E") { - let angleBracketsCount = 1; - for (i += 8; i < xmlData.length; i++) { - if (xmlData[i] === "<") { - angleBracketsCount++; - } else if (xmlData[i] === ">") { - angleBracketsCount--; - if (angleBracketsCount === 0) { - break; - } - } - } - } else if (xmlData.length > i + 9 && xmlData[i + 1] === "[" && xmlData[i + 2] === "C" && xmlData[i + 3] === "D" && xmlData[i + 4] === "A" && xmlData[i + 5] === "T" && xmlData[i + 6] === "A" && xmlData[i + 7] === "[") { - for (i += 8; i < xmlData.length; i++) { - if (xmlData[i] === "]" && xmlData[i + 1] === "]" && xmlData[i + 2] === ">") { - i += 2; - break; - } - } + match = RFC_850_DATE.exec(value); + if (match) { + const [_, dayStr, monthStr, yearStr, hours, minutes, seconds, fractionalMilliseconds] = match; + return adjustRfc850Year( + buildDate(parseTwoDigitYear(yearStr), parseMonthByShortName(monthStr), parseDateValue(dayStr, "day", 1, 31), { + hours, + minutes, + seconds, + fractionalMilliseconds + }) + ); } - return i; - } - var doubleQuote = '"'; - var singleQuote = "'"; - function readAttributeStr(xmlData, i) { - let attrStr = ""; - let startChar = ""; - let tagClosed = false; - for (; i < xmlData.length; i++) { - if (xmlData[i] === doubleQuote || xmlData[i] === singleQuote) { - if (startChar === "") { - startChar = xmlData[i]; - } else if (startChar !== xmlData[i]) { - } else { - startChar = ""; - } - } else if (xmlData[i] === ">") { - if (startChar === "") { - tagClosed = true; - break; - } - } - attrStr += xmlData[i]; + match = ASC_TIME.exec(value); + if (match) { + const [_, monthStr, dayStr, hours, minutes, seconds, fractionalMilliseconds, yearStr] = match; + return buildDate( + strictParseShort(stripLeadingZeroes(yearStr)), + parseMonthByShortName(monthStr), + parseDateValue(dayStr.trimLeft(), "day", 1, 31), + { hours, minutes, seconds, fractionalMilliseconds } + ); } - if (startChar !== "") { - return false; + throw new TypeError("Invalid RFC-7231 date-time value"); + }, "parseRfc7231DateTime"); + var parseEpochTimestamp = /* @__PURE__ */ __name((value) => { + if (value === null || value === void 0) { + return void 0; } - return { - value: attrStr, - index: i, - tagClosed - }; - } - var validAttrStrRegxp = new RegExp(`(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['"])(([\\s\\S])*?)\\5)?`, "g"); - function validateAttributeString(attrStr, options) { - const matches = util.getAllMatches(attrStr, validAttrStrRegxp); - const attrNames = {}; - for (let i = 0; i < matches.length; i++) { - if (matches[i][1].length === 0) { - return getErrorObject("InvalidAttr", "Attribute '" + matches[i][2] + "' has no space in starting.", getPositionFromMatch(matches[i])); - } else if (matches[i][3] !== void 0 && matches[i][4] === void 0) { - return getErrorObject("InvalidAttr", "Attribute '" + matches[i][2] + "' is without value.", getPositionFromMatch(matches[i])); - } else if (matches[i][3] === void 0 && !options.allowBooleanAttributes) { - return getErrorObject("InvalidAttr", "boolean attribute '" + matches[i][2] + "' is not allowed.", getPositionFromMatch(matches[i])); - } - const attrName = matches[i][2]; - if (!validateAttrName(attrName)) { - return getErrorObject("InvalidAttr", "Attribute '" + attrName + "' is an invalid name.", getPositionFromMatch(matches[i])); - } - if (!attrNames.hasOwnProperty(attrName)) { - attrNames[attrName] = 1; - } else { - return getErrorObject("InvalidAttr", "Attribute '" + attrName + "' is repeated.", getPositionFromMatch(matches[i])); - } + let valueAsDouble; + if (typeof value === "number") { + valueAsDouble = value; + } else if (typeof value === "string") { + valueAsDouble = strictParseDouble(value); + } else if (typeof value === "object" && value.tag === 1) { + valueAsDouble = value.value; + } else { + throw new TypeError("Epoch timestamps must be expressed as floating point numbers or their string representation"); + } + if (Number.isNaN(valueAsDouble) || valueAsDouble === Infinity || valueAsDouble === -Infinity) { + throw new TypeError("Epoch timestamps must be valid, non-Infinite, non-NaN numerics"); + } + return new Date(Math.round(valueAsDouble * 1e3)); + }, "parseEpochTimestamp"); + var buildDate = /* @__PURE__ */ __name((year, month, day, time) => { + const adjustedMonth = month - 1; + validateDayOfMonth(year, adjustedMonth, day); + return new Date( + Date.UTC( + year, + adjustedMonth, + day, + parseDateValue(time.hours, "hour", 0, 23), + parseDateValue(time.minutes, "minute", 0, 59), + // seconds can go up to 60 for leap seconds + parseDateValue(time.seconds, "seconds", 0, 60), + parseMilliseconds(time.fractionalMilliseconds) + ) + ); + }, "buildDate"); + var parseTwoDigitYear = /* @__PURE__ */ __name((value) => { + const thisYear = (/* @__PURE__ */ new Date()).getUTCFullYear(); + const valueInThisCentury = Math.floor(thisYear / 100) * 100 + strictParseShort(stripLeadingZeroes(value)); + if (valueInThisCentury < thisYear) { + return valueInThisCentury + 100; + } + return valueInThisCentury; + }, "parseTwoDigitYear"); + var FIFTY_YEARS_IN_MILLIS = 50 * 365 * 24 * 60 * 60 * 1e3; + var adjustRfc850Year = /* @__PURE__ */ __name((input) => { + if (input.getTime() - (/* @__PURE__ */ new Date()).getTime() > FIFTY_YEARS_IN_MILLIS) { + return new Date( + Date.UTC( + input.getUTCFullYear() - 100, + input.getUTCMonth(), + input.getUTCDate(), + input.getUTCHours(), + input.getUTCMinutes(), + input.getUTCSeconds(), + input.getUTCMilliseconds() + ) + ); + } + return input; + }, "adjustRfc850Year"); + var parseMonthByShortName = /* @__PURE__ */ __name((value) => { + const monthIdx = MONTHS.indexOf(value); + if (monthIdx < 0) { + throw new TypeError(`Invalid month: ${value}`); + } + return monthIdx + 1; + }, "parseMonthByShortName"); + var DAYS_IN_MONTH = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]; + var validateDayOfMonth = /* @__PURE__ */ __name((year, month, day) => { + let maxDays = DAYS_IN_MONTH[month]; + if (month === 1 && isLeapYear(year)) { + maxDays = 29; + } + if (day > maxDays) { + throw new TypeError(`Invalid day for ${MONTHS[month]} in ${year}: ${day}`); + } + }, "validateDayOfMonth"); + var isLeapYear = /* @__PURE__ */ __name((year) => { + return year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0); + }, "isLeapYear"); + var parseDateValue = /* @__PURE__ */ __name((value, type, lower, upper) => { + const dateVal = strictParseByte(stripLeadingZeroes(value)); + if (dateVal < lower || dateVal > upper) { + throw new TypeError(`${type} must be between ${lower} and ${upper}, inclusive`); + } + return dateVal; + }, "parseDateValue"); + var parseMilliseconds = /* @__PURE__ */ __name((value) => { + if (value === null || value === void 0) { + return 0; + } + return strictParseFloat32("0." + value) * 1e3; + }, "parseMilliseconds"); + var parseOffsetToMilliseconds = /* @__PURE__ */ __name((value) => { + const directionStr = value[0]; + let direction = 1; + if (directionStr == "+") { + direction = 1; + } else if (directionStr == "-") { + direction = -1; + } else { + throw new TypeError(`Offset direction, ${directionStr}, must be "+" or "-"`); + } + const hour = Number(value.substring(1, 3)); + const minute = Number(value.substring(4, 6)); + return direction * (hour * 60 + minute) * 60 * 1e3; + }, "parseOffsetToMilliseconds"); + var stripLeadingZeroes = /* @__PURE__ */ __name((value) => { + let idx = 0; + while (idx < value.length - 1 && value.charAt(idx) === "0") { + idx++; + } + if (idx === 0) { + return value; } - return true; - } - function validateNumberAmpersand(xmlData, i) { - let re = /\d/; - if (xmlData[i] === "x") { - i++; - re = /[\da-fA-F]/; + return value.slice(idx); + }, "stripLeadingZeroes"); + var _ServiceException = class _ServiceException2 extends Error { + constructor(options) { + super(options.message); + Object.setPrototypeOf(this, _ServiceException2.prototype); + this.name = options.name; + this.$fault = options.$fault; + this.$metadata = options.$metadata; } - for (; i < xmlData.length; i++) { - if (xmlData[i] === ";") - return i; - if (!xmlData[i].match(re)) - break; + }; + __name(_ServiceException, "ServiceException"); + var ServiceException = _ServiceException; + var decorateServiceException = /* @__PURE__ */ __name((exception, additions = {}) => { + Object.entries(additions).filter(([, v]) => v !== void 0).forEach(([k, v]) => { + if (exception[k] == void 0 || exception[k] === "") { + exception[k] = v; + } + }); + const message = exception.message || exception.Message || "UnknownError"; + exception.message = message; + delete exception.Message; + return exception; + }, "decorateServiceException"); + var throwDefaultError = /* @__PURE__ */ __name(({ output, parsedBody, exceptionCtor, errorCode }) => { + const $metadata = deserializeMetadata(output); + const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : void 0; + const response = new exceptionCtor({ + name: (parsedBody == null ? void 0 : parsedBody.code) || (parsedBody == null ? void 0 : parsedBody.Code) || errorCode || statusCode || "UnknownError", + $fault: "client", + $metadata + }); + throw decorateServiceException(response, parsedBody); + }, "throwDefaultError"); + var withBaseException = /* @__PURE__ */ __name((ExceptionCtor) => { + return ({ output, parsedBody, errorCode }) => { + throwDefaultError({ output, parsedBody, exceptionCtor: ExceptionCtor, errorCode }); + }; + }, "withBaseException"); + var deserializeMetadata = /* @__PURE__ */ __name((output) => ({ + httpStatusCode: output.statusCode, + requestId: output.headers["x-amzn-requestid"] ?? output.headers["x-amzn-request-id"] ?? output.headers["x-amz-request-id"], + extendedRequestId: output.headers["x-amz-id-2"], + cfId: output.headers["x-amz-cf-id"] + }), "deserializeMetadata"); + var loadConfigsForDefaultMode = /* @__PURE__ */ __name((mode) => { + switch (mode) { + case "standard": + return { + retryMode: "standard", + connectionTimeout: 3100 + }; + case "in-region": + return { + retryMode: "standard", + connectionTimeout: 1100 + }; + case "cross-region": + return { + retryMode: "standard", + connectionTimeout: 3100 + }; + case "mobile": + return { + retryMode: "standard", + connectionTimeout: 3e4 + }; + default: + return {}; } - return -1; - } - function validateAmpersand(xmlData, i) { - i++; - if (xmlData[i] === ";") - return -1; - if (xmlData[i] === "#") { - i++; - return validateNumberAmpersand(xmlData, i); + }, "loadConfigsForDefaultMode"); + var warningEmitted2 = false; + var emitWarningIfUnsupportedVersion2 = /* @__PURE__ */ __name((version2) => { + if (version2 && !warningEmitted2 && parseInt(version2.substring(1, version2.indexOf("."))) < 16) { + warningEmitted2 = true; } - let count = 0; - for (; i < xmlData.length; i++, count++) { - if (xmlData[i].match(/\w/) && count < 20) + }, "emitWarningIfUnsupportedVersion"); + function extendedEncodeURIComponent(str) { + return encodeURIComponent(str).replace(/[!'()*]/g, function(c) { + return "%" + c.charCodeAt(0).toString(16).toUpperCase(); + }); + } + __name(extendedEncodeURIComponent, "extendedEncodeURIComponent"); + var getChecksumConfiguration = /* @__PURE__ */ __name((runtimeConfig) => { + const checksumAlgorithms = []; + for (const id in import_types5.AlgorithmId) { + const algorithmId = import_types5.AlgorithmId[id]; + if (runtimeConfig[algorithmId] === void 0) { continue; - if (xmlData[i] === ";") - break; - return -1; + } + checksumAlgorithms.push({ + algorithmId: () => algorithmId, + checksumConstructor: () => runtimeConfig[algorithmId] + }); } - return i; - } - function getErrorObject(code, message, lineNumber) { return { - err: { - code, - msg: message, - line: lineNumber.line || lineNumber, - col: lineNumber.col + _checksumAlgorithms: checksumAlgorithms, + addChecksumAlgorithm(algo) { + this._checksumAlgorithms.push(algo); + }, + checksumAlgorithms() { + return this._checksumAlgorithms; } }; - } - function validateAttrName(attrName) { - return util.isName(attrName); - } - function validateTagName(tagname) { - return util.isName(tagname); - } - function getLineNumberForPosition(xmlData, index) { - const lines = xmlData.substring(0, index).split(/\r?\n/); + }, "getChecksumConfiguration"); + var resolveChecksumRuntimeConfig = /* @__PURE__ */ __name((clientConfig) => { + const runtimeConfig = {}; + clientConfig.checksumAlgorithms().forEach((checksumAlgorithm) => { + runtimeConfig[checksumAlgorithm.algorithmId()] = checksumAlgorithm.checksumConstructor(); + }); + return runtimeConfig; + }, "resolveChecksumRuntimeConfig"); + var getRetryConfiguration = /* @__PURE__ */ __name((runtimeConfig) => { + let _retryStrategy = runtimeConfig.retryStrategy; return { - line: lines.length, - // column number is last line's length + 1, because column numbering starts at 1: - col: lines[lines.length - 1].length + 1 + setRetryStrategy(retryStrategy) { + _retryStrategy = retryStrategy; + }, + retryStrategy() { + return _retryStrategy; + } }; - } - function getPositionFromMatch(match) { - return match.startIndex + match[1].length; - } - } -}); - -// ../../../node_modules/fast-xml-parser/src/xmlparser/OptionsBuilder.js -var require_OptionsBuilder = __commonJS({ - "../../../node_modules/fast-xml-parser/src/xmlparser/OptionsBuilder.js"(exports2) { - var defaultOptions = { - preserveOrder: false, - attributeNamePrefix: "@_", - attributesGroupName: false, - textNodeName: "#text", - ignoreAttributes: true, - removeNSPrefix: false, - // remove NS from tag name or attribute name if true - allowBooleanAttributes: false, - //a tag can have attributes without any value - //ignoreRootElement : false, - parseTagValue: true, - parseAttributeValue: false, - trimValues: true, - //Trim string values of tag and attributes - cdataPropName: false, - numberParseOptions: { - hex: true, - leadingZeros: true, - eNotation: true - }, - tagValueProcessor: function(tagName, val2) { - return val2; - }, - attributeValueProcessor: function(attrName, val2) { - return val2; - }, - stopNodes: [], - //nested tags will not be parsed even for errors - alwaysCreateTextNode: false, - isArray: () => false, - commentPropName: false, - unpairedTags: [], - processEntities: true, - htmlEntities: false, - ignoreDeclaration: false, - ignorePiTags: false, - transformTagName: false, - transformAttributeName: false, - updateTag: function(tagName, jPath, attrs) { - return tagName; + }, "getRetryConfiguration"); + var resolveRetryRuntimeConfig = /* @__PURE__ */ __name((retryStrategyConfiguration) => { + const runtimeConfig = {}; + runtimeConfig.retryStrategy = retryStrategyConfiguration.retryStrategy(); + return runtimeConfig; + }, "resolveRetryRuntimeConfig"); + var getDefaultExtensionConfiguration = /* @__PURE__ */ __name((runtimeConfig) => { + return { + ...getChecksumConfiguration(runtimeConfig), + ...getRetryConfiguration(runtimeConfig) + }; + }, "getDefaultExtensionConfiguration"); + var getDefaultClientConfiguration = getDefaultExtensionConfiguration; + var resolveDefaultRuntimeConfig = /* @__PURE__ */ __name((config) => { + return { + ...resolveChecksumRuntimeConfig(config), + ...resolveRetryRuntimeConfig(config) + }; + }, "resolveDefaultRuntimeConfig"); + var getArrayIfSingleItem = /* @__PURE__ */ __name((mayBeArray) => Array.isArray(mayBeArray) ? mayBeArray : [mayBeArray], "getArrayIfSingleItem"); + var getValueFromTextNode2 = /* @__PURE__ */ __name((obj) => { + const textNodeName = "#text"; + for (const key in obj) { + if (obj.hasOwnProperty(key) && obj[key][textNodeName] !== void 0) { + obj[key] = obj[key][textNodeName]; + } else if (typeof obj[key] === "object" && obj[key] !== null) { + obj[key] = getValueFromTextNode2(obj[key]); + } + } + return obj; + }, "getValueFromTextNode"); + var isSerializableHeaderValue = /* @__PURE__ */ __name((value) => { + return value != null; + }, "isSerializableHeaderValue"); + var StringWrapper = /* @__PURE__ */ __name(function() { + const Class = Object.getPrototypeOf(this).constructor; + const Constructor = Function.bind.apply(String, [null, ...arguments]); + const instance = new Constructor(); + Object.setPrototypeOf(instance, Class.prototype); + return instance; + }, "StringWrapper"); + StringWrapper.prototype = Object.create(String.prototype, { + constructor: { + value: StringWrapper, + enumerable: false, + writable: true, + configurable: true + } + }); + Object.setPrototypeOf(StringWrapper, String); + var _LazyJsonString = class _LazyJsonString2 extends StringWrapper { + deserializeJSON() { + return JSON.parse(super.toString()); + } + toJSON() { + return super.toString(); + } + static fromObject(object) { + if (object instanceof _LazyJsonString2) { + return object; + } else if (object instanceof String || typeof object === "string") { + return new _LazyJsonString2(object); + } + return new _LazyJsonString2(JSON.stringify(object)); } - // skipEmptyListItem: false - }; - var buildOptions = function(options) { - return Object.assign({}, defaultOptions, options); }; - exports2.buildOptions = buildOptions; - exports2.defaultOptions = defaultOptions; - } -}); - -// ../../../node_modules/fast-xml-parser/src/xmlparser/xmlNode.js -var require_xmlNode = __commonJS({ - "../../../node_modules/fast-xml-parser/src/xmlparser/xmlNode.js"(exports2, module2) { - "use strict"; - var XmlNode = class { - constructor(tagname) { - this.tagname = tagname; - this.child = []; - this[":@"] = {}; + __name(_LazyJsonString, "LazyJsonString"); + var LazyJsonString = _LazyJsonString; + var _NoOpLogger = class _NoOpLogger { + trace() { } - add(key, val2) { - if (key === "__proto__") key = "#__proto__"; - this.child.push({ [key]: val2 }); + debug() { } - addChild(node) { - if (node.tagname === "__proto__") node.tagname = "#__proto__"; - if (node[":@"] && Object.keys(node[":@"]).length > 0) { - this.child.push({ [node.tagname]: node.child, [":@"]: node[":@"] }); + info() { + } + warn() { + } + error() { + } + }; + __name(_NoOpLogger, "NoOpLogger"); + var NoOpLogger = _NoOpLogger; + function map(arg0, arg1, arg2) { + let target; + let filter; + let instructions; + if (typeof arg1 === "undefined" && typeof arg2 === "undefined") { + target = {}; + instructions = arg0; + } else { + target = arg0; + if (typeof arg1 === "function") { + filter = arg1; + instructions = arg2; + return mapWithFilter(target, filter, instructions); } else { - this.child.push({ [node.tagname]: node.child }); + instructions = arg1; } } - }; - module2.exports = XmlNode; - } -}); - -// ../../../node_modules/fast-xml-parser/src/xmlparser/DocTypeReader.js -var require_DocTypeReader = __commonJS({ - "../../../node_modules/fast-xml-parser/src/xmlparser/DocTypeReader.js"(exports2, module2) { - var util = require_util2(); - function readDocType(xmlData, i) { - const entities = {}; - if (xmlData[i + 3] === "O" && xmlData[i + 4] === "C" && xmlData[i + 5] === "T" && xmlData[i + 6] === "Y" && xmlData[i + 7] === "P" && xmlData[i + 8] === "E") { - i = i + 9; - let angleBracketsCount = 1; - let hasBody = false, comment = false; - let exp = ""; - for (; i < xmlData.length; i++) { - if (xmlData[i] === "<" && !comment) { - if (hasBody && isEntity(xmlData, i)) { - i += 7; - [entityName, val, i] = readEntityExp(xmlData, i + 1); - if (val.indexOf("&") === -1) - entities[validateEntityName(entityName)] = { - regx: RegExp(`&${entityName};`, "g"), - val - }; - } else if (hasBody && isElement(xmlData, i)) i += 8; - else if (hasBody && isAttlist(xmlData, i)) i += 8; - else if (hasBody && isNotation(xmlData, i)) i += 9; - else if (isComment) comment = true; - else throw new Error("Invalid DOCTYPE"); - angleBracketsCount++; - exp = ""; - } else if (xmlData[i] === ">") { - if (comment) { - if (xmlData[i - 1] === "-" && xmlData[i - 2] === "-") { - comment = false; - angleBracketsCount--; - } + for (const key of Object.keys(instructions)) { + if (!Array.isArray(instructions[key])) { + target[key] = instructions[key]; + continue; + } + applyInstruction(target, null, instructions, key); + } + return target; + } + __name(map, "map"); + var convertMap = /* @__PURE__ */ __name((target) => { + const output = {}; + for (const [k, v] of Object.entries(target || {})) { + output[k] = [, v]; + } + return output; + }, "convertMap"); + var take = /* @__PURE__ */ __name((source, instructions) => { + const out = {}; + for (const key in instructions) { + applyInstruction(out, source, instructions, key); + } + return out; + }, "take"); + var mapWithFilter = /* @__PURE__ */ __name((target, filter, instructions) => { + return map( + target, + Object.entries(instructions).reduce( + (_instructions, [key, value]) => { + if (Array.isArray(value)) { + _instructions[key] = value; } else { - angleBracketsCount--; - } - if (angleBracketsCount === 0) { - break; + if (typeof value === "function") { + _instructions[key] = [filter, value()]; + } else { + _instructions[key] = [filter, value]; + } } - } else if (xmlData[i] === "[") { - hasBody = true; - } else { - exp += xmlData[i]; - } + return _instructions; + }, + {} + ) + ); + }, "mapWithFilter"); + var applyInstruction = /* @__PURE__ */ __name((target, source, instructions, targetKey) => { + if (source !== null) { + let instruction = instructions[targetKey]; + if (typeof instruction === "function") { + instruction = [, instruction]; } - if (angleBracketsCount !== 0) { - throw new Error(`Unclosed DOCTYPE`); + const [filter2 = nonNullish, valueFn = pass, sourceKey = targetKey] = instruction; + if (typeof filter2 === "function" && filter2(source[sourceKey]) || typeof filter2 !== "function" && !!filter2) { + target[targetKey] = valueFn(source[sourceKey]); } - } else { - throw new Error(`Invalid Tag instead of DOCTYPE`); + return; } - return { entities, i }; - } - function readEntityExp(xmlData, i) { - let entityName2 = ""; - for (; i < xmlData.length && (xmlData[i] !== "'" && xmlData[i] !== '"'); i++) { - entityName2 += xmlData[i]; + let [filter, value] = instructions[targetKey]; + if (typeof value === "function") { + let _value; + const defaultFilterPassed = filter === void 0 && (_value = value()) != null; + const customFilterPassed = typeof filter === "function" && !!filter(void 0) || typeof filter !== "function" && !!filter; + if (defaultFilterPassed) { + target[targetKey] = _value; + } else if (customFilterPassed) { + target[targetKey] = value(); + } + } else { + const defaultFilterPassed = filter === void 0 && value != null; + const customFilterPassed = typeof filter === "function" && !!filter(value) || typeof filter !== "function" && !!filter; + if (defaultFilterPassed || customFilterPassed) { + target[targetKey] = value; + } } - entityName2 = entityName2.trim(); - if (entityName2.indexOf(" ") !== -1) throw new Error("External entites are not supported"); - const startChar = xmlData[i++]; - let val2 = ""; - for (; i < xmlData.length && xmlData[i] !== startChar; i++) { - val2 += xmlData[i]; + }, "applyInstruction"); + var nonNullish = /* @__PURE__ */ __name((_) => _ != null, "nonNullish"); + var pass = /* @__PURE__ */ __name((_) => _, "pass"); + function quoteHeader(part) { + if (part.includes(",") || part.includes('"')) { + part = `"${part.replace(/"/g, '\\"')}"`; } - return [entityName2, val2, i]; - } - function isComment(xmlData, i) { - if (xmlData[i + 1] === "!" && xmlData[i + 2] === "-" && xmlData[i + 3] === "-") return true; - return false; - } - function isEntity(xmlData, i) { - if (xmlData[i + 1] === "!" && xmlData[i + 2] === "E" && xmlData[i + 3] === "N" && xmlData[i + 4] === "T" && xmlData[i + 5] === "I" && xmlData[i + 6] === "T" && xmlData[i + 7] === "Y") return true; - return false; - } - function isElement(xmlData, i) { - if (xmlData[i + 1] === "!" && xmlData[i + 2] === "E" && xmlData[i + 3] === "L" && xmlData[i + 4] === "E" && xmlData[i + 5] === "M" && xmlData[i + 6] === "E" && xmlData[i + 7] === "N" && xmlData[i + 8] === "T") return true; - return false; - } - function isAttlist(xmlData, i) { - if (xmlData[i + 1] === "!" && xmlData[i + 2] === "A" && xmlData[i + 3] === "T" && xmlData[i + 4] === "T" && xmlData[i + 5] === "L" && xmlData[i + 6] === "I" && xmlData[i + 7] === "S" && xmlData[i + 8] === "T") return true; - return false; - } - function isNotation(xmlData, i) { - if (xmlData[i + 1] === "!" && xmlData[i + 2] === "N" && xmlData[i + 3] === "O" && xmlData[i + 4] === "T" && xmlData[i + 5] === "A" && xmlData[i + 6] === "T" && xmlData[i + 7] === "I" && xmlData[i + 8] === "O" && xmlData[i + 9] === "N") return true; - return false; - } - function validateEntityName(name) { - if (util.isName(name)) - return name; - else - throw new Error(`Invalid entity name ${name}`); - } - module2.exports = readDocType; - } -}); - -// ../../../node_modules/strnum/strnum.js -var require_strnum = __commonJS({ - "../../../node_modules/strnum/strnum.js"(exports2, module2) { - var hexRegex = /^[-+]?0x[a-fA-F0-9]+$/; - var numRegex = /^([\-\+])?(0*)(\.[0-9]+([eE]\-?[0-9]+)?|[0-9]+(\.[0-9]+([eE]\-?[0-9]+)?)?)$/; - if (!Number.parseInt && window.parseInt) { - Number.parseInt = window.parseInt; - } - if (!Number.parseFloat && window.parseFloat) { - Number.parseFloat = window.parseFloat; + return part; } - var consider = { - hex: true, - leadingZeros: true, - decimalPoint: ".", - eNotation: true - //skipLike: /regex/ - }; - function toNumber(str, options = {}) { - options = Object.assign({}, consider, options); - if (!str || typeof str !== "string") return str; - let trimmedStr = str.trim(); - if (options.skipLike !== void 0 && options.skipLike.test(trimmedStr)) return str; - else if (options.hex && hexRegex.test(trimmedStr)) { - return Number.parseInt(trimmedStr, 16); + __name(quoteHeader, "quoteHeader"); + var resolvedPath2 = /* @__PURE__ */ __name((resolvedPath22, input, memberName, labelValueProvider, uriLabel, isGreedyLabel) => { + if (input != null && input[memberName] !== void 0) { + const labelValue = labelValueProvider(); + if (labelValue.length <= 0) { + throw new Error("Empty value provided for input HTTP label: " + memberName + "."); + } + resolvedPath22 = resolvedPath22.replace( + uriLabel, + isGreedyLabel ? labelValue.split("/").map((segment) => extendedEncodeURIComponent(segment)).join("/") : extendedEncodeURIComponent(labelValue) + ); } else { - const match = numRegex.exec(trimmedStr); - if (match) { - const sign = match[1]; - const leadingZeros = match[2]; - let numTrimmedByZeros = trimZeros(match[3]); - const eNotation = match[4] || match[6]; - if (!options.leadingZeros && leadingZeros.length > 0 && sign && trimmedStr[2] !== ".") return str; - else if (!options.leadingZeros && leadingZeros.length > 0 && !sign && trimmedStr[1] !== ".") return str; - else { - const num = Number(trimmedStr); - const numStr = "" + num; - if (numStr.search(/[eE]/) !== -1) { - if (options.eNotation) return num; - else return str; - } else if (eNotation) { - if (options.eNotation) return num; - else return str; - } else if (trimmedStr.indexOf(".") !== -1) { - if (numStr === "0" && numTrimmedByZeros === "") return num; - else if (numStr === numTrimmedByZeros) return num; - else if (sign && numStr === "-" + numTrimmedByZeros) return num; - else return str; - } - if (leadingZeros) { - if (numTrimmedByZeros === numStr) return num; - else if (sign + numTrimmedByZeros === numStr) return num; - else return str; - } - if (trimmedStr === numStr) return num; - else if (trimmedStr === sign + numStr) return num; - return str; + throw new Error("No value provided for input HTTP label: " + memberName + "."); + } + return resolvedPath22; + }, "resolvedPath"); + var serializeFloat = /* @__PURE__ */ __name((value) => { + if (value !== value) { + return "NaN"; + } + switch (value) { + case Infinity: + return "Infinity"; + case -Infinity: + return "-Infinity"; + default: + return value; + } + }, "serializeFloat"); + var serializeDateTime = /* @__PURE__ */ __name((date) => date.toISOString().replace(".000Z", "Z"), "serializeDateTime"); + var _json = /* @__PURE__ */ __name((obj) => { + if (obj == null) { + return {}; + } + if (Array.isArray(obj)) { + return obj.filter((_) => _ != null).map(_json); + } + if (typeof obj === "object") { + const target = {}; + for (const key of Object.keys(obj)) { + if (obj[key] == null) { + continue; } + target[key] = _json(obj[key]); + } + return target; + } + return obj; + }, "_json"); + function splitEvery(value, delimiter, numDelimiters) { + if (numDelimiters <= 0 || !Number.isInteger(numDelimiters)) { + throw new Error("Invalid number of delimiters (" + numDelimiters + ") for splitEvery."); + } + const segments = value.split(delimiter); + if (numDelimiters === 1) { + return segments; + } + const compoundSegments = []; + let currentSegment = ""; + for (let i = 0; i < segments.length; i++) { + if (currentSegment === "") { + currentSegment = segments[i]; } else { - return str; + currentSegment += delimiter + segments[i]; + } + if ((i + 1) % numDelimiters === 0) { + compoundSegments.push(currentSegment); + currentSegment = ""; } } - } - function trimZeros(numStr) { - if (numStr && numStr.indexOf(".") !== -1) { - numStr = numStr.replace(/0+$/, ""); - if (numStr === ".") numStr = "0"; - else if (numStr[0] === ".") numStr = "0" + numStr; - else if (numStr[numStr.length - 1] === ".") numStr = numStr.substr(0, numStr.length - 1); - return numStr; + if (currentSegment !== "") { + compoundSegments.push(currentSegment); } - return numStr; + return compoundSegments; } - module2.exports = toNumber; + __name(splitEvery, "splitEvery"); + var splitHeader = /* @__PURE__ */ __name((value) => { + const z = value.length; + const values = []; + let withinQuotes = false; + let prevChar = void 0; + let anchor = 0; + for (let i = 0; i < z; ++i) { + const char = value[i]; + switch (char) { + case `"`: + if (prevChar !== "\\") { + withinQuotes = !withinQuotes; + } + break; + case ",": + if (!withinQuotes) { + values.push(value.slice(anchor, i)); + anchor = i + 1; + } + break; + default: + } + prevChar = char; + } + values.push(value.slice(anchor)); + return values.map((v) => { + v = v.trim(); + const z2 = v.length; + if (z2 < 2) { + return v; + } + if (v[0] === `"` && v[z2 - 1] === `"`) { + v = v.slice(1, z2 - 1); + } + return v.replace(/\\"/g, '"'); + }); + }, "splitHeader"); } }); -// ../../../node_modules/fast-xml-parser/src/xmlparser/OrderedObjParser.js -var require_OrderedObjParser = __commonJS({ - "../../../node_modules/fast-xml-parser/src/xmlparser/OrderedObjParser.js"(exports2, module2) { +// ../../../node_modules/@smithy/middleware-retry/dist-cjs/isStreamingPayload/isStreamingPayload.js +var require_isStreamingPayload = __commonJS({ + "../../../node_modules/@smithy/middleware-retry/dist-cjs/isStreamingPayload/isStreamingPayload.js"(exports2) { "use strict"; - var util = require_util2(); - var xmlNode = require_xmlNode(); - var readDocType = require_DocTypeReader(); - var toNumber = require_strnum(); - var regx = "<((!\\[CDATA\\[([\\s\\S]*?)(]]>))|((NAME:)?(NAME))([^>]*)>|((\\/)(NAME)\\s*>))([^<]*)".replace(/NAME/g, util.nameRegexp); - var OrderedObjParser = class { - constructor(options) { - this.options = options; - this.currentNode = null; - this.tagsNodeStack = []; - this.docTypeEntities = {}; - this.lastEntities = { - "apos": { regex: /&(apos|#39|#x27);/g, val: "'" }, - "gt": { regex: /&(gt|#62|#x3E);/g, val: ">" }, - "lt": { regex: /&(lt|#60|#x3C);/g, val: "<" }, - "quot": { regex: /&(quot|#34|#x22);/g, val: '"' } - }; - this.ampEntity = { regex: /&(amp|#38|#x26);/g, val: "&" }; - this.htmlEntities = { - "space": { regex: /&(nbsp|#160);/g, val: " " }, - // "lt" : { regex: /&(lt|#60);/g, val: "<" }, - // "gt" : { regex: /&(gt|#62);/g, val: ">" }, - // "amp" : { regex: /&(amp|#38);/g, val: "&" }, - // "quot" : { regex: /&(quot|#34);/g, val: "\"" }, - // "apos" : { regex: /&(apos|#39);/g, val: "'" }, - "cent": { regex: /&(cent|#162);/g, val: "\xA2" }, - "pound": { regex: /&(pound|#163);/g, val: "\xA3" }, - "yen": { regex: /&(yen|#165);/g, val: "\xA5" }, - "euro": { regex: /&(euro|#8364);/g, val: "\u20AC" }, - "copyright": { regex: /&(copy|#169);/g, val: "\xA9" }, - "reg": { regex: /&(reg|#174);/g, val: "\xAE" }, - "inr": { regex: /&(inr|#8377);/g, val: "\u20B9" } - }; - this.addExternalEntities = addExternalEntities; - this.parseXml = parseXml; - this.parseTextData = parseTextData; - this.resolveNameSpace = resolveNameSpace; - this.buildAttributesMap = buildAttributesMap; - this.isItStopNode = isItStopNode; - this.replaceEntitiesValue = replaceEntitiesValue; - this.readStopNodeData = readStopNodeData; - this.saveTextToParentTag = saveTextToParentTag; - this.addChild = addChild; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.isStreamingPayload = void 0; + var stream_1 = require("stream"); + var isStreamingPayload = (request2) => (request2 === null || request2 === void 0 ? void 0 : request2.body) instanceof stream_1.Readable || typeof ReadableStream !== "undefined" && (request2 === null || request2 === void 0 ? void 0 : request2.body) instanceof ReadableStream; + exports2.isStreamingPayload = isStreamingPayload; + } +}); + +// ../../../node_modules/@smithy/middleware-retry/dist-cjs/index.js +var require_dist_cjs38 = __commonJS({ + "../../../node_modules/@smithy/middleware-retry/dist-cjs/index.js"(exports2, module2) { + var __defProp2 = Object.defineProperty; + var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; + var __getOwnPropNames2 = Object.getOwnPropertyNames; + var __hasOwnProp2 = Object.prototype.hasOwnProperty; + var __name = (target, value) => __defProp2(target, "name", { value, configurable: true }); + var __export2 = (target, all) => { + for (var name in all) + __defProp2(target, name, { get: all[name], enumerable: true }); + }; + var __copyProps2 = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames2(from)) + if (!__hasOwnProp2.call(to, key) && key !== except) + __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable }); } + return to; }; - function addExternalEntities(externalEntities) { - const entKeys = Object.keys(externalEntities); - for (let i = 0; i < entKeys.length; i++) { - const ent = entKeys[i]; - this.lastEntities[ent] = { - regex: new RegExp("&" + ent + ";", "g"), - val: externalEntities[ent] - }; + var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); + var src_exports = {}; + __export2(src_exports, { + AdaptiveRetryStrategy: () => AdaptiveRetryStrategy, + CONFIG_MAX_ATTEMPTS: () => CONFIG_MAX_ATTEMPTS, + CONFIG_RETRY_MODE: () => CONFIG_RETRY_MODE, + ENV_MAX_ATTEMPTS: () => ENV_MAX_ATTEMPTS, + ENV_RETRY_MODE: () => ENV_RETRY_MODE, + NODE_MAX_ATTEMPT_CONFIG_OPTIONS: () => NODE_MAX_ATTEMPT_CONFIG_OPTIONS, + NODE_RETRY_MODE_CONFIG_OPTIONS: () => NODE_RETRY_MODE_CONFIG_OPTIONS, + StandardRetryStrategy: () => StandardRetryStrategy, + defaultDelayDecider: () => defaultDelayDecider, + defaultRetryDecider: () => defaultRetryDecider, + getOmitRetryHeadersPlugin: () => getOmitRetryHeadersPlugin, + getRetryAfterHint: () => getRetryAfterHint, + getRetryPlugin: () => getRetryPlugin, + omitRetryHeadersMiddleware: () => omitRetryHeadersMiddleware, + omitRetryHeadersMiddlewareOptions: () => omitRetryHeadersMiddlewareOptions, + resolveRetryConfig: () => resolveRetryConfig, + retryMiddleware: () => retryMiddleware, + retryMiddlewareOptions: () => retryMiddlewareOptions2 + }); + module2.exports = __toCommonJS2(src_exports); + var import_protocol_http8 = require_dist_cjs21(); + var import_uuid = (init_esm_node(), __toCommonJS(esm_node_exports)); + var import_util_retry = require_dist_cjs23(); + var getDefaultRetryQuota = /* @__PURE__ */ __name((initialRetryTokens, options) => { + const MAX_CAPACITY = initialRetryTokens; + const noRetryIncrement = (options == null ? void 0 : options.noRetryIncrement) ?? import_util_retry.NO_RETRY_INCREMENT; + const retryCost = (options == null ? void 0 : options.retryCost) ?? import_util_retry.RETRY_COST; + const timeoutRetryCost = (options == null ? void 0 : options.timeoutRetryCost) ?? import_util_retry.TIMEOUT_RETRY_COST; + let availableCapacity = initialRetryTokens; + const getCapacityAmount = /* @__PURE__ */ __name((error) => error.name === "TimeoutError" ? timeoutRetryCost : retryCost, "getCapacityAmount"); + const hasRetryTokens = /* @__PURE__ */ __name((error) => getCapacityAmount(error) <= availableCapacity, "hasRetryTokens"); + const retrieveRetryTokens = /* @__PURE__ */ __name((error) => { + if (!hasRetryTokens(error)) { + throw new Error("No retry token available"); + } + const capacityAmount = getCapacityAmount(error); + availableCapacity -= capacityAmount; + return capacityAmount; + }, "retrieveRetryTokens"); + const releaseRetryTokens = /* @__PURE__ */ __name((capacityReleaseAmount) => { + availableCapacity += capacityReleaseAmount ?? noRetryIncrement; + availableCapacity = Math.min(availableCapacity, MAX_CAPACITY); + }, "releaseRetryTokens"); + return Object.freeze({ + hasRetryTokens, + retrieveRetryTokens, + releaseRetryTokens + }); + }, "getDefaultRetryQuota"); + var defaultDelayDecider = /* @__PURE__ */ __name((delayBase, attempts) => Math.floor(Math.min(import_util_retry.MAXIMUM_RETRY_DELAY, Math.random() * 2 ** attempts * delayBase)), "defaultDelayDecider"); + var import_service_error_classification = require_dist_cjs22(); + var defaultRetryDecider = /* @__PURE__ */ __name((error) => { + if (!error) { + return false; + } + return (0, import_service_error_classification.isRetryableByTrait)(error) || (0, import_service_error_classification.isClockSkewError)(error) || (0, import_service_error_classification.isThrottlingError)(error) || (0, import_service_error_classification.isTransientError)(error); + }, "defaultRetryDecider"); + var asSdkError = /* @__PURE__ */ __name((error) => { + if (error instanceof Error) + return error; + if (error instanceof Object) + return Object.assign(new Error(), error); + if (typeof error === "string") + return new Error(error); + return new Error(`AWS SDK error wrapper for ${error}`); + }, "asSdkError"); + var _StandardRetryStrategy = class _StandardRetryStrategy { + constructor(maxAttemptsProvider, options) { + this.maxAttemptsProvider = maxAttemptsProvider; + this.mode = import_util_retry.RETRY_MODES.STANDARD; + this.retryDecider = (options == null ? void 0 : options.retryDecider) ?? defaultRetryDecider; + this.delayDecider = (options == null ? void 0 : options.delayDecider) ?? defaultDelayDecider; + this.retryQuota = (options == null ? void 0 : options.retryQuota) ?? getDefaultRetryQuota(import_util_retry.INITIAL_RETRY_TOKENS); } - } - function parseTextData(val2, tagName, jPath, dontTrim, hasAttributes, isLeafNode, escapeEntities) { - if (val2 !== void 0) { - if (this.options.trimValues && !dontTrim) { - val2 = val2.trim(); - } - if (val2.length > 0) { - if (!escapeEntities) val2 = this.replaceEntitiesValue(val2); - const newval = this.options.tagValueProcessor(tagName, val2, jPath, hasAttributes, isLeafNode); - if (newval === null || newval === void 0) { - return val2; - } else if (typeof newval !== typeof val2 || newval !== val2) { - return newval; - } else if (this.options.trimValues) { - return parseValue(val2, this.options.parseTagValue, this.options.numberParseOptions); - } else { - const trimmedVal = val2.trim(); - if (trimmedVal === val2) { - return parseValue(val2, this.options.parseTagValue, this.options.numberParseOptions); - } else { - return val2; - } - } - } + shouldRetry(error, attempts, maxAttempts) { + return attempts < maxAttempts && this.retryDecider(error) && this.retryQuota.hasRetryTokens(error); } - } - function resolveNameSpace(tagname) { - if (this.options.removeNSPrefix) { - const tags = tagname.split(":"); - const prefix = tagname.charAt(0) === "/" ? "/" : ""; - if (tags[0] === "xmlns") { - return ""; - } - if (tags.length === 2) { - tagname = prefix + tags[1]; + async getMaxAttempts() { + let maxAttempts; + try { + maxAttempts = await this.maxAttemptsProvider(); + } catch (error) { + maxAttempts = import_util_retry.DEFAULT_MAX_ATTEMPTS; } + return maxAttempts; } - return tagname; - } - var attrsRegx = new RegExp(`([^\\s=]+)\\s*(=\\s*(['"])([\\s\\S]*?)\\3)?`, "gm"); - function buildAttributesMap(attrStr, jPath, tagName) { - if (!this.options.ignoreAttributes && typeof attrStr === "string") { - const matches = util.getAllMatches(attrStr, attrsRegx); - const len = matches.length; - const attrs = {}; - for (let i = 0; i < len; i++) { - const attrName = this.resolveNameSpace(matches[i][1]); - let oldVal = matches[i][4]; - let aName = this.options.attributeNamePrefix + attrName; - if (attrName.length) { - if (this.options.transformAttributeName) { - aName = this.options.transformAttributeName(aName); - } - if (aName === "__proto__") aName = "#__proto__"; - if (oldVal !== void 0) { - if (this.options.trimValues) { - oldVal = oldVal.trim(); - } - oldVal = this.replaceEntitiesValue(oldVal); - const newVal = this.options.attributeValueProcessor(attrName, oldVal, jPath); - if (newVal === null || newVal === void 0) { - attrs[aName] = oldVal; - } else if (typeof newVal !== typeof oldVal || newVal !== oldVal) { - attrs[aName] = newVal; - } else { - attrs[aName] = parseValue( - oldVal, - this.options.parseAttributeValue, - this.options.numberParseOptions - ); - } - } else if (this.options.allowBooleanAttributes) { - attrs[aName] = true; - } - } - } - if (!Object.keys(attrs).length) { - return; - } - if (this.options.attributesGroupName) { - const attrCollection = {}; - attrCollection[this.options.attributesGroupName] = attrs; - return attrCollection; + async retry(next, args, options) { + let retryTokenAmount; + let attempts = 0; + let totalDelay = 0; + const maxAttempts = await this.getMaxAttempts(); + const { request: request2 } = args; + if (import_protocol_http8.HttpRequest.isInstance(request2)) { + request2.headers[import_util_retry.INVOCATION_ID_HEADER] = (0, import_uuid.v4)(); } - return attrs; - } - } - var parseXml = function(xmlData) { - xmlData = xmlData.replace(/\r\n?/g, "\n"); - const xmlObj = new xmlNode("!xml"); - let currentNode = xmlObj; - let textData = ""; - let jPath = ""; - for (let i = 0; i < xmlData.length; i++) { - const ch = xmlData[i]; - if (ch === "<") { - if (xmlData[i + 1] === "/") { - const closeIndex = findClosingIndex(xmlData, ">", i, "Closing Tag is not closed."); - let tagName = xmlData.substring(i + 2, closeIndex).trim(); - if (this.options.removeNSPrefix) { - const colonIndex = tagName.indexOf(":"); - if (colonIndex !== -1) { - tagName = tagName.substr(colonIndex + 1); - } - } - if (this.options.transformTagName) { - tagName = this.options.transformTagName(tagName); - } - if (currentNode) { - textData = this.saveTextToParentTag(textData, currentNode, jPath); - } - const lastTagName = jPath.substring(jPath.lastIndexOf(".") + 1); - if (tagName && this.options.unpairedTags.indexOf(tagName) !== -1) { - throw new Error(`Unpaired tag can not be used as closing tag: `); - } - let propIndex = 0; - if (lastTagName && this.options.unpairedTags.indexOf(lastTagName) !== -1) { - propIndex = jPath.lastIndexOf(".", jPath.lastIndexOf(".") - 1); - this.tagsNodeStack.pop(); - } else { - propIndex = jPath.lastIndexOf("."); - } - jPath = jPath.substring(0, propIndex); - currentNode = this.tagsNodeStack.pop(); - textData = ""; - i = closeIndex; - } else if (xmlData[i + 1] === "?") { - let tagData = readTagExp(xmlData, i, false, "?>"); - if (!tagData) throw new Error("Pi Tag is not closed."); - textData = this.saveTextToParentTag(textData, currentNode, jPath); - if (this.options.ignoreDeclaration && tagData.tagName === "?xml" || this.options.ignorePiTags) { - } else { - const childNode = new xmlNode(tagData.tagName); - childNode.add(this.options.textNodeName, ""); - if (tagData.tagName !== tagData.tagExp && tagData.attrExpPresent) { - childNode[":@"] = this.buildAttributesMap(tagData.tagExp, jPath, tagData.tagName); - } - this.addChild(currentNode, childNode, jPath); - } - i = tagData.closeIndex + 1; - } else if (xmlData.substr(i + 1, 3) === "!--") { - const endIndex = findClosingIndex(xmlData, "-->", i + 4, "Comment is not closed."); - if (this.options.commentPropName) { - const comment = xmlData.substring(i + 4, endIndex - 2); - textData = this.saveTextToParentTag(textData, currentNode, jPath); - currentNode.add(this.options.commentPropName, [{ [this.options.textNodeName]: comment }]); - } - i = endIndex; - } else if (xmlData.substr(i + 1, 2) === "!D") { - const result = readDocType(xmlData, i); - this.docTypeEntities = result.entities; - i = result.i; - } else if (xmlData.substr(i + 1, 2) === "![") { - const closeIndex = findClosingIndex(xmlData, "]]>", i, "CDATA is not closed.") - 2; - const tagExp = xmlData.substring(i + 9, closeIndex); - textData = this.saveTextToParentTag(textData, currentNode, jPath); - if (this.options.cdataPropName) { - currentNode.add(this.options.cdataPropName, [{ [this.options.textNodeName]: tagExp }]); - } else { - let val2 = this.parseTextData(tagExp, currentNode.tagname, jPath, true, false, true); - if (val2 == void 0) val2 = ""; - currentNode.add(this.options.textNodeName, val2); - } - i = closeIndex + 2; - } else { - let result = readTagExp(xmlData, i, this.options.removeNSPrefix); - let tagName = result.tagName; - let tagExp = result.tagExp; - let attrExpPresent = result.attrExpPresent; - let closeIndex = result.closeIndex; - if (this.options.transformTagName) { - tagName = this.options.transformTagName(tagName); - } - if (currentNode && textData) { - if (currentNode.tagname !== "!xml") { - textData = this.saveTextToParentTag(textData, currentNode, jPath, false); - } - } - const lastTag = currentNode; - if (lastTag && this.options.unpairedTags.indexOf(lastTag.tagname) !== -1) { - currentNode = this.tagsNodeStack.pop(); - jPath = jPath.substring(0, jPath.lastIndexOf(".")); - } - if (tagName !== xmlObj.tagname) { - jPath += jPath ? "." + tagName : tagName; + while (true) { + try { + if (import_protocol_http8.HttpRequest.isInstance(request2)) { + request2.headers[import_util_retry.REQUEST_HEADER] = `attempt=${attempts + 1}; max=${maxAttempts}`; } - if (this.isItStopNode(this.options.stopNodes, jPath, tagName)) { - let tagContent = ""; - if (tagExp.length > 0 && tagExp.lastIndexOf("/") === tagExp.length - 1) { - i = result.closeIndex; - } else if (this.options.unpairedTags.indexOf(tagName) !== -1) { - i = result.closeIndex; - } else { - const result2 = this.readStopNodeData(xmlData, tagName, closeIndex + 1); - if (!result2) throw new Error(`Unexpected end of ${tagName}`); - i = result2.i; - tagContent = result2.tagContent; - } - const childNode = new xmlNode(tagName); - if (tagName !== tagExp && attrExpPresent) { - childNode[":@"] = this.buildAttributesMap(tagExp, jPath, tagName); - } - if (tagContent) { - tagContent = this.parseTextData(tagContent, tagName, jPath, true, attrExpPresent, true, true); - } - jPath = jPath.substr(0, jPath.lastIndexOf(".")); - childNode.add(this.options.textNodeName, tagContent); - this.addChild(currentNode, childNode, jPath); - } else { - if (tagExp.length > 0 && tagExp.lastIndexOf("/") === tagExp.length - 1) { - if (tagName[tagName.length - 1] === "/") { - tagName = tagName.substr(0, tagName.length - 1); - tagExp = tagName; - } else { - tagExp = tagExp.substr(0, tagExp.length - 1); - } - if (this.options.transformTagName) { - tagName = this.options.transformTagName(tagName); - } - const childNode = new xmlNode(tagName); - if (tagName !== tagExp && attrExpPresent) { - childNode[":@"] = this.buildAttributesMap(tagExp, jPath, tagName); - } - this.addChild(currentNode, childNode, jPath); - jPath = jPath.substr(0, jPath.lastIndexOf(".")); - } else { - const childNode = new xmlNode(tagName); - this.tagsNodeStack.push(currentNode); - if (tagName !== tagExp && attrExpPresent) { - childNode[":@"] = this.buildAttributesMap(tagExp, jPath, tagName); - } - this.addChild(currentNode, childNode, jPath); - currentNode = childNode; - } - textData = ""; - i = closeIndex; + if (options == null ? void 0 : options.beforeRequest) { + await options.beforeRequest(); } + const { response, output } = await next(args); + if (options == null ? void 0 : options.afterRequest) { + options.afterRequest(response); + } + this.retryQuota.releaseRetryTokens(retryTokenAmount); + output.$metadata.attempts = attempts + 1; + output.$metadata.totalRetryDelay = totalDelay; + return { response, output }; + } catch (e) { + const err = asSdkError(e); + attempts++; + if (this.shouldRetry(err, attempts, maxAttempts)) { + retryTokenAmount = this.retryQuota.retrieveRetryTokens(err); + const delayFromDecider = this.delayDecider( + (0, import_service_error_classification.isThrottlingError)(err) ? import_util_retry.THROTTLING_RETRY_DELAY_BASE : import_util_retry.DEFAULT_RETRY_DELAY_BASE, + attempts + ); + const delayFromResponse = getDelayFromRetryAfterHeader(err.$response); + const delay = Math.max(delayFromResponse || 0, delayFromDecider); + totalDelay += delay; + await new Promise((resolve) => setTimeout(resolve, delay)); + continue; + } + if (!err.$metadata) { + err.$metadata = {}; + } + err.$metadata.attempts = attempts; + err.$metadata.totalRetryDelay = totalDelay; + throw err; } - } else { - textData += xmlData[i]; } } - return xmlObj.child; }; - function addChild(currentNode, childNode, jPath) { - const result = this.options.updateTag(childNode.tagname, jPath, childNode[":@"]); - if (result === false) { - } else if (typeof result === "string") { - childNode.tagname = result; - currentNode.addChild(childNode); - } else { - currentNode.addChild(childNode); + __name(_StandardRetryStrategy, "StandardRetryStrategy"); + var StandardRetryStrategy = _StandardRetryStrategy; + var getDelayFromRetryAfterHeader = /* @__PURE__ */ __name((response) => { + if (!import_protocol_http8.HttpResponse.isInstance(response)) + return; + const retryAfterHeaderName = Object.keys(response.headers).find((key) => key.toLowerCase() === "retry-after"); + if (!retryAfterHeaderName) + return; + const retryAfter = response.headers[retryAfterHeaderName]; + const retryAfterSeconds = Number(retryAfter); + if (!Number.isNaN(retryAfterSeconds)) + return retryAfterSeconds * 1e3; + const retryAfterDate = new Date(retryAfter); + return retryAfterDate.getTime() - Date.now(); + }, "getDelayFromRetryAfterHeader"); + var _AdaptiveRetryStrategy = class _AdaptiveRetryStrategy extends StandardRetryStrategy { + constructor(maxAttemptsProvider, options) { + const { rateLimiter, ...superOptions } = options ?? {}; + super(maxAttemptsProvider, superOptions); + this.rateLimiter = rateLimiter ?? new import_util_retry.DefaultRateLimiter(); + this.mode = import_util_retry.RETRY_MODES.ADAPTIVE; } - } - var replaceEntitiesValue = function(val2) { - if (this.options.processEntities) { - for (let entityName2 in this.docTypeEntities) { - const entity = this.docTypeEntities[entityName2]; - val2 = val2.replace(entity.regx, entity.val); - } - for (let entityName2 in this.lastEntities) { - const entity = this.lastEntities[entityName2]; - val2 = val2.replace(entity.regex, entity.val); - } - if (this.options.htmlEntities) { - for (let entityName2 in this.htmlEntities) { - const entity = this.htmlEntities[entityName2]; - val2 = val2.replace(entity.regex, entity.val); + async retry(next, args) { + return super.retry(next, args, { + beforeRequest: async () => { + return this.rateLimiter.getSendToken(); + }, + afterRequest: (response) => { + this.rateLimiter.updateClientSendingRate(response); } - } - val2 = val2.replace(this.ampEntity.regex, this.ampEntity.val); + }); } - return val2; }; - function saveTextToParentTag(textData, currentNode, jPath, isLeafNode) { - if (textData) { - if (isLeafNode === void 0) isLeafNode = Object.keys(currentNode.child).length === 0; - textData = this.parseTextData( - textData, - currentNode.tagname, - jPath, - false, - currentNode[":@"] ? Object.keys(currentNode[":@"]).length !== 0 : false, - isLeafNode - ); - if (textData !== void 0 && textData !== "") - currentNode.add(this.options.textNodeName, textData); - textData = ""; - } - return textData; - } - function isItStopNode(stopNodes, jPath, currentTagName) { - const allNodesExp = "*." + currentTagName; - for (const stopNodePath in stopNodes) { - const stopNodeExp = stopNodes[stopNodePath]; - if (allNodesExp === stopNodeExp || jPath === stopNodeExp) return true; - } - return false; - } - function tagExpWithClosingIndex(xmlData, i, closingChar = ">") { - let attrBoundary; - let tagExp = ""; - for (let index = i; index < xmlData.length; index++) { - let ch = xmlData[index]; - if (attrBoundary) { - if (ch === attrBoundary) attrBoundary = ""; - } else if (ch === '"' || ch === "'") { - attrBoundary = ch; - } else if (ch === closingChar[0]) { - if (closingChar[1]) { - if (xmlData[index + 1] === closingChar[1]) { - return { - data: tagExp, - index - }; - } - } else { - return { - data: tagExp, - index - }; - } - } else if (ch === " ") { - ch = " "; + __name(_AdaptiveRetryStrategy, "AdaptiveRetryStrategy"); + var AdaptiveRetryStrategy = _AdaptiveRetryStrategy; + var import_util_middleware3 = require_dist_cjs24(); + var ENV_MAX_ATTEMPTS = "AWS_MAX_ATTEMPTS"; + var CONFIG_MAX_ATTEMPTS = "max_attempts"; + var NODE_MAX_ATTEMPT_CONFIG_OPTIONS = { + environmentVariableSelector: (env) => { + const value = env[ENV_MAX_ATTEMPTS]; + if (!value) + return void 0; + const maxAttempt = parseInt(value); + if (Number.isNaN(maxAttempt)) { + throw new Error(`Environment variable ${ENV_MAX_ATTEMPTS} mast be a number, got "${value}"`); } - tagExp += ch; - } - } - function findClosingIndex(xmlData, str, i, errMsg) { - const closingIndex = xmlData.indexOf(str, i); - if (closingIndex === -1) { - throw new Error(errMsg); - } else { - return closingIndex + str.length - 1; - } - } - function readTagExp(xmlData, i, removeNSPrefix, closingChar = ">") { - const result = tagExpWithClosingIndex(xmlData, i + 1, closingChar); - if (!result) return; - let tagExp = result.data; - const closeIndex = result.index; - const separatorIndex = tagExp.search(/\s/); - let tagName = tagExp; - let attrExpPresent = true; - if (separatorIndex !== -1) { - tagName = tagExp.substr(0, separatorIndex).replace(/\s\s*$/, ""); - tagExp = tagExp.substr(separatorIndex + 1); - } - if (removeNSPrefix) { - const colonIndex = tagName.indexOf(":"); - if (colonIndex !== -1) { - tagName = tagName.substr(colonIndex + 1); - attrExpPresent = tagName !== result.data.substr(colonIndex + 1); + return maxAttempt; + }, + configFileSelector: (profile) => { + const value = profile[CONFIG_MAX_ATTEMPTS]; + if (!value) + return void 0; + const maxAttempt = parseInt(value); + if (Number.isNaN(maxAttempt)) { + throw new Error(`Shared config file entry ${CONFIG_MAX_ATTEMPTS} mast be a number, got "${value}"`); } - } + return maxAttempt; + }, + default: import_util_retry.DEFAULT_MAX_ATTEMPTS + }; + var resolveRetryConfig = /* @__PURE__ */ __name((input) => { + const { retryStrategy } = input; + const maxAttempts = (0, import_util_middleware3.normalizeProvider)(input.maxAttempts ?? import_util_retry.DEFAULT_MAX_ATTEMPTS); return { - tagName, - tagExp, - closeIndex, - attrExpPresent + ...input, + maxAttempts, + retryStrategy: async () => { + if (retryStrategy) { + return retryStrategy; + } + const retryMode = await (0, import_util_middleware3.normalizeProvider)(input.retryMode)(); + if (retryMode === import_util_retry.RETRY_MODES.ADAPTIVE) { + return new import_util_retry.AdaptiveRetryStrategy(maxAttempts); + } + return new import_util_retry.StandardRetryStrategy(maxAttempts); + } }; - } - function readStopNodeData(xmlData, tagName, i) { - const startIndex = i; - let openTagCount = 1; - for (; i < xmlData.length; i++) { - if (xmlData[i] === "<") { - if (xmlData[i + 1] === "/") { - const closeIndex = findClosingIndex(xmlData, ">", i, `${tagName} is not closed`); - let closeTagName = xmlData.substring(i + 2, closeIndex).trim(); - if (closeTagName === tagName) { - openTagCount--; - if (openTagCount === 0) { - return { - tagContent: xmlData.substring(startIndex, i), - i: closeIndex - }; - } + }, "resolveRetryConfig"); + var ENV_RETRY_MODE = "AWS_RETRY_MODE"; + var CONFIG_RETRY_MODE = "retry_mode"; + var NODE_RETRY_MODE_CONFIG_OPTIONS = { + environmentVariableSelector: (env) => env[ENV_RETRY_MODE], + configFileSelector: (profile) => profile[CONFIG_RETRY_MODE], + default: import_util_retry.DEFAULT_RETRY_MODE + }; + var omitRetryHeadersMiddleware = /* @__PURE__ */ __name(() => (next) => async (args) => { + const { request: request2 } = args; + if (import_protocol_http8.HttpRequest.isInstance(request2)) { + delete request2.headers[import_util_retry.INVOCATION_ID_HEADER]; + delete request2.headers[import_util_retry.REQUEST_HEADER]; + } + return next(args); + }, "omitRetryHeadersMiddleware"); + var omitRetryHeadersMiddlewareOptions = { + name: "omitRetryHeadersMiddleware", + tags: ["RETRY", "HEADERS", "OMIT_RETRY_HEADERS"], + relation: "before", + toMiddleware: "awsAuthMiddleware", + override: true + }; + var getOmitRetryHeadersPlugin = /* @__PURE__ */ __name((options) => ({ + applyToStack: (clientStack) => { + clientStack.addRelativeTo(omitRetryHeadersMiddleware(), omitRetryHeadersMiddlewareOptions); + } + }), "getOmitRetryHeadersPlugin"); + var import_smithy_client5 = require_dist_cjs37(); + var import_isStreamingPayload = require_isStreamingPayload(); + var retryMiddleware = /* @__PURE__ */ __name((options) => (next, context) => async (args) => { + var _a; + let retryStrategy = await options.retryStrategy(); + const maxAttempts = await options.maxAttempts(); + if (isRetryStrategyV2(retryStrategy)) { + retryStrategy = retryStrategy; + let retryToken = await retryStrategy.acquireInitialRetryToken(context["partition_id"]); + let lastError = new Error(); + let attempts = 0; + let totalRetryDelay = 0; + const { request: request2 } = args; + const isRequest = import_protocol_http8.HttpRequest.isInstance(request2); + if (isRequest) { + request2.headers[import_util_retry.INVOCATION_ID_HEADER] = (0, import_uuid.v4)(); + } + while (true) { + try { + if (isRequest) { + request2.headers[import_util_retry.REQUEST_HEADER] = `attempt=${attempts + 1}; max=${maxAttempts}`; } - i = closeIndex; - } else if (xmlData[i + 1] === "?") { - const closeIndex = findClosingIndex(xmlData, "?>", i + 1, "StopNode is not closed."); - i = closeIndex; - } else if (xmlData.substr(i + 1, 3) === "!--") { - const closeIndex = findClosingIndex(xmlData, "-->", i + 3, "StopNode is not closed."); - i = closeIndex; - } else if (xmlData.substr(i + 1, 2) === "![") { - const closeIndex = findClosingIndex(xmlData, "]]>", i, "StopNode is not closed.") - 2; - i = closeIndex; - } else { - const tagData = readTagExp(xmlData, i, ">"); - if (tagData) { - const openTagName = tagData && tagData.tagName; - if (openTagName === tagName && tagData.tagExp[tagData.tagExp.length - 1] !== "/") { - openTagCount++; + const { response, output } = await next(args); + retryStrategy.recordSuccess(retryToken); + output.$metadata.attempts = attempts + 1; + output.$metadata.totalRetryDelay = totalRetryDelay; + return { response, output }; + } catch (e) { + const retryErrorInfo = getRetryErrorInfo(e); + lastError = asSdkError(e); + if (isRequest && (0, import_isStreamingPayload.isStreamingPayload)(request2)) { + (_a = context.logger instanceof import_smithy_client5.NoOpLogger ? console : context.logger) == null ? void 0 : _a.warn( + "An error was encountered in a non-retryable streaming request." + ); + throw lastError; + } + try { + retryToken = await retryStrategy.refreshRetryTokenForRetry(retryToken, retryErrorInfo); + } catch (refreshError) { + if (!lastError.$metadata) { + lastError.$metadata = {}; } - i = tagData.closeIndex; + lastError.$metadata.attempts = attempts + 1; + lastError.$metadata.totalRetryDelay = totalRetryDelay; + throw lastError; } + attempts = retryToken.getRetryCount(); + const delay = retryToken.getRetryDelay(); + totalRetryDelay += delay; + await new Promise((resolve) => setTimeout(resolve, delay)); } } - } - } - function parseValue(val2, shouldParse, options) { - if (shouldParse && typeof val2 === "string") { - const newval = val2.trim(); - if (newval === "true") return true; - else if (newval === "false") return false; - else return toNumber(val2, options); } else { - if (util.isExist(val2)) { - return val2; - } else { - return ""; - } + retryStrategy = retryStrategy; + if (retryStrategy == null ? void 0 : retryStrategy.mode) + context.userAgent = [...context.userAgent || [], ["cfg/retry-mode", retryStrategy.mode]]; + return retryStrategy.retry(next, args); } - } - module2.exports = OrderedObjParser; + }, "retryMiddleware"); + var isRetryStrategyV2 = /* @__PURE__ */ __name((retryStrategy) => typeof retryStrategy.acquireInitialRetryToken !== "undefined" && typeof retryStrategy.refreshRetryTokenForRetry !== "undefined" && typeof retryStrategy.recordSuccess !== "undefined", "isRetryStrategyV2"); + var getRetryErrorInfo = /* @__PURE__ */ __name((error) => { + const errorInfo = { + error, + errorType: getRetryErrorType(error) + }; + const retryAfterHint = getRetryAfterHint(error.$response); + if (retryAfterHint) { + errorInfo.retryAfterHint = retryAfterHint; + } + return errorInfo; + }, "getRetryErrorInfo"); + var getRetryErrorType = /* @__PURE__ */ __name((error) => { + if ((0, import_service_error_classification.isThrottlingError)(error)) + return "THROTTLING"; + if ((0, import_service_error_classification.isTransientError)(error)) + return "TRANSIENT"; + if ((0, import_service_error_classification.isServerError)(error)) + return "SERVER_ERROR"; + return "CLIENT_ERROR"; + }, "getRetryErrorType"); + var retryMiddlewareOptions2 = { + name: "retryMiddleware", + tags: ["RETRY"], + step: "finalizeRequest", + priority: "high", + override: true + }; + var getRetryPlugin = /* @__PURE__ */ __name((options) => ({ + applyToStack: (clientStack) => { + clientStack.add(retryMiddleware(options), retryMiddlewareOptions2); + } + }), "getRetryPlugin"); + var getRetryAfterHint = /* @__PURE__ */ __name((response) => { + if (!import_protocol_http8.HttpResponse.isInstance(response)) + return; + const retryAfterHeaderName = Object.keys(response.headers).find((key) => key.toLowerCase() === "retry-after"); + if (!retryAfterHeaderName) + return; + const retryAfter = response.headers[retryAfterHeaderName]; + const retryAfterSeconds = Number(retryAfter); + if (!Number.isNaN(retryAfterSeconds)) + return new Date(retryAfterSeconds * 1e3); + const retryAfterDate = new Date(retryAfter); + return retryAfterDate; + }, "getRetryAfterHint"); } }); -// ../../../node_modules/fast-xml-parser/src/xmlparser/node2json.js -var require_node2json = __commonJS({ - "../../../node_modules/fast-xml-parser/src/xmlparser/node2json.js"(exports2) { - "use strict"; - function prettify(node, options) { - return compress(node, options); - } - function compress(arr, options, jPath) { - let text; - const compressedObj = {}; - for (let i = 0; i < arr.length; i++) { - const tagObj = arr[i]; - const property = propName(tagObj); - let newJpath = ""; - if (jPath === void 0) newJpath = property; - else newJpath = jPath + "." + property; - if (property === options.textNodeName) { - if (text === void 0) text = tagObj[property]; - else text += "" + tagObj[property]; - } else if (property === void 0) { - continue; - } else if (tagObj[property]) { - let val2 = compress(tagObj[property], options, newJpath); - const isLeaf = isLeafTag(val2, options); - if (tagObj[":@"]) { - assignAttributes(val2, tagObj[":@"], newJpath, options); - } else if (Object.keys(val2).length === 1 && val2[options.textNodeName] !== void 0 && !options.alwaysCreateTextNode) { - val2 = val2[options.textNodeName]; - } else if (Object.keys(val2).length === 0) { - if (options.alwaysCreateTextNode) val2[options.textNodeName] = ""; - else val2 = ""; - } - if (compressedObj[property] !== void 0 && compressedObj.hasOwnProperty(property)) { - if (!Array.isArray(compressedObj[property])) { - compressedObj[property] = [compressedObj[property]]; - } - compressedObj[property].push(val2); - } else { - if (options.isArray(property, newJpath, isLeaf)) { - compressedObj[property] = [val2]; - } else { - compressedObj[property] = val2; - } - } - } - } - if (typeof text === "string") { - if (text.length > 0) compressedObj[options.textNodeName] = text; - } else if (text !== void 0) compressedObj[options.textNodeName] = text; - return compressedObj; - } - function propName(obj) { - const keys = Object.keys(obj); - for (let i = 0; i < keys.length; i++) { - const key = keys[i]; - if (key !== ":@") return key; +// ../../../node_modules/@smithy/core/dist-es/middleware-http-signing/getHttpSigningMiddleware.js +var import_middleware_retry, httpSigningMiddlewareOptions, getHttpSigningPlugin; +var init_getHttpSigningMiddleware = __esm({ + "../../../node_modules/@smithy/core/dist-es/middleware-http-signing/getHttpSigningMiddleware.js"() { + import_middleware_retry = __toESM(require_dist_cjs38()); + init_httpSigningMiddleware(); + httpSigningMiddlewareOptions = { + step: "finalizeRequest", + tags: ["HTTP_SIGNING"], + name: "httpSigningMiddleware", + aliases: ["apiKeyMiddleware", "tokenMiddleware", "awsAuthMiddleware"], + override: true, + relation: "after", + toMiddleware: import_middleware_retry.retryMiddlewareOptions.name + }; + getHttpSigningPlugin = (config) => ({ + applyToStack: (clientStack) => { + clientStack.addRelativeTo(httpSigningMiddleware(config), httpSigningMiddlewareOptions); } - } - function assignAttributes(obj, attrMap, jpath, options) { - if (attrMap) { - const keys = Object.keys(attrMap); - const len = keys.length; - for (let i = 0; i < len; i++) { - const atrrName = keys[i]; - if (options.isArray(atrrName, jpath + "." + atrrName, true, true)) { - obj[atrrName] = [attrMap[atrrName]]; - } else { - obj[atrrName] = attrMap[atrrName]; + }); + } +}); + +// ../../../node_modules/@smithy/core/dist-es/middleware-http-signing/index.js +var init_middleware_http_signing = __esm({ + "../../../node_modules/@smithy/core/dist-es/middleware-http-signing/index.js"() { + init_httpSigningMiddleware(); + init_getHttpSigningMiddleware(); + } +}); + +// ../../../node_modules/@smithy/core/dist-es/util-identity-and-auth/DefaultIdentityProviderConfig.js +var DefaultIdentityProviderConfig; +var init_DefaultIdentityProviderConfig = __esm({ + "../../../node_modules/@smithy/core/dist-es/util-identity-and-auth/DefaultIdentityProviderConfig.js"() { + DefaultIdentityProviderConfig = class { + constructor(config) { + this.authSchemes = /* @__PURE__ */ new Map(); + for (const [key, value] of Object.entries(config)) { + if (value !== void 0) { + this.authSchemes.set(key, value); } } } - } - function isLeafTag(obj, options) { - const { textNodeName } = options; - const propCount = Object.keys(obj).length; - if (propCount === 0) { - return true; - } - if (propCount === 1 && (obj[textNodeName] || typeof obj[textNodeName] === "boolean" || obj[textNodeName] === 0)) { - return true; + getIdentityProvider(schemeId) { + return this.authSchemes.get(schemeId); } - return false; - } - exports2.prettify = prettify; + }; } }); -// ../../../node_modules/fast-xml-parser/src/xmlparser/XMLParser.js -var require_XMLParser = __commonJS({ - "../../../node_modules/fast-xml-parser/src/xmlparser/XMLParser.js"(exports2, module2) { - var { buildOptions } = require_OptionsBuilder(); - var OrderedObjParser = require_OrderedObjParser(); - var { prettify } = require_node2json(); - var validator = require_validator(); - var XMLParser = class { - constructor(options) { - this.externalEntities = {}; - this.options = buildOptions(options); - } - /** - * Parse XML dats to JS object - * @param {string|Buffer} xmlData - * @param {boolean|Object} validationOption - */ - parse(xmlData, validationOption) { - if (typeof xmlData === "string") { - } else if (xmlData.toString) { - xmlData = xmlData.toString(); - } else { - throw new Error("XML data is accepted in String or Bytes[] form."); +// ../../../node_modules/@smithy/core/dist-es/util-identity-and-auth/httpAuthSchemes/httpApiKeyAuth.js +var import_protocol_http2, import_types3, HttpApiKeyAuthSigner; +var init_httpApiKeyAuth = __esm({ + "../../../node_modules/@smithy/core/dist-es/util-identity-and-auth/httpAuthSchemes/httpApiKeyAuth.js"() { + import_protocol_http2 = __toESM(require_dist_cjs20()); + import_types3 = __toESM(require_dist_cjs()); + HttpApiKeyAuthSigner = class { + async sign(httpRequest, identity, signingProperties) { + if (!signingProperties) { + throw new Error("request could not be signed with `apiKey` since the `name` and `in` signer properties are missing"); } - if (validationOption) { - if (validationOption === true) validationOption = {}; - const result = validator.validate(xmlData, validationOption); - if (result !== true) { - throw Error(`${result.err.msg}:${result.err.line}:${result.err.col}`); - } + if (!signingProperties.name) { + throw new Error("request could not be signed with `apiKey` since the `name` signer property is missing"); } - const orderedObjParser = new OrderedObjParser(this.options); - orderedObjParser.addExternalEntities(this.externalEntities); - const orderedResult = orderedObjParser.parseXml(xmlData); - if (this.options.preserveOrder || orderedResult === void 0) return orderedResult; - else return prettify(orderedResult, this.options); - } - /** - * Add Entity which is not by default supported by this library - * @param {string} key - * @param {string} value - */ - addEntity(key, value) { - if (value.indexOf("&") !== -1) { - throw new Error("Entity value can't have '&'"); - } else if (key.indexOf("&") !== -1 || key.indexOf(";") !== -1) { - throw new Error("An entity must be set without '&' and ';'. Eg. use '#xD' for ' '"); - } else if (value === "&") { - throw new Error("An entity with value '&' is not permitted"); + if (!signingProperties.in) { + throw new Error("request could not be signed with `apiKey` since the `in` signer property is missing"); + } + if (!identity.apiKey) { + throw new Error("request could not be signed with `apiKey` since the `apiKey` is not defined"); + } + const clonedRequest = import_protocol_http2.HttpRequest.clone(httpRequest); + if (signingProperties.in === import_types3.HttpApiKeyAuthLocation.QUERY) { + clonedRequest.query[signingProperties.name] = identity.apiKey; + } else if (signingProperties.in === import_types3.HttpApiKeyAuthLocation.HEADER) { + clonedRequest.headers[signingProperties.name] = signingProperties.scheme ? `${signingProperties.scheme} ${identity.apiKey}` : identity.apiKey; } else { - this.externalEntities[key] = value; + throw new Error("request can only be signed with `apiKey` locations `query` or `header`, but found: `" + signingProperties.in + "`"); } + return clonedRequest; } }; - module2.exports = XMLParser; } }); -// ../../../node_modules/fast-xml-parser/src/xmlbuilder/orderedJs2Xml.js -var require_orderedJs2Xml = __commonJS({ - "../../../node_modules/fast-xml-parser/src/xmlbuilder/orderedJs2Xml.js"(exports2, module2) { - var EOL = "\n"; - function toXml(jArray, options) { - let indentation = ""; - if (options.format && options.indentBy.length > 0) { - indentation = EOL; +// ../../../node_modules/@smithy/core/dist-es/util-identity-and-auth/httpAuthSchemes/httpBearerAuth.js +var import_protocol_http3, HttpBearerAuthSigner; +var init_httpBearerAuth = __esm({ + "../../../node_modules/@smithy/core/dist-es/util-identity-and-auth/httpAuthSchemes/httpBearerAuth.js"() { + import_protocol_http3 = __toESM(require_dist_cjs20()); + HttpBearerAuthSigner = class { + async sign(httpRequest, identity, signingProperties) { + const clonedRequest = import_protocol_http3.HttpRequest.clone(httpRequest); + if (!identity.token) { + throw new Error("request could not be signed with `token` since the `token` is not defined"); + } + clonedRequest.headers["Authorization"] = `Bearer ${identity.token}`; + return clonedRequest; } - return arrToStr(jArray, options, "", indentation); - } - function arrToStr(arr, options, jPath, indentation) { - let xmlStr = ""; - let isPreviousElementTag = false; - for (let i = 0; i < arr.length; i++) { - const tagObj = arr[i]; - const tagName = propName(tagObj); - let newJPath = ""; - if (jPath.length === 0) newJPath = tagName; - else newJPath = `${jPath}.${tagName}`; - if (tagName === options.textNodeName) { - let tagText = tagObj[tagName]; - if (!isStopNode(newJPath, options)) { - tagText = options.tagValueProcessor(tagName, tagText); - tagText = replaceEntitiesValue(tagText, options); - } - if (isPreviousElementTag) { - xmlStr += indentation; - } - xmlStr += tagText; - isPreviousElementTag = false; - continue; - } else if (tagName === options.cdataPropName) { - if (isPreviousElementTag) { - xmlStr += indentation; - } - xmlStr += ``; - isPreviousElementTag = false; - continue; - } else if (tagName === options.commentPropName) { - xmlStr += indentation + ``; - isPreviousElementTag = true; - continue; - } else if (tagName[0] === "?") { - const attStr2 = attr_to_str(tagObj[":@"], options); - const tempInd = tagName === "?xml" ? "" : indentation; - let piTextNodeName = tagObj[tagName][0][options.textNodeName]; - piTextNodeName = piTextNodeName.length !== 0 ? " " + piTextNodeName : ""; - xmlStr += tempInd + `<${tagName}${piTextNodeName}${attStr2}?>`; - isPreviousElementTag = true; - continue; + }; + } +}); + +// ../../../node_modules/@smithy/core/dist-es/util-identity-and-auth/httpAuthSchemes/noAuth.js +var NoAuthSigner; +var init_noAuth = __esm({ + "../../../node_modules/@smithy/core/dist-es/util-identity-and-auth/httpAuthSchemes/noAuth.js"() { + NoAuthSigner = class { + async sign(httpRequest, identity, signingProperties) { + return httpRequest; + } + }; + } +}); + +// ../../../node_modules/@smithy/core/dist-es/util-identity-and-auth/httpAuthSchemes/index.js +var init_httpAuthSchemes = __esm({ + "../../../node_modules/@smithy/core/dist-es/util-identity-and-auth/httpAuthSchemes/index.js"() { + init_httpApiKeyAuth(); + init_httpBearerAuth(); + init_noAuth(); + } +}); + +// ../../../node_modules/@smithy/core/dist-es/util-identity-and-auth/memoizeIdentityProvider.js +var createIsIdentityExpiredFunction, EXPIRATION_MS, isIdentityExpired, doesIdentityRequireRefresh, memoizeIdentityProvider; +var init_memoizeIdentityProvider = __esm({ + "../../../node_modules/@smithy/core/dist-es/util-identity-and-auth/memoizeIdentityProvider.js"() { + createIsIdentityExpiredFunction = (expirationMs) => (identity) => doesIdentityRequireRefresh(identity) && identity.expiration.getTime() - Date.now() < expirationMs; + EXPIRATION_MS = 3e5; + isIdentityExpired = createIsIdentityExpiredFunction(EXPIRATION_MS); + doesIdentityRequireRefresh = (identity) => identity.expiration !== void 0; + memoizeIdentityProvider = (provider, isExpired, requiresRefresh) => { + if (provider === void 0) { + return void 0; + } + const normalizedProvider = typeof provider !== "function" ? async () => Promise.resolve(provider) : provider; + let resolved; + let pending; + let hasResult; + let isConstant = false; + const coalesceProvider = async (options) => { + if (!pending) { + pending = normalizedProvider(options); } - let newIdentation = indentation; - if (newIdentation !== "") { - newIdentation += options.indentBy; + try { + resolved = await pending; + hasResult = true; + isConstant = false; + } finally { + pending = void 0; } - const attStr = attr_to_str(tagObj[":@"], options); - const tagStart = indentation + `<${tagName}${attStr}`; - const tagValue = arrToStr(tagObj[tagName], options, newJPath, newIdentation); - if (options.unpairedTags.indexOf(tagName) !== -1) { - if (options.suppressUnpairedNode) xmlStr += tagStart + ">"; - else xmlStr += tagStart + "/>"; - } else if ((!tagValue || tagValue.length === 0) && options.suppressEmptyNode) { - xmlStr += tagStart + "/>"; - } else if (tagValue && tagValue.endsWith(">")) { - xmlStr += tagStart + `>${tagValue}${indentation}`; - } else { - xmlStr += tagStart + ">"; - if (tagValue && indentation !== "" && (tagValue.includes("/>") || tagValue.includes(" { + if (!hasResult || options?.forceRefresh) { + resolved = await coalesceProvider(options); } - xmlStr += ``; + return resolved; + }; + } + return async (options) => { + if (!hasResult || options?.forceRefresh) { + resolved = await coalesceProvider(options); } - isPreviousElementTag = true; + if (isConstant) { + return resolved; + } + if (!requiresRefresh(resolved)) { + isConstant = true; + return resolved; + } + if (isExpired(resolved)) { + await coalesceProvider(options); + return resolved; + } + return resolved; + }; + }; + } +}); + +// ../../../node_modules/@smithy/core/dist-es/util-identity-and-auth/index.js +var init_util_identity_and_auth = __esm({ + "../../../node_modules/@smithy/core/dist-es/util-identity-and-auth/index.js"() { + init_DefaultIdentityProviderConfig(); + init_httpAuthSchemes(); + init_memoizeIdentityProvider(); + } +}); + +// ../../../node_modules/@smithy/core/dist-es/getSmithyContext.js +var import_types4, getSmithyContext3; +var init_getSmithyContext = __esm({ + "../../../node_modules/@smithy/core/dist-es/getSmithyContext.js"() { + import_types4 = __toESM(require_dist_cjs()); + getSmithyContext3 = (context) => context[import_types4.SMITHY_CONTEXT_KEY] || (context[import_types4.SMITHY_CONTEXT_KEY] = {}); + } +}); + +// ../../../node_modules/@smithy/core/dist-es/normalizeProvider.js +var normalizeProvider; +var init_normalizeProvider = __esm({ + "../../../node_modules/@smithy/core/dist-es/normalizeProvider.js"() { + normalizeProvider = (input) => { + if (typeof input === "function") + return input; + const promisified = Promise.resolve(input); + return () => promisified; + }; + } +}); + +// ../../../node_modules/@smithy/core/dist-es/protocols/requestBuilder.js +function requestBuilder(input, context) { + return new RequestBuilder(input, context); +} +var import_protocol_http4, import_smithy_client, RequestBuilder; +var init_requestBuilder = __esm({ + "../../../node_modules/@smithy/core/dist-es/protocols/requestBuilder.js"() { + import_protocol_http4 = __toESM(require_dist_cjs20()); + import_smithy_client = __toESM(require_dist_cjs37()); + RequestBuilder = class { + constructor(input, context) { + this.input = input; + this.context = context; + this.query = {}; + this.method = ""; + this.headers = {}; + this.path = ""; + this.body = null; + this.hostname = ""; + this.resolvePathStack = []; + } + async build() { + const { hostname, protocol = "https", port, path: basePath } = await this.context.endpoint(); + this.path = basePath; + for (const resolvePath of this.resolvePathStack) { + resolvePath(this.path); + } + return new import_protocol_http4.HttpRequest({ + protocol, + hostname: this.hostname || hostname, + port, + method: this.method, + path: this.path, + query: this.query, + body: this.body, + headers: this.headers + }); } - return xmlStr; - } - function propName(obj) { - const keys = Object.keys(obj); - for (let i = 0; i < keys.length; i++) { - const key = keys[i]; - if (key !== ":@") return key; + hn(hostname) { + this.hostname = hostname; + return this; } - } - function attr_to_str(attrMap, options) { - let attrStr = ""; - if (attrMap && !options.ignoreAttributes) { - for (let attr in attrMap) { - let attrVal = options.attributeValueProcessor(attr, attrMap[attr]); - attrVal = replaceEntitiesValue(attrVal, options); - if (attrVal === true && options.suppressBooleanAttributes) { - attrStr += ` ${attr.substr(options.attributeNamePrefix.length)}`; - } else { - attrStr += ` ${attr.substr(options.attributeNamePrefix.length)}="${attrVal}"`; - } - } + bp(uriLabel) { + this.resolvePathStack.push((basePath) => { + this.path = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + uriLabel; + }); + return this; } - return attrStr; - } - function isStopNode(jPath, options) { - jPath = jPath.substr(0, jPath.length - options.textNodeName.length - 1); - let tagName = jPath.substr(jPath.lastIndexOf(".") + 1); - for (let index in options.stopNodes) { - if (options.stopNodes[index] === jPath || options.stopNodes[index] === "*." + tagName) return true; + p(memberName, labelValueProvider, uriLabel, isGreedyLabel) { + this.resolvePathStack.push((path) => { + this.path = (0, import_smithy_client.resolvedPath)(path, this.input, memberName, labelValueProvider, uriLabel, isGreedyLabel); + }); + return this; } - return false; - } - function replaceEntitiesValue(textValue, options) { - if (textValue && textValue.length > 0 && options.processEntities) { - for (let i = 0; i < options.entities.length; i++) { - const entity = options.entities[i]; - textValue = textValue.replace(entity.regex, entity.val); - } + h(headers) { + this.headers = headers; + return this; } - return textValue; - } - module2.exports = toXml; + q(query) { + this.query = query; + return this; + } + b(body) { + this.body = body; + return this; + } + m(method) { + this.method = method; + return this; + } + }; } }); -// ../../../node_modules/fast-xml-parser/src/xmlbuilder/json2xml.js -var require_json2xml = __commonJS({ - "../../../node_modules/fast-xml-parser/src/xmlbuilder/json2xml.js"(exports2, module2) { - "use strict"; - var buildFromOrderedJs = require_orderedJs2Xml(); - var defaultOptions = { - attributeNamePrefix: "@_", - attributesGroupName: false, - textNodeName: "#text", - ignoreAttributes: true, - cdataPropName: false, - format: false, - indentBy: " ", - suppressEmptyNode: false, - suppressUnpairedNode: true, - suppressBooleanAttributes: true, - tagValueProcessor: function(key, a) { - return a; - }, - attributeValueProcessor: function(attrName, a) { - return a; - }, - preserveOrder: false, - commentPropName: false, - unpairedTags: [], - entities: [ - { regex: new RegExp("&", "g"), val: "&" }, - //it must be on top - { regex: new RegExp(">", "g"), val: ">" }, - { regex: new RegExp("<", "g"), val: "<" }, - { regex: new RegExp("'", "g"), val: "'" }, - { regex: new RegExp('"', "g"), val: """ } - ], - processEntities: true, - stopNodes: [], - // transformTagName: false, - // transformAttributeName: false, - oneListGroup: false - }; - function Builder(options) { - this.options = Object.assign({}, defaultOptions, options); - if (this.options.ignoreAttributes || this.options.attributesGroupName) { - this.isAttribute = function() { - return false; - }; - } else { - this.attrPrefixLen = this.options.attributeNamePrefix.length; - this.isAttribute = isAttribute; +// ../../../node_modules/@smithy/core/dist-es/pagination/createPaginator.js +function createPaginator(ClientCtor, CommandCtor, inputTokenName, outputTokenName, pageSizeTokenName) { + return async function* paginateOperation(config, input, ...additionalArguments) { + let token = config.startingToken || void 0; + let hasNext = true; + let page; + while (hasNext) { + input[inputTokenName] = token; + if (pageSizeTokenName) { + input[pageSizeTokenName] = input[pageSizeTokenName] ?? config.pageSize; } - this.processTextOrObjNode = processTextOrObjNode; - if (this.options.format) { - this.indentate = indentate; - this.tagEndChar = ">\n"; - this.newLine = "\n"; + if (config.client instanceof ClientCtor) { + page = await makePagedClientRequest(CommandCtor, config.client, input, ...additionalArguments); } else { - this.indentate = function() { - return ""; - }; - this.tagEndChar = ">"; - this.newLine = ""; + throw new Error(`Invalid client, expected instance of ${ClientCtor.name}`); } + yield page; + const prevToken = token; + token = get(page, outputTokenName); + hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); } - Builder.prototype.build = function(jObj) { - if (this.options.preserveOrder) { - return buildFromOrderedJs(jObj, this.options); - } else { - if (Array.isArray(jObj) && this.options.arrayNodeName && this.options.arrayNodeName.length > 1) { - jObj = { - [this.options.arrayNodeName]: jObj - }; + return void 0; + }; +} +var makePagedClientRequest, get; +var init_createPaginator = __esm({ + "../../../node_modules/@smithy/core/dist-es/pagination/createPaginator.js"() { + makePagedClientRequest = async (CommandCtor, client, input, ...args) => { + return await client.send(new CommandCtor(input), ...args); + }; + get = (fromObject, path) => { + let cursor = fromObject; + const pathComponents = path.split("."); + for (const step of pathComponents) { + if (!cursor || typeof cursor !== "object") { + return void 0; } - return this.j2x(jObj, 0).val; + cursor = cursor[step]; + } + return cursor; + }; + } +}); + +// ../../../node_modules/@smithy/core/dist-es/index.js +var dist_es_exports = {}; +__export(dist_es_exports, { + DefaultIdentityProviderConfig: () => DefaultIdentityProviderConfig, + EXPIRATION_MS: () => EXPIRATION_MS, + HttpApiKeyAuthSigner: () => HttpApiKeyAuthSigner, + HttpBearerAuthSigner: () => HttpBearerAuthSigner, + NoAuthSigner: () => NoAuthSigner, + RequestBuilder: () => RequestBuilder, + createIsIdentityExpiredFunction: () => createIsIdentityExpiredFunction, + createPaginator: () => createPaginator, + doesIdentityRequireRefresh: () => doesIdentityRequireRefresh, + getHttpAuthSchemeEndpointRuleSetPlugin: () => getHttpAuthSchemeEndpointRuleSetPlugin, + getHttpAuthSchemePlugin: () => getHttpAuthSchemePlugin, + getHttpSigningPlugin: () => getHttpSigningPlugin, + getSmithyContext: () => getSmithyContext3, + httpAuthSchemeEndpointRuleSetMiddlewareOptions: () => httpAuthSchemeEndpointRuleSetMiddlewareOptions, + httpAuthSchemeMiddleware: () => httpAuthSchemeMiddleware, + httpAuthSchemeMiddlewareOptions: () => httpAuthSchemeMiddlewareOptions, + httpSigningMiddleware: () => httpSigningMiddleware, + httpSigningMiddlewareOptions: () => httpSigningMiddlewareOptions, + isIdentityExpired: () => isIdentityExpired, + memoizeIdentityProvider: () => memoizeIdentityProvider, + normalizeProvider: () => normalizeProvider, + requestBuilder: () => requestBuilder +}); +var init_dist_es = __esm({ + "../../../node_modules/@smithy/core/dist-es/index.js"() { + init_middleware_http_auth_scheme(); + init_middleware_http_signing(); + init_util_identity_and_auth(); + init_getSmithyContext(); + init_normalizeProvider(); + init_requestBuilder(); + init_createPaginator(); + } +}); + +// ../../../node_modules/@smithy/middleware-content-length/dist-cjs/index.js +var require_dist_cjs39 = __commonJS({ + "../../../node_modules/@smithy/middleware-content-length/dist-cjs/index.js"(exports2, module2) { + var __defProp2 = Object.defineProperty; + var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; + var __getOwnPropNames2 = Object.getOwnPropertyNames; + var __hasOwnProp2 = Object.prototype.hasOwnProperty; + var __name = (target, value) => __defProp2(target, "name", { value, configurable: true }); + var __export2 = (target, all) => { + for (var name in all) + __defProp2(target, name, { get: all[name], enumerable: true }); + }; + var __copyProps2 = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames2(from)) + if (!__hasOwnProp2.call(to, key) && key !== except) + __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable }); } + return to; }; - Builder.prototype.j2x = function(jObj, level) { - let attrStr = ""; - let val2 = ""; - for (let key in jObj) { - if (typeof jObj[key] === "undefined") { - } else if (jObj[key] === null) { - if (key[0] === "?") val2 += this.indentate(level) + "<" + key + "?" + this.tagEndChar; - else val2 += this.indentate(level) + "<" + key + "/" + this.tagEndChar; - } else if (jObj[key] instanceof Date) { - val2 += this.buildTextValNode(jObj[key], key, "", level); - } else if (typeof jObj[key] !== "object") { - const attr = this.isAttribute(key); - if (attr) { - attrStr += this.buildAttrPairStr(attr, "" + jObj[key]); - } else { - if (key === this.options.textNodeName) { - let newval = this.options.tagValueProcessor(key, "" + jObj[key]); - val2 += this.replaceEntitiesValue(newval); - } else { - val2 += this.buildTextValNode(jObj[key], key, "", level); - } - } - } else if (Array.isArray(jObj[key])) { - const arrLen = jObj[key].length; - let listTagVal = ""; - for (let j = 0; j < arrLen; j++) { - const item = jObj[key][j]; - if (typeof item === "undefined") { - } else if (item === null) { - if (key[0] === "?") val2 += this.indentate(level) + "<" + key + "?" + this.tagEndChar; - else val2 += this.indentate(level) + "<" + key + "/" + this.tagEndChar; - } else if (typeof item === "object") { - if (this.options.oneListGroup) { - listTagVal += this.j2x(item, level + 1).val; - } else { - listTagVal += this.processTextOrObjNode(item, key, level); - } - } else { - listTagVal += this.buildTextValNode(item, key, "", level); - } - } - if (this.options.oneListGroup) { - listTagVal = this.buildObjectNode(listTagVal, key, "", level); - } - val2 += listTagVal; - } else { - if (this.options.attributesGroupName && key === this.options.attributesGroupName) { - const Ks = Object.keys(jObj[key]); - const L = Ks.length; - for (let j = 0; j < L; j++) { - attrStr += this.buildAttrPairStr(Ks[j], "" + jObj[key][Ks[j]]); + var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); + var src_exports = {}; + __export2(src_exports, { + contentLengthMiddleware: () => contentLengthMiddleware, + contentLengthMiddlewareOptions: () => contentLengthMiddlewareOptions, + getContentLengthPlugin: () => getContentLengthPlugin + }); + module2.exports = __toCommonJS2(src_exports); + var import_protocol_http8 = require_dist_cjs2(); + var CONTENT_LENGTH_HEADER = "content-length"; + function contentLengthMiddleware(bodyLengthChecker) { + return (next) => async (args) => { + const request2 = args.request; + if (import_protocol_http8.HttpRequest.isInstance(request2)) { + const { body, headers } = request2; + if (body && Object.keys(headers).map((str) => str.toLowerCase()).indexOf(CONTENT_LENGTH_HEADER) === -1) { + try { + const length = bodyLengthChecker(body); + request2.headers = { + ...request2.headers, + [CONTENT_LENGTH_HEADER]: String(length) + }; + } catch (error) { } - } else { - val2 += this.processTextOrObjNode(jObj[key], key, level); } } - } - return { attrStr, val: val2 }; + return next({ + ...args, + request: request2 + }); + }; + } + __name(contentLengthMiddleware, "contentLengthMiddleware"); + var contentLengthMiddlewareOptions = { + step: "build", + tags: ["SET_CONTENT_LENGTH", "CONTENT_LENGTH"], + name: "contentLengthMiddleware", + override: true }; - Builder.prototype.buildAttrPairStr = function(attrName, val2) { - val2 = this.options.attributeValueProcessor(attrName, "" + val2); - val2 = this.replaceEntitiesValue(val2); - if (this.options.suppressBooleanAttributes && val2 === "true") { - return " " + attrName; - } else return " " + attrName + '="' + val2 + '"'; + var getContentLengthPlugin = /* @__PURE__ */ __name((options) => ({ + applyToStack: (clientStack) => { + clientStack.add(contentLengthMiddleware(options.bodyLengthChecker), contentLengthMiddlewareOptions); + } + }), "getContentLengthPlugin"); + } +}); + +// ../../../node_modules/@smithy/property-provider/dist-cjs/index.js +var require_dist_cjs40 = __commonJS({ + "../../../node_modules/@smithy/property-provider/dist-cjs/index.js"(exports2, module2) { + var __defProp2 = Object.defineProperty; + var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; + var __getOwnPropNames2 = Object.getOwnPropertyNames; + var __hasOwnProp2 = Object.prototype.hasOwnProperty; + var __name = (target, value) => __defProp2(target, "name", { value, configurable: true }); + var __export2 = (target, all) => { + for (var name in all) + __defProp2(target, name, { get: all[name], enumerable: true }); }; - function processTextOrObjNode(object, key, level) { - const result = this.j2x(object, level + 1); - if (object[this.options.textNodeName] !== void 0 && Object.keys(object).length === 1) { - return this.buildTextValNode(object[this.options.textNodeName], key, result.attrStr, level); - } else { - return this.buildObjectNode(result.val, key, result.attrStr, level); + var __copyProps2 = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames2(from)) + if (!__hasOwnProp2.call(to, key) && key !== except) + __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable }); } - } - Builder.prototype.buildObjectNode = function(val2, key, attrStr, level) { - if (val2 === "") { - if (key[0] === "?") return this.indentate(level) + "<" + key + attrStr + "?" + this.tagEndChar; - else { - return this.indentate(level) + "<" + key + attrStr + this.closeTag(key) + this.tagEndChar; - } - } else { - let tagEndExp = "" + val2 + tagEndExp; - } else if (this.options.commentPropName !== false && key === this.options.commentPropName && piClosingChar.length === 0) { - return this.indentate(level) + `` + this.newLine; - } else { - return this.indentate(level) + "<" + key + attrStr + piClosingChar + this.tagEndChar + val2 + this.indentate(level) + tagEndExp; + return to; + }; + var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); + var src_exports = {}; + __export2(src_exports, { + CredentialsProviderError: () => CredentialsProviderError, + ProviderError: () => ProviderError2, + TokenProviderError: () => TokenProviderError, + chain: () => chain, + fromStatic: () => fromStatic, + memoize: () => memoize + }); + module2.exports = __toCommonJS2(src_exports); + var _ProviderError = class _ProviderError2 extends Error { + constructor(message, options = true) { + var _a; + let logger; + let tryNextLink = true; + if (typeof options === "boolean") { + logger = void 0; + tryNextLink = options; + } else if (options != null && typeof options === "object") { + logger = options.logger; + tryNextLink = options.tryNextLink ?? true; } + super(message); + this.name = "ProviderError"; + this.tryNextLink = tryNextLink; + Object.setPrototypeOf(this, _ProviderError2.prototype); + (_a = logger == null ? void 0 : logger.debug) == null ? void 0 : _a.call(logger, `@smithy/property-provider ${tryNextLink ? "->" : "(!)"} ${message}`); + } + /** + * @deprecated use new operator. + */ + static from(error, options = true) { + return Object.assign(new this(error.message, options), error); } }; - Builder.prototype.closeTag = function(key) { - let closeTag = ""; - if (this.options.unpairedTags.indexOf(key) !== -1) { - if (!this.options.suppressUnpairedNode) closeTag = "/"; - } else if (this.options.suppressEmptyNode) { - closeTag = "/"; - } else { - closeTag = `>` + this.newLine; - } else if (this.options.commentPropName !== false && key === this.options.commentPropName) { - return this.indentate(level) + `` + this.newLine; - } else if (key[0] === "?") { - return this.indentate(level) + "<" + key + attrStr + "?" + this.tagEndChar; - } else { - let textValue = this.options.tagValueProcessor(key, val2); - textValue = this.replaceEntitiesValue(textValue); - if (textValue === "") { - return this.indentate(level) + "<" + key + attrStr + this.closeTag(key) + this.tagEndChar; - } else { - return this.indentate(level) + "<" + key + attrStr + ">" + textValue + " async () => { + if (providers.length === 0) { + throw new ProviderError2("No providers in chain"); + } + let lastProviderError; + for (const provider of providers) { + try { + const credentials = await provider(); + return credentials; + } catch (err) { + lastProviderError = err; + if (err == null ? void 0 : err.tryNextLink) { + continue; + } + throw err; + } + } + throw lastProviderError; + }, "chain"); + var fromStatic = /* @__PURE__ */ __name((staticValue) => () => Promise.resolve(staticValue), "fromStatic"); + var memoize = /* @__PURE__ */ __name((provider, isExpired, requiresRefresh) => { + let resolved; + let pending; + let hasResult; + let isConstant = false; + const coalesceProvider = /* @__PURE__ */ __name(async () => { + if (!pending) { + pending = provider(); + } + try { + resolved = await pending; + hasResult = true; + isConstant = false; + } finally { + pending = void 0; } + return resolved; + }, "coalesceProvider"); + if (isExpired === void 0) { + return async (options) => { + if (!hasResult || (options == null ? void 0 : options.forceRefresh)) { + resolved = await coalesceProvider(); + } + return resolved; + }; } - }; - Builder.prototype.replaceEntitiesValue = function(textValue) { - if (textValue && textValue.length > 0 && this.options.processEntities) { - for (let i = 0; i < this.options.entities.length; i++) { - const entity = this.options.entities[i]; - textValue = textValue.replace(entity.regex, entity.val); + return async (options) => { + if (!hasResult || (options == null ? void 0 : options.forceRefresh)) { + resolved = await coalesceProvider(); + } + if (isConstant) { + return resolved; + } + if (requiresRefresh && !requiresRefresh(resolved)) { + isConstant = true; + return resolved; + } + if (isExpired(resolved)) { + await coalesceProvider(); + return resolved; } + return resolved; + }; + }, "memoize"); + } +}); + +// ../../../node_modules/@smithy/shared-ini-file-loader/dist-cjs/getHomeDir.js +var require_getHomeDir2 = __commonJS({ + "../../../node_modules/@smithy/shared-ini-file-loader/dist-cjs/getHomeDir.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.getHomeDir = void 0; + var os_1 = require("os"); + var path_1 = require("path"); + var homeDirCache = {}; + var getHomeDirCacheKey = () => { + if (process && process.geteuid) { + return `${process.geteuid()}`; } - return textValue; + return "DEFAULT"; }; - function indentate(level) { - return this.options.indentBy.repeat(level); - } - function isAttribute(name) { - if (name.startsWith(this.options.attributeNamePrefix)) { - return name.substr(this.attrPrefixLen); - } else { - return false; - } - } - module2.exports = Builder; + var getHomeDir2 = () => { + const { HOME, USERPROFILE, HOMEPATH, HOMEDRIVE = `C:${path_1.sep}` } = process.env; + if (HOME) + return HOME; + if (USERPROFILE) + return USERPROFILE; + if (HOMEPATH) + return `${HOMEDRIVE}${HOMEPATH}`; + const homeDirCacheKey = getHomeDirCacheKey(); + if (!homeDirCache[homeDirCacheKey]) + homeDirCache[homeDirCacheKey] = (0, os_1.homedir)(); + return homeDirCache[homeDirCacheKey]; + }; + exports2.getHomeDir = getHomeDir2; } }); -// ../../../node_modules/fast-xml-parser/src/fxp.js -var require_fxp = __commonJS({ - "../../../node_modules/fast-xml-parser/src/fxp.js"(exports2, module2) { +// ../../../node_modules/@smithy/shared-ini-file-loader/dist-cjs/getSSOTokenFilepath.js +var require_getSSOTokenFilepath2 = __commonJS({ + "../../../node_modules/@smithy/shared-ini-file-loader/dist-cjs/getSSOTokenFilepath.js"(exports2) { "use strict"; - var validator = require_validator(); - var XMLParser = require_XMLParser(); - var XMLBuilder = require_json2xml(); - module2.exports = { - XMLParser, - XMLValidator: validator, - XMLBuilder + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.getSSOTokenFilepath = void 0; + var crypto_1 = require("crypto"); + var path_1 = require("path"); + var getHomeDir_1 = require_getHomeDir2(); + var getSSOTokenFilepath2 = (id) => { + const hasher = (0, crypto_1.createHash)("sha1"); + const cacheName = hasher.update(id).digest("hex"); + return (0, path_1.join)((0, getHomeDir_1.getHomeDir)(), ".aws", "sso", "cache", `${cacheName}.json`); }; + exports2.getSSOTokenFilepath = getSSOTokenFilepath2; } }); -// ../../../node_modules/@aws-sdk/client-sts/dist-cjs/protocols/Aws_query.js -var require_Aws_query = __commonJS({ - "../../../node_modules/@aws-sdk/client-sts/dist-cjs/protocols/Aws_query.js"(exports2) { +// ../../../node_modules/@smithy/shared-ini-file-loader/dist-cjs/getSSOTokenFromFile.js +var require_getSSOTokenFromFile2 = __commonJS({ + "../../../node_modules/@smithy/shared-ini-file-loader/dist-cjs/getSSOTokenFromFile.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.de_GetSessionTokenCommand = exports2.de_GetFederationTokenCommand = exports2.de_GetCallerIdentityCommand = exports2.de_GetAccessKeyInfoCommand = exports2.de_DecodeAuthorizationMessageCommand = exports2.de_AssumeRoleWithWebIdentityCommand = exports2.de_AssumeRoleWithSAMLCommand = exports2.de_AssumeRoleCommand = exports2.se_GetSessionTokenCommand = exports2.se_GetFederationTokenCommand = exports2.se_GetCallerIdentityCommand = exports2.se_GetAccessKeyInfoCommand = exports2.se_DecodeAuthorizationMessageCommand = exports2.se_AssumeRoleWithWebIdentityCommand = exports2.se_AssumeRoleWithSAMLCommand = exports2.se_AssumeRoleCommand = void 0; - var protocol_http_1 = require_dist_cjs2(); - var smithy_client_1 = require_dist_cjs34(); - var fast_xml_parser_1 = require_fxp(); - var models_0_1 = require_models_0(); - var STSServiceException_1 = require_STSServiceException(); - var se_AssumeRoleCommand = async (input, context) => { - const headers = SHARED_HEADERS; - let body; - body = buildFormUrlencodedString({ - ...se_AssumeRoleRequest(input, context), - Action: "AssumeRole", - Version: "2011-06-15" - }); - return buildHttpRpcRequest(context, headers, "/", void 0, body); - }; - exports2.se_AssumeRoleCommand = se_AssumeRoleCommand; - var se_AssumeRoleWithSAMLCommand = async (input, context) => { - const headers = SHARED_HEADERS; - let body; - body = buildFormUrlencodedString({ - ...se_AssumeRoleWithSAMLRequest(input, context), - Action: "AssumeRoleWithSAML", - Version: "2011-06-15" - }); - return buildHttpRpcRequest(context, headers, "/", void 0, body); - }; - exports2.se_AssumeRoleWithSAMLCommand = se_AssumeRoleWithSAMLCommand; - var se_AssumeRoleWithWebIdentityCommand = async (input, context) => { - const headers = SHARED_HEADERS; - let body; - body = buildFormUrlencodedString({ - ...se_AssumeRoleWithWebIdentityRequest(input, context), - Action: "AssumeRoleWithWebIdentity", - Version: "2011-06-15" - }); - return buildHttpRpcRequest(context, headers, "/", void 0, body); - }; - exports2.se_AssumeRoleWithWebIdentityCommand = se_AssumeRoleWithWebIdentityCommand; - var se_DecodeAuthorizationMessageCommand = async (input, context) => { - const headers = SHARED_HEADERS; - let body; - body = buildFormUrlencodedString({ - ...se_DecodeAuthorizationMessageRequest(input, context), - Action: "DecodeAuthorizationMessage", - Version: "2011-06-15" - }); - return buildHttpRpcRequest(context, headers, "/", void 0, body); - }; - exports2.se_DecodeAuthorizationMessageCommand = se_DecodeAuthorizationMessageCommand; - var se_GetAccessKeyInfoCommand = async (input, context) => { - const headers = SHARED_HEADERS; - let body; - body = buildFormUrlencodedString({ - ...se_GetAccessKeyInfoRequest(input, context), - Action: "GetAccessKeyInfo", - Version: "2011-06-15" - }); - return buildHttpRpcRequest(context, headers, "/", void 0, body); + exports2.getSSOTokenFromFile = void 0; + var fs_1 = require("fs"); + var getSSOTokenFilepath_1 = require_getSSOTokenFilepath2(); + var { readFile } = fs_1.promises; + var getSSOTokenFromFile2 = async (id) => { + const ssoTokenFilepath = (0, getSSOTokenFilepath_1.getSSOTokenFilepath)(id); + const ssoTokenText = await readFile(ssoTokenFilepath, "utf8"); + return JSON.parse(ssoTokenText); }; - exports2.se_GetAccessKeyInfoCommand = se_GetAccessKeyInfoCommand; - var se_GetCallerIdentityCommand = async (input, context) => { - const headers = SHARED_HEADERS; - let body; - body = buildFormUrlencodedString({ - ...se_GetCallerIdentityRequest(input, context), - Action: "GetCallerIdentity", - Version: "2011-06-15" - }); - return buildHttpRpcRequest(context, headers, "/", void 0, body); + exports2.getSSOTokenFromFile = getSSOTokenFromFile2; + } +}); + +// ../../../node_modules/@smithy/shared-ini-file-loader/dist-cjs/slurpFile.js +var require_slurpFile2 = __commonJS({ + "../../../node_modules/@smithy/shared-ini-file-loader/dist-cjs/slurpFile.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.slurpFile = void 0; + var fs_1 = require("fs"); + var { readFile } = fs_1.promises; + var filePromisesHash = {}; + var slurpFile = (path, options) => { + if (!filePromisesHash[path] || (options === null || options === void 0 ? void 0 : options.ignoreCache)) { + filePromisesHash[path] = readFile(path, "utf8"); + } + return filePromisesHash[path]; }; - exports2.se_GetCallerIdentityCommand = se_GetCallerIdentityCommand; - var se_GetFederationTokenCommand = async (input, context) => { - const headers = SHARED_HEADERS; - let body; - body = buildFormUrlencodedString({ - ...se_GetFederationTokenRequest(input, context), - Action: "GetFederationToken", - Version: "2011-06-15" - }); - return buildHttpRpcRequest(context, headers, "/", void 0, body); + exports2.slurpFile = slurpFile; + } +}); + +// ../../../node_modules/@smithy/shared-ini-file-loader/dist-cjs/index.js +var require_dist_cjs41 = __commonJS({ + "../../../node_modules/@smithy/shared-ini-file-loader/dist-cjs/index.js"(exports2, module2) { + var __defProp2 = Object.defineProperty; + var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; + var __getOwnPropNames2 = Object.getOwnPropertyNames; + var __hasOwnProp2 = Object.prototype.hasOwnProperty; + var __name = (target, value) => __defProp2(target, "name", { value, configurable: true }); + var __export2 = (target, all) => { + for (var name in all) + __defProp2(target, name, { get: all[name], enumerable: true }); }; - exports2.se_GetFederationTokenCommand = se_GetFederationTokenCommand; - var se_GetSessionTokenCommand = async (input, context) => { - const headers = SHARED_HEADERS; - let body; - body = buildFormUrlencodedString({ - ...se_GetSessionTokenRequest(input, context), - Action: "GetSessionToken", - Version: "2011-06-15" - }); - return buildHttpRpcRequest(context, headers, "/", void 0, body); + var __copyProps2 = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames2(from)) + if (!__hasOwnProp2.call(to, key) && key !== except) + __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable }); + } + return to; }; - exports2.se_GetSessionTokenCommand = se_GetSessionTokenCommand; - var de_AssumeRoleCommand = async (output, context) => { - if (output.statusCode >= 300) { - return de_AssumeRoleCommandError(output, context); + var __reExport = (target, mod, secondTarget) => (__copyProps2(target, mod, "default"), secondTarget && __copyProps2(secondTarget, mod, "default")); + var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); + var src_exports = {}; + __export2(src_exports, { + CONFIG_PREFIX_SEPARATOR: () => CONFIG_PREFIX_SEPARATOR, + DEFAULT_PROFILE: () => DEFAULT_PROFILE, + ENV_PROFILE: () => ENV_PROFILE, + getProfileName: () => getProfileName, + loadSharedConfigFiles: () => loadSharedConfigFiles, + loadSsoSessionData: () => loadSsoSessionData, + parseKnownFiles: () => parseKnownFiles + }); + module2.exports = __toCommonJS2(src_exports); + __reExport(src_exports, require_getHomeDir2(), module2.exports); + var ENV_PROFILE = "AWS_PROFILE"; + var DEFAULT_PROFILE = "default"; + var getProfileName = /* @__PURE__ */ __name((init) => init.profile || process.env[ENV_PROFILE] || DEFAULT_PROFILE, "getProfileName"); + __reExport(src_exports, require_getSSOTokenFilepath2(), module2.exports); + __reExport(src_exports, require_getSSOTokenFromFile2(), module2.exports); + var import_types5 = require_dist_cjs(); + var getConfigData = /* @__PURE__ */ __name((data) => Object.entries(data).filter(([key]) => { + const indexOfSeparator = key.indexOf(CONFIG_PREFIX_SEPARATOR); + if (indexOfSeparator === -1) { + return false; + } + return Object.values(import_types5.IniSectionType).includes(key.substring(0, indexOfSeparator)); + }).reduce( + (acc, [key, value]) => { + const indexOfSeparator = key.indexOf(CONFIG_PREFIX_SEPARATOR); + const updatedKey = key.substring(0, indexOfSeparator) === import_types5.IniSectionType.PROFILE ? key.substring(indexOfSeparator + 1) : key; + acc[updatedKey] = value; + return acc; + }, + { + // Populate default profile, if present. + ...data.default && { default: data.default } + } + ), "getConfigData"); + var import_path = require("path"); + var import_getHomeDir = require_getHomeDir2(); + var ENV_CONFIG_PATH = "AWS_CONFIG_FILE"; + var getConfigFilepath = /* @__PURE__ */ __name(() => process.env[ENV_CONFIG_PATH] || (0, import_path.join)((0, import_getHomeDir.getHomeDir)(), ".aws", "config"), "getConfigFilepath"); + var import_getHomeDir2 = require_getHomeDir2(); + var ENV_CREDENTIALS_PATH = "AWS_SHARED_CREDENTIALS_FILE"; + var getCredentialsFilepath = /* @__PURE__ */ __name(() => process.env[ENV_CREDENTIALS_PATH] || (0, import_path.join)((0, import_getHomeDir2.getHomeDir)(), ".aws", "credentials"), "getCredentialsFilepath"); + var import_getHomeDir3 = require_getHomeDir2(); + var prefixKeyRegex = /^([\w-]+)\s(["'])?([\w-@\+\.%:/]+)\2$/; + var profileNameBlockList = ["__proto__", "profile __proto__"]; + var parseIni = /* @__PURE__ */ __name((iniData) => { + const map = {}; + let currentSection; + let currentSubSection; + for (const iniLine of iniData.split(/\r?\n/)) { + const trimmedLine = iniLine.split(/(^|\s)[;#]/)[0].trim(); + const isSection = trimmedLine[0] === "[" && trimmedLine[trimmedLine.length - 1] === "]"; + if (isSection) { + currentSection = void 0; + currentSubSection = void 0; + const sectionName = trimmedLine.substring(1, trimmedLine.length - 1); + const matches = prefixKeyRegex.exec(sectionName); + if (matches) { + const [, prefix, , name] = matches; + if (Object.values(import_types5.IniSectionType).includes(prefix)) { + currentSection = [prefix, name].join(CONFIG_PREFIX_SEPARATOR); + } + } else { + currentSection = sectionName; + } + if (profileNameBlockList.includes(sectionName)) { + throw new Error(`Found invalid profile name "${sectionName}"`); + } + } else if (currentSection) { + const indexOfEqualsSign = trimmedLine.indexOf("="); + if (![0, -1].includes(indexOfEqualsSign)) { + const [name, value] = [ + trimmedLine.substring(0, indexOfEqualsSign).trim(), + trimmedLine.substring(indexOfEqualsSign + 1).trim() + ]; + if (value === "") { + currentSubSection = name; + } else { + if (currentSubSection && iniLine.trimStart() === iniLine) { + currentSubSection = void 0; + } + map[currentSection] = map[currentSection] || {}; + const key = currentSubSection ? [currentSubSection, name].join(CONFIG_PREFIX_SEPARATOR) : name; + map[currentSection][key] = value; + } + } + } } - const data = await parseBody(output.body, context); - let contents = {}; - contents = de_AssumeRoleResponse(data.AssumeRoleResult, context); - const response = { - $metadata: deserializeMetadata(output), - ...contents - }; - return response; - }; - exports2.de_AssumeRoleCommand = de_AssumeRoleCommand; - var de_AssumeRoleCommandError = async (output, context) => { - const parsedOutput = { - ...output, - body: await parseErrorBody(output.body, context) - }; - const errorCode = loadQueryErrorCode(output, parsedOutput.body); - switch (errorCode) { - case "ExpiredTokenException": - case "com.amazonaws.sts#ExpiredTokenException": - throw await de_ExpiredTokenExceptionRes(parsedOutput, context); - case "MalformedPolicyDocument": - case "com.amazonaws.sts#MalformedPolicyDocumentException": - throw await de_MalformedPolicyDocumentExceptionRes(parsedOutput, context); - case "PackedPolicyTooLarge": - case "com.amazonaws.sts#PackedPolicyTooLargeException": - throw await de_PackedPolicyTooLargeExceptionRes(parsedOutput, context); - case "RegionDisabledException": - case "com.amazonaws.sts#RegionDisabledException": - throw await de_RegionDisabledExceptionRes(parsedOutput, context); - default: - const parsedBody = parsedOutput.body; - return throwDefaultError({ - output, - parsedBody: parsedBody.Error, - errorCode - }); + return map; + }, "parseIni"); + var import_slurpFile = require_slurpFile2(); + var swallowError = /* @__PURE__ */ __name(() => ({}), "swallowError"); + var CONFIG_PREFIX_SEPARATOR = "."; + var loadSharedConfigFiles = /* @__PURE__ */ __name(async (init = {}) => { + const { filepath = getCredentialsFilepath(), configFilepath = getConfigFilepath() } = init; + const homeDir = (0, import_getHomeDir3.getHomeDir)(); + const relativeHomeDirPrefix = "~/"; + let resolvedFilepath = filepath; + if (filepath.startsWith(relativeHomeDirPrefix)) { + resolvedFilepath = (0, import_path.join)(homeDir, filepath.slice(2)); } - }; - var de_AssumeRoleWithSAMLCommand = async (output, context) => { - if (output.statusCode >= 300) { - return de_AssumeRoleWithSAMLCommandError(output, context); + let resolvedConfigFilepath = configFilepath; + if (configFilepath.startsWith(relativeHomeDirPrefix)) { + resolvedConfigFilepath = (0, import_path.join)(homeDir, configFilepath.slice(2)); } - const data = await parseBody(output.body, context); - let contents = {}; - contents = de_AssumeRoleWithSAMLResponse(data.AssumeRoleWithSAMLResult, context); - const response = { - $metadata: deserializeMetadata(output), - ...contents - }; - return response; - }; - exports2.de_AssumeRoleWithSAMLCommand = de_AssumeRoleWithSAMLCommand; - var de_AssumeRoleWithSAMLCommandError = async (output, context) => { - const parsedOutput = { - ...output, - body: await parseErrorBody(output.body, context) + const parsedFiles = await Promise.all([ + (0, import_slurpFile.slurpFile)(resolvedConfigFilepath, { + ignoreCache: init.ignoreCache + }).then(parseIni).then(getConfigData).catch(swallowError), + (0, import_slurpFile.slurpFile)(resolvedFilepath, { + ignoreCache: init.ignoreCache + }).then(parseIni).catch(swallowError) + ]); + return { + configFile: parsedFiles[0], + credentialsFile: parsedFiles[1] }; - const errorCode = loadQueryErrorCode(output, parsedOutput.body); - switch (errorCode) { - case "ExpiredTokenException": - case "com.amazonaws.sts#ExpiredTokenException": - throw await de_ExpiredTokenExceptionRes(parsedOutput, context); - case "IDPRejectedClaim": - case "com.amazonaws.sts#IDPRejectedClaimException": - throw await de_IDPRejectedClaimExceptionRes(parsedOutput, context); - case "InvalidIdentityToken": - case "com.amazonaws.sts#InvalidIdentityTokenException": - throw await de_InvalidIdentityTokenExceptionRes(parsedOutput, context); - case "MalformedPolicyDocument": - case "com.amazonaws.sts#MalformedPolicyDocumentException": - throw await de_MalformedPolicyDocumentExceptionRes(parsedOutput, context); - case "PackedPolicyTooLarge": - case "com.amazonaws.sts#PackedPolicyTooLargeException": - throw await de_PackedPolicyTooLargeExceptionRes(parsedOutput, context); - case "RegionDisabledException": - case "com.amazonaws.sts#RegionDisabledException": - throw await de_RegionDisabledExceptionRes(parsedOutput, context); - default: - const parsedBody = parsedOutput.body; - return throwDefaultError({ - output, - parsedBody: parsedBody.Error, - errorCode - }); + }, "loadSharedConfigFiles"); + var getSsoSessionData = /* @__PURE__ */ __name((data) => Object.entries(data).filter(([key]) => key.startsWith(import_types5.IniSectionType.SSO_SESSION + CONFIG_PREFIX_SEPARATOR)).reduce((acc, [key, value]) => ({ ...acc, [key.substring(key.indexOf(CONFIG_PREFIX_SEPARATOR) + 1)]: value }), {}), "getSsoSessionData"); + var import_slurpFile2 = require_slurpFile2(); + var swallowError2 = /* @__PURE__ */ __name(() => ({}), "swallowError"); + var loadSsoSessionData = /* @__PURE__ */ __name(async (init = {}) => (0, import_slurpFile2.slurpFile)(init.configFilepath ?? getConfigFilepath()).then(parseIni).then(getSsoSessionData).catch(swallowError2), "loadSsoSessionData"); + var mergeConfigFiles = /* @__PURE__ */ __name((...files) => { + const merged = {}; + for (const file of files) { + for (const [key, values] of Object.entries(file)) { + if (merged[key] !== void 0) { + Object.assign(merged[key], values); + } else { + merged[key] = values; + } + } } + return merged; + }, "mergeConfigFiles"); + var parseKnownFiles = /* @__PURE__ */ __name(async (init) => { + const parsedFiles = await loadSharedConfigFiles(init); + return mergeConfigFiles(parsedFiles.configFile, parsedFiles.credentialsFile); + }, "parseKnownFiles"); + } +}); + +// ../../../node_modules/@smithy/node-config-provider/dist-cjs/index.js +var require_dist_cjs42 = __commonJS({ + "../../../node_modules/@smithy/node-config-provider/dist-cjs/index.js"(exports2, module2) { + var __defProp2 = Object.defineProperty; + var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; + var __getOwnPropNames2 = Object.getOwnPropertyNames; + var __hasOwnProp2 = Object.prototype.hasOwnProperty; + var __name = (target, value) => __defProp2(target, "name", { value, configurable: true }); + var __export2 = (target, all) => { + for (var name in all) + __defProp2(target, name, { get: all[name], enumerable: true }); }; - var de_AssumeRoleWithWebIdentityCommand = async (output, context) => { - if (output.statusCode >= 300) { - return de_AssumeRoleWithWebIdentityCommandError(output, context); + var __copyProps2 = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames2(from)) + if (!__hasOwnProp2.call(to, key) && key !== except) + __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable }); } - const data = await parseBody(output.body, context); - let contents = {}; - contents = de_AssumeRoleWithWebIdentityResponse(data.AssumeRoleWithWebIdentityResult, context); - const response = { - $metadata: deserializeMetadata(output), - ...contents - }; - return response; + return to; }; - exports2.de_AssumeRoleWithWebIdentityCommand = de_AssumeRoleWithWebIdentityCommand; - var de_AssumeRoleWithWebIdentityCommandError = async (output, context) => { - const parsedOutput = { - ...output, - body: await parseErrorBody(output.body, context) - }; - const errorCode = loadQueryErrorCode(output, parsedOutput.body); - switch (errorCode) { - case "ExpiredTokenException": - case "com.amazonaws.sts#ExpiredTokenException": - throw await de_ExpiredTokenExceptionRes(parsedOutput, context); - case "IDPCommunicationError": - case "com.amazonaws.sts#IDPCommunicationErrorException": - throw await de_IDPCommunicationErrorExceptionRes(parsedOutput, context); - case "IDPRejectedClaim": - case "com.amazonaws.sts#IDPRejectedClaimException": - throw await de_IDPRejectedClaimExceptionRes(parsedOutput, context); - case "InvalidIdentityToken": - case "com.amazonaws.sts#InvalidIdentityTokenException": - throw await de_InvalidIdentityTokenExceptionRes(parsedOutput, context); - case "MalformedPolicyDocument": - case "com.amazonaws.sts#MalformedPolicyDocumentException": - throw await de_MalformedPolicyDocumentExceptionRes(parsedOutput, context); - case "PackedPolicyTooLarge": - case "com.amazonaws.sts#PackedPolicyTooLargeException": - throw await de_PackedPolicyTooLargeExceptionRes(parsedOutput, context); - case "RegionDisabledException": - case "com.amazonaws.sts#RegionDisabledException": - throw await de_RegionDisabledExceptionRes(parsedOutput, context); - default: - const parsedBody = parsedOutput.body; - return throwDefaultError({ - output, - parsedBody: parsedBody.Error, - errorCode - }); + var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); + var src_exports = {}; + __export2(src_exports, { + loadConfig: () => loadConfig + }); + module2.exports = __toCommonJS2(src_exports); + var import_property_provider2 = require_dist_cjs40(); + function getSelectorName(functionString) { + try { + const constants = new Set(Array.from(functionString.match(/([A-Z_]){3,}/g) ?? [])); + constants.delete("CONFIG"); + constants.delete("CONFIG_PREFIX_SEPARATOR"); + constants.delete("ENV"); + return [...constants].join(", "); + } catch (e) { + return functionString; } - }; - var de_DecodeAuthorizationMessageCommand = async (output, context) => { - if (output.statusCode >= 300) { - return de_DecodeAuthorizationMessageCommandError(output, context); + } + __name(getSelectorName, "getSelectorName"); + var fromEnv = /* @__PURE__ */ __name((envVarSelector, logger) => async () => { + try { + const config = envVarSelector(process.env); + if (config === void 0) { + throw new Error(); + } + return config; + } catch (e) { + throw new import_property_provider2.CredentialsProviderError( + e.message || `Not found in ENV: ${getSelectorName(envVarSelector.toString())}`, + { logger } + ); } - const data = await parseBody(output.body, context); - let contents = {}; - contents = de_DecodeAuthorizationMessageResponse(data.DecodeAuthorizationMessageResult, context); - const response = { - $metadata: deserializeMetadata(output), - ...contents - }; - return response; - }; - exports2.de_DecodeAuthorizationMessageCommand = de_DecodeAuthorizationMessageCommand; - var de_DecodeAuthorizationMessageCommandError = async (output, context) => { - const parsedOutput = { - ...output, - body: await parseErrorBody(output.body, context) - }; - const errorCode = loadQueryErrorCode(output, parsedOutput.body); - switch (errorCode) { - case "InvalidAuthorizationMessageException": - case "com.amazonaws.sts#InvalidAuthorizationMessageException": - throw await de_InvalidAuthorizationMessageExceptionRes(parsedOutput, context); - default: - const parsedBody = parsedOutput.body; - return throwDefaultError({ - output, - parsedBody: parsedBody.Error, - errorCode - }); + }, "fromEnv"); + var import_shared_ini_file_loader = require_dist_cjs41(); + var fromSharedConfigFiles = /* @__PURE__ */ __name((configSelector, { preferredFile = "config", ...init } = {}) => async () => { + const profile = (0, import_shared_ini_file_loader.getProfileName)(init); + const { configFile, credentialsFile } = await (0, import_shared_ini_file_loader.loadSharedConfigFiles)(init); + const profileFromCredentials = credentialsFile[profile] || {}; + const profileFromConfig = configFile[profile] || {}; + const mergedProfile = preferredFile === "config" ? { ...profileFromCredentials, ...profileFromConfig } : { ...profileFromConfig, ...profileFromCredentials }; + try { + const cfgFile = preferredFile === "config" ? configFile : credentialsFile; + const configValue = configSelector(mergedProfile, cfgFile); + if (configValue === void 0) { + throw new Error(); + } + return configValue; + } catch (e) { + throw new import_property_provider2.CredentialsProviderError( + e.message || `Not found in config files w/ profile [${profile}]: ${getSelectorName(configSelector.toString())}`, + { logger: init.logger } + ); } + }, "fromSharedConfigFiles"); + var isFunction = /* @__PURE__ */ __name((func) => typeof func === "function", "isFunction"); + var fromStatic = /* @__PURE__ */ __name((defaultValue) => isFunction(defaultValue) ? async () => await defaultValue() : (0, import_property_provider2.fromStatic)(defaultValue), "fromStatic"); + var loadConfig = /* @__PURE__ */ __name(({ environmentVariableSelector, configFileSelector, default: defaultValue }, configuration = {}) => (0, import_property_provider2.memoize)( + (0, import_property_provider2.chain)( + fromEnv(environmentVariableSelector), + fromSharedConfigFiles(configFileSelector, configuration), + fromStatic(defaultValue) + ) + ), "loadConfig"); + } +}); + +// ../../../node_modules/@smithy/middleware-endpoint/dist-cjs/adaptors/getEndpointUrlConfig.js +var require_getEndpointUrlConfig2 = __commonJS({ + "../../../node_modules/@smithy/middleware-endpoint/dist-cjs/adaptors/getEndpointUrlConfig.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.getEndpointUrlConfig = void 0; + var shared_ini_file_loader_1 = require_dist_cjs41(); + var ENV_ENDPOINT_URL = "AWS_ENDPOINT_URL"; + var CONFIG_ENDPOINT_URL = "endpoint_url"; + var getEndpointUrlConfig = (serviceId) => ({ + environmentVariableSelector: (env) => { + const serviceSuffixParts = serviceId.split(" ").map((w) => w.toUpperCase()); + const serviceEndpointUrl = env[[ENV_ENDPOINT_URL, ...serviceSuffixParts].join("_")]; + if (serviceEndpointUrl) + return serviceEndpointUrl; + const endpointUrl = env[ENV_ENDPOINT_URL]; + if (endpointUrl) + return endpointUrl; + return void 0; + }, + configFileSelector: (profile, config) => { + if (config && profile.services) { + const servicesSection = config[["services", profile.services].join(shared_ini_file_loader_1.CONFIG_PREFIX_SEPARATOR)]; + if (servicesSection) { + const servicePrefixParts = serviceId.split(" ").map((w) => w.toLowerCase()); + const endpointUrl2 = servicesSection[[servicePrefixParts.join("_"), CONFIG_ENDPOINT_URL].join(shared_ini_file_loader_1.CONFIG_PREFIX_SEPARATOR)]; + if (endpointUrl2) + return endpointUrl2; + } + } + const endpointUrl = profile[CONFIG_ENDPOINT_URL]; + if (endpointUrl) + return endpointUrl; + return void 0; + }, + default: void 0 + }); + exports2.getEndpointUrlConfig = getEndpointUrlConfig; + } +}); + +// ../../../node_modules/@smithy/middleware-endpoint/dist-cjs/adaptors/getEndpointFromConfig.js +var require_getEndpointFromConfig2 = __commonJS({ + "../../../node_modules/@smithy/middleware-endpoint/dist-cjs/adaptors/getEndpointFromConfig.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.getEndpointFromConfig = void 0; + var node_config_provider_1 = require_dist_cjs42(); + var getEndpointUrlConfig_1 = require_getEndpointUrlConfig2(); + var getEndpointFromConfig = async (serviceId) => (0, node_config_provider_1.loadConfig)((0, getEndpointUrlConfig_1.getEndpointUrlConfig)(serviceId !== null && serviceId !== void 0 ? serviceId : ""))(); + exports2.getEndpointFromConfig = getEndpointFromConfig; + } +}); + +// ../../../node_modules/@smithy/querystring-parser/dist-cjs/index.js +var require_dist_cjs43 = __commonJS({ + "../../../node_modules/@smithy/querystring-parser/dist-cjs/index.js"(exports2, module2) { + var __defProp2 = Object.defineProperty; + var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; + var __getOwnPropNames2 = Object.getOwnPropertyNames; + var __hasOwnProp2 = Object.prototype.hasOwnProperty; + var __name = (target, value) => __defProp2(target, "name", { value, configurable: true }); + var __export2 = (target, all) => { + for (var name in all) + __defProp2(target, name, { get: all[name], enumerable: true }); }; - var de_GetAccessKeyInfoCommand = async (output, context) => { - if (output.statusCode >= 300) { - return de_GetAccessKeyInfoCommandError(output, context); + var __copyProps2 = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames2(from)) + if (!__hasOwnProp2.call(to, key) && key !== except) + __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable }); } - const data = await parseBody(output.body, context); - let contents = {}; - contents = de_GetAccessKeyInfoResponse(data.GetAccessKeyInfoResult, context); - const response = { - $metadata: deserializeMetadata(output), - ...contents - }; - return response; - }; - exports2.de_GetAccessKeyInfoCommand = de_GetAccessKeyInfoCommand; - var de_GetAccessKeyInfoCommandError = async (output, context) => { - const parsedOutput = { - ...output, - body: await parseErrorBody(output.body, context) - }; - const errorCode = loadQueryErrorCode(output, parsedOutput.body); - const parsedBody = parsedOutput.body; - return throwDefaultError({ - output, - parsedBody: parsedBody.Error, - errorCode - }); + return to; }; - var de_GetCallerIdentityCommand = async (output, context) => { - if (output.statusCode >= 300) { - return de_GetCallerIdentityCommandError(output, context); + var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); + var src_exports = {}; + __export2(src_exports, { + parseQueryString: () => parseQueryString + }); + module2.exports = __toCommonJS2(src_exports); + function parseQueryString(querystring) { + const query = {}; + querystring = querystring.replace(/^\?/, ""); + if (querystring) { + for (const pair of querystring.split("&")) { + let [key, value = null] = pair.split("="); + key = decodeURIComponent(key); + if (value) { + value = decodeURIComponent(value); + } + if (!(key in query)) { + query[key] = value; + } else if (Array.isArray(query[key])) { + query[key].push(value); + } else { + query[key] = [query[key], value]; + } + } } - const data = await parseBody(output.body, context); - let contents = {}; - contents = de_GetCallerIdentityResponse(data.GetCallerIdentityResult, context); - const response = { - $metadata: deserializeMetadata(output), - ...contents - }; - return response; - }; - exports2.de_GetCallerIdentityCommand = de_GetCallerIdentityCommand; - var de_GetCallerIdentityCommandError = async (output, context) => { - const parsedOutput = { - ...output, - body: await parseErrorBody(output.body, context) - }; - const errorCode = loadQueryErrorCode(output, parsedOutput.body); - const parsedBody = parsedOutput.body; - return throwDefaultError({ - output, - parsedBody: parsedBody.Error, - errorCode - }); + return query; + } + __name(parseQueryString, "parseQueryString"); + } +}); + +// ../../../node_modules/@smithy/url-parser/dist-cjs/index.js +var require_dist_cjs44 = __commonJS({ + "../../../node_modules/@smithy/url-parser/dist-cjs/index.js"(exports2, module2) { + var __defProp2 = Object.defineProperty; + var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; + var __getOwnPropNames2 = Object.getOwnPropertyNames; + var __hasOwnProp2 = Object.prototype.hasOwnProperty; + var __name = (target, value) => __defProp2(target, "name", { value, configurable: true }); + var __export2 = (target, all) => { + for (var name in all) + __defProp2(target, name, { get: all[name], enumerable: true }); }; - var de_GetFederationTokenCommand = async (output, context) => { - if (output.statusCode >= 300) { - return de_GetFederationTokenCommandError(output, context); + var __copyProps2 = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames2(from)) + if (!__hasOwnProp2.call(to, key) && key !== except) + __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable }); } - const data = await parseBody(output.body, context); - let contents = {}; - contents = de_GetFederationTokenResponse(data.GetFederationTokenResult, context); - const response = { - $metadata: deserializeMetadata(output), - ...contents - }; - return response; + return to; }; - exports2.de_GetFederationTokenCommand = de_GetFederationTokenCommand; - var de_GetFederationTokenCommandError = async (output, context) => { - const parsedOutput = { - ...output, - body: await parseErrorBody(output.body, context) - }; - const errorCode = loadQueryErrorCode(output, parsedOutput.body); - switch (errorCode) { - case "MalformedPolicyDocument": - case "com.amazonaws.sts#MalformedPolicyDocumentException": - throw await de_MalformedPolicyDocumentExceptionRes(parsedOutput, context); - case "PackedPolicyTooLarge": - case "com.amazonaws.sts#PackedPolicyTooLargeException": - throw await de_PackedPolicyTooLargeExceptionRes(parsedOutput, context); - case "RegionDisabledException": - case "com.amazonaws.sts#RegionDisabledException": - throw await de_RegionDisabledExceptionRes(parsedOutput, context); - default: - const parsedBody = parsedOutput.body; - return throwDefaultError({ - output, - parsedBody: parsedBody.Error, - errorCode - }); + var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); + var src_exports = {}; + __export2(src_exports, { + parseUrl: () => parseUrl + }); + module2.exports = __toCommonJS2(src_exports); + var import_querystring_parser = require_dist_cjs43(); + var parseUrl = /* @__PURE__ */ __name((url2) => { + if (typeof url2 === "string") { + return parseUrl(new URL(url2)); } - }; - var de_GetSessionTokenCommand = async (output, context) => { - if (output.statusCode >= 300) { - return de_GetSessionTokenCommandError(output, context); + const { hostname, pathname, port, protocol, search } = url2; + let query; + if (search) { + query = (0, import_querystring_parser.parseQueryString)(search); } - const data = await parseBody(output.body, context); - let contents = {}; - contents = de_GetSessionTokenResponse(data.GetSessionTokenResult, context); - const response = { - $metadata: deserializeMetadata(output), - ...contents - }; - return response; - }; - exports2.de_GetSessionTokenCommand = de_GetSessionTokenCommand; - var de_GetSessionTokenCommandError = async (output, context) => { - const parsedOutput = { - ...output, - body: await parseErrorBody(output.body, context) + return { + hostname, + port: port ? parseInt(port) : void 0, + protocol, + path: pathname, + query }; - const errorCode = loadQueryErrorCode(output, parsedOutput.body); - switch (errorCode) { - case "RegionDisabledException": - case "com.amazonaws.sts#RegionDisabledException": - throw await de_RegionDisabledExceptionRes(parsedOutput, context); - default: - const parsedBody = parsedOutput.body; - return throwDefaultError({ - output, - parsedBody: parsedBody.Error, - errorCode - }); - } - }; - var de_ExpiredTokenExceptionRes = async (parsedOutput, context) => { - const body = parsedOutput.body; - const deserialized = de_ExpiredTokenException(body.Error, context); - const exception = new models_0_1.ExpiredTokenException({ - $metadata: deserializeMetadata(parsedOutput), - ...deserialized - }); - return (0, smithy_client_1.decorateServiceException)(exception, body); - }; - var de_IDPCommunicationErrorExceptionRes = async (parsedOutput, context) => { - const body = parsedOutput.body; - const deserialized = de_IDPCommunicationErrorException(body.Error, context); - const exception = new models_0_1.IDPCommunicationErrorException({ - $metadata: deserializeMetadata(parsedOutput), - ...deserialized - }); - return (0, smithy_client_1.decorateServiceException)(exception, body); - }; - var de_IDPRejectedClaimExceptionRes = async (parsedOutput, context) => { - const body = parsedOutput.body; - const deserialized = de_IDPRejectedClaimException(body.Error, context); - const exception = new models_0_1.IDPRejectedClaimException({ - $metadata: deserializeMetadata(parsedOutput), - ...deserialized - }); - return (0, smithy_client_1.decorateServiceException)(exception, body); - }; - var de_InvalidAuthorizationMessageExceptionRes = async (parsedOutput, context) => { - const body = parsedOutput.body; - const deserialized = de_InvalidAuthorizationMessageException(body.Error, context); - const exception = new models_0_1.InvalidAuthorizationMessageException({ - $metadata: deserializeMetadata(parsedOutput), - ...deserialized - }); - return (0, smithy_client_1.decorateServiceException)(exception, body); + }, "parseUrl"); + } +}); + +// ../../../node_modules/@smithy/middleware-serde/dist-cjs/index.js +var require_dist_cjs45 = __commonJS({ + "../../../node_modules/@smithy/middleware-serde/dist-cjs/index.js"(exports2, module2) { + var __defProp2 = Object.defineProperty; + var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; + var __getOwnPropNames2 = Object.getOwnPropertyNames; + var __hasOwnProp2 = Object.prototype.hasOwnProperty; + var __name = (target, value) => __defProp2(target, "name", { value, configurable: true }); + var __export2 = (target, all) => { + for (var name in all) + __defProp2(target, name, { get: all[name], enumerable: true }); }; - var de_InvalidIdentityTokenExceptionRes = async (parsedOutput, context) => { - const body = parsedOutput.body; - const deserialized = de_InvalidIdentityTokenException(body.Error, context); - const exception = new models_0_1.InvalidIdentityTokenException({ - $metadata: deserializeMetadata(parsedOutput), - ...deserialized - }); - return (0, smithy_client_1.decorateServiceException)(exception, body); + var __copyProps2 = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames2(from)) + if (!__hasOwnProp2.call(to, key) && key !== except) + __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable }); + } + return to; }; - var de_MalformedPolicyDocumentExceptionRes = async (parsedOutput, context) => { - const body = parsedOutput.body; - const deserialized = de_MalformedPolicyDocumentException(body.Error, context); - const exception = new models_0_1.MalformedPolicyDocumentException({ - $metadata: deserializeMetadata(parsedOutput), - ...deserialized + var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); + var src_exports = {}; + __export2(src_exports, { + deserializerMiddleware: () => deserializerMiddleware, + deserializerMiddlewareOption: () => deserializerMiddlewareOption, + getSerdePlugin: () => getSerdePlugin, + serializerMiddleware: () => serializerMiddleware, + serializerMiddlewareOption: () => serializerMiddlewareOption2 + }); + module2.exports = __toCommonJS2(src_exports); + var deserializerMiddleware = /* @__PURE__ */ __name((options, deserializer) => (next) => async (args) => { + const { response } = await next(args); + try { + const parsed = await deserializer(response, options); + return { + response, + output: parsed + }; + } catch (error) { + Object.defineProperty(error, "$response", { + value: response + }); + if (!("$metadata" in error)) { + const hint = `Deserialization error: to see the raw response, inspect the hidden field {error}.$response on this object.`; + error.message += "\n " + hint; + if (typeof error.$responseBodyText !== "undefined") { + if (error.$response) { + error.$response.body = error.$responseBodyText; + } + } + } + throw error; + } + }, "deserializerMiddleware"); + var serializerMiddleware = /* @__PURE__ */ __name((options, serializer) => (next, context) => async (args) => { + var _a; + const endpoint = ((_a = context.endpointV2) == null ? void 0 : _a.url) && options.urlParser ? async () => options.urlParser(context.endpointV2.url) : options.endpoint; + if (!endpoint) { + throw new Error("No valid endpoint provider available."); + } + const request2 = await serializer(args.input, { ...options, endpoint }); + return next({ + ...args, + request: request2 }); - return (0, smithy_client_1.decorateServiceException)(exception, body); + }, "serializerMiddleware"); + var deserializerMiddlewareOption = { + name: "deserializerMiddleware", + step: "deserialize", + tags: ["DESERIALIZER"], + override: true }; - var de_PackedPolicyTooLargeExceptionRes = async (parsedOutput, context) => { - const body = parsedOutput.body; - const deserialized = de_PackedPolicyTooLargeException(body.Error, context); - const exception = new models_0_1.PackedPolicyTooLargeException({ - $metadata: deserializeMetadata(parsedOutput), - ...deserialized - }); - return (0, smithy_client_1.decorateServiceException)(exception, body); + var serializerMiddlewareOption2 = { + name: "serializerMiddleware", + step: "serialize", + tags: ["SERIALIZER"], + override: true }; - var de_RegionDisabledExceptionRes = async (parsedOutput, context) => { - const body = parsedOutput.body; - const deserialized = de_RegionDisabledException(body.Error, context); - const exception = new models_0_1.RegionDisabledException({ - $metadata: deserializeMetadata(parsedOutput), - ...deserialized - }); - return (0, smithy_client_1.decorateServiceException)(exception, body); + function getSerdePlugin(config, serializer, deserializer) { + return { + applyToStack: (commandStack) => { + commandStack.add(deserializerMiddleware(config, deserializer), deserializerMiddlewareOption); + commandStack.add(serializerMiddleware(config, serializer), serializerMiddlewareOption2); + } + }; + } + __name(getSerdePlugin, "getSerdePlugin"); + } +}); + +// ../../../node_modules/@smithy/middleware-endpoint/dist-cjs/index.js +var require_dist_cjs46 = __commonJS({ + "../../../node_modules/@smithy/middleware-endpoint/dist-cjs/index.js"(exports2, module2) { + var __defProp2 = Object.defineProperty; + var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; + var __getOwnPropNames2 = Object.getOwnPropertyNames; + var __hasOwnProp2 = Object.prototype.hasOwnProperty; + var __name = (target, value) => __defProp2(target, "name", { value, configurable: true }); + var __export2 = (target, all) => { + for (var name in all) + __defProp2(target, name, { get: all[name], enumerable: true }); }; - var se_AssumeRoleRequest = (input, context) => { - const entries = {}; - if (input.RoleArn != null) { - entries["RoleArn"] = input.RoleArn; + var __copyProps2 = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames2(from)) + if (!__hasOwnProp2.call(to, key) && key !== except) + __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable }); } - if (input.RoleSessionName != null) { - entries["RoleSessionName"] = input.RoleSessionName; + return to; + }; + var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); + var src_exports = {}; + __export2(src_exports, { + endpointMiddleware: () => endpointMiddleware, + endpointMiddlewareOptions: () => endpointMiddlewareOptions2, + getEndpointFromInstructions: () => getEndpointFromInstructions, + getEndpointPlugin: () => getEndpointPlugin, + resolveEndpointConfig: () => resolveEndpointConfig, + resolveParams: () => resolveParams, + toEndpointV1: () => toEndpointV1 + }); + module2.exports = __toCommonJS2(src_exports); + var resolveParamsForS3 = /* @__PURE__ */ __name(async (endpointParams) => { + const bucket = (endpointParams == null ? void 0 : endpointParams.Bucket) || ""; + if (typeof endpointParams.Bucket === "string") { + endpointParams.Bucket = bucket.replace(/#/g, encodeURIComponent("#")).replace(/\?/g, encodeURIComponent("?")); } - if (input.PolicyArns != null) { - const memberEntries = se_policyDescriptorListType(input.PolicyArns, context); - if (input.PolicyArns?.length === 0) { - entries.PolicyArns = []; + if (isArnBucketName(bucket)) { + if (endpointParams.ForcePathStyle === true) { + throw new Error("Path-style addressing cannot be used with ARN buckets"); } - Object.entries(memberEntries).forEach(([key, value]) => { - const loc = `PolicyArns.${key}`; - entries[loc] = value; - }); + } else if (!isDnsCompatibleBucketName(bucket) || bucket.indexOf(".") !== -1 && !String(endpointParams.Endpoint).startsWith("http:") || bucket.toLowerCase() !== bucket || bucket.length < 3) { + endpointParams.ForcePathStyle = true; } - if (input.Policy != null) { - entries["Policy"] = input.Policy; + if (endpointParams.DisableMultiRegionAccessPoints) { + endpointParams.disableMultiRegionAccessPoints = true; + endpointParams.DisableMRAP = true; } - if (input.DurationSeconds != null) { - entries["DurationSeconds"] = input.DurationSeconds; + return endpointParams; + }, "resolveParamsForS3"); + var DOMAIN_PATTERN = /^[a-z0-9][a-z0-9\.\-]{1,61}[a-z0-9]$/; + var IP_ADDRESS_PATTERN = /(\d+\.){3}\d+/; + var DOTS_PATTERN = /\.\./; + var isDnsCompatibleBucketName = /* @__PURE__ */ __name((bucketName) => DOMAIN_PATTERN.test(bucketName) && !IP_ADDRESS_PATTERN.test(bucketName) && !DOTS_PATTERN.test(bucketName), "isDnsCompatibleBucketName"); + var isArnBucketName = /* @__PURE__ */ __name((bucketName) => { + const [arn, partition, service, , , bucket] = bucketName.split(":"); + const isArn = arn === "arn" && bucketName.split(":").length >= 6; + const isValidArn = Boolean(isArn && partition && service && bucket); + if (isArn && !isValidArn) { + throw new Error(`Invalid ARN: ${bucketName} was an invalid ARN.`); } - if (input.Tags != null) { - const memberEntries = se_tagListType(input.Tags, context); - if (input.Tags?.length === 0) { - entries.Tags = []; + return isValidArn; + }, "isArnBucketName"); + var createConfigValueProvider = /* @__PURE__ */ __name((configKey, canonicalEndpointParamKey, config) => { + const configProvider = /* @__PURE__ */ __name(async () => { + const configValue = config[configKey] ?? config[canonicalEndpointParamKey]; + if (typeof configValue === "function") { + return configValue(); } - Object.entries(memberEntries).forEach(([key, value]) => { - const loc = `Tags.${key}`; - entries[loc] = value; - }); + return configValue; + }, "configProvider"); + if (configKey === "credentialScope" || canonicalEndpointParamKey === "CredentialScope") { + return async () => { + const credentials = typeof config.credentials === "function" ? await config.credentials() : config.credentials; + const configValue = (credentials == null ? void 0 : credentials.credentialScope) ?? (credentials == null ? void 0 : credentials.CredentialScope); + return configValue; + }; } - if (input.TransitiveTagKeys != null) { - const memberEntries = se_tagKeyListType(input.TransitiveTagKeys, context); - if (input.TransitiveTagKeys?.length === 0) { - entries.TransitiveTagKeys = []; - } - Object.entries(memberEntries).forEach(([key, value]) => { - const loc = `TransitiveTagKeys.${key}`; - entries[loc] = value; - }); + if (configKey === "accountId" || canonicalEndpointParamKey === "AccountId") { + return async () => { + const credentials = typeof config.credentials === "function" ? await config.credentials() : config.credentials; + const configValue = (credentials == null ? void 0 : credentials.accountId) ?? (credentials == null ? void 0 : credentials.AccountId); + return configValue; + }; } - if (input.ExternalId != null) { - entries["ExternalId"] = input.ExternalId; + if (configKey === "endpoint" || canonicalEndpointParamKey === "endpoint") { + return async () => { + const endpoint = await configProvider(); + if (endpoint && typeof endpoint === "object") { + if ("url" in endpoint) { + return endpoint.url.href; + } + if ("hostname" in endpoint) { + const { protocol, hostname, port, path } = endpoint; + return `${protocol}//${hostname}${port ? ":" + port : ""}${path}`; + } + } + return endpoint; + }; } - if (input.SerialNumber != null) { - entries["SerialNumber"] = input.SerialNumber; + return configProvider; + }, "createConfigValueProvider"); + var import_getEndpointFromConfig = require_getEndpointFromConfig2(); + var import_url_parser = require_dist_cjs44(); + var toEndpointV1 = /* @__PURE__ */ __name((endpoint) => { + if (typeof endpoint === "object") { + if ("url" in endpoint) { + return (0, import_url_parser.parseUrl)(endpoint.url); + } + return endpoint; } - if (input.TokenCode != null) { - entries["TokenCode"] = input.TokenCode; + return (0, import_url_parser.parseUrl)(endpoint); + }, "toEndpointV1"); + var getEndpointFromInstructions = /* @__PURE__ */ __name(async (commandInput, instructionsSupplier, clientConfig, context) => { + if (!clientConfig.endpoint) { + let endpointFromConfig; + if (clientConfig.serviceConfiguredEndpoint) { + endpointFromConfig = await clientConfig.serviceConfiguredEndpoint(); + } else { + endpointFromConfig = await (0, import_getEndpointFromConfig.getEndpointFromConfig)(clientConfig.serviceId); + } + if (endpointFromConfig) { + clientConfig.endpoint = () => Promise.resolve(toEndpointV1(endpointFromConfig)); + } } - if (input.SourceIdentity != null) { - entries["SourceIdentity"] = input.SourceIdentity; + const endpointParams = await resolveParams(commandInput, instructionsSupplier, clientConfig); + if (typeof clientConfig.endpointProvider !== "function") { + throw new Error("config.endpointProvider is not set."); } - if (input.ProvidedContexts != null) { - const memberEntries = se_ProvidedContextsListType(input.ProvidedContexts, context); - if (input.ProvidedContexts?.length === 0) { - entries.ProvidedContexts = []; + const endpoint = clientConfig.endpointProvider(endpointParams, context); + return endpoint; + }, "getEndpointFromInstructions"); + var resolveParams = /* @__PURE__ */ __name(async (commandInput, instructionsSupplier, clientConfig) => { + var _a; + const endpointParams = {}; + const instructions = ((_a = instructionsSupplier == null ? void 0 : instructionsSupplier.getEndpointParameterInstructions) == null ? void 0 : _a.call(instructionsSupplier)) || {}; + for (const [name, instruction] of Object.entries(instructions)) { + switch (instruction.type) { + case "staticContextParams": + endpointParams[name] = instruction.value; + break; + case "contextParams": + endpointParams[name] = commandInput[instruction.name]; + break; + case "clientContextParams": + case "builtInParams": + endpointParams[name] = await createConfigValueProvider(instruction.name, name, clientConfig)(); + break; + default: + throw new Error("Unrecognized endpoint parameter instruction: " + JSON.stringify(instruction)); } - Object.entries(memberEntries).forEach(([key, value]) => { - const loc = `ProvidedContexts.${key}`; - entries[loc] = value; - }); - } - return entries; - }; - var se_AssumeRoleWithSAMLRequest = (input, context) => { - const entries = {}; - if (input.RoleArn != null) { - entries["RoleArn"] = input.RoleArn; } - if (input.PrincipalArn != null) { - entries["PrincipalArn"] = input.PrincipalArn; + if (Object.keys(instructions).length === 0) { + Object.assign(endpointParams, clientConfig); } - if (input.SAMLAssertion != null) { - entries["SAMLAssertion"] = input.SAMLAssertion; + if (String(clientConfig.serviceId).toLowerCase() === "s3") { + await resolveParamsForS3(endpointParams); } - if (input.PolicyArns != null) { - const memberEntries = se_policyDescriptorListType(input.PolicyArns, context); - if (input.PolicyArns?.length === 0) { - entries.PolicyArns = []; + return endpointParams; + }, "resolveParams"); + var import_util_middleware3 = require_dist_cjs10(); + var endpointMiddleware = /* @__PURE__ */ __name(({ + config, + instructions + }) => { + return (next, context) => async (args) => { + var _a, _b, _c; + const endpoint = await getEndpointFromInstructions( + args.input, + { + getEndpointParameterInstructions() { + return instructions; + } + }, + { ...config }, + context + ); + context.endpointV2 = endpoint; + context.authSchemes = (_a = endpoint.properties) == null ? void 0 : _a.authSchemes; + const authScheme = (_b = context.authSchemes) == null ? void 0 : _b[0]; + if (authScheme) { + context["signing_region"] = authScheme.signingRegion; + context["signing_service"] = authScheme.signingName; + const smithyContext = (0, import_util_middleware3.getSmithyContext)(context); + const httpAuthOption = (_c = smithyContext == null ? void 0 : smithyContext.selectedHttpAuthScheme) == null ? void 0 : _c.httpAuthOption; + if (httpAuthOption) { + httpAuthOption.signingProperties = Object.assign( + httpAuthOption.signingProperties || {}, + { + signing_region: authScheme.signingRegion, + signingRegion: authScheme.signingRegion, + signing_service: authScheme.signingName, + signingName: authScheme.signingName, + signingRegionSet: authScheme.signingRegionSet + }, + authScheme.properties + ); + } } - Object.entries(memberEntries).forEach(([key, value]) => { - const loc = `PolicyArns.${key}`; - entries[loc] = value; + return next({ + ...args }); - } - if (input.Policy != null) { - entries["Policy"] = input.Policy; - } - if (input.DurationSeconds != null) { - entries["DurationSeconds"] = input.DurationSeconds; - } - return entries; + }; + }, "endpointMiddleware"); + var import_middleware_serde2 = require_dist_cjs45(); + var endpointMiddlewareOptions2 = { + step: "serialize", + tags: ["ENDPOINT_PARAMETERS", "ENDPOINT_V2", "ENDPOINT"], + name: "endpointV2Middleware", + override: true, + relation: "before", + toMiddleware: import_middleware_serde2.serializerMiddlewareOption.name }; - var se_AssumeRoleWithWebIdentityRequest = (input, context) => { - const entries = {}; - if (input.RoleArn != null) { - entries["RoleArn"] = input.RoleArn; - } - if (input.RoleSessionName != null) { - entries["RoleSessionName"] = input.RoleSessionName; - } - if (input.WebIdentityToken != null) { - entries["WebIdentityToken"] = input.WebIdentityToken; - } - if (input.ProviderId != null) { - entries["ProviderId"] = input.ProviderId; + var getEndpointPlugin = /* @__PURE__ */ __name((config, instructions) => ({ + applyToStack: (clientStack) => { + clientStack.addRelativeTo( + endpointMiddleware({ + config, + instructions + }), + endpointMiddlewareOptions2 + ); } - if (input.PolicyArns != null) { - const memberEntries = se_policyDescriptorListType(input.PolicyArns, context); - if (input.PolicyArns?.length === 0) { - entries.PolicyArns = []; + }), "getEndpointPlugin"); + var import_getEndpointFromConfig2 = require_getEndpointFromConfig2(); + var resolveEndpointConfig = /* @__PURE__ */ __name((input) => { + const tls = input.tls ?? true; + const { endpoint } = input; + const customEndpointProvider = endpoint != null ? async () => toEndpointV1(await (0, import_util_middleware3.normalizeProvider)(endpoint)()) : void 0; + const isCustomEndpoint = !!endpoint; + const resolvedConfig = { + ...input, + endpoint: customEndpointProvider, + tls, + isCustomEndpoint, + useDualstackEndpoint: (0, import_util_middleware3.normalizeProvider)(input.useDualstackEndpoint ?? false), + useFipsEndpoint: (0, import_util_middleware3.normalizeProvider)(input.useFipsEndpoint ?? false) + }; + let configuredEndpointPromise = void 0; + resolvedConfig.serviceConfiguredEndpoint = async () => { + if (input.serviceId && !configuredEndpointPromise) { + configuredEndpointPromise = (0, import_getEndpointFromConfig2.getEndpointFromConfig)(input.serviceId); } - Object.entries(memberEntries).forEach(([key, value]) => { - const loc = `PolicyArns.${key}`; - entries[loc] = value; - }); - } - if (input.Policy != null) { - entries["Policy"] = input.Policy; - } - if (input.DurationSeconds != null) { - entries["DurationSeconds"] = input.DurationSeconds; + return configuredEndpointPromise; + }; + return resolvedConfig; + }, "resolveEndpointConfig"); + } +}); + +// ../../../node_modules/@aws-sdk/core/dist-es/submodules/client/emitWarningIfUnsupportedVersion.js +var warningEmitted, emitWarningIfUnsupportedVersion; +var init_emitWarningIfUnsupportedVersion = __esm({ + "../../../node_modules/@aws-sdk/core/dist-es/submodules/client/emitWarningIfUnsupportedVersion.js"() { + warningEmitted = false; + emitWarningIfUnsupportedVersion = (version2) => { + if (version2 && !warningEmitted && parseInt(version2.substring(1, version2.indexOf("."))) < 18) { + warningEmitted = true; + process.emitWarning(`NodeDeprecationWarning: The AWS SDK for JavaScript (v3) will +no longer support Node.js 16.x on January 6, 2025. + +To continue receiving updates to AWS services, bug fixes, and security +updates please upgrade to a supported Node.js LTS version. + +More information can be found at: https://a.co/74kJMmI`); } - return entries; }; - var se_DecodeAuthorizationMessageRequest = (input, context) => { - const entries = {}; - if (input.EncodedMessage != null) { - entries["EncodedMessage"] = input.EncodedMessage; + } +}); + +// ../../../node_modules/@aws-sdk/core/dist-es/submodules/client/index.js +var init_client = __esm({ + "../../../node_modules/@aws-sdk/core/dist-es/submodules/client/index.js"() { + init_emitWarningIfUnsupportedVersion(); + } +}); + +// ../../../node_modules/@aws-sdk/core/dist-es/submodules/httpAuthSchemes/utils/getDateHeader.js +var import_protocol_http5, getDateHeader; +var init_getDateHeader = __esm({ + "../../../node_modules/@aws-sdk/core/dist-es/submodules/httpAuthSchemes/utils/getDateHeader.js"() { + import_protocol_http5 = __toESM(require_dist_cjs2()); + getDateHeader = (response) => import_protocol_http5.HttpResponse.isInstance(response) ? response.headers?.date ?? response.headers?.Date : void 0; + } +}); + +// ../../../node_modules/@aws-sdk/core/dist-es/submodules/httpAuthSchemes/utils/getSkewCorrectedDate.js +var getSkewCorrectedDate; +var init_getSkewCorrectedDate = __esm({ + "../../../node_modules/@aws-sdk/core/dist-es/submodules/httpAuthSchemes/utils/getSkewCorrectedDate.js"() { + getSkewCorrectedDate = (systemClockOffset) => new Date(Date.now() + systemClockOffset); + } +}); + +// ../../../node_modules/@aws-sdk/core/dist-es/submodules/httpAuthSchemes/utils/isClockSkewed.js +var isClockSkewed; +var init_isClockSkewed = __esm({ + "../../../node_modules/@aws-sdk/core/dist-es/submodules/httpAuthSchemes/utils/isClockSkewed.js"() { + init_getSkewCorrectedDate(); + isClockSkewed = (clockTime, systemClockOffset) => Math.abs(getSkewCorrectedDate(systemClockOffset).getTime() - clockTime) >= 3e5; + } +}); + +// ../../../node_modules/@aws-sdk/core/dist-es/submodules/httpAuthSchemes/utils/getUpdatedSystemClockOffset.js +var getUpdatedSystemClockOffset; +var init_getUpdatedSystemClockOffset = __esm({ + "../../../node_modules/@aws-sdk/core/dist-es/submodules/httpAuthSchemes/utils/getUpdatedSystemClockOffset.js"() { + init_isClockSkewed(); + getUpdatedSystemClockOffset = (clockTime, currentSystemClockOffset) => { + const clockTimeInMs = Date.parse(clockTime); + if (isClockSkewed(clockTimeInMs, currentSystemClockOffset)) { + return clockTimeInMs - Date.now(); } - return entries; + return currentSystemClockOffset; }; - var se_GetAccessKeyInfoRequest = (input, context) => { - const entries = {}; - if (input.AccessKeyId != null) { - entries["AccessKeyId"] = input.AccessKeyId; + } +}); + +// ../../../node_modules/@aws-sdk/core/dist-es/submodules/httpAuthSchemes/utils/index.js +var init_utils = __esm({ + "../../../node_modules/@aws-sdk/core/dist-es/submodules/httpAuthSchemes/utils/index.js"() { + init_getDateHeader(); + init_getSkewCorrectedDate(); + init_getUpdatedSystemClockOffset(); + } +}); + +// ../../../node_modules/@aws-sdk/core/dist-es/submodules/httpAuthSchemes/aws_sdk/AwsSdkSigV4Signer.js +var import_protocol_http6, throwSigningPropertyError, validateSigningProperties, AwsSdkSigV4Signer, AWSSDKSigV4Signer; +var init_AwsSdkSigV4Signer = __esm({ + "../../../node_modules/@aws-sdk/core/dist-es/submodules/httpAuthSchemes/aws_sdk/AwsSdkSigV4Signer.js"() { + import_protocol_http6 = __toESM(require_dist_cjs2()); + init_utils(); + throwSigningPropertyError = (name, property) => { + if (!property) { + throw new Error(`Property \`${name}\` is not resolved for AWS SDK SigV4Auth`); } - return entries; + return property; }; - var se_GetCallerIdentityRequest = (input, context) => { - const entries = {}; - return entries; + validateSigningProperties = async (signingProperties) => { + const context = throwSigningPropertyError("context", signingProperties.context); + const config = throwSigningPropertyError("config", signingProperties.config); + const authScheme = context.endpointV2?.properties?.authSchemes?.[0]; + const signerFunction = throwSigningPropertyError("signer", config.signer); + const signer = await signerFunction(authScheme); + const signingRegion = signingProperties?.signingRegion; + const signingRegionSet = signingProperties?.signingRegionSet; + const signingName = signingProperties?.signingName; + return { + config, + signer, + signingRegion, + signingRegionSet, + signingName + }; }; - var se_GetFederationTokenRequest = (input, context) => { - const entries = {}; - if (input.Name != null) { - entries["Name"] = input.Name; - } - if (input.Policy != null) { - entries["Policy"] = input.Policy; - } - if (input.PolicyArns != null) { - const memberEntries = se_policyDescriptorListType(input.PolicyArns, context); - if (input.PolicyArns?.length === 0) { - entries.PolicyArns = []; + AwsSdkSigV4Signer = class { + async sign(httpRequest, identity, signingProperties) { + if (!import_protocol_http6.HttpRequest.isInstance(httpRequest)) { + throw new Error("The request is not an instance of `HttpRequest` and cannot be signed"); } - Object.entries(memberEntries).forEach(([key, value]) => { - const loc = `PolicyArns.${key}`; - entries[loc] = value; - }); - } - if (input.DurationSeconds != null) { - entries["DurationSeconds"] = input.DurationSeconds; - } - if (input.Tags != null) { - const memberEntries = se_tagListType(input.Tags, context); - if (input.Tags?.length === 0) { - entries.Tags = []; + const validatedProps = await validateSigningProperties(signingProperties); + const { config, signer } = validatedProps; + let { signingRegion, signingName } = validatedProps; + const handlerExecutionContext = signingProperties.context; + if (handlerExecutionContext?.authSchemes?.length ?? 0 > 1) { + const [first, second] = handlerExecutionContext.authSchemes; + if (first?.name === "sigv4a" && second?.name === "sigv4") { + signingRegion = second?.signingRegion ?? signingRegion; + signingName = second?.signingName ?? signingName; + } } - Object.entries(memberEntries).forEach(([key, value]) => { - const loc = `Tags.${key}`; - entries[loc] = value; + const signedRequest = await signer.sign(httpRequest, { + signingDate: getSkewCorrectedDate(config.systemClockOffset), + signingRegion, + signingService: signingName }); + return signedRequest; + } + errorHandler(signingProperties) { + return (error) => { + const serverTime = error.ServerTime ?? getDateHeader(error.$response); + if (serverTime) { + const config = throwSigningPropertyError("config", signingProperties.config); + const initialSystemClockOffset = config.systemClockOffset; + config.systemClockOffset = getUpdatedSystemClockOffset(serverTime, config.systemClockOffset); + const clockSkewCorrected = config.systemClockOffset !== initialSystemClockOffset; + if (clockSkewCorrected && error.$metadata) { + error.$metadata.clockSkewCorrected = true; + } + } + throw error; + }; } - return entries; - }; - var se_GetSessionTokenRequest = (input, context) => { - const entries = {}; - if (input.DurationSeconds != null) { - entries["DurationSeconds"] = input.DurationSeconds; - } - if (input.SerialNumber != null) { - entries["SerialNumber"] = input.SerialNumber; - } - if (input.TokenCode != null) { - entries["TokenCode"] = input.TokenCode; - } - return entries; - }; - var se_policyDescriptorListType = (input, context) => { - const entries = {}; - let counter = 1; - for (const entry of input) { - if (entry === null) { - continue; + successHandler(httpResponse, signingProperties) { + const dateHeader = getDateHeader(httpResponse); + if (dateHeader) { + const config = throwSigningPropertyError("config", signingProperties.config); + config.systemClockOffset = getUpdatedSystemClockOffset(dateHeader, config.systemClockOffset); } - const memberEntries = se_PolicyDescriptorType(entry, context); - Object.entries(memberEntries).forEach(([key, value]) => { - entries[`member.${counter}.${key}`] = value; - }); - counter++; - } - return entries; - }; - var se_PolicyDescriptorType = (input, context) => { - const entries = {}; - if (input.arn != null) { - entries["arn"] = input.arn; - } - return entries; - }; - var se_ProvidedContext = (input, context) => { - const entries = {}; - if (input.ProviderArn != null) { - entries["ProviderArn"] = input.ProviderArn; } - if (input.ContextAssertion != null) { - entries["ContextAssertion"] = input.ContextAssertion; - } - return entries; }; - var se_ProvidedContextsListType = (input, context) => { - const entries = {}; - let counter = 1; - for (const entry of input) { - if (entry === null) { - continue; + AWSSDKSigV4Signer = AwsSdkSigV4Signer; + } +}); + +// ../../../node_modules/@aws-sdk/core/dist-es/submodules/httpAuthSchemes/aws_sdk/AwsSdkSigV4ASigner.js +var import_protocol_http7, AwsSdkSigV4ASigner; +var init_AwsSdkSigV4ASigner = __esm({ + "../../../node_modules/@aws-sdk/core/dist-es/submodules/httpAuthSchemes/aws_sdk/AwsSdkSigV4ASigner.js"() { + import_protocol_http7 = __toESM(require_dist_cjs2()); + init_utils(); + init_AwsSdkSigV4Signer(); + AwsSdkSigV4ASigner = class extends AwsSdkSigV4Signer { + async sign(httpRequest, identity, signingProperties) { + if (!import_protocol_http7.HttpRequest.isInstance(httpRequest)) { + throw new Error("The request is not an instance of `HttpRequest` and cannot be signed"); } - const memberEntries = se_ProvidedContext(entry, context); - Object.entries(memberEntries).forEach(([key, value]) => { - entries[`member.${counter}.${key}`] = value; + const { config, signer, signingRegion, signingRegionSet, signingName } = await validateSigningProperties(signingProperties); + const configResolvedSigningRegionSet = await config.sigv4aSigningRegionSet?.(); + const multiRegionOverride = (configResolvedSigningRegionSet ?? signingRegionSet ?? [signingRegion]).join(","); + const signedRequest = await signer.sign(httpRequest, { + signingDate: getSkewCorrectedDate(config.systemClockOffset), + signingRegion: multiRegionOverride, + signingService: signingName }); - counter++; + return signedRequest; } - return entries; }; - var se_Tag = (input, context) => { - const entries = {}; - if (input.Key != null) { - entries["Key"] = input.Key; - } - if (input.Value != null) { - entries["Value"] = input.Value; - } - return entries; + } +}); + +// ../../../node_modules/@aws-sdk/core/dist-es/submodules/httpAuthSchemes/aws_sdk/resolveAwsSdkSigV4AConfig.js +var import_property_provider, resolveAwsSdkSigV4AConfig, NODE_SIGV4A_CONFIG_OPTIONS; +var init_resolveAwsSdkSigV4AConfig = __esm({ + "../../../node_modules/@aws-sdk/core/dist-es/submodules/httpAuthSchemes/aws_sdk/resolveAwsSdkSigV4AConfig.js"() { + init_dist_es(); + import_property_provider = __toESM(require_dist_cjs40()); + resolveAwsSdkSigV4AConfig = (config) => { + config.sigv4aSigningRegionSet = normalizeProvider(config.sigv4aSigningRegionSet); + return config; }; - var se_tagKeyListType = (input, context) => { - const entries = {}; - let counter = 1; - for (const entry of input) { - if (entry === null) { - continue; + NODE_SIGV4A_CONFIG_OPTIONS = { + environmentVariableSelector(env) { + if (env.AWS_SIGV4A_SIGNING_REGION_SET) { + return env.AWS_SIGV4A_SIGNING_REGION_SET.split(",").map((_) => _.trim()); } - entries[`member.${counter}`] = entry; - counter++; - } - return entries; - }; - var se_tagListType = (input, context) => { - const entries = {}; - let counter = 1; - for (const entry of input) { - if (entry === null) { - continue; + throw new import_property_provider.ProviderError("AWS_SIGV4A_SIGNING_REGION_SET not set in env.", { + tryNextLink: true + }); + }, + configFileSelector(profile) { + if (profile.sigv4a_signing_region_set) { + return (profile.sigv4a_signing_region_set ?? "").split(",").map((_) => _.trim()); } - const memberEntries = se_Tag(entry, context); - Object.entries(memberEntries).forEach(([key, value]) => { - entries[`member.${counter}.${key}`] = value; + throw new import_property_provider.ProviderError("sigv4a_signing_region_set not set in profile.", { + tryNextLink: true }); - counter++; - } - return entries; - }; - var de_AssumedRoleUser = (output, context) => { - const contents = {}; - if (output["AssumedRoleId"] !== void 0) { - contents.AssumedRoleId = (0, smithy_client_1.expectString)(output["AssumedRoleId"]); - } - if (output["Arn"] !== void 0) { - contents.Arn = (0, smithy_client_1.expectString)(output["Arn"]); - } - return contents; - }; - var de_AssumeRoleResponse = (output, context) => { - const contents = {}; - if (output["Credentials"] !== void 0) { - contents.Credentials = de_Credentials(output["Credentials"], context); - } - if (output["AssumedRoleUser"] !== void 0) { - contents.AssumedRoleUser = de_AssumedRoleUser(output["AssumedRoleUser"], context); - } - if (output["PackedPolicySize"] !== void 0) { - contents.PackedPolicySize = (0, smithy_client_1.strictParseInt32)(output["PackedPolicySize"]); - } - if (output["SourceIdentity"] !== void 0) { - contents.SourceIdentity = (0, smithy_client_1.expectString)(output["SourceIdentity"]); - } - return contents; - }; - var de_AssumeRoleWithSAMLResponse = (output, context) => { - const contents = {}; - if (output["Credentials"] !== void 0) { - contents.Credentials = de_Credentials(output["Credentials"], context); - } - if (output["AssumedRoleUser"] !== void 0) { - contents.AssumedRoleUser = de_AssumedRoleUser(output["AssumedRoleUser"], context); - } - if (output["PackedPolicySize"] !== void 0) { - contents.PackedPolicySize = (0, smithy_client_1.strictParseInt32)(output["PackedPolicySize"]); - } - if (output["Subject"] !== void 0) { - contents.Subject = (0, smithy_client_1.expectString)(output["Subject"]); - } - if (output["SubjectType"] !== void 0) { - contents.SubjectType = (0, smithy_client_1.expectString)(output["SubjectType"]); - } - if (output["Issuer"] !== void 0) { - contents.Issuer = (0, smithy_client_1.expectString)(output["Issuer"]); - } - if (output["Audience"] !== void 0) { - contents.Audience = (0, smithy_client_1.expectString)(output["Audience"]); - } - if (output["NameQualifier"] !== void 0) { - contents.NameQualifier = (0, smithy_client_1.expectString)(output["NameQualifier"]); - } - if (output["SourceIdentity"] !== void 0) { - contents.SourceIdentity = (0, smithy_client_1.expectString)(output["SourceIdentity"]); - } - return contents; - }; - var de_AssumeRoleWithWebIdentityResponse = (output, context) => { - const contents = {}; - if (output["Credentials"] !== void 0) { - contents.Credentials = de_Credentials(output["Credentials"], context); - } - if (output["SubjectFromWebIdentityToken"] !== void 0) { - contents.SubjectFromWebIdentityToken = (0, smithy_client_1.expectString)(output["SubjectFromWebIdentityToken"]); - } - if (output["AssumedRoleUser"] !== void 0) { - contents.AssumedRoleUser = de_AssumedRoleUser(output["AssumedRoleUser"], context); - } - if (output["PackedPolicySize"] !== void 0) { - contents.PackedPolicySize = (0, smithy_client_1.strictParseInt32)(output["PackedPolicySize"]); - } - if (output["Provider"] !== void 0) { - contents.Provider = (0, smithy_client_1.expectString)(output["Provider"]); - } - if (output["Audience"] !== void 0) { - contents.Audience = (0, smithy_client_1.expectString)(output["Audience"]); - } - if (output["SourceIdentity"] !== void 0) { - contents.SourceIdentity = (0, smithy_client_1.expectString)(output["SourceIdentity"]); - } - return contents; - }; - var de_Credentials = (output, context) => { - const contents = {}; - if (output["AccessKeyId"] !== void 0) { - contents.AccessKeyId = (0, smithy_client_1.expectString)(output["AccessKeyId"]); - } - if (output["SecretAccessKey"] !== void 0) { - contents.SecretAccessKey = (0, smithy_client_1.expectString)(output["SecretAccessKey"]); - } - if (output["SessionToken"] !== void 0) { - contents.SessionToken = (0, smithy_client_1.expectString)(output["SessionToken"]); - } - if (output["Expiration"] !== void 0) { - contents.Expiration = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseRfc3339DateTimeWithOffset)(output["Expiration"])); - } - return contents; - }; - var de_DecodeAuthorizationMessageResponse = (output, context) => { - const contents = {}; - if (output["DecodedMessage"] !== void 0) { - contents.DecodedMessage = (0, smithy_client_1.expectString)(output["DecodedMessage"]); - } - return contents; - }; - var de_ExpiredTokenException = (output, context) => { - const contents = {}; - if (output["message"] !== void 0) { - contents.message = (0, smithy_client_1.expectString)(output["message"]); - } - return contents; + }, + default: void 0 }; - var de_FederatedUser = (output, context) => { - const contents = {}; - if (output["FederatedUserId"] !== void 0) { - contents.FederatedUserId = (0, smithy_client_1.expectString)(output["FederatedUserId"]); - } - if (output["Arn"] !== void 0) { - contents.Arn = (0, smithy_client_1.expectString)(output["Arn"]); - } - return contents; + } +}); + +// ../../../node_modules/@smithy/signature-v4/dist-cjs/index.js +var require_dist_cjs47 = __commonJS({ + "../../../node_modules/@smithy/signature-v4/dist-cjs/index.js"(exports2, module2) { + var __defProp2 = Object.defineProperty; + var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; + var __getOwnPropNames2 = Object.getOwnPropertyNames; + var __hasOwnProp2 = Object.prototype.hasOwnProperty; + var __name = (target, value) => __defProp2(target, "name", { value, configurable: true }); + var __export2 = (target, all) => { + for (var name in all) + __defProp2(target, name, { get: all[name], enumerable: true }); }; - var de_GetAccessKeyInfoResponse = (output, context) => { - const contents = {}; - if (output["Account"] !== void 0) { - contents.Account = (0, smithy_client_1.expectString)(output["Account"]); + var __copyProps2 = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames2(from)) + if (!__hasOwnProp2.call(to, key) && key !== except) + __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable }); } - return contents; + return to; }; - var de_GetCallerIdentityResponse = (output, context) => { - const contents = {}; - if (output["UserId"] !== void 0) { - contents.UserId = (0, smithy_client_1.expectString)(output["UserId"]); - } - if (output["Account"] !== void 0) { - contents.Account = (0, smithy_client_1.expectString)(output["Account"]); - } - if (output["Arn"] !== void 0) { - contents.Arn = (0, smithy_client_1.expectString)(output["Arn"]); - } - return contents; + var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); + var src_exports = {}; + __export2(src_exports, { + SignatureV4: () => SignatureV42, + clearCredentialCache: () => clearCredentialCache, + createScope: () => createScope, + getCanonicalHeaders: () => getCanonicalHeaders, + getCanonicalQuery: () => getCanonicalQuery, + getPayloadHash: () => getPayloadHash, + getSigningKey: () => getSigningKey, + moveHeadersToQuery: () => moveHeadersToQuery, + prepareRequest: () => prepareRequest + }); + module2.exports = __toCommonJS2(src_exports); + var import_util_middleware3 = require_dist_cjs10(); + var import_util_utf84 = require_dist_cjs28(); + var ALGORITHM_QUERY_PARAM = "X-Amz-Algorithm"; + var CREDENTIAL_QUERY_PARAM = "X-Amz-Credential"; + var AMZ_DATE_QUERY_PARAM = "X-Amz-Date"; + var SIGNED_HEADERS_QUERY_PARAM = "X-Amz-SignedHeaders"; + var EXPIRES_QUERY_PARAM = "X-Amz-Expires"; + var SIGNATURE_QUERY_PARAM = "X-Amz-Signature"; + var TOKEN_QUERY_PARAM = "X-Amz-Security-Token"; + var AUTH_HEADER = "authorization"; + var AMZ_DATE_HEADER = AMZ_DATE_QUERY_PARAM.toLowerCase(); + var DATE_HEADER = "date"; + var GENERATED_HEADERS = [AUTH_HEADER, AMZ_DATE_HEADER, DATE_HEADER]; + var SIGNATURE_HEADER = SIGNATURE_QUERY_PARAM.toLowerCase(); + var SHA256_HEADER = "x-amz-content-sha256"; + var TOKEN_HEADER = TOKEN_QUERY_PARAM.toLowerCase(); + var ALWAYS_UNSIGNABLE_HEADERS = { + authorization: true, + "cache-control": true, + connection: true, + expect: true, + from: true, + "keep-alive": true, + "max-forwards": true, + pragma: true, + referer: true, + te: true, + trailer: true, + "transfer-encoding": true, + upgrade: true, + "user-agent": true, + "x-amzn-trace-id": true }; - var de_GetFederationTokenResponse = (output, context) => { - const contents = {}; - if (output["Credentials"] !== void 0) { - contents.Credentials = de_Credentials(output["Credentials"], context); - } - if (output["FederatedUser"] !== void 0) { - contents.FederatedUser = de_FederatedUser(output["FederatedUser"], context); - } - if (output["PackedPolicySize"] !== void 0) { - contents.PackedPolicySize = (0, smithy_client_1.strictParseInt32)(output["PackedPolicySize"]); + var PROXY_HEADER_PATTERN = /^proxy-/; + var SEC_HEADER_PATTERN = /^sec-/; + var ALGORITHM_IDENTIFIER = "AWS4-HMAC-SHA256"; + var EVENT_ALGORITHM_IDENTIFIER = "AWS4-HMAC-SHA256-PAYLOAD"; + var UNSIGNED_PAYLOAD = "UNSIGNED-PAYLOAD"; + var MAX_CACHE_SIZE = 50; + var KEY_TYPE_IDENTIFIER = "aws4_request"; + var MAX_PRESIGNED_TTL = 60 * 60 * 24 * 7; + var import_util_hex_encoding = require_dist_cjs35(); + var import_util_utf8 = require_dist_cjs28(); + var signingKeyCache = {}; + var cacheQueue = []; + var createScope = /* @__PURE__ */ __name((shortDate, region, service) => `${shortDate}/${region}/${service}/${KEY_TYPE_IDENTIFIER}`, "createScope"); + var getSigningKey = /* @__PURE__ */ __name(async (sha256Constructor, credentials, shortDate, region, service) => { + const credsHash = await hmac(sha256Constructor, credentials.secretAccessKey, credentials.accessKeyId); + const cacheKey = `${shortDate}:${region}:${service}:${(0, import_util_hex_encoding.toHex)(credsHash)}:${credentials.sessionToken}`; + if (cacheKey in signingKeyCache) { + return signingKeyCache[cacheKey]; } - return contents; - }; - var de_GetSessionTokenResponse = (output, context) => { - const contents = {}; - if (output["Credentials"] !== void 0) { - contents.Credentials = de_Credentials(output["Credentials"], context); + cacheQueue.push(cacheKey); + while (cacheQueue.length > MAX_CACHE_SIZE) { + delete signingKeyCache[cacheQueue.shift()]; } - return contents; - }; - var de_IDPCommunicationErrorException = (output, context) => { - const contents = {}; - if (output["message"] !== void 0) { - contents.message = (0, smithy_client_1.expectString)(output["message"]); + let key = `AWS4${credentials.secretAccessKey}`; + for (const signable of [shortDate, region, service, KEY_TYPE_IDENTIFIER]) { + key = await hmac(sha256Constructor, key, signable); } - return contents; - }; - var de_IDPRejectedClaimException = (output, context) => { - const contents = {}; - if (output["message"] !== void 0) { - contents.message = (0, smithy_client_1.expectString)(output["message"]); + return signingKeyCache[cacheKey] = key; + }, "getSigningKey"); + var clearCredentialCache = /* @__PURE__ */ __name(() => { + cacheQueue.length = 0; + Object.keys(signingKeyCache).forEach((cacheKey) => { + delete signingKeyCache[cacheKey]; + }); + }, "clearCredentialCache"); + var hmac = /* @__PURE__ */ __name((ctor, secret, data) => { + const hash = new ctor(secret); + hash.update((0, import_util_utf8.toUint8Array)(data)); + return hash.digest(); + }, "hmac"); + var getCanonicalHeaders = /* @__PURE__ */ __name(({ headers }, unsignableHeaders, signableHeaders) => { + const canonical = {}; + for (const headerName of Object.keys(headers).sort()) { + if (headers[headerName] == void 0) { + continue; + } + const canonicalHeaderName = headerName.toLowerCase(); + if (canonicalHeaderName in ALWAYS_UNSIGNABLE_HEADERS || (unsignableHeaders == null ? void 0 : unsignableHeaders.has(canonicalHeaderName)) || PROXY_HEADER_PATTERN.test(canonicalHeaderName) || SEC_HEADER_PATTERN.test(canonicalHeaderName)) { + if (!signableHeaders || signableHeaders && !signableHeaders.has(canonicalHeaderName)) { + continue; + } + } + canonical[canonicalHeaderName] = headers[headerName].trim().replace(/\s+/g, " "); } - return contents; - }; - var de_InvalidAuthorizationMessageException = (output, context) => { - const contents = {}; - if (output["message"] !== void 0) { - contents.message = (0, smithy_client_1.expectString)(output["message"]); + return canonical; + }, "getCanonicalHeaders"); + var import_util_uri_escape = require_dist_cjs31(); + var getCanonicalQuery = /* @__PURE__ */ __name(({ query = {} }) => { + const keys = []; + const serialized = {}; + for (const key of Object.keys(query).sort()) { + if (key.toLowerCase() === SIGNATURE_HEADER) { + continue; + } + keys.push(key); + const value = query[key]; + if (typeof value === "string") { + serialized[key] = `${(0, import_util_uri_escape.escapeUri)(key)}=${(0, import_util_uri_escape.escapeUri)(value)}`; + } else if (Array.isArray(value)) { + serialized[key] = value.slice(0).reduce( + (encoded, value2) => encoded.concat([`${(0, import_util_uri_escape.escapeUri)(key)}=${(0, import_util_uri_escape.escapeUri)(value2)}`]), + [] + ).sort().join("&"); + } } - return contents; - }; - var de_InvalidIdentityTokenException = (output, context) => { - const contents = {}; - if (output["message"] !== void 0) { - contents.message = (0, smithy_client_1.expectString)(output["message"]); + return keys.map((key) => serialized[key]).filter((serialized2) => serialized2).join("&"); + }, "getCanonicalQuery"); + var import_is_array_buffer = require_dist_cjs26(); + var import_util_utf82 = require_dist_cjs28(); + var getPayloadHash = /* @__PURE__ */ __name(async ({ headers, body }, hashConstructor) => { + for (const headerName of Object.keys(headers)) { + if (headerName.toLowerCase() === SHA256_HEADER) { + return headers[headerName]; + } } - return contents; - }; - var de_MalformedPolicyDocumentException = (output, context) => { - const contents = {}; - if (output["message"] !== void 0) { - contents.message = (0, smithy_client_1.expectString)(output["message"]); + if (body == void 0) { + return "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"; + } else if (typeof body === "string" || ArrayBuffer.isView(body) || (0, import_is_array_buffer.isArrayBuffer)(body)) { + const hashCtor = new hashConstructor(); + hashCtor.update((0, import_util_utf82.toUint8Array)(body)); + return (0, import_util_hex_encoding.toHex)(await hashCtor.digest()); } - return contents; - }; - var de_PackedPolicyTooLargeException = (output, context) => { - const contents = {}; - if (output["message"] !== void 0) { - contents.message = (0, smithy_client_1.expectString)(output["message"]); + return UNSIGNED_PAYLOAD; + }, "getPayloadHash"); + var import_util_utf83 = require_dist_cjs28(); + var _HeaderFormatter = class _HeaderFormatter { + format(headers) { + const chunks = []; + for (const headerName of Object.keys(headers)) { + const bytes = (0, import_util_utf83.fromUtf8)(headerName); + chunks.push(Uint8Array.from([bytes.byteLength]), bytes, this.formatHeaderValue(headers[headerName])); + } + const out = new Uint8Array(chunks.reduce((carry, bytes) => carry + bytes.byteLength, 0)); + let position = 0; + for (const chunk of chunks) { + out.set(chunk, position); + position += chunk.byteLength; + } + return out; } - return contents; - }; - var de_RegionDisabledException = (output, context) => { - const contents = {}; - if (output["message"] !== void 0) { - contents.message = (0, smithy_client_1.expectString)(output["message"]); + formatHeaderValue(header) { + switch (header.type) { + case "boolean": + return Uint8Array.from([ + header.value ? 0 : 1 + /* boolFalse */ + ]); + case "byte": + return Uint8Array.from([2, header.value]); + case "short": + const shortView = new DataView(new ArrayBuffer(3)); + shortView.setUint8( + 0, + 3 + /* short */ + ); + shortView.setInt16(1, header.value, false); + return new Uint8Array(shortView.buffer); + case "integer": + const intView = new DataView(new ArrayBuffer(5)); + intView.setUint8( + 0, + 4 + /* integer */ + ); + intView.setInt32(1, header.value, false); + return new Uint8Array(intView.buffer); + case "long": + const longBytes = new Uint8Array(9); + longBytes[0] = 5; + longBytes.set(header.value.bytes, 1); + return longBytes; + case "binary": + const binView = new DataView(new ArrayBuffer(3 + header.value.byteLength)); + binView.setUint8( + 0, + 6 + /* byteArray */ + ); + binView.setUint16(1, header.value.byteLength, false); + const binBytes = new Uint8Array(binView.buffer); + binBytes.set(header.value, 3); + return binBytes; + case "string": + const utf8Bytes = (0, import_util_utf83.fromUtf8)(header.value); + const strView = new DataView(new ArrayBuffer(3 + utf8Bytes.byteLength)); + strView.setUint8( + 0, + 7 + /* string */ + ); + strView.setUint16(1, utf8Bytes.byteLength, false); + const strBytes = new Uint8Array(strView.buffer); + strBytes.set(utf8Bytes, 3); + return strBytes; + case "timestamp": + const tsBytes = new Uint8Array(9); + tsBytes[0] = 8; + tsBytes.set(Int64.fromNumber(header.value.valueOf()).bytes, 1); + return tsBytes; + case "uuid": + if (!UUID_PATTERN.test(header.value)) { + throw new Error(`Invalid UUID received: ${header.value}`); + } + const uuidBytes = new Uint8Array(17); + uuidBytes[0] = 9; + uuidBytes.set((0, import_util_hex_encoding.fromHex)(header.value.replace(/\-/g, "")), 1); + return uuidBytes; + } } - return contents; }; - var deserializeMetadata = (output) => ({ - httpStatusCode: output.statusCode, - requestId: output.headers["x-amzn-requestid"] ?? output.headers["x-amzn-request-id"] ?? output.headers["x-amz-request-id"], - extendedRequestId: output.headers["x-amz-id-2"], - cfId: output.headers["x-amz-cf-id"] - }); - var collectBodyString = (streamBody, context) => (0, smithy_client_1.collectBody)(streamBody, context).then((body) => context.utf8Encoder(body)); - var throwDefaultError = (0, smithy_client_1.withBaseException)(STSServiceException_1.STSServiceException); - var buildHttpRpcRequest = async (context, headers, path, resolvedHostname, body) => { - const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); - const contents = { - protocol, - hostname, - port, - method: "POST", - path: basePath.endsWith("/") ? basePath.slice(0, -1) + path : basePath + path, - headers - }; - if (resolvedHostname !== void 0) { - contents.hostname = resolvedHostname; + __name(_HeaderFormatter, "HeaderFormatter"); + var HeaderFormatter = _HeaderFormatter; + var UUID_PATTERN = /^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/; + var _Int64 = class _Int642 { + constructor(bytes) { + this.bytes = bytes; + if (bytes.byteLength !== 8) { + throw new Error("Int64 buffers must be exactly 8 bytes"); + } } - if (body !== void 0) { - contents.body = body; + static fromNumber(number) { + if (number > 9223372036854776e3 || number < -9223372036854776e3) { + throw new Error(`${number} is too large (or, if negative, too small) to represent as an Int64`); + } + const bytes = new Uint8Array(8); + for (let i = 7, remaining = Math.abs(Math.round(number)); i > -1 && remaining > 0; i--, remaining /= 256) { + bytes[i] = remaining; + } + if (number < 0) { + negate(bytes); + } + return new _Int642(bytes); } - return new protocol_http_1.HttpRequest(contents); - }; - var SHARED_HEADERS = { - "content-type": "application/x-www-form-urlencoded" - }; - var parseBody = (streamBody, context) => collectBodyString(streamBody, context).then((encoded) => { - if (encoded.length) { - const parser = new fast_xml_parser_1.XMLParser({ - attributeNamePrefix: "", - htmlEntities: true, - ignoreAttributes: false, - ignoreDeclaration: true, - parseTagValue: false, - trimValues: false, - tagValueProcessor: (_, val2) => val2.trim() === "" && val2.includes("\n") ? "" : void 0 - }); - parser.addEntity("#xD", "\r"); - parser.addEntity("#10", "\n"); - const parsedObj = parser.parse(encoded); - const textNodeName = "#text"; - const key = Object.keys(parsedObj)[0]; - const parsedObjToReturn = parsedObj[key]; - if (parsedObjToReturn[textNodeName]) { - parsedObjToReturn[key] = parsedObjToReturn[textNodeName]; - delete parsedObjToReturn[textNodeName]; + /** + * Called implicitly by infix arithmetic operators. + */ + valueOf() { + const bytes = this.bytes.slice(0); + const negative = bytes[0] & 128; + if (negative) { + negate(bytes); } - return (0, smithy_client_1.getValueFromTextNode)(parsedObjToReturn); + return parseInt((0, import_util_hex_encoding.toHex)(bytes), 16) * (negative ? -1 : 1); } - return {}; - }); - var parseErrorBody = async (errorBody, context) => { - const value = await parseBody(errorBody, context); - if (value.Error) { - value.Error.message = value.Error.message ?? value.Error.Message; + toString() { + return String(this.valueOf()); } - return value; }; - var buildFormUrlencodedString = (formEntries) => Object.entries(formEntries).map(([key, value]) => (0, smithy_client_1.extendedEncodeURIComponent)(key) + "=" + (0, smithy_client_1.extendedEncodeURIComponent)(value)).join("&"); - var loadQueryErrorCode = (output, data) => { - if (data.Error?.Code !== void 0) { - return data.Error.Code; + __name(_Int64, "Int64"); + var Int64 = _Int64; + function negate(bytes) { + for (let i = 0; i < 8; i++) { + bytes[i] ^= 255; } - if (output.statusCode == 404) { - return "NotFound"; + for (let i = 7; i > -1; i--) { + bytes[i]++; + if (bytes[i] !== 0) + break; } - }; - } -}); - -// ../../../node_modules/@aws-sdk/client-sts/dist-cjs/commands/AssumeRoleCommand.js -var require_AssumeRoleCommand = __commonJS({ - "../../../node_modules/@aws-sdk/client-sts/dist-cjs/commands/AssumeRoleCommand.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.AssumeRoleCommand = exports2.$Command = void 0; - var middleware_signing_1 = require_dist_cjs14(); - var middleware_endpoint_1 = require_dist_cjs26(); - var middleware_serde_1 = require_dist_cjs25(); - var smithy_client_1 = require_dist_cjs34(); - Object.defineProperty(exports2, "$Command", { enumerable: true, get: function() { - return smithy_client_1.Command; - } }); - var types_1 = require_dist_cjs(); - var models_0_1 = require_models_0(); - var Aws_query_1 = require_Aws_query(); - var AssumeRoleCommand = class _AssumeRoleCommand extends smithy_client_1.Command { - static getEndpointParameterInstructions() { - return { - UseGlobalEndpoint: { type: "builtInParams", name: "useGlobalEndpoint" }, - UseFIPS: { type: "builtInParams", name: "useFipsEndpoint" }, - Endpoint: { type: "builtInParams", name: "endpoint" }, - Region: { type: "builtInParams", name: "region" }, - UseDualStack: { type: "builtInParams", name: "useDualstackEndpoint" } - }; + } + __name(negate, "negate"); + var hasHeader = /* @__PURE__ */ __name((soughtHeader, headers) => { + soughtHeader = soughtHeader.toLowerCase(); + for (const headerName of Object.keys(headers)) { + if (soughtHeader === headerName.toLowerCase()) { + return true; + } } - constructor(input) { - super(); - this.input = input; + return false; + }, "hasHeader"); + var import_protocol_http8 = require_dist_cjs2(); + var moveHeadersToQuery = /* @__PURE__ */ __name((request2, options = {}) => { + var _a; + const { headers, query = {} } = import_protocol_http8.HttpRequest.clone(request2); + for (const name of Object.keys(headers)) { + const lname = name.toLowerCase(); + if (lname.slice(0, 6) === "x-amz-" && !((_a = options.unhoistableHeaders) == null ? void 0 : _a.has(lname))) { + query[name] = headers[name]; + delete headers[name]; + } } - resolveMiddleware(clientStack, configuration, options) { - this.middlewareStack.use((0, middleware_serde_1.getSerdePlugin)(configuration, this.serialize, this.deserialize)); - this.middlewareStack.use((0, middleware_endpoint_1.getEndpointPlugin)(configuration, _AssumeRoleCommand.getEndpointParameterInstructions())); - this.middlewareStack.use((0, middleware_signing_1.getAwsAuthPlugin)(configuration)); - const stack = clientStack.concat(this.middlewareStack); - const { logger } = configuration; - const clientName = "STSClient"; - const commandName = "AssumeRoleCommand"; - const handlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: (_) => _, - outputFilterSensitiveLog: models_0_1.AssumeRoleResponseFilterSensitiveLog, - [types_1.SMITHY_CONTEXT_KEY]: { - service: "AWSSecurityTokenServiceV20110615", - operation: "AssumeRole" - } - }; - const { requestHandler } = configuration; - return stack.resolve((request2) => requestHandler.handle(request2.request, options || {}), handlerExecutionContext); + return { + ...request2, + headers, + query + }; + }, "moveHeadersToQuery"); + var prepareRequest = /* @__PURE__ */ __name((request2) => { + request2 = import_protocol_http8.HttpRequest.clone(request2); + for (const headerName of Object.keys(request2.headers)) { + if (GENERATED_HEADERS.indexOf(headerName.toLowerCase()) > -1) { + delete request2.headers[headerName]; + } } - serialize(input, context) { - return (0, Aws_query_1.se_AssumeRoleCommand)(input, context); + return request2; + }, "prepareRequest"); + var iso8601 = /* @__PURE__ */ __name((time) => toDate(time).toISOString().replace(/\.\d{3}Z$/, "Z"), "iso8601"); + var toDate = /* @__PURE__ */ __name((time) => { + if (typeof time === "number") { + return new Date(time * 1e3); } - deserialize(output, context) { - return (0, Aws_query_1.de_AssumeRoleCommand)(output, context); + if (typeof time === "string") { + if (Number(time)) { + return new Date(Number(time) * 1e3); + } + return new Date(time); } - }; - exports2.AssumeRoleCommand = AssumeRoleCommand; - } -}); - -// ../../../node_modules/@aws-sdk/client-sts/dist-cjs/commands/AssumeRoleWithWebIdentityCommand.js -var require_AssumeRoleWithWebIdentityCommand = __commonJS({ - "../../../node_modules/@aws-sdk/client-sts/dist-cjs/commands/AssumeRoleWithWebIdentityCommand.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.AssumeRoleWithWebIdentityCommand = exports2.$Command = void 0; - var middleware_endpoint_1 = require_dist_cjs26(); - var middleware_serde_1 = require_dist_cjs25(); - var smithy_client_1 = require_dist_cjs34(); - Object.defineProperty(exports2, "$Command", { enumerable: true, get: function() { - return smithy_client_1.Command; - } }); - var types_1 = require_dist_cjs(); - var models_0_1 = require_models_0(); - var Aws_query_1 = require_Aws_query(); - var AssumeRoleWithWebIdentityCommand = class _AssumeRoleWithWebIdentityCommand extends smithy_client_1.Command { - static getEndpointParameterInstructions() { - return { - UseGlobalEndpoint: { type: "builtInParams", name: "useGlobalEndpoint" }, - UseFIPS: { type: "builtInParams", name: "useFipsEndpoint" }, - Endpoint: { type: "builtInParams", name: "endpoint" }, - Region: { type: "builtInParams", name: "region" }, - UseDualStack: { type: "builtInParams", name: "useDualstackEndpoint" } - }; + return time; + }, "toDate"); + var _SignatureV4 = class _SignatureV4 { + constructor({ + applyChecksum, + credentials, + region, + service, + sha256, + uriEscapePath = true + }) { + this.headerFormatter = new HeaderFormatter(); + this.service = service; + this.sha256 = sha256; + this.uriEscapePath = uriEscapePath; + this.applyChecksum = typeof applyChecksum === "boolean" ? applyChecksum : true; + this.regionProvider = (0, import_util_middleware3.normalizeProvider)(region); + this.credentialProvider = (0, import_util_middleware3.normalizeProvider)(credentials); } - constructor(input) { - super(); - this.input = input; + async presign(originalRequest, options = {}) { + const { + signingDate = /* @__PURE__ */ new Date(), + expiresIn = 3600, + unsignableHeaders, + unhoistableHeaders, + signableHeaders, + signingRegion, + signingService + } = options; + const credentials = await this.credentialProvider(); + this.validateResolvedCredentials(credentials); + const region = signingRegion ?? await this.regionProvider(); + const { longDate, shortDate } = formatDate(signingDate); + if (expiresIn > MAX_PRESIGNED_TTL) { + return Promise.reject( + "Signature version 4 presigned URLs must have an expiration date less than one week in the future" + ); + } + const scope = createScope(shortDate, region, signingService ?? this.service); + const request2 = moveHeadersToQuery(prepareRequest(originalRequest), { unhoistableHeaders }); + if (credentials.sessionToken) { + request2.query[TOKEN_QUERY_PARAM] = credentials.sessionToken; + } + request2.query[ALGORITHM_QUERY_PARAM] = ALGORITHM_IDENTIFIER; + request2.query[CREDENTIAL_QUERY_PARAM] = `${credentials.accessKeyId}/${scope}`; + request2.query[AMZ_DATE_QUERY_PARAM] = longDate; + request2.query[EXPIRES_QUERY_PARAM] = expiresIn.toString(10); + const canonicalHeaders = getCanonicalHeaders(request2, unsignableHeaders, signableHeaders); + request2.query[SIGNED_HEADERS_QUERY_PARAM] = getCanonicalHeaderList(canonicalHeaders); + request2.query[SIGNATURE_QUERY_PARAM] = await this.getSignature( + longDate, + scope, + this.getSigningKey(credentials, region, shortDate, signingService), + this.createCanonicalRequest(request2, canonicalHeaders, await getPayloadHash(originalRequest, this.sha256)) + ); + return request2; } - resolveMiddleware(clientStack, configuration, options) { - this.middlewareStack.use((0, middleware_serde_1.getSerdePlugin)(configuration, this.serialize, this.deserialize)); - this.middlewareStack.use((0, middleware_endpoint_1.getEndpointPlugin)(configuration, _AssumeRoleWithWebIdentityCommand.getEndpointParameterInstructions())); - const stack = clientStack.concat(this.middlewareStack); - const { logger } = configuration; - const clientName = "STSClient"; - const commandName = "AssumeRoleWithWebIdentityCommand"; - const handlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: models_0_1.AssumeRoleWithWebIdentityRequestFilterSensitiveLog, - outputFilterSensitiveLog: models_0_1.AssumeRoleWithWebIdentityResponseFilterSensitiveLog, - [types_1.SMITHY_CONTEXT_KEY]: { - service: "AWSSecurityTokenServiceV20110615", - operation: "AssumeRoleWithWebIdentity" + async sign(toSign, options) { + if (typeof toSign === "string") { + return this.signString(toSign, options); + } else if (toSign.headers && toSign.payload) { + return this.signEvent(toSign, options); + } else if (toSign.message) { + return this.signMessage(toSign, options); + } else { + return this.signRequest(toSign, options); + } + } + async signEvent({ headers, payload }, { signingDate = /* @__PURE__ */ new Date(), priorSignature, signingRegion, signingService }) { + const region = signingRegion ?? await this.regionProvider(); + const { shortDate, longDate } = formatDate(signingDate); + const scope = createScope(shortDate, region, signingService ?? this.service); + const hashedPayload = await getPayloadHash({ headers: {}, body: payload }, this.sha256); + const hash = new this.sha256(); + hash.update(headers); + const hashedHeaders = (0, import_util_hex_encoding.toHex)(await hash.digest()); + const stringToSign = [ + EVENT_ALGORITHM_IDENTIFIER, + longDate, + scope, + priorSignature, + hashedHeaders, + hashedPayload + ].join("\n"); + return this.signString(stringToSign, { signingDate, signingRegion: region, signingService }); + } + async signMessage(signableMessage, { signingDate = /* @__PURE__ */ new Date(), signingRegion, signingService }) { + const promise = this.signEvent( + { + headers: this.headerFormatter.format(signableMessage.message.headers), + payload: signableMessage.message.body + }, + { + signingDate, + signingRegion, + signingService, + priorSignature: signableMessage.priorSignature } - }; - const { requestHandler } = configuration; - return stack.resolve((request2) => requestHandler.handle(request2.request, options || {}), handlerExecutionContext); - } - serialize(input, context) { - return (0, Aws_query_1.se_AssumeRoleWithWebIdentityCommand)(input, context); - } - deserialize(output, context) { - return (0, Aws_query_1.de_AssumeRoleWithWebIdentityCommand)(output, context); + ); + return promise.then((signature) => { + return { message: signableMessage.message, signature }; + }); } - }; - exports2.AssumeRoleWithWebIdentityCommand = AssumeRoleWithWebIdentityCommand; - } -}); - -// ../../../node_modules/@aws-sdk/client-sts/dist-cjs/defaultStsRoleAssumers.js -var require_defaultStsRoleAssumers = __commonJS({ - "../../../node_modules/@aws-sdk/client-sts/dist-cjs/defaultStsRoleAssumers.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.decorateDefaultCredentialProvider = exports2.getDefaultRoleAssumerWithWebIdentity = exports2.getDefaultRoleAssumer = void 0; - var AssumeRoleCommand_1 = require_AssumeRoleCommand(); - var AssumeRoleWithWebIdentityCommand_1 = require_AssumeRoleWithWebIdentityCommand(); - var ASSUME_ROLE_DEFAULT_REGION = "us-east-1"; - var decorateDefaultRegion = (region) => { - if (typeof region !== "function") { - return region === void 0 ? ASSUME_ROLE_DEFAULT_REGION : region; + async signString(stringToSign, { signingDate = /* @__PURE__ */ new Date(), signingRegion, signingService } = {}) { + const credentials = await this.credentialProvider(); + this.validateResolvedCredentials(credentials); + const region = signingRegion ?? await this.regionProvider(); + const { shortDate } = formatDate(signingDate); + const hash = new this.sha256(await this.getSigningKey(credentials, region, shortDate, signingService)); + hash.update((0, import_util_utf84.toUint8Array)(stringToSign)); + return (0, import_util_hex_encoding.toHex)(await hash.digest()); } - return async () => { - try { - return await region(); - } catch (e) { - return ASSUME_ROLE_DEFAULT_REGION; - } - }; - }; - var getDefaultRoleAssumer = (stsOptions, stsClientCtor) => { - let stsClient; - let closureSourceCreds; - return async (sourceCreds, params) => { - closureSourceCreds = sourceCreds; - if (!stsClient) { - const { logger, region, requestHandler } = stsOptions; - stsClient = new stsClientCtor({ - logger, - credentialDefaultProvider: () => async () => closureSourceCreds, - region: decorateDefaultRegion(region || stsOptions.region), - ...requestHandler ? { requestHandler } : {} - }); - } - const { Credentials } = await stsClient.send(new AssumeRoleCommand_1.AssumeRoleCommand(params)); - if (!Credentials || !Credentials.AccessKeyId || !Credentials.SecretAccessKey) { - throw new Error(`Invalid response from STS.assumeRole call with role ${params.RoleArn}`); - } - return { - accessKeyId: Credentials.AccessKeyId, - secretAccessKey: Credentials.SecretAccessKey, - sessionToken: Credentials.SessionToken, - expiration: Credentials.Expiration - }; - }; - }; - exports2.getDefaultRoleAssumer = getDefaultRoleAssumer; - var getDefaultRoleAssumerWithWebIdentity = (stsOptions, stsClientCtor) => { - let stsClient; - return async (params) => { - if (!stsClient) { - const { logger, region, requestHandler } = stsOptions; - stsClient = new stsClientCtor({ - logger, - region: decorateDefaultRegion(region || stsOptions.region), - ...requestHandler ? { requestHandler } : {} - }); + async signRequest(requestToSign, { + signingDate = /* @__PURE__ */ new Date(), + signableHeaders, + unsignableHeaders, + signingRegion, + signingService + } = {}) { + const credentials = await this.credentialProvider(); + this.validateResolvedCredentials(credentials); + const region = signingRegion ?? await this.regionProvider(); + const request2 = prepareRequest(requestToSign); + const { longDate, shortDate } = formatDate(signingDate); + const scope = createScope(shortDate, region, signingService ?? this.service); + request2.headers[AMZ_DATE_HEADER] = longDate; + if (credentials.sessionToken) { + request2.headers[TOKEN_HEADER] = credentials.sessionToken; } - const { Credentials } = await stsClient.send(new AssumeRoleWithWebIdentityCommand_1.AssumeRoleWithWebIdentityCommand(params)); - if (!Credentials || !Credentials.AccessKeyId || !Credentials.SecretAccessKey) { - throw new Error(`Invalid response from STS.assumeRoleWithWebIdentity call with role ${params.RoleArn}`); + const payloadHash = await getPayloadHash(request2, this.sha256); + if (!hasHeader(SHA256_HEADER, request2.headers) && this.applyChecksum) { + request2.headers[SHA256_HEADER] = payloadHash; } - return { - accessKeyId: Credentials.AccessKeyId, - secretAccessKey: Credentials.SecretAccessKey, - sessionToken: Credentials.SessionToken, - expiration: Credentials.Expiration - }; - }; - }; - exports2.getDefaultRoleAssumerWithWebIdentity = getDefaultRoleAssumerWithWebIdentity; - var decorateDefaultCredentialProvider = (provider) => (input) => provider({ - roleAssumer: (0, exports2.getDefaultRoleAssumer)(input, input.stsClientCtor), - roleAssumerWithWebIdentity: (0, exports2.getDefaultRoleAssumerWithWebIdentity)(input, input.stsClientCtor), - ...input - }); - exports2.decorateDefaultCredentialProvider = decorateDefaultCredentialProvider; - } -}); - -// ../../../node_modules/@aws-sdk/credential-provider-env/dist-cjs/fromEnv.js -var require_fromEnv = __commonJS({ - "../../../node_modules/@aws-sdk/credential-provider-env/dist-cjs/fromEnv.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.fromEnv = exports2.ENV_EXPIRATION = exports2.ENV_SESSION = exports2.ENV_SECRET = exports2.ENV_KEY = void 0; - var property_provider_1 = require_dist_cjs6(); - exports2.ENV_KEY = "AWS_ACCESS_KEY_ID"; - exports2.ENV_SECRET = "AWS_SECRET_ACCESS_KEY"; - exports2.ENV_SESSION = "AWS_SESSION_TOKEN"; - exports2.ENV_EXPIRATION = "AWS_CREDENTIAL_EXPIRATION"; - var fromEnv = () => async () => { - const accessKeyId = process.env[exports2.ENV_KEY]; - const secretAccessKey = process.env[exports2.ENV_SECRET]; - const sessionToken = process.env[exports2.ENV_SESSION]; - const expiry = process.env[exports2.ENV_EXPIRATION]; - if (accessKeyId && secretAccessKey) { - return { - accessKeyId, - secretAccessKey, - ...sessionToken && { sessionToken }, - ...expiry && { expiration: new Date(expiry) } - }; + const canonicalHeaders = getCanonicalHeaders(request2, unsignableHeaders, signableHeaders); + const signature = await this.getSignature( + longDate, + scope, + this.getSigningKey(credentials, region, shortDate, signingService), + this.createCanonicalRequest(request2, canonicalHeaders, payloadHash) + ); + request2.headers[AUTH_HEADER] = `${ALGORITHM_IDENTIFIER} Credential=${credentials.accessKeyId}/${scope}, SignedHeaders=${getCanonicalHeaderList(canonicalHeaders)}, Signature=${signature}`; + return request2; } - throw new property_provider_1.CredentialsProviderError("Unable to find environment variable credentials."); - }; - exports2.fromEnv = fromEnv; - } -}); - -// ../../../node_modules/@aws-sdk/credential-provider-env/dist-cjs/index.js -var require_dist_cjs37 = __commonJS({ - "../../../node_modules/@aws-sdk/credential-provider-env/dist-cjs/index.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports)); - tslib_1.__exportStar(require_fromEnv(), exports2); - } -}); + createCanonicalRequest(request2, canonicalHeaders, payloadHash) { + const sortedHeaders = Object.keys(canonicalHeaders).sort(); + return `${request2.method} +${this.getCanonicalPath(request2)} +${getCanonicalQuery(request2)} +${sortedHeaders.map((name) => `${name}:${canonicalHeaders[name]}`).join("\n")} -// ../../../node_modules/@smithy/credential-provider-imds/dist-cjs/index.js -var require_dist_cjs38 = __commonJS({ - "../../../node_modules/@smithy/credential-provider-imds/dist-cjs/index.js"(exports2, module2) { - var __defProp2 = Object.defineProperty; - var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; - var __getOwnPropNames2 = Object.getOwnPropertyNames; - var __hasOwnProp2 = Object.prototype.hasOwnProperty; - var __name = (target, value) => __defProp2(target, "name", { value, configurable: true }); - var __export2 = (target, all) => { - for (var name in all) - __defProp2(target, name, { get: all[name], enumerable: true }); - }; - var __copyProps2 = (to, from, except, desc) => { - if (from && typeof from === "object" || typeof from === "function") { - for (let key of __getOwnPropNames2(from)) - if (!__hasOwnProp2.call(to, key) && key !== except) - __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable }); +${sortedHeaders.join(";")} +${payloadHash}`; } - return to; - }; - var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); - var src_exports = {}; - __export2(src_exports, { - DEFAULT_MAX_RETRIES: () => DEFAULT_MAX_RETRIES, - DEFAULT_TIMEOUT: () => DEFAULT_TIMEOUT, - ENV_CMDS_AUTH_TOKEN: () => ENV_CMDS_AUTH_TOKEN, - ENV_CMDS_FULL_URI: () => ENV_CMDS_FULL_URI, - ENV_CMDS_RELATIVE_URI: () => ENV_CMDS_RELATIVE_URI, - Endpoint: () => Endpoint, - fromContainerMetadata: () => fromContainerMetadata, - fromInstanceMetadata: () => fromInstanceMetadata, - getInstanceMetadataEndpoint: () => getInstanceMetadataEndpoint, - httpRequest: () => httpRequest, - providerConfigFromInit: () => providerConfigFromInit - }); - module2.exports = __toCommonJS2(src_exports); - var import_url = require("url"); - var import_property_provider = require_dist_cjs6(); - var import_buffer = require("buffer"); - var import_http2 = require("http"); - function httpRequest(options) { - return new Promise((resolve, reject) => { - var _a; - const req = (0, import_http2.request)({ - method: "GET", - ...options, - // Node.js http module doesn't accept hostname with square brackets - // Refs: https://github.com/nodejs/node/issues/39738 - hostname: (_a = options.hostname) == null ? void 0 : _a.replace(/^\[(.+)\]$/, "$1") - }); - req.on("error", (err) => { - reject(Object.assign(new import_property_provider.ProviderError("Unable to connect to instance metadata service"), err)); - req.destroy(); - }); - req.on("timeout", () => { - reject(new import_property_provider.ProviderError("TimeoutError from instance metadata service")); - req.destroy(); - }); - req.on("response", (res) => { - const { statusCode = 400 } = res; - if (statusCode < 200 || 300 <= statusCode) { - reject( - Object.assign(new import_property_provider.ProviderError("Error response received from instance metadata service"), { statusCode }) - ); - req.destroy(); + async createStringToSign(longDate, credentialScope, canonicalRequest) { + const hash = new this.sha256(); + hash.update((0, import_util_utf84.toUint8Array)(canonicalRequest)); + const hashedRequest = await hash.digest(); + return `${ALGORITHM_IDENTIFIER} +${longDate} +${credentialScope} +${(0, import_util_hex_encoding.toHex)(hashedRequest)}`; + } + getCanonicalPath({ path }) { + if (this.uriEscapePath) { + const normalizedPathSegments = []; + for (const pathSegment of path.split("/")) { + if ((pathSegment == null ? void 0 : pathSegment.length) === 0) + continue; + if (pathSegment === ".") + continue; + if (pathSegment === "..") { + normalizedPathSegments.pop(); + } else { + normalizedPathSegments.push(pathSegment); + } } - const chunks = []; - res.on("data", (chunk) => { - chunks.push(chunk); - }); - res.on("end", () => { - resolve(import_buffer.Buffer.concat(chunks)); - req.destroy(); - }); - }); - req.end(); - }); - } - __name(httpRequest, "httpRequest"); - var isImdsCredentials = /* @__PURE__ */ __name((arg) => Boolean(arg) && typeof arg === "object" && typeof arg.AccessKeyId === "string" && typeof arg.SecretAccessKey === "string" && typeof arg.Token === "string" && typeof arg.Expiration === "string", "isImdsCredentials"); - var fromImdsCredentials = /* @__PURE__ */ __name((creds) => ({ - accessKeyId: creds.AccessKeyId, - secretAccessKey: creds.SecretAccessKey, - sessionToken: creds.Token, - expiration: new Date(creds.Expiration) - }), "fromImdsCredentials"); - var DEFAULT_TIMEOUT = 1e3; - var DEFAULT_MAX_RETRIES = 0; - var providerConfigFromInit = /* @__PURE__ */ __name(({ - maxRetries = DEFAULT_MAX_RETRIES, - timeout = DEFAULT_TIMEOUT - }) => ({ maxRetries, timeout }), "providerConfigFromInit"); - var retry = /* @__PURE__ */ __name((toRetry, maxRetries) => { - let promise = toRetry(); - for (let i = 0; i < maxRetries; i++) { - promise = promise.catch(toRetry); + const normalizedPath = `${(path == null ? void 0 : path.startsWith("/")) ? "/" : ""}${normalizedPathSegments.join("/")}${normalizedPathSegments.length > 0 && (path == null ? void 0 : path.endsWith("/")) ? "/" : ""}`; + const doubleEncoded = (0, import_util_uri_escape.escapeUri)(normalizedPath); + return doubleEncoded.replace(/%2F/g, "/"); + } + return path; } - return promise; - }, "retry"); - var ENV_CMDS_FULL_URI = "AWS_CONTAINER_CREDENTIALS_FULL_URI"; - var ENV_CMDS_RELATIVE_URI = "AWS_CONTAINER_CREDENTIALS_RELATIVE_URI"; - var ENV_CMDS_AUTH_TOKEN = "AWS_CONTAINER_AUTHORIZATION_TOKEN"; - var fromContainerMetadata = /* @__PURE__ */ __name((init = {}) => { - const { timeout, maxRetries } = providerConfigFromInit(init); - return () => retry(async () => { - const requestOptions = await getCmdsUri(); - const credsResponse = JSON.parse(await requestFromEcsImds(timeout, requestOptions)); - if (!isImdsCredentials(credsResponse)) { - throw new import_property_provider.CredentialsProviderError("Invalid response received from instance metadata service."); + async getSignature(longDate, credentialScope, keyPromise, canonicalRequest) { + const stringToSign = await this.createStringToSign(longDate, credentialScope, canonicalRequest); + const hash = new this.sha256(await keyPromise); + hash.update((0, import_util_utf84.toUint8Array)(stringToSign)); + return (0, import_util_hex_encoding.toHex)(await hash.digest()); + } + getSigningKey(credentials, region, shortDate, service) { + return getSigningKey(this.sha256, credentials, shortDate, region, service || this.service); + } + validateResolvedCredentials(credentials) { + if (typeof credentials !== "object" || // @ts-expect-error: Property 'accessKeyId' does not exist on type 'object'.ts(2339) + typeof credentials.accessKeyId !== "string" || // @ts-expect-error: Property 'secretAccessKey' does not exist on type 'object'.ts(2339) + typeof credentials.secretAccessKey !== "string") { + throw new Error("Resolved credential object is not valid"); } - return fromImdsCredentials(credsResponse); - }, maxRetries); - }, "fromContainerMetadata"); - var requestFromEcsImds = /* @__PURE__ */ __name(async (timeout, options) => { - if (process.env[ENV_CMDS_AUTH_TOKEN]) { - options.headers = { - ...options.headers, - Authorization: process.env[ENV_CMDS_AUTH_TOKEN] - }; } - const buffer = await httpRequest({ - ...options, - timeout - }); - return buffer.toString(); - }, "requestFromEcsImds"); - var CMDS_IP = "169.254.170.2"; - var GREENGRASS_HOSTS = { - localhost: true, - "127.0.0.1": true - }; - var GREENGRASS_PROTOCOLS = { - "http:": true, - "https:": true }; - var getCmdsUri = /* @__PURE__ */ __name(async () => { - if (process.env[ENV_CMDS_RELATIVE_URI]) { - return { - hostname: CMDS_IP, - path: process.env[ENV_CMDS_RELATIVE_URI] - }; + __name(_SignatureV4, "SignatureV4"); + var SignatureV42 = _SignatureV4; + var formatDate = /* @__PURE__ */ __name((now) => { + const longDate = iso8601(now).replace(/[\-:]/g, ""); + return { + longDate, + shortDate: longDate.slice(0, 8) + }; + }, "formatDate"); + var getCanonicalHeaderList = /* @__PURE__ */ __name((headers) => Object.keys(headers).sort().join(";"), "getCanonicalHeaderList"); + } +}); + +// ../../../node_modules/@aws-sdk/core/dist-es/submodules/httpAuthSchemes/aws_sdk/resolveAwsSdkSigV4Config.js +var import_signature_v4, resolveAwsSdkSigV4Config, resolveAWSSDKSigV4Config; +var init_resolveAwsSdkSigV4Config = __esm({ + "../../../node_modules/@aws-sdk/core/dist-es/submodules/httpAuthSchemes/aws_sdk/resolveAwsSdkSigV4Config.js"() { + init_dist_es(); + import_signature_v4 = __toESM(require_dist_cjs47()); + resolveAwsSdkSigV4Config = (config) => { + let normalizedCreds; + if (config.credentials) { + normalizedCreds = memoizeIdentityProvider(config.credentials, isIdentityExpired, doesIdentityRequireRefresh); } - if (process.env[ENV_CMDS_FULL_URI]) { - const parsed = (0, import_url.parse)(process.env[ENV_CMDS_FULL_URI]); - if (!parsed.hostname || !(parsed.hostname in GREENGRASS_HOSTS)) { - throw new import_property_provider.CredentialsProviderError( - `${parsed.hostname} is not a valid container metadata service hostname`, - false - ); - } - if (!parsed.protocol || !(parsed.protocol in GREENGRASS_PROTOCOLS)) { - throw new import_property_provider.CredentialsProviderError( - `${parsed.protocol} is not a valid container metadata service protocol`, - false - ); + if (!normalizedCreds) { + if (config.credentialDefaultProvider) { + normalizedCreds = normalizeProvider(config.credentialDefaultProvider(Object.assign({}, config, { + parentClientConfig: config + }))); + } else { + normalizedCreds = async () => { + throw new Error("`credentials` is missing"); + }; } - return { - ...parsed, - port: parsed.port ? parseInt(parsed.port, 10) : void 0 + } + const { signingEscapePath = true, systemClockOffset = config.systemClockOffset || 0, sha256 } = config; + let signer; + if (config.signer) { + signer = normalizeProvider(config.signer); + } else if (config.regionInfoProvider) { + signer = () => normalizeProvider(config.region)().then(async (region) => [ + await config.regionInfoProvider(region, { + useFipsEndpoint: await config.useFipsEndpoint(), + useDualstackEndpoint: await config.useDualstackEndpoint() + }) || {}, + region + ]).then(([regionInfo, region]) => { + const { signingRegion, signingService } = regionInfo; + config.signingRegion = config.signingRegion || signingRegion || region; + config.signingName = config.signingName || signingService || config.serviceId; + const params = { + ...config, + credentials: normalizedCreds, + region: config.signingRegion, + service: config.signingName, + sha256, + uriEscapePath: signingEscapePath + }; + const SignerCtor = config.signerConstructor || import_signature_v4.SignatureV4; + return new SignerCtor(params); + }); + } else { + signer = async (authScheme) => { + authScheme = Object.assign({}, { + name: "sigv4", + signingName: config.signingName || config.defaultSigningName, + signingRegion: await normalizeProvider(config.region)(), + properties: {} + }, authScheme); + const signingRegion = authScheme.signingRegion; + const signingService = authScheme.signingName; + config.signingRegion = config.signingRegion || signingRegion; + config.signingName = config.signingName || signingService || config.serviceId; + const params = { + ...config, + credentials: normalizedCreds, + region: config.signingRegion, + service: config.signingName, + sha256, + uriEscapePath: signingEscapePath + }; + const SignerCtor = config.signerConstructor || import_signature_v4.SignatureV4; + return new SignerCtor(params); }; } - throw new import_property_provider.CredentialsProviderError( - `The container metadata credential provider cannot be used unless the ${ENV_CMDS_RELATIVE_URI} or ${ENV_CMDS_FULL_URI} environment variable is set`, - false - ); - }, "getCmdsUri"); - var _InstanceMetadataV1FallbackError = class _InstanceMetadataV1FallbackError2 extends import_property_provider.CredentialsProviderError { - constructor(message, tryNextLink = true) { - super(message, tryNextLink); - this.tryNextLink = tryNextLink; - this.name = "InstanceMetadataV1FallbackError"; - Object.setPrototypeOf(this, _InstanceMetadataV1FallbackError2.prototype); + return { + ...config, + systemClockOffset, + signingEscapePath, + credentials: normalizedCreds, + signer + }; + }; + resolveAWSSDKSigV4Config = resolveAwsSdkSigV4Config; + } +}); + +// ../../../node_modules/@aws-sdk/core/dist-es/submodules/httpAuthSchemes/aws_sdk/index.js +var init_aws_sdk = __esm({ + "../../../node_modules/@aws-sdk/core/dist-es/submodules/httpAuthSchemes/aws_sdk/index.js"() { + init_AwsSdkSigV4Signer(); + init_AwsSdkSigV4ASigner(); + init_resolveAwsSdkSigV4AConfig(); + init_resolveAwsSdkSigV4Config(); + } +}); + +// ../../../node_modules/@aws-sdk/core/dist-es/submodules/httpAuthSchemes/index.js +var init_httpAuthSchemes2 = __esm({ + "../../../node_modules/@aws-sdk/core/dist-es/submodules/httpAuthSchemes/index.js"() { + init_aws_sdk(); + } +}); + +// ../../../node_modules/@aws-sdk/core/dist-es/submodules/protocols/coercing-serializers.js +var _toStr, _toBool, _toNum; +var init_coercing_serializers = __esm({ + "../../../node_modules/@aws-sdk/core/dist-es/submodules/protocols/coercing-serializers.js"() { + _toStr = (val2) => { + if (val2 == null) { + return val2; } + if (typeof val2 === "number" || typeof val2 === "bigint") { + const warning = new Error(`Received number ${val2} where a string was expected.`); + warning.name = "Warning"; + console.warn(warning); + return String(val2); + } + if (typeof val2 === "boolean") { + const warning = new Error(`Received boolean ${val2} where a string was expected.`); + warning.name = "Warning"; + console.warn(warning); + return String(val2); + } + return val2; }; - __name(_InstanceMetadataV1FallbackError, "InstanceMetadataV1FallbackError"); - var InstanceMetadataV1FallbackError = _InstanceMetadataV1FallbackError; - var import_node_config_provider = require_dist_cjs22(); - var import_url_parser = require_dist_cjs24(); - var Endpoint = /* @__PURE__ */ ((Endpoint2) => { - Endpoint2["IPv4"] = "http://169.254.169.254"; - Endpoint2["IPv6"] = "http://[fd00:ec2::254]"; - return Endpoint2; - })(Endpoint || {}); - var ENV_ENDPOINT_NAME = "AWS_EC2_METADATA_SERVICE_ENDPOINT"; - var CONFIG_ENDPOINT_NAME = "ec2_metadata_service_endpoint"; - var ENDPOINT_CONFIG_OPTIONS = { - environmentVariableSelector: (env) => env[ENV_ENDPOINT_NAME], - configFileSelector: (profile) => profile[CONFIG_ENDPOINT_NAME], - default: void 0 + _toBool = (val2) => { + if (val2 == null) { + return val2; + } + if (typeof val2 === "number") { + } + if (typeof val2 === "string") { + const lowercase = val2.toLowerCase(); + if (val2 !== "" && lowercase !== "false" && lowercase !== "true") { + const warning = new Error(`Received string "${val2}" where a boolean was expected.`); + warning.name = "Warning"; + console.warn(warning); + } + return val2 !== "" && lowercase !== "false"; + } + return val2; }; - var EndpointMode = /* @__PURE__ */ ((EndpointMode2) => { - EndpointMode2["IPv4"] = "IPv4"; - EndpointMode2["IPv6"] = "IPv6"; - return EndpointMode2; - })(EndpointMode || {}); - var ENV_ENDPOINT_MODE_NAME = "AWS_EC2_METADATA_SERVICE_ENDPOINT_MODE"; - var CONFIG_ENDPOINT_MODE_NAME = "ec2_metadata_service_endpoint_mode"; - var ENDPOINT_MODE_CONFIG_OPTIONS = { - environmentVariableSelector: (env) => env[ENV_ENDPOINT_MODE_NAME], - configFileSelector: (profile) => profile[CONFIG_ENDPOINT_MODE_NAME], - default: "IPv4" - /* IPv4 */ + _toNum = (val2) => { + if (val2 == null) { + return val2; + } + if (typeof val2 === "boolean") { + } + if (typeof val2 === "string") { + const num = Number(val2); + if (num.toString() !== val2) { + const warning = new Error(`Received string "${val2}" where a number was expected.`); + warning.name = "Warning"; + console.warn(warning); + return val2; + } + return num; + } + return val2; }; - var getInstanceMetadataEndpoint = /* @__PURE__ */ __name(async () => (0, import_url_parser.parseUrl)(await getFromEndpointConfig() || await getFromEndpointModeConfig()), "getInstanceMetadataEndpoint"); - var getFromEndpointConfig = /* @__PURE__ */ __name(async () => (0, import_node_config_provider.loadConfig)(ENDPOINT_CONFIG_OPTIONS)(), "getFromEndpointConfig"); - var getFromEndpointModeConfig = /* @__PURE__ */ __name(async () => { - const endpointMode = await (0, import_node_config_provider.loadConfig)(ENDPOINT_MODE_CONFIG_OPTIONS)(); - switch (endpointMode) { - case "IPv4": - return "http://169.254.169.254"; - case "IPv6": - return "http://[fd00:ec2::254]"; - default: - throw new Error(`Unsupported endpoint mode: ${endpointMode}. Select from ${Object.values(EndpointMode)}`); + } +}); + +// ../../../node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/awsExpectUnion.js +var import_smithy_client2, awsExpectUnion; +var init_awsExpectUnion = __esm({ + "../../../node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/awsExpectUnion.js"() { + import_smithy_client2 = __toESM(require_dist_cjs37()); + awsExpectUnion = (value) => { + if (value == null) { + return void 0; } - }, "getFromEndpointModeConfig"); - var STATIC_STABILITY_REFRESH_INTERVAL_SECONDS = 5 * 60; - var STATIC_STABILITY_REFRESH_INTERVAL_JITTER_WINDOW_SECONDS = 5 * 60; - var STATIC_STABILITY_DOC_URL = "https://docs.aws.amazon.com/sdkref/latest/guide/feature-static-credentials.html"; - var getExtendedInstanceMetadataCredentials = /* @__PURE__ */ __name((credentials, logger) => { - const refreshInterval = STATIC_STABILITY_REFRESH_INTERVAL_SECONDS + Math.floor(Math.random() * STATIC_STABILITY_REFRESH_INTERVAL_JITTER_WINDOW_SECONDS); - const newExpiration = new Date(Date.now() + refreshInterval * 1e3); - logger.warn( - `Attempting credential expiration extension due to a credential service availability issue. A refresh of these credentials will be attempted after ${new Date(newExpiration)}. -For more information, please visit: ` + STATIC_STABILITY_DOC_URL - ); - const originalExpiration = credentials.originalExpiration ?? credentials.expiration; - return { - ...credentials, - ...originalExpiration ? { originalExpiration } : {}, - expiration: newExpiration - }; - }, "getExtendedInstanceMetadataCredentials"); - var staticStabilityProvider = /* @__PURE__ */ __name((provider, options = {}) => { - const logger = (options == null ? void 0 : options.logger) || console; - let pastCredentials; - return async () => { - let credentials; + if (typeof value === "object" && "__type" in value) { + delete value.__type; + } + return (0, import_smithy_client2.expectUnion)(value); + }; + } +}); + +// ../../../node_modules/@aws-sdk/core/dist-es/submodules/protocols/common.js +var import_smithy_client3, collectBodyString; +var init_common = __esm({ + "../../../node_modules/@aws-sdk/core/dist-es/submodules/protocols/common.js"() { + import_smithy_client3 = __toESM(require_dist_cjs37()); + collectBodyString = (streamBody, context) => (0, import_smithy_client3.collectBody)(streamBody, context).then((body) => context.utf8Encoder(body)); + } +}); + +// ../../../node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/parseJsonBody.js +var parseJsonBody, parseJsonErrorBody, loadRestJsonErrorCode; +var init_parseJsonBody = __esm({ + "../../../node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/parseJsonBody.js"() { + init_common(); + parseJsonBody = (streamBody, context) => collectBodyString(streamBody, context).then((encoded) => { + if (encoded.length) { try { - credentials = await provider(); - if (credentials.expiration && credentials.expiration.getTime() < Date.now()) { - credentials = getExtendedInstanceMetadataCredentials(credentials, logger); - } + return JSON.parse(encoded); } catch (e) { - if (pastCredentials) { - logger.warn("Credential renew failed: ", e); - credentials = getExtendedInstanceMetadataCredentials(pastCredentials, logger); + if (e?.name === "SyntaxError") { + Object.defineProperty(e, "$responseBodyText", { + value: encoded + }); + } + throw e; + } + } + return {}; + }); + parseJsonErrorBody = async (errorBody, context) => { + const value = await parseJsonBody(errorBody, context); + value.message = value.message ?? value.Message; + return value; + }; + loadRestJsonErrorCode = (output, data) => { + const findKey = (object, key) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase()); + const sanitizeErrorCode = (rawValue) => { + let cleanValue = rawValue; + if (typeof cleanValue === "number") { + cleanValue = cleanValue.toString(); + } + if (cleanValue.indexOf(",") >= 0) { + cleanValue = cleanValue.split(",")[0]; + } + if (cleanValue.indexOf(":") >= 0) { + cleanValue = cleanValue.split(":")[0]; + } + if (cleanValue.indexOf("#") >= 0) { + cleanValue = cleanValue.split("#")[1]; + } + return cleanValue; + }; + const headerKey = findKey(output.headers, "x-amzn-errortype"); + if (headerKey !== void 0) { + return sanitizeErrorCode(output.headers[headerKey]); + } + if (data.code !== void 0) { + return sanitizeErrorCode(data.code); + } + if (data["__type"] !== void 0) { + return sanitizeErrorCode(data["__type"]); + } + }; + } +}); + +// ../../../node_modules/fast-xml-parser/src/util.js +var require_util = __commonJS({ + "../../../node_modules/fast-xml-parser/src/util.js"(exports2) { + "use strict"; + var nameStartChar = ":A-Za-z_\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD"; + var nameChar = nameStartChar + "\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040"; + var nameRegexp = "[" + nameStartChar + "][" + nameChar + "]*"; + var regexName = new RegExp("^" + nameRegexp + "$"); + var getAllMatches = function(string, regex) { + const matches = []; + let match = regex.exec(string); + while (match) { + const allmatches = []; + allmatches.startIndex = regex.lastIndex - match[0].length; + const len = match.length; + for (let index = 0; index < len; index++) { + allmatches.push(match[index]); + } + matches.push(allmatches); + match = regex.exec(string); + } + return matches; + }; + var isName = function(string) { + const match = regexName.exec(string); + return !(match === null || typeof match === "undefined"); + }; + exports2.isExist = function(v) { + return typeof v !== "undefined"; + }; + exports2.isEmptyObject = function(obj) { + return Object.keys(obj).length === 0; + }; + exports2.merge = function(target, a, arrayMode) { + if (a) { + const keys = Object.keys(a); + const len = keys.length; + for (let i = 0; i < len; i++) { + if (arrayMode === "strict") { + target[keys[i]] = [a[keys[i]]]; } else { - throw e; + target[keys[i]] = a[keys[i]]; } } - pastCredentials = credentials; - return credentials; - }; - }, "staticStabilityProvider"); - var IMDS_PATH = "/latest/meta-data/iam/security-credentials/"; - var IMDS_TOKEN_PATH = "/latest/api/token"; - var AWS_EC2_METADATA_V1_DISABLED = "AWS_EC2_METADATA_V1_DISABLED"; - var PROFILE_AWS_EC2_METADATA_V1_DISABLED = "ec2_metadata_v1_disabled"; - var X_AWS_EC2_METADATA_TOKEN = "x-aws-ec2-metadata-token"; - var fromInstanceMetadata = /* @__PURE__ */ __name((init = {}) => staticStabilityProvider(getInstanceImdsProvider(init), { logger: init.logger }), "fromInstanceMetadata"); - var getInstanceImdsProvider = /* @__PURE__ */ __name((init) => { - let disableFetchToken = false; - const { logger, profile } = init; - const { timeout, maxRetries } = providerConfigFromInit(init); - const getCredentials = /* @__PURE__ */ __name(async (maxRetries2, options) => { - var _a; - const isImdsV1Fallback = disableFetchToken || ((_a = options.headers) == null ? void 0 : _a[X_AWS_EC2_METADATA_TOKEN]) == null; - if (isImdsV1Fallback) { - let fallbackBlockedFromProfile = false; - let fallbackBlockedFromProcessEnv = false; - const configValue = await (0, import_node_config_provider.loadConfig)( - { - environmentVariableSelector: (env) => { - const envValue = env[AWS_EC2_METADATA_V1_DISABLED]; - fallbackBlockedFromProcessEnv = !!envValue && envValue !== "false"; - if (envValue === void 0) { - throw new import_property_provider.CredentialsProviderError( - `${AWS_EC2_METADATA_V1_DISABLED} not set in env, checking config file next.` + } + }; + exports2.getValue = function(v) { + if (exports2.isExist(v)) { + return v; + } else { + return ""; + } + }; + exports2.isName = isName; + exports2.getAllMatches = getAllMatches; + exports2.nameRegexp = nameRegexp; + } +}); + +// ../../../node_modules/fast-xml-parser/src/validator.js +var require_validator = __commonJS({ + "../../../node_modules/fast-xml-parser/src/validator.js"(exports2) { + "use strict"; + var util = require_util(); + var defaultOptions = { + allowBooleanAttributes: false, + //A tag can have attributes without any value + unpairedTags: [] + }; + exports2.validate = function(xmlData, options) { + options = Object.assign({}, defaultOptions, options); + const tags = []; + let tagFound = false; + let reachedRoot = false; + if (xmlData[0] === "\uFEFF") { + xmlData = xmlData.substr(1); + } + for (let i = 0; i < xmlData.length; i++) { + if (xmlData[i] === "<" && xmlData[i + 1] === "?") { + i += 2; + i = readPI(xmlData, i); + if (i.err) return i; + } else if (xmlData[i] === "<") { + let tagStartPos = i; + i++; + if (xmlData[i] === "!") { + i = readCommentAndCDATA(xmlData, i); + continue; + } else { + let closingTag = false; + if (xmlData[i] === "/") { + closingTag = true; + i++; + } + let tagName = ""; + for (; i < xmlData.length && xmlData[i] !== ">" && xmlData[i] !== " " && xmlData[i] !== " " && xmlData[i] !== "\n" && xmlData[i] !== "\r"; i++) { + tagName += xmlData[i]; + } + tagName = tagName.trim(); + if (tagName[tagName.length - 1] === "/") { + tagName = tagName.substring(0, tagName.length - 1); + i--; + } + if (!validateTagName(tagName)) { + let msg; + if (tagName.trim().length === 0) { + msg = "Invalid space after '<'."; + } else { + msg = "Tag '" + tagName + "' is an invalid name."; + } + return getErrorObject("InvalidTag", msg, getLineNumberForPosition(xmlData, i)); + } + const result = readAttributeStr(xmlData, i); + if (result === false) { + return getErrorObject("InvalidAttr", "Attributes for '" + tagName + "' have open quote.", getLineNumberForPosition(xmlData, i)); + } + let attrStr = result.value; + i = result.index; + if (attrStr[attrStr.length - 1] === "/") { + const attrStrStart = i - attrStr.length; + attrStr = attrStr.substring(0, attrStr.length - 1); + const isValid = validateAttributeString(attrStr, options); + if (isValid === true) { + tagFound = true; + } else { + return getErrorObject(isValid.err.code, isValid.err.msg, getLineNumberForPosition(xmlData, attrStrStart + isValid.err.line)); + } + } else if (closingTag) { + if (!result.tagClosed) { + return getErrorObject("InvalidTag", "Closing tag '" + tagName + "' doesn't have proper closing.", getLineNumberForPosition(xmlData, i)); + } else if (attrStr.trim().length > 0) { + return getErrorObject("InvalidTag", "Closing tag '" + tagName + "' can't have attributes or invalid starting.", getLineNumberForPosition(xmlData, tagStartPos)); + } else if (tags.length === 0) { + return getErrorObject("InvalidTag", "Closing tag '" + tagName + "' has not been opened.", getLineNumberForPosition(xmlData, tagStartPos)); + } else { + const otg = tags.pop(); + if (tagName !== otg.tagName) { + let openPos = getLineNumberForPosition(xmlData, otg.tagStartPos); + return getErrorObject( + "InvalidTag", + "Expected closing tag '" + otg.tagName + "' (opened in line " + openPos.line + ", col " + openPos.col + ") instead of closing tag '" + tagName + "'.", + getLineNumberForPosition(xmlData, tagStartPos) ); } - return fallbackBlockedFromProcessEnv; - }, - configFileSelector: (profile2) => { - const profileValue = profile2[PROFILE_AWS_EC2_METADATA_V1_DISABLED]; - fallbackBlockedFromProfile = !!profileValue && profileValue !== "false"; - return fallbackBlockedFromProfile; - }, - default: false - }, - { - profile - } - )(); - if (init.ec2MetadataV1Disabled || configValue) { - const causes = []; - if (init.ec2MetadataV1Disabled) - causes.push("credential provider initialization (runtime option ec2MetadataV1Disabled)"); - if (fallbackBlockedFromProfile) - causes.push(`config file profile (${PROFILE_AWS_EC2_METADATA_V1_DISABLED})`); - if (fallbackBlockedFromProcessEnv) - causes.push(`process environment variable (${AWS_EC2_METADATA_V1_DISABLED})`); - throw new InstanceMetadataV1FallbackError( - `AWS EC2 Metadata v1 fallback has been blocked by AWS SDK configuration in the following: [${causes.join( - ", " - )}].` - ); - } - } - const imdsProfile = (await retry(async () => { - let profile2; - try { - profile2 = await getProfile(options); - } catch (err) { - if (err.statusCode === 401) { - disableFetchToken = false; + if (tags.length == 0) { + reachedRoot = true; + } + } + } else { + const isValid = validateAttributeString(attrStr, options); + if (isValid !== true) { + return getErrorObject(isValid.err.code, isValid.err.msg, getLineNumberForPosition(xmlData, i - attrStr.length + isValid.err.line)); + } + if (reachedRoot === true) { + return getErrorObject("InvalidXml", "Multiple possible root nodes found.", getLineNumberForPosition(xmlData, i)); + } else if (options.unpairedTags.indexOf(tagName) !== -1) { + } else { + tags.push({ tagName, tagStartPos }); + } + tagFound = true; } - throw err; - } - return profile2; - }, maxRetries2)).trim(); - return retry(async () => { - let creds; - try { - creds = await getCredentialsFromProfile(imdsProfile, options); - } catch (err) { - if (err.statusCode === 401) { - disableFetchToken = false; + for (i++; i < xmlData.length; i++) { + if (xmlData[i] === "<") { + if (xmlData[i + 1] === "!") { + i++; + i = readCommentAndCDATA(xmlData, i); + continue; + } else if (xmlData[i + 1] === "?") { + i = readPI(xmlData, ++i); + if (i.err) return i; + } else { + break; + } + } else if (xmlData[i] === "&") { + const afterAmp = validateAmpersand(xmlData, i); + if (afterAmp == -1) + return getErrorObject("InvalidChar", "char '&' is not expected.", getLineNumberForPosition(xmlData, i)); + i = afterAmp; + } else { + if (reachedRoot === true && !isWhiteSpace(xmlData[i])) { + return getErrorObject("InvalidXml", "Extra text at the end", getLineNumberForPosition(xmlData, i)); + } + } } - throw err; - } - return creds; - }, maxRetries2); - }, "getCredentials"); - return async () => { - const endpoint = await getInstanceMetadataEndpoint(); - if (disableFetchToken) { - logger == null ? void 0 : logger.debug("AWS SDK Instance Metadata", "using v1 fallback (no token fetch)"); - return getCredentials(maxRetries, { ...endpoint, timeout }); - } else { - let token; - try { - token = (await getMetadataToken({ ...endpoint, timeout })).toString(); - } catch (error) { - if ((error == null ? void 0 : error.statusCode) === 400) { - throw Object.assign(error, { - message: "EC2 Metadata token request returned error" - }); - } else if (error.message === "TimeoutError" || [403, 404, 405].includes(error.statusCode)) { - disableFetchToken = true; + if (xmlData[i] === "<") { + i--; } - logger == null ? void 0 : logger.debug("AWS SDK Instance Metadata", "using v1 fallback (initial)"); - return getCredentials(maxRetries, { ...endpoint, timeout }); } - return getCredentials(maxRetries, { - ...endpoint, - headers: { - [X_AWS_EC2_METADATA_TOKEN]: token - }, - timeout - }); + } else { + if (isWhiteSpace(xmlData[i])) { + continue; + } + return getErrorObject("InvalidChar", "char '" + xmlData[i] + "' is not expected.", getLineNumberForPosition(xmlData, i)); } - }; - }, "getInstanceImdsProvider"); - var getMetadataToken = /* @__PURE__ */ __name(async (options) => httpRequest({ - ...options, - path: IMDS_TOKEN_PATH, - method: "PUT", - headers: { - "x-aws-ec2-metadata-token-ttl-seconds": "21600" - } - }), "getMetadataToken"); - var getProfile = /* @__PURE__ */ __name(async (options) => (await httpRequest({ ...options, path: IMDS_PATH })).toString(), "getProfile"); - var getCredentialsFromProfile = /* @__PURE__ */ __name(async (profile, options) => { - const credsResponse = JSON.parse( - (await httpRequest({ - ...options, - path: IMDS_PATH + profile - })).toString() - ); - if (!isImdsCredentials(credsResponse)) { - throw new import_property_provider.CredentialsProviderError("Invalid response received from instance metadata service."); } - return fromImdsCredentials(credsResponse); - }, "getCredentialsFromProfile"); - } -}); - -// ../../../node_modules/@aws-sdk/credential-provider-ini/dist-cjs/resolveCredentialSource.js -var require_resolveCredentialSource = __commonJS({ - "../../../node_modules/@aws-sdk/credential-provider-ini/dist-cjs/resolveCredentialSource.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.resolveCredentialSource = void 0; - var credential_provider_env_1 = require_dist_cjs37(); - var credential_provider_imds_1 = require_dist_cjs38(); - var property_provider_1 = require_dist_cjs6(); - var resolveCredentialSource = (credentialSource, profileName) => { - const sourceProvidersMap = { - EcsContainer: credential_provider_imds_1.fromContainerMetadata, - Ec2InstanceMetadata: credential_provider_imds_1.fromInstanceMetadata, - Environment: credential_provider_env_1.fromEnv - }; - if (credentialSource in sourceProvidersMap) { - return sourceProvidersMap[credentialSource](); - } else { - throw new property_provider_1.CredentialsProviderError(`Unsupported credential source in profile ${profileName}. Got ${credentialSource}, expected EcsContainer or Ec2InstanceMetadata or Environment.`); + if (!tagFound) { + return getErrorObject("InvalidXml", "Start tag expected.", 1); + } else if (tags.length == 1) { + return getErrorObject("InvalidTag", "Unclosed tag '" + tags[0].tagName + "'.", getLineNumberForPosition(xmlData, tags[0].tagStartPos)); + } else if (tags.length > 0) { + return getErrorObject("InvalidXml", "Invalid '" + JSON.stringify(tags.map((t) => t.tagName), null, 4).replace(/\r?\n/g, "") + "' found.", { line: 1, col: 1 }); } + return true; }; - exports2.resolveCredentialSource = resolveCredentialSource; - } -}); - -// ../../../node_modules/@aws-sdk/credential-provider-ini/dist-cjs/resolveAssumeRoleCredentials.js -var require_resolveAssumeRoleCredentials = __commonJS({ - "../../../node_modules/@aws-sdk/credential-provider-ini/dist-cjs/resolveAssumeRoleCredentials.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.resolveAssumeRoleCredentials = exports2.isAssumeRoleProfile = void 0; - var property_provider_1 = require_dist_cjs6(); - var shared_ini_file_loader_1 = require_dist_cjs21(); - var resolveCredentialSource_1 = require_resolveCredentialSource(); - var resolveProfileData_1 = require_resolveProfileData(); - var isAssumeRoleProfile = (arg) => Boolean(arg) && typeof arg === "object" && typeof arg.role_arn === "string" && ["undefined", "string"].indexOf(typeof arg.role_session_name) > -1 && ["undefined", "string"].indexOf(typeof arg.external_id) > -1 && ["undefined", "string"].indexOf(typeof arg.mfa_serial) > -1 && (isAssumeRoleWithSourceProfile(arg) || isAssumeRoleWithProviderProfile(arg)); - exports2.isAssumeRoleProfile = isAssumeRoleProfile; - var isAssumeRoleWithSourceProfile = (arg) => typeof arg.source_profile === "string" && typeof arg.credential_source === "undefined"; - var isAssumeRoleWithProviderProfile = (arg) => typeof arg.credential_source === "string" && typeof arg.source_profile === "undefined"; - var resolveAssumeRoleCredentials = async (profileName, profiles, options, visitedProfiles = {}) => { - const data = profiles[profileName]; - if (!options.roleAssumer) { - throw new property_provider_1.CredentialsProviderError(`Profile ${profileName} requires a role to be assumed, but no role assumption callback was provided.`, false); - } - const { source_profile } = data; - if (source_profile && source_profile in visitedProfiles) { - throw new property_provider_1.CredentialsProviderError(`Detected a cycle attempting to resolve credentials for profile ${(0, shared_ini_file_loader_1.getProfileName)(options)}. Profiles visited: ` + Object.keys(visitedProfiles).join(", "), false); - } - const sourceCredsProvider = source_profile ? (0, resolveProfileData_1.resolveProfileData)(source_profile, profiles, options, { - ...visitedProfiles, - [source_profile]: true - }) : (0, resolveCredentialSource_1.resolveCredentialSource)(data.credential_source, profileName)(); - const params = { - RoleArn: data.role_arn, - RoleSessionName: data.role_session_name || `aws-sdk-js-${Date.now()}`, - ExternalId: data.external_id, - DurationSeconds: parseInt(data.duration_seconds || "3600", 10) - }; - const { mfa_serial } = data; - if (mfa_serial) { - if (!options.mfaCodeProvider) { - throw new property_provider_1.CredentialsProviderError(`Profile ${profileName} requires multi-factor authentication, but no MFA code callback was provided.`, false); + function isWhiteSpace(char) { + return char === " " || char === " " || char === "\n" || char === "\r"; + } + function readPI(xmlData, i) { + const start = i; + for (; i < xmlData.length; i++) { + if (xmlData[i] == "?" || xmlData[i] == " ") { + const tagname = xmlData.substr(start, i - start); + if (i > 5 && tagname === "xml") { + return getErrorObject("InvalidXml", "XML declaration allowed only at the start of the document.", getLineNumberForPosition(xmlData, i)); + } else if (xmlData[i] == "?" && xmlData[i + 1] == ">") { + i++; + break; + } else { + continue; + } } - params.SerialNumber = mfa_serial; - params.TokenCode = await options.mfaCodeProvider(mfa_serial); - } - const sourceCreds = await sourceCredsProvider; - return options.roleAssumer(sourceCreds, params); - }; - exports2.resolveAssumeRoleCredentials = resolveAssumeRoleCredentials; - } -}); - -// ../../../node_modules/@aws-sdk/credential-provider-process/dist-cjs/getValidatedProcessCredentials.js -var require_getValidatedProcessCredentials = __commonJS({ - "../../../node_modules/@aws-sdk/credential-provider-process/dist-cjs/getValidatedProcessCredentials.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.getValidatedProcessCredentials = void 0; - var getValidatedProcessCredentials = (profileName, data) => { - if (data.Version !== 1) { - throw Error(`Profile ${profileName} credential_process did not return Version 1.`); } - if (data.AccessKeyId === void 0 || data.SecretAccessKey === void 0) { - throw Error(`Profile ${profileName} credential_process returned invalid credentials.`); + return i; + } + function readCommentAndCDATA(xmlData, i) { + if (xmlData.length > i + 5 && xmlData[i + 1] === "-" && xmlData[i + 2] === "-") { + for (i += 3; i < xmlData.length; i++) { + if (xmlData[i] === "-" && xmlData[i + 1] === "-" && xmlData[i + 2] === ">") { + i += 2; + break; + } + } + } else if (xmlData.length > i + 8 && xmlData[i + 1] === "D" && xmlData[i + 2] === "O" && xmlData[i + 3] === "C" && xmlData[i + 4] === "T" && xmlData[i + 5] === "Y" && xmlData[i + 6] === "P" && xmlData[i + 7] === "E") { + let angleBracketsCount = 1; + for (i += 8; i < xmlData.length; i++) { + if (xmlData[i] === "<") { + angleBracketsCount++; + } else if (xmlData[i] === ">") { + angleBracketsCount--; + if (angleBracketsCount === 0) { + break; + } + } + } + } else if (xmlData.length > i + 9 && xmlData[i + 1] === "[" && xmlData[i + 2] === "C" && xmlData[i + 3] === "D" && xmlData[i + 4] === "A" && xmlData[i + 5] === "T" && xmlData[i + 6] === "A" && xmlData[i + 7] === "[") { + for (i += 8; i < xmlData.length; i++) { + if (xmlData[i] === "]" && xmlData[i + 1] === "]" && xmlData[i + 2] === ">") { + i += 2; + break; + } + } } - if (data.Expiration) { - const currentTime = /* @__PURE__ */ new Date(); - const expireTime = new Date(data.Expiration); - if (expireTime < currentTime) { - throw Error(`Profile ${profileName} credential_process returned expired credentials.`); + return i; + } + var doubleQuote = '"'; + var singleQuote = "'"; + function readAttributeStr(xmlData, i) { + let attrStr = ""; + let startChar = ""; + let tagClosed = false; + for (; i < xmlData.length; i++) { + if (xmlData[i] === doubleQuote || xmlData[i] === singleQuote) { + if (startChar === "") { + startChar = xmlData[i]; + } else if (startChar !== xmlData[i]) { + } else { + startChar = ""; + } + } else if (xmlData[i] === ">") { + if (startChar === "") { + tagClosed = true; + break; + } } + attrStr += xmlData[i]; + } + if (startChar !== "") { + return false; } return { - accessKeyId: data.AccessKeyId, - secretAccessKey: data.SecretAccessKey, - ...data.SessionToken && { sessionToken: data.SessionToken }, - ...data.Expiration && { expiration: new Date(data.Expiration) } + value: attrStr, + index: i, + tagClosed }; - }; - exports2.getValidatedProcessCredentials = getValidatedProcessCredentials; - } -}); - -// ../../../node_modules/@aws-sdk/credential-provider-process/dist-cjs/resolveProcessCredentials.js -var require_resolveProcessCredentials = __commonJS({ - "../../../node_modules/@aws-sdk/credential-provider-process/dist-cjs/resolveProcessCredentials.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.resolveProcessCredentials = void 0; - var property_provider_1 = require_dist_cjs6(); - var child_process_1 = require("child_process"); - var util_1 = require("util"); - var getValidatedProcessCredentials_1 = require_getValidatedProcessCredentials(); - var resolveProcessCredentials = async (profileName, profiles) => { - const profile = profiles[profileName]; - if (profiles[profileName]) { - const credentialProcess = profile["credential_process"]; - if (credentialProcess !== void 0) { - const execPromise = (0, util_1.promisify)(child_process_1.exec); - try { - const { stdout } = await execPromise(credentialProcess); - let data; - try { - data = JSON.parse(stdout.trim()); - } catch (_a) { - throw Error(`Profile ${profileName} credential_process returned invalid JSON.`); - } - return (0, getValidatedProcessCredentials_1.getValidatedProcessCredentials)(profileName, data); - } catch (error) { - throw new property_provider_1.CredentialsProviderError(error.message); - } + } + var validAttrStrRegxp = new RegExp(`(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['"])(([\\s\\S])*?)\\5)?`, "g"); + function validateAttributeString(attrStr, options) { + const matches = util.getAllMatches(attrStr, validAttrStrRegxp); + const attrNames = {}; + for (let i = 0; i < matches.length; i++) { + if (matches[i][1].length === 0) { + return getErrorObject("InvalidAttr", "Attribute '" + matches[i][2] + "' has no space in starting.", getPositionFromMatch(matches[i])); + } else if (matches[i][3] !== void 0 && matches[i][4] === void 0) { + return getErrorObject("InvalidAttr", "Attribute '" + matches[i][2] + "' is without value.", getPositionFromMatch(matches[i])); + } else if (matches[i][3] === void 0 && !options.allowBooleanAttributes) { + return getErrorObject("InvalidAttr", "boolean attribute '" + matches[i][2] + "' is not allowed.", getPositionFromMatch(matches[i])); + } + const attrName = matches[i][2]; + if (!validateAttrName(attrName)) { + return getErrorObject("InvalidAttr", "Attribute '" + attrName + "' is an invalid name.", getPositionFromMatch(matches[i])); + } + if (!attrNames.hasOwnProperty(attrName)) { + attrNames[attrName] = 1; } else { - throw new property_provider_1.CredentialsProviderError(`Profile ${profileName} did not contain credential_process.`); + return getErrorObject("InvalidAttr", "Attribute '" + attrName + "' is repeated.", getPositionFromMatch(matches[i])); } - } else { - throw new property_provider_1.CredentialsProviderError(`Profile ${profileName} could not be found in shared credentials file.`); } - }; - exports2.resolveProcessCredentials = resolveProcessCredentials; - } -}); - -// ../../../node_modules/@aws-sdk/credential-provider-process/dist-cjs/fromProcess.js -var require_fromProcess = __commonJS({ - "../../../node_modules/@aws-sdk/credential-provider-process/dist-cjs/fromProcess.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.fromProcess = void 0; - var shared_ini_file_loader_1 = require_dist_cjs21(); - var resolveProcessCredentials_1 = require_resolveProcessCredentials(); - var fromProcess = (init = {}) => async () => { - const profiles = await (0, shared_ini_file_loader_1.parseKnownFiles)(init); - return (0, resolveProcessCredentials_1.resolveProcessCredentials)((0, shared_ini_file_loader_1.getProfileName)(init), profiles); - }; - exports2.fromProcess = fromProcess; - } -}); - -// ../../../node_modules/@aws-sdk/credential-provider-process/dist-cjs/index.js -var require_dist_cjs39 = __commonJS({ - "../../../node_modules/@aws-sdk/credential-provider-process/dist-cjs/index.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports)); - tslib_1.__exportStar(require_fromProcess(), exports2); - } -}); - -// ../../../node_modules/@aws-sdk/credential-provider-ini/dist-cjs/resolveProcessCredentials.js -var require_resolveProcessCredentials2 = __commonJS({ - "../../../node_modules/@aws-sdk/credential-provider-ini/dist-cjs/resolveProcessCredentials.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.resolveProcessCredentials = exports2.isProcessProfile = void 0; - var credential_provider_process_1 = require_dist_cjs39(); - var isProcessProfile = (arg) => Boolean(arg) && typeof arg === "object" && typeof arg.credential_process === "string"; - exports2.isProcessProfile = isProcessProfile; - var resolveProcessCredentials = async (options, profile) => (0, credential_provider_process_1.fromProcess)({ - ...options, - profile - })(); - exports2.resolveProcessCredentials = resolveProcessCredentials; - } -}); - -// ../../../node_modules/@aws-sdk/credential-provider-sso/dist-cjs/isSsoProfile.js -var require_isSsoProfile = __commonJS({ - "../../../node_modules/@aws-sdk/credential-provider-sso/dist-cjs/isSsoProfile.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.isSsoProfile = void 0; - var isSsoProfile = (arg) => arg && (typeof arg.sso_start_url === "string" || typeof arg.sso_account_id === "string" || typeof arg.sso_session === "string" || typeof arg.sso_region === "string" || typeof arg.sso_role_name === "string"); - exports2.isSsoProfile = isSsoProfile; - } -}); - -// ../../../node_modules/@aws-sdk/client-sso/dist-cjs/endpoint/EndpointParameters.js -var require_EndpointParameters3 = __commonJS({ - "../../../node_modules/@aws-sdk/client-sso/dist-cjs/endpoint/EndpointParameters.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.resolveClientEndpointParameters = void 0; - var resolveClientEndpointParameters = (options) => { + return true; + } + function validateNumberAmpersand(xmlData, i) { + let re = /\d/; + if (xmlData[i] === "x") { + i++; + re = /[\da-fA-F]/; + } + for (; i < xmlData.length; i++) { + if (xmlData[i] === ";") + return i; + if (!xmlData[i].match(re)) + break; + } + return -1; + } + function validateAmpersand(xmlData, i) { + i++; + if (xmlData[i] === ";") + return -1; + if (xmlData[i] === "#") { + i++; + return validateNumberAmpersand(xmlData, i); + } + let count = 0; + for (; i < xmlData.length; i++, count++) { + if (xmlData[i].match(/\w/) && count < 20) + continue; + if (xmlData[i] === ";") + break; + return -1; + } + return i; + } + function getErrorObject(code, message, lineNumber) { return { - ...options, - useDualstackEndpoint: options.useDualstackEndpoint ?? false, - useFipsEndpoint: options.useFipsEndpoint ?? false, - defaultSigningName: "awsssoportal" + err: { + code, + msg: message, + line: lineNumber.line || lineNumber, + col: lineNumber.col + } }; - }; - exports2.resolveClientEndpointParameters = resolveClientEndpointParameters; + } + function validateAttrName(attrName) { + return util.isName(attrName); + } + function validateTagName(tagname) { + return util.isName(tagname); + } + function getLineNumberForPosition(xmlData, index) { + const lines = xmlData.substring(0, index).split(/\r?\n/); + return { + line: lines.length, + // column number is last line's length + 1, because column numbering starts at 1: + col: lines[lines.length - 1].length + 1 + }; + } + function getPositionFromMatch(match) { + return match.startIndex + match[1].length; + } } }); -// ../../../node_modules/@aws-sdk/client-sso/package.json -var require_package3 = __commonJS({ - "../../../node_modules/@aws-sdk/client-sso/package.json"(exports2, module2) { - module2.exports = { - name: "@aws-sdk/client-sso", - description: "AWS SDK for JavaScript Sso Client for Node.js, Browser and React Native", - version: "3.421.0", - scripts: { - build: "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'", - "build:cjs": "tsc -p tsconfig.cjs.json", - "build:docs": "typedoc", - "build:es": "tsc -p tsconfig.es.json", - "build:include:deps": "lerna run --scope $npm_package_name --include-dependencies build", - "build:types": "tsc -p tsconfig.types.json", - "build:types:downlevel": "downlevel-dts dist-types dist-types/ts3.4", - clean: "rimraf ./dist-* && rimraf *.tsbuildinfo", - "extract:docs": "api-extractor run --local", - "generate:client": "node ../../scripts/generate-clients/single-service --solo sso" - }, - main: "./dist-cjs/index.js", - types: "./dist-types/index.d.ts", - module: "./dist-es/index.js", - sideEffects: false, - dependencies: { - "@aws-crypto/sha256-browser": "3.0.0", - "@aws-crypto/sha256-js": "3.0.0", - "@aws-sdk/middleware-host-header": "3.418.0", - "@aws-sdk/middleware-logger": "3.418.0", - "@aws-sdk/middleware-recursion-detection": "3.418.0", - "@aws-sdk/middleware-user-agent": "3.418.0", - "@aws-sdk/region-config-resolver": "3.418.0", - "@aws-sdk/types": "3.418.0", - "@aws-sdk/util-endpoints": "3.418.0", - "@aws-sdk/util-user-agent-browser": "3.418.0", - "@aws-sdk/util-user-agent-node": "3.418.0", - "@smithy/config-resolver": "^2.0.10", - "@smithy/fetch-http-handler": "^2.1.5", - "@smithy/hash-node": "^2.0.9", - "@smithy/invalid-dependency": "^2.0.9", - "@smithy/middleware-content-length": "^2.0.11", - "@smithy/middleware-endpoint": "^2.0.9", - "@smithy/middleware-retry": "^2.0.12", - "@smithy/middleware-serde": "^2.0.9", - "@smithy/middleware-stack": "^2.0.2", - "@smithy/node-config-provider": "^2.0.12", - "@smithy/node-http-handler": "^2.1.5", - "@smithy/protocol-http": "^3.0.5", - "@smithy/smithy-client": "^2.1.6", - "@smithy/types": "^2.3.3", - "@smithy/url-parser": "^2.0.9", - "@smithy/util-base64": "^2.0.0", - "@smithy/util-body-length-browser": "^2.0.0", - "@smithy/util-body-length-node": "^2.1.0", - "@smithy/util-defaults-mode-browser": "^2.0.10", - "@smithy/util-defaults-mode-node": "^2.0.12", - "@smithy/util-retry": "^2.0.2", - "@smithy/util-utf8": "^2.0.0", - tslib: "^2.5.0" - }, - devDependencies: { - "@smithy/service-client-documentation-generator": "^2.0.0", - "@tsconfig/node14": "1.0.3", - "@types/node": "^14.14.31", - concurrently: "7.0.0", - "downlevel-dts": "0.10.1", - rimraf: "3.0.2", - typedoc: "0.23.23", - typescript: "~4.9.5" - }, - engines: { - node: ">=14.0.0" - }, - typesVersions: { - "<4.0": { - "dist-types/*": [ - "dist-types/ts3.4/*" - ] - } - }, - files: [ - "dist-*/**" - ], - author: { - name: "AWS SDK for JavaScript Team", - url: "https://aws.amazon.com/javascript/" +// ../../../node_modules/fast-xml-parser/src/xmlparser/OptionsBuilder.js +var require_OptionsBuilder = __commonJS({ + "../../../node_modules/fast-xml-parser/src/xmlparser/OptionsBuilder.js"(exports2) { + var defaultOptions = { + preserveOrder: false, + attributeNamePrefix: "@_", + attributesGroupName: false, + textNodeName: "#text", + ignoreAttributes: true, + removeNSPrefix: false, + // remove NS from tag name or attribute name if true + allowBooleanAttributes: false, + //a tag can have attributes without any value + //ignoreRootElement : false, + parseTagValue: true, + parseAttributeValue: false, + trimValues: true, + //Trim string values of tag and attributes + cdataPropName: false, + numberParseOptions: { + hex: true, + leadingZeros: true, + eNotation: true }, - license: "Apache-2.0", - browser: { - "./dist-es/runtimeConfig": "./dist-es/runtimeConfig.browser" + tagValueProcessor: function(tagName, val2) { + return val2; }, - "react-native": { - "./dist-es/runtimeConfig": "./dist-es/runtimeConfig.native" + attributeValueProcessor: function(attrName, val2) { + return val2; }, - homepage: "https://github.com/aws/aws-sdk-js-v3/tree/main/clients/client-sso", - repository: { - type: "git", - url: "https://github.com/aws/aws-sdk-js-v3.git", - directory: "clients/client-sso" + stopNodes: [], + //nested tags will not be parsed even for errors + alwaysCreateTextNode: false, + isArray: () => false, + commentPropName: false, + unpairedTags: [], + processEntities: true, + htmlEntities: false, + ignoreDeclaration: false, + ignorePiTags: false, + transformTagName: false, + transformAttributeName: false, + updateTag: function(tagName, jPath, attrs) { + return tagName; } + // skipEmptyListItem: false }; - } -}); - -// ../../../node_modules/@aws-sdk/util-user-agent-node/dist-cjs/is-crt-available.js -var require_is_crt_available = __commonJS({ - "../../../node_modules/@aws-sdk/util-user-agent-node/dist-cjs/is-crt-available.js"(exports2, module2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.isCrtAvailable = void 0; - var isCrtAvailable = () => { - try { - if (typeof require === "function" && typeof module2 !== "undefined" && require("aws-crt")) { - return ["md/crt-avail"]; - } - return null; - } catch (e) { - return null; - } + var buildOptions = function(options) { + return Object.assign({}, defaultOptions, options); }; - exports2.isCrtAvailable = isCrtAvailable; + exports2.buildOptions = buildOptions; + exports2.defaultOptions = defaultOptions; } }); -// ../../../node_modules/@aws-sdk/util-user-agent-node/dist-cjs/index.js -var require_dist_cjs40 = __commonJS({ - "../../../node_modules/@aws-sdk/util-user-agent-node/dist-cjs/index.js"(exports2) { +// ../../../node_modules/fast-xml-parser/src/xmlparser/xmlNode.js +var require_xmlNode = __commonJS({ + "../../../node_modules/fast-xml-parser/src/xmlparser/xmlNode.js"(exports2, module2) { "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.defaultUserAgent = exports2.UA_APP_ID_INI_NAME = exports2.UA_APP_ID_ENV_NAME = void 0; - var node_config_provider_1 = require_dist_cjs22(); - var os_1 = require("os"); - var process_1 = require("process"); - var is_crt_available_1 = require_is_crt_available(); - exports2.UA_APP_ID_ENV_NAME = "AWS_SDK_UA_APP_ID"; - exports2.UA_APP_ID_INI_NAME = "sdk-ua-app-id"; - var defaultUserAgent = ({ serviceId, clientVersion }) => { - const sections = [ - ["aws-sdk-js", clientVersion], - ["ua", "2.0"], - [`os/${(0, os_1.platform)()}`, (0, os_1.release)()], - ["lang/js"], - ["md/nodejs", `${process_1.versions.node}`] - ]; - const crtAvailable = (0, is_crt_available_1.isCrtAvailable)(); - if (crtAvailable) { - sections.push(crtAvailable); - } - if (serviceId) { - sections.push([`api/${serviceId}`, clientVersion]); + var XmlNode = class { + constructor(tagname) { + this.tagname = tagname; + this.child = []; + this[":@"] = {}; } - if (process_1.env.AWS_EXECUTION_ENV) { - sections.push([`exec-env/${process_1.env.AWS_EXECUTION_ENV}`]); + add(key, val2) { + if (key === "__proto__") key = "#__proto__"; + this.child.push({ [key]: val2 }); } - const appIdPromise = (0, node_config_provider_1.loadConfig)({ - environmentVariableSelector: (env) => env[exports2.UA_APP_ID_ENV_NAME], - configFileSelector: (profile) => profile[exports2.UA_APP_ID_INI_NAME], - default: void 0 - })(); - let resolvedUserAgent = void 0; - return async () => { - if (!resolvedUserAgent) { - const appId = await appIdPromise; - resolvedUserAgent = appId ? [...sections, [`app/${appId}`]] : [...sections]; + addChild(node) { + if (node.tagname === "__proto__") node.tagname = "#__proto__"; + if (node[":@"] && Object.keys(node[":@"]).length > 0) { + this.child.push({ [node.tagname]: node.child, [":@"]: node[":@"] }); + } else { + this.child.push({ [node.tagname]: node.child }); } - return resolvedUserAgent; - }; + } }; - exports2.defaultUserAgent = defaultUserAgent; + module2.exports = XmlNode; } }); -// ../../../node_modules/@smithy/hash-node/dist-cjs/index.js -var require_dist_cjs41 = __commonJS({ - "../../../node_modules/@smithy/hash-node/dist-cjs/index.js"(exports2, module2) { - var __defProp2 = Object.defineProperty; - var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; - var __getOwnPropNames2 = Object.getOwnPropertyNames; - var __hasOwnProp2 = Object.prototype.hasOwnProperty; - var __name = (target, value) => __defProp2(target, "name", { value, configurable: true }); - var __export2 = (target, all) => { - for (var name in all) - __defProp2(target, name, { get: all[name], enumerable: true }); - }; - var __copyProps2 = (to, from, except, desc) => { - if (from && typeof from === "object" || typeof from === "function") { - for (let key of __getOwnPropNames2(from)) - if (!__hasOwnProp2.call(to, key) && key !== except) - __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable }); - } - return to; - }; - var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); - var src_exports = {}; - __export2(src_exports, { - Hash: () => Hash - }); - module2.exports = __toCommonJS2(src_exports); - var import_util_buffer_from = require_dist_cjs9(); - var import_util_utf8 = require_dist_cjs10(); - var import_buffer = require("buffer"); - var import_crypto5 = require("crypto"); - var _Hash = class _Hash { - constructor(algorithmIdentifier, secret) { - this.algorithmIdentifier = algorithmIdentifier; - this.secret = secret; - this.reset(); - } - update(toHash, encoding) { - this.hash.update((0, import_util_utf8.toUint8Array)(castSourceData(toHash, encoding))); +// ../../../node_modules/fast-xml-parser/src/xmlparser/DocTypeReader.js +var require_DocTypeReader = __commonJS({ + "../../../node_modules/fast-xml-parser/src/xmlparser/DocTypeReader.js"(exports2, module2) { + var util = require_util(); + function readDocType(xmlData, i) { + const entities = {}; + if (xmlData[i + 3] === "O" && xmlData[i + 4] === "C" && xmlData[i + 5] === "T" && xmlData[i + 6] === "Y" && xmlData[i + 7] === "P" && xmlData[i + 8] === "E") { + i = i + 9; + let angleBracketsCount = 1; + let hasBody = false, comment = false; + let exp = ""; + for (; i < xmlData.length; i++) { + if (xmlData[i] === "<" && !comment) { + if (hasBody && isEntity(xmlData, i)) { + i += 7; + [entityName, val, i] = readEntityExp(xmlData, i + 1); + if (val.indexOf("&") === -1) + entities[validateEntityName(entityName)] = { + regx: RegExp(`&${entityName};`, "g"), + val + }; + } else if (hasBody && isElement(xmlData, i)) i += 8; + else if (hasBody && isAttlist(xmlData, i)) i += 8; + else if (hasBody && isNotation(xmlData, i)) i += 9; + else if (isComment) comment = true; + else throw new Error("Invalid DOCTYPE"); + angleBracketsCount++; + exp = ""; + } else if (xmlData[i] === ">") { + if (comment) { + if (xmlData[i - 1] === "-" && xmlData[i - 2] === "-") { + comment = false; + angleBracketsCount--; + } + } else { + angleBracketsCount--; + } + if (angleBracketsCount === 0) { + break; + } + } else if (xmlData[i] === "[") { + hasBody = true; + } else { + exp += xmlData[i]; + } + } + if (angleBracketsCount !== 0) { + throw new Error(`Unclosed DOCTYPE`); + } + } else { + throw new Error(`Invalid Tag instead of DOCTYPE`); } - digest() { - return Promise.resolve(this.hash.digest()); + return { entities, i }; + } + function readEntityExp(xmlData, i) { + let entityName2 = ""; + for (; i < xmlData.length && (xmlData[i] !== "'" && xmlData[i] !== '"'); i++) { + entityName2 += xmlData[i]; } - reset() { - this.hash = this.secret ? (0, import_crypto5.createHmac)(this.algorithmIdentifier, castSourceData(this.secret)) : (0, import_crypto5.createHash)(this.algorithmIdentifier); + entityName2 = entityName2.trim(); + if (entityName2.indexOf(" ") !== -1) throw new Error("External entites are not supported"); + const startChar = xmlData[i++]; + let val2 = ""; + for (; i < xmlData.length && xmlData[i] !== startChar; i++) { + val2 += xmlData[i]; } + return [entityName2, val2, i]; + } + function isComment(xmlData, i) { + if (xmlData[i + 1] === "!" && xmlData[i + 2] === "-" && xmlData[i + 3] === "-") return true; + return false; + } + function isEntity(xmlData, i) { + if (xmlData[i + 1] === "!" && xmlData[i + 2] === "E" && xmlData[i + 3] === "N" && xmlData[i + 4] === "T" && xmlData[i + 5] === "I" && xmlData[i + 6] === "T" && xmlData[i + 7] === "Y") return true; + return false; + } + function isElement(xmlData, i) { + if (xmlData[i + 1] === "!" && xmlData[i + 2] === "E" && xmlData[i + 3] === "L" && xmlData[i + 4] === "E" && xmlData[i + 5] === "M" && xmlData[i + 6] === "E" && xmlData[i + 7] === "N" && xmlData[i + 8] === "T") return true; + return false; + } + function isAttlist(xmlData, i) { + if (xmlData[i + 1] === "!" && xmlData[i + 2] === "A" && xmlData[i + 3] === "T" && xmlData[i + 4] === "T" && xmlData[i + 5] === "L" && xmlData[i + 6] === "I" && xmlData[i + 7] === "S" && xmlData[i + 8] === "T") return true; + return false; + } + function isNotation(xmlData, i) { + if (xmlData[i + 1] === "!" && xmlData[i + 2] === "N" && xmlData[i + 3] === "O" && xmlData[i + 4] === "T" && xmlData[i + 5] === "A" && xmlData[i + 6] === "T" && xmlData[i + 7] === "I" && xmlData[i + 8] === "O" && xmlData[i + 9] === "N") return true; + return false; + } + function validateEntityName(name) { + if (util.isName(name)) + return name; + else + throw new Error(`Invalid entity name ${name}`); + } + module2.exports = readDocType; + } +}); + +// ../../../node_modules/strnum/strnum.js +var require_strnum = __commonJS({ + "../../../node_modules/strnum/strnum.js"(exports2, module2) { + var hexRegex = /^[-+]?0x[a-fA-F0-9]+$/; + var numRegex = /^([\-\+])?(0*)(\.[0-9]+([eE]\-?[0-9]+)?|[0-9]+(\.[0-9]+([eE]\-?[0-9]+)?)?)$/; + if (!Number.parseInt && window.parseInt) { + Number.parseInt = window.parseInt; + } + if (!Number.parseFloat && window.parseFloat) { + Number.parseFloat = window.parseFloat; + } + var consider = { + hex: true, + leadingZeros: true, + decimalPoint: ".", + eNotation: true + //skipLike: /regex/ }; - __name(_Hash, "Hash"); - var Hash = _Hash; - function castSourceData(toCast, encoding) { - if (import_buffer.Buffer.isBuffer(toCast)) { - return toCast; - } - if (typeof toCast === "string") { - return (0, import_util_buffer_from.fromString)(toCast, encoding); + function toNumber(str, options = {}) { + options = Object.assign({}, consider, options); + if (!str || typeof str !== "string") return str; + let trimmedStr = str.trim(); + if (options.skipLike !== void 0 && options.skipLike.test(trimmedStr)) return str; + else if (options.hex && hexRegex.test(trimmedStr)) { + return Number.parseInt(trimmedStr, 16); + } else { + const match = numRegex.exec(trimmedStr); + if (match) { + const sign = match[1]; + const leadingZeros = match[2]; + let numTrimmedByZeros = trimZeros(match[3]); + const eNotation = match[4] || match[6]; + if (!options.leadingZeros && leadingZeros.length > 0 && sign && trimmedStr[2] !== ".") return str; + else if (!options.leadingZeros && leadingZeros.length > 0 && !sign && trimmedStr[1] !== ".") return str; + else { + const num = Number(trimmedStr); + const numStr = "" + num; + if (numStr.search(/[eE]/) !== -1) { + if (options.eNotation) return num; + else return str; + } else if (eNotation) { + if (options.eNotation) return num; + else return str; + } else if (trimmedStr.indexOf(".") !== -1) { + if (numStr === "0" && numTrimmedByZeros === "") return num; + else if (numStr === numTrimmedByZeros) return num; + else if (sign && numStr === "-" + numTrimmedByZeros) return num; + else return str; + } + if (leadingZeros) { + if (numTrimmedByZeros === numStr) return num; + else if (sign + numTrimmedByZeros === numStr) return num; + else return str; + } + if (trimmedStr === numStr) return num; + else if (trimmedStr === sign + numStr) return num; + return str; + } + } else { + return str; + } } - if (ArrayBuffer.isView(toCast)) { - return (0, import_util_buffer_from.fromArrayBuffer)(toCast.buffer, toCast.byteOffset, toCast.byteLength); + } + function trimZeros(numStr) { + if (numStr && numStr.indexOf(".") !== -1) { + numStr = numStr.replace(/0+$/, ""); + if (numStr === ".") numStr = "0"; + else if (numStr[0] === ".") numStr = "0" + numStr; + else if (numStr[numStr.length - 1] === ".") numStr = numStr.substr(0, numStr.length - 1); + return numStr; } - return (0, import_util_buffer_from.fromArrayBuffer)(toCast); + return numStr; } - __name(castSourceData, "castSourceData"); + module2.exports = toNumber; } }); -// ../../../node_modules/@smithy/util-body-length-node/dist-cjs/index.js -var require_dist_cjs42 = __commonJS({ - "../../../node_modules/@smithy/util-body-length-node/dist-cjs/index.js"(exports2, module2) { - var __defProp2 = Object.defineProperty; - var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; - var __getOwnPropNames2 = Object.getOwnPropertyNames; - var __hasOwnProp2 = Object.prototype.hasOwnProperty; - var __name = (target, value) => __defProp2(target, "name", { value, configurable: true }); - var __export2 = (target, all) => { - for (var name in all) - __defProp2(target, name, { get: all[name], enumerable: true }); - }; - var __copyProps2 = (to, from, except, desc) => { - if (from && typeof from === "object" || typeof from === "function") { - for (let key of __getOwnPropNames2(from)) - if (!__hasOwnProp2.call(to, key) && key !== except) - __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable }); +// ../../../node_modules/fast-xml-parser/src/xmlparser/OrderedObjParser.js +var require_OrderedObjParser = __commonJS({ + "../../../node_modules/fast-xml-parser/src/xmlparser/OrderedObjParser.js"(exports2, module2) { + "use strict"; + var util = require_util(); + var xmlNode = require_xmlNode(); + var readDocType = require_DocTypeReader(); + var toNumber = require_strnum(); + var OrderedObjParser = class { + constructor(options) { + this.options = options; + this.currentNode = null; + this.tagsNodeStack = []; + this.docTypeEntities = {}; + this.lastEntities = { + "apos": { regex: /&(apos|#39|#x27);/g, val: "'" }, + "gt": { regex: /&(gt|#62|#x3E);/g, val: ">" }, + "lt": { regex: /&(lt|#60|#x3C);/g, val: "<" }, + "quot": { regex: /&(quot|#34|#x22);/g, val: '"' } + }; + this.ampEntity = { regex: /&(amp|#38|#x26);/g, val: "&" }; + this.htmlEntities = { + "space": { regex: /&(nbsp|#160);/g, val: " " }, + // "lt" : { regex: /&(lt|#60);/g, val: "<" }, + // "gt" : { regex: /&(gt|#62);/g, val: ">" }, + // "amp" : { regex: /&(amp|#38);/g, val: "&" }, + // "quot" : { regex: /&(quot|#34);/g, val: "\"" }, + // "apos" : { regex: /&(apos|#39);/g, val: "'" }, + "cent": { regex: /&(cent|#162);/g, val: "\xA2" }, + "pound": { regex: /&(pound|#163);/g, val: "\xA3" }, + "yen": { regex: /&(yen|#165);/g, val: "\xA5" }, + "euro": { regex: /&(euro|#8364);/g, val: "\u20AC" }, + "copyright": { regex: /&(copy|#169);/g, val: "\xA9" }, + "reg": { regex: /&(reg|#174);/g, val: "\xAE" }, + "inr": { regex: /&(inr|#8377);/g, val: "\u20B9" }, + "num_dec": { regex: /&#([0-9]{1,7});/g, val: (_, str) => String.fromCharCode(Number.parseInt(str, 10)) }, + "num_hex": { regex: /&#x([0-9a-fA-F]{1,6});/g, val: (_, str) => String.fromCharCode(Number.parseInt(str, 16)) } + }; + this.addExternalEntities = addExternalEntities; + this.parseXml = parseXml; + this.parseTextData = parseTextData; + this.resolveNameSpace = resolveNameSpace; + this.buildAttributesMap = buildAttributesMap; + this.isItStopNode = isItStopNode; + this.replaceEntitiesValue = replaceEntitiesValue; + this.readStopNodeData = readStopNodeData; + this.saveTextToParentTag = saveTextToParentTag; + this.addChild = addChild; } - return to; }; - var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); - var src_exports = {}; - __export2(src_exports, { - calculateBodyLength: () => calculateBodyLength - }); - module2.exports = __toCommonJS2(src_exports); - var import_fs = require("fs"); - var calculateBodyLength = /* @__PURE__ */ __name((body) => { - if (!body) { - return 0; + function addExternalEntities(externalEntities) { + const entKeys = Object.keys(externalEntities); + for (let i = 0; i < entKeys.length; i++) { + const ent = entKeys[i]; + this.lastEntities[ent] = { + regex: new RegExp("&" + ent + ";", "g"), + val: externalEntities[ent] + }; + } + } + function parseTextData(val2, tagName, jPath, dontTrim, hasAttributes, isLeafNode, escapeEntities) { + if (val2 !== void 0) { + if (this.options.trimValues && !dontTrim) { + val2 = val2.trim(); + } + if (val2.length > 0) { + if (!escapeEntities) val2 = this.replaceEntitiesValue(val2); + const newval = this.options.tagValueProcessor(tagName, val2, jPath, hasAttributes, isLeafNode); + if (newval === null || newval === void 0) { + return val2; + } else if (typeof newval !== typeof val2 || newval !== val2) { + return newval; + } else if (this.options.trimValues) { + return parseValue(val2, this.options.parseTagValue, this.options.numberParseOptions); + } else { + const trimmedVal = val2.trim(); + if (trimmedVal === val2) { + return parseValue(val2, this.options.parseTagValue, this.options.numberParseOptions); + } else { + return val2; + } + } + } } - if (typeof body === "string") { - return Buffer.byteLength(body); - } else if (typeof body.byteLength === "number") { - return body.byteLength; - } else if (typeof body.size === "number") { - return body.size; - } else if (typeof body.start === "number" && typeof body.end === "number") { - return body.end + 1 - body.start; - } else if (typeof body.path === "string" || Buffer.isBuffer(body.path)) { - return (0, import_fs.lstatSync)(body.path).size; - } else if (typeof body.fd === "number") { - return (0, import_fs.fstatSync)(body.fd).size; + } + function resolveNameSpace(tagname) { + if (this.options.removeNSPrefix) { + const tags = tagname.split(":"); + const prefix = tagname.charAt(0) === "/" ? "/" : ""; + if (tags[0] === "xmlns") { + return ""; + } + if (tags.length === 2) { + tagname = prefix + tags[1]; + } } - throw new Error(`Body Length computation failed for ${body}`); - }, "calculateBodyLength"); - } -}); - -// ../../../node_modules/@aws-sdk/client-sso/dist-cjs/endpoint/ruleset.js -var require_ruleset = __commonJS({ - "../../../node_modules/@aws-sdk/client-sso/dist-cjs/endpoint/ruleset.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.ruleSet = void 0; - var q = "required"; - var r = "fn"; - var s = "argv"; - var t = "ref"; - var a = "isSet"; - var b = "tree"; - var c = "error"; - var d = "endpoint"; - var e = "PartitionResult"; - var f = { [q]: false, "type": "String" }; - var g = { [q]: true, "default": false, "type": "Boolean" }; - var h = { [t]: "Endpoint" }; - var i = { [r]: "booleanEquals", [s]: [{ [t]: "UseFIPS" }, true] }; - var j = { [r]: "booleanEquals", [s]: [{ [t]: "UseDualStack" }, true] }; - var k = {}; - var l = { [r]: "booleanEquals", [s]: [true, { [r]: "getAttr", [s]: [{ [t]: e }, "supportsFIPS"] }] }; - var m = { [r]: "booleanEquals", [s]: [true, { [r]: "getAttr", [s]: [{ [t]: e }, "supportsDualStack"] }] }; - var n = [i]; - var o = [j]; - var p = [{ [t]: "Region" }]; - var _data = { version: "1.0", parameters: { Region: f, UseDualStack: g, UseFIPS: g, Endpoint: f }, rules: [{ conditions: [{ [r]: a, [s]: [h] }], type: b, rules: [{ conditions: n, error: "Invalid Configuration: FIPS and custom endpoint are not supported", type: c }, { conditions: o, error: "Invalid Configuration: Dualstack and custom endpoint are not supported", type: c }, { endpoint: { url: h, properties: k, headers: k }, type: d }] }, { conditions: [{ [r]: a, [s]: p }], type: b, rules: [{ conditions: [{ [r]: "aws.partition", [s]: p, assign: e }], type: b, rules: [{ conditions: [i, j], type: b, rules: [{ conditions: [l, m], type: b, rules: [{ endpoint: { url: "https://portal.sso-fips.{Region}.{PartitionResult#dualStackDnsSuffix}", properties: k, headers: k }, type: d }] }, { error: "FIPS and DualStack are enabled, but this partition does not support one or both", type: c }] }, { conditions: n, type: b, rules: [{ conditions: [l], type: b, rules: [{ endpoint: { url: "https://portal.sso-fips.{Region}.{PartitionResult#dnsSuffix}", properties: k, headers: k }, type: d }] }, { error: "FIPS is enabled but this partition does not support FIPS", type: c }] }, { conditions: o, type: b, rules: [{ conditions: [m], type: b, rules: [{ endpoint: { url: "https://portal.sso.{Region}.{PartitionResult#dualStackDnsSuffix}", properties: k, headers: k }, type: d }] }, { error: "DualStack is enabled but this partition does not support DualStack", type: c }] }, { endpoint: { url: "https://portal.sso.{Region}.{PartitionResult#dnsSuffix}", properties: k, headers: k }, type: d }] }] }, { error: "Invalid Configuration: Missing Region", type: c }] }; - exports2.ruleSet = _data; - } -}); - -// ../../../node_modules/@aws-sdk/client-sso/dist-cjs/endpoint/endpointResolver.js -var require_endpointResolver = __commonJS({ - "../../../node_modules/@aws-sdk/client-sso/dist-cjs/endpoint/endpointResolver.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.defaultEndpointResolver = void 0; - var util_endpoints_1 = require_dist_cjs16(); - var ruleset_1 = require_ruleset(); - var defaultEndpointResolver = (endpointParams, context = {}) => { - return (0, util_endpoints_1.resolveEndpoint)(ruleset_1.ruleSet, { - endpointParams, - logger: context.logger - }); - }; - exports2.defaultEndpointResolver = defaultEndpointResolver; - } -}); - -// ../../../node_modules/@aws-sdk/client-sso/dist-cjs/runtimeConfig.shared.js -var require_runtimeConfig_shared = __commonJS({ - "../../../node_modules/@aws-sdk/client-sso/dist-cjs/runtimeConfig.shared.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.getRuntimeConfig = void 0; - var smithy_client_1 = require_dist_cjs34(); - var url_parser_1 = require_dist_cjs24(); - var util_base64_1 = require_dist_cjs30(); - var util_utf8_1 = require_dist_cjs10(); - var endpointResolver_1 = require_endpointResolver(); - var getRuntimeConfig = (config) => ({ - apiVersion: "2019-06-10", - base64Decoder: config?.base64Decoder ?? util_base64_1.fromBase64, - base64Encoder: config?.base64Encoder ?? util_base64_1.toBase64, - disableHostPrefix: config?.disableHostPrefix ?? false, - endpointProvider: config?.endpointProvider ?? endpointResolver_1.defaultEndpointResolver, - extensions: config?.extensions ?? [], - logger: config?.logger ?? new smithy_client_1.NoOpLogger(), - serviceId: config?.serviceId ?? "SSO", - urlParser: config?.urlParser ?? url_parser_1.parseUrl, - utf8Decoder: config?.utf8Decoder ?? util_utf8_1.fromUtf8, - utf8Encoder: config?.utf8Encoder ?? util_utf8_1.toUtf8 - }); - exports2.getRuntimeConfig = getRuntimeConfig; - } -}); - -// ../../../node_modules/@smithy/util-defaults-mode-node/dist-cjs/index.js -var require_dist_cjs43 = __commonJS({ - "../../../node_modules/@smithy/util-defaults-mode-node/dist-cjs/index.js"(exports2, module2) { - var __create2 = Object.create; - var __defProp2 = Object.defineProperty; - var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; - var __getOwnPropNames2 = Object.getOwnPropertyNames; - var __getProtoOf2 = Object.getPrototypeOf; - var __hasOwnProp2 = Object.prototype.hasOwnProperty; - var __name = (target, value) => __defProp2(target, "name", { value, configurable: true }); - var __export2 = (target, all) => { - for (var name in all) - __defProp2(target, name, { get: all[name], enumerable: true }); - }; - var __copyProps2 = (to, from, except, desc) => { - if (from && typeof from === "object" || typeof from === "function") { - for (let key of __getOwnPropNames2(from)) - if (!__hasOwnProp2.call(to, key) && key !== except) - __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable }); + return tagname; + } + var attrsRegx = new RegExp(`([^\\s=]+)\\s*(=\\s*(['"])([\\s\\S]*?)\\3)?`, "gm"); + function buildAttributesMap(attrStr, jPath, tagName) { + if (!this.options.ignoreAttributes && typeof attrStr === "string") { + const matches = util.getAllMatches(attrStr, attrsRegx); + const len = matches.length; + const attrs = {}; + for (let i = 0; i < len; i++) { + const attrName = this.resolveNameSpace(matches[i][1]); + let oldVal = matches[i][4]; + let aName = this.options.attributeNamePrefix + attrName; + if (attrName.length) { + if (this.options.transformAttributeName) { + aName = this.options.transformAttributeName(aName); + } + if (aName === "__proto__") aName = "#__proto__"; + if (oldVal !== void 0) { + if (this.options.trimValues) { + oldVal = oldVal.trim(); + } + oldVal = this.replaceEntitiesValue(oldVal); + const newVal = this.options.attributeValueProcessor(attrName, oldVal, jPath); + if (newVal === null || newVal === void 0) { + attrs[aName] = oldVal; + } else if (typeof newVal !== typeof oldVal || newVal !== oldVal) { + attrs[aName] = newVal; + } else { + attrs[aName] = parseValue( + oldVal, + this.options.parseAttributeValue, + this.options.numberParseOptions + ); + } + } else if (this.options.allowBooleanAttributes) { + attrs[aName] = true; + } + } + } + if (!Object.keys(attrs).length) { + return; + } + if (this.options.attributesGroupName) { + const attrCollection = {}; + attrCollection[this.options.attributesGroupName] = attrs; + return attrCollection; + } + return attrs; + } + } + var parseXml = function(xmlData) { + xmlData = xmlData.replace(/\r\n?/g, "\n"); + const xmlObj = new xmlNode("!xml"); + let currentNode = xmlObj; + let textData = ""; + let jPath = ""; + for (let i = 0; i < xmlData.length; i++) { + const ch = xmlData[i]; + if (ch === "<") { + if (xmlData[i + 1] === "/") { + const closeIndex = findClosingIndex(xmlData, ">", i, "Closing Tag is not closed."); + let tagName = xmlData.substring(i + 2, closeIndex).trim(); + if (this.options.removeNSPrefix) { + const colonIndex = tagName.indexOf(":"); + if (colonIndex !== -1) { + tagName = tagName.substr(colonIndex + 1); + } + } + if (this.options.transformTagName) { + tagName = this.options.transformTagName(tagName); + } + if (currentNode) { + textData = this.saveTextToParentTag(textData, currentNode, jPath); + } + const lastTagName = jPath.substring(jPath.lastIndexOf(".") + 1); + if (tagName && this.options.unpairedTags.indexOf(tagName) !== -1) { + throw new Error(`Unpaired tag can not be used as closing tag: `); + } + let propIndex = 0; + if (lastTagName && this.options.unpairedTags.indexOf(lastTagName) !== -1) { + propIndex = jPath.lastIndexOf(".", jPath.lastIndexOf(".") - 1); + this.tagsNodeStack.pop(); + } else { + propIndex = jPath.lastIndexOf("."); + } + jPath = jPath.substring(0, propIndex); + currentNode = this.tagsNodeStack.pop(); + textData = ""; + i = closeIndex; + } else if (xmlData[i + 1] === "?") { + let tagData = readTagExp(xmlData, i, false, "?>"); + if (!tagData) throw new Error("Pi Tag is not closed."); + textData = this.saveTextToParentTag(textData, currentNode, jPath); + if (this.options.ignoreDeclaration && tagData.tagName === "?xml" || this.options.ignorePiTags) { + } else { + const childNode = new xmlNode(tagData.tagName); + childNode.add(this.options.textNodeName, ""); + if (tagData.tagName !== tagData.tagExp && tagData.attrExpPresent) { + childNode[":@"] = this.buildAttributesMap(tagData.tagExp, jPath, tagData.tagName); + } + this.addChild(currentNode, childNode, jPath); + } + i = tagData.closeIndex + 1; + } else if (xmlData.substr(i + 1, 3) === "!--") { + const endIndex = findClosingIndex(xmlData, "-->", i + 4, "Comment is not closed."); + if (this.options.commentPropName) { + const comment = xmlData.substring(i + 4, endIndex - 2); + textData = this.saveTextToParentTag(textData, currentNode, jPath); + currentNode.add(this.options.commentPropName, [{ [this.options.textNodeName]: comment }]); + } + i = endIndex; + } else if (xmlData.substr(i + 1, 2) === "!D") { + const result = readDocType(xmlData, i); + this.docTypeEntities = result.entities; + i = result.i; + } else if (xmlData.substr(i + 1, 2) === "![") { + const closeIndex = findClosingIndex(xmlData, "]]>", i, "CDATA is not closed.") - 2; + const tagExp = xmlData.substring(i + 9, closeIndex); + textData = this.saveTextToParentTag(textData, currentNode, jPath); + let val2 = this.parseTextData(tagExp, currentNode.tagname, jPath, true, false, true, true); + if (val2 == void 0) val2 = ""; + if (this.options.cdataPropName) { + currentNode.add(this.options.cdataPropName, [{ [this.options.textNodeName]: tagExp }]); + } else { + currentNode.add(this.options.textNodeName, val2); + } + i = closeIndex + 2; + } else { + let result = readTagExp(xmlData, i, this.options.removeNSPrefix); + let tagName = result.tagName; + const rawTagName = result.rawTagName; + let tagExp = result.tagExp; + let attrExpPresent = result.attrExpPresent; + let closeIndex = result.closeIndex; + if (this.options.transformTagName) { + tagName = this.options.transformTagName(tagName); + } + if (currentNode && textData) { + if (currentNode.tagname !== "!xml") { + textData = this.saveTextToParentTag(textData, currentNode, jPath, false); + } + } + const lastTag = currentNode; + if (lastTag && this.options.unpairedTags.indexOf(lastTag.tagname) !== -1) { + currentNode = this.tagsNodeStack.pop(); + jPath = jPath.substring(0, jPath.lastIndexOf(".")); + } + if (tagName !== xmlObj.tagname) { + jPath += jPath ? "." + tagName : tagName; + } + if (this.isItStopNode(this.options.stopNodes, jPath, tagName)) { + let tagContent = ""; + if (tagExp.length > 0 && tagExp.lastIndexOf("/") === tagExp.length - 1) { + if (tagName[tagName.length - 1] === "/") { + tagName = tagName.substr(0, tagName.length - 1); + jPath = jPath.substr(0, jPath.length - 1); + tagExp = tagName; + } else { + tagExp = tagExp.substr(0, tagExp.length - 1); + } + i = result.closeIndex; + } else if (this.options.unpairedTags.indexOf(tagName) !== -1) { + i = result.closeIndex; + } else { + const result2 = this.readStopNodeData(xmlData, rawTagName, closeIndex + 1); + if (!result2) throw new Error(`Unexpected end of ${rawTagName}`); + i = result2.i; + tagContent = result2.tagContent; + } + const childNode = new xmlNode(tagName); + if (tagName !== tagExp && attrExpPresent) { + childNode[":@"] = this.buildAttributesMap(tagExp, jPath, tagName); + } + if (tagContent) { + tagContent = this.parseTextData(tagContent, tagName, jPath, true, attrExpPresent, true, true); + } + jPath = jPath.substr(0, jPath.lastIndexOf(".")); + childNode.add(this.options.textNodeName, tagContent); + this.addChild(currentNode, childNode, jPath); + } else { + if (tagExp.length > 0 && tagExp.lastIndexOf("/") === tagExp.length - 1) { + if (tagName[tagName.length - 1] === "/") { + tagName = tagName.substr(0, tagName.length - 1); + jPath = jPath.substr(0, jPath.length - 1); + tagExp = tagName; + } else { + tagExp = tagExp.substr(0, tagExp.length - 1); + } + if (this.options.transformTagName) { + tagName = this.options.transformTagName(tagName); + } + const childNode = new xmlNode(tagName); + if (tagName !== tagExp && attrExpPresent) { + childNode[":@"] = this.buildAttributesMap(tagExp, jPath, tagName); + } + this.addChild(currentNode, childNode, jPath); + jPath = jPath.substr(0, jPath.lastIndexOf(".")); + } else { + const childNode = new xmlNode(tagName); + this.tagsNodeStack.push(currentNode); + if (tagName !== tagExp && attrExpPresent) { + childNode[":@"] = this.buildAttributesMap(tagExp, jPath, tagName); + } + this.addChild(currentNode, childNode, jPath); + currentNode = childNode; + } + textData = ""; + i = closeIndex; + } + } + } else { + textData += xmlData[i]; + } } - return to; + return xmlObj.child; }; - var __toESM2 = (mod, isNodeMode, target) => (target = mod != null ? __create2(__getProtoOf2(mod)) : {}, __copyProps2( - // If the importer is in node compatibility mode or this is not an ESM - // file that has been converted to a CommonJS file using a Babel- - // compatible transform (i.e. "__esModule" has not been set), then set - // "default" to the CommonJS "module.exports" for node compatibility. - isNodeMode || !mod || !mod.__esModule ? __defProp2(target, "default", { value: mod, enumerable: true }) : target, - mod - )); - var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); - var src_exports = {}; - __export2(src_exports, { - resolveDefaultsModeConfig: () => resolveDefaultsModeConfig - }); - module2.exports = __toCommonJS2(src_exports); - var import_config_resolver = require_dist_cjs19(); - var import_node_config_provider = require_dist_cjs22(); - var import_property_provider = require_dist_cjs6(); - var AWS_EXECUTION_ENV = "AWS_EXECUTION_ENV"; - var AWS_REGION_ENV = "AWS_REGION"; - var AWS_DEFAULT_REGION_ENV = "AWS_DEFAULT_REGION"; - var ENV_IMDS_DISABLED = "AWS_EC2_METADATA_DISABLED"; - var DEFAULTS_MODE_OPTIONS = ["in-region", "cross-region", "mobile", "standard", "legacy"]; - var IMDS_REGION_PATH = "/latest/meta-data/placement/region"; - var AWS_DEFAULTS_MODE_ENV = "AWS_DEFAULTS_MODE"; - var AWS_DEFAULTS_MODE_CONFIG = "defaults_mode"; - var NODE_DEFAULTS_MODE_CONFIG_OPTIONS = { - environmentVariableSelector: (env) => { - return env[AWS_DEFAULTS_MODE_ENV]; - }, - configFileSelector: (profile) => { - return profile[AWS_DEFAULTS_MODE_CONFIG]; - }, - default: "legacy" + function addChild(currentNode, childNode, jPath) { + const result = this.options.updateTag(childNode.tagname, jPath, childNode[":@"]); + if (result === false) { + } else if (typeof result === "string") { + childNode.tagname = result; + currentNode.addChild(childNode); + } else { + currentNode.addChild(childNode); + } + } + var replaceEntitiesValue = function(val2) { + if (this.options.processEntities) { + for (let entityName2 in this.docTypeEntities) { + const entity = this.docTypeEntities[entityName2]; + val2 = val2.replace(entity.regx, entity.val); + } + for (let entityName2 in this.lastEntities) { + const entity = this.lastEntities[entityName2]; + val2 = val2.replace(entity.regex, entity.val); + } + if (this.options.htmlEntities) { + for (let entityName2 in this.htmlEntities) { + const entity = this.htmlEntities[entityName2]; + val2 = val2.replace(entity.regex, entity.val); + } + } + val2 = val2.replace(this.ampEntity.regex, this.ampEntity.val); + } + return val2; }; - var resolveDefaultsModeConfig = /* @__PURE__ */ __name(({ - region = (0, import_node_config_provider.loadConfig)(import_config_resolver.NODE_REGION_CONFIG_OPTIONS), - defaultsMode = (0, import_node_config_provider.loadConfig)(NODE_DEFAULTS_MODE_CONFIG_OPTIONS) - } = {}) => (0, import_property_provider.memoize)(async () => { - const mode = typeof defaultsMode === "function" ? await defaultsMode() : defaultsMode; - switch (mode == null ? void 0 : mode.toLowerCase()) { - case "auto": - return resolveNodeDefaultsModeAuto(region); - case "in-region": - case "cross-region": - case "mobile": - case "standard": - case "legacy": - return Promise.resolve(mode == null ? void 0 : mode.toLocaleLowerCase()); - case void 0: - return Promise.resolve("legacy"); - default: - throw new Error( - `Invalid parameter for "defaultsMode", expect ${DEFAULTS_MODE_OPTIONS.join(", ")}, got ${mode}` - ); + function saveTextToParentTag(textData, currentNode, jPath, isLeafNode) { + if (textData) { + if (isLeafNode === void 0) isLeafNode = Object.keys(currentNode.child).length === 0; + textData = this.parseTextData( + textData, + currentNode.tagname, + jPath, + false, + currentNode[":@"] ? Object.keys(currentNode[":@"]).length !== 0 : false, + isLeafNode + ); + if (textData !== void 0 && textData !== "") + currentNode.add(this.options.textNodeName, textData); + textData = ""; } - }), "resolveDefaultsModeConfig"); - var resolveNodeDefaultsModeAuto = /* @__PURE__ */ __name(async (clientRegion) => { - if (clientRegion) { - const resolvedRegion = typeof clientRegion === "function" ? await clientRegion() : clientRegion; - const inferredRegion = await inferPhysicalRegion(); - if (!inferredRegion) { - return "standard"; + return textData; + } + function isItStopNode(stopNodes, jPath, currentTagName) { + const allNodesExp = "*." + currentTagName; + for (const stopNodePath in stopNodes) { + const stopNodeExp = stopNodes[stopNodePath]; + if (allNodesExp === stopNodeExp || jPath === stopNodeExp) return true; + } + return false; + } + function tagExpWithClosingIndex(xmlData, i, closingChar = ">") { + let attrBoundary; + let tagExp = ""; + for (let index = i; index < xmlData.length; index++) { + let ch = xmlData[index]; + if (attrBoundary) { + if (ch === attrBoundary) attrBoundary = ""; + } else if (ch === '"' || ch === "'") { + attrBoundary = ch; + } else if (ch === closingChar[0]) { + if (closingChar[1]) { + if (xmlData[index + 1] === closingChar[1]) { + return { + data: tagExp, + index + }; + } + } else { + return { + data: tagExp, + index + }; + } + } else if (ch === " ") { + ch = " "; } - if (resolvedRegion === inferredRegion) { - return "in-region"; - } else { - return "cross-region"; + tagExp += ch; + } + } + function findClosingIndex(xmlData, str, i, errMsg) { + const closingIndex = xmlData.indexOf(str, i); + if (closingIndex === -1) { + throw new Error(errMsg); + } else { + return closingIndex + str.length - 1; + } + } + function readTagExp(xmlData, i, removeNSPrefix, closingChar = ">") { + const result = tagExpWithClosingIndex(xmlData, i + 1, closingChar); + if (!result) return; + let tagExp = result.data; + const closeIndex = result.index; + const separatorIndex = tagExp.search(/\s/); + let tagName = tagExp; + let attrExpPresent = true; + if (separatorIndex !== -1) { + tagName = tagExp.substring(0, separatorIndex); + tagExp = tagExp.substring(separatorIndex + 1).trimStart(); + } + const rawTagName = tagName; + if (removeNSPrefix) { + const colonIndex = tagName.indexOf(":"); + if (colonIndex !== -1) { + tagName = tagName.substr(colonIndex + 1); + attrExpPresent = tagName !== result.data.substr(colonIndex + 1); } } - return "standard"; - }, "resolveNodeDefaultsModeAuto"); - var inferPhysicalRegion = /* @__PURE__ */ __name(async () => { - if (process.env[AWS_EXECUTION_ENV] && (process.env[AWS_REGION_ENV] || process.env[AWS_DEFAULT_REGION_ENV])) { - return process.env[AWS_REGION_ENV] ?? process.env[AWS_DEFAULT_REGION_ENV]; + return { + tagName, + tagExp, + closeIndex, + attrExpPresent, + rawTagName + }; + } + function readStopNodeData(xmlData, tagName, i) { + const startIndex = i; + let openTagCount = 1; + for (; i < xmlData.length; i++) { + if (xmlData[i] === "<") { + if (xmlData[i + 1] === "/") { + const closeIndex = findClosingIndex(xmlData, ">", i, `${tagName} is not closed`); + let closeTagName = xmlData.substring(i + 2, closeIndex).trim(); + if (closeTagName === tagName) { + openTagCount--; + if (openTagCount === 0) { + return { + tagContent: xmlData.substring(startIndex, i), + i: closeIndex + }; + } + } + i = closeIndex; + } else if (xmlData[i + 1] === "?") { + const closeIndex = findClosingIndex(xmlData, "?>", i + 1, "StopNode is not closed."); + i = closeIndex; + } else if (xmlData.substr(i + 1, 3) === "!--") { + const closeIndex = findClosingIndex(xmlData, "-->", i + 3, "StopNode is not closed."); + i = closeIndex; + } else if (xmlData.substr(i + 1, 2) === "![") { + const closeIndex = findClosingIndex(xmlData, "]]>", i, "StopNode is not closed.") - 2; + i = closeIndex; + } else { + const tagData = readTagExp(xmlData, i, ">"); + if (tagData) { + const openTagName = tagData && tagData.tagName; + if (openTagName === tagName && tagData.tagExp[tagData.tagExp.length - 1] !== "/") { + openTagCount++; + } + i = tagData.closeIndex; + } + } + } } - if (!process.env[ENV_IMDS_DISABLED]) { - try { - const { getInstanceMetadataEndpoint, httpRequest } = await Promise.resolve().then(() => __toESM2(require_dist_cjs38())); - const endpoint = await getInstanceMetadataEndpoint(); - return (await httpRequest({ ...endpoint, path: IMDS_REGION_PATH })).toString(); - } catch (e) { + } + function parseValue(val2, shouldParse, options) { + if (shouldParse && typeof val2 === "string") { + const newval = val2.trim(); + if (newval === "true") return true; + else if (newval === "false") return false; + else return toNumber(val2, options); + } else { + if (util.isExist(val2)) { + return val2; + } else { + return ""; } } - }, "inferPhysicalRegion"); - } -}); - -// ../../../node_modules/@aws-sdk/client-sso/dist-cjs/runtimeConfig.js -var require_runtimeConfig = __commonJS({ - "../../../node_modules/@aws-sdk/client-sso/dist-cjs/runtimeConfig.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.getRuntimeConfig = void 0; - var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports)); - var package_json_1 = tslib_1.__importDefault(require_package3()); - var util_user_agent_node_1 = require_dist_cjs40(); - var config_resolver_1 = require_dist_cjs19(); - var hash_node_1 = require_dist_cjs41(); - var middleware_retry_1 = require_dist_cjs35(); - var node_config_provider_1 = require_dist_cjs22(); - var node_http_handler_1 = require_dist_cjs32(); - var util_body_length_node_1 = require_dist_cjs42(); - var util_retry_1 = require_dist_cjs28(); - var runtimeConfig_shared_1 = require_runtimeConfig_shared(); - var smithy_client_1 = require_dist_cjs34(); - var util_defaults_mode_node_1 = require_dist_cjs43(); - var smithy_client_2 = require_dist_cjs34(); - var getRuntimeConfig = (config) => { - (0, smithy_client_2.emitWarningIfUnsupportedVersion)(process.version); - const defaultsMode = (0, util_defaults_mode_node_1.resolveDefaultsModeConfig)(config); - const defaultConfigProvider = () => defaultsMode().then(smithy_client_1.loadConfigsForDefaultMode); - const clientSharedValues = (0, runtimeConfig_shared_1.getRuntimeConfig)(config); - return { - ...clientSharedValues, - ...config, - runtime: "node", - defaultsMode, - bodyLengthChecker: config?.bodyLengthChecker ?? util_body_length_node_1.calculateBodyLength, - defaultUserAgentProvider: config?.defaultUserAgentProvider ?? (0, util_user_agent_node_1.defaultUserAgent)({ serviceId: clientSharedValues.serviceId, clientVersion: package_json_1.default.version }), - maxAttempts: config?.maxAttempts ?? (0, node_config_provider_1.loadConfig)(middleware_retry_1.NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: config?.region ?? (0, node_config_provider_1.loadConfig)(config_resolver_1.NODE_REGION_CONFIG_OPTIONS, config_resolver_1.NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: config?.requestHandler ?? new node_http_handler_1.NodeHttpHandler(defaultConfigProvider), - retryMode: config?.retryMode ?? (0, node_config_provider_1.loadConfig)({ - ...middleware_retry_1.NODE_RETRY_MODE_CONFIG_OPTIONS, - default: async () => (await defaultConfigProvider()).retryMode || util_retry_1.DEFAULT_RETRY_MODE - }), - sha256: config?.sha256 ?? hash_node_1.Hash.bind(null, "sha256"), - streamCollector: config?.streamCollector ?? node_http_handler_1.streamCollector, - useDualstackEndpoint: config?.useDualstackEndpoint ?? (0, node_config_provider_1.loadConfig)(config_resolver_1.NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS), - useFipsEndpoint: config?.useFipsEndpoint ?? (0, node_config_provider_1.loadConfig)(config_resolver_1.NODE_USE_FIPS_ENDPOINT_CONFIG_OPTIONS) - }; - }; - exports2.getRuntimeConfig = getRuntimeConfig; + } + module2.exports = OrderedObjParser; } }); -// ../../../node_modules/@aws-sdk/region-config-resolver/dist-cjs/extensions/index.js -var require_extensions2 = __commonJS({ - "../../../node_modules/@aws-sdk/region-config-resolver/dist-cjs/extensions/index.js"(exports2) { +// ../../../node_modules/fast-xml-parser/src/xmlparser/node2json.js +var require_node2json = __commonJS({ + "../../../node_modules/fast-xml-parser/src/xmlparser/node2json.js"(exports2) { "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.resolveAwsRegionExtensionConfiguration = exports2.getAwsRegionExtensionConfiguration = void 0; - var getAwsRegionExtensionConfiguration = (runtimeConfig) => { - let runtimeConfigRegion = async () => { - if (runtimeConfig.region === void 0) { - throw new Error("Region is missing from runtimeConfig"); - } - const region = runtimeConfig.region; - if (typeof region === "string") { - return region; - } - return region(); - }; - return { - setRegion(region) { - runtimeConfigRegion = region; - }, - region() { - return runtimeConfigRegion; + function prettify(node, options) { + return compress(node, options); + } + function compress(arr, options, jPath) { + let text; + const compressedObj = {}; + for (let i = 0; i < arr.length; i++) { + const tagObj = arr[i]; + const property = propName(tagObj); + let newJpath = ""; + if (jPath === void 0) newJpath = property; + else newJpath = jPath + "." + property; + if (property === options.textNodeName) { + if (text === void 0) text = tagObj[property]; + else text += "" + tagObj[property]; + } else if (property === void 0) { + continue; + } else if (tagObj[property]) { + let val2 = compress(tagObj[property], options, newJpath); + const isLeaf = isLeafTag(val2, options); + if (tagObj[":@"]) { + assignAttributes(val2, tagObj[":@"], newJpath, options); + } else if (Object.keys(val2).length === 1 && val2[options.textNodeName] !== void 0 && !options.alwaysCreateTextNode) { + val2 = val2[options.textNodeName]; + } else if (Object.keys(val2).length === 0) { + if (options.alwaysCreateTextNode) val2[options.textNodeName] = ""; + else val2 = ""; + } + if (compressedObj[property] !== void 0 && compressedObj.hasOwnProperty(property)) { + if (!Array.isArray(compressedObj[property])) { + compressedObj[property] = [compressedObj[property]]; + } + compressedObj[property].push(val2); + } else { + if (options.isArray(property, newJpath, isLeaf)) { + compressedObj[property] = [val2]; + } else { + compressedObj[property] = val2; + } + } } - }; - }; - exports2.getAwsRegionExtensionConfiguration = getAwsRegionExtensionConfiguration; - var resolveAwsRegionExtensionConfiguration = (awsRegionExtensionConfiguration) => { - return { - region: awsRegionExtensionConfiguration.region() - }; - }; - exports2.resolveAwsRegionExtensionConfiguration = resolveAwsRegionExtensionConfiguration; - } -}); - -// ../../../node_modules/@aws-sdk/region-config-resolver/dist-cjs/regionConfig/config.js -var require_config = __commonJS({ - "../../../node_modules/@aws-sdk/region-config-resolver/dist-cjs/regionConfig/config.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.NODE_REGION_CONFIG_FILE_OPTIONS = exports2.NODE_REGION_CONFIG_OPTIONS = exports2.REGION_INI_NAME = exports2.REGION_ENV_NAME = void 0; - exports2.REGION_ENV_NAME = "AWS_REGION"; - exports2.REGION_INI_NAME = "region"; - exports2.NODE_REGION_CONFIG_OPTIONS = { - environmentVariableSelector: (env) => env[exports2.REGION_ENV_NAME], - configFileSelector: (profile) => profile[exports2.REGION_INI_NAME], - default: () => { - throw new Error("Region is missing"); } - }; - exports2.NODE_REGION_CONFIG_FILE_OPTIONS = { - preferredFile: "credentials" - }; - } -}); - -// ../../../node_modules/@aws-sdk/region-config-resolver/dist-cjs/regionConfig/isFipsRegion.js -var require_isFipsRegion = __commonJS({ - "../../../node_modules/@aws-sdk/region-config-resolver/dist-cjs/regionConfig/isFipsRegion.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.isFipsRegion = void 0; - var isFipsRegion = (region) => typeof region === "string" && (region.startsWith("fips-") || region.endsWith("-fips")); - exports2.isFipsRegion = isFipsRegion; - } -}); - -// ../../../node_modules/@aws-sdk/region-config-resolver/dist-cjs/regionConfig/getRealRegion.js -var require_getRealRegion = __commonJS({ - "../../../node_modules/@aws-sdk/region-config-resolver/dist-cjs/regionConfig/getRealRegion.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.getRealRegion = void 0; - var isFipsRegion_1 = require_isFipsRegion(); - var getRealRegion = (region) => (0, isFipsRegion_1.isFipsRegion)(region) ? ["fips-aws-global", "aws-fips"].includes(region) ? "us-east-1" : region.replace(/fips-(dkr-|prod-)?|-fips/, "") : region; - exports2.getRealRegion = getRealRegion; - } -}); - -// ../../../node_modules/@aws-sdk/region-config-resolver/dist-cjs/regionConfig/resolveRegionConfig.js -var require_resolveRegionConfig = __commonJS({ - "../../../node_modules/@aws-sdk/region-config-resolver/dist-cjs/regionConfig/resolveRegionConfig.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.resolveRegionConfig = void 0; - var getRealRegion_1 = require_getRealRegion(); - var isFipsRegion_1 = require_isFipsRegion(); - var resolveRegionConfig = (input) => { - const { region, useFipsEndpoint } = input; - if (!region) { - throw new Error("Region is missing"); + if (typeof text === "string") { + if (text.length > 0) compressedObj[options.textNodeName] = text; + } else if (text !== void 0) compressedObj[options.textNodeName] = text; + return compressedObj; + } + function propName(obj) { + const keys = Object.keys(obj); + for (let i = 0; i < keys.length; i++) { + const key = keys[i]; + if (key !== ":@") return key; } - return { - ...input, - region: async () => { - if (typeof region === "string") { - return (0, getRealRegion_1.getRealRegion)(region); - } - const providedRegion = await region(); - return (0, getRealRegion_1.getRealRegion)(providedRegion); - }, - useFipsEndpoint: async () => { - const providedRegion = typeof region === "string" ? region : await region(); - if ((0, isFipsRegion_1.isFipsRegion)(providedRegion)) { - return true; + } + function assignAttributes(obj, attrMap, jpath, options) { + if (attrMap) { + const keys = Object.keys(attrMap); + const len = keys.length; + for (let i = 0; i < len; i++) { + const atrrName = keys[i]; + if (options.isArray(atrrName, jpath + "." + atrrName, true, true)) { + obj[atrrName] = [attrMap[atrrName]]; + } else { + obj[atrrName] = attrMap[atrrName]; } - return typeof useFipsEndpoint !== "function" ? Promise.resolve(!!useFipsEndpoint) : useFipsEndpoint(); } - }; - }; - exports2.resolveRegionConfig = resolveRegionConfig; - } -}); - -// ../../../node_modules/@aws-sdk/region-config-resolver/dist-cjs/regionConfig/index.js -var require_regionConfig = __commonJS({ - "../../../node_modules/@aws-sdk/region-config-resolver/dist-cjs/regionConfig/index.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports)); - tslib_1.__exportStar(require_config(), exports2); - tslib_1.__exportStar(require_resolveRegionConfig(), exports2); - } -}); - -// ../../../node_modules/@aws-sdk/region-config-resolver/dist-cjs/index.js -var require_dist_cjs44 = __commonJS({ - "../../../node_modules/@aws-sdk/region-config-resolver/dist-cjs/index.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports)); - tslib_1.__exportStar(require_extensions2(), exports2); - tslib_1.__exportStar(require_regionConfig(), exports2); - } -}); - -// ../../../node_modules/@aws-sdk/client-sso/dist-cjs/runtimeExtensions.js -var require_runtimeExtensions = __commonJS({ - "../../../node_modules/@aws-sdk/client-sso/dist-cjs/runtimeExtensions.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.resolveRuntimeExtensions = void 0; - var region_config_resolver_1 = require_dist_cjs44(); - var protocol_http_1 = require_dist_cjs2(); - var smithy_client_1 = require_dist_cjs34(); - var asPartial = (t) => t; - var resolveRuntimeExtensions = (runtimeConfig, extensions) => { - const extensionConfiguration = { - ...asPartial((0, region_config_resolver_1.getAwsRegionExtensionConfiguration)(runtimeConfig)), - ...asPartial((0, smithy_client_1.getDefaultExtensionConfiguration)(runtimeConfig)), - ...asPartial((0, protocol_http_1.getHttpHandlerExtensionConfiguration)(runtimeConfig)) - }; - extensions.forEach((extension) => extension.configure(extensionConfiguration)); - return { - ...runtimeConfig, - ...(0, region_config_resolver_1.resolveAwsRegionExtensionConfiguration)(extensionConfiguration), - ...(0, smithy_client_1.resolveDefaultRuntimeConfig)(extensionConfiguration), - ...(0, protocol_http_1.resolveHttpHandlerRuntimeConfig)(extensionConfiguration) - }; - }; - exports2.resolveRuntimeExtensions = resolveRuntimeExtensions; - } -}); - -// ../../../node_modules/@aws-sdk/client-sso/dist-cjs/SSOClient.js -var require_SSOClient = __commonJS({ - "../../../node_modules/@aws-sdk/client-sso/dist-cjs/SSOClient.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.SSOClient = exports2.__Client = void 0; - var middleware_host_header_1 = require_dist_cjs3(); - var middleware_logger_1 = require_dist_cjs4(); - var middleware_recursion_detection_1 = require_dist_cjs5(); - var middleware_user_agent_1 = require_dist_cjs17(); - var config_resolver_1 = require_dist_cjs19(); - var middleware_content_length_1 = require_dist_cjs20(); - var middleware_endpoint_1 = require_dist_cjs26(); - var middleware_retry_1 = require_dist_cjs35(); - var smithy_client_1 = require_dist_cjs34(); - Object.defineProperty(exports2, "__Client", { enumerable: true, get: function() { - return smithy_client_1.Client; - } }); - var EndpointParameters_1 = require_EndpointParameters3(); - var runtimeConfig_1 = require_runtimeConfig(); - var runtimeExtensions_1 = require_runtimeExtensions(); - var SSOClient = class extends smithy_client_1.Client { - constructor(...[configuration]) { - const _config_0 = (0, runtimeConfig_1.getRuntimeConfig)(configuration || {}); - const _config_1 = (0, EndpointParameters_1.resolveClientEndpointParameters)(_config_0); - const _config_2 = (0, config_resolver_1.resolveRegionConfig)(_config_1); - const _config_3 = (0, middleware_endpoint_1.resolveEndpointConfig)(_config_2); - const _config_4 = (0, middleware_retry_1.resolveRetryConfig)(_config_3); - const _config_5 = (0, middleware_host_header_1.resolveHostHeaderConfig)(_config_4); - const _config_6 = (0, middleware_user_agent_1.resolveUserAgentConfig)(_config_5); - const _config_7 = (0, runtimeExtensions_1.resolveRuntimeExtensions)(_config_6, configuration?.extensions || []); - super(_config_7); - this.config = _config_7; - this.middlewareStack.use((0, middleware_retry_1.getRetryPlugin)(this.config)); - this.middlewareStack.use((0, middleware_content_length_1.getContentLengthPlugin)(this.config)); - this.middlewareStack.use((0, middleware_host_header_1.getHostHeaderPlugin)(this.config)); - this.middlewareStack.use((0, middleware_logger_1.getLoggerPlugin)(this.config)); - this.middlewareStack.use((0, middleware_recursion_detection_1.getRecursionDetectionPlugin)(this.config)); - this.middlewareStack.use((0, middleware_user_agent_1.getUserAgentPlugin)(this.config)); } - destroy() { - super.destroy(); + } + function isLeafTag(obj, options) { + const { textNodeName } = options; + const propCount = Object.keys(obj).length; + if (propCount === 0) { + return true; } - }; - exports2.SSOClient = SSOClient; + if (propCount === 1 && (obj[textNodeName] || typeof obj[textNodeName] === "boolean" || obj[textNodeName] === 0)) { + return true; + } + return false; + } + exports2.prettify = prettify; } }); -// ../../../node_modules/@aws-sdk/client-sso/dist-cjs/models/SSOServiceException.js -var require_SSOServiceException = __commonJS({ - "../../../node_modules/@aws-sdk/client-sso/dist-cjs/models/SSOServiceException.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.SSOServiceException = exports2.__ServiceException = void 0; - var smithy_client_1 = require_dist_cjs34(); - Object.defineProperty(exports2, "__ServiceException", { enumerable: true, get: function() { - return smithy_client_1.ServiceException; - } }); - var SSOServiceException = class _SSOServiceException extends smithy_client_1.ServiceException { +// ../../../node_modules/fast-xml-parser/src/xmlparser/XMLParser.js +var require_XMLParser = __commonJS({ + "../../../node_modules/fast-xml-parser/src/xmlparser/XMLParser.js"(exports2, module2) { + var { buildOptions } = require_OptionsBuilder(); + var OrderedObjParser = require_OrderedObjParser(); + var { prettify } = require_node2json(); + var validator = require_validator(); + var XMLParser2 = class { constructor(options) { - super(options); - Object.setPrototypeOf(this, _SSOServiceException.prototype); + this.externalEntities = {}; + this.options = buildOptions(options); + } + /** + * Parse XML dats to JS object + * @param {string|Buffer} xmlData + * @param {boolean|Object} validationOption + */ + parse(xmlData, validationOption) { + if (typeof xmlData === "string") { + } else if (xmlData.toString) { + xmlData = xmlData.toString(); + } else { + throw new Error("XML data is accepted in String or Bytes[] form."); + } + if (validationOption) { + if (validationOption === true) validationOption = {}; + const result = validator.validate(xmlData, validationOption); + if (result !== true) { + throw Error(`${result.err.msg}:${result.err.line}:${result.err.col}`); + } + } + const orderedObjParser = new OrderedObjParser(this.options); + orderedObjParser.addExternalEntities(this.externalEntities); + const orderedResult = orderedObjParser.parseXml(xmlData); + if (this.options.preserveOrder || orderedResult === void 0) return orderedResult; + else return prettify(orderedResult, this.options); + } + /** + * Add Entity which is not by default supported by this library + * @param {string} key + * @param {string} value + */ + addEntity(key, value) { + if (value.indexOf("&") !== -1) { + throw new Error("Entity value can't have '&'"); + } else if (key.indexOf("&") !== -1 || key.indexOf(";") !== -1) { + throw new Error("An entity must be set without '&' and ';'. Eg. use '#xD' for ' '"); + } else if (value === "&") { + throw new Error("An entity with value '&' is not permitted"); + } else { + this.externalEntities[key] = value; + } } }; - exports2.SSOServiceException = SSOServiceException; + module2.exports = XMLParser2; } }); -// ../../../node_modules/@aws-sdk/client-sso/dist-cjs/models/models_0.js -var require_models_02 = __commonJS({ - "../../../node_modules/@aws-sdk/client-sso/dist-cjs/models/models_0.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.LogoutRequestFilterSensitiveLog = exports2.ListAccountsRequestFilterSensitiveLog = exports2.ListAccountRolesRequestFilterSensitiveLog = exports2.GetRoleCredentialsResponseFilterSensitiveLog = exports2.RoleCredentialsFilterSensitiveLog = exports2.GetRoleCredentialsRequestFilterSensitiveLog = exports2.UnauthorizedException = exports2.TooManyRequestsException = exports2.ResourceNotFoundException = exports2.InvalidRequestException = void 0; - var smithy_client_1 = require_dist_cjs34(); - var SSOServiceException_1 = require_SSOServiceException(); - var InvalidRequestException = class _InvalidRequestException extends SSOServiceException_1.SSOServiceException { - constructor(opts) { - super({ - name: "InvalidRequestException", - $fault: "client", - ...opts - }); - this.name = "InvalidRequestException"; - this.$fault = "client"; - Object.setPrototypeOf(this, _InvalidRequestException.prototype); +// ../../../node_modules/fast-xml-parser/src/xmlbuilder/orderedJs2Xml.js +var require_orderedJs2Xml = __commonJS({ + "../../../node_modules/fast-xml-parser/src/xmlbuilder/orderedJs2Xml.js"(exports2, module2) { + var EOL = "\n"; + function toXml(jArray, options) { + let indentation = ""; + if (options.format && options.indentBy.length > 0) { + indentation = EOL; } - }; - exports2.InvalidRequestException = InvalidRequestException; - var ResourceNotFoundException = class _ResourceNotFoundException extends SSOServiceException_1.SSOServiceException { - constructor(opts) { - super({ - name: "ResourceNotFoundException", - $fault: "client", - ...opts - }); - this.name = "ResourceNotFoundException"; - this.$fault = "client"; - Object.setPrototypeOf(this, _ResourceNotFoundException.prototype); + return arrToStr(jArray, options, "", indentation); + } + function arrToStr(arr, options, jPath, indentation) { + let xmlStr = ""; + let isPreviousElementTag = false; + for (let i = 0; i < arr.length; i++) { + const tagObj = arr[i]; + const tagName = propName(tagObj); + if (tagName === void 0) continue; + let newJPath = ""; + if (jPath.length === 0) newJPath = tagName; + else newJPath = `${jPath}.${tagName}`; + if (tagName === options.textNodeName) { + let tagText = tagObj[tagName]; + if (!isStopNode(newJPath, options)) { + tagText = options.tagValueProcessor(tagName, tagText); + tagText = replaceEntitiesValue(tagText, options); + } + if (isPreviousElementTag) { + xmlStr += indentation; + } + xmlStr += tagText; + isPreviousElementTag = false; + continue; + } else if (tagName === options.cdataPropName) { + if (isPreviousElementTag) { + xmlStr += indentation; + } + xmlStr += ``; + isPreviousElementTag = false; + continue; + } else if (tagName === options.commentPropName) { + xmlStr += indentation + ``; + isPreviousElementTag = true; + continue; + } else if (tagName[0] === "?") { + const attStr2 = attr_to_str(tagObj[":@"], options); + const tempInd = tagName === "?xml" ? "" : indentation; + let piTextNodeName = tagObj[tagName][0][options.textNodeName]; + piTextNodeName = piTextNodeName.length !== 0 ? " " + piTextNodeName : ""; + xmlStr += tempInd + `<${tagName}${piTextNodeName}${attStr2}?>`; + isPreviousElementTag = true; + continue; + } + let newIdentation = indentation; + if (newIdentation !== "") { + newIdentation += options.indentBy; + } + const attStr = attr_to_str(tagObj[":@"], options); + const tagStart = indentation + `<${tagName}${attStr}`; + const tagValue = arrToStr(tagObj[tagName], options, newJPath, newIdentation); + if (options.unpairedTags.indexOf(tagName) !== -1) { + if (options.suppressUnpairedNode) xmlStr += tagStart + ">"; + else xmlStr += tagStart + "/>"; + } else if ((!tagValue || tagValue.length === 0) && options.suppressEmptyNode) { + xmlStr += tagStart + "/>"; + } else if (tagValue && tagValue.endsWith(">")) { + xmlStr += tagStart + `>${tagValue}${indentation}`; + } else { + xmlStr += tagStart + ">"; + if (tagValue && indentation !== "" && (tagValue.includes("/>") || tagValue.includes("`; + } + isPreviousElementTag = true; } - }; - exports2.ResourceNotFoundException = ResourceNotFoundException; - var TooManyRequestsException = class _TooManyRequestsException extends SSOServiceException_1.SSOServiceException { - constructor(opts) { - super({ - name: "TooManyRequestsException", - $fault: "client", - ...opts - }); - this.name = "TooManyRequestsException"; - this.$fault = "client"; - Object.setPrototypeOf(this, _TooManyRequestsException.prototype); + return xmlStr; + } + function propName(obj) { + const keys = Object.keys(obj); + for (let i = 0; i < keys.length; i++) { + const key = keys[i]; + if (!obj.hasOwnProperty(key)) continue; + if (key !== ":@") return key; } - }; - exports2.TooManyRequestsException = TooManyRequestsException; - var UnauthorizedException = class _UnauthorizedException extends SSOServiceException_1.SSOServiceException { - constructor(opts) { - super({ - name: "UnauthorizedException", - $fault: "client", - ...opts - }); - this.name = "UnauthorizedException"; - this.$fault = "client"; - Object.setPrototypeOf(this, _UnauthorizedException.prototype); + } + function attr_to_str(attrMap, options) { + let attrStr = ""; + if (attrMap && !options.ignoreAttributes) { + for (let attr in attrMap) { + if (!attrMap.hasOwnProperty(attr)) continue; + let attrVal = options.attributeValueProcessor(attr, attrMap[attr]); + attrVal = replaceEntitiesValue(attrVal, options); + if (attrVal === true && options.suppressBooleanAttributes) { + attrStr += ` ${attr.substr(options.attributeNamePrefix.length)}`; + } else { + attrStr += ` ${attr.substr(options.attributeNamePrefix.length)}="${attrVal}"`; + } + } } - }; - exports2.UnauthorizedException = UnauthorizedException; - var GetRoleCredentialsRequestFilterSensitiveLog = (obj) => ({ - ...obj, - ...obj.accessToken && { accessToken: smithy_client_1.SENSITIVE_STRING } - }); - exports2.GetRoleCredentialsRequestFilterSensitiveLog = GetRoleCredentialsRequestFilterSensitiveLog; - var RoleCredentialsFilterSensitiveLog = (obj) => ({ - ...obj, - ...obj.secretAccessKey && { secretAccessKey: smithy_client_1.SENSITIVE_STRING }, - ...obj.sessionToken && { sessionToken: smithy_client_1.SENSITIVE_STRING } - }); - exports2.RoleCredentialsFilterSensitiveLog = RoleCredentialsFilterSensitiveLog; - var GetRoleCredentialsResponseFilterSensitiveLog = (obj) => ({ - ...obj, - ...obj.roleCredentials && { roleCredentials: (0, exports2.RoleCredentialsFilterSensitiveLog)(obj.roleCredentials) } - }); - exports2.GetRoleCredentialsResponseFilterSensitiveLog = GetRoleCredentialsResponseFilterSensitiveLog; - var ListAccountRolesRequestFilterSensitiveLog = (obj) => ({ - ...obj, - ...obj.accessToken && { accessToken: smithy_client_1.SENSITIVE_STRING } - }); - exports2.ListAccountRolesRequestFilterSensitiveLog = ListAccountRolesRequestFilterSensitiveLog; - var ListAccountsRequestFilterSensitiveLog = (obj) => ({ - ...obj, - ...obj.accessToken && { accessToken: smithy_client_1.SENSITIVE_STRING } - }); - exports2.ListAccountsRequestFilterSensitiveLog = ListAccountsRequestFilterSensitiveLog; - var LogoutRequestFilterSensitiveLog = (obj) => ({ - ...obj, - ...obj.accessToken && { accessToken: smithy_client_1.SENSITIVE_STRING } - }); - exports2.LogoutRequestFilterSensitiveLog = LogoutRequestFilterSensitiveLog; - } -}); - -// ../../../node_modules/@aws-sdk/client-sso/dist-cjs/protocols/Aws_restJson1.js -var require_Aws_restJson1 = __commonJS({ - "../../../node_modules/@aws-sdk/client-sso/dist-cjs/protocols/Aws_restJson1.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.de_LogoutCommand = exports2.de_ListAccountsCommand = exports2.de_ListAccountRolesCommand = exports2.de_GetRoleCredentialsCommand = exports2.se_LogoutCommand = exports2.se_ListAccountsCommand = exports2.se_ListAccountRolesCommand = exports2.se_GetRoleCredentialsCommand = void 0; - var protocol_http_1 = require_dist_cjs2(); - var smithy_client_1 = require_dist_cjs34(); - var models_0_1 = require_models_02(); - var SSOServiceException_1 = require_SSOServiceException(); - var se_GetRoleCredentialsCommand = async (input, context) => { - const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); - const headers = (0, smithy_client_1.map)({}, isSerializableHeaderValue, { - "x-amz-sso_bearer_token": input.accessToken - }); - const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}/federation/credentials`; - const query = (0, smithy_client_1.map)({ - role_name: [, (0, smithy_client_1.expectNonNull)(input.roleName, `roleName`)], - account_id: [, (0, smithy_client_1.expectNonNull)(input.accountId, `accountId`)] - }); - let body; - return new protocol_http_1.HttpRequest({ - protocol, - hostname, - port, - method: "GET", - headers, - path: resolvedPath, - query, - body - }); - }; - exports2.se_GetRoleCredentialsCommand = se_GetRoleCredentialsCommand; - var se_ListAccountRolesCommand = async (input, context) => { - const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); - const headers = (0, smithy_client_1.map)({}, isSerializableHeaderValue, { - "x-amz-sso_bearer_token": input.accessToken - }); - const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}/assignment/roles`; - const query = (0, smithy_client_1.map)({ - next_token: [, input.nextToken], - max_result: [() => input.maxResults !== void 0, () => input.maxResults.toString()], - account_id: [, (0, smithy_client_1.expectNonNull)(input.accountId, `accountId`)] - }); - let body; - return new protocol_http_1.HttpRequest({ - protocol, - hostname, - port, - method: "GET", - headers, - path: resolvedPath, - query, - body - }); - }; - exports2.se_ListAccountRolesCommand = se_ListAccountRolesCommand; - var se_ListAccountsCommand = async (input, context) => { - const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); - const headers = (0, smithy_client_1.map)({}, isSerializableHeaderValue, { - "x-amz-sso_bearer_token": input.accessToken - }); - const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}/assignment/accounts`; - const query = (0, smithy_client_1.map)({ - next_token: [, input.nextToken], - max_result: [() => input.maxResults !== void 0, () => input.maxResults.toString()] - }); - let body; - return new protocol_http_1.HttpRequest({ - protocol, - hostname, - port, - method: "GET", - headers, - path: resolvedPath, - query, - body - }); - }; - exports2.se_ListAccountsCommand = se_ListAccountsCommand; - var se_LogoutCommand = async (input, context) => { - const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); - const headers = (0, smithy_client_1.map)({}, isSerializableHeaderValue, { - "x-amz-sso_bearer_token": input.accessToken - }); - const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}/logout`; - let body; - return new protocol_http_1.HttpRequest({ - protocol, - hostname, - port, - method: "POST", - headers, - path: resolvedPath, - body - }); - }; - exports2.se_LogoutCommand = se_LogoutCommand; - var de_GetRoleCredentialsCommand = async (output, context) => { - if (output.statusCode !== 200 && output.statusCode >= 300) { - return de_GetRoleCredentialsCommandError(output, context); + return attrStr; + } + function isStopNode(jPath, options) { + jPath = jPath.substr(0, jPath.length - options.textNodeName.length - 1); + let tagName = jPath.substr(jPath.lastIndexOf(".") + 1); + for (let index in options.stopNodes) { + if (options.stopNodes[index] === jPath || options.stopNodes[index] === "*." + tagName) return true; } - const contents = (0, smithy_client_1.map)({ - $metadata: deserializeMetadata(output) - }); - const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body"); - const doc = (0, smithy_client_1.take)(data, { - roleCredentials: smithy_client_1._json - }); - Object.assign(contents, doc); - return contents; - }; - exports2.de_GetRoleCredentialsCommand = de_GetRoleCredentialsCommand; - var de_GetRoleCredentialsCommandError = async (output, context) => { - const parsedOutput = { - ...output, - body: await parseErrorBody(output.body, context) - }; - const errorCode = loadRestJsonErrorCode(output, parsedOutput.body); - switch (errorCode) { - case "InvalidRequestException": - case "com.amazonaws.sso#InvalidRequestException": - throw await de_InvalidRequestExceptionRes(parsedOutput, context); - case "ResourceNotFoundException": - case "com.amazonaws.sso#ResourceNotFoundException": - throw await de_ResourceNotFoundExceptionRes(parsedOutput, context); - case "TooManyRequestsException": - case "com.amazonaws.sso#TooManyRequestsException": - throw await de_TooManyRequestsExceptionRes(parsedOutput, context); - case "UnauthorizedException": - case "com.amazonaws.sso#UnauthorizedException": - throw await de_UnauthorizedExceptionRes(parsedOutput, context); - default: - const parsedBody = parsedOutput.body; - return throwDefaultError({ - output, - parsedBody, - errorCode - }); + return false; + } + function replaceEntitiesValue(textValue, options) { + if (textValue && textValue.length > 0 && options.processEntities) { + for (let i = 0; i < options.entities.length; i++) { + const entity = options.entities[i]; + textValue = textValue.replace(entity.regex, entity.val); + } } + return textValue; + } + module2.exports = toXml; + } +}); + +// ../../../node_modules/fast-xml-parser/src/xmlbuilder/json2xml.js +var require_json2xml = __commonJS({ + "../../../node_modules/fast-xml-parser/src/xmlbuilder/json2xml.js"(exports2, module2) { + "use strict"; + var buildFromOrderedJs = require_orderedJs2Xml(); + var defaultOptions = { + attributeNamePrefix: "@_", + attributesGroupName: false, + textNodeName: "#text", + ignoreAttributes: true, + cdataPropName: false, + format: false, + indentBy: " ", + suppressEmptyNode: false, + suppressUnpairedNode: true, + suppressBooleanAttributes: true, + tagValueProcessor: function(key, a) { + return a; + }, + attributeValueProcessor: function(attrName, a) { + return a; + }, + preserveOrder: false, + commentPropName: false, + unpairedTags: [], + entities: [ + { regex: new RegExp("&", "g"), val: "&" }, + //it must be on top + { regex: new RegExp(">", "g"), val: ">" }, + { regex: new RegExp("<", "g"), val: "<" }, + { regex: new RegExp("'", "g"), val: "'" }, + { regex: new RegExp('"', "g"), val: """ } + ], + processEntities: true, + stopNodes: [], + // transformTagName: false, + // transformAttributeName: false, + oneListGroup: false }; - var de_ListAccountRolesCommand = async (output, context) => { - if (output.statusCode !== 200 && output.statusCode >= 300) { - return de_ListAccountRolesCommandError(output, context); + function Builder(options) { + this.options = Object.assign({}, defaultOptions, options); + if (this.options.ignoreAttributes || this.options.attributesGroupName) { + this.isAttribute = function() { + return false; + }; + } else { + this.attrPrefixLen = this.options.attributeNamePrefix.length; + this.isAttribute = isAttribute; } - const contents = (0, smithy_client_1.map)({ - $metadata: deserializeMetadata(output) - }); - const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body"); - const doc = (0, smithy_client_1.take)(data, { - nextToken: smithy_client_1.expectString, - roleList: smithy_client_1._json - }); - Object.assign(contents, doc); - return contents; - }; - exports2.de_ListAccountRolesCommand = de_ListAccountRolesCommand; - var de_ListAccountRolesCommandError = async (output, context) => { - const parsedOutput = { - ...output, - body: await parseErrorBody(output.body, context) - }; - const errorCode = loadRestJsonErrorCode(output, parsedOutput.body); - switch (errorCode) { - case "InvalidRequestException": - case "com.amazonaws.sso#InvalidRequestException": - throw await de_InvalidRequestExceptionRes(parsedOutput, context); - case "ResourceNotFoundException": - case "com.amazonaws.sso#ResourceNotFoundException": - throw await de_ResourceNotFoundExceptionRes(parsedOutput, context); - case "TooManyRequestsException": - case "com.amazonaws.sso#TooManyRequestsException": - throw await de_TooManyRequestsExceptionRes(parsedOutput, context); - case "UnauthorizedException": - case "com.amazonaws.sso#UnauthorizedException": - throw await de_UnauthorizedExceptionRes(parsedOutput, context); - default: - const parsedBody = parsedOutput.body; - return throwDefaultError({ - output, - parsedBody, - errorCode - }); + this.processTextOrObjNode = processTextOrObjNode; + if (this.options.format) { + this.indentate = indentate; + this.tagEndChar = ">\n"; + this.newLine = "\n"; + } else { + this.indentate = function() { + return ""; + }; + this.tagEndChar = ">"; + this.newLine = ""; + } + } + Builder.prototype.build = function(jObj) { + if (this.options.preserveOrder) { + return buildFromOrderedJs(jObj, this.options); + } else { + if (Array.isArray(jObj) && this.options.arrayNodeName && this.options.arrayNodeName.length > 1) { + jObj = { + [this.options.arrayNodeName]: jObj + }; + } + return this.j2x(jObj, 0).val; } }; - var de_ListAccountsCommand = async (output, context) => { - if (output.statusCode !== 200 && output.statusCode >= 300) { - return de_ListAccountsCommandError(output, context); + Builder.prototype.j2x = function(jObj, level) { + let attrStr = ""; + let val2 = ""; + for (let key in jObj) { + if (!Object.prototype.hasOwnProperty.call(jObj, key)) continue; + if (typeof jObj[key] === "undefined") { + if (this.isAttribute(key)) { + val2 += ""; + } + } else if (jObj[key] === null) { + if (this.isAttribute(key)) { + val2 += ""; + } else if (key[0] === "?") { + val2 += this.indentate(level) + "<" + key + "?" + this.tagEndChar; + } else { + val2 += this.indentate(level) + "<" + key + "/" + this.tagEndChar; + } + } else if (jObj[key] instanceof Date) { + val2 += this.buildTextValNode(jObj[key], key, "", level); + } else if (typeof jObj[key] !== "object") { + const attr = this.isAttribute(key); + if (attr) { + attrStr += this.buildAttrPairStr(attr, "" + jObj[key]); + } else { + if (key === this.options.textNodeName) { + let newval = this.options.tagValueProcessor(key, "" + jObj[key]); + val2 += this.replaceEntitiesValue(newval); + } else { + val2 += this.buildTextValNode(jObj[key], key, "", level); + } + } + } else if (Array.isArray(jObj[key])) { + const arrLen = jObj[key].length; + let listTagVal = ""; + let listTagAttr = ""; + for (let j = 0; j < arrLen; j++) { + const item = jObj[key][j]; + if (typeof item === "undefined") { + } else if (item === null) { + if (key[0] === "?") val2 += this.indentate(level) + "<" + key + "?" + this.tagEndChar; + else val2 += this.indentate(level) + "<" + key + "/" + this.tagEndChar; + } else if (typeof item === "object") { + if (this.options.oneListGroup) { + const result = this.j2x(item, level + 1); + listTagVal += result.val; + if (this.options.attributesGroupName && item.hasOwnProperty(this.options.attributesGroupName)) { + listTagAttr += result.attrStr; + } + } else { + listTagVal += this.processTextOrObjNode(item, key, level); + } + } else { + if (this.options.oneListGroup) { + let textValue = this.options.tagValueProcessor(key, item); + textValue = this.replaceEntitiesValue(textValue); + listTagVal += textValue; + } else { + listTagVal += this.buildTextValNode(item, key, "", level); + } + } + } + if (this.options.oneListGroup) { + listTagVal = this.buildObjectNode(listTagVal, key, listTagAttr, level); + } + val2 += listTagVal; + } else { + if (this.options.attributesGroupName && key === this.options.attributesGroupName) { + const Ks = Object.keys(jObj[key]); + const L = Ks.length; + for (let j = 0; j < L; j++) { + attrStr += this.buildAttrPairStr(Ks[j], "" + jObj[key][Ks[j]]); + } + } else { + val2 += this.processTextOrObjNode(jObj[key], key, level); + } + } } - const contents = (0, smithy_client_1.map)({ - $metadata: deserializeMetadata(output) - }); - const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body"); - const doc = (0, smithy_client_1.take)(data, { - accountList: smithy_client_1._json, - nextToken: smithy_client_1.expectString - }); - Object.assign(contents, doc); - return contents; + return { attrStr, val: val2 }; }; - exports2.de_ListAccountsCommand = de_ListAccountsCommand; - var de_ListAccountsCommandError = async (output, context) => { - const parsedOutput = { - ...output, - body: await parseErrorBody(output.body, context) - }; - const errorCode = loadRestJsonErrorCode(output, parsedOutput.body); - switch (errorCode) { - case "InvalidRequestException": - case "com.amazonaws.sso#InvalidRequestException": - throw await de_InvalidRequestExceptionRes(parsedOutput, context); - case "ResourceNotFoundException": - case "com.amazonaws.sso#ResourceNotFoundException": - throw await de_ResourceNotFoundExceptionRes(parsedOutput, context); - case "TooManyRequestsException": - case "com.amazonaws.sso#TooManyRequestsException": - throw await de_TooManyRequestsExceptionRes(parsedOutput, context); - case "UnauthorizedException": - case "com.amazonaws.sso#UnauthorizedException": - throw await de_UnauthorizedExceptionRes(parsedOutput, context); - default: - const parsedBody = parsedOutput.body; - return throwDefaultError({ - output, - parsedBody, - errorCode - }); + Builder.prototype.buildAttrPairStr = function(attrName, val2) { + val2 = this.options.attributeValueProcessor(attrName, "" + val2); + val2 = this.replaceEntitiesValue(val2); + if (this.options.suppressBooleanAttributes && val2 === "true") { + return " " + attrName; + } else return " " + attrName + '="' + val2 + '"'; + }; + function processTextOrObjNode(object, key, level) { + const result = this.j2x(object, level + 1); + if (object[this.options.textNodeName] !== void 0 && Object.keys(object).length === 1) { + return this.buildTextValNode(object[this.options.textNodeName], key, result.attrStr, level); + } else { + return this.buildObjectNode(result.val, key, result.attrStr, level); + } + } + Builder.prototype.buildObjectNode = function(val2, key, attrStr, level) { + if (val2 === "") { + if (key[0] === "?") return this.indentate(level) + "<" + key + attrStr + "?" + this.tagEndChar; + else { + return this.indentate(level) + "<" + key + attrStr + this.closeTag(key) + this.tagEndChar; + } + } else { + let tagEndExp = "" + val2 + tagEndExp; + } else if (this.options.commentPropName !== false && key === this.options.commentPropName && piClosingChar.length === 0) { + return this.indentate(level) + `` + this.newLine; + } else { + return this.indentate(level) + "<" + key + attrStr + piClosingChar + this.tagEndChar + val2 + this.indentate(level) + tagEndExp; + } } }; - var de_LogoutCommand = async (output, context) => { - if (output.statusCode !== 200 && output.statusCode >= 300) { - return de_LogoutCommandError(output, context); + Builder.prototype.closeTag = function(key) { + let closeTag = ""; + if (this.options.unpairedTags.indexOf(key) !== -1) { + if (!this.options.suppressUnpairedNode) closeTag = "/"; + } else if (this.options.suppressEmptyNode) { + closeTag = "/"; + } else { + closeTag = `> { - const parsedOutput = { - ...output, - body: await parseErrorBody(output.body, context) - }; - const errorCode = loadRestJsonErrorCode(output, parsedOutput.body); - switch (errorCode) { - case "InvalidRequestException": - case "com.amazonaws.sso#InvalidRequestException": - throw await de_InvalidRequestExceptionRes(parsedOutput, context); - case "TooManyRequestsException": - case "com.amazonaws.sso#TooManyRequestsException": - throw await de_TooManyRequestsExceptionRes(parsedOutput, context); - case "UnauthorizedException": - case "com.amazonaws.sso#UnauthorizedException": - throw await de_UnauthorizedExceptionRes(parsedOutput, context); - default: - const parsedBody = parsedOutput.body; - return throwDefaultError({ - output, - parsedBody, - errorCode - }); + Builder.prototype.buildTextValNode = function(val2, key, attrStr, level) { + if (this.options.cdataPropName !== false && key === this.options.cdataPropName) { + return this.indentate(level) + `` + this.newLine; + } else if (this.options.commentPropName !== false && key === this.options.commentPropName) { + return this.indentate(level) + `` + this.newLine; + } else if (key[0] === "?") { + return this.indentate(level) + "<" + key + attrStr + "?" + this.tagEndChar; + } else { + let textValue = this.options.tagValueProcessor(key, val2); + textValue = this.replaceEntitiesValue(textValue); + if (textValue === "") { + return this.indentate(level) + "<" + key + attrStr + this.closeTag(key) + this.tagEndChar; + } else { + return this.indentate(level) + "<" + key + attrStr + ">" + textValue + " { - const contents = (0, smithy_client_1.map)({}); - const data = parsedOutput.body; - const doc = (0, smithy_client_1.take)(data, { - message: smithy_client_1.expectString - }); - Object.assign(contents, doc); - const exception = new models_0_1.InvalidRequestException({ - $metadata: deserializeMetadata(parsedOutput), - ...contents - }); - return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body); - }; - var de_ResourceNotFoundExceptionRes = async (parsedOutput, context) => { - const contents = (0, smithy_client_1.map)({}); - const data = parsedOutput.body; - const doc = (0, smithy_client_1.take)(data, { - message: smithy_client_1.expectString - }); - Object.assign(contents, doc); - const exception = new models_0_1.ResourceNotFoundException({ - $metadata: deserializeMetadata(parsedOutput), - ...contents - }); - return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body); - }; - var de_TooManyRequestsExceptionRes = async (parsedOutput, context) => { - const contents = (0, smithy_client_1.map)({}); - const data = parsedOutput.body; - const doc = (0, smithy_client_1.take)(data, { - message: smithy_client_1.expectString - }); - Object.assign(contents, doc); - const exception = new models_0_1.TooManyRequestsException({ - $metadata: deserializeMetadata(parsedOutput), - ...contents - }); - return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body); + Builder.prototype.replaceEntitiesValue = function(textValue) { + if (textValue && textValue.length > 0 && this.options.processEntities) { + for (let i = 0; i < this.options.entities.length; i++) { + const entity = this.options.entities[i]; + textValue = textValue.replace(entity.regex, entity.val); + } + } + return textValue; }; - var de_UnauthorizedExceptionRes = async (parsedOutput, context) => { - const contents = (0, smithy_client_1.map)({}); - const data = parsedOutput.body; - const doc = (0, smithy_client_1.take)(data, { - message: smithy_client_1.expectString - }); - Object.assign(contents, doc); - const exception = new models_0_1.UnauthorizedException({ - $metadata: deserializeMetadata(parsedOutput), - ...contents - }); - return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body); + function indentate(level) { + return this.options.indentBy.repeat(level); + } + function isAttribute(name) { + if (name.startsWith(this.options.attributeNamePrefix) && name !== this.options.textNodeName) { + return name.substr(this.attrPrefixLen); + } else { + return false; + } + } + module2.exports = Builder; + } +}); + +// ../../../node_modules/fast-xml-parser/src/fxp.js +var require_fxp = __commonJS({ + "../../../node_modules/fast-xml-parser/src/fxp.js"(exports2, module2) { + "use strict"; + var validator = require_validator(); + var XMLParser2 = require_XMLParser(); + var XMLBuilder = require_json2xml(); + module2.exports = { + XMLParser: XMLParser2, + XMLValidator: validator, + XMLBuilder }; - var deserializeMetadata = (output) => ({ - httpStatusCode: output.statusCode, - requestId: output.headers["x-amzn-requestid"] ?? output.headers["x-amzn-request-id"] ?? output.headers["x-amz-request-id"], - extendedRequestId: output.headers["x-amz-id-2"], - cfId: output.headers["x-amz-cf-id"] - }); - var collectBodyString = (streamBody, context) => (0, smithy_client_1.collectBody)(streamBody, context).then((body) => context.utf8Encoder(body)); - var isSerializableHeaderValue = (value) => value !== void 0 && value !== null && value !== "" && (!Object.getOwnPropertyNames(value).includes("length") || value.length != 0) && (!Object.getOwnPropertyNames(value).includes("size") || value.size != 0); - var parseBody = (streamBody, context) => collectBodyString(streamBody, context).then((encoded) => { + } +}); + +// ../../../node_modules/@aws-sdk/core/dist-es/submodules/protocols/xml/parseXmlBody.js +var import_smithy_client4, import_fast_xml_parser, parseXmlBody, parseXmlErrorBody, loadRestXmlErrorCode; +var init_parseXmlBody = __esm({ + "../../../node_modules/@aws-sdk/core/dist-es/submodules/protocols/xml/parseXmlBody.js"() { + import_smithy_client4 = __toESM(require_dist_cjs37()); + import_fast_xml_parser = __toESM(require_fxp()); + init_common(); + parseXmlBody = (streamBody, context) => collectBodyString(streamBody, context).then((encoded) => { if (encoded.length) { - return JSON.parse(encoded); + const parser = new import_fast_xml_parser.XMLParser({ + attributeNamePrefix: "", + htmlEntities: true, + ignoreAttributes: false, + ignoreDeclaration: true, + parseTagValue: false, + trimValues: false, + tagValueProcessor: (_, val2) => val2.trim() === "" && val2.includes("\n") ? "" : void 0 + }); + parser.addEntity("#xD", "\r"); + parser.addEntity("#10", "\n"); + let parsedObj; + try { + parsedObj = parser.parse(encoded, true); + } catch (e) { + if (e && typeof e === "object") { + Object.defineProperty(e, "$responseBodyText", { + value: encoded + }); + } + throw e; + } + const textNodeName = "#text"; + const key = Object.keys(parsedObj)[0]; + const parsedObjToReturn = parsedObj[key]; + if (parsedObjToReturn[textNodeName]) { + parsedObjToReturn[key] = parsedObjToReturn[textNodeName]; + delete parsedObjToReturn[textNodeName]; + } + return (0, import_smithy_client4.getValueFromTextNode)(parsedObjToReturn); } return {}; }); - var parseErrorBody = async (errorBody, context) => { - const value = await parseBody(errorBody, context); - value.message = value.message ?? value.Message; + parseXmlErrorBody = async (errorBody, context) => { + const value = await parseXmlBody(errorBody, context); + if (value.Error) { + value.Error.message = value.Error.message ?? value.Error.Message; + } return value; }; - var loadRestJsonErrorCode = (output, data) => { - const findKey = (object, key) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase()); - const sanitizeErrorCode = (rawValue) => { - let cleanValue = rawValue; - if (typeof cleanValue === "number") { - cleanValue = cleanValue.toString(); - } - if (cleanValue.indexOf(",") >= 0) { - cleanValue = cleanValue.split(",")[0]; - } - if (cleanValue.indexOf(":") >= 0) { - cleanValue = cleanValue.split(":")[0]; - } - if (cleanValue.indexOf("#") >= 0) { - cleanValue = cleanValue.split("#")[1]; - } - return cleanValue; - }; - const headerKey = findKey(output.headers, "x-amzn-errortype"); - if (headerKey !== void 0) { - return sanitizeErrorCode(output.headers[headerKey]); + loadRestXmlErrorCode = (output, data) => { + if (data?.Error?.Code !== void 0) { + return data.Error.Code; } - if (data.code !== void 0) { - return sanitizeErrorCode(data.code); + if (data?.Code !== void 0) { + return data.Code; } - if (data["__type"] !== void 0) { - return sanitizeErrorCode(data["__type"]); + if (output.statusCode == 404) { + return "NotFound"; + } + }; + } +}); + +// ../../../node_modules/@aws-sdk/core/dist-es/submodules/protocols/index.js +var init_protocols = __esm({ + "../../../node_modules/@aws-sdk/core/dist-es/submodules/protocols/index.js"() { + init_coercing_serializers(); + init_awsExpectUnion(); + init_parseJsonBody(); + init_parseXmlBody(); + } +}); + +// ../../../node_modules/@aws-sdk/core/dist-es/index.js +var dist_es_exports2 = {}; +__export(dist_es_exports2, { + AWSSDKSigV4Signer: () => AWSSDKSigV4Signer, + AwsSdkSigV4ASigner: () => AwsSdkSigV4ASigner, + AwsSdkSigV4Signer: () => AwsSdkSigV4Signer, + NODE_SIGV4A_CONFIG_OPTIONS: () => NODE_SIGV4A_CONFIG_OPTIONS, + _toBool: () => _toBool, + _toNum: () => _toNum, + _toStr: () => _toStr, + awsExpectUnion: () => awsExpectUnion, + emitWarningIfUnsupportedVersion: () => emitWarningIfUnsupportedVersion, + loadRestJsonErrorCode: () => loadRestJsonErrorCode, + loadRestXmlErrorCode: () => loadRestXmlErrorCode, + parseJsonBody: () => parseJsonBody, + parseJsonErrorBody: () => parseJsonErrorBody, + parseXmlBody: () => parseXmlBody, + parseXmlErrorBody: () => parseXmlErrorBody, + resolveAWSSDKSigV4Config: () => resolveAWSSDKSigV4Config, + resolveAwsSdkSigV4AConfig: () => resolveAwsSdkSigV4AConfig, + resolveAwsSdkSigV4Config: () => resolveAwsSdkSigV4Config, + validateSigningProperties: () => validateSigningProperties +}); +var init_dist_es2 = __esm({ + "../../../node_modules/@aws-sdk/core/dist-es/index.js"() { + init_client(); + init_httpAuthSchemes2(); + init_protocols(); + } +}); + +// ../../../node_modules/@aws-sdk/client-sfn/dist-cjs/auth/httpAuthSchemeProvider.js +var require_httpAuthSchemeProvider = __commonJS({ + "../../../node_modules/@aws-sdk/client-sfn/dist-cjs/auth/httpAuthSchemeProvider.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.resolveHttpAuthSchemeConfig = exports2.defaultSFNHttpAuthSchemeProvider = exports2.defaultSFNHttpAuthSchemeParametersProvider = void 0; + var core_1 = (init_dist_es2(), __toCommonJS(dist_es_exports2)); + var util_middleware_1 = require_dist_cjs10(); + var defaultSFNHttpAuthSchemeParametersProvider = async (config, context, input) => { + return { + operation: (0, util_middleware_1.getSmithyContext)(context).operation, + region: await (0, util_middleware_1.normalizeProvider)(config.region)() || (() => { + throw new Error("expected `region` to be configured for `aws.auth#sigv4`"); + })() + }; + }; + exports2.defaultSFNHttpAuthSchemeParametersProvider = defaultSFNHttpAuthSchemeParametersProvider; + function createAwsAuthSigv4HttpAuthOption(authParameters) { + return { + schemeId: "aws.auth#sigv4", + signingProperties: { + name: "states", + region: authParameters.region + }, + propertiesExtractor: (config, context) => ({ + signingProperties: { + config, + context + } + }) + }; + } + var defaultSFNHttpAuthSchemeProvider = (authParameters) => { + const options = []; + switch (authParameters.operation) { + default: { + options.push(createAwsAuthSigv4HttpAuthOption(authParameters)); + } } + return options; + }; + exports2.defaultSFNHttpAuthSchemeProvider = defaultSFNHttpAuthSchemeProvider; + var resolveHttpAuthSchemeConfig = (config) => { + const config_0 = (0, core_1.resolveAwsSdkSigV4Config)(config); + return { + ...config_0 + }; + }; + exports2.resolveHttpAuthSchemeConfig = resolveHttpAuthSchemeConfig; + } +}); + +// ../../../node_modules/tslib/tslib.es6.mjs +var tslib_es6_exports = {}; +__export(tslib_es6_exports, { + __addDisposableResource: () => __addDisposableResource, + __assign: () => __assign, + __asyncDelegator: () => __asyncDelegator, + __asyncGenerator: () => __asyncGenerator, + __asyncValues: () => __asyncValues, + __await: () => __await, + __awaiter: () => __awaiter, + __classPrivateFieldGet: () => __classPrivateFieldGet, + __classPrivateFieldIn: () => __classPrivateFieldIn, + __classPrivateFieldSet: () => __classPrivateFieldSet, + __createBinding: () => __createBinding, + __decorate: () => __decorate, + __disposeResources: () => __disposeResources, + __esDecorate: () => __esDecorate, + __exportStar: () => __exportStar, + __extends: () => __extends, + __generator: () => __generator, + __importDefault: () => __importDefault, + __importStar: () => __importStar, + __makeTemplateObject: () => __makeTemplateObject, + __metadata: () => __metadata, + __param: () => __param, + __propKey: () => __propKey, + __read: () => __read, + __rest: () => __rest, + __runInitializers: () => __runInitializers, + __setFunctionName: () => __setFunctionName, + __spread: () => __spread, + __spreadArray: () => __spreadArray, + __spreadArrays: () => __spreadArrays, + __values: () => __values, + default: () => tslib_es6_default +}); +function __extends(d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { + this.constructor = d; + } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); +} +function __rest(s, e) { + var t = {}; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) + t[p] = s[p]; + if (s != null && typeof Object.getOwnPropertySymbols === "function") + for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { + if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) + t[p[i]] = s[p[i]]; + } + return t; +} +function __decorate(decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; +} +function __param(paramIndex, decorator) { + return function(target, key) { + decorator(target, key, paramIndex); + }; +} +function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) { + function accept(f) { + if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); + return f; + } + var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value"; + var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null; + var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {}); + var _, done = false; + for (var i = decorators.length - 1; i >= 0; i--) { + var context = {}; + for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p]; + for (var p in contextIn.access) context.access[p] = contextIn.access[p]; + context.addInitializer = function(f) { + if (done) throw new TypeError("Cannot add initializers after decoration has completed"); + extraInitializers.push(accept(f || null)); }; + var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context); + if (kind === "accessor") { + if (result === void 0) continue; + if (result === null || typeof result !== "object") throw new TypeError("Object expected"); + if (_ = accept(result.get)) descriptor.get = _; + if (_ = accept(result.set)) descriptor.set = _; + if (_ = accept(result.init)) initializers.unshift(_); + } else if (_ = accept(result)) { + if (kind === "field") initializers.unshift(_); + else descriptor[key] = _; + } } -}); - -// ../../../node_modules/@aws-sdk/client-sso/dist-cjs/commands/GetRoleCredentialsCommand.js -var require_GetRoleCredentialsCommand = __commonJS({ - "../../../node_modules/@aws-sdk/client-sso/dist-cjs/commands/GetRoleCredentialsCommand.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.GetRoleCredentialsCommand = exports2.$Command = void 0; - var middleware_endpoint_1 = require_dist_cjs26(); - var middleware_serde_1 = require_dist_cjs25(); - var smithy_client_1 = require_dist_cjs34(); - Object.defineProperty(exports2, "$Command", { enumerable: true, get: function() { - return smithy_client_1.Command; - } }); - var types_1 = require_dist_cjs(); - var models_0_1 = require_models_02(); - var Aws_restJson1_1 = require_Aws_restJson1(); - var GetRoleCredentialsCommand = class _GetRoleCredentialsCommand extends smithy_client_1.Command { - static getEndpointParameterInstructions() { - return { - UseFIPS: { type: "builtInParams", name: "useFipsEndpoint" }, - Endpoint: { type: "builtInParams", name: "endpoint" }, - Region: { type: "builtInParams", name: "region" }, - UseDualStack: { type: "builtInParams", name: "useDualstackEndpoint" } - }; - } - constructor(input) { - super(); - this.input = input; - } - resolveMiddleware(clientStack, configuration, options) { - this.middlewareStack.use((0, middleware_serde_1.getSerdePlugin)(configuration, this.serialize, this.deserialize)); - this.middlewareStack.use((0, middleware_endpoint_1.getEndpointPlugin)(configuration, _GetRoleCredentialsCommand.getEndpointParameterInstructions())); - const stack = clientStack.concat(this.middlewareStack); - const { logger } = configuration; - const clientName = "SSOClient"; - const commandName = "GetRoleCredentialsCommand"; - const handlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: models_0_1.GetRoleCredentialsRequestFilterSensitiveLog, - outputFilterSensitiveLog: models_0_1.GetRoleCredentialsResponseFilterSensitiveLog, - [types_1.SMITHY_CONTEXT_KEY]: { - service: "SWBPortalService", - operation: "GetRoleCredentials" - } - }; - const { requestHandler } = configuration; - return stack.resolve((request2) => requestHandler.handle(request2.request, options || {}), handlerExecutionContext); - } - serialize(input, context) { - return (0, Aws_restJson1_1.se_GetRoleCredentialsCommand)(input, context); + if (target) Object.defineProperty(target, contextIn.name, descriptor); + done = true; +} +function __runInitializers(thisArg, initializers, value) { + var useValue = arguments.length > 2; + for (var i = 0; i < initializers.length; i++) { + value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg); + } + return useValue ? value : void 0; +} +function __propKey(x) { + return typeof x === "symbol" ? x : "".concat(x); +} +function __setFunctionName(f, name, prefix) { + if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : ""; + return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name }); +} +function __metadata(metadataKey, metadataValue) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue); +} +function __awaiter(thisArg, _arguments, P, generator) { + function adopt(value) { + return value instanceof P ? value : new P(function(resolve) { + resolve(value); + }); + } + return new (P || (P = Promise))(function(resolve, reject) { + function fulfilled(value) { + try { + step(generator.next(value)); + } catch (e) { + reject(e); } - deserialize(output, context) { - return (0, Aws_restJson1_1.de_GetRoleCredentialsCommand)(output, context); + } + function rejected(value) { + try { + step(generator["throw"](value)); + } catch (e) { + reject(e); } + } + function step(result) { + result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); + } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +} +function __generator(thisArg, body) { + var _ = { label: 0, sent: function() { + if (t[0] & 1) throw t[1]; + return t[1]; + }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype); + return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { + return this; + }), g; + function verb(n) { + return function(v) { + return step([n, v]); }; - exports2.GetRoleCredentialsCommand = GetRoleCredentialsCommand; } -}); - -// ../../../node_modules/@aws-sdk/client-sso/dist-cjs/commands/ListAccountRolesCommand.js -var require_ListAccountRolesCommand = __commonJS({ - "../../../node_modules/@aws-sdk/client-sso/dist-cjs/commands/ListAccountRolesCommand.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.ListAccountRolesCommand = exports2.$Command = void 0; - var middleware_endpoint_1 = require_dist_cjs26(); - var middleware_serde_1 = require_dist_cjs25(); - var smithy_client_1 = require_dist_cjs34(); - Object.defineProperty(exports2, "$Command", { enumerable: true, get: function() { - return smithy_client_1.Command; - } }); - var types_1 = require_dist_cjs(); - var models_0_1 = require_models_02(); - var Aws_restJson1_1 = require_Aws_restJson1(); - var ListAccountRolesCommand = class _ListAccountRolesCommand extends smithy_client_1.Command { - static getEndpointParameterInstructions() { - return { - UseFIPS: { type: "builtInParams", name: "useFipsEndpoint" }, - Endpoint: { type: "builtInParams", name: "endpoint" }, - Region: { type: "builtInParams", name: "region" }, - UseDualStack: { type: "builtInParams", name: "useDualstackEndpoint" } - }; - } - constructor(input) { - super(); - this.input = input; - } - resolveMiddleware(clientStack, configuration, options) { - this.middlewareStack.use((0, middleware_serde_1.getSerdePlugin)(configuration, this.serialize, this.deserialize)); - this.middlewareStack.use((0, middleware_endpoint_1.getEndpointPlugin)(configuration, _ListAccountRolesCommand.getEndpointParameterInstructions())); - const stack = clientStack.concat(this.middlewareStack); - const { logger } = configuration; - const clientName = "SSOClient"; - const commandName = "ListAccountRolesCommand"; - const handlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: models_0_1.ListAccountRolesRequestFilterSensitiveLog, - outputFilterSensitiveLog: (_) => _, - [types_1.SMITHY_CONTEXT_KEY]: { - service: "SWBPortalService", - operation: "ListAccountRoles" + function step(op) { + if (f) throw new TypeError("Generator is already executing."); + while (g && (g = 0, op[0] && (_ = 0)), _) try { + if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; + if (y = 0, t) op = [op[0] & 2, t.value]; + switch (op[0]) { + case 0: + case 1: + t = op; + break; + case 4: + _.label++; + return { value: op[1], done: false }; + case 5: + _.label++; + y = op[1]; + op = [0]; + continue; + case 7: + op = _.ops.pop(); + _.trys.pop(); + continue; + default: + if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { + _ = 0; + continue; } - }; - const { requestHandler } = configuration; - return stack.resolve((request2) => requestHandler.handle(request2.request, options || {}), handlerExecutionContext); - } - serialize(input, context) { - return (0, Aws_restJson1_1.se_ListAccountRolesCommand)(input, context); - } - deserialize(output, context) { - return (0, Aws_restJson1_1.de_ListAccountRolesCommand)(output, context); + if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) { + _.label = op[1]; + break; + } + if (op[0] === 6 && _.label < t[1]) { + _.label = t[1]; + t = op; + break; + } + if (t && _.label < t[2]) { + _.label = t[2]; + _.ops.push(op); + break; + } + if (t[2]) _.ops.pop(); + _.trys.pop(); + continue; } + op = body.call(thisArg, _); + } catch (e) { + op = [6, e]; + y = 0; + } finally { + f = t = 0; + } + if (op[0] & 5) throw op[1]; + return { value: op[0] ? op[1] : void 0, done: true }; + } +} +function __exportStar(m, o) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p); +} +function __values(o) { + var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; + if (m) return m.call(o); + if (o && typeof o.length === "number") return { + next: function() { + if (o && i >= o.length) o = void 0; + return { value: o && o[i++], done: !o }; + } + }; + throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); +} +function __read(o, n) { + var m = typeof Symbol === "function" && o[Symbol.iterator]; + if (!m) return o; + var i = m.call(o), r, ar = [], e; + try { + while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); + } catch (error) { + e = { error }; + } finally { + try { + if (r && !r.done && (m = i["return"])) m.call(i); + } finally { + if (e) throw e.error; + } + } + return ar; +} +function __spread() { + for (var ar = [], i = 0; i < arguments.length; i++) + ar = ar.concat(__read(arguments[i])); + return ar; +} +function __spreadArrays() { + for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length; + for (var r = Array(s), k = 0, i = 0; i < il; i++) + for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) + r[k] = a[j]; + return r; +} +function __spreadArray(to, from, pack) { + if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { + if (ar || !(i in from)) { + if (!ar) ar = Array.prototype.slice.call(from, 0, i); + ar[i] = from[i]; + } + } + return to.concat(ar || Array.prototype.slice.call(from)); +} +function __await(v) { + return this instanceof __await ? (this.v = v, this) : new __await(v); +} +function __asyncGenerator(thisArg, _arguments, generator) { + if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); + var g = generator.apply(thisArg, _arguments || []), i, q = []; + return i = Object.create((typeof AsyncIterator === "function" ? AsyncIterator : Object).prototype), verb("next"), verb("throw"), verb("return", awaitReturn), i[Symbol.asyncIterator] = function() { + return this; + }, i; + function awaitReturn(f) { + return function(v) { + return Promise.resolve(v).then(f, reject); }; - exports2.ListAccountRolesCommand = ListAccountRolesCommand; } -}); - -// ../../../node_modules/@aws-sdk/client-sso/dist-cjs/commands/ListAccountsCommand.js -var require_ListAccountsCommand = __commonJS({ - "../../../node_modules/@aws-sdk/client-sso/dist-cjs/commands/ListAccountsCommand.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.ListAccountsCommand = exports2.$Command = void 0; - var middleware_endpoint_1 = require_dist_cjs26(); - var middleware_serde_1 = require_dist_cjs25(); - var smithy_client_1 = require_dist_cjs34(); - Object.defineProperty(exports2, "$Command", { enumerable: true, get: function() { - return smithy_client_1.Command; - } }); - var types_1 = require_dist_cjs(); - var models_0_1 = require_models_02(); - var Aws_restJson1_1 = require_Aws_restJson1(); - var ListAccountsCommand = class _ListAccountsCommand extends smithy_client_1.Command { - static getEndpointParameterInstructions() { - return { - UseFIPS: { type: "builtInParams", name: "useFipsEndpoint" }, - Endpoint: { type: "builtInParams", name: "endpoint" }, - Region: { type: "builtInParams", name: "region" }, - UseDualStack: { type: "builtInParams", name: "useDualstackEndpoint" } - }; - } - constructor(input) { - super(); - this.input = input; - } - resolveMiddleware(clientStack, configuration, options) { - this.middlewareStack.use((0, middleware_serde_1.getSerdePlugin)(configuration, this.serialize, this.deserialize)); - this.middlewareStack.use((0, middleware_endpoint_1.getEndpointPlugin)(configuration, _ListAccountsCommand.getEndpointParameterInstructions())); - const stack = clientStack.concat(this.middlewareStack); - const { logger } = configuration; - const clientName = "SSOClient"; - const commandName = "ListAccountsCommand"; - const handlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: models_0_1.ListAccountsRequestFilterSensitiveLog, - outputFilterSensitiveLog: (_) => _, - [types_1.SMITHY_CONTEXT_KEY]: { - service: "SWBPortalService", - operation: "ListAccounts" - } - }; - const { requestHandler } = configuration; - return stack.resolve((request2) => requestHandler.handle(request2.request, options || {}), handlerExecutionContext); - } - serialize(input, context) { - return (0, Aws_restJson1_1.se_ListAccountsCommand)(input, context); - } - deserialize(output, context) { - return (0, Aws_restJson1_1.de_ListAccountsCommand)(output, context); - } - }; - exports2.ListAccountsCommand = ListAccountsCommand; + function verb(n, f) { + if (g[n]) { + i[n] = function(v) { + return new Promise(function(a, b) { + q.push([n, v, a, b]) > 1 || resume(n, v); + }); + }; + if (f) i[n] = f(i[n]); + } } -}); - -// ../../../node_modules/@aws-sdk/client-sso/dist-cjs/commands/LogoutCommand.js -var require_LogoutCommand = __commonJS({ - "../../../node_modules/@aws-sdk/client-sso/dist-cjs/commands/LogoutCommand.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.LogoutCommand = exports2.$Command = void 0; - var middleware_endpoint_1 = require_dist_cjs26(); - var middleware_serde_1 = require_dist_cjs25(); - var smithy_client_1 = require_dist_cjs34(); - Object.defineProperty(exports2, "$Command", { enumerable: true, get: function() { - return smithy_client_1.Command; - } }); - var types_1 = require_dist_cjs(); - var models_0_1 = require_models_02(); - var Aws_restJson1_1 = require_Aws_restJson1(); - var LogoutCommand = class _LogoutCommand extends smithy_client_1.Command { - static getEndpointParameterInstructions() { - return { - UseFIPS: { type: "builtInParams", name: "useFipsEndpoint" }, - Endpoint: { type: "builtInParams", name: "endpoint" }, - Region: { type: "builtInParams", name: "region" }, - UseDualStack: { type: "builtInParams", name: "useDualstackEndpoint" } - }; - } - constructor(input) { - super(); - this.input = input; - } - resolveMiddleware(clientStack, configuration, options) { - this.middlewareStack.use((0, middleware_serde_1.getSerdePlugin)(configuration, this.serialize, this.deserialize)); - this.middlewareStack.use((0, middleware_endpoint_1.getEndpointPlugin)(configuration, _LogoutCommand.getEndpointParameterInstructions())); - const stack = clientStack.concat(this.middlewareStack); - const { logger } = configuration; - const clientName = "SSOClient"; - const commandName = "LogoutCommand"; - const handlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: models_0_1.LogoutRequestFilterSensitiveLog, - outputFilterSensitiveLog: (_) => _, - [types_1.SMITHY_CONTEXT_KEY]: { - service: "SWBPortalService", - operation: "Logout" - } - }; - const { requestHandler } = configuration; - return stack.resolve((request2) => requestHandler.handle(request2.request, options || {}), handlerExecutionContext); - } - serialize(input, context) { - return (0, Aws_restJson1_1.se_LogoutCommand)(input, context); - } - deserialize(output, context) { - return (0, Aws_restJson1_1.de_LogoutCommand)(output, context); - } - }; - exports2.LogoutCommand = LogoutCommand; + function resume(n, v) { + try { + step(g[n](v)); + } catch (e) { + settle(q[0][3], e); + } } -}); - -// ../../../node_modules/@aws-sdk/client-sso/dist-cjs/SSO.js -var require_SSO = __commonJS({ - "../../../node_modules/@aws-sdk/client-sso/dist-cjs/SSO.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.SSO = void 0; - var smithy_client_1 = require_dist_cjs34(); - var GetRoleCredentialsCommand_1 = require_GetRoleCredentialsCommand(); - var ListAccountRolesCommand_1 = require_ListAccountRolesCommand(); - var ListAccountsCommand_1 = require_ListAccountsCommand(); - var LogoutCommand_1 = require_LogoutCommand(); - var SSOClient_1 = require_SSOClient(); - var commands = { - GetRoleCredentialsCommand: GetRoleCredentialsCommand_1.GetRoleCredentialsCommand, - ListAccountRolesCommand: ListAccountRolesCommand_1.ListAccountRolesCommand, - ListAccountsCommand: ListAccountsCommand_1.ListAccountsCommand, - LogoutCommand: LogoutCommand_1.LogoutCommand - }; - var SSO = class extends SSOClient_1.SSOClient { - }; - exports2.SSO = SSO; - (0, smithy_client_1.createAggregatedClient)(commands, SSO); + function step(r) { + r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); } -}); - -// ../../../node_modules/@aws-sdk/client-sso/dist-cjs/commands/index.js -var require_commands = __commonJS({ - "../../../node_modules/@aws-sdk/client-sso/dist-cjs/commands/index.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports)); - tslib_1.__exportStar(require_GetRoleCredentialsCommand(), exports2); - tslib_1.__exportStar(require_ListAccountRolesCommand(), exports2); - tslib_1.__exportStar(require_ListAccountsCommand(), exports2); - tslib_1.__exportStar(require_LogoutCommand(), exports2); + function fulfill(value) { + resume("next", value); } -}); - -// ../../../node_modules/@aws-sdk/client-sso/dist-cjs/pagination/Interfaces.js -var require_Interfaces = __commonJS({ - "../../../node_modules/@aws-sdk/client-sso/dist-cjs/pagination/Interfaces.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); + function reject(value) { + resume("throw", value); } -}); - -// ../../../node_modules/@aws-sdk/client-sso/dist-cjs/pagination/ListAccountRolesPaginator.js -var require_ListAccountRolesPaginator = __commonJS({ - "../../../node_modules/@aws-sdk/client-sso/dist-cjs/pagination/ListAccountRolesPaginator.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.paginateListAccountRoles = void 0; - var ListAccountRolesCommand_1 = require_ListAccountRolesCommand(); - var SSOClient_1 = require_SSOClient(); - var makePagedClientRequest = async (client, input, ...args) => { - return await client.send(new ListAccountRolesCommand_1.ListAccountRolesCommand(input), ...args); - }; - async function* paginateListAccountRoles(config, input, ...additionalArguments) { - let token = config.startingToken || void 0; - let hasNext = true; - let page; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof SSOClient_1.SSOClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SSO | SSOClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - return void 0; - } - exports2.paginateListAccountRoles = paginateListAccountRoles; + function settle(f, v) { + if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); } -}); - -// ../../../node_modules/@aws-sdk/client-sso/dist-cjs/pagination/ListAccountsPaginator.js -var require_ListAccountsPaginator = __commonJS({ - "../../../node_modules/@aws-sdk/client-sso/dist-cjs/pagination/ListAccountsPaginator.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.paginateListAccounts = void 0; - var ListAccountsCommand_1 = require_ListAccountsCommand(); - var SSOClient_1 = require_SSOClient(); - var makePagedClientRequest = async (client, input, ...args) => { - return await client.send(new ListAccountsCommand_1.ListAccountsCommand(input), ...args); - }; - async function* paginateListAccounts(config, input, ...additionalArguments) { - let token = config.startingToken || void 0; - let hasNext = true; - let page; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof SSOClient_1.SSOClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SSO | SSOClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - return void 0; - } - exports2.paginateListAccounts = paginateListAccounts; +} +function __asyncDelegator(o) { + var i, p; + return i = {}, verb("next"), verb("throw", function(e) { + throw e; + }), verb("return"), i[Symbol.iterator] = function() { + return this; + }, i; + function verb(n, f) { + i[n] = o[n] ? function(v) { + return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v; + } : f; } -}); - -// ../../../node_modules/@aws-sdk/client-sso/dist-cjs/pagination/index.js -var require_pagination2 = __commonJS({ - "../../../node_modules/@aws-sdk/client-sso/dist-cjs/pagination/index.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports)); - tslib_1.__exportStar(require_Interfaces(), exports2); - tslib_1.__exportStar(require_ListAccountRolesPaginator(), exports2); - tslib_1.__exportStar(require_ListAccountsPaginator(), exports2); +} +function __asyncValues(o) { + if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); + var m = o[Symbol.asyncIterator], i; + return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function() { + return this; + }, i); + function verb(n) { + i[n] = o[n] && function(v) { + return new Promise(function(resolve, reject) { + v = o[n](v), settle(resolve, reject, v.done, v.value); + }); + }; } -}); - -// ../../../node_modules/@aws-sdk/client-sso/dist-cjs/models/index.js -var require_models = __commonJS({ - "../../../node_modules/@aws-sdk/client-sso/dist-cjs/models/index.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports)); - tslib_1.__exportStar(require_models_02(), exports2); + function settle(resolve, reject, d, v) { + Promise.resolve(v).then(function(v2) { + resolve({ value: v2, done: d }); + }, reject); } -}); - -// ../../../node_modules/@aws-sdk/client-sso/dist-cjs/index.js -var require_dist_cjs45 = __commonJS({ - "../../../node_modules/@aws-sdk/client-sso/dist-cjs/index.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.SSOServiceException = void 0; - var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports)); - tslib_1.__exportStar(require_SSOClient(), exports2); - tslib_1.__exportStar(require_SSO(), exports2); - tslib_1.__exportStar(require_commands(), exports2); - tslib_1.__exportStar(require_pagination2(), exports2); - tslib_1.__exportStar(require_models(), exports2); - var SSOServiceException_1 = require_SSOServiceException(); - Object.defineProperty(exports2, "SSOServiceException", { enumerable: true, get: function() { - return SSOServiceException_1.SSOServiceException; - } }); +} +function __makeTemplateObject(cooked, raw) { + if (Object.defineProperty) { + Object.defineProperty(cooked, "raw", { value: raw }); + } else { + cooked.raw = raw; } -}); - -// ../../../node_modules/@aws-sdk/token-providers/dist-cjs/bundle/client-sso-oidc-node.js -var require_client_sso_oidc_node = __commonJS({ - "../../../node_modules/@aws-sdk/token-providers/dist-cjs/bundle/client-sso-oidc-node.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.UnsupportedGrantTypeException = exports2.UnauthorizedClientException = exports2.SlowDownException = exports2.SSOOIDCClient = exports2.InvalidScopeException = exports2.InvalidRequestException = exports2.InvalidClientException = exports2.InternalServerException = exports2.ExpiredTokenException = exports2.CreateTokenCommand = exports2.AuthorizationPendingException = exports2.AccessDeniedException = void 0; - var middleware_host_header_1 = require_dist_cjs3(); - var middleware_logger_1 = require_dist_cjs4(); - var middleware_recursion_detection_1 = require_dist_cjs5(); - var middleware_user_agent_1 = require_dist_cjs17(); - var config_resolver_1 = require_dist_cjs19(); - var middleware_content_length_1 = require_dist_cjs20(); - var middleware_endpoint_1 = require_dist_cjs26(); - var middleware_retry_1 = require_dist_cjs35(); - var smithy_client_1 = require_dist_cjs34(); - var resolveClientEndpointParameters = (options) => { - var _a, _b; - return { - ...options, - useDualstackEndpoint: (_a = options.useDualstackEndpoint) !== null && _a !== void 0 ? _a : false, - useFipsEndpoint: (_b = options.useFipsEndpoint) !== null && _b !== void 0 ? _b : false, - defaultSigningName: "awsssooidc" - }; - }; - var package_default = { version: "3.387.0" }; - var util_user_agent_node_1 = require_dist_cjs40(); - var config_resolver_2 = require_dist_cjs19(); - var hash_node_1 = require_dist_cjs41(); - var middleware_retry_2 = require_dist_cjs35(); - var node_config_provider_1 = require_dist_cjs22(); - var node_http_handler_1 = require_dist_cjs32(); - var util_body_length_node_1 = require_dist_cjs42(); - var util_retry_1 = require_dist_cjs28(); - var smithy_client_2 = require_dist_cjs34(); - var url_parser_1 = require_dist_cjs24(); - var util_base64_1 = require_dist_cjs30(); - var util_utf8_1 = require_dist_cjs10(); - var util_endpoints_1 = require_dist_cjs16(); - var p = "required"; - var q = "fn"; - var r = "argv"; - var s = "ref"; - var a = "PartitionResult"; - var b = "tree"; - var c = "error"; - var d = "endpoint"; - var e = { [p]: false, "type": "String" }; - var f = { [p]: true, "default": false, "type": "Boolean" }; - var g = { [s]: "Endpoint" }; - var h = { [q]: "booleanEquals", [r]: [{ [s]: "UseFIPS" }, true] }; - var i = { [q]: "booleanEquals", [r]: [{ [s]: "UseDualStack" }, true] }; - var j = {}; - var k = { [q]: "booleanEquals", [r]: [true, { [q]: "getAttr", [r]: [{ [s]: a }, "supportsFIPS"] }] }; - var l = { [q]: "booleanEquals", [r]: [true, { [q]: "getAttr", [r]: [{ [s]: a }, "supportsDualStack"] }] }; - var m = [g]; - var n = [h]; - var o = [i]; - var _data = { version: "1.0", parameters: { Region: e, UseDualStack: f, UseFIPS: f, Endpoint: e }, rules: [{ conditions: [{ [q]: "aws.partition", [r]: [{ [s]: "Region" }], assign: a }], type: b, rules: [{ conditions: [{ [q]: "isSet", [r]: m }, { [q]: "parseURL", [r]: m, assign: "url" }], type: b, rules: [{ conditions: n, error: "Invalid Configuration: FIPS and custom endpoint are not supported", type: c }, { type: b, rules: [{ conditions: o, error: "Invalid Configuration: Dualstack and custom endpoint are not supported", type: c }, { endpoint: { url: g, properties: j, headers: j }, type: d }] }] }, { conditions: [h, i], type: b, rules: [{ conditions: [k, l], type: b, rules: [{ endpoint: { url: "https://oidc-fips.{Region}.{PartitionResult#dualStackDnsSuffix}", properties: j, headers: j }, type: d }] }, { error: "FIPS and DualStack are enabled, but this partition does not support one or both", type: c }] }, { conditions: n, type: b, rules: [{ conditions: [k], type: b, rules: [{ type: b, rules: [{ endpoint: { url: "https://oidc-fips.{Region}.{PartitionResult#dnsSuffix}", properties: j, headers: j }, type: d }] }] }, { error: "FIPS is enabled but this partition does not support FIPS", type: c }] }, { conditions: o, type: b, rules: [{ conditions: [l], type: b, rules: [{ endpoint: { url: "https://oidc.{Region}.{PartitionResult#dualStackDnsSuffix}", properties: j, headers: j }, type: d }] }, { error: "DualStack is enabled but this partition does not support DualStack", type: c }] }, { endpoint: { url: "https://oidc.{Region}.{PartitionResult#dnsSuffix}", properties: j, headers: j }, type: d }] }] }; - var ruleSet = _data; - var defaultEndpointResolver = (endpointParams, context = {}) => { - return (0, util_endpoints_1.resolveEndpoint)(ruleSet, { - endpointParams, - logger: context.logger - }); + return cooked; +} +function __importStar(mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) { + for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + } + __setModuleDefault(result, mod); + return result; +} +function __importDefault(mod) { + return mod && mod.__esModule ? mod : { default: mod }; +} +function __classPrivateFieldGet(receiver, state, kind, f) { + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); + return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); +} +function __classPrivateFieldSet(receiver, state, value, kind, f) { + if (kind === "m") throw new TypeError("Private method is not writable"); + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); + return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value), value; +} +function __classPrivateFieldIn(state, receiver) { + if (receiver === null || typeof receiver !== "object" && typeof receiver !== "function") throw new TypeError("Cannot use 'in' operator on non-object"); + return typeof state === "function" ? receiver === state : state.has(receiver); +} +function __addDisposableResource(env, value, async) { + if (value !== null && value !== void 0) { + if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected."); + var dispose, inner; + if (async) { + if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined."); + dispose = value[Symbol.asyncDispose]; + } + if (dispose === void 0) { + if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined."); + dispose = value[Symbol.dispose]; + if (async) inner = dispose; + } + if (typeof dispose !== "function") throw new TypeError("Object not disposable."); + if (inner) dispose = function() { + try { + inner.call(this); + } catch (e) { + return Promise.reject(e); + } }; - var getRuntimeConfig = (config) => { - var _a, _b, _c, _d, _e, _f, _g, _h, _j; - return { - apiVersion: "2019-06-10", - base64Decoder: (_a = config === null || config === void 0 ? void 0 : config.base64Decoder) !== null && _a !== void 0 ? _a : util_base64_1.fromBase64, - base64Encoder: (_b = config === null || config === void 0 ? void 0 : config.base64Encoder) !== null && _b !== void 0 ? _b : util_base64_1.toBase64, - disableHostPrefix: (_c = config === null || config === void 0 ? void 0 : config.disableHostPrefix) !== null && _c !== void 0 ? _c : false, - endpointProvider: (_d = config === null || config === void 0 ? void 0 : config.endpointProvider) !== null && _d !== void 0 ? _d : defaultEndpointResolver, - logger: (_e = config === null || config === void 0 ? void 0 : config.logger) !== null && _e !== void 0 ? _e : new smithy_client_2.NoOpLogger(), - serviceId: (_f = config === null || config === void 0 ? void 0 : config.serviceId) !== null && _f !== void 0 ? _f : "SSO OIDC", - urlParser: (_g = config === null || config === void 0 ? void 0 : config.urlParser) !== null && _g !== void 0 ? _g : url_parser_1.parseUrl, - utf8Decoder: (_h = config === null || config === void 0 ? void 0 : config.utf8Decoder) !== null && _h !== void 0 ? _h : util_utf8_1.fromUtf8, - utf8Encoder: (_j = config === null || config === void 0 ? void 0 : config.utf8Encoder) !== null && _j !== void 0 ? _j : util_utf8_1.toUtf8 + env.stack.push({ value, dispose, async }); + } else if (async) { + env.stack.push({ async: true }); + } + return value; +} +function __disposeResources(env) { + function fail(e) { + env.error = env.hasError ? new _SuppressedError(e, env.error, "An error was suppressed during disposal.") : e; + env.hasError = true; + } + var r, s = 0; + function next() { + while (r = env.stack.pop()) { + try { + if (!r.async && s === 1) return s = 0, env.stack.push(r), Promise.resolve().then(next); + if (r.dispose) { + var result = r.dispose.call(r.value); + if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) { + fail(e); + return next(); + }); + } else s |= 1; + } catch (e) { + fail(e); + } + } + if (s === 1) return env.hasError ? Promise.reject(env.error) : Promise.resolve(); + if (env.hasError) throw env.error; + } + return next(); +} +var extendStatics, __assign, __createBinding, __setModuleDefault, _SuppressedError, tslib_es6_default; +var init_tslib_es6 = __esm({ + "../../../node_modules/tslib/tslib.es6.mjs"() { + extendStatics = function(d, b) { + extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) { + d2.__proto__ = b2; + } || function(d2, b2) { + for (var p in b2) if (Object.prototype.hasOwnProperty.call(b2, p)) d2[p] = b2[p]; }; + return extendStatics(d, b); }; - var smithy_client_3 = require_dist_cjs34(); - var util_defaults_mode_node_1 = require_dist_cjs43(); - var smithy_client_4 = require_dist_cjs34(); - var getRuntimeConfig2 = (config) => { - var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k; - (0, smithy_client_4.emitWarningIfUnsupportedVersion)(process.version); - const defaultsMode = (0, util_defaults_mode_node_1.resolveDefaultsModeConfig)(config); - const defaultConfigProvider = () => defaultsMode().then(smithy_client_3.loadConfigsForDefaultMode); - const clientSharedValues = getRuntimeConfig(config); - return { - ...clientSharedValues, - ...config, - runtime: "node", - defaultsMode, - bodyLengthChecker: (_a = config === null || config === void 0 ? void 0 : config.bodyLengthChecker) !== null && _a !== void 0 ? _a : util_body_length_node_1.calculateBodyLength, - defaultUserAgentProvider: (_b = config === null || config === void 0 ? void 0 : config.defaultUserAgentProvider) !== null && _b !== void 0 ? _b : (0, util_user_agent_node_1.defaultUserAgent)({ serviceId: clientSharedValues.serviceId, clientVersion: package_default.version }), - maxAttempts: (_c = config === null || config === void 0 ? void 0 : config.maxAttempts) !== null && _c !== void 0 ? _c : (0, node_config_provider_1.loadConfig)(middleware_retry_2.NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: (_d = config === null || config === void 0 ? void 0 : config.region) !== null && _d !== void 0 ? _d : (0, node_config_provider_1.loadConfig)(config_resolver_2.NODE_REGION_CONFIG_OPTIONS, config_resolver_2.NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: (_e = config === null || config === void 0 ? void 0 : config.requestHandler) !== null && _e !== void 0 ? _e : new node_http_handler_1.NodeHttpHandler(defaultConfigProvider), - retryMode: (_f = config === null || config === void 0 ? void 0 : config.retryMode) !== null && _f !== void 0 ? _f : (0, node_config_provider_1.loadConfig)({ - ...middleware_retry_2.NODE_RETRY_MODE_CONFIG_OPTIONS, - default: async () => (await defaultConfigProvider()).retryMode || util_retry_1.DEFAULT_RETRY_MODE - }), - sha256: (_g = config === null || config === void 0 ? void 0 : config.sha256) !== null && _g !== void 0 ? _g : hash_node_1.Hash.bind(null, "sha256"), - streamCollector: (_h = config === null || config === void 0 ? void 0 : config.streamCollector) !== null && _h !== void 0 ? _h : node_http_handler_1.streamCollector, - useDualstackEndpoint: (_j = config === null || config === void 0 ? void 0 : config.useDualstackEndpoint) !== null && _j !== void 0 ? _j : (0, node_config_provider_1.loadConfig)(config_resolver_2.NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS), - useFipsEndpoint: (_k = config === null || config === void 0 ? void 0 : config.useFipsEndpoint) !== null && _k !== void 0 ? _k : (0, node_config_provider_1.loadConfig)(config_resolver_2.NODE_USE_FIPS_ENDPOINT_CONFIG_OPTIONS) + __assign = function() { + __assign = Object.assign || function __assign2(t) { + for (var s, i = 1, n = arguments.length; i < n; i++) { + s = arguments[i]; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; + } + return t; }; + return __assign.apply(this, arguments); }; - var SSOOIDCClient = class extends smithy_client_1.Client { - constructor(...[configuration]) { - const _config_0 = getRuntimeConfig2(configuration || {}); - const _config_1 = resolveClientEndpointParameters(_config_0); - const _config_2 = (0, config_resolver_1.resolveRegionConfig)(_config_1); - const _config_3 = (0, middleware_endpoint_1.resolveEndpointConfig)(_config_2); - const _config_4 = (0, middleware_retry_1.resolveRetryConfig)(_config_3); - const _config_5 = (0, middleware_host_header_1.resolveHostHeaderConfig)(_config_4); - const _config_6 = (0, middleware_user_agent_1.resolveUserAgentConfig)(_config_5); - super(_config_6); - this.config = _config_6; - this.middlewareStack.use((0, middleware_retry_1.getRetryPlugin)(this.config)); - this.middlewareStack.use((0, middleware_content_length_1.getContentLengthPlugin)(this.config)); - this.middlewareStack.use((0, middleware_host_header_1.getHostHeaderPlugin)(this.config)); - this.middlewareStack.use((0, middleware_logger_1.getLoggerPlugin)(this.config)); - this.middlewareStack.use((0, middleware_recursion_detection_1.getRecursionDetectionPlugin)(this.config)); - this.middlewareStack.use((0, middleware_user_agent_1.getUserAgentPlugin)(this.config)); - } - destroy() { - super.destroy(); - } - }; - exports2.SSOOIDCClient = SSOOIDCClient; - var smithy_client_5 = require_dist_cjs34(); - var middleware_endpoint_2 = require_dist_cjs26(); - var middleware_serde_1 = require_dist_cjs25(); - var smithy_client_6 = require_dist_cjs34(); - var protocol_http_1 = require_dist_cjs2(); - var smithy_client_7 = require_dist_cjs34(); - var smithy_client_8 = require_dist_cjs34(); - var SSOOIDCServiceException = class _SSOOIDCServiceException extends smithy_client_8.ServiceException { - constructor(options) { - super(options); - Object.setPrototypeOf(this, _SSOOIDCServiceException.prototype); - } - }; - var AccessDeniedException = class _AccessDeniedException extends SSOOIDCServiceException { - constructor(opts) { - super({ - name: "AccessDeniedException", - $fault: "client", - ...opts - }); - this.name = "AccessDeniedException"; - this.$fault = "client"; - Object.setPrototypeOf(this, _AccessDeniedException.prototype); - this.error = opts.error; - this.error_description = opts.error_description; + __createBinding = Object.create ? function(o, m, k, k2) { + if (k2 === void 0) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { + return m[k]; + } }; } + Object.defineProperty(o, k2, desc); + } : function(o, m, k, k2) { + if (k2 === void 0) k2 = k; + o[k2] = m[k]; }; - exports2.AccessDeniedException = AccessDeniedException; - var AuthorizationPendingException = class _AuthorizationPendingException extends SSOOIDCServiceException { - constructor(opts) { - super({ - name: "AuthorizationPendingException", - $fault: "client", - ...opts - }); - this.name = "AuthorizationPendingException"; - this.$fault = "client"; - Object.setPrototypeOf(this, _AuthorizationPendingException.prototype); - this.error = opts.error; - this.error_description = opts.error_description; - } + __setModuleDefault = Object.create ? function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); + } : function(o, v) { + o["default"] = v; }; - exports2.AuthorizationPendingException = AuthorizationPendingException; - var ExpiredTokenException = class _ExpiredTokenException extends SSOOIDCServiceException { - constructor(opts) { - super({ - name: "ExpiredTokenException", - $fault: "client", - ...opts - }); - this.name = "ExpiredTokenException"; - this.$fault = "client"; - Object.setPrototypeOf(this, _ExpiredTokenException.prototype); - this.error = opts.error; - this.error_description = opts.error_description; - } + _SuppressedError = typeof SuppressedError === "function" ? SuppressedError : function(error, suppressed, message) { + var e = new Error(message); + return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e; }; - exports2.ExpiredTokenException = ExpiredTokenException; - var InternalServerException = class _InternalServerException extends SSOOIDCServiceException { - constructor(opts) { - super({ - name: "InternalServerException", - $fault: "server", - ...opts - }); - this.name = "InternalServerException"; - this.$fault = "server"; - Object.setPrototypeOf(this, _InternalServerException.prototype); - this.error = opts.error; - this.error_description = opts.error_description; - } + tslib_es6_default = { + __extends, + __assign, + __rest, + __decorate, + __param, + __metadata, + __awaiter, + __generator, + __createBinding, + __exportStar, + __values, + __read, + __spread, + __spreadArrays, + __spreadArray, + __await, + __asyncGenerator, + __asyncDelegator, + __asyncValues, + __makeTemplateObject, + __importStar, + __importDefault, + __classPrivateFieldGet, + __classPrivateFieldSet, + __classPrivateFieldIn, + __addDisposableResource, + __disposeResources }; - exports2.InternalServerException = InternalServerException; - var InvalidClientException = class _InvalidClientException extends SSOOIDCServiceException { - constructor(opts) { - super({ - name: "InvalidClientException", - $fault: "client", - ...opts - }); - this.name = "InvalidClientException"; - this.$fault = "client"; - Object.setPrototypeOf(this, _InvalidClientException.prototype); - this.error = opts.error; - this.error_description = opts.error_description; + } +}); + +// ../../../node_modules/@aws-sdk/client-sfn/package.json +var require_package = __commonJS({ + "../../../node_modules/@aws-sdk/client-sfn/package.json"(exports2, module2) { + module2.exports = { + name: "@aws-sdk/client-sfn", + description: "AWS SDK for JavaScript Sfn Client for Node.js, Browser and React Native", + version: "3.632.0", + scripts: { + build: "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'", + "build:cjs": "node ../../scripts/compilation/inline client-sfn", + "build:es": "tsc -p tsconfig.es.json", + "build:include:deps": "lerna run --scope $npm_package_name --include-dependencies build", + "build:types": "tsc -p tsconfig.types.json", + "build:types:downlevel": "downlevel-dts dist-types dist-types/ts3.4", + clean: "rimraf ./dist-* && rimraf *.tsbuildinfo", + "extract:docs": "api-extractor run --local", + "generate:client": "node ../../scripts/generate-clients/single-service --solo sfn" + }, + main: "./dist-cjs/index.js", + types: "./dist-types/index.d.ts", + module: "./dist-es/index.js", + sideEffects: false, + dependencies: { + "@aws-crypto/sha256-browser": "5.2.0", + "@aws-crypto/sha256-js": "5.2.0", + "@aws-sdk/client-sso-oidc": "3.632.0", + "@aws-sdk/client-sts": "3.632.0", + "@aws-sdk/core": "3.629.0", + "@aws-sdk/credential-provider-node": "3.632.0", + "@aws-sdk/middleware-host-header": "3.620.0", + "@aws-sdk/middleware-logger": "3.609.0", + "@aws-sdk/middleware-recursion-detection": "3.620.0", + "@aws-sdk/middleware-user-agent": "3.632.0", + "@aws-sdk/region-config-resolver": "3.614.0", + "@aws-sdk/types": "3.609.0", + "@aws-sdk/util-endpoints": "3.632.0", + "@aws-sdk/util-user-agent-browser": "3.609.0", + "@aws-sdk/util-user-agent-node": "3.614.0", + "@smithy/config-resolver": "^3.0.5", + "@smithy/core": "^2.3.2", + "@smithy/fetch-http-handler": "^3.2.4", + "@smithy/hash-node": "^3.0.3", + "@smithy/invalid-dependency": "^3.0.3", + "@smithy/middleware-content-length": "^3.0.5", + "@smithy/middleware-endpoint": "^3.1.0", + "@smithy/middleware-retry": "^3.0.14", + "@smithy/middleware-serde": "^3.0.3", + "@smithy/middleware-stack": "^3.0.3", + "@smithy/node-config-provider": "^3.1.4", + "@smithy/node-http-handler": "^3.1.4", + "@smithy/protocol-http": "^4.1.0", + "@smithy/smithy-client": "^3.1.12", + "@smithy/types": "^3.3.0", + "@smithy/url-parser": "^3.0.3", + "@smithy/util-base64": "^3.0.0", + "@smithy/util-body-length-browser": "^3.0.0", + "@smithy/util-body-length-node": "^3.0.0", + "@smithy/util-defaults-mode-browser": "^3.0.14", + "@smithy/util-defaults-mode-node": "^3.0.14", + "@smithy/util-endpoints": "^2.0.5", + "@smithy/util-middleware": "^3.0.3", + "@smithy/util-retry": "^3.0.3", + "@smithy/util-utf8": "^3.0.0", + tslib: "^2.6.2", + uuid: "^9.0.1" + }, + devDependencies: { + "@tsconfig/node16": "16.1.3", + "@types/node": "^16.18.96", + "@types/uuid": "^9.0.4", + concurrently: "7.0.0", + "downlevel-dts": "0.10.1", + rimraf: "3.0.2", + typescript: "~4.9.5" + }, + engines: { + node: ">=16.0.0" + }, + typesVersions: { + "<4.0": { + "dist-types/*": [ + "dist-types/ts3.4/*" + ] + } + }, + files: [ + "dist-*/**" + ], + author: { + name: "AWS SDK for JavaScript Team", + url: "https://aws.amazon.com/javascript/" + }, + license: "Apache-2.0", + browser: { + "./dist-es/runtimeConfig": "./dist-es/runtimeConfig.browser" + }, + "react-native": { + "./dist-es/runtimeConfig": "./dist-es/runtimeConfig.native" + }, + homepage: "https://github.com/aws/aws-sdk-js-v3/tree/main/clients/client-sfn", + repository: { + type: "git", + url: "https://github.com/aws/aws-sdk-js-v3.git", + directory: "clients/client-sfn" } }; - exports2.InvalidClientException = InvalidClientException; - var InvalidGrantException = class _InvalidGrantException extends SSOOIDCServiceException { - constructor(opts) { - super({ - name: "InvalidGrantException", - $fault: "client", - ...opts - }); - this.name = "InvalidGrantException"; - this.$fault = "client"; - Object.setPrototypeOf(this, _InvalidGrantException.prototype); - this.error = opts.error; - this.error_description = opts.error_description; - } + } +}); + +// ../../../node_modules/@aws-sdk/credential-provider-env/dist-cjs/index.js +var require_dist_cjs48 = __commonJS({ + "../../../node_modules/@aws-sdk/credential-provider-env/dist-cjs/index.js"(exports2, module2) { + "use strict"; + var __defProp2 = Object.defineProperty; + var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; + var __getOwnPropNames2 = Object.getOwnPropertyNames; + var __hasOwnProp2 = Object.prototype.hasOwnProperty; + var __name = (target, value) => __defProp2(target, "name", { value, configurable: true }); + var __export2 = (target, all) => { + for (var name in all) + __defProp2(target, name, { get: all[name], enumerable: true }); }; - var InvalidRequestException = class _InvalidRequestException extends SSOOIDCServiceException { - constructor(opts) { - super({ - name: "InvalidRequestException", - $fault: "client", - ...opts - }); - this.name = "InvalidRequestException"; - this.$fault = "client"; - Object.setPrototypeOf(this, _InvalidRequestException.prototype); - this.error = opts.error; - this.error_description = opts.error_description; + var __copyProps2 = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames2(from)) + if (!__hasOwnProp2.call(to, key) && key !== except) + __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable }); } + return to; }; - exports2.InvalidRequestException = InvalidRequestException; - var InvalidScopeException = class _InvalidScopeException extends SSOOIDCServiceException { - constructor(opts) { - super({ - name: "InvalidScopeException", - $fault: "client", - ...opts - }); - this.name = "InvalidScopeException"; - this.$fault = "client"; - Object.setPrototypeOf(this, _InvalidScopeException.prototype); - this.error = opts.error; - this.error_description = opts.error_description; + var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); + var src_exports = {}; + __export2(src_exports, { + ENV_ACCOUNT_ID: () => ENV_ACCOUNT_ID, + ENV_CREDENTIAL_SCOPE: () => ENV_CREDENTIAL_SCOPE, + ENV_EXPIRATION: () => ENV_EXPIRATION, + ENV_KEY: () => ENV_KEY, + ENV_SECRET: () => ENV_SECRET, + ENV_SESSION: () => ENV_SESSION, + fromEnv: () => fromEnv + }); + module2.exports = __toCommonJS2(src_exports); + var import_property_provider2 = require_dist_cjs40(); + var ENV_KEY = "AWS_ACCESS_KEY_ID"; + var ENV_SECRET = "AWS_SECRET_ACCESS_KEY"; + var ENV_SESSION = "AWS_SESSION_TOKEN"; + var ENV_EXPIRATION = "AWS_CREDENTIAL_EXPIRATION"; + var ENV_CREDENTIAL_SCOPE = "AWS_CREDENTIAL_SCOPE"; + var ENV_ACCOUNT_ID = "AWS_ACCOUNT_ID"; + var fromEnv = /* @__PURE__ */ __name((init) => async () => { + var _a; + (_a = init == null ? void 0 : init.logger) == null ? void 0 : _a.debug("@aws-sdk/credential-provider-env - fromEnv"); + const accessKeyId = process.env[ENV_KEY]; + const secretAccessKey = process.env[ENV_SECRET]; + const sessionToken = process.env[ENV_SESSION]; + const expiry = process.env[ENV_EXPIRATION]; + const credentialScope = process.env[ENV_CREDENTIAL_SCOPE]; + const accountId = process.env[ENV_ACCOUNT_ID]; + if (accessKeyId && secretAccessKey) { + return { + accessKeyId, + secretAccessKey, + ...sessionToken && { sessionToken }, + ...expiry && { expiration: new Date(expiry) }, + ...credentialScope && { credentialScope }, + ...accountId && { accountId } + }; } + throw new import_property_provider2.CredentialsProviderError("Unable to find environment variable credentials.", { logger: init == null ? void 0 : init.logger }); + }, "fromEnv"); + } +}); + +// ../../../node_modules/@smithy/credential-provider-imds/dist-cjs/index.js +var require_dist_cjs49 = __commonJS({ + "../../../node_modules/@smithy/credential-provider-imds/dist-cjs/index.js"(exports2, module2) { + var __defProp2 = Object.defineProperty; + var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; + var __getOwnPropNames2 = Object.getOwnPropertyNames; + var __hasOwnProp2 = Object.prototype.hasOwnProperty; + var __name = (target, value) => __defProp2(target, "name", { value, configurable: true }); + var __export2 = (target, all) => { + for (var name in all) + __defProp2(target, name, { get: all[name], enumerable: true }); }; - exports2.InvalidScopeException = InvalidScopeException; - var SlowDownException = class _SlowDownException extends SSOOIDCServiceException { - constructor(opts) { - super({ - name: "SlowDownException", - $fault: "client", - ...opts - }); - this.name = "SlowDownException"; - this.$fault = "client"; - Object.setPrototypeOf(this, _SlowDownException.prototype); - this.error = opts.error; - this.error_description = opts.error_description; + var __copyProps2 = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames2(from)) + if (!__hasOwnProp2.call(to, key) && key !== except) + __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable }); } + return to; }; - exports2.SlowDownException = SlowDownException; - var UnauthorizedClientException = class _UnauthorizedClientException extends SSOOIDCServiceException { - constructor(opts) { - super({ - name: "UnauthorizedClientException", - $fault: "client", - ...opts + var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); + var src_exports = {}; + __export2(src_exports, { + DEFAULT_MAX_RETRIES: () => DEFAULT_MAX_RETRIES, + DEFAULT_TIMEOUT: () => DEFAULT_TIMEOUT, + ENV_CMDS_AUTH_TOKEN: () => ENV_CMDS_AUTH_TOKEN, + ENV_CMDS_FULL_URI: () => ENV_CMDS_FULL_URI, + ENV_CMDS_RELATIVE_URI: () => ENV_CMDS_RELATIVE_URI, + Endpoint: () => Endpoint, + fromContainerMetadata: () => fromContainerMetadata, + fromInstanceMetadata: () => fromInstanceMetadata, + getInstanceMetadataEndpoint: () => getInstanceMetadataEndpoint, + httpRequest: () => httpRequest, + providerConfigFromInit: () => providerConfigFromInit + }); + module2.exports = __toCommonJS2(src_exports); + var import_url = require("url"); + var import_property_provider2 = require_dist_cjs40(); + var import_buffer = require("buffer"); + var import_http2 = require("http"); + function httpRequest(options) { + return new Promise((resolve, reject) => { + var _a; + const req = (0, import_http2.request)({ + method: "GET", + ...options, + // Node.js http module doesn't accept hostname with square brackets + // Refs: https://github.com/nodejs/node/issues/39738 + hostname: (_a = options.hostname) == null ? void 0 : _a.replace(/^\[(.+)\]$/, "$1") }); - this.name = "UnauthorizedClientException"; - this.$fault = "client"; - Object.setPrototypeOf(this, _UnauthorizedClientException.prototype); - this.error = opts.error; - this.error_description = opts.error_description; - } - }; - exports2.UnauthorizedClientException = UnauthorizedClientException; - var UnsupportedGrantTypeException = class _UnsupportedGrantTypeException extends SSOOIDCServiceException { - constructor(opts) { - super({ - name: "UnsupportedGrantTypeException", - $fault: "client", - ...opts + req.on("error", (err) => { + reject(Object.assign(new import_property_provider2.ProviderError("Unable to connect to instance metadata service"), err)); + req.destroy(); }); - this.name = "UnsupportedGrantTypeException"; - this.$fault = "client"; - Object.setPrototypeOf(this, _UnsupportedGrantTypeException.prototype); - this.error = opts.error; - this.error_description = opts.error_description; - } - }; - exports2.UnsupportedGrantTypeException = UnsupportedGrantTypeException; - var InvalidClientMetadataException = class _InvalidClientMetadataException extends SSOOIDCServiceException { - constructor(opts) { - super({ - name: "InvalidClientMetadataException", - $fault: "client", - ...opts + req.on("timeout", () => { + reject(new import_property_provider2.ProviderError("TimeoutError from instance metadata service")); + req.destroy(); }); - this.name = "InvalidClientMetadataException"; - this.$fault = "client"; - Object.setPrototypeOf(this, _InvalidClientMetadataException.prototype); - this.error = opts.error; - this.error_description = opts.error_description; - } - }; - var se_CreateTokenCommand = async (input, context) => { - const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); - const headers = { - "content-type": "application/json" - }; - const resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}/token`; - let body; - body = JSON.stringify((0, smithy_client_7.take)(input, { - clientId: [], - clientSecret: [], - code: [], - deviceCode: [], - grantType: [], - redirectUri: [], - refreshToken: [], - scope: (_) => (0, smithy_client_7._json)(_) - })); - return new protocol_http_1.HttpRequest({ - protocol, - hostname, - port, - method: "POST", - headers, - path: resolvedPath, - body - }); - }; - var se_RegisterClientCommand = async (input, context) => { - const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); - const headers = { - "content-type": "application/json" - }; - const resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}/client/register`; - let body; - body = JSON.stringify((0, smithy_client_7.take)(input, { - clientName: [], - clientType: [], - scopes: (_) => (0, smithy_client_7._json)(_) - })); - return new protocol_http_1.HttpRequest({ - protocol, - hostname, - port, - method: "POST", - headers, - path: resolvedPath, - body - }); - }; - var se_StartDeviceAuthorizationCommand = async (input, context) => { - const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); - const headers = { - "content-type": "application/json" - }; - const resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}/device_authorization`; - let body; - body = JSON.stringify((0, smithy_client_7.take)(input, { - clientId: [], - clientSecret: [], - startUrl: [] - })); - return new protocol_http_1.HttpRequest({ - protocol, - hostname, - port, - method: "POST", - headers, - path: resolvedPath, - body + req.on("response", (res) => { + const { statusCode = 400 } = res; + if (statusCode < 200 || 300 <= statusCode) { + reject( + Object.assign(new import_property_provider2.ProviderError("Error response received from instance metadata service"), { statusCode }) + ); + req.destroy(); + } + const chunks = []; + res.on("data", (chunk) => { + chunks.push(chunk); + }); + res.on("end", () => { + resolve(import_buffer.Buffer.concat(chunks)); + req.destroy(); + }); + }); + req.end(); }); - }; - var de_CreateTokenCommand = async (output, context) => { - if (output.statusCode !== 200 && output.statusCode >= 300) { - return de_CreateTokenCommandError(output, context); + } + __name(httpRequest, "httpRequest"); + var isImdsCredentials = /* @__PURE__ */ __name((arg) => Boolean(arg) && typeof arg === "object" && typeof arg.AccessKeyId === "string" && typeof arg.SecretAccessKey === "string" && typeof arg.Token === "string" && typeof arg.Expiration === "string", "isImdsCredentials"); + var fromImdsCredentials = /* @__PURE__ */ __name((creds) => ({ + accessKeyId: creds.AccessKeyId, + secretAccessKey: creds.SecretAccessKey, + sessionToken: creds.Token, + expiration: new Date(creds.Expiration), + ...creds.AccountId && { accountId: creds.AccountId } + }), "fromImdsCredentials"); + var DEFAULT_TIMEOUT = 1e3; + var DEFAULT_MAX_RETRIES = 0; + var providerConfigFromInit = /* @__PURE__ */ __name(({ + maxRetries = DEFAULT_MAX_RETRIES, + timeout = DEFAULT_TIMEOUT + }) => ({ maxRetries, timeout }), "providerConfigFromInit"); + var retry = /* @__PURE__ */ __name((toRetry, maxRetries) => { + let promise = toRetry(); + for (let i = 0; i < maxRetries; i++) { + promise = promise.catch(toRetry); } - const contents = (0, smithy_client_7.map)({ - $metadata: deserializeMetadata(output) - }); - const data = (0, smithy_client_7.expectNonNull)((0, smithy_client_7.expectObject)(await parseBody(output.body, context)), "body"); - const doc = (0, smithy_client_7.take)(data, { - accessToken: smithy_client_7.expectString, - expiresIn: smithy_client_7.expectInt32, - idToken: smithy_client_7.expectString, - refreshToken: smithy_client_7.expectString, - tokenType: smithy_client_7.expectString + return promise; + }, "retry"); + var ENV_CMDS_FULL_URI = "AWS_CONTAINER_CREDENTIALS_FULL_URI"; + var ENV_CMDS_RELATIVE_URI = "AWS_CONTAINER_CREDENTIALS_RELATIVE_URI"; + var ENV_CMDS_AUTH_TOKEN = "AWS_CONTAINER_AUTHORIZATION_TOKEN"; + var fromContainerMetadata = /* @__PURE__ */ __name((init = {}) => { + const { timeout, maxRetries } = providerConfigFromInit(init); + return () => retry(async () => { + const requestOptions = await getCmdsUri({ logger: init.logger }); + const credsResponse = JSON.parse(await requestFromEcsImds(timeout, requestOptions)); + if (!isImdsCredentials(credsResponse)) { + throw new import_property_provider2.CredentialsProviderError("Invalid response received from instance metadata service.", { + logger: init.logger + }); + } + return fromImdsCredentials(credsResponse); + }, maxRetries); + }, "fromContainerMetadata"); + var requestFromEcsImds = /* @__PURE__ */ __name(async (timeout, options) => { + if (process.env[ENV_CMDS_AUTH_TOKEN]) { + options.headers = { + ...options.headers, + Authorization: process.env[ENV_CMDS_AUTH_TOKEN] + }; + } + const buffer = await httpRequest({ + ...options, + timeout }); - Object.assign(contents, doc); - return contents; + return buffer.toString(); + }, "requestFromEcsImds"); + var CMDS_IP = "169.254.170.2"; + var GREENGRASS_HOSTS = { + localhost: true, + "127.0.0.1": true }; - var de_CreateTokenCommandError = async (output, context) => { - const parsedOutput = { - ...output, - body: await parseErrorBody(output.body, context) - }; - const errorCode = loadRestJsonErrorCode(output, parsedOutput.body); - switch (errorCode) { - case "AccessDeniedException": - case "com.amazonaws.ssooidc#AccessDeniedException": - throw await de_AccessDeniedExceptionRes(parsedOutput, context); - case "AuthorizationPendingException": - case "com.amazonaws.ssooidc#AuthorizationPendingException": - throw await de_AuthorizationPendingExceptionRes(parsedOutput, context); - case "ExpiredTokenException": - case "com.amazonaws.ssooidc#ExpiredTokenException": - throw await de_ExpiredTokenExceptionRes(parsedOutput, context); - case "InternalServerException": - case "com.amazonaws.ssooidc#InternalServerException": - throw await de_InternalServerExceptionRes(parsedOutput, context); - case "InvalidClientException": - case "com.amazonaws.ssooidc#InvalidClientException": - throw await de_InvalidClientExceptionRes(parsedOutput, context); - case "InvalidGrantException": - case "com.amazonaws.ssooidc#InvalidGrantException": - throw await de_InvalidGrantExceptionRes(parsedOutput, context); - case "InvalidRequestException": - case "com.amazonaws.ssooidc#InvalidRequestException": - throw await de_InvalidRequestExceptionRes(parsedOutput, context); - case "InvalidScopeException": - case "com.amazonaws.ssooidc#InvalidScopeException": - throw await de_InvalidScopeExceptionRes(parsedOutput, context); - case "SlowDownException": - case "com.amazonaws.ssooidc#SlowDownException": - throw await de_SlowDownExceptionRes(parsedOutput, context); - case "UnauthorizedClientException": - case "com.amazonaws.ssooidc#UnauthorizedClientException": - throw await de_UnauthorizedClientExceptionRes(parsedOutput, context); - case "UnsupportedGrantTypeException": - case "com.amazonaws.ssooidc#UnsupportedGrantTypeException": - throw await de_UnsupportedGrantTypeExceptionRes(parsedOutput, context); - default: - const parsedBody = parsedOutput.body; - return throwDefaultError({ - output, - parsedBody, - errorCode + var GREENGRASS_PROTOCOLS = { + "http:": true, + "https:": true + }; + var getCmdsUri = /* @__PURE__ */ __name(async ({ logger }) => { + if (process.env[ENV_CMDS_RELATIVE_URI]) { + return { + hostname: CMDS_IP, + path: process.env[ENV_CMDS_RELATIVE_URI] + }; + } + if (process.env[ENV_CMDS_FULL_URI]) { + const parsed = (0, import_url.parse)(process.env[ENV_CMDS_FULL_URI]); + if (!parsed.hostname || !(parsed.hostname in GREENGRASS_HOSTS)) { + throw new import_property_provider2.CredentialsProviderError(`${parsed.hostname} is not a valid container metadata service hostname`, { + tryNextLink: false, + logger + }); + } + if (!parsed.protocol || !(parsed.protocol in GREENGRASS_PROTOCOLS)) { + throw new import_property_provider2.CredentialsProviderError(`${parsed.protocol} is not a valid container metadata service protocol`, { + tryNextLink: false, + logger }); + } + return { + ...parsed, + port: parsed.port ? parseInt(parsed.port, 10) : void 0 + }; } - }; - var de_RegisterClientCommand = async (output, context) => { - if (output.statusCode !== 200 && output.statusCode >= 300) { - return de_RegisterClientCommandError(output, context); + throw new import_property_provider2.CredentialsProviderError( + `The container metadata credential provider cannot be used unless the ${ENV_CMDS_RELATIVE_URI} or ${ENV_CMDS_FULL_URI} environment variable is set`, + { + tryNextLink: false, + logger + } + ); + }, "getCmdsUri"); + var _InstanceMetadataV1FallbackError = class _InstanceMetadataV1FallbackError2 extends import_property_provider2.CredentialsProviderError { + constructor(message, tryNextLink = true) { + super(message, tryNextLink); + this.tryNextLink = tryNextLink; + this.name = "InstanceMetadataV1FallbackError"; + Object.setPrototypeOf(this, _InstanceMetadataV1FallbackError2.prototype); } - const contents = (0, smithy_client_7.map)({ - $metadata: deserializeMetadata(output) - }); - const data = (0, smithy_client_7.expectNonNull)((0, smithy_client_7.expectObject)(await parseBody(output.body, context)), "body"); - const doc = (0, smithy_client_7.take)(data, { - authorizationEndpoint: smithy_client_7.expectString, - clientId: smithy_client_7.expectString, - clientIdIssuedAt: smithy_client_7.expectLong, - clientSecret: smithy_client_7.expectString, - clientSecretExpiresAt: smithy_client_7.expectLong, - tokenEndpoint: smithy_client_7.expectString - }); - Object.assign(contents, doc); - return contents; }; - var de_RegisterClientCommandError = async (output, context) => { - const parsedOutput = { - ...output, - body: await parseErrorBody(output.body, context) - }; - const errorCode = loadRestJsonErrorCode(output, parsedOutput.body); - switch (errorCode) { - case "InternalServerException": - case "com.amazonaws.ssooidc#InternalServerException": - throw await de_InternalServerExceptionRes(parsedOutput, context); - case "InvalidClientMetadataException": - case "com.amazonaws.ssooidc#InvalidClientMetadataException": - throw await de_InvalidClientMetadataExceptionRes(parsedOutput, context); - case "InvalidRequestException": - case "com.amazonaws.ssooidc#InvalidRequestException": - throw await de_InvalidRequestExceptionRes(parsedOutput, context); - case "InvalidScopeException": - case "com.amazonaws.ssooidc#InvalidScopeException": - throw await de_InvalidScopeExceptionRes(parsedOutput, context); - default: - const parsedBody = parsedOutput.body; - return throwDefaultError({ - output, - parsedBody, - errorCode - }); - } + __name(_InstanceMetadataV1FallbackError, "InstanceMetadataV1FallbackError"); + var InstanceMetadataV1FallbackError = _InstanceMetadataV1FallbackError; + var import_node_config_provider = require_dist_cjs42(); + var import_url_parser = require_dist_cjs44(); + var Endpoint = /* @__PURE__ */ ((Endpoint2) => { + Endpoint2["IPv4"] = "http://169.254.169.254"; + Endpoint2["IPv6"] = "http://[fd00:ec2::254]"; + return Endpoint2; + })(Endpoint || {}); + var ENV_ENDPOINT_NAME = "AWS_EC2_METADATA_SERVICE_ENDPOINT"; + var CONFIG_ENDPOINT_NAME = "ec2_metadata_service_endpoint"; + var ENDPOINT_CONFIG_OPTIONS = { + environmentVariableSelector: (env) => env[ENV_ENDPOINT_NAME], + configFileSelector: (profile) => profile[CONFIG_ENDPOINT_NAME], + default: void 0 }; - var de_StartDeviceAuthorizationCommand = async (output, context) => { - if (output.statusCode !== 200 && output.statusCode >= 300) { - return de_StartDeviceAuthorizationCommandError(output, context); - } - const contents = (0, smithy_client_7.map)({ - $metadata: deserializeMetadata(output) - }); - const data = (0, smithy_client_7.expectNonNull)((0, smithy_client_7.expectObject)(await parseBody(output.body, context)), "body"); - const doc = (0, smithy_client_7.take)(data, { - deviceCode: smithy_client_7.expectString, - expiresIn: smithy_client_7.expectInt32, - interval: smithy_client_7.expectInt32, - userCode: smithy_client_7.expectString, - verificationUri: smithy_client_7.expectString, - verificationUriComplete: smithy_client_7.expectString - }); - Object.assign(contents, doc); - return contents; + var EndpointMode = /* @__PURE__ */ ((EndpointMode2) => { + EndpointMode2["IPv4"] = "IPv4"; + EndpointMode2["IPv6"] = "IPv6"; + return EndpointMode2; + })(EndpointMode || {}); + var ENV_ENDPOINT_MODE_NAME = "AWS_EC2_METADATA_SERVICE_ENDPOINT_MODE"; + var CONFIG_ENDPOINT_MODE_NAME = "ec2_metadata_service_endpoint_mode"; + var ENDPOINT_MODE_CONFIG_OPTIONS = { + environmentVariableSelector: (env) => env[ENV_ENDPOINT_MODE_NAME], + configFileSelector: (profile) => profile[CONFIG_ENDPOINT_MODE_NAME], + default: "IPv4" + /* IPv4 */ }; - var de_StartDeviceAuthorizationCommandError = async (output, context) => { - const parsedOutput = { - ...output, - body: await parseErrorBody(output.body, context) - }; - const errorCode = loadRestJsonErrorCode(output, parsedOutput.body); - switch (errorCode) { - case "InternalServerException": - case "com.amazonaws.ssooidc#InternalServerException": - throw await de_InternalServerExceptionRes(parsedOutput, context); - case "InvalidClientException": - case "com.amazonaws.ssooidc#InvalidClientException": - throw await de_InvalidClientExceptionRes(parsedOutput, context); - case "InvalidRequestException": - case "com.amazonaws.ssooidc#InvalidRequestException": - throw await de_InvalidRequestExceptionRes(parsedOutput, context); - case "SlowDownException": - case "com.amazonaws.ssooidc#SlowDownException": - throw await de_SlowDownExceptionRes(parsedOutput, context); - case "UnauthorizedClientException": - case "com.amazonaws.ssooidc#UnauthorizedClientException": - throw await de_UnauthorizedClientExceptionRes(parsedOutput, context); + var getInstanceMetadataEndpoint = /* @__PURE__ */ __name(async () => (0, import_url_parser.parseUrl)(await getFromEndpointConfig() || await getFromEndpointModeConfig()), "getInstanceMetadataEndpoint"); + var getFromEndpointConfig = /* @__PURE__ */ __name(async () => (0, import_node_config_provider.loadConfig)(ENDPOINT_CONFIG_OPTIONS)(), "getFromEndpointConfig"); + var getFromEndpointModeConfig = /* @__PURE__ */ __name(async () => { + const endpointMode = await (0, import_node_config_provider.loadConfig)(ENDPOINT_MODE_CONFIG_OPTIONS)(); + switch (endpointMode) { + case "IPv4": + return "http://169.254.169.254"; + case "IPv6": + return "http://[fd00:ec2::254]"; default: - const parsedBody = parsedOutput.body; - return throwDefaultError({ - output, - parsedBody, - errorCode + throw new Error(`Unsupported endpoint mode: ${endpointMode}. Select from ${Object.values(EndpointMode)}`); + } + }, "getFromEndpointModeConfig"); + var STATIC_STABILITY_REFRESH_INTERVAL_SECONDS = 5 * 60; + var STATIC_STABILITY_REFRESH_INTERVAL_JITTER_WINDOW_SECONDS = 5 * 60; + var STATIC_STABILITY_DOC_URL = "https://docs.aws.amazon.com/sdkref/latest/guide/feature-static-credentials.html"; + var getExtendedInstanceMetadataCredentials = /* @__PURE__ */ __name((credentials, logger) => { + const refreshInterval = STATIC_STABILITY_REFRESH_INTERVAL_SECONDS + Math.floor(Math.random() * STATIC_STABILITY_REFRESH_INTERVAL_JITTER_WINDOW_SECONDS); + const newExpiration = new Date(Date.now() + refreshInterval * 1e3); + logger.warn( + `Attempting credential expiration extension due to a credential service availability issue. A refresh of these credentials will be attempted after ${new Date(newExpiration)}. +For more information, please visit: ` + STATIC_STABILITY_DOC_URL + ); + const originalExpiration = credentials.originalExpiration ?? credentials.expiration; + return { + ...credentials, + ...originalExpiration ? { originalExpiration } : {}, + expiration: newExpiration + }; + }, "getExtendedInstanceMetadataCredentials"); + var staticStabilityProvider = /* @__PURE__ */ __name((provider, options = {}) => { + const logger = (options == null ? void 0 : options.logger) || console; + let pastCredentials; + return async () => { + let credentials; + try { + credentials = await provider(); + if (credentials.expiration && credentials.expiration.getTime() < Date.now()) { + credentials = getExtendedInstanceMetadataCredentials(credentials, logger); + } + } catch (e) { + if (pastCredentials) { + logger.warn("Credential renew failed: ", e); + credentials = getExtendedInstanceMetadataCredentials(pastCredentials, logger); + } else { + throw e; + } + } + pastCredentials = credentials; + return credentials; + }; + }, "staticStabilityProvider"); + var IMDS_PATH = "/latest/meta-data/iam/security-credentials/"; + var IMDS_TOKEN_PATH = "/latest/api/token"; + var AWS_EC2_METADATA_V1_DISABLED = "AWS_EC2_METADATA_V1_DISABLED"; + var PROFILE_AWS_EC2_METADATA_V1_DISABLED = "ec2_metadata_v1_disabled"; + var X_AWS_EC2_METADATA_TOKEN = "x-aws-ec2-metadata-token"; + var fromInstanceMetadata = /* @__PURE__ */ __name((init = {}) => staticStabilityProvider(getInstanceMetadataProvider(init), { logger: init.logger }), "fromInstanceMetadata"); + var getInstanceMetadataProvider = /* @__PURE__ */ __name((init = {}) => { + let disableFetchToken = false; + const { logger, profile } = init; + const { timeout, maxRetries } = providerConfigFromInit(init); + const getCredentials = /* @__PURE__ */ __name(async (maxRetries2, options) => { + var _a; + const isImdsV1Fallback = disableFetchToken || ((_a = options.headers) == null ? void 0 : _a[X_AWS_EC2_METADATA_TOKEN]) == null; + if (isImdsV1Fallback) { + let fallbackBlockedFromProfile = false; + let fallbackBlockedFromProcessEnv = false; + const configValue = await (0, import_node_config_provider.loadConfig)( + { + environmentVariableSelector: (env) => { + const envValue = env[AWS_EC2_METADATA_V1_DISABLED]; + fallbackBlockedFromProcessEnv = !!envValue && envValue !== "false"; + if (envValue === void 0) { + throw new import_property_provider2.CredentialsProviderError( + `${AWS_EC2_METADATA_V1_DISABLED} not set in env, checking config file next.`, + { logger: init.logger } + ); + } + return fallbackBlockedFromProcessEnv; + }, + configFileSelector: (profile2) => { + const profileValue = profile2[PROFILE_AWS_EC2_METADATA_V1_DISABLED]; + fallbackBlockedFromProfile = !!profileValue && profileValue !== "false"; + return fallbackBlockedFromProfile; + }, + default: false + }, + { + profile + } + )(); + if (init.ec2MetadataV1Disabled || configValue) { + const causes = []; + if (init.ec2MetadataV1Disabled) + causes.push("credential provider initialization (runtime option ec2MetadataV1Disabled)"); + if (fallbackBlockedFromProfile) + causes.push(`config file profile (${PROFILE_AWS_EC2_METADATA_V1_DISABLED})`); + if (fallbackBlockedFromProcessEnv) + causes.push(`process environment variable (${AWS_EC2_METADATA_V1_DISABLED})`); + throw new InstanceMetadataV1FallbackError( + `AWS EC2 Metadata v1 fallback has been blocked by AWS SDK configuration in the following: [${causes.join( + ", " + )}].` + ); + } + } + const imdsProfile = (await retry(async () => { + let profile2; + try { + profile2 = await getProfile(options); + } catch (err) { + if (err.statusCode === 401) { + disableFetchToken = false; + } + throw err; + } + return profile2; + }, maxRetries2)).trim(); + return retry(async () => { + let creds; + try { + creds = await getCredentialsFromProfile(imdsProfile, options, init); + } catch (err) { + if (err.statusCode === 401) { + disableFetchToken = false; + } + throw err; + } + return creds; + }, maxRetries2); + }, "getCredentials"); + return async () => { + const endpoint = await getInstanceMetadataEndpoint(); + if (disableFetchToken) { + logger == null ? void 0 : logger.debug("AWS SDK Instance Metadata", "using v1 fallback (no token fetch)"); + return getCredentials(maxRetries, { ...endpoint, timeout }); + } else { + let token; + try { + token = (await getMetadataToken({ ...endpoint, timeout })).toString(); + } catch (error) { + if ((error == null ? void 0 : error.statusCode) === 400) { + throw Object.assign(error, { + message: "EC2 Metadata token request returned error" + }); + } else if (error.message === "TimeoutError" || [403, 404, 405].includes(error.statusCode)) { + disableFetchToken = true; + } + logger == null ? void 0 : logger.debug("AWS SDK Instance Metadata", "using v1 fallback (initial)"); + return getCredentials(maxRetries, { ...endpoint, timeout }); + } + return getCredentials(maxRetries, { + ...endpoint, + headers: { + [X_AWS_EC2_METADATA_TOKEN]: token + }, + timeout }); - } - }; - var throwDefaultError = (0, smithy_client_7.withBaseException)(SSOOIDCServiceException); - var de_AccessDeniedExceptionRes = async (parsedOutput, context) => { - const contents = (0, smithy_client_7.map)({}); - const data = parsedOutput.body; - const doc = (0, smithy_client_7.take)(data, { - error: smithy_client_7.expectString, - error_description: smithy_client_7.expectString - }); - Object.assign(contents, doc); - const exception = new AccessDeniedException({ - $metadata: deserializeMetadata(parsedOutput), - ...contents - }); - return (0, smithy_client_7.decorateServiceException)(exception, parsedOutput.body); - }; - var de_AuthorizationPendingExceptionRes = async (parsedOutput, context) => { - const contents = (0, smithy_client_7.map)({}); - const data = parsedOutput.body; - const doc = (0, smithy_client_7.take)(data, { - error: smithy_client_7.expectString, - error_description: smithy_client_7.expectString - }); - Object.assign(contents, doc); - const exception = new AuthorizationPendingException({ - $metadata: deserializeMetadata(parsedOutput), - ...contents - }); - return (0, smithy_client_7.decorateServiceException)(exception, parsedOutput.body); - }; - var de_ExpiredTokenExceptionRes = async (parsedOutput, context) => { - const contents = (0, smithy_client_7.map)({}); - const data = parsedOutput.body; - const doc = (0, smithy_client_7.take)(data, { - error: smithy_client_7.expectString, - error_description: smithy_client_7.expectString - }); - Object.assign(contents, doc); - const exception = new ExpiredTokenException({ - $metadata: deserializeMetadata(parsedOutput), - ...contents - }); - return (0, smithy_client_7.decorateServiceException)(exception, parsedOutput.body); - }; - var de_InternalServerExceptionRes = async (parsedOutput, context) => { - const contents = (0, smithy_client_7.map)({}); - const data = parsedOutput.body; - const doc = (0, smithy_client_7.take)(data, { - error: smithy_client_7.expectString, - error_description: smithy_client_7.expectString - }); - Object.assign(contents, doc); - const exception = new InternalServerException({ - $metadata: deserializeMetadata(parsedOutput), - ...contents - }); - return (0, smithy_client_7.decorateServiceException)(exception, parsedOutput.body); - }; - var de_InvalidClientExceptionRes = async (parsedOutput, context) => { - const contents = (0, smithy_client_7.map)({}); - const data = parsedOutput.body; - const doc = (0, smithy_client_7.take)(data, { - error: smithy_client_7.expectString, - error_description: smithy_client_7.expectString - }); - Object.assign(contents, doc); - const exception = new InvalidClientException({ - $metadata: deserializeMetadata(parsedOutput), - ...contents - }); - return (0, smithy_client_7.decorateServiceException)(exception, parsedOutput.body); - }; - var de_InvalidClientMetadataExceptionRes = async (parsedOutput, context) => { - const contents = (0, smithy_client_7.map)({}); - const data = parsedOutput.body; - const doc = (0, smithy_client_7.take)(data, { - error: smithy_client_7.expectString, - error_description: smithy_client_7.expectString - }); - Object.assign(contents, doc); - const exception = new InvalidClientMetadataException({ - $metadata: deserializeMetadata(parsedOutput), - ...contents - }); - return (0, smithy_client_7.decorateServiceException)(exception, parsedOutput.body); - }; - var de_InvalidGrantExceptionRes = async (parsedOutput, context) => { - const contents = (0, smithy_client_7.map)({}); - const data = parsedOutput.body; - const doc = (0, smithy_client_7.take)(data, { - error: smithy_client_7.expectString, - error_description: smithy_client_7.expectString - }); - Object.assign(contents, doc); - const exception = new InvalidGrantException({ - $metadata: deserializeMetadata(parsedOutput), - ...contents - }); - return (0, smithy_client_7.decorateServiceException)(exception, parsedOutput.body); - }; - var de_InvalidRequestExceptionRes = async (parsedOutput, context) => { - const contents = (0, smithy_client_7.map)({}); - const data = parsedOutput.body; - const doc = (0, smithy_client_7.take)(data, { - error: smithy_client_7.expectString, - error_description: smithy_client_7.expectString - }); - Object.assign(contents, doc); - const exception = new InvalidRequestException({ - $metadata: deserializeMetadata(parsedOutput), - ...contents - }); - return (0, smithy_client_7.decorateServiceException)(exception, parsedOutput.body); - }; - var de_InvalidScopeExceptionRes = async (parsedOutput, context) => { - const contents = (0, smithy_client_7.map)({}); - const data = parsedOutput.body; - const doc = (0, smithy_client_7.take)(data, { - error: smithy_client_7.expectString, - error_description: smithy_client_7.expectString - }); - Object.assign(contents, doc); - const exception = new InvalidScopeException({ - $metadata: deserializeMetadata(parsedOutput), - ...contents - }); - return (0, smithy_client_7.decorateServiceException)(exception, parsedOutput.body); - }; - var de_SlowDownExceptionRes = async (parsedOutput, context) => { - const contents = (0, smithy_client_7.map)({}); - const data = parsedOutput.body; - const doc = (0, smithy_client_7.take)(data, { - error: smithy_client_7.expectString, - error_description: smithy_client_7.expectString - }); - Object.assign(contents, doc); - const exception = new SlowDownException({ - $metadata: deserializeMetadata(parsedOutput), - ...contents - }); - return (0, smithy_client_7.decorateServiceException)(exception, parsedOutput.body); - }; - var de_UnauthorizedClientExceptionRes = async (parsedOutput, context) => { - const contents = (0, smithy_client_7.map)({}); - const data = parsedOutput.body; - const doc = (0, smithy_client_7.take)(data, { - error: smithy_client_7.expectString, - error_description: smithy_client_7.expectString - }); - Object.assign(contents, doc); - const exception = new UnauthorizedClientException({ - $metadata: deserializeMetadata(parsedOutput), - ...contents - }); - return (0, smithy_client_7.decorateServiceException)(exception, parsedOutput.body); - }; - var de_UnsupportedGrantTypeExceptionRes = async (parsedOutput, context) => { - const contents = (0, smithy_client_7.map)({}); - const data = parsedOutput.body; - const doc = (0, smithy_client_7.take)(data, { - error: smithy_client_7.expectString, - error_description: smithy_client_7.expectString - }); - Object.assign(contents, doc); - const exception = new UnsupportedGrantTypeException({ - $metadata: deserializeMetadata(parsedOutput), - ...contents - }); - return (0, smithy_client_7.decorateServiceException)(exception, parsedOutput.body); - }; - var deserializeMetadata = (output) => { - var _a, _b; - return { - httpStatusCode: output.statusCode, - requestId: (_b = (_a = output.headers["x-amzn-requestid"]) !== null && _a !== void 0 ? _a : output.headers["x-amzn-request-id"]) !== null && _b !== void 0 ? _b : output.headers["x-amz-request-id"], - extendedRequestId: output.headers["x-amz-id-2"], - cfId: output.headers["x-amz-cf-id"] + } }; + }, "getInstanceMetadataProvider"); + var getMetadataToken = /* @__PURE__ */ __name(async (options) => httpRequest({ + ...options, + path: IMDS_TOKEN_PATH, + method: "PUT", + headers: { + "x-aws-ec2-metadata-token-ttl-seconds": "21600" + } + }), "getMetadataToken"); + var getProfile = /* @__PURE__ */ __name(async (options) => (await httpRequest({ ...options, path: IMDS_PATH })).toString(), "getProfile"); + var getCredentialsFromProfile = /* @__PURE__ */ __name(async (profile, options, init) => { + const credentialsResponse = JSON.parse( + (await httpRequest({ + ...options, + path: IMDS_PATH + profile + })).toString() + ); + if (!isImdsCredentials(credentialsResponse)) { + throw new import_property_provider2.CredentialsProviderError("Invalid response received from instance metadata service.", { + logger: init.logger + }); + } + return fromImdsCredentials(credentialsResponse); + }, "getCredentialsFromProfile"); + } +}); + +// ../../../node_modules/@smithy/node-http-handler/node_modules/@smithy/querystring-builder/dist-cjs/index.js +var require_dist_cjs50 = __commonJS({ + "../../../node_modules/@smithy/node-http-handler/node_modules/@smithy/querystring-builder/dist-cjs/index.js"(exports2, module2) { + var __defProp2 = Object.defineProperty; + var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; + var __getOwnPropNames2 = Object.getOwnPropertyNames; + var __hasOwnProp2 = Object.prototype.hasOwnProperty; + var __name = (target, value) => __defProp2(target, "name", { value, configurable: true }); + var __export2 = (target, all) => { + for (var name in all) + __defProp2(target, name, { get: all[name], enumerable: true }); }; - var collectBodyString = (streamBody, context) => (0, smithy_client_7.collectBody)(streamBody, context).then((body) => context.utf8Encoder(body)); - var parseBody = (streamBody, context) => collectBodyString(streamBody, context).then((encoded) => { - if (encoded.length) { - return JSON.parse(encoded); + var __copyProps2 = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames2(from)) + if (!__hasOwnProp2.call(to, key) && key !== except) + __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable }); } - return {}; - }); - var parseErrorBody = async (errorBody, context) => { - var _a; - const value = await parseBody(errorBody, context); - value.message = (_a = value.message) !== null && _a !== void 0 ? _a : value.Message; - return value; + return to; }; - var loadRestJsonErrorCode = (output, data) => { - const findKey = (object, key) => Object.keys(object).find((k2) => k2.toLowerCase() === key.toLowerCase()); - const sanitizeErrorCode = (rawValue) => { - let cleanValue = rawValue; - if (typeof cleanValue === "number") { - cleanValue = cleanValue.toString(); - } - if (cleanValue.indexOf(",") >= 0) { - cleanValue = cleanValue.split(",")[0]; - } - if (cleanValue.indexOf(":") >= 0) { - cleanValue = cleanValue.split(":")[0]; - } - if (cleanValue.indexOf("#") >= 0) { - cleanValue = cleanValue.split("#")[1]; + var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); + var src_exports = {}; + __export2(src_exports, { + buildQueryString: () => buildQueryString + }); + module2.exports = __toCommonJS2(src_exports); + var import_util_uri_escape = require_dist_cjs31(); + function buildQueryString(query) { + const parts = []; + for (let key of Object.keys(query).sort()) { + const value = query[key]; + key = (0, import_util_uri_escape.escapeUri)(key); + if (Array.isArray(value)) { + for (let i = 0, iLen = value.length; i < iLen; i++) { + parts.push(`${key}=${(0, import_util_uri_escape.escapeUri)(value[i])}`); + } + } else { + let qsEntry = key; + if (value || typeof value === "string") { + qsEntry += `=${(0, import_util_uri_escape.escapeUri)(value)}`; + } + parts.push(qsEntry); } - return cleanValue; - }; - const headerKey = findKey(output.headers, "x-amzn-errortype"); - if (headerKey !== void 0) { - return sanitizeErrorCode(output.headers[headerKey]); - } - if (data.code !== void 0) { - return sanitizeErrorCode(data.code); } - if (data["__type"] !== void 0) { - return sanitizeErrorCode(data["__type"]); + return parts.join("&"); + } + __name(buildQueryString, "buildQueryString"); + } +}); + +// ../../../node_modules/@smithy/node-http-handler/dist-cjs/index.js +var require_dist_cjs51 = __commonJS({ + "../../../node_modules/@smithy/node-http-handler/dist-cjs/index.js"(exports2, module2) { + var __create2 = Object.create; + var __defProp2 = Object.defineProperty; + var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; + var __getOwnPropNames2 = Object.getOwnPropertyNames; + var __getProtoOf2 = Object.getPrototypeOf; + var __hasOwnProp2 = Object.prototype.hasOwnProperty; + var __name = (target, value) => __defProp2(target, "name", { value, configurable: true }); + var __export2 = (target, all) => { + for (var name in all) + __defProp2(target, name, { get: all[name], enumerable: true }); + }; + var __copyProps2 = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames2(from)) + if (!__hasOwnProp2.call(to, key) && key !== except) + __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable }); } + return to; }; - var CreateTokenCommand = class _CreateTokenCommand extends smithy_client_6.Command { - constructor(input) { - super(); - this.input = input; + var __toESM2 = (mod, isNodeMode, target) => (target = mod != null ? __create2(__getProtoOf2(mod)) : {}, __copyProps2( + // If the importer is in node compatibility mode or this is not an ESM + // file that has been converted to a CommonJS file using a Babel- + // compatible transform (i.e. "__esModule" has not been set), then set + // "default" to the CommonJS "module.exports" for node compatibility. + isNodeMode || !mod || !mod.__esModule ? __defProp2(target, "default", { value: mod, enumerable: true }) : target, + mod + )); + var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); + var src_exports = {}; + __export2(src_exports, { + DEFAULT_REQUEST_TIMEOUT: () => DEFAULT_REQUEST_TIMEOUT, + NodeHttp2Handler: () => NodeHttp2Handler, + NodeHttpHandler: () => NodeHttpHandler, + streamCollector: () => streamCollector + }); + module2.exports = __toCommonJS2(src_exports); + var import_protocol_http8 = require_dist_cjs2(); + var import_querystring_builder = require_dist_cjs50(); + var import_http2 = require("http"); + var import_https = require("https"); + var NODEJS_TIMEOUT_ERROR_CODES = ["ECONNRESET", "EPIPE", "ETIMEDOUT"]; + var getTransformedHeaders = /* @__PURE__ */ __name((headers) => { + const transformedHeaders = {}; + for (const name of Object.keys(headers)) { + const headerValues = headers[name]; + transformedHeaders[name] = Array.isArray(headerValues) ? headerValues.join(",") : headerValues; + } + return transformedHeaders; + }, "getTransformedHeaders"); + var DEFER_EVENT_LISTENER_TIME = 1e3; + var setConnectionTimeout = /* @__PURE__ */ __name((request2, reject, timeoutInMs = 0) => { + if (!timeoutInMs) { + return -1; + } + const registerTimeout = /* @__PURE__ */ __name((offset) => { + const timeoutId = setTimeout(() => { + request2.destroy(); + reject( + Object.assign(new Error(`Socket timed out without establishing a connection within ${timeoutInMs} ms`), { + name: "TimeoutError" + }) + ); + }, timeoutInMs - offset); + const doWithSocket = /* @__PURE__ */ __name((socket) => { + if (socket == null ? void 0 : socket.connecting) { + socket.on("connect", () => { + clearTimeout(timeoutId); + }); + } else { + clearTimeout(timeoutId); + } + }, "doWithSocket"); + if (request2.socket) { + doWithSocket(request2.socket); + } else { + request2.on("socket", doWithSocket); + } + }, "registerTimeout"); + if (timeoutInMs < 2e3) { + registerTimeout(0); + return 0; } - static getEndpointParameterInstructions() { - return { - UseFIPS: { type: "builtInParams", name: "useFipsEndpoint" }, - Endpoint: { type: "builtInParams", name: "endpoint" }, - Region: { type: "builtInParams", name: "region" }, - UseDualStack: { type: "builtInParams", name: "useDualstackEndpoint" } - }; + return setTimeout(registerTimeout.bind(null, DEFER_EVENT_LISTENER_TIME), DEFER_EVENT_LISTENER_TIME); + }, "setConnectionTimeout"); + var DEFER_EVENT_LISTENER_TIME2 = 3e3; + var setSocketKeepAlive = /* @__PURE__ */ __name((request2, { keepAlive, keepAliveMsecs }, deferTimeMs = DEFER_EVENT_LISTENER_TIME2) => { + if (keepAlive !== true) { + return -1; } - resolveMiddleware(clientStack, configuration, options) { - this.middlewareStack.use((0, middleware_serde_1.getSerdePlugin)(configuration, this.serialize, this.deserialize)); - this.middlewareStack.use((0, middleware_endpoint_2.getEndpointPlugin)(configuration, _CreateTokenCommand.getEndpointParameterInstructions())); - const stack = clientStack.concat(this.middlewareStack); - const { logger } = configuration; - const clientName = "SSOOIDCClient"; - const commandName = "CreateTokenCommand"; - const handlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: (_) => _, - outputFilterSensitiveLog: (_) => _ - }; - const { requestHandler } = configuration; - return stack.resolve((request2) => requestHandler.handle(request2.request, options || {}), handlerExecutionContext); + const registerListener = /* @__PURE__ */ __name(() => { + if (request2.socket) { + request2.socket.setKeepAlive(keepAlive, keepAliveMsecs || 0); + } else { + request2.on("socket", (socket) => { + socket.setKeepAlive(keepAlive, keepAliveMsecs || 0); + }); + } + }, "registerListener"); + if (deferTimeMs === 0) { + registerListener(); + return 0; } - serialize(input, context) { - return se_CreateTokenCommand(input, context); + return setTimeout(registerListener, deferTimeMs); + }, "setSocketKeepAlive"); + var DEFER_EVENT_LISTENER_TIME3 = 3e3; + var setSocketTimeout = /* @__PURE__ */ __name((request2, reject, timeoutInMs = 0) => { + const registerTimeout = /* @__PURE__ */ __name((offset) => { + request2.setTimeout(timeoutInMs - offset, () => { + request2.destroy(); + reject(Object.assign(new Error(`Connection timed out after ${timeoutInMs} ms`), { name: "TimeoutError" })); + }); + }, "registerTimeout"); + if (0 < timeoutInMs && timeoutInMs < 6e3) { + registerTimeout(0); + return 0; } - deserialize(output, context) { - return de_CreateTokenCommand(output, context); + return setTimeout( + registerTimeout.bind(null, timeoutInMs === 0 ? 0 : DEFER_EVENT_LISTENER_TIME3), + DEFER_EVENT_LISTENER_TIME3 + ); + }, "setSocketTimeout"); + var import_stream = require("stream"); + var MIN_WAIT_TIME = 1e3; + async function writeRequestBody(httpRequest, request2, maxContinueTimeoutMs = MIN_WAIT_TIME) { + const headers = request2.headers ?? {}; + const expect = headers["Expect"] || headers["expect"]; + let timeoutId = -1; + let hasError = false; + if (expect === "100-continue") { + await Promise.race([ + new Promise((resolve) => { + timeoutId = Number(setTimeout(resolve, Math.max(MIN_WAIT_TIME, maxContinueTimeoutMs))); + }), + new Promise((resolve) => { + httpRequest.on("continue", () => { + clearTimeout(timeoutId); + resolve(); + }); + httpRequest.on("error", () => { + hasError = true; + clearTimeout(timeoutId); + resolve(); + }); + }) + ]); } - }; - exports2.CreateTokenCommand = CreateTokenCommand; - var middleware_endpoint_3 = require_dist_cjs26(); - var middleware_serde_2 = require_dist_cjs25(); - var smithy_client_9 = require_dist_cjs34(); - var RegisterClientCommand = class _RegisterClientCommand extends smithy_client_9.Command { - constructor(input) { - super(); - this.input = input; + if (!hasError) { + writeBody(httpRequest, request2.body); } - static getEndpointParameterInstructions() { - return { - UseFIPS: { type: "builtInParams", name: "useFipsEndpoint" }, - Endpoint: { type: "builtInParams", name: "endpoint" }, - Region: { type: "builtInParams", name: "region" }, - UseDualStack: { type: "builtInParams", name: "useDualstackEndpoint" } - }; + } + __name(writeRequestBody, "writeRequestBody"); + function writeBody(httpRequest, body) { + if (body instanceof import_stream.Readable) { + body.pipe(httpRequest); + return; } - resolveMiddleware(clientStack, configuration, options) { - this.middlewareStack.use((0, middleware_serde_2.getSerdePlugin)(configuration, this.serialize, this.deserialize)); - this.middlewareStack.use((0, middleware_endpoint_3.getEndpointPlugin)(configuration, _RegisterClientCommand.getEndpointParameterInstructions())); - const stack = clientStack.concat(this.middlewareStack); - const { logger } = configuration; - const clientName = "SSOOIDCClient"; - const commandName = "RegisterClientCommand"; - const handlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: (_) => _, - outputFilterSensitiveLog: (_) => _ - }; - const { requestHandler } = configuration; - return stack.resolve((request2) => requestHandler.handle(request2.request, options || {}), handlerExecutionContext); + if (body) { + if (Buffer.isBuffer(body) || typeof body === "string") { + httpRequest.end(body); + return; + } + const uint8 = body; + if (typeof uint8 === "object" && uint8.buffer && typeof uint8.byteOffset === "number" && typeof uint8.byteLength === "number") { + httpRequest.end(Buffer.from(uint8.buffer, uint8.byteOffset, uint8.byteLength)); + return; + } + httpRequest.end(Buffer.from(body)); + return; } - serialize(input, context) { - return se_RegisterClientCommand(input, context); + httpRequest.end(); + } + __name(writeBody, "writeBody"); + var DEFAULT_REQUEST_TIMEOUT = 0; + var _NodeHttpHandler = class _NodeHttpHandler2 { + constructor(options) { + this.socketWarningTimestamp = 0; + this.metadata = { handlerProtocol: "http/1.1" }; + this.configProvider = new Promise((resolve, reject) => { + if (typeof options === "function") { + options().then((_options) => { + resolve(this.resolveDefaultConfig(_options)); + }).catch(reject); + } else { + resolve(this.resolveDefaultConfig(options)); + } + }); } - deserialize(output, context) { - return de_RegisterClientCommand(output, context); + /** + * @returns the input if it is an HttpHandler of any class, + * or instantiates a new instance of this handler. + */ + static create(instanceOrOptions) { + if (typeof (instanceOrOptions == null ? void 0 : instanceOrOptions.handle) === "function") { + return instanceOrOptions; + } + return new _NodeHttpHandler2(instanceOrOptions); } - }; - var middleware_endpoint_4 = require_dist_cjs26(); - var middleware_serde_3 = require_dist_cjs25(); - var smithy_client_10 = require_dist_cjs34(); - var StartDeviceAuthorizationCommand = class _StartDeviceAuthorizationCommand extends smithy_client_10.Command { - constructor(input) { - super(); - this.input = input; + /** + * @internal + * + * @param agent - http(s) agent in use by the NodeHttpHandler instance. + * @param socketWarningTimestamp - last socket usage check timestamp. + * @param logger - channel for the warning. + * @returns timestamp of last emitted warning. + */ + static checkSocketUsage(agent, socketWarningTimestamp, logger = console) { + var _a, _b, _c; + const { sockets, requests, maxSockets } = agent; + if (typeof maxSockets !== "number" || maxSockets === Infinity) { + return socketWarningTimestamp; + } + const interval = 15e3; + if (Date.now() - interval < socketWarningTimestamp) { + return socketWarningTimestamp; + } + if (sockets && requests) { + for (const origin in sockets) { + const socketsInUse = ((_a = sockets[origin]) == null ? void 0 : _a.length) ?? 0; + const requestsEnqueued = ((_b = requests[origin]) == null ? void 0 : _b.length) ?? 0; + if (socketsInUse >= maxSockets && requestsEnqueued >= 2 * maxSockets) { + (_c = logger == null ? void 0 : logger.warn) == null ? void 0 : _c.call( + logger, + `@smithy/node-http-handler:WARN - socket usage at capacity=${socketsInUse} and ${requestsEnqueued} additional requests are enqueued. +See https://docs.aws.amazon.com/sdk-for-javascript/v3/developer-guide/node-configuring-maxsockets.html +or increase socketAcquisitionWarningTimeout=(millis) in the NodeHttpHandler config.` + ); + return Date.now(); + } + } + } + return socketWarningTimestamp; } - static getEndpointParameterInstructions() { + resolveDefaultConfig(options) { + const { requestTimeout, connectionTimeout, socketTimeout, httpAgent, httpsAgent } = options || {}; + const keepAlive = true; + const maxSockets = 50; return { - UseFIPS: { type: "builtInParams", name: "useFipsEndpoint" }, - Endpoint: { type: "builtInParams", name: "endpoint" }, - Region: { type: "builtInParams", name: "region" }, - UseDualStack: { type: "builtInParams", name: "useDualstackEndpoint" } - }; - } - resolveMiddleware(clientStack, configuration, options) { - this.middlewareStack.use((0, middleware_serde_3.getSerdePlugin)(configuration, this.serialize, this.deserialize)); - this.middlewareStack.use((0, middleware_endpoint_4.getEndpointPlugin)(configuration, _StartDeviceAuthorizationCommand.getEndpointParameterInstructions())); - const stack = clientStack.concat(this.middlewareStack); - const { logger } = configuration; - const clientName = "SSOOIDCClient"; - const commandName = "StartDeviceAuthorizationCommand"; - const handlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: (_) => _, - outputFilterSensitiveLog: (_) => _ + connectionTimeout, + requestTimeout: requestTimeout ?? socketTimeout, + httpAgent: (() => { + if (httpAgent instanceof import_http2.Agent || typeof (httpAgent == null ? void 0 : httpAgent.destroy) === "function") { + return httpAgent; + } + return new import_http2.Agent({ keepAlive, maxSockets, ...httpAgent }); + })(), + httpsAgent: (() => { + if (httpsAgent instanceof import_https.Agent || typeof (httpsAgent == null ? void 0 : httpsAgent.destroy) === "function") { + return httpsAgent; + } + return new import_https.Agent({ keepAlive, maxSockets, ...httpsAgent }); + })(), + logger: console }; - const { requestHandler } = configuration; - return stack.resolve((request2) => requestHandler.handle(request2.request, options || {}), handlerExecutionContext); - } - serialize(input, context) { - return se_StartDeviceAuthorizationCommand(input, context); } - deserialize(output, context) { - return de_StartDeviceAuthorizationCommand(output, context); + destroy() { + var _a, _b, _c, _d; + (_b = (_a = this.config) == null ? void 0 : _a.httpAgent) == null ? void 0 : _b.destroy(); + (_d = (_c = this.config) == null ? void 0 : _c.httpsAgent) == null ? void 0 : _d.destroy(); } - }; - var commands = { - CreateTokenCommand, - RegisterClientCommand, - StartDeviceAuthorizationCommand - }; - var SSOOIDC = class extends SSOOIDCClient { - }; - (0, smithy_client_5.createAggregatedClient)(commands, SSOOIDC); - } -}); - -// ../../../node_modules/@aws-sdk/token-providers/dist-cjs/constants.js -var require_constants2 = __commonJS({ - "../../../node_modules/@aws-sdk/token-providers/dist-cjs/constants.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.REFRESH_MESSAGE = exports2.EXPIRE_WINDOW_MS = void 0; - exports2.EXPIRE_WINDOW_MS = 5 * 60 * 1e3; - exports2.REFRESH_MESSAGE = `To refresh this SSO session run 'aws sso login' with the corresponding profile.`; - } -}); - -// ../../../node_modules/@aws-sdk/token-providers/dist-cjs/getSsoOidcClient.js -var require_getSsoOidcClient = __commonJS({ - "../../../node_modules/@aws-sdk/token-providers/dist-cjs/getSsoOidcClient.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.getSsoOidcClient = void 0; - var client_sso_oidc_node_1 = require_client_sso_oidc_node(); - var ssoOidcClientsHash = {}; - var getSsoOidcClient = (ssoRegion) => { - if (ssoOidcClientsHash[ssoRegion]) { - return ssoOidcClientsHash[ssoRegion]; + async handle(request2, { abortSignal } = {}) { + if (!this.config) { + this.config = await this.configProvider; + } + return new Promise((_resolve, _reject) => { + let writeRequestBodyPromise = void 0; + const timeouts = []; + const resolve = /* @__PURE__ */ __name(async (arg) => { + await writeRequestBodyPromise; + timeouts.forEach(clearTimeout); + _resolve(arg); + }, "resolve"); + const reject = /* @__PURE__ */ __name(async (arg) => { + await writeRequestBodyPromise; + timeouts.forEach(clearTimeout); + _reject(arg); + }, "reject"); + if (!this.config) { + throw new Error("Node HTTP request handler config is not resolved"); + } + if (abortSignal == null ? void 0 : abortSignal.aborted) { + const abortError = new Error("Request aborted"); + abortError.name = "AbortError"; + reject(abortError); + return; + } + const isSSL = request2.protocol === "https:"; + const agent = isSSL ? this.config.httpsAgent : this.config.httpAgent; + timeouts.push( + setTimeout( + () => { + this.socketWarningTimestamp = _NodeHttpHandler2.checkSocketUsage( + agent, + this.socketWarningTimestamp, + this.config.logger + ); + }, + this.config.socketAcquisitionWarningTimeout ?? (this.config.requestTimeout ?? 2e3) + (this.config.connectionTimeout ?? 1e3) + ) + ); + const queryString = (0, import_querystring_builder.buildQueryString)(request2.query || {}); + let auth = void 0; + if (request2.username != null || request2.password != null) { + const username = request2.username ?? ""; + const password = request2.password ?? ""; + auth = `${username}:${password}`; + } + let path = request2.path; + if (queryString) { + path += `?${queryString}`; + } + if (request2.fragment) { + path += `#${request2.fragment}`; + } + const nodeHttpsOptions = { + headers: request2.headers, + host: request2.hostname, + method: request2.method, + path, + port: request2.port, + agent, + auth + }; + const requestFunc = isSSL ? import_https.request : import_http2.request; + const req = requestFunc(nodeHttpsOptions, (res) => { + const httpResponse = new import_protocol_http8.HttpResponse({ + statusCode: res.statusCode || -1, + reason: res.statusMessage, + headers: getTransformedHeaders(res.headers), + body: res + }); + resolve({ response: httpResponse }); + }); + req.on("error", (err) => { + if (NODEJS_TIMEOUT_ERROR_CODES.includes(err.code)) { + reject(Object.assign(err, { name: "TimeoutError" })); + } else { + reject(err); + } + }); + if (abortSignal) { + const onAbort = /* @__PURE__ */ __name(() => { + req.destroy(); + const abortError = new Error("Request aborted"); + abortError.name = "AbortError"; + reject(abortError); + }, "onAbort"); + if (typeof abortSignal.addEventListener === "function") { + const signal = abortSignal; + signal.addEventListener("abort", onAbort, { once: true }); + req.once("close", () => signal.removeEventListener("abort", onAbort)); + } else { + abortSignal.onabort = onAbort; + } + } + timeouts.push(setConnectionTimeout(req, reject, this.config.connectionTimeout)); + timeouts.push(setSocketTimeout(req, reject, this.config.requestTimeout)); + const httpAgent = nodeHttpsOptions.agent; + if (typeof httpAgent === "object" && "keepAlive" in httpAgent) { + timeouts.push( + setSocketKeepAlive(req, { + // @ts-expect-error keepAlive is not public on httpAgent. + keepAlive: httpAgent.keepAlive, + // @ts-expect-error keepAliveMsecs is not public on httpAgent. + keepAliveMsecs: httpAgent.keepAliveMsecs + }) + ); + } + writeRequestBodyPromise = writeRequestBody(req, request2, this.config.requestTimeout).catch((e) => { + timeouts.forEach(clearTimeout); + return _reject(e); + }); + }); } - const ssoOidcClient = new client_sso_oidc_node_1.SSOOIDCClient({ region: ssoRegion }); - ssoOidcClientsHash[ssoRegion] = ssoOidcClient; - return ssoOidcClient; - }; - exports2.getSsoOidcClient = getSsoOidcClient; - } -}); - -// ../../../node_modules/@aws-sdk/token-providers/dist-cjs/getNewSsoOidcToken.js -var require_getNewSsoOidcToken = __commonJS({ - "../../../node_modules/@aws-sdk/token-providers/dist-cjs/getNewSsoOidcToken.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.getNewSsoOidcToken = void 0; - var client_sso_oidc_node_1 = require_client_sso_oidc_node(); - var getSsoOidcClient_1 = require_getSsoOidcClient(); - var getNewSsoOidcToken = (ssoToken, ssoRegion) => { - const ssoOidcClient = (0, getSsoOidcClient_1.getSsoOidcClient)(ssoRegion); - return ssoOidcClient.send(new client_sso_oidc_node_1.CreateTokenCommand({ - clientId: ssoToken.clientId, - clientSecret: ssoToken.clientSecret, - refreshToken: ssoToken.refreshToken, - grantType: "refresh_token" - })); - }; - exports2.getNewSsoOidcToken = getNewSsoOidcToken; - } -}); - -// ../../../node_modules/@aws-sdk/token-providers/dist-cjs/validateTokenExpiry.js -var require_validateTokenExpiry = __commonJS({ - "../../../node_modules/@aws-sdk/token-providers/dist-cjs/validateTokenExpiry.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.validateTokenExpiry = void 0; - var property_provider_1 = require_dist_cjs6(); - var constants_1 = require_constants2(); - var validateTokenExpiry = (token) => { - if (token.expiration && token.expiration.getTime() < Date.now()) { - throw new property_provider_1.TokenProviderError(`Token is expired. ${constants_1.REFRESH_MESSAGE}`, false); + updateHttpClientConfig(key, value) { + this.config = void 0; + this.configProvider = this.configProvider.then((config) => { + return { + ...config, + [key]: value + }; + }); } - }; - exports2.validateTokenExpiry = validateTokenExpiry; - } -}); - -// ../../../node_modules/@aws-sdk/token-providers/dist-cjs/validateTokenKey.js -var require_validateTokenKey = __commonJS({ - "../../../node_modules/@aws-sdk/token-providers/dist-cjs/validateTokenKey.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.validateTokenKey = void 0; - var property_provider_1 = require_dist_cjs6(); - var constants_1 = require_constants2(); - var validateTokenKey = (key, value, forRefresh = false) => { - if (typeof value === "undefined") { - throw new property_provider_1.TokenProviderError(`Value not present for '${key}' in SSO Token${forRefresh ? ". Cannot refresh" : ""}. ${constants_1.REFRESH_MESSAGE}`, false); + httpHandlerConfigs() { + return this.config ?? {}; } }; - exports2.validateTokenKey = validateTokenKey; - } -}); - -// ../../../node_modules/@aws-sdk/token-providers/dist-cjs/writeSSOTokenToFile.js -var require_writeSSOTokenToFile = __commonJS({ - "../../../node_modules/@aws-sdk/token-providers/dist-cjs/writeSSOTokenToFile.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.writeSSOTokenToFile = void 0; - var shared_ini_file_loader_1 = require_dist_cjs21(); - var fs_1 = require("fs"); - var { writeFile } = fs_1.promises; - var writeSSOTokenToFile = (id, ssoToken) => { - const tokenFilepath = (0, shared_ini_file_loader_1.getSSOTokenFilepath)(id); - const tokenString = JSON.stringify(ssoToken, null, 2); - return writeFile(tokenFilepath, tokenString); - }; - exports2.writeSSOTokenToFile = writeSSOTokenToFile; - } -}); - -// ../../../node_modules/@aws-sdk/token-providers/dist-cjs/fromSso.js -var require_fromSso = __commonJS({ - "../../../node_modules/@aws-sdk/token-providers/dist-cjs/fromSso.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.fromSso = void 0; - var property_provider_1 = require_dist_cjs6(); - var shared_ini_file_loader_1 = require_dist_cjs21(); - var constants_1 = require_constants2(); - var getNewSsoOidcToken_1 = require_getNewSsoOidcToken(); - var validateTokenExpiry_1 = require_validateTokenExpiry(); - var validateTokenKey_1 = require_validateTokenKey(); - var writeSSOTokenToFile_1 = require_writeSSOTokenToFile(); - var lastRefreshAttemptTime = /* @__PURE__ */ new Date(0); - var fromSso = (init = {}) => async () => { - const profiles = await (0, shared_ini_file_loader_1.parseKnownFiles)(init); - const profileName = (0, shared_ini_file_loader_1.getProfileName)(init); - const profile = profiles[profileName]; - if (!profile) { - throw new property_provider_1.TokenProviderError(`Profile '${profileName}' could not be found in shared credentials file.`, false); - } else if (!profile["sso_session"]) { - throw new property_provider_1.TokenProviderError(`Profile '${profileName}' is missing required property 'sso_session'.`); - } - const ssoSessionName = profile["sso_session"]; - const ssoSessions = await (0, shared_ini_file_loader_1.loadSsoSessionData)(init); - const ssoSession = ssoSessions[ssoSessionName]; - if (!ssoSession) { - throw new property_provider_1.TokenProviderError(`Sso session '${ssoSessionName}' could not be found in shared credentials file.`, false); + __name(_NodeHttpHandler, "NodeHttpHandler"); + var NodeHttpHandler = _NodeHttpHandler; + var import_http22 = require("http2"); + var import_http23 = __toESM2(require("http2")); + var _NodeHttp2ConnectionPool = class _NodeHttp2ConnectionPool { + constructor(sessions) { + this.sessions = []; + this.sessions = sessions ?? []; } - for (const ssoSessionRequiredKey of ["sso_start_url", "sso_region"]) { - if (!ssoSession[ssoSessionRequiredKey]) { - throw new property_provider_1.TokenProviderError(`Sso session '${ssoSessionName}' is missing required property '${ssoSessionRequiredKey}'.`, false); + poll() { + if (this.sessions.length > 0) { + return this.sessions.shift(); } } - const ssoStartUrl = ssoSession["sso_start_url"]; - const ssoRegion = ssoSession["sso_region"]; - let ssoToken; - try { - ssoToken = await (0, shared_ini_file_loader_1.getSSOTokenFromFile)(ssoSessionName); - } catch (e) { - throw new property_provider_1.TokenProviderError(`The SSO session token associated with profile=${profileName} was not found or is invalid. ${constants_1.REFRESH_MESSAGE}`, false); + offerLast(session) { + this.sessions.push(session); } - (0, validateTokenKey_1.validateTokenKey)("accessToken", ssoToken.accessToken); - (0, validateTokenKey_1.validateTokenKey)("expiresAt", ssoToken.expiresAt); - const { accessToken, expiresAt } = ssoToken; - const existingToken = { token: accessToken, expiration: new Date(expiresAt) }; - if (existingToken.expiration.getTime() - Date.now() > constants_1.EXPIRE_WINDOW_MS) { - return existingToken; + contains(session) { + return this.sessions.includes(session); } - if (Date.now() - lastRefreshAttemptTime.getTime() < 30 * 1e3) { - (0, validateTokenExpiry_1.validateTokenExpiry)(existingToken); - return existingToken; + remove(session) { + this.sessions = this.sessions.filter((s) => s !== session); } - (0, validateTokenKey_1.validateTokenKey)("clientId", ssoToken.clientId, true); - (0, validateTokenKey_1.validateTokenKey)("clientSecret", ssoToken.clientSecret, true); - (0, validateTokenKey_1.validateTokenKey)("refreshToken", ssoToken.refreshToken, true); - try { - lastRefreshAttemptTime.setTime(Date.now()); - const newSsoOidcToken = await (0, getNewSsoOidcToken_1.getNewSsoOidcToken)(ssoToken, ssoRegion); - (0, validateTokenKey_1.validateTokenKey)("accessToken", newSsoOidcToken.accessToken); - (0, validateTokenKey_1.validateTokenKey)("expiresIn", newSsoOidcToken.expiresIn); - const newTokenExpiration = new Date(Date.now() + newSsoOidcToken.expiresIn * 1e3); - try { - await (0, writeSSOTokenToFile_1.writeSSOTokenToFile)(ssoSessionName, { - ...ssoToken, - accessToken: newSsoOidcToken.accessToken, - expiresAt: newTokenExpiration.toISOString(), - refreshToken: newSsoOidcToken.refreshToken - }); - } catch (error) { + [Symbol.iterator]() { + return this.sessions[Symbol.iterator](); + } + destroy(connection) { + for (const session of this.sessions) { + if (session === connection) { + if (!session.destroyed) { + session.destroy(); + } + } } - return { - token: newSsoOidcToken.accessToken, - expiration: newTokenExpiration - }; - } catch (error) { - (0, validateTokenExpiry_1.validateTokenExpiry)(existingToken); - return existingToken; } }; - exports2.fromSso = fromSso; - } -}); - -// ../../../node_modules/@aws-sdk/token-providers/dist-cjs/fromStatic.js -var require_fromStatic = __commonJS({ - "../../../node_modules/@aws-sdk/token-providers/dist-cjs/fromStatic.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.fromStatic = void 0; - var property_provider_1 = require_dist_cjs6(); - var fromStatic = ({ token }) => async () => { - if (!token || !token.token) { - throw new property_provider_1.TokenProviderError(`Please pass a valid token to fromStatic`, false); + __name(_NodeHttp2ConnectionPool, "NodeHttp2ConnectionPool"); + var NodeHttp2ConnectionPool = _NodeHttp2ConnectionPool; + var _NodeHttp2ConnectionManager = class _NodeHttp2ConnectionManager { + constructor(config) { + this.sessionCache = /* @__PURE__ */ new Map(); + this.config = config; + if (this.config.maxConcurrency && this.config.maxConcurrency <= 0) { + throw new RangeError("maxConcurrency must be greater than zero."); + } } - return token; - }; - exports2.fromStatic = fromStatic; - } -}); - -// ../../../node_modules/@aws-sdk/token-providers/dist-cjs/nodeProvider.js -var require_nodeProvider = __commonJS({ - "../../../node_modules/@aws-sdk/token-providers/dist-cjs/nodeProvider.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.nodeProvider = void 0; - var property_provider_1 = require_dist_cjs6(); - var fromSso_1 = require_fromSso(); - var nodeProvider = (init = {}) => (0, property_provider_1.memoize)((0, property_provider_1.chain)((0, fromSso_1.fromSso)(init), async () => { - throw new property_provider_1.TokenProviderError("Could not load token from any providers", false); - }), (token) => token.expiration !== void 0 && token.expiration.getTime() - Date.now() < 3e5, (token) => token.expiration !== void 0); - exports2.nodeProvider = nodeProvider; - } -}); - -// ../../../node_modules/@aws-sdk/token-providers/dist-cjs/index.js -var require_dist_cjs46 = __commonJS({ - "../../../node_modules/@aws-sdk/token-providers/dist-cjs/index.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports)); - tslib_1.__exportStar(require_client_sso_oidc_node(), exports2); - tslib_1.__exportStar(require_fromSso(), exports2); - tslib_1.__exportStar(require_fromStatic(), exports2); - tslib_1.__exportStar(require_nodeProvider(), exports2); - } -}); - -// ../../../node_modules/@aws-sdk/credential-provider-sso/dist-cjs/resolveSSOCredentials.js -var require_resolveSSOCredentials = __commonJS({ - "../../../node_modules/@aws-sdk/credential-provider-sso/dist-cjs/resolveSSOCredentials.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.resolveSSOCredentials = void 0; - var client_sso_1 = require_dist_cjs45(); - var token_providers_1 = require_dist_cjs46(); - var property_provider_1 = require_dist_cjs6(); - var shared_ini_file_loader_1 = require_dist_cjs21(); - var SHOULD_FAIL_CREDENTIAL_CHAIN = false; - var resolveSSOCredentials = async ({ ssoStartUrl, ssoSession, ssoAccountId, ssoRegion, ssoRoleName, ssoClient, profile }) => { - let token; - const refreshMessage = `To refresh this SSO session run aws sso login with the corresponding profile.`; - if (ssoSession) { - try { - const _token = await (0, token_providers_1.fromSso)({ profile })(); - token = { - accessToken: _token.token, - expiresAt: new Date(_token.expiration).toISOString() - }; - } catch (e) { - throw new property_provider_1.CredentialsProviderError(e.message, SHOULD_FAIL_CREDENTIAL_CHAIN); + lease(requestContext, connectionConfiguration) { + const url2 = this.getUrlString(requestContext); + const existingPool = this.sessionCache.get(url2); + if (existingPool) { + const existingSession = existingPool.poll(); + if (existingSession && !this.config.disableConcurrency) { + return existingSession; + } } - } else { - try { - token = await (0, shared_ini_file_loader_1.getSSOTokenFromFile)(ssoStartUrl); - } catch (e) { - throw new property_provider_1.CredentialsProviderError(`The SSO session associated with this profile is invalid. ${refreshMessage}`, SHOULD_FAIL_CREDENTIAL_CHAIN); + const session = import_http23.default.connect(url2); + if (this.config.maxConcurrency) { + session.settings({ maxConcurrentStreams: this.config.maxConcurrency }, (err) => { + if (err) { + throw new Error( + "Fail to set maxConcurrentStreams to " + this.config.maxConcurrency + "when creating new session for " + requestContext.destination.toString() + ); + } + }); + } + session.unref(); + const destroySessionCb = /* @__PURE__ */ __name(() => { + session.destroy(); + this.deleteSession(url2, session); + }, "destroySessionCb"); + session.on("goaway", destroySessionCb); + session.on("error", destroySessionCb); + session.on("frameError", destroySessionCb); + session.on("close", () => this.deleteSession(url2, session)); + if (connectionConfiguration.requestTimeout) { + session.setTimeout(connectionConfiguration.requestTimeout, destroySessionCb); } + const connectionPool = this.sessionCache.get(url2) || new NodeHttp2ConnectionPool(); + connectionPool.offerLast(session); + this.sessionCache.set(url2, connectionPool); + return session; } - if (new Date(token.expiresAt).getTime() - Date.now() <= 0) { - throw new property_provider_1.CredentialsProviderError(`The SSO session associated with this profile has expired. ${refreshMessage}`, SHOULD_FAIL_CREDENTIAL_CHAIN); + /** + * Delete a session from the connection pool. + * @param authority The authority of the session to delete. + * @param session The session to delete. + */ + deleteSession(authority, session) { + const existingConnectionPool = this.sessionCache.get(authority); + if (!existingConnectionPool) { + return; + } + if (!existingConnectionPool.contains(session)) { + return; + } + existingConnectionPool.remove(session); + this.sessionCache.set(authority, existingConnectionPool); } - const { accessToken } = token; - const sso = ssoClient || new client_sso_1.SSOClient({ region: ssoRegion }); - let ssoResp; - try { - ssoResp = await sso.send(new client_sso_1.GetRoleCredentialsCommand({ - accountId: ssoAccountId, - roleName: ssoRoleName, - accessToken - })); - } catch (e) { - throw property_provider_1.CredentialsProviderError.from(e, SHOULD_FAIL_CREDENTIAL_CHAIN); + release(requestContext, session) { + var _a; + const cacheKey = this.getUrlString(requestContext); + (_a = this.sessionCache.get(cacheKey)) == null ? void 0 : _a.offerLast(session); } - const { roleCredentials: { accessKeyId, secretAccessKey, sessionToken, expiration } = {} } = ssoResp; - if (!accessKeyId || !secretAccessKey || !sessionToken || !expiration) { - throw new property_provider_1.CredentialsProviderError("SSO returns an invalid temporary credential.", SHOULD_FAIL_CREDENTIAL_CHAIN); + destroy() { + for (const [key, connectionPool] of this.sessionCache) { + for (const session of connectionPool) { + if (!session.destroyed) { + session.destroy(); + } + connectionPool.remove(session); + } + this.sessionCache.delete(key); + } } - return { accessKeyId, secretAccessKey, sessionToken, expiration: new Date(expiration) }; - }; - exports2.resolveSSOCredentials = resolveSSOCredentials; - } -}); - -// ../../../node_modules/@aws-sdk/credential-provider-sso/dist-cjs/validateSsoProfile.js -var require_validateSsoProfile = __commonJS({ - "../../../node_modules/@aws-sdk/credential-provider-sso/dist-cjs/validateSsoProfile.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.validateSsoProfile = void 0; - var property_provider_1 = require_dist_cjs6(); - var validateSsoProfile = (profile) => { - const { sso_start_url, sso_account_id, sso_region, sso_role_name } = profile; - if (!sso_start_url || !sso_account_id || !sso_region || !sso_role_name) { - throw new property_provider_1.CredentialsProviderError(`Profile is configured with invalid SSO credentials. Required parameters "sso_account_id", "sso_region", "sso_role_name", "sso_start_url". Got ${Object.keys(profile).join(", ")} -Reference: https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-sso.html`, false); + setMaxConcurrentStreams(maxConcurrentStreams) { + if (this.config.maxConcurrency && this.config.maxConcurrency <= 0) { + throw new RangeError("maxConcurrentStreams must be greater than zero."); + } + this.config.maxConcurrency = maxConcurrentStreams; + } + setDisableConcurrentStreams(disableConcurrentStreams) { + this.config.disableConcurrency = disableConcurrentStreams; + } + getUrlString(request2) { + return request2.destination.toString(); } - return profile; }; - exports2.validateSsoProfile = validateSsoProfile; - } -}); - -// ../../../node_modules/@aws-sdk/credential-provider-sso/dist-cjs/fromSSO.js -var require_fromSSO = __commonJS({ - "../../../node_modules/@aws-sdk/credential-provider-sso/dist-cjs/fromSSO.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.fromSSO = void 0; - var property_provider_1 = require_dist_cjs6(); - var shared_ini_file_loader_1 = require_dist_cjs21(); - var isSsoProfile_1 = require_isSsoProfile(); - var resolveSSOCredentials_1 = require_resolveSSOCredentials(); - var validateSsoProfile_1 = require_validateSsoProfile(); - var fromSSO = (init = {}) => async () => { - const { ssoStartUrl, ssoAccountId, ssoRegion, ssoRoleName, ssoClient, ssoSession } = init; - const profileName = (0, shared_ini_file_loader_1.getProfileName)(init); - if (!ssoStartUrl && !ssoAccountId && !ssoRegion && !ssoRoleName && !ssoSession) { - const profiles = await (0, shared_ini_file_loader_1.parseKnownFiles)(init); - const profile = profiles[profileName]; - if (!profile) { - throw new property_provider_1.CredentialsProviderError(`Profile ${profileName} was not found.`); + __name(_NodeHttp2ConnectionManager, "NodeHttp2ConnectionManager"); + var NodeHttp2ConnectionManager = _NodeHttp2ConnectionManager; + var _NodeHttp2Handler = class _NodeHttp2Handler2 { + constructor(options) { + this.metadata = { handlerProtocol: "h2" }; + this.connectionManager = new NodeHttp2ConnectionManager({}); + this.configProvider = new Promise((resolve, reject) => { + if (typeof options === "function") { + options().then((opts) => { + resolve(opts || {}); + }).catch(reject); + } else { + resolve(options || {}); + } + }); + } + /** + * @returns the input if it is an HttpHandler of any class, + * or instantiates a new instance of this handler. + */ + static create(instanceOrOptions) { + if (typeof (instanceOrOptions == null ? void 0 : instanceOrOptions.handle) === "function") { + return instanceOrOptions; } - if (!(0, isSsoProfile_1.isSsoProfile)(profile)) { - throw new property_provider_1.CredentialsProviderError(`Profile ${profileName} is not configured with SSO credentials.`); + return new _NodeHttp2Handler2(instanceOrOptions); + } + destroy() { + this.connectionManager.destroy(); + } + async handle(request2, { abortSignal } = {}) { + if (!this.config) { + this.config = await this.configProvider; + this.connectionManager.setDisableConcurrentStreams(this.config.disableConcurrentStreams || false); + if (this.config.maxConcurrentStreams) { + this.connectionManager.setMaxConcurrentStreams(this.config.maxConcurrentStreams); + } } - if (profile === null || profile === void 0 ? void 0 : profile.sso_session) { - const ssoSessions = await (0, shared_ini_file_loader_1.loadSsoSessionData)(init); - const session = ssoSessions[profile.sso_session]; - const conflictMsg = ` configurations in profile ${profileName} and sso-session ${profile.sso_session}`; - if (ssoRegion && ssoRegion !== session.sso_region) { - throw new property_provider_1.CredentialsProviderError(`Conflicting SSO region` + conflictMsg, false); + const { requestTimeout, disableConcurrentStreams } = this.config; + return new Promise((_resolve, _reject) => { + var _a; + let fulfilled = false; + let writeRequestBodyPromise = void 0; + const resolve = /* @__PURE__ */ __name(async (arg) => { + await writeRequestBodyPromise; + _resolve(arg); + }, "resolve"); + const reject = /* @__PURE__ */ __name(async (arg) => { + await writeRequestBodyPromise; + _reject(arg); + }, "reject"); + if (abortSignal == null ? void 0 : abortSignal.aborted) { + fulfilled = true; + const abortError = new Error("Request aborted"); + abortError.name = "AbortError"; + reject(abortError); + return; } - if (ssoStartUrl && ssoStartUrl !== session.sso_start_url) { - throw new property_provider_1.CredentialsProviderError(`Conflicting SSO start_url` + conflictMsg, false); + const { hostname, method, port, protocol, query } = request2; + let auth = ""; + if (request2.username != null || request2.password != null) { + const username = request2.username ?? ""; + const password = request2.password ?? ""; + auth = `${username}:${password}@`; } - profile.sso_region = session.sso_region; - profile.sso_start_url = session.sso_start_url; - } - const { sso_start_url, sso_account_id, sso_region, sso_role_name, sso_session } = (0, validateSsoProfile_1.validateSsoProfile)(profile); - return (0, resolveSSOCredentials_1.resolveSSOCredentials)({ - ssoStartUrl: sso_start_url, - ssoSession: sso_session, - ssoAccountId: sso_account_id, - ssoRegion: sso_region, - ssoRoleName: sso_role_name, - ssoClient, - profile: profileName + const authority = `${protocol}//${auth}${hostname}${port ? `:${port}` : ""}`; + const requestContext = { destination: new URL(authority) }; + const session = this.connectionManager.lease(requestContext, { + requestTimeout: (_a = this.config) == null ? void 0 : _a.sessionTimeout, + disableConcurrentStreams: disableConcurrentStreams || false + }); + const rejectWithDestroy = /* @__PURE__ */ __name((err) => { + if (disableConcurrentStreams) { + this.destroySession(session); + } + fulfilled = true; + reject(err); + }, "rejectWithDestroy"); + const queryString = (0, import_querystring_builder.buildQueryString)(query || {}); + let path = request2.path; + if (queryString) { + path += `?${queryString}`; + } + if (request2.fragment) { + path += `#${request2.fragment}`; + } + const req = session.request({ + ...request2.headers, + [import_http22.constants.HTTP2_HEADER_PATH]: path, + [import_http22.constants.HTTP2_HEADER_METHOD]: method + }); + session.ref(); + req.on("response", (headers) => { + const httpResponse = new import_protocol_http8.HttpResponse({ + statusCode: headers[":status"] || -1, + headers: getTransformedHeaders(headers), + body: req + }); + fulfilled = true; + resolve({ response: httpResponse }); + if (disableConcurrentStreams) { + session.close(); + this.connectionManager.deleteSession(authority, session); + } + }); + if (requestTimeout) { + req.setTimeout(requestTimeout, () => { + req.close(); + const timeoutError = new Error(`Stream timed out because of no activity for ${requestTimeout} ms`); + timeoutError.name = "TimeoutError"; + rejectWithDestroy(timeoutError); + }); + } + if (abortSignal) { + const onAbort = /* @__PURE__ */ __name(() => { + req.close(); + const abortError = new Error("Request aborted"); + abortError.name = "AbortError"; + rejectWithDestroy(abortError); + }, "onAbort"); + if (typeof abortSignal.addEventListener === "function") { + const signal = abortSignal; + signal.addEventListener("abort", onAbort, { once: true }); + req.once("close", () => signal.removeEventListener("abort", onAbort)); + } else { + abortSignal.onabort = onAbort; + } + } + req.on("frameError", (type, code, id) => { + rejectWithDestroy(new Error(`Frame type id ${type} in stream id ${id} has failed with code ${code}.`)); + }); + req.on("error", rejectWithDestroy); + req.on("aborted", () => { + rejectWithDestroy( + new Error(`HTTP/2 stream is abnormally aborted in mid-communication with result code ${req.rstCode}.`) + ); + }); + req.on("close", () => { + session.unref(); + if (disableConcurrentStreams) { + session.destroy(); + } + if (!fulfilled) { + rejectWithDestroy(new Error("Unexpected error: http2 request did not get a response")); + } + }); + writeRequestBodyPromise = writeRequestBody(req, request2, requestTimeout); }); - } else if (!ssoStartUrl || !ssoAccountId || !ssoRegion || !ssoRoleName) { - throw new property_provider_1.CredentialsProviderError('Incomplete configuration. The fromSSO() argument hash must include "ssoStartUrl", "ssoAccountId", "ssoRegion", "ssoRoleName"'); - } else { - return (0, resolveSSOCredentials_1.resolveSSOCredentials)({ - ssoStartUrl, - ssoSession, - ssoAccountId, - ssoRegion, - ssoRoleName, - ssoClient, - profile: profileName + } + updateHttpClientConfig(key, value) { + this.config = void 0; + this.configProvider = this.configProvider.then((config) => { + return { + ...config, + [key]: value + }; }); } - }; - exports2.fromSSO = fromSSO; - } -}); - -// ../../../node_modules/@aws-sdk/credential-provider-sso/dist-cjs/types.js -var require_types2 = __commonJS({ - "../../../node_modules/@aws-sdk/credential-provider-sso/dist-cjs/types.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - } -}); - -// ../../../node_modules/@aws-sdk/credential-provider-sso/dist-cjs/index.js -var require_dist_cjs47 = __commonJS({ - "../../../node_modules/@aws-sdk/credential-provider-sso/dist-cjs/index.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports)); - tslib_1.__exportStar(require_fromSSO(), exports2); - tslib_1.__exportStar(require_isSsoProfile(), exports2); - tslib_1.__exportStar(require_types2(), exports2); - tslib_1.__exportStar(require_validateSsoProfile(), exports2); - } -}); - -// ../../../node_modules/@aws-sdk/credential-provider-ini/dist-cjs/resolveSsoCredentials.js -var require_resolveSsoCredentials = __commonJS({ - "../../../node_modules/@aws-sdk/credential-provider-ini/dist-cjs/resolveSsoCredentials.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.resolveSsoCredentials = exports2.isSsoProfile = void 0; - var credential_provider_sso_1 = require_dist_cjs47(); - var credential_provider_sso_2 = require_dist_cjs47(); - Object.defineProperty(exports2, "isSsoProfile", { enumerable: true, get: function() { - return credential_provider_sso_2.isSsoProfile; - } }); - var resolveSsoCredentials = (data) => { - const { sso_start_url, sso_account_id, sso_session, sso_region, sso_role_name } = (0, credential_provider_sso_1.validateSsoProfile)(data); - return (0, credential_provider_sso_1.fromSSO)({ - ssoStartUrl: sso_start_url, - ssoAccountId: sso_account_id, - ssoSession: sso_session, - ssoRegion: sso_region, - ssoRoleName: sso_role_name - })(); - }; - exports2.resolveSsoCredentials = resolveSsoCredentials; - } -}); - -// ../../../node_modules/@aws-sdk/credential-provider-ini/dist-cjs/resolveStaticCredentials.js -var require_resolveStaticCredentials = __commonJS({ - "../../../node_modules/@aws-sdk/credential-provider-ini/dist-cjs/resolveStaticCredentials.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.resolveStaticCredentials = exports2.isStaticCredsProfile = void 0; - var isStaticCredsProfile = (arg) => Boolean(arg) && typeof arg === "object" && typeof arg.aws_access_key_id === "string" && typeof arg.aws_secret_access_key === "string" && ["undefined", "string"].indexOf(typeof arg.aws_session_token) > -1; - exports2.isStaticCredsProfile = isStaticCredsProfile; - var resolveStaticCredentials = (profile) => Promise.resolve({ - accessKeyId: profile.aws_access_key_id, - secretAccessKey: profile.aws_secret_access_key, - sessionToken: profile.aws_session_token - }); - exports2.resolveStaticCredentials = resolveStaticCredentials; - } -}); - -// ../../../node_modules/@aws-sdk/credential-provider-web-identity/dist-cjs/fromWebToken.js -var require_fromWebToken = __commonJS({ - "../../../node_modules/@aws-sdk/credential-provider-web-identity/dist-cjs/fromWebToken.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.fromWebToken = void 0; - var property_provider_1 = require_dist_cjs6(); - var fromWebToken = (init) => () => { - const { roleArn, roleSessionName, webIdentityToken, providerId, policyArns, policy, durationSeconds, roleAssumerWithWebIdentity } = init; - if (!roleAssumerWithWebIdentity) { - throw new property_provider_1.CredentialsProviderError(`Role Arn '${roleArn}' needs to be assumed with web identity, but no role assumption callback was provided.`, false); + httpHandlerConfigs() { + return this.config ?? {}; + } + /** + * Destroys a session. + * @param session The session to destroy. + */ + destroySession(session) { + if (!session.destroyed) { + session.destroy(); + } } - return roleAssumerWithWebIdentity({ - RoleArn: roleArn, - RoleSessionName: roleSessionName !== null && roleSessionName !== void 0 ? roleSessionName : `aws-sdk-js-session-${Date.now()}`, - WebIdentityToken: webIdentityToken, - ProviderId: providerId, - PolicyArns: policyArns, - Policy: policy, - DurationSeconds: durationSeconds - }); }; - exports2.fromWebToken = fromWebToken; - } -}); - -// ../../../node_modules/@aws-sdk/credential-provider-web-identity/dist-cjs/fromTokenFile.js -var require_fromTokenFile = __commonJS({ - "../../../node_modules/@aws-sdk/credential-provider-web-identity/dist-cjs/fromTokenFile.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.fromTokenFile = void 0; - var property_provider_1 = require_dist_cjs6(); - var fs_1 = require("fs"); - var fromWebToken_1 = require_fromWebToken(); - var ENV_TOKEN_FILE = "AWS_WEB_IDENTITY_TOKEN_FILE"; - var ENV_ROLE_ARN = "AWS_ROLE_ARN"; - var ENV_ROLE_SESSION_NAME = "AWS_ROLE_SESSION_NAME"; - var fromTokenFile = (init = {}) => async () => { - var _a, _b, _c; - const webIdentityTokenFile = (_a = init === null || init === void 0 ? void 0 : init.webIdentityTokenFile) !== null && _a !== void 0 ? _a : process.env[ENV_TOKEN_FILE]; - const roleArn = (_b = init === null || init === void 0 ? void 0 : init.roleArn) !== null && _b !== void 0 ? _b : process.env[ENV_ROLE_ARN]; - const roleSessionName = (_c = init === null || init === void 0 ? void 0 : init.roleSessionName) !== null && _c !== void 0 ? _c : process.env[ENV_ROLE_SESSION_NAME]; - if (!webIdentityTokenFile || !roleArn) { - throw new property_provider_1.CredentialsProviderError("Web identity configuration not specified"); + __name(_NodeHttp2Handler, "NodeHttp2Handler"); + var NodeHttp2Handler = _NodeHttp2Handler; + var _Collector = class _Collector extends import_stream.Writable { + constructor() { + super(...arguments); + this.bufferedBytes = []; + } + _write(chunk, encoding, callback) { + this.bufferedBytes.push(chunk); + callback(); } - return (0, fromWebToken_1.fromWebToken)({ - ...init, - webIdentityToken: (0, fs_1.readFileSync)(webIdentityTokenFile, { encoding: "ascii" }), - roleArn, - roleSessionName - })(); }; - exports2.fromTokenFile = fromTokenFile; - } -}); - -// ../../../node_modules/@aws-sdk/credential-provider-web-identity/dist-cjs/index.js -var require_dist_cjs48 = __commonJS({ - "../../../node_modules/@aws-sdk/credential-provider-web-identity/dist-cjs/index.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports)); - tslib_1.__exportStar(require_fromTokenFile(), exports2); - tslib_1.__exportStar(require_fromWebToken(), exports2); + __name(_Collector, "Collector"); + var Collector = _Collector; + var streamCollector = /* @__PURE__ */ __name((stream) => { + if (isReadableStreamInstance(stream)) { + return collectReadableStream(stream); + } + return new Promise((resolve, reject) => { + const collector = new Collector(); + stream.pipe(collector); + stream.on("error", (err) => { + collector.end(); + reject(err); + }); + collector.on("error", reject); + collector.on("finish", function() { + const bytes = new Uint8Array(Buffer.concat(this.bufferedBytes)); + resolve(bytes); + }); + }); + }, "streamCollector"); + var isReadableStreamInstance = /* @__PURE__ */ __name((stream) => typeof ReadableStream === "function" && stream instanceof ReadableStream, "isReadableStreamInstance"); + async function collectReadableStream(stream) { + const chunks = []; + const reader = stream.getReader(); + let isDone = false; + let length = 0; + while (!isDone) { + const { done, value } = await reader.read(); + if (value) { + chunks.push(value); + length += value.length; + } + isDone = done; + } + const collected = new Uint8Array(length); + let offset = 0; + for (const chunk of chunks) { + collected.set(chunk, offset); + offset += chunk.length; + } + return collected; + } + __name(collectReadableStream, "collectReadableStream"); } }); -// ../../../node_modules/@aws-sdk/credential-provider-ini/dist-cjs/resolveWebIdentityCredentials.js -var require_resolveWebIdentityCredentials = __commonJS({ - "../../../node_modules/@aws-sdk/credential-provider-ini/dist-cjs/resolveWebIdentityCredentials.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.resolveWebIdentityCredentials = exports2.isWebIdentityProfile = void 0; - var credential_provider_web_identity_1 = require_dist_cjs48(); - var isWebIdentityProfile = (arg) => Boolean(arg) && typeof arg === "object" && typeof arg.web_identity_token_file === "string" && typeof arg.role_arn === "string" && ["undefined", "string"].indexOf(typeof arg.role_session_name) > -1; - exports2.isWebIdentityProfile = isWebIdentityProfile; - var resolveWebIdentityCredentials = async (profile, options) => (0, credential_provider_web_identity_1.fromTokenFile)({ - webIdentityTokenFile: profile.web_identity_token_file, - roleArn: profile.role_arn, - roleSessionName: profile.role_session_name, - roleAssumerWithWebIdentity: options.roleAssumerWithWebIdentity - })(); - exports2.resolveWebIdentityCredentials = resolveWebIdentityCredentials; - } -}); - -// ../../../node_modules/@aws-sdk/credential-provider-ini/dist-cjs/resolveProfileData.js -var require_resolveProfileData = __commonJS({ - "../../../node_modules/@aws-sdk/credential-provider-ini/dist-cjs/resolveProfileData.js"(exports2) { +// ../../../node_modules/@aws-sdk/credential-provider-http/dist-cjs/fromHttp/checkUrl.js +var require_checkUrl = __commonJS({ + "../../../node_modules/@aws-sdk/credential-provider-http/dist-cjs/fromHttp/checkUrl.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.resolveProfileData = void 0; - var property_provider_1 = require_dist_cjs6(); - var resolveAssumeRoleCredentials_1 = require_resolveAssumeRoleCredentials(); - var resolveProcessCredentials_1 = require_resolveProcessCredentials2(); - var resolveSsoCredentials_1 = require_resolveSsoCredentials(); - var resolveStaticCredentials_1 = require_resolveStaticCredentials(); - var resolveWebIdentityCredentials_1 = require_resolveWebIdentityCredentials(); - var resolveProfileData = async (profileName, profiles, options, visitedProfiles = {}) => { - const data = profiles[profileName]; - if (Object.keys(visitedProfiles).length > 0 && (0, resolveStaticCredentials_1.isStaticCredsProfile)(data)) { - return (0, resolveStaticCredentials_1.resolveStaticCredentials)(data); - } - if ((0, resolveAssumeRoleCredentials_1.isAssumeRoleProfile)(data)) { - return (0, resolveAssumeRoleCredentials_1.resolveAssumeRoleCredentials)(profileName, profiles, options, visitedProfiles); - } - if ((0, resolveStaticCredentials_1.isStaticCredsProfile)(data)) { - return (0, resolveStaticCredentials_1.resolveStaticCredentials)(data); - } - if ((0, resolveWebIdentityCredentials_1.isWebIdentityProfile)(data)) { - return (0, resolveWebIdentityCredentials_1.resolveWebIdentityCredentials)(data, options); + exports2.checkUrl = void 0; + var property_provider_1 = require_dist_cjs40(); + var ECS_CONTAINER_HOST = "169.254.170.2"; + var EKS_CONTAINER_HOST_IPv4 = "169.254.170.23"; + var EKS_CONTAINER_HOST_IPv6 = "[fd00:ec2::23]"; + var checkUrl = (url2, logger) => { + if (url2.protocol === "https:") { + return; } - if ((0, resolveProcessCredentials_1.isProcessProfile)(data)) { - return (0, resolveProcessCredentials_1.resolveProcessCredentials)(options, profileName); + if (url2.hostname === ECS_CONTAINER_HOST || url2.hostname === EKS_CONTAINER_HOST_IPv4 || url2.hostname === EKS_CONTAINER_HOST_IPv6) { + return; } - if ((0, resolveSsoCredentials_1.isSsoProfile)(data)) { - return (0, resolveSsoCredentials_1.resolveSsoCredentials)(data); + if (url2.hostname.includes("[")) { + if (url2.hostname === "[::1]" || url2.hostname === "[0000:0000:0000:0000:0000:0000:0000:0001]") { + return; + } + } else { + if (url2.hostname === "localhost") { + return; + } + const ipComponents = url2.hostname.split("."); + const inRange = (component) => { + const num = parseInt(component, 10); + return 0 <= num && num <= 255; + }; + if (ipComponents[0] === "127" && inRange(ipComponents[1]) && inRange(ipComponents[2]) && inRange(ipComponents[3]) && ipComponents.length === 4) { + return; + } } - throw new property_provider_1.CredentialsProviderError(`Profile ${profileName} could not be found or parsed in shared credentials file.`); + throw new property_provider_1.CredentialsProviderError(`URL not accepted. It must either be HTTPS or match one of the following: + - loopback CIDR 127.0.0.0/8 or [::1/128] + - ECS container host 169.254.170.2 + - EKS container host 169.254.170.23 or [fd00:ec2::23]`, { logger }); }; - exports2.resolveProfileData = resolveProfileData; + exports2.checkUrl = checkUrl; } }); -// ../../../node_modules/@aws-sdk/credential-provider-ini/dist-cjs/fromIni.js -var require_fromIni = __commonJS({ - "../../../node_modules/@aws-sdk/credential-provider-ini/dist-cjs/fromIni.js"(exports2) { +// ../../../node_modules/@smithy/util-stream/dist-cjs/getAwsChunkedEncodingStream.js +var require_getAwsChunkedEncodingStream2 = __commonJS({ + "../../../node_modules/@smithy/util-stream/dist-cjs/getAwsChunkedEncodingStream.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.fromIni = void 0; - var shared_ini_file_loader_1 = require_dist_cjs21(); - var resolveProfileData_1 = require_resolveProfileData(); - var fromIni = (init = {}) => async () => { - const profiles = await (0, shared_ini_file_loader_1.parseKnownFiles)(init); - return (0, resolveProfileData_1.resolveProfileData)((0, shared_ini_file_loader_1.getProfileName)(init), profiles, init); + exports2.getAwsChunkedEncodingStream = void 0; + var stream_1 = require("stream"); + var getAwsChunkedEncodingStream2 = (readableStream, options) => { + const { base64Encoder, bodyLengthChecker, checksumAlgorithmFn, checksumLocationName, streamHasher } = options; + const checksumRequired = base64Encoder !== void 0 && checksumAlgorithmFn !== void 0 && checksumLocationName !== void 0 && streamHasher !== void 0; + const digest = checksumRequired ? streamHasher(checksumAlgorithmFn, readableStream) : void 0; + const awsChunkedEncodingStream = new stream_1.Readable({ read: () => { + } }); + readableStream.on("data", (data) => { + const length = bodyLengthChecker(data) || 0; + awsChunkedEncodingStream.push(`${length.toString(16)}\r +`); + awsChunkedEncodingStream.push(data); + awsChunkedEncodingStream.push("\r\n"); + }); + readableStream.on("end", async () => { + awsChunkedEncodingStream.push(`0\r +`); + if (checksumRequired) { + const checksum = base64Encoder(await digest); + awsChunkedEncodingStream.push(`${checksumLocationName}:${checksum}\r +`); + awsChunkedEncodingStream.push(`\r +`); + } + awsChunkedEncodingStream.push(null); + }); + return awsChunkedEncodingStream; }; - exports2.fromIni = fromIni; + exports2.getAwsChunkedEncodingStream = getAwsChunkedEncodingStream2; } }); -// ../../../node_modules/@aws-sdk/credential-provider-ini/dist-cjs/index.js -var require_dist_cjs49 = __commonJS({ - "../../../node_modules/@aws-sdk/credential-provider-ini/dist-cjs/index.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports)); - tslib_1.__exportStar(require_fromIni(), exports2); +// ../../../node_modules/@smithy/fetch-http-handler/node_modules/@smithy/querystring-builder/dist-cjs/index.js +var require_dist_cjs52 = __commonJS({ + "../../../node_modules/@smithy/fetch-http-handler/node_modules/@smithy/querystring-builder/dist-cjs/index.js"(exports2, module2) { + var __defProp2 = Object.defineProperty; + var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; + var __getOwnPropNames2 = Object.getOwnPropertyNames; + var __hasOwnProp2 = Object.prototype.hasOwnProperty; + var __name = (target, value) => __defProp2(target, "name", { value, configurable: true }); + var __export2 = (target, all) => { + for (var name in all) + __defProp2(target, name, { get: all[name], enumerable: true }); + }; + var __copyProps2 = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames2(from)) + if (!__hasOwnProp2.call(to, key) && key !== except) + __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable }); + } + return to; + }; + var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); + var src_exports = {}; + __export2(src_exports, { + buildQueryString: () => buildQueryString + }); + module2.exports = __toCommonJS2(src_exports); + var import_util_uri_escape = require_dist_cjs31(); + function buildQueryString(query) { + const parts = []; + for (let key of Object.keys(query).sort()) { + const value = query[key]; + key = (0, import_util_uri_escape.escapeUri)(key); + if (Array.isArray(value)) { + for (let i = 0, iLen = value.length; i < iLen; i++) { + parts.push(`${key}=${(0, import_util_uri_escape.escapeUri)(value[i])}`); + } + } else { + let qsEntry = key; + if (value || typeof value === "string") { + qsEntry += `=${(0, import_util_uri_escape.escapeUri)(value)}`; + } + parts.push(qsEntry); + } + } + return parts.join("&"); + } + __name(buildQueryString, "buildQueryString"); } }); -// ../../../node_modules/@aws-sdk/credential-provider-node/dist-cjs/remoteProvider.js -var require_remoteProvider = __commonJS({ - "../../../node_modules/@aws-sdk/credential-provider-node/dist-cjs/remoteProvider.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.remoteProvider = exports2.ENV_IMDS_DISABLED = void 0; - var credential_provider_imds_1 = require_dist_cjs38(); - var property_provider_1 = require_dist_cjs6(); - exports2.ENV_IMDS_DISABLED = "AWS_EC2_METADATA_DISABLED"; - var remoteProvider = (init) => { - if (process.env[credential_provider_imds_1.ENV_CMDS_RELATIVE_URI] || process.env[credential_provider_imds_1.ENV_CMDS_FULL_URI]) { - return (0, credential_provider_imds_1.fromContainerMetadata)(init); - } - if (process.env[exports2.ENV_IMDS_DISABLED]) { - return async () => { - throw new property_provider_1.CredentialsProviderError("EC2 Instance Metadata Service access disabled"); +// ../../../node_modules/@smithy/fetch-http-handler/dist-cjs/index.js +var require_dist_cjs53 = __commonJS({ + "../../../node_modules/@smithy/fetch-http-handler/dist-cjs/index.js"(exports2, module2) { + var __defProp2 = Object.defineProperty; + var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; + var __getOwnPropNames2 = Object.getOwnPropertyNames; + var __hasOwnProp2 = Object.prototype.hasOwnProperty; + var __name = (target, value) => __defProp2(target, "name", { value, configurable: true }); + var __export2 = (target, all) => { + for (var name in all) + __defProp2(target, name, { get: all[name], enumerable: true }); + }; + var __copyProps2 = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames2(from)) + if (!__hasOwnProp2.call(to, key) && key !== except) + __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable }); + } + return to; + }; + var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); + var src_exports = {}; + __export2(src_exports, { + FetchHttpHandler: () => FetchHttpHandler, + keepAliveSupport: () => keepAliveSupport, + streamCollector: () => streamCollector + }); + module2.exports = __toCommonJS2(src_exports); + var import_protocol_http8 = require_dist_cjs2(); + var import_querystring_builder = require_dist_cjs52(); + function requestTimeout(timeoutInMs = 0) { + return new Promise((resolve, reject) => { + if (timeoutInMs) { + setTimeout(() => { + const timeoutError = new Error(`Request did not complete within ${timeoutInMs} ms`); + timeoutError.name = "TimeoutError"; + reject(timeoutError); + }, timeoutInMs); + } + }); + } + __name(requestTimeout, "requestTimeout"); + var keepAliveSupport = { + supported: void 0 + }; + var _FetchHttpHandler = class _FetchHttpHandler2 { + /** + * @returns the input if it is an HttpHandler of any class, + * or instantiates a new instance of this handler. + */ + static create(instanceOrOptions) { + if (typeof (instanceOrOptions == null ? void 0 : instanceOrOptions.handle) === "function") { + return instanceOrOptions; + } + return new _FetchHttpHandler2(instanceOrOptions); + } + constructor(options) { + if (typeof options === "function") { + this.configProvider = options().then((opts) => opts || {}); + } else { + this.config = options ?? {}; + this.configProvider = Promise.resolve(this.config); + } + if (keepAliveSupport.supported === void 0) { + keepAliveSupport.supported = Boolean( + typeof Request !== "undefined" && "keepalive" in new Request("https://[::1]") + ); + } + } + destroy() { + } + async handle(request2, { abortSignal } = {}) { + if (!this.config) { + this.config = await this.configProvider; + } + const requestTimeoutInMs = this.config.requestTimeout; + const keepAlive = this.config.keepAlive === true; + const credentials = this.config.credentials; + if (abortSignal == null ? void 0 : abortSignal.aborted) { + const abortError = new Error("Request aborted"); + abortError.name = "AbortError"; + return Promise.reject(abortError); + } + let path = request2.path; + const queryString = (0, import_querystring_builder.buildQueryString)(request2.query || {}); + if (queryString) { + path += `?${queryString}`; + } + if (request2.fragment) { + path += `#${request2.fragment}`; + } + let auth = ""; + if (request2.username != null || request2.password != null) { + const username = request2.username ?? ""; + const password = request2.password ?? ""; + auth = `${username}:${password}@`; + } + const { port, method } = request2; + const url2 = `${request2.protocol}//${auth}${request2.hostname}${port ? `:${port}` : ""}${path}`; + const body = method === "GET" || method === "HEAD" ? void 0 : request2.body; + const requestOptions = { + body, + headers: new Headers(request2.headers), + method, + credentials }; + if (body) { + requestOptions.duplex = "half"; + } + if (typeof AbortController !== "undefined") { + requestOptions.signal = abortSignal; + } + if (keepAliveSupport.supported) { + requestOptions.keepalive = keepAlive; + } + let removeSignalEventListener = /* @__PURE__ */ __name(() => { + }, "removeSignalEventListener"); + const fetchRequest = new Request(url2, requestOptions); + const raceOfPromises = [ + fetch(fetchRequest).then((response) => { + const fetchHeaders = response.headers; + const transformedHeaders = {}; + for (const pair of fetchHeaders.entries()) { + transformedHeaders[pair[0]] = pair[1]; + } + const hasReadableStream = response.body != void 0; + if (!hasReadableStream) { + return response.blob().then((body2) => ({ + response: new import_protocol_http8.HttpResponse({ + headers: transformedHeaders, + reason: response.statusText, + statusCode: response.status, + body: body2 + }) + })); + } + return { + response: new import_protocol_http8.HttpResponse({ + headers: transformedHeaders, + reason: response.statusText, + statusCode: response.status, + body: response.body + }) + }; + }), + requestTimeout(requestTimeoutInMs) + ]; + if (abortSignal) { + raceOfPromises.push( + new Promise((resolve, reject) => { + const onAbort = /* @__PURE__ */ __name(() => { + const abortError = new Error("Request aborted"); + abortError.name = "AbortError"; + reject(abortError); + }, "onAbort"); + if (typeof abortSignal.addEventListener === "function") { + const signal = abortSignal; + signal.addEventListener("abort", onAbort, { once: true }); + removeSignalEventListener = /* @__PURE__ */ __name(() => signal.removeEventListener("abort", onAbort), "removeSignalEventListener"); + } else { + abortSignal.onabort = onAbort; + } + }) + ); + } + return Promise.race(raceOfPromises).finally(removeSignalEventListener); + } + updateHttpClientConfig(key, value) { + this.config = void 0; + this.configProvider = this.configProvider.then((config) => { + config[key] = value; + return config; + }); + } + httpHandlerConfigs() { + return this.config ?? {}; } - return (0, credential_provider_imds_1.fromInstanceMetadata)(init); }; - exports2.remoteProvider = remoteProvider; - } -}); - -// ../../../node_modules/@aws-sdk/credential-provider-node/dist-cjs/defaultProvider.js -var require_defaultProvider = __commonJS({ - "../../../node_modules/@aws-sdk/credential-provider-node/dist-cjs/defaultProvider.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.defaultProvider = void 0; - var credential_provider_env_1 = require_dist_cjs37(); - var credential_provider_ini_1 = require_dist_cjs49(); - var credential_provider_process_1 = require_dist_cjs39(); - var credential_provider_sso_1 = require_dist_cjs47(); - var credential_provider_web_identity_1 = require_dist_cjs48(); - var property_provider_1 = require_dist_cjs6(); - var shared_ini_file_loader_1 = require_dist_cjs21(); - var remoteProvider_1 = require_remoteProvider(); - var defaultProvider = (init = {}) => (0, property_provider_1.memoize)((0, property_provider_1.chain)(...init.profile || process.env[shared_ini_file_loader_1.ENV_PROFILE] ? [] : [(0, credential_provider_env_1.fromEnv)()], (0, credential_provider_sso_1.fromSSO)(init), (0, credential_provider_ini_1.fromIni)(init), (0, credential_provider_process_1.fromProcess)(init), (0, credential_provider_web_identity_1.fromTokenFile)(init), (0, remoteProvider_1.remoteProvider)(init), async () => { - throw new property_provider_1.CredentialsProviderError("Could not load credentials from any providers", false); - }), (credentials) => credentials.expiration !== void 0 && credentials.expiration.getTime() - Date.now() < 3e5, (credentials) => credentials.expiration !== void 0); - exports2.defaultProvider = defaultProvider; + __name(_FetchHttpHandler, "FetchHttpHandler"); + var FetchHttpHandler = _FetchHttpHandler; + var import_util_base64 = require_dist_cjs29(); + var streamCollector = /* @__PURE__ */ __name((stream) => { + if (typeof Blob === "function" && stream instanceof Blob) { + return collectBlob(stream); + } + return collectStream(stream); + }, "streamCollector"); + async function collectBlob(blob) { + const base64 = await readToBase64(blob); + const arrayBuffer = (0, import_util_base64.fromBase64)(base64); + return new Uint8Array(arrayBuffer); + } + __name(collectBlob, "collectBlob"); + async function collectStream(stream) { + const chunks = []; + const reader = stream.getReader(); + let isDone = false; + let length = 0; + while (!isDone) { + const { done, value } = await reader.read(); + if (value) { + chunks.push(value); + length += value.length; + } + isDone = done; + } + const collected = new Uint8Array(length); + let offset = 0; + for (const chunk of chunks) { + collected.set(chunk, offset); + offset += chunk.length; + } + return collected; + } + __name(collectStream, "collectStream"); + function readToBase64(blob) { + return new Promise((resolve, reject) => { + const reader = new FileReader(); + reader.onloadend = () => { + if (reader.readyState !== 2) { + return reject(new Error("Reader aborted too early")); + } + const result = reader.result ?? ""; + const commaIndex = result.indexOf(","); + const dataOffset = commaIndex > -1 ? commaIndex + 1 : result.length; + resolve(result.substring(dataOffset)); + }; + reader.onabort = () => reject(new Error("Read aborted")); + reader.onerror = () => reject(reader.error); + reader.readAsDataURL(blob); + }); + } + __name(readToBase64, "readToBase64"); } }); -// ../../../node_modules/@aws-sdk/credential-provider-node/dist-cjs/index.js -var require_dist_cjs50 = __commonJS({ - "../../../node_modules/@aws-sdk/credential-provider-node/dist-cjs/index.js"(exports2) { +// ../../../node_modules/@smithy/util-stream/dist-cjs/stream-type-check.js +var require_stream_type_check2 = __commonJS({ + "../../../node_modules/@smithy/util-stream/dist-cjs/stream-type-check.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); - var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports)); - tslib_1.__exportStar(require_defaultProvider(), exports2); + exports2.isReadableStream = void 0; + var isReadableStream2 = (stream) => { + var _a; + return typeof ReadableStream === "function" && (((_a = stream === null || stream === void 0 ? void 0 : stream.constructor) === null || _a === void 0 ? void 0 : _a.name) === ReadableStream.name || stream instanceof ReadableStream); + }; + exports2.isReadableStream = isReadableStream2; } }); -// ../../../node_modules/@aws-sdk/client-sts/dist-cjs/endpoint/ruleset.js -var require_ruleset2 = __commonJS({ - "../../../node_modules/@aws-sdk/client-sts/dist-cjs/endpoint/ruleset.js"(exports2) { +// ../../../node_modules/@smithy/util-stream/dist-cjs/sdk-stream-mixin.browser.js +var require_sdk_stream_mixin_browser2 = __commonJS({ + "../../../node_modules/@smithy/util-stream/dist-cjs/sdk-stream-mixin.browser.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.ruleSet = void 0; - var F = "required"; - var G = "type"; - var H = "fn"; - var I = "argv"; - var J = "ref"; - var a = false; - var b = true; - var c = "booleanEquals"; - var d = "tree"; - var e = "stringEquals"; - var f = "sigv4"; - var g = "sts"; - var h = "us-east-1"; - var i = "endpoint"; - var j = "https://sts.{Region}.{PartitionResult#dnsSuffix}"; - var k = "error"; - var l = "getAttr"; - var m = { [F]: false, [G]: "String" }; - var n = { [F]: true, "default": false, [G]: "Boolean" }; - var o = { [J]: "Endpoint" }; - var p = { [H]: "isSet", [I]: [{ [J]: "Region" }] }; - var q = { [J]: "Region" }; - var r = { [H]: "aws.partition", [I]: [q], "assign": "PartitionResult" }; - var s = { [J]: "UseFIPS" }; - var t = { [J]: "UseDualStack" }; - var u = { "url": "https://sts.amazonaws.com", "properties": { "authSchemes": [{ "name": f, "signingName": g, "signingRegion": h }] }, "headers": {} }; - var v = {}; - var w = { "conditions": [{ [H]: e, [I]: [q, "aws-global"] }], [i]: u, [G]: i }; - var x = { [H]: c, [I]: [s, true] }; - var y = { [H]: c, [I]: [t, true] }; - var z = { [H]: c, [I]: [true, { [H]: l, [I]: [{ [J]: "PartitionResult" }, "supportsFIPS"] }] }; - var A = { [J]: "PartitionResult" }; - var B = { [H]: c, [I]: [true, { [H]: l, [I]: [A, "supportsDualStack"] }] }; - var C = [{ [H]: "isSet", [I]: [o] }]; - var D = [x]; - var E = [y]; - var _data = { version: "1.0", parameters: { Region: m, UseDualStack: n, UseFIPS: n, Endpoint: m, UseGlobalEndpoint: n }, rules: [{ conditions: [{ [H]: c, [I]: [{ [J]: "UseGlobalEndpoint" }, b] }, { [H]: "not", [I]: C }, p, r, { [H]: c, [I]: [s, a] }, { [H]: c, [I]: [t, a] }], [G]: d, rules: [{ conditions: [{ [H]: e, [I]: [q, "ap-northeast-1"] }], endpoint: u, [G]: i }, { conditions: [{ [H]: e, [I]: [q, "ap-south-1"] }], endpoint: u, [G]: i }, { conditions: [{ [H]: e, [I]: [q, "ap-southeast-1"] }], endpoint: u, [G]: i }, { conditions: [{ [H]: e, [I]: [q, "ap-southeast-2"] }], endpoint: u, [G]: i }, w, { conditions: [{ [H]: e, [I]: [q, "ca-central-1"] }], endpoint: u, [G]: i }, { conditions: [{ [H]: e, [I]: [q, "eu-central-1"] }], endpoint: u, [G]: i }, { conditions: [{ [H]: e, [I]: [q, "eu-north-1"] }], endpoint: u, [G]: i }, { conditions: [{ [H]: e, [I]: [q, "eu-west-1"] }], endpoint: u, [G]: i }, { conditions: [{ [H]: e, [I]: [q, "eu-west-2"] }], endpoint: u, [G]: i }, { conditions: [{ [H]: e, [I]: [q, "eu-west-3"] }], endpoint: u, [G]: i }, { conditions: [{ [H]: e, [I]: [q, "sa-east-1"] }], endpoint: u, [G]: i }, { conditions: [{ [H]: e, [I]: [q, h] }], endpoint: u, [G]: i }, { conditions: [{ [H]: e, [I]: [q, "us-east-2"] }], endpoint: u, [G]: i }, { conditions: [{ [H]: e, [I]: [q, "us-west-1"] }], endpoint: u, [G]: i }, { conditions: [{ [H]: e, [I]: [q, "us-west-2"] }], endpoint: u, [G]: i }, { endpoint: { url: j, properties: { authSchemes: [{ name: f, signingName: g, signingRegion: "{Region}" }] }, headers: v }, [G]: i }] }, { conditions: C, [G]: d, rules: [{ conditions: D, error: "Invalid Configuration: FIPS and custom endpoint are not supported", [G]: k }, { conditions: E, error: "Invalid Configuration: Dualstack and custom endpoint are not supported", [G]: k }, { endpoint: { url: o, properties: v, headers: v }, [G]: i }] }, { conditions: [p], [G]: d, rules: [{ conditions: [r], [G]: d, rules: [{ conditions: [x, y], [G]: d, rules: [{ conditions: [z, B], [G]: d, rules: [{ endpoint: { url: "https://sts-fips.{Region}.{PartitionResult#dualStackDnsSuffix}", properties: v, headers: v }, [G]: i }] }, { error: "FIPS and DualStack are enabled, but this partition does not support one or both", [G]: k }] }, { conditions: D, [G]: d, rules: [{ conditions: [z], [G]: d, rules: [{ conditions: [{ [H]: e, [I]: ["aws-us-gov", { [H]: l, [I]: [A, "name"] }] }], endpoint: { url: "https://sts.{Region}.amazonaws.com", properties: v, headers: v }, [G]: i }, { endpoint: { url: "https://sts-fips.{Region}.{PartitionResult#dnsSuffix}", properties: v, headers: v }, [G]: i }] }, { error: "FIPS is enabled but this partition does not support FIPS", [G]: k }] }, { conditions: E, [G]: d, rules: [{ conditions: [B], [G]: d, rules: [{ endpoint: { url: "https://sts.{Region}.{PartitionResult#dualStackDnsSuffix}", properties: v, headers: v }, [G]: i }] }, { error: "DualStack is enabled but this partition does not support DualStack", [G]: k }] }, w, { endpoint: { url: j, properties: v, headers: v }, [G]: i }] }] }, { error: "Invalid Configuration: Missing Region", [G]: k }] }; - exports2.ruleSet = _data; + exports2.sdkStreamMixin = void 0; + var fetch_http_handler_1 = require_dist_cjs53(); + var util_base64_1 = require_dist_cjs29(); + var util_hex_encoding_1 = require_dist_cjs35(); + var util_utf8_1 = require_dist_cjs28(); + var stream_type_check_1 = require_stream_type_check2(); + var ERR_MSG_STREAM_HAS_BEEN_TRANSFORMED = "The stream has already been transformed."; + var sdkStreamMixin2 = (stream) => { + var _a, _b; + if (!isBlobInstance(stream) && !(0, stream_type_check_1.isReadableStream)(stream)) { + const name = ((_b = (_a = stream === null || stream === void 0 ? void 0 : stream.__proto__) === null || _a === void 0 ? void 0 : _a.constructor) === null || _b === void 0 ? void 0 : _b.name) || stream; + throw new Error(`Unexpected stream implementation, expect Blob or ReadableStream, got ${name}`); + } + let transformed = false; + const transformToByteArray = async () => { + if (transformed) { + throw new Error(ERR_MSG_STREAM_HAS_BEEN_TRANSFORMED); + } + transformed = true; + return await (0, fetch_http_handler_1.streamCollector)(stream); + }; + const blobToWebStream = (blob) => { + if (typeof blob.stream !== "function") { + throw new Error("Cannot transform payload Blob to web stream. Please make sure the Blob.stream() is polyfilled.\nIf you are using React Native, this API is not yet supported, see: https://react-native.canny.io/feature-requests/p/fetch-streaming-body"); + } + return blob.stream(); + }; + return Object.assign(stream, { + transformToByteArray, + transformToString: async (encoding) => { + const buf = await transformToByteArray(); + if (encoding === "base64") { + return (0, util_base64_1.toBase64)(buf); + } else if (encoding === "hex") { + return (0, util_hex_encoding_1.toHex)(buf); + } else if (encoding === void 0 || encoding === "utf8" || encoding === "utf-8") { + return (0, util_utf8_1.toUtf8)(buf); + } else if (typeof TextDecoder === "function") { + return new TextDecoder(encoding).decode(buf); + } else { + throw new Error("TextDecoder is not available, please make sure polyfill is provided."); + } + }, + transformToWebStream: () => { + if (transformed) { + throw new Error(ERR_MSG_STREAM_HAS_BEEN_TRANSFORMED); + } + transformed = true; + if (isBlobInstance(stream)) { + return blobToWebStream(stream); + } else if ((0, stream_type_check_1.isReadableStream)(stream)) { + return stream; + } else { + throw new Error(`Cannot transform payload to web stream, got ${stream}`); + } + } + }); + }; + exports2.sdkStreamMixin = sdkStreamMixin2; + var isBlobInstance = (stream) => typeof Blob === "function" && stream instanceof Blob; } }); -// ../../../node_modules/@aws-sdk/client-sts/dist-cjs/endpoint/endpointResolver.js -var require_endpointResolver2 = __commonJS({ - "../../../node_modules/@aws-sdk/client-sts/dist-cjs/endpoint/endpointResolver.js"(exports2) { +// ../../../node_modules/@smithy/util-stream/dist-cjs/sdk-stream-mixin.js +var require_sdk_stream_mixin2 = __commonJS({ + "../../../node_modules/@smithy/util-stream/dist-cjs/sdk-stream-mixin.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.defaultEndpointResolver = void 0; - var util_endpoints_1 = require_dist_cjs16(); - var ruleset_1 = require_ruleset2(); - var defaultEndpointResolver = (endpointParams, context = {}) => { - return (0, util_endpoints_1.resolveEndpoint)(ruleset_1.ruleSet, { - endpointParams, - logger: context.logger + exports2.sdkStreamMixin = void 0; + var node_http_handler_1 = require_dist_cjs51(); + var util_buffer_from_1 = require_dist_cjs27(); + var stream_1 = require("stream"); + var util_1 = require("util"); + var sdk_stream_mixin_browser_1 = require_sdk_stream_mixin_browser2(); + var ERR_MSG_STREAM_HAS_BEEN_TRANSFORMED = "The stream has already been transformed."; + var sdkStreamMixin2 = (stream) => { + var _a, _b; + if (!(stream instanceof stream_1.Readable)) { + try { + return (0, sdk_stream_mixin_browser_1.sdkStreamMixin)(stream); + } catch (e) { + const name = ((_b = (_a = stream === null || stream === void 0 ? void 0 : stream.__proto__) === null || _a === void 0 ? void 0 : _a.constructor) === null || _b === void 0 ? void 0 : _b.name) || stream; + throw new Error(`Unexpected stream implementation, expect Stream.Readable instance, got ${name}`); + } + } + let transformed = false; + const transformToByteArray = async () => { + if (transformed) { + throw new Error(ERR_MSG_STREAM_HAS_BEEN_TRANSFORMED); + } + transformed = true; + return await (0, node_http_handler_1.streamCollector)(stream); + }; + return Object.assign(stream, { + transformToByteArray, + transformToString: async (encoding) => { + const buf = await transformToByteArray(); + if (encoding === void 0 || Buffer.isEncoding(encoding)) { + return (0, util_buffer_from_1.fromArrayBuffer)(buf.buffer, buf.byteOffset, buf.byteLength).toString(encoding); + } else { + const decoder2 = new util_1.TextDecoder(encoding); + return decoder2.decode(buf); + } + }, + transformToWebStream: () => { + if (transformed) { + throw new Error(ERR_MSG_STREAM_HAS_BEEN_TRANSFORMED); + } + if (stream.readableFlowing !== null) { + throw new Error("The stream has been consumed by other callbacks."); + } + if (typeof stream_1.Readable.toWeb !== "function") { + throw new Error("Readable.toWeb() is not supported. Please make sure you are using Node.js >= 17.0.0, or polyfill is available."); + } + transformed = true; + return stream_1.Readable.toWeb(stream); + } }); }; - exports2.defaultEndpointResolver = defaultEndpointResolver; + exports2.sdkStreamMixin = sdkStreamMixin2; } }); -// ../../../node_modules/@aws-sdk/client-sts/dist-cjs/runtimeConfig.shared.js -var require_runtimeConfig_shared2 = __commonJS({ - "../../../node_modules/@aws-sdk/client-sts/dist-cjs/runtimeConfig.shared.js"(exports2) { +// ../../../node_modules/@smithy/util-stream/dist-cjs/splitStream.browser.js +var require_splitStream_browser2 = __commonJS({ + "../../../node_modules/@smithy/util-stream/dist-cjs/splitStream.browser.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.getRuntimeConfig = void 0; - var smithy_client_1 = require_dist_cjs34(); - var url_parser_1 = require_dist_cjs24(); - var util_base64_1 = require_dist_cjs30(); - var util_utf8_1 = require_dist_cjs10(); - var endpointResolver_1 = require_endpointResolver2(); - var getRuntimeConfig = (config) => ({ - apiVersion: "2011-06-15", - base64Decoder: config?.base64Decoder ?? util_base64_1.fromBase64, - base64Encoder: config?.base64Encoder ?? util_base64_1.toBase64, - disableHostPrefix: config?.disableHostPrefix ?? false, - endpointProvider: config?.endpointProvider ?? endpointResolver_1.defaultEndpointResolver, - extensions: config?.extensions ?? [], - logger: config?.logger ?? new smithy_client_1.NoOpLogger(), - serviceId: config?.serviceId ?? "STS", - urlParser: config?.urlParser ?? url_parser_1.parseUrl, - utf8Decoder: config?.utf8Decoder ?? util_utf8_1.fromUtf8, - utf8Encoder: config?.utf8Encoder ?? util_utf8_1.toUtf8 - }); - exports2.getRuntimeConfig = getRuntimeConfig; + exports2.splitStream = void 0; + async function splitStream2(stream) { + if (typeof stream.stream === "function") { + stream = stream.stream(); + } + const readableStream = stream; + return readableStream.tee(); + } + exports2.splitStream = splitStream2; } }); -// ../../../node_modules/@aws-sdk/client-sts/dist-cjs/runtimeConfig.js -var require_runtimeConfig2 = __commonJS({ - "../../../node_modules/@aws-sdk/client-sts/dist-cjs/runtimeConfig.js"(exports2) { +// ../../../node_modules/@smithy/util-stream/dist-cjs/splitStream.js +var require_splitStream2 = __commonJS({ + "../../../node_modules/@smithy/util-stream/dist-cjs/splitStream.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.getRuntimeConfig = void 0; - var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports)); - var package_json_1 = tslib_1.__importDefault(require_package2()); - var defaultStsRoleAssumers_1 = require_defaultStsRoleAssumers(); - var credential_provider_node_1 = require_dist_cjs50(); - var util_user_agent_node_1 = require_dist_cjs40(); - var config_resolver_1 = require_dist_cjs19(); - var hash_node_1 = require_dist_cjs41(); - var middleware_retry_1 = require_dist_cjs35(); - var node_config_provider_1 = require_dist_cjs22(); - var node_http_handler_1 = require_dist_cjs32(); - var util_body_length_node_1 = require_dist_cjs42(); - var util_retry_1 = require_dist_cjs28(); - var runtimeConfig_shared_1 = require_runtimeConfig_shared2(); - var smithy_client_1 = require_dist_cjs34(); - var util_defaults_mode_node_1 = require_dist_cjs43(); - var smithy_client_2 = require_dist_cjs34(); - var getRuntimeConfig = (config) => { - (0, smithy_client_2.emitWarningIfUnsupportedVersion)(process.version); - const defaultsMode = (0, util_defaults_mode_node_1.resolveDefaultsModeConfig)(config); - const defaultConfigProvider = () => defaultsMode().then(smithy_client_1.loadConfigsForDefaultMode); - const clientSharedValues = (0, runtimeConfig_shared_1.getRuntimeConfig)(config); - return { - ...clientSharedValues, - ...config, - runtime: "node", - defaultsMode, - bodyLengthChecker: config?.bodyLengthChecker ?? util_body_length_node_1.calculateBodyLength, - credentialDefaultProvider: config?.credentialDefaultProvider ?? (0, defaultStsRoleAssumers_1.decorateDefaultCredentialProvider)(credential_provider_node_1.defaultProvider), - defaultUserAgentProvider: config?.defaultUserAgentProvider ?? (0, util_user_agent_node_1.defaultUserAgent)({ serviceId: clientSharedValues.serviceId, clientVersion: package_json_1.default.version }), - maxAttempts: config?.maxAttempts ?? (0, node_config_provider_1.loadConfig)(middleware_retry_1.NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: config?.region ?? (0, node_config_provider_1.loadConfig)(config_resolver_1.NODE_REGION_CONFIG_OPTIONS, config_resolver_1.NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: config?.requestHandler ?? new node_http_handler_1.NodeHttpHandler(defaultConfigProvider), - retryMode: config?.retryMode ?? (0, node_config_provider_1.loadConfig)({ - ...middleware_retry_1.NODE_RETRY_MODE_CONFIG_OPTIONS, - default: async () => (await defaultConfigProvider()).retryMode || util_retry_1.DEFAULT_RETRY_MODE - }), - sha256: config?.sha256 ?? hash_node_1.Hash.bind(null, "sha256"), - streamCollector: config?.streamCollector ?? node_http_handler_1.streamCollector, - useDualstackEndpoint: config?.useDualstackEndpoint ?? (0, node_config_provider_1.loadConfig)(config_resolver_1.NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS), - useFipsEndpoint: config?.useFipsEndpoint ?? (0, node_config_provider_1.loadConfig)(config_resolver_1.NODE_USE_FIPS_ENDPOINT_CONFIG_OPTIONS) - }; - }; - exports2.getRuntimeConfig = getRuntimeConfig; + exports2.splitStream = void 0; + var stream_1 = require("stream"); + var splitStream_browser_1 = require_splitStream_browser2(); + var stream_type_check_1 = require_stream_type_check2(); + async function splitStream2(stream) { + if ((0, stream_type_check_1.isReadableStream)(stream)) { + return (0, splitStream_browser_1.splitStream)(stream); + } + const stream1 = new stream_1.PassThrough(); + const stream2 = new stream_1.PassThrough(); + stream.pipe(stream1); + stream.pipe(stream2); + return [stream1, stream2]; + } + exports2.splitStream = splitStream2; } }); -// ../../../node_modules/@aws-sdk/client-sts/dist-cjs/runtimeExtensions.js -var require_runtimeExtensions2 = __commonJS({ - "../../../node_modules/@aws-sdk/client-sts/dist-cjs/runtimeExtensions.js"(exports2) { +// ../../../node_modules/@smithy/util-stream/dist-cjs/headStream.browser.js +var require_headStream_browser2 = __commonJS({ + "../../../node_modules/@smithy/util-stream/dist-cjs/headStream.browser.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.resolveRuntimeExtensions = void 0; - var region_config_resolver_1 = require_dist_cjs44(); - var protocol_http_1 = require_dist_cjs2(); - var smithy_client_1 = require_dist_cjs34(); - var asPartial = (t) => t; - var resolveRuntimeExtensions = (runtimeConfig, extensions) => { - const extensionConfiguration = { - ...asPartial((0, region_config_resolver_1.getAwsRegionExtensionConfiguration)(runtimeConfig)), - ...asPartial((0, smithy_client_1.getDefaultExtensionConfiguration)(runtimeConfig)), - ...asPartial((0, protocol_http_1.getHttpHandlerExtensionConfiguration)(runtimeConfig)) - }; - extensions.forEach((extension) => extension.configure(extensionConfiguration)); - return { - ...runtimeConfig, - ...(0, region_config_resolver_1.resolveAwsRegionExtensionConfiguration)(extensionConfiguration), - ...(0, smithy_client_1.resolveDefaultRuntimeConfig)(extensionConfiguration), - ...(0, protocol_http_1.resolveHttpHandlerRuntimeConfig)(extensionConfiguration) - }; - }; - exports2.resolveRuntimeExtensions = resolveRuntimeExtensions; + exports2.headStream = void 0; + async function headStream2(stream, bytes) { + var _a; + let byteLengthCounter = 0; + const chunks = []; + const reader = stream.getReader(); + let isDone = false; + while (!isDone) { + const { done, value } = await reader.read(); + if (value) { + chunks.push(value); + byteLengthCounter += (_a = value === null || value === void 0 ? void 0 : value.byteLength) !== null && _a !== void 0 ? _a : 0; + } + if (byteLengthCounter >= bytes) { + break; + } + isDone = done; + } + reader.releaseLock(); + const collected = new Uint8Array(Math.min(bytes, byteLengthCounter)); + let offset = 0; + for (const chunk of chunks) { + if (chunk.byteLength > collected.byteLength - offset) { + collected.set(chunk.subarray(0, collected.byteLength - offset), offset); + break; + } else { + collected.set(chunk, offset); + } + offset += chunk.length; + } + return collected; + } + exports2.headStream = headStream2; } }); -// ../../../node_modules/@aws-sdk/client-sts/dist-cjs/STSClient.js -var require_STSClient = __commonJS({ - "../../../node_modules/@aws-sdk/client-sts/dist-cjs/STSClient.js"(exports2) { +// ../../../node_modules/@smithy/util-stream/dist-cjs/headStream.js +var require_headStream2 = __commonJS({ + "../../../node_modules/@smithy/util-stream/dist-cjs/headStream.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.STSClient = exports2.__Client = void 0; - var middleware_host_header_1 = require_dist_cjs3(); - var middleware_logger_1 = require_dist_cjs4(); - var middleware_recursion_detection_1 = require_dist_cjs5(); - var middleware_sdk_sts_1 = require_dist_cjs36(); - var middleware_user_agent_1 = require_dist_cjs17(); - var config_resolver_1 = require_dist_cjs19(); - var middleware_content_length_1 = require_dist_cjs20(); - var middleware_endpoint_1 = require_dist_cjs26(); - var middleware_retry_1 = require_dist_cjs35(); - var smithy_client_1 = require_dist_cjs34(); - Object.defineProperty(exports2, "__Client", { enumerable: true, get: function() { - return smithy_client_1.Client; - } }); - var EndpointParameters_1 = require_EndpointParameters2(); - var runtimeConfig_1 = require_runtimeConfig2(); - var runtimeExtensions_1 = require_runtimeExtensions2(); - var STSClient = class _STSClient extends smithy_client_1.Client { - constructor(...[configuration]) { - const _config_0 = (0, runtimeConfig_1.getRuntimeConfig)(configuration || {}); - const _config_1 = (0, EndpointParameters_1.resolveClientEndpointParameters)(_config_0); - const _config_2 = (0, config_resolver_1.resolveRegionConfig)(_config_1); - const _config_3 = (0, middleware_endpoint_1.resolveEndpointConfig)(_config_2); - const _config_4 = (0, middleware_retry_1.resolveRetryConfig)(_config_3); - const _config_5 = (0, middleware_host_header_1.resolveHostHeaderConfig)(_config_4); - const _config_6 = (0, middleware_sdk_sts_1.resolveStsAuthConfig)(_config_5, { stsClientCtor: _STSClient }); - const _config_7 = (0, middleware_user_agent_1.resolveUserAgentConfig)(_config_6); - const _config_8 = (0, runtimeExtensions_1.resolveRuntimeExtensions)(_config_7, configuration?.extensions || []); - super(_config_8); - this.config = _config_8; - this.middlewareStack.use((0, middleware_retry_1.getRetryPlugin)(this.config)); - this.middlewareStack.use((0, middleware_content_length_1.getContentLengthPlugin)(this.config)); - this.middlewareStack.use((0, middleware_host_header_1.getHostHeaderPlugin)(this.config)); - this.middlewareStack.use((0, middleware_logger_1.getLoggerPlugin)(this.config)); - this.middlewareStack.use((0, middleware_recursion_detection_1.getRecursionDetectionPlugin)(this.config)); - this.middlewareStack.use((0, middleware_user_agent_1.getUserAgentPlugin)(this.config)); + exports2.headStream = void 0; + var stream_1 = require("stream"); + var headStream_browser_1 = require_headStream_browser2(); + var stream_type_check_1 = require_stream_type_check2(); + var headStream2 = (stream, bytes) => { + if ((0, stream_type_check_1.isReadableStream)(stream)) { + return (0, headStream_browser_1.headStream)(stream, bytes); } - destroy() { - super.destroy(); + return new Promise((resolve, reject) => { + const collector = new Collector(); + collector.limit = bytes; + stream.pipe(collector); + stream.on("error", (err) => { + collector.end(); + reject(err); + }); + collector.on("error", reject); + collector.on("finish", function() { + const bytes2 = new Uint8Array(Buffer.concat(this.buffers)); + resolve(bytes2); + }); + }); + }; + exports2.headStream = headStream2; + var Collector = class extends stream_1.Writable { + constructor() { + super(...arguments); + this.buffers = []; + this.limit = Infinity; + this.bytesBuffered = 0; + } + _write(chunk, encoding, callback) { + var _a; + this.buffers.push(chunk); + this.bytesBuffered += (_a = chunk.byteLength) !== null && _a !== void 0 ? _a : 0; + if (this.bytesBuffered >= this.limit) { + const excess = this.bytesBuffered - this.limit; + const tailBuffer = this.buffers[this.buffers.length - 1]; + this.buffers[this.buffers.length - 1] = tailBuffer.subarray(0, tailBuffer.byteLength - excess); + this.emit("finish"); + } + callback(); } }; - exports2.STSClient = STSClient; } }); -// ../../../node_modules/@aws-sdk/client-sts/dist-cjs/commands/AssumeRoleWithSAMLCommand.js -var require_AssumeRoleWithSAMLCommand = __commonJS({ - "../../../node_modules/@aws-sdk/client-sts/dist-cjs/commands/AssumeRoleWithSAMLCommand.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.AssumeRoleWithSAMLCommand = exports2.$Command = void 0; - var middleware_endpoint_1 = require_dist_cjs26(); - var middleware_serde_1 = require_dist_cjs25(); - var smithy_client_1 = require_dist_cjs34(); - Object.defineProperty(exports2, "$Command", { enumerable: true, get: function() { - return smithy_client_1.Command; - } }); - var types_1 = require_dist_cjs(); - var models_0_1 = require_models_0(); - var Aws_query_1 = require_Aws_query(); - var AssumeRoleWithSAMLCommand = class _AssumeRoleWithSAMLCommand extends smithy_client_1.Command { - static getEndpointParameterInstructions() { - return { - UseGlobalEndpoint: { type: "builtInParams", name: "useGlobalEndpoint" }, - UseFIPS: { type: "builtInParams", name: "useFipsEndpoint" }, - Endpoint: { type: "builtInParams", name: "endpoint" }, - Region: { type: "builtInParams", name: "region" }, - UseDualStack: { type: "builtInParams", name: "useDualstackEndpoint" } - }; +// ../../../node_modules/@smithy/util-stream/dist-cjs/index.js +var require_dist_cjs54 = __commonJS({ + "../../../node_modules/@smithy/util-stream/dist-cjs/index.js"(exports2, module2) { + var __defProp2 = Object.defineProperty; + var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; + var __getOwnPropNames2 = Object.getOwnPropertyNames; + var __hasOwnProp2 = Object.prototype.hasOwnProperty; + var __name = (target, value) => __defProp2(target, "name", { value, configurable: true }); + var __export2 = (target, all) => { + for (var name in all) + __defProp2(target, name, { get: all[name], enumerable: true }); + }; + var __copyProps2 = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames2(from)) + if (!__hasOwnProp2.call(to, key) && key !== except) + __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable }); } - constructor(input) { - super(); - this.input = input; + return to; + }; + var __reExport = (target, mod, secondTarget) => (__copyProps2(target, mod, "default"), secondTarget && __copyProps2(secondTarget, mod, "default")); + var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); + var src_exports = {}; + __export2(src_exports, { + Uint8ArrayBlobAdapter: () => Uint8ArrayBlobAdapter + }); + module2.exports = __toCommonJS2(src_exports); + var import_util_base64 = require_dist_cjs29(); + var import_util_utf8 = require_dist_cjs28(); + function transformToString(payload, encoding = "utf-8") { + if (encoding === "base64") { + return (0, import_util_base64.toBase64)(payload); } - resolveMiddleware(clientStack, configuration, options) { - this.middlewareStack.use((0, middleware_serde_1.getSerdePlugin)(configuration, this.serialize, this.deserialize)); - this.middlewareStack.use((0, middleware_endpoint_1.getEndpointPlugin)(configuration, _AssumeRoleWithSAMLCommand.getEndpointParameterInstructions())); - const stack = clientStack.concat(this.middlewareStack); - const { logger } = configuration; - const clientName = "STSClient"; - const commandName = "AssumeRoleWithSAMLCommand"; - const handlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: models_0_1.AssumeRoleWithSAMLRequestFilterSensitiveLog, - outputFilterSensitiveLog: models_0_1.AssumeRoleWithSAMLResponseFilterSensitiveLog, - [types_1.SMITHY_CONTEXT_KEY]: { - service: "AWSSecurityTokenServiceV20110615", - operation: "AssumeRoleWithSAML" - } - }; - const { requestHandler } = configuration; - return stack.resolve((request2) => requestHandler.handle(request2.request, options || {}), handlerExecutionContext); + return (0, import_util_utf8.toUtf8)(payload); + } + __name(transformToString, "transformToString"); + function transformFromString(str, encoding) { + if (encoding === "base64") { + return Uint8ArrayBlobAdapter.mutate((0, import_util_base64.fromBase64)(str)); + } + return Uint8ArrayBlobAdapter.mutate((0, import_util_utf8.fromUtf8)(str)); + } + __name(transformFromString, "transformFromString"); + var _Uint8ArrayBlobAdapter = class _Uint8ArrayBlobAdapter2 extends Uint8Array { + /** + * @param source - such as a string or Stream. + * @returns a new Uint8ArrayBlobAdapter extending Uint8Array. + */ + static fromString(source, encoding = "utf-8") { + switch (typeof source) { + case "string": + return transformFromString(source, encoding); + default: + throw new Error(`Unsupported conversion from ${typeof source} to Uint8ArrayBlobAdapter.`); + } } - serialize(input, context) { - return (0, Aws_query_1.se_AssumeRoleWithSAMLCommand)(input, context); + /** + * @param source - Uint8Array to be mutated. + * @returns the same Uint8Array but with prototype switched to Uint8ArrayBlobAdapter. + */ + static mutate(source) { + Object.setPrototypeOf(source, _Uint8ArrayBlobAdapter2.prototype); + return source; } - deserialize(output, context) { - return (0, Aws_query_1.de_AssumeRoleWithSAMLCommand)(output, context); + /** + * @param encoding - default 'utf-8'. + * @returns the blob as string. + */ + transformToString(encoding = "utf-8") { + return transformToString(this, encoding); } }; - exports2.AssumeRoleWithSAMLCommand = AssumeRoleWithSAMLCommand; + __name(_Uint8ArrayBlobAdapter, "Uint8ArrayBlobAdapter"); + var Uint8ArrayBlobAdapter = _Uint8ArrayBlobAdapter; + __reExport(src_exports, require_getAwsChunkedEncodingStream2(), module2.exports); + __reExport(src_exports, require_sdk_stream_mixin2(), module2.exports); + __reExport(src_exports, require_splitStream2(), module2.exports); + __reExport(src_exports, require_headStream2(), module2.exports); + __reExport(src_exports, require_stream_type_check2(), module2.exports); } }); -// ../../../node_modules/@aws-sdk/client-sts/dist-cjs/commands/DecodeAuthorizationMessageCommand.js -var require_DecodeAuthorizationMessageCommand = __commonJS({ - "../../../node_modules/@aws-sdk/client-sts/dist-cjs/commands/DecodeAuthorizationMessageCommand.js"(exports2) { +// ../../../node_modules/@aws-sdk/credential-provider-http/dist-cjs/fromHttp/requestHelpers.js +var require_requestHelpers = __commonJS({ + "../../../node_modules/@aws-sdk/credential-provider-http/dist-cjs/fromHttp/requestHelpers.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.DecodeAuthorizationMessageCommand = exports2.$Command = void 0; - var middleware_signing_1 = require_dist_cjs14(); - var middleware_endpoint_1 = require_dist_cjs26(); - var middleware_serde_1 = require_dist_cjs25(); - var smithy_client_1 = require_dist_cjs34(); - Object.defineProperty(exports2, "$Command", { enumerable: true, get: function() { - return smithy_client_1.Command; - } }); - var types_1 = require_dist_cjs(); - var Aws_query_1 = require_Aws_query(); - var DecodeAuthorizationMessageCommand = class _DecodeAuthorizationMessageCommand extends smithy_client_1.Command { - static getEndpointParameterInstructions() { + exports2.getCredentials = exports2.createGetRequest = void 0; + var property_provider_1 = require_dist_cjs40(); + var protocol_http_1 = require_dist_cjs2(); + var smithy_client_1 = require_dist_cjs37(); + var util_stream_1 = require_dist_cjs54(); + function createGetRequest(url2) { + return new protocol_http_1.HttpRequest({ + protocol: url2.protocol, + hostname: url2.hostname, + port: Number(url2.port), + path: url2.pathname, + query: Array.from(url2.searchParams.entries()).reduce((acc, [k, v]) => { + acc[k] = v; + return acc; + }, {}), + fragment: url2.hash + }); + } + exports2.createGetRequest = createGetRequest; + async function getCredentials(response, logger) { + const stream = (0, util_stream_1.sdkStreamMixin)(response.body); + const str = await stream.transformToString(); + if (response.statusCode === 200) { + const parsed = JSON.parse(str); + if (typeof parsed.AccessKeyId !== "string" || typeof parsed.SecretAccessKey !== "string" || typeof parsed.Token !== "string" || typeof parsed.Expiration !== "string") { + throw new property_provider_1.CredentialsProviderError("HTTP credential provider response not of the required format, an object matching: { AccessKeyId: string, SecretAccessKey: string, Token: string, Expiration: string(rfc3339) }", { logger }); + } return { - UseGlobalEndpoint: { type: "builtInParams", name: "useGlobalEndpoint" }, - UseFIPS: { type: "builtInParams", name: "useFipsEndpoint" }, - Endpoint: { type: "builtInParams", name: "endpoint" }, - Region: { type: "builtInParams", name: "region" }, - UseDualStack: { type: "builtInParams", name: "useDualstackEndpoint" } + accessKeyId: parsed.AccessKeyId, + secretAccessKey: parsed.SecretAccessKey, + sessionToken: parsed.Token, + expiration: (0, smithy_client_1.parseRfc3339DateTime)(parsed.Expiration) }; } - constructor(input) { - super(); - this.input = input; + if (response.statusCode >= 400 && response.statusCode < 500) { + let parsedBody = {}; + try { + parsedBody = JSON.parse(str); + } catch (e) { + } + throw Object.assign(new property_provider_1.CredentialsProviderError(`Server responded with status: ${response.statusCode}`, { logger }), { + Code: parsedBody.Code, + Message: parsedBody.Message + }); } - resolveMiddleware(clientStack, configuration, options) { - this.middlewareStack.use((0, middleware_serde_1.getSerdePlugin)(configuration, this.serialize, this.deserialize)); - this.middlewareStack.use((0, middleware_endpoint_1.getEndpointPlugin)(configuration, _DecodeAuthorizationMessageCommand.getEndpointParameterInstructions())); - this.middlewareStack.use((0, middleware_signing_1.getAwsAuthPlugin)(configuration)); - const stack = clientStack.concat(this.middlewareStack); - const { logger } = configuration; - const clientName = "STSClient"; - const commandName = "DecodeAuthorizationMessageCommand"; - const handlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: (_) => _, - outputFilterSensitiveLog: (_) => _, - [types_1.SMITHY_CONTEXT_KEY]: { - service: "AWSSecurityTokenServiceV20110615", - operation: "DecodeAuthorizationMessage" + throw new property_provider_1.CredentialsProviderError(`Server responded with status: ${response.statusCode}`, { logger }); + } + exports2.getCredentials = getCredentials; + } +}); + +// ../../../node_modules/@aws-sdk/credential-provider-http/dist-cjs/fromHttp/retry-wrapper.js +var require_retry_wrapper = __commonJS({ + "../../../node_modules/@aws-sdk/credential-provider-http/dist-cjs/fromHttp/retry-wrapper.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.retryWrapper = void 0; + var retryWrapper = (toRetry, maxRetries, delayMs) => { + return async () => { + for (let i = 0; i < maxRetries; ++i) { + try { + return await toRetry(); + } catch (e) { + await new Promise((resolve) => setTimeout(resolve, delayMs)); } - }; - const { requestHandler } = configuration; - return stack.resolve((request2) => requestHandler.handle(request2.request, options || {}), handlerExecutionContext); - } - serialize(input, context) { - return (0, Aws_query_1.se_DecodeAuthorizationMessageCommand)(input, context); - } - deserialize(output, context) { - return (0, Aws_query_1.de_DecodeAuthorizationMessageCommand)(output, context); - } + } + return await toRetry(); + }; }; - exports2.DecodeAuthorizationMessageCommand = DecodeAuthorizationMessageCommand; + exports2.retryWrapper = retryWrapper; } }); -// ../../../node_modules/@aws-sdk/client-sts/dist-cjs/commands/GetAccessKeyInfoCommand.js -var require_GetAccessKeyInfoCommand = __commonJS({ - "../../../node_modules/@aws-sdk/client-sts/dist-cjs/commands/GetAccessKeyInfoCommand.js"(exports2) { +// ../../../node_modules/@aws-sdk/credential-provider-http/dist-cjs/fromHttp/fromHttp.js +var require_fromHttp = __commonJS({ + "../../../node_modules/@aws-sdk/credential-provider-http/dist-cjs/fromHttp/fromHttp.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.GetAccessKeyInfoCommand = exports2.$Command = void 0; - var middleware_signing_1 = require_dist_cjs14(); - var middleware_endpoint_1 = require_dist_cjs26(); - var middleware_serde_1 = require_dist_cjs25(); - var smithy_client_1 = require_dist_cjs34(); - Object.defineProperty(exports2, "$Command", { enumerable: true, get: function() { - return smithy_client_1.Command; - } }); - var types_1 = require_dist_cjs(); - var Aws_query_1 = require_Aws_query(); - var GetAccessKeyInfoCommand = class _GetAccessKeyInfoCommand extends smithy_client_1.Command { - static getEndpointParameterInstructions() { - return { - UseGlobalEndpoint: { type: "builtInParams", name: "useGlobalEndpoint" }, - UseFIPS: { type: "builtInParams", name: "useFipsEndpoint" }, - Endpoint: { type: "builtInParams", name: "endpoint" }, - Region: { type: "builtInParams", name: "region" }, - UseDualStack: { type: "builtInParams", name: "useDualstackEndpoint" } - }; - } - constructor(input) { - super(); - this.input = input; - } - resolveMiddleware(clientStack, configuration, options) { - this.middlewareStack.use((0, middleware_serde_1.getSerdePlugin)(configuration, this.serialize, this.deserialize)); - this.middlewareStack.use((0, middleware_endpoint_1.getEndpointPlugin)(configuration, _GetAccessKeyInfoCommand.getEndpointParameterInstructions())); - this.middlewareStack.use((0, middleware_signing_1.getAwsAuthPlugin)(configuration)); - const stack = clientStack.concat(this.middlewareStack); - const { logger } = configuration; - const clientName = "STSClient"; - const commandName = "GetAccessKeyInfoCommand"; - const handlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: (_) => _, - outputFilterSensitiveLog: (_) => _, - [types_1.SMITHY_CONTEXT_KEY]: { - service: "AWSSecurityTokenServiceV20110615", - operation: "GetAccessKeyInfo" - } - }; - const { requestHandler } = configuration; - return stack.resolve((request2) => requestHandler.handle(request2.request, options || {}), handlerExecutionContext); - } - serialize(input, context) { - return (0, Aws_query_1.se_GetAccessKeyInfoCommand)(input, context); - } - deserialize(output, context) { - return (0, Aws_query_1.de_GetAccessKeyInfoCommand)(output, context); - } + exports2.fromHttp = void 0; + var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports)); + var node_http_handler_1 = require_dist_cjs51(); + var property_provider_1 = require_dist_cjs40(); + var promises_1 = tslib_1.__importDefault(require("fs/promises")); + var checkUrl_1 = require_checkUrl(); + var requestHelpers_1 = require_requestHelpers(); + var retry_wrapper_1 = require_retry_wrapper(); + var AWS_CONTAINER_CREDENTIALS_RELATIVE_URI = "AWS_CONTAINER_CREDENTIALS_RELATIVE_URI"; + var DEFAULT_LINK_LOCAL_HOST = "http://169.254.170.2"; + var AWS_CONTAINER_CREDENTIALS_FULL_URI = "AWS_CONTAINER_CREDENTIALS_FULL_URI"; + var AWS_CONTAINER_AUTHORIZATION_TOKEN_FILE = "AWS_CONTAINER_AUTHORIZATION_TOKEN_FILE"; + var AWS_CONTAINER_AUTHORIZATION_TOKEN = "AWS_CONTAINER_AUTHORIZATION_TOKEN"; + var fromHttp = (options = {}) => { + options.logger?.debug("@aws-sdk/credential-provider-http - fromHttp"); + let host; + const relative = options.awsContainerCredentialsRelativeUri ?? process.env[AWS_CONTAINER_CREDENTIALS_RELATIVE_URI]; + const full = options.awsContainerCredentialsFullUri ?? process.env[AWS_CONTAINER_CREDENTIALS_FULL_URI]; + const token = options.awsContainerAuthorizationToken ?? process.env[AWS_CONTAINER_AUTHORIZATION_TOKEN]; + const tokenFile = options.awsContainerAuthorizationTokenFile ?? process.env[AWS_CONTAINER_AUTHORIZATION_TOKEN_FILE]; + const warn = options.logger?.constructor?.name === "NoOpLogger" || !options.logger ? console.warn : options.logger.warn; + if (relative && full) { + warn("@aws-sdk/credential-provider-http: you have set both awsContainerCredentialsRelativeUri and awsContainerCredentialsFullUri."); + warn("awsContainerCredentialsFullUri will take precedence."); + } + if (token && tokenFile) { + warn("@aws-sdk/credential-provider-http: you have set both awsContainerAuthorizationToken and awsContainerAuthorizationTokenFile."); + warn("awsContainerAuthorizationToken will take precedence."); + } + if (full) { + host = full; + } else if (relative) { + host = `${DEFAULT_LINK_LOCAL_HOST}${relative}`; + } else { + throw new property_provider_1.CredentialsProviderError(`No HTTP credential provider host provided. +Set AWS_CONTAINER_CREDENTIALS_FULL_URI or AWS_CONTAINER_CREDENTIALS_RELATIVE_URI.`, { logger: options.logger }); + } + const url2 = new URL(host); + (0, checkUrl_1.checkUrl)(url2, options.logger); + const requestHandler = new node_http_handler_1.NodeHttpHandler({ + requestTimeout: options.timeout ?? 1e3, + connectionTimeout: options.timeout ?? 1e3 + }); + return (0, retry_wrapper_1.retryWrapper)(async () => { + const request2 = (0, requestHelpers_1.createGetRequest)(url2); + if (token) { + request2.headers.Authorization = token; + } else if (tokenFile) { + request2.headers.Authorization = (await promises_1.default.readFile(tokenFile)).toString(); + } + try { + const result = await requestHandler.handle(request2); + return (0, requestHelpers_1.getCredentials)(result.response); + } catch (e) { + throw new property_provider_1.CredentialsProviderError(String(e), { logger: options.logger }); + } + }, options.maxRetries ?? 3, options.timeout ?? 1e3); }; - exports2.GetAccessKeyInfoCommand = GetAccessKeyInfoCommand; + exports2.fromHttp = fromHttp; } }); -// ../../../node_modules/@aws-sdk/client-sts/dist-cjs/commands/GetCallerIdentityCommand.js -var require_GetCallerIdentityCommand = __commonJS({ - "../../../node_modules/@aws-sdk/client-sts/dist-cjs/commands/GetCallerIdentityCommand.js"(exports2) { +// ../../../node_modules/@aws-sdk/credential-provider-http/dist-cjs/index.js +var require_dist_cjs55 = __commonJS({ + "../../../node_modules/@aws-sdk/credential-provider-http/dist-cjs/index.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.GetCallerIdentityCommand = exports2.$Command = void 0; - var middleware_signing_1 = require_dist_cjs14(); - var middleware_endpoint_1 = require_dist_cjs26(); - var middleware_serde_1 = require_dist_cjs25(); - var smithy_client_1 = require_dist_cjs34(); - Object.defineProperty(exports2, "$Command", { enumerable: true, get: function() { - return smithy_client_1.Command; + exports2.fromHttp = void 0; + var fromHttp_1 = require_fromHttp(); + Object.defineProperty(exports2, "fromHttp", { enumerable: true, get: function() { + return fromHttp_1.fromHttp; } }); - var types_1 = require_dist_cjs(); - var Aws_query_1 = require_Aws_query(); - var GetCallerIdentityCommand = class _GetCallerIdentityCommand extends smithy_client_1.Command { - static getEndpointParameterInstructions() { - return { - UseGlobalEndpoint: { type: "builtInParams", name: "useGlobalEndpoint" }, - UseFIPS: { type: "builtInParams", name: "useFipsEndpoint" }, - Endpoint: { type: "builtInParams", name: "endpoint" }, - Region: { type: "builtInParams", name: "region" }, - UseDualStack: { type: "builtInParams", name: "useDualstackEndpoint" } - }; - } - constructor(input) { - super(); - this.input = input; - } - resolveMiddleware(clientStack, configuration, options) { - this.middlewareStack.use((0, middleware_serde_1.getSerdePlugin)(configuration, this.serialize, this.deserialize)); - this.middlewareStack.use((0, middleware_endpoint_1.getEndpointPlugin)(configuration, _GetCallerIdentityCommand.getEndpointParameterInstructions())); - this.middlewareStack.use((0, middleware_signing_1.getAwsAuthPlugin)(configuration)); - const stack = clientStack.concat(this.middlewareStack); - const { logger } = configuration; - const clientName = "STSClient"; - const commandName = "GetCallerIdentityCommand"; - const handlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: (_) => _, - outputFilterSensitiveLog: (_) => _, - [types_1.SMITHY_CONTEXT_KEY]: { - service: "AWSSecurityTokenServiceV20110615", - operation: "GetCallerIdentity" + } +}); + +// ../../../node_modules/@aws-sdk/client-sso/dist-cjs/auth/httpAuthSchemeProvider.js +var require_httpAuthSchemeProvider2 = __commonJS({ + "../../../node_modules/@aws-sdk/client-sso/dist-cjs/auth/httpAuthSchemeProvider.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.resolveHttpAuthSchemeConfig = exports2.defaultSSOHttpAuthSchemeProvider = exports2.defaultSSOHttpAuthSchemeParametersProvider = void 0; + var core_1 = (init_dist_es2(), __toCommonJS(dist_es_exports2)); + var util_middleware_1 = require_dist_cjs10(); + var defaultSSOHttpAuthSchemeParametersProvider = async (config, context, input) => { + return { + operation: (0, util_middleware_1.getSmithyContext)(context).operation, + region: await (0, util_middleware_1.normalizeProvider)(config.region)() || (() => { + throw new Error("expected `region` to be configured for `aws.auth#sigv4`"); + })() + }; + }; + exports2.defaultSSOHttpAuthSchemeParametersProvider = defaultSSOHttpAuthSchemeParametersProvider; + function createAwsAuthSigv4HttpAuthOption(authParameters) { + return { + schemeId: "aws.auth#sigv4", + signingProperties: { + name: "awsssoportal", + region: authParameters.region + }, + propertiesExtractor: (config, context) => ({ + signingProperties: { + config, + context } - }; - const { requestHandler } = configuration; - return stack.resolve((request2) => requestHandler.handle(request2.request, options || {}), handlerExecutionContext); - } - serialize(input, context) { - return (0, Aws_query_1.se_GetCallerIdentityCommand)(input, context); + }) + }; + } + function createSmithyApiNoAuthHttpAuthOption(authParameters) { + return { + schemeId: "smithy.api#noAuth" + }; + } + var defaultSSOHttpAuthSchemeProvider = (authParameters) => { + const options = []; + switch (authParameters.operation) { + case "GetRoleCredentials": { + options.push(createSmithyApiNoAuthHttpAuthOption(authParameters)); + break; + } + case "ListAccountRoles": { + options.push(createSmithyApiNoAuthHttpAuthOption(authParameters)); + break; + } + case "ListAccounts": { + options.push(createSmithyApiNoAuthHttpAuthOption(authParameters)); + break; + } + case "Logout": { + options.push(createSmithyApiNoAuthHttpAuthOption(authParameters)); + break; + } + default: { + options.push(createAwsAuthSigv4HttpAuthOption(authParameters)); + } } - deserialize(output, context) { - return (0, Aws_query_1.de_GetCallerIdentityCommand)(output, context); + return options; + }; + exports2.defaultSSOHttpAuthSchemeProvider = defaultSSOHttpAuthSchemeProvider; + var resolveHttpAuthSchemeConfig = (config) => { + const config_0 = (0, core_1.resolveAwsSdkSigV4Config)(config); + return { + ...config_0 + }; + }; + exports2.resolveHttpAuthSchemeConfig = resolveHttpAuthSchemeConfig; + } +}); + +// ../../../node_modules/@aws-sdk/client-sso/package.json +var require_package2 = __commonJS({ + "../../../node_modules/@aws-sdk/client-sso/package.json"(exports2, module2) { + module2.exports = { + name: "@aws-sdk/client-sso", + description: "AWS SDK for JavaScript Sso Client for Node.js, Browser and React Native", + version: "3.632.0", + scripts: { + build: "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'", + "build:cjs": "node ../../scripts/compilation/inline client-sso", + "build:es": "tsc -p tsconfig.es.json", + "build:include:deps": "lerna run --scope $npm_package_name --include-dependencies build", + "build:types": "tsc -p tsconfig.types.json", + "build:types:downlevel": "downlevel-dts dist-types dist-types/ts3.4", + clean: "rimraf ./dist-* && rimraf *.tsbuildinfo", + "extract:docs": "api-extractor run --local", + "generate:client": "node ../../scripts/generate-clients/single-service --solo sso" + }, + main: "./dist-cjs/index.js", + types: "./dist-types/index.d.ts", + module: "./dist-es/index.js", + sideEffects: false, + dependencies: { + "@aws-crypto/sha256-browser": "5.2.0", + "@aws-crypto/sha256-js": "5.2.0", + "@aws-sdk/core": "3.629.0", + "@aws-sdk/middleware-host-header": "3.620.0", + "@aws-sdk/middleware-logger": "3.609.0", + "@aws-sdk/middleware-recursion-detection": "3.620.0", + "@aws-sdk/middleware-user-agent": "3.632.0", + "@aws-sdk/region-config-resolver": "3.614.0", + "@aws-sdk/types": "3.609.0", + "@aws-sdk/util-endpoints": "3.632.0", + "@aws-sdk/util-user-agent-browser": "3.609.0", + "@aws-sdk/util-user-agent-node": "3.614.0", + "@smithy/config-resolver": "^3.0.5", + "@smithy/core": "^2.3.2", + "@smithy/fetch-http-handler": "^3.2.4", + "@smithy/hash-node": "^3.0.3", + "@smithy/invalid-dependency": "^3.0.3", + "@smithy/middleware-content-length": "^3.0.5", + "@smithy/middleware-endpoint": "^3.1.0", + "@smithy/middleware-retry": "^3.0.14", + "@smithy/middleware-serde": "^3.0.3", + "@smithy/middleware-stack": "^3.0.3", + "@smithy/node-config-provider": "^3.1.4", + "@smithy/node-http-handler": "^3.1.4", + "@smithy/protocol-http": "^4.1.0", + "@smithy/smithy-client": "^3.1.12", + "@smithy/types": "^3.3.0", + "@smithy/url-parser": "^3.0.3", + "@smithy/util-base64": "^3.0.0", + "@smithy/util-body-length-browser": "^3.0.0", + "@smithy/util-body-length-node": "^3.0.0", + "@smithy/util-defaults-mode-browser": "^3.0.14", + "@smithy/util-defaults-mode-node": "^3.0.14", + "@smithy/util-endpoints": "^2.0.5", + "@smithy/util-middleware": "^3.0.3", + "@smithy/util-retry": "^3.0.3", + "@smithy/util-utf8": "^3.0.0", + tslib: "^2.6.2" + }, + devDependencies: { + "@tsconfig/node16": "16.1.3", + "@types/node": "^16.18.96", + concurrently: "7.0.0", + "downlevel-dts": "0.10.1", + rimraf: "3.0.2", + typescript: "~4.9.5" + }, + engines: { + node: ">=16.0.0" + }, + typesVersions: { + "<4.0": { + "dist-types/*": [ + "dist-types/ts3.4/*" + ] + } + }, + files: [ + "dist-*/**" + ], + author: { + name: "AWS SDK for JavaScript Team", + url: "https://aws.amazon.com/javascript/" + }, + license: "Apache-2.0", + browser: { + "./dist-es/runtimeConfig": "./dist-es/runtimeConfig.browser" + }, + "react-native": { + "./dist-es/runtimeConfig": "./dist-es/runtimeConfig.native" + }, + homepage: "https://github.com/aws/aws-sdk-js-v3/tree/main/clients/client-sso", + repository: { + type: "git", + url: "https://github.com/aws/aws-sdk-js-v3.git", + directory: "clients/client-sso" } }; - exports2.GetCallerIdentityCommand = GetCallerIdentityCommand; } }); -// ../../../node_modules/@aws-sdk/client-sts/dist-cjs/commands/GetFederationTokenCommand.js -var require_GetFederationTokenCommand = __commonJS({ - "../../../node_modules/@aws-sdk/client-sts/dist-cjs/commands/GetFederationTokenCommand.js"(exports2) { +// ../../../node_modules/@aws-sdk/util-user-agent-node/dist-cjs/index.js +var require_dist_cjs56 = __commonJS({ + "../../../node_modules/@aws-sdk/util-user-agent-node/dist-cjs/index.js"(exports2, module2) { "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.GetFederationTokenCommand = exports2.$Command = void 0; - var middleware_signing_1 = require_dist_cjs14(); - var middleware_endpoint_1 = require_dist_cjs26(); - var middleware_serde_1 = require_dist_cjs25(); - var smithy_client_1 = require_dist_cjs34(); - Object.defineProperty(exports2, "$Command", { enumerable: true, get: function() { - return smithy_client_1.Command; - } }); - var types_1 = require_dist_cjs(); - var models_0_1 = require_models_0(); - var Aws_query_1 = require_Aws_query(); - var GetFederationTokenCommand = class _GetFederationTokenCommand extends smithy_client_1.Command { - static getEndpointParameterInstructions() { - return { - UseGlobalEndpoint: { type: "builtInParams", name: "useGlobalEndpoint" }, - UseFIPS: { type: "builtInParams", name: "useFipsEndpoint" }, - Endpoint: { type: "builtInParams", name: "endpoint" }, - Region: { type: "builtInParams", name: "region" }, - UseDualStack: { type: "builtInParams", name: "useDualstackEndpoint" } - }; + var __defProp2 = Object.defineProperty; + var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; + var __getOwnPropNames2 = Object.getOwnPropertyNames; + var __hasOwnProp2 = Object.prototype.hasOwnProperty; + var __name = (target, value) => __defProp2(target, "name", { value, configurable: true }); + var __export2 = (target, all) => { + for (var name in all) + __defProp2(target, name, { get: all[name], enumerable: true }); + }; + var __copyProps2 = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames2(from)) + if (!__hasOwnProp2.call(to, key) && key !== except) + __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable }); } - constructor(input) { - super(); - this.input = input; + return to; + }; + var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); + var src_exports = {}; + __export2(src_exports, { + UA_APP_ID_ENV_NAME: () => UA_APP_ID_ENV_NAME, + UA_APP_ID_INI_NAME: () => UA_APP_ID_INI_NAME, + crtAvailability: () => crtAvailability, + defaultUserAgent: () => defaultUserAgent + }); + module2.exports = __toCommonJS2(src_exports); + var import_node_config_provider = require_dist_cjs42(); + var import_os = require("os"); + var import_process = require("process"); + var crtAvailability = { + isCrtAvailable: false + }; + var isCrtAvailable = /* @__PURE__ */ __name(() => { + if (crtAvailability.isCrtAvailable) { + return ["md/crt-avail"]; } - resolveMiddleware(clientStack, configuration, options) { - this.middlewareStack.use((0, middleware_serde_1.getSerdePlugin)(configuration, this.serialize, this.deserialize)); - this.middlewareStack.use((0, middleware_endpoint_1.getEndpointPlugin)(configuration, _GetFederationTokenCommand.getEndpointParameterInstructions())); - this.middlewareStack.use((0, middleware_signing_1.getAwsAuthPlugin)(configuration)); - const stack = clientStack.concat(this.middlewareStack); - const { logger } = configuration; - const clientName = "STSClient"; - const commandName = "GetFederationTokenCommand"; - const handlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: (_) => _, - outputFilterSensitiveLog: models_0_1.GetFederationTokenResponseFilterSensitiveLog, - [types_1.SMITHY_CONTEXT_KEY]: { - service: "AWSSecurityTokenServiceV20110615", - operation: "GetFederationToken" - } - }; - const { requestHandler } = configuration; - return stack.resolve((request2) => requestHandler.handle(request2.request, options || {}), handlerExecutionContext); + return null; + }, "isCrtAvailable"); + var UA_APP_ID_ENV_NAME = "AWS_SDK_UA_APP_ID"; + var UA_APP_ID_INI_NAME = "sdk-ua-app-id"; + var defaultUserAgent = /* @__PURE__ */ __name(({ serviceId, clientVersion }) => { + const sections = [ + // sdk-metadata + ["aws-sdk-js", clientVersion], + // ua-metadata + ["ua", "2.0"], + // os-metadata + [`os/${(0, import_os.platform)()}`, (0, import_os.release)()], + // language-metadata + // ECMAScript edition doesn't matter in JS, so no version needed. + ["lang/js"], + ["md/nodejs", `${import_process.versions.node}`] + ]; + const crtAvailable = isCrtAvailable(); + if (crtAvailable) { + sections.push(crtAvailable); } - serialize(input, context) { - return (0, Aws_query_1.se_GetFederationTokenCommand)(input, context); + if (serviceId) { + sections.push([`api/${serviceId}`, clientVersion]); } - deserialize(output, context) { - return (0, Aws_query_1.de_GetFederationTokenCommand)(output, context); + if (import_process.env.AWS_EXECUTION_ENV) { + sections.push([`exec-env/${import_process.env.AWS_EXECUTION_ENV}`]); } - }; - exports2.GetFederationTokenCommand = GetFederationTokenCommand; + const appIdPromise = (0, import_node_config_provider.loadConfig)({ + environmentVariableSelector: (env2) => env2[UA_APP_ID_ENV_NAME], + configFileSelector: (profile) => profile[UA_APP_ID_INI_NAME], + default: void 0 + })(); + let resolvedUserAgent = void 0; + return async () => { + if (!resolvedUserAgent) { + const appId = await appIdPromise; + resolvedUserAgent = appId ? [...sections, [`app/${appId}`]] : [...sections]; + } + return resolvedUserAgent; + }; + }, "defaultUserAgent"); } }); -// ../../../node_modules/@aws-sdk/client-sts/dist-cjs/commands/GetSessionTokenCommand.js -var require_GetSessionTokenCommand = __commonJS({ - "../../../node_modules/@aws-sdk/client-sts/dist-cjs/commands/GetSessionTokenCommand.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.GetSessionTokenCommand = exports2.$Command = void 0; - var middleware_signing_1 = require_dist_cjs14(); - var middleware_endpoint_1 = require_dist_cjs26(); - var middleware_serde_1 = require_dist_cjs25(); - var smithy_client_1 = require_dist_cjs34(); - Object.defineProperty(exports2, "$Command", { enumerable: true, get: function() { - return smithy_client_1.Command; - } }); - var types_1 = require_dist_cjs(); - var models_0_1 = require_models_0(); - var Aws_query_1 = require_Aws_query(); - var GetSessionTokenCommand = class _GetSessionTokenCommand extends smithy_client_1.Command { - static getEndpointParameterInstructions() { - return { - UseGlobalEndpoint: { type: "builtInParams", name: "useGlobalEndpoint" }, - UseFIPS: { type: "builtInParams", name: "useFipsEndpoint" }, - Endpoint: { type: "builtInParams", name: "endpoint" }, - Region: { type: "builtInParams", name: "region" }, - UseDualStack: { type: "builtInParams", name: "useDualstackEndpoint" } - }; +// ../../../node_modules/@smithy/hash-node/dist-cjs/index.js +var require_dist_cjs57 = __commonJS({ + "../../../node_modules/@smithy/hash-node/dist-cjs/index.js"(exports2, module2) { + var __defProp2 = Object.defineProperty; + var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; + var __getOwnPropNames2 = Object.getOwnPropertyNames; + var __hasOwnProp2 = Object.prototype.hasOwnProperty; + var __name = (target, value) => __defProp2(target, "name", { value, configurable: true }); + var __export2 = (target, all) => { + for (var name in all) + __defProp2(target, name, { get: all[name], enumerable: true }); + }; + var __copyProps2 = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames2(from)) + if (!__hasOwnProp2.call(to, key) && key !== except) + __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable }); } - constructor(input) { - super(); - this.input = input; + return to; + }; + var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); + var src_exports = {}; + __export2(src_exports, { + Hash: () => Hash + }); + module2.exports = __toCommonJS2(src_exports); + var import_util_buffer_from = require_dist_cjs27(); + var import_util_utf8 = require_dist_cjs28(); + var import_buffer = require("buffer"); + var import_crypto5 = require("crypto"); + var _Hash = class _Hash { + constructor(algorithmIdentifier, secret) { + this.algorithmIdentifier = algorithmIdentifier; + this.secret = secret; + this.reset(); } - resolveMiddleware(clientStack, configuration, options) { - this.middlewareStack.use((0, middleware_serde_1.getSerdePlugin)(configuration, this.serialize, this.deserialize)); - this.middlewareStack.use((0, middleware_endpoint_1.getEndpointPlugin)(configuration, _GetSessionTokenCommand.getEndpointParameterInstructions())); - this.middlewareStack.use((0, middleware_signing_1.getAwsAuthPlugin)(configuration)); - const stack = clientStack.concat(this.middlewareStack); - const { logger } = configuration; - const clientName = "STSClient"; - const commandName = "GetSessionTokenCommand"; - const handlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: (_) => _, - outputFilterSensitiveLog: models_0_1.GetSessionTokenResponseFilterSensitiveLog, - [types_1.SMITHY_CONTEXT_KEY]: { - service: "AWSSecurityTokenServiceV20110615", - operation: "GetSessionToken" - } - }; - const { requestHandler } = configuration; - return stack.resolve((request2) => requestHandler.handle(request2.request, options || {}), handlerExecutionContext); + update(toHash, encoding) { + this.hash.update((0, import_util_utf8.toUint8Array)(castSourceData(toHash, encoding))); } - serialize(input, context) { - return (0, Aws_query_1.se_GetSessionTokenCommand)(input, context); + digest() { + return Promise.resolve(this.hash.digest()); } - deserialize(output, context) { - return (0, Aws_query_1.de_GetSessionTokenCommand)(output, context); + reset() { + this.hash = this.secret ? (0, import_crypto5.createHmac)(this.algorithmIdentifier, castSourceData(this.secret)) : (0, import_crypto5.createHash)(this.algorithmIdentifier); } }; - exports2.GetSessionTokenCommand = GetSessionTokenCommand; + __name(_Hash, "Hash"); + var Hash = _Hash; + function castSourceData(toCast, encoding) { + if (import_buffer.Buffer.isBuffer(toCast)) { + return toCast; + } + if (typeof toCast === "string") { + return (0, import_util_buffer_from.fromString)(toCast, encoding); + } + if (ArrayBuffer.isView(toCast)) { + return (0, import_util_buffer_from.fromArrayBuffer)(toCast.buffer, toCast.byteOffset, toCast.byteLength); + } + return (0, import_util_buffer_from.fromArrayBuffer)(toCast); + } + __name(castSourceData, "castSourceData"); } }); -// ../../../node_modules/@aws-sdk/client-sts/dist-cjs/STS.js -var require_STS = __commonJS({ - "../../../node_modules/@aws-sdk/client-sts/dist-cjs/STS.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.STS = void 0; - var smithy_client_1 = require_dist_cjs34(); - var AssumeRoleCommand_1 = require_AssumeRoleCommand(); - var AssumeRoleWithSAMLCommand_1 = require_AssumeRoleWithSAMLCommand(); - var AssumeRoleWithWebIdentityCommand_1 = require_AssumeRoleWithWebIdentityCommand(); - var DecodeAuthorizationMessageCommand_1 = require_DecodeAuthorizationMessageCommand(); - var GetAccessKeyInfoCommand_1 = require_GetAccessKeyInfoCommand(); - var GetCallerIdentityCommand_1 = require_GetCallerIdentityCommand(); - var GetFederationTokenCommand_1 = require_GetFederationTokenCommand(); - var GetSessionTokenCommand_1 = require_GetSessionTokenCommand(); - var STSClient_1 = require_STSClient(); - var commands = { - AssumeRoleCommand: AssumeRoleCommand_1.AssumeRoleCommand, - AssumeRoleWithSAMLCommand: AssumeRoleWithSAMLCommand_1.AssumeRoleWithSAMLCommand, - AssumeRoleWithWebIdentityCommand: AssumeRoleWithWebIdentityCommand_1.AssumeRoleWithWebIdentityCommand, - DecodeAuthorizationMessageCommand: DecodeAuthorizationMessageCommand_1.DecodeAuthorizationMessageCommand, - GetAccessKeyInfoCommand: GetAccessKeyInfoCommand_1.GetAccessKeyInfoCommand, - GetCallerIdentityCommand: GetCallerIdentityCommand_1.GetCallerIdentityCommand, - GetFederationTokenCommand: GetFederationTokenCommand_1.GetFederationTokenCommand, - GetSessionTokenCommand: GetSessionTokenCommand_1.GetSessionTokenCommand - }; - var STS = class extends STSClient_1.STSClient { +// ../../../node_modules/@smithy/util-body-length-node/dist-cjs/index.js +var require_dist_cjs58 = __commonJS({ + "../../../node_modules/@smithy/util-body-length-node/dist-cjs/index.js"(exports2, module2) { + var __defProp2 = Object.defineProperty; + var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; + var __getOwnPropNames2 = Object.getOwnPropertyNames; + var __hasOwnProp2 = Object.prototype.hasOwnProperty; + var __name = (target, value) => __defProp2(target, "name", { value, configurable: true }); + var __export2 = (target, all) => { + for (var name in all) + __defProp2(target, name, { get: all[name], enumerable: true }); }; - exports2.STS = STS; - (0, smithy_client_1.createAggregatedClient)(commands, STS); - } -}); - -// ../../../node_modules/@aws-sdk/client-sts/dist-cjs/commands/index.js -var require_commands2 = __commonJS({ - "../../../node_modules/@aws-sdk/client-sts/dist-cjs/commands/index.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports)); - tslib_1.__exportStar(require_AssumeRoleCommand(), exports2); - tslib_1.__exportStar(require_AssumeRoleWithSAMLCommand(), exports2); - tslib_1.__exportStar(require_AssumeRoleWithWebIdentityCommand(), exports2); - tslib_1.__exportStar(require_DecodeAuthorizationMessageCommand(), exports2); - tslib_1.__exportStar(require_GetAccessKeyInfoCommand(), exports2); - tslib_1.__exportStar(require_GetCallerIdentityCommand(), exports2); - tslib_1.__exportStar(require_GetFederationTokenCommand(), exports2); - tslib_1.__exportStar(require_GetSessionTokenCommand(), exports2); - } -}); - -// ../../../node_modules/@aws-sdk/client-sts/dist-cjs/models/index.js -var require_models2 = __commonJS({ - "../../../node_modules/@aws-sdk/client-sts/dist-cjs/models/index.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports)); - tslib_1.__exportStar(require_models_0(), exports2); - } -}); - -// ../../../node_modules/@aws-sdk/client-sts/dist-cjs/defaultRoleAssumers.js -var require_defaultRoleAssumers = __commonJS({ - "../../../node_modules/@aws-sdk/client-sts/dist-cjs/defaultRoleAssumers.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.decorateDefaultCredentialProvider = exports2.getDefaultRoleAssumerWithWebIdentity = exports2.getDefaultRoleAssumer = void 0; - var defaultStsRoleAssumers_1 = require_defaultStsRoleAssumers(); - var STSClient_1 = require_STSClient(); - var getCustomizableStsClientCtor = (baseCtor, customizations) => { - if (!customizations) - return baseCtor; - else - return class CustomizableSTSClient extends baseCtor { - constructor(config) { - super(config); - for (const customization of customizations) { - this.middlewareStack.use(customization); - } - } - }; + var __copyProps2 = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames2(from)) + if (!__hasOwnProp2.call(to, key) && key !== except) + __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable }); + } + return to; }; - var getDefaultRoleAssumer = (stsOptions = {}, stsPlugins) => (0, defaultStsRoleAssumers_1.getDefaultRoleAssumer)(stsOptions, getCustomizableStsClientCtor(STSClient_1.STSClient, stsPlugins)); - exports2.getDefaultRoleAssumer = getDefaultRoleAssumer; - var getDefaultRoleAssumerWithWebIdentity = (stsOptions = {}, stsPlugins) => (0, defaultStsRoleAssumers_1.getDefaultRoleAssumerWithWebIdentity)(stsOptions, getCustomizableStsClientCtor(STSClient_1.STSClient, stsPlugins)); - exports2.getDefaultRoleAssumerWithWebIdentity = getDefaultRoleAssumerWithWebIdentity; - var decorateDefaultCredentialProvider = (provider) => (input) => provider({ - roleAssumer: (0, exports2.getDefaultRoleAssumer)(input), - roleAssumerWithWebIdentity: (0, exports2.getDefaultRoleAssumerWithWebIdentity)(input), - ...input + var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); + var src_exports = {}; + __export2(src_exports, { + calculateBodyLength: () => calculateBodyLength }); - exports2.decorateDefaultCredentialProvider = decorateDefaultCredentialProvider; - } -}); - -// ../../../node_modules/@aws-sdk/client-sts/dist-cjs/index.js -var require_dist_cjs51 = __commonJS({ - "../../../node_modules/@aws-sdk/client-sts/dist-cjs/index.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.STSServiceException = void 0; - var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports)); - tslib_1.__exportStar(require_STSClient(), exports2); - tslib_1.__exportStar(require_STS(), exports2); - tslib_1.__exportStar(require_commands2(), exports2); - tslib_1.__exportStar(require_models2(), exports2); - tslib_1.__exportStar(require_defaultRoleAssumers(), exports2); - var STSServiceException_1 = require_STSServiceException(); - Object.defineProperty(exports2, "STSServiceException", { enumerable: true, get: function() { - return STSServiceException_1.STSServiceException; - } }); - } -}); - -// ../../../node_modules/@aws-sdk/client-sfn/dist-cjs/endpoint/ruleset.js -var require_ruleset3 = __commonJS({ - "../../../node_modules/@aws-sdk/client-sfn/dist-cjs/endpoint/ruleset.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.ruleSet = void 0; - var r = "required"; - var s = "fn"; - var t = "argv"; - var u = "ref"; - var a = "isSet"; - var b = "tree"; - var c = "error"; - var d = "endpoint"; - var e = "PartitionResult"; - var f = { [r]: false, "type": "String" }; - var g = { [r]: true, "default": false, "type": "Boolean" }; - var h = { [u]: "Endpoint" }; - var i = { [s]: "booleanEquals", [t]: [{ [u]: "UseFIPS" }, true] }; - var j = { [s]: "booleanEquals", [t]: [{ [u]: "UseDualStack" }, true] }; - var k = {}; - var l = { [u]: "Region" }; - var m = { [s]: "booleanEquals", [t]: [true, { [s]: "getAttr", [t]: [{ [u]: e }, "supportsFIPS"] }] }; - var n = { [s]: "booleanEquals", [t]: [true, { [s]: "getAttr", [t]: [{ [u]: e }, "supportsDualStack"] }] }; - var o = [i]; - var p = [j]; - var q = [l]; - var _data = { version: "1.0", parameters: { Region: f, UseDualStack: g, UseFIPS: g, Endpoint: f }, rules: [{ conditions: [{ [s]: a, [t]: [h] }], type: b, rules: [{ conditions: o, error: "Invalid Configuration: FIPS and custom endpoint are not supported", type: c }, { conditions: p, error: "Invalid Configuration: Dualstack and custom endpoint are not supported", type: c }, { endpoint: { url: h, properties: k, headers: k }, type: d }] }, { conditions: [{ [s]: a, [t]: q }], type: b, rules: [{ conditions: [{ [s]: "aws.partition", [t]: q, assign: e }], type: b, rules: [{ conditions: [i, j], type: b, rules: [{ conditions: [m, n], type: b, rules: [{ endpoint: { url: "https://states-fips.{Region}.{PartitionResult#dualStackDnsSuffix}", properties: k, headers: k }, type: d }] }, { error: "FIPS and DualStack are enabled, but this partition does not support one or both", type: c }] }, { conditions: o, type: b, rules: [{ conditions: [m], type: b, rules: [{ conditions: [{ [s]: "stringEquals", [t]: [l, "us-gov-west-1"] }], endpoint: { url: "https://states.us-gov-west-1.amazonaws.com", properties: k, headers: k }, type: d }, { endpoint: { url: "https://states-fips.{Region}.{PartitionResult#dnsSuffix}", properties: k, headers: k }, type: d }] }, { error: "FIPS is enabled but this partition does not support FIPS", type: c }] }, { conditions: p, type: b, rules: [{ conditions: [n], type: b, rules: [{ endpoint: { url: "https://states.{Region}.{PartitionResult#dualStackDnsSuffix}", properties: k, headers: k }, type: d }] }, { error: "DualStack is enabled but this partition does not support DualStack", type: c }] }, { endpoint: { url: "https://states.{Region}.{PartitionResult#dnsSuffix}", properties: k, headers: k }, type: d }] }] }, { error: "Invalid Configuration: Missing Region", type: c }] }; - exports2.ruleSet = _data; + module2.exports = __toCommonJS2(src_exports); + var import_fs = require("fs"); + var calculateBodyLength = /* @__PURE__ */ __name((body) => { + if (!body) { + return 0; + } + if (typeof body === "string") { + return Buffer.byteLength(body); + } else if (typeof body.byteLength === "number") { + return body.byteLength; + } else if (typeof body.size === "number") { + return body.size; + } else if (typeof body.start === "number" && typeof body.end === "number") { + return body.end + 1 - body.start; + } else if (typeof body.path === "string" || Buffer.isBuffer(body.path)) { + return (0, import_fs.lstatSync)(body.path).size; + } else if (typeof body.fd === "number") { + return (0, import_fs.fstatSync)(body.fd).size; + } + throw new Error(`Body Length computation failed for ${body}`); + }, "calculateBodyLength"); } }); -// ../../../node_modules/@aws-sdk/client-sfn/dist-cjs/endpoint/endpointResolver.js -var require_endpointResolver3 = __commonJS({ - "../../../node_modules/@aws-sdk/client-sfn/dist-cjs/endpoint/endpointResolver.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.defaultEndpointResolver = void 0; - var util_endpoints_1 = require_dist_cjs16(); - var ruleset_1 = require_ruleset3(); - var defaultEndpointResolver = (endpointParams, context = {}) => { - return (0, util_endpoints_1.resolveEndpoint)(ruleset_1.ruleSet, { - endpointParams, - logger: context.logger - }); +// ../../../node_modules/@smithy/util-retry/node_modules/@smithy/service-error-classification/dist-cjs/index.js +var require_dist_cjs59 = __commonJS({ + "../../../node_modules/@smithy/util-retry/node_modules/@smithy/service-error-classification/dist-cjs/index.js"(exports2, module2) { + var __defProp2 = Object.defineProperty; + var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; + var __getOwnPropNames2 = Object.getOwnPropertyNames; + var __hasOwnProp2 = Object.prototype.hasOwnProperty; + var __name = (target, value) => __defProp2(target, "name", { value, configurable: true }); + var __export2 = (target, all) => { + for (var name in all) + __defProp2(target, name, { get: all[name], enumerable: true }); }; - exports2.defaultEndpointResolver = defaultEndpointResolver; - } -}); - -// ../../../node_modules/@aws-sdk/client-sfn/dist-cjs/runtimeConfig.shared.js -var require_runtimeConfig_shared3 = __commonJS({ - "../../../node_modules/@aws-sdk/client-sfn/dist-cjs/runtimeConfig.shared.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.getRuntimeConfig = void 0; - var smithy_client_1 = require_dist_cjs34(); - var url_parser_1 = require_dist_cjs24(); - var util_base64_1 = require_dist_cjs30(); - var util_utf8_1 = require_dist_cjs10(); - var endpointResolver_1 = require_endpointResolver3(); - var getRuntimeConfig = (config) => ({ - apiVersion: "2016-11-23", - base64Decoder: config?.base64Decoder ?? util_base64_1.fromBase64, - base64Encoder: config?.base64Encoder ?? util_base64_1.toBase64, - disableHostPrefix: config?.disableHostPrefix ?? false, - endpointProvider: config?.endpointProvider ?? endpointResolver_1.defaultEndpointResolver, - extensions: config?.extensions ?? [], - logger: config?.logger ?? new smithy_client_1.NoOpLogger(), - serviceId: config?.serviceId ?? "SFN", - urlParser: config?.urlParser ?? url_parser_1.parseUrl, - utf8Decoder: config?.utf8Decoder ?? util_utf8_1.fromUtf8, - utf8Encoder: config?.utf8Encoder ?? util_utf8_1.toUtf8 - }); - exports2.getRuntimeConfig = getRuntimeConfig; - } -}); - -// ../../../node_modules/@aws-sdk/client-sfn/dist-cjs/runtimeConfig.js -var require_runtimeConfig3 = __commonJS({ - "../../../node_modules/@aws-sdk/client-sfn/dist-cjs/runtimeConfig.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.getRuntimeConfig = void 0; - var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports)); - var package_json_1 = tslib_1.__importDefault(require_package()); - var client_sts_1 = require_dist_cjs51(); - var credential_provider_node_1 = require_dist_cjs50(); - var util_user_agent_node_1 = require_dist_cjs40(); - var config_resolver_1 = require_dist_cjs19(); - var hash_node_1 = require_dist_cjs41(); - var middleware_retry_1 = require_dist_cjs35(); - var node_config_provider_1 = require_dist_cjs22(); - var node_http_handler_1 = require_dist_cjs32(); - var util_body_length_node_1 = require_dist_cjs42(); - var util_retry_1 = require_dist_cjs28(); - var runtimeConfig_shared_1 = require_runtimeConfig_shared3(); - var smithy_client_1 = require_dist_cjs34(); - var util_defaults_mode_node_1 = require_dist_cjs43(); - var smithy_client_2 = require_dist_cjs34(); - var getRuntimeConfig = (config) => { - (0, smithy_client_2.emitWarningIfUnsupportedVersion)(process.version); - const defaultsMode = (0, util_defaults_mode_node_1.resolveDefaultsModeConfig)(config); - const defaultConfigProvider = () => defaultsMode().then(smithy_client_1.loadConfigsForDefaultMode); - const clientSharedValues = (0, runtimeConfig_shared_1.getRuntimeConfig)(config); - return { - ...clientSharedValues, - ...config, - runtime: "node", - defaultsMode, - bodyLengthChecker: config?.bodyLengthChecker ?? util_body_length_node_1.calculateBodyLength, - credentialDefaultProvider: config?.credentialDefaultProvider ?? (0, client_sts_1.decorateDefaultCredentialProvider)(credential_provider_node_1.defaultProvider), - defaultUserAgentProvider: config?.defaultUserAgentProvider ?? (0, util_user_agent_node_1.defaultUserAgent)({ serviceId: clientSharedValues.serviceId, clientVersion: package_json_1.default.version }), - maxAttempts: config?.maxAttempts ?? (0, node_config_provider_1.loadConfig)(middleware_retry_1.NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: config?.region ?? (0, node_config_provider_1.loadConfig)(config_resolver_1.NODE_REGION_CONFIG_OPTIONS, config_resolver_1.NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: config?.requestHandler ?? new node_http_handler_1.NodeHttpHandler(defaultConfigProvider), - retryMode: config?.retryMode ?? (0, node_config_provider_1.loadConfig)({ - ...middleware_retry_1.NODE_RETRY_MODE_CONFIG_OPTIONS, - default: async () => (await defaultConfigProvider()).retryMode || util_retry_1.DEFAULT_RETRY_MODE - }), - sha256: config?.sha256 ?? hash_node_1.Hash.bind(null, "sha256"), - streamCollector: config?.streamCollector ?? node_http_handler_1.streamCollector, - useDualstackEndpoint: config?.useDualstackEndpoint ?? (0, node_config_provider_1.loadConfig)(config_resolver_1.NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS), - useFipsEndpoint: config?.useFipsEndpoint ?? (0, node_config_provider_1.loadConfig)(config_resolver_1.NODE_USE_FIPS_ENDPOINT_CONFIG_OPTIONS) - }; + var __copyProps2 = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames2(from)) + if (!__hasOwnProp2.call(to, key) && key !== except) + __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable }); + } + return to; }; - exports2.getRuntimeConfig = getRuntimeConfig; + var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); + var src_exports = {}; + __export2(src_exports, { + isClockSkewCorrectedError: () => isClockSkewCorrectedError, + isClockSkewError: () => isClockSkewError, + isRetryableByTrait: () => isRetryableByTrait, + isServerError: () => isServerError, + isThrottlingError: () => isThrottlingError, + isTransientError: () => isTransientError + }); + module2.exports = __toCommonJS2(src_exports); + var CLOCK_SKEW_ERROR_CODES = [ + "AuthFailure", + "InvalidSignatureException", + "RequestExpired", + "RequestInTheFuture", + "RequestTimeTooSkewed", + "SignatureDoesNotMatch" + ]; + var THROTTLING_ERROR_CODES = [ + "BandwidthLimitExceeded", + "EC2ThrottledException", + "LimitExceededException", + "PriorRequestNotComplete", + "ProvisionedThroughputExceededException", + "RequestLimitExceeded", + "RequestThrottled", + "RequestThrottledException", + "SlowDown", + "ThrottledException", + "Throttling", + "ThrottlingException", + "TooManyRequestsException", + "TransactionInProgressException" + // DynamoDB + ]; + var TRANSIENT_ERROR_CODES = ["TimeoutError", "RequestTimeout", "RequestTimeoutException"]; + var TRANSIENT_ERROR_STATUS_CODES = [500, 502, 503, 504]; + var NODEJS_TIMEOUT_ERROR_CODES = ["ECONNRESET", "ECONNREFUSED", "EPIPE", "ETIMEDOUT"]; + var isRetryableByTrait = /* @__PURE__ */ __name((error) => error.$retryable !== void 0, "isRetryableByTrait"); + var isClockSkewError = /* @__PURE__ */ __name((error) => CLOCK_SKEW_ERROR_CODES.includes(error.name), "isClockSkewError"); + var isClockSkewCorrectedError = /* @__PURE__ */ __name((error) => { + var _a; + return (_a = error.$metadata) == null ? void 0 : _a.clockSkewCorrected; + }, "isClockSkewCorrectedError"); + var isThrottlingError = /* @__PURE__ */ __name((error) => { + var _a, _b; + return ((_a = error.$metadata) == null ? void 0 : _a.httpStatusCode) === 429 || THROTTLING_ERROR_CODES.includes(error.name) || ((_b = error.$retryable) == null ? void 0 : _b.throttling) == true; + }, "isThrottlingError"); + var isTransientError = /* @__PURE__ */ __name((error) => { + var _a; + return isClockSkewCorrectedError(error) || TRANSIENT_ERROR_CODES.includes(error.name) || NODEJS_TIMEOUT_ERROR_CODES.includes((error == null ? void 0 : error.code) || "") || TRANSIENT_ERROR_STATUS_CODES.includes(((_a = error.$metadata) == null ? void 0 : _a.httpStatusCode) || 0); + }, "isTransientError"); + var isServerError = /* @__PURE__ */ __name((error) => { + var _a; + if (((_a = error.$metadata) == null ? void 0 : _a.httpStatusCode) !== void 0) { + const statusCode = error.$metadata.httpStatusCode; + if (500 <= statusCode && statusCode <= 599 && !isTransientError(error)) { + return true; + } + return false; + } + return false; + }, "isServerError"); } }); -// ../../../node_modules/@aws-sdk/client-sfn/dist-cjs/runtimeExtensions.js -var require_runtimeExtensions3 = __commonJS({ - "../../../node_modules/@aws-sdk/client-sfn/dist-cjs/runtimeExtensions.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.resolveRuntimeExtensions = void 0; - var region_config_resolver_1 = require_dist_cjs44(); - var protocol_http_1 = require_dist_cjs2(); - var smithy_client_1 = require_dist_cjs34(); - var asPartial = (t) => t; - var resolveRuntimeExtensions = (runtimeConfig, extensions) => { - const extensionConfiguration = { - ...asPartial((0, region_config_resolver_1.getAwsRegionExtensionConfiguration)(runtimeConfig)), - ...asPartial((0, smithy_client_1.getDefaultExtensionConfiguration)(runtimeConfig)), - ...asPartial((0, protocol_http_1.getHttpHandlerExtensionConfiguration)(runtimeConfig)) - }; - extensions.forEach((extension) => extension.configure(extensionConfiguration)); - return { - ...runtimeConfig, - ...(0, region_config_resolver_1.resolveAwsRegionExtensionConfiguration)(extensionConfiguration), - ...(0, smithy_client_1.resolveDefaultRuntimeConfig)(extensionConfiguration), - ...(0, protocol_http_1.resolveHttpHandlerRuntimeConfig)(extensionConfiguration) - }; +// ../../../node_modules/@smithy/util-retry/dist-cjs/index.js +var require_dist_cjs60 = __commonJS({ + "../../../node_modules/@smithy/util-retry/dist-cjs/index.js"(exports2, module2) { + var __defProp2 = Object.defineProperty; + var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; + var __getOwnPropNames2 = Object.getOwnPropertyNames; + var __hasOwnProp2 = Object.prototype.hasOwnProperty; + var __name = (target, value) => __defProp2(target, "name", { value, configurable: true }); + var __export2 = (target, all) => { + for (var name in all) + __defProp2(target, name, { get: all[name], enumerable: true }); }; - exports2.resolveRuntimeExtensions = resolveRuntimeExtensions; - } -}); - -// ../../../node_modules/@aws-sdk/client-sfn/dist-cjs/SFNClient.js -var require_SFNClient = __commonJS({ - "../../../node_modules/@aws-sdk/client-sfn/dist-cjs/SFNClient.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.SFNClient = exports2.__Client = void 0; - var middleware_host_header_1 = require_dist_cjs3(); - var middleware_logger_1 = require_dist_cjs4(); - var middleware_recursion_detection_1 = require_dist_cjs5(); - var middleware_signing_1 = require_dist_cjs14(); - var middleware_user_agent_1 = require_dist_cjs17(); - var config_resolver_1 = require_dist_cjs19(); - var middleware_content_length_1 = require_dist_cjs20(); - var middleware_endpoint_1 = require_dist_cjs26(); - var middleware_retry_1 = require_dist_cjs35(); - var smithy_client_1 = require_dist_cjs34(); - Object.defineProperty(exports2, "__Client", { enumerable: true, get: function() { - return smithy_client_1.Client; - } }); - var EndpointParameters_1 = require_EndpointParameters(); - var runtimeConfig_1 = require_runtimeConfig3(); - var runtimeExtensions_1 = require_runtimeExtensions3(); - var SFNClient = class extends smithy_client_1.Client { - constructor(...[configuration]) { - const _config_0 = (0, runtimeConfig_1.getRuntimeConfig)(configuration || {}); - const _config_1 = (0, EndpointParameters_1.resolveClientEndpointParameters)(_config_0); - const _config_2 = (0, config_resolver_1.resolveRegionConfig)(_config_1); - const _config_3 = (0, middleware_endpoint_1.resolveEndpointConfig)(_config_2); - const _config_4 = (0, middleware_retry_1.resolveRetryConfig)(_config_3); - const _config_5 = (0, middleware_host_header_1.resolveHostHeaderConfig)(_config_4); - const _config_6 = (0, middleware_signing_1.resolveAwsAuthConfig)(_config_5); - const _config_7 = (0, middleware_user_agent_1.resolveUserAgentConfig)(_config_6); - const _config_8 = (0, runtimeExtensions_1.resolveRuntimeExtensions)(_config_7, configuration?.extensions || []); - super(_config_8); - this.config = _config_8; - this.middlewareStack.use((0, middleware_retry_1.getRetryPlugin)(this.config)); - this.middlewareStack.use((0, middleware_content_length_1.getContentLengthPlugin)(this.config)); - this.middlewareStack.use((0, middleware_host_header_1.getHostHeaderPlugin)(this.config)); - this.middlewareStack.use((0, middleware_logger_1.getLoggerPlugin)(this.config)); - this.middlewareStack.use((0, middleware_recursion_detection_1.getRecursionDetectionPlugin)(this.config)); - this.middlewareStack.use((0, middleware_signing_1.getAwsAuthPlugin)(this.config)); - this.middlewareStack.use((0, middleware_user_agent_1.getUserAgentPlugin)(this.config)); - } - destroy() { - super.destroy(); + var __copyProps2 = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames2(from)) + if (!__hasOwnProp2.call(to, key) && key !== except) + __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable }); } + return to; }; - exports2.SFNClient = SFNClient; - } -}); - -// ../../../node_modules/@aws-sdk/client-sfn/dist-cjs/models/SFNServiceException.js -var require_SFNServiceException = __commonJS({ - "../../../node_modules/@aws-sdk/client-sfn/dist-cjs/models/SFNServiceException.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.SFNServiceException = exports2.__ServiceException = void 0; - var smithy_client_1 = require_dist_cjs34(); - Object.defineProperty(exports2, "__ServiceException", { enumerable: true, get: function() { - return smithy_client_1.ServiceException; - } }); - var SFNServiceException = class _SFNServiceException extends smithy_client_1.ServiceException { + var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); + var src_exports = {}; + __export2(src_exports, { + AdaptiveRetryStrategy: () => AdaptiveRetryStrategy, + ConfiguredRetryStrategy: () => ConfiguredRetryStrategy, + DEFAULT_MAX_ATTEMPTS: () => DEFAULT_MAX_ATTEMPTS, + DEFAULT_RETRY_DELAY_BASE: () => DEFAULT_RETRY_DELAY_BASE, + DEFAULT_RETRY_MODE: () => DEFAULT_RETRY_MODE, + DefaultRateLimiter: () => DefaultRateLimiter, + INITIAL_RETRY_TOKENS: () => INITIAL_RETRY_TOKENS, + INVOCATION_ID_HEADER: () => INVOCATION_ID_HEADER, + MAXIMUM_RETRY_DELAY: () => MAXIMUM_RETRY_DELAY, + NO_RETRY_INCREMENT: () => NO_RETRY_INCREMENT, + REQUEST_HEADER: () => REQUEST_HEADER, + RETRY_COST: () => RETRY_COST, + RETRY_MODES: () => RETRY_MODES, + StandardRetryStrategy: () => StandardRetryStrategy, + THROTTLING_RETRY_DELAY_BASE: () => THROTTLING_RETRY_DELAY_BASE, + TIMEOUT_RETRY_COST: () => TIMEOUT_RETRY_COST + }); + module2.exports = __toCommonJS2(src_exports); + var RETRY_MODES = /* @__PURE__ */ ((RETRY_MODES2) => { + RETRY_MODES2["STANDARD"] = "standard"; + RETRY_MODES2["ADAPTIVE"] = "adaptive"; + return RETRY_MODES2; + })(RETRY_MODES || {}); + var DEFAULT_MAX_ATTEMPTS = 3; + var DEFAULT_RETRY_MODE = "standard"; + var import_service_error_classification = require_dist_cjs59(); + var _DefaultRateLimiter = class _DefaultRateLimiter { constructor(options) { - super(options); - Object.setPrototypeOf(this, _SFNServiceException.prototype); + this.currentCapacity = 0; + this.enabled = false; + this.lastMaxRate = 0; + this.measuredTxRate = 0; + this.requestCount = 0; + this.lastTimestamp = 0; + this.timeWindow = 0; + this.beta = (options == null ? void 0 : options.beta) ?? 0.7; + this.minCapacity = (options == null ? void 0 : options.minCapacity) ?? 1; + this.minFillRate = (options == null ? void 0 : options.minFillRate) ?? 0.5; + this.scaleConstant = (options == null ? void 0 : options.scaleConstant) ?? 0.4; + this.smooth = (options == null ? void 0 : options.smooth) ?? 0.8; + const currentTimeInSeconds = this.getCurrentTimeInSeconds(); + this.lastThrottleTime = currentTimeInSeconds; + this.lastTxRateBucket = Math.floor(this.getCurrentTimeInSeconds()); + this.fillRate = this.minFillRate; + this.maxCapacity = this.minCapacity; } - }; - exports2.SFNServiceException = SFNServiceException; - } -}); - -// ../../../node_modules/@aws-sdk/client-sfn/dist-cjs/models/models_0.js -var require_models_03 = __commonJS({ - "../../../node_modules/@aws-sdk/client-sfn/dist-cjs/models/models_0.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.ExecutionStartedEventDetailsFilterSensitiveLog = exports2.ExecutionFailedEventDetailsFilterSensitiveLog = exports2.ExecutionAbortedEventDetailsFilterSensitiveLog = exports2.GetActivityTaskOutputFilterSensitiveLog = exports2.DescribeStateMachineForExecutionOutputFilterSensitiveLog = exports2.DescribeStateMachineAliasOutputFilterSensitiveLog = exports2.DescribeStateMachineOutputFilterSensitiveLog = exports2.DescribeExecutionOutputFilterSensitiveLog = exports2.CreateStateMachineAliasInputFilterSensitiveLog = exports2.CreateStateMachineInputFilterSensitiveLog = exports2.ActivityTimedOutEventDetailsFilterSensitiveLog = exports2.ActivitySucceededEventDetailsFilterSensitiveLog = exports2.ActivityScheduleFailedEventDetailsFilterSensitiveLog = exports2.ActivityScheduledEventDetailsFilterSensitiveLog = exports2.ActivityFailedEventDetailsFilterSensitiveLog = exports2.MissingRequiredParameter = exports2.SyncExecutionStatus = exports2.InvalidExecutionInput = exports2.ExecutionLimitExceeded = exports2.ExecutionAlreadyExists = exports2.InvalidOutput = exports2.TaskTimedOut = exports2.TaskDoesNotExist = exports2.InvalidToken = exports2.HistoryEventType = exports2.StateMachineDoesNotExist = exports2.StateMachineStatus = exports2.MapRunStatus = exports2.ExecutionDoesNotExist = exports2.ExecutionStatus = exports2.ServiceQuotaExceededException = exports2.ResourceNotFound = exports2.ValidationException = exports2.ValidationExceptionReason = exports2.StateMachineTypeNotSupported = exports2.StateMachineLimitExceeded = exports2.StateMachineDeleting = exports2.StateMachineAlreadyExists = exports2.InvalidTracingConfiguration = exports2.InvalidLoggingConfiguration = exports2.InvalidDefinition = exports2.InvalidArn = exports2.StateMachineType = exports2.LogLevel = exports2.ConflictException = exports2.TooManyTags = exports2.InvalidName = exports2.ActivityWorkerLimitExceeded = exports2.ActivityLimitExceeded = exports2.ActivityDoesNotExist = void 0; - exports2.UpdateStateMachineAliasInputFilterSensitiveLog = exports2.UpdateStateMachineInputFilterSensitiveLog = exports2.StopExecutionInputFilterSensitiveLog = exports2.StartSyncExecutionOutputFilterSensitiveLog = exports2.StartSyncExecutionInputFilterSensitiveLog = exports2.StartExecutionInputFilterSensitiveLog = exports2.SendTaskSuccessInputFilterSensitiveLog = exports2.SendTaskFailureInputFilterSensitiveLog = exports2.PublishStateMachineVersionInputFilterSensitiveLog = exports2.GetExecutionHistoryOutputFilterSensitiveLog = exports2.HistoryEventFilterSensitiveLog = exports2.TaskTimedOutEventDetailsFilterSensitiveLog = exports2.TaskSucceededEventDetailsFilterSensitiveLog = exports2.TaskSubmittedEventDetailsFilterSensitiveLog = exports2.TaskSubmitFailedEventDetailsFilterSensitiveLog = exports2.TaskStartFailedEventDetailsFilterSensitiveLog = exports2.TaskScheduledEventDetailsFilterSensitiveLog = exports2.TaskFailedEventDetailsFilterSensitiveLog = exports2.StateExitedEventDetailsFilterSensitiveLog = exports2.StateEnteredEventDetailsFilterSensitiveLog = exports2.MapRunFailedEventDetailsFilterSensitiveLog = exports2.LambdaFunctionTimedOutEventDetailsFilterSensitiveLog = exports2.LambdaFunctionSucceededEventDetailsFilterSensitiveLog = exports2.LambdaFunctionStartFailedEventDetailsFilterSensitiveLog = exports2.LambdaFunctionScheduleFailedEventDetailsFilterSensitiveLog = exports2.LambdaFunctionScheduledEventDetailsFilterSensitiveLog = exports2.LambdaFunctionFailedEventDetailsFilterSensitiveLog = exports2.ExecutionTimedOutEventDetailsFilterSensitiveLog = exports2.ExecutionSucceededEventDetailsFilterSensitiveLog = void 0; - var smithy_client_1 = require_dist_cjs34(); - var SFNServiceException_1 = require_SFNServiceException(); - var ActivityDoesNotExist = class _ActivityDoesNotExist extends SFNServiceException_1.SFNServiceException { - constructor(opts) { - super({ - name: "ActivityDoesNotExist", - $fault: "client", - ...opts - }); - this.name = "ActivityDoesNotExist"; - this.$fault = "client"; - Object.setPrototypeOf(this, _ActivityDoesNotExist.prototype); + getCurrentTimeInSeconds() { + return Date.now() / 1e3; } - }; - exports2.ActivityDoesNotExist = ActivityDoesNotExist; - var ActivityLimitExceeded = class _ActivityLimitExceeded extends SFNServiceException_1.SFNServiceException { - constructor(opts) { - super({ - name: "ActivityLimitExceeded", - $fault: "client", - ...opts - }); - this.name = "ActivityLimitExceeded"; - this.$fault = "client"; - Object.setPrototypeOf(this, _ActivityLimitExceeded.prototype); + async getSendToken() { + return this.acquireTokenBucket(1); } - }; - exports2.ActivityLimitExceeded = ActivityLimitExceeded; - var ActivityWorkerLimitExceeded = class _ActivityWorkerLimitExceeded extends SFNServiceException_1.SFNServiceException { - constructor(opts) { - super({ - name: "ActivityWorkerLimitExceeded", - $fault: "client", - ...opts - }); - this.name = "ActivityWorkerLimitExceeded"; - this.$fault = "client"; - Object.setPrototypeOf(this, _ActivityWorkerLimitExceeded.prototype); + async acquireTokenBucket(amount) { + if (!this.enabled) { + return; + } + this.refillTokenBucket(); + if (amount > this.currentCapacity) { + const delay = (amount - this.currentCapacity) / this.fillRate * 1e3; + await new Promise((resolve) => setTimeout(resolve, delay)); + } + this.currentCapacity = this.currentCapacity - amount; } - }; - exports2.ActivityWorkerLimitExceeded = ActivityWorkerLimitExceeded; - var InvalidName = class _InvalidName extends SFNServiceException_1.SFNServiceException { - constructor(opts) { - super({ - name: "InvalidName", - $fault: "client", - ...opts - }); - this.name = "InvalidName"; - this.$fault = "client"; - Object.setPrototypeOf(this, _InvalidName.prototype); + refillTokenBucket() { + const timestamp = this.getCurrentTimeInSeconds(); + if (!this.lastTimestamp) { + this.lastTimestamp = timestamp; + return; + } + const fillAmount = (timestamp - this.lastTimestamp) * this.fillRate; + this.currentCapacity = Math.min(this.maxCapacity, this.currentCapacity + fillAmount); + this.lastTimestamp = timestamp; } - }; - exports2.InvalidName = InvalidName; - var TooManyTags = class _TooManyTags extends SFNServiceException_1.SFNServiceException { - constructor(opts) { - super({ - name: "TooManyTags", - $fault: "client", - ...opts - }); - this.name = "TooManyTags"; - this.$fault = "client"; - Object.setPrototypeOf(this, _TooManyTags.prototype); - this.resourceName = opts.resourceName; + updateClientSendingRate(response) { + let calculatedRate; + this.updateMeasuredRate(); + if ((0, import_service_error_classification.isThrottlingError)(response)) { + const rateToUse = !this.enabled ? this.measuredTxRate : Math.min(this.measuredTxRate, this.fillRate); + this.lastMaxRate = rateToUse; + this.calculateTimeWindow(); + this.lastThrottleTime = this.getCurrentTimeInSeconds(); + calculatedRate = this.cubicThrottle(rateToUse); + this.enableTokenBucket(); + } else { + this.calculateTimeWindow(); + calculatedRate = this.cubicSuccess(this.getCurrentTimeInSeconds()); + } + const newRate = Math.min(calculatedRate, 2 * this.measuredTxRate); + this.updateTokenBucketRate(newRate); } - }; - exports2.TooManyTags = TooManyTags; - var ConflictException = class _ConflictException extends SFNServiceException_1.SFNServiceException { - constructor(opts) { - super({ - name: "ConflictException", - $fault: "client", - ...opts - }); - this.name = "ConflictException"; - this.$fault = "client"; - Object.setPrototypeOf(this, _ConflictException.prototype); + calculateTimeWindow() { + this.timeWindow = this.getPrecise(Math.pow(this.lastMaxRate * (1 - this.beta) / this.scaleConstant, 1 / 3)); + } + cubicThrottle(rateToUse) { + return this.getPrecise(rateToUse * this.beta); + } + cubicSuccess(timestamp) { + return this.getPrecise( + this.scaleConstant * Math.pow(timestamp - this.lastThrottleTime - this.timeWindow, 3) + this.lastMaxRate + ); + } + enableTokenBucket() { + this.enabled = true; + } + updateTokenBucketRate(newRate) { + this.refillTokenBucket(); + this.fillRate = Math.max(newRate, this.minFillRate); + this.maxCapacity = Math.max(newRate, this.minCapacity); + this.currentCapacity = Math.min(this.currentCapacity, this.maxCapacity); + } + updateMeasuredRate() { + const t = this.getCurrentTimeInSeconds(); + const timeBucket = Math.floor(t * 2) / 2; + this.requestCount++; + if (timeBucket > this.lastTxRateBucket) { + const currentRate = this.requestCount / (timeBucket - this.lastTxRateBucket); + this.measuredTxRate = this.getPrecise(currentRate * this.smooth + this.measuredTxRate * (1 - this.smooth)); + this.requestCount = 0; + this.lastTxRateBucket = timeBucket; + } + } + getPrecise(num) { + return parseFloat(num.toFixed(8)); } }; - exports2.ConflictException = ConflictException; - exports2.LogLevel = { - ALL: "ALL", - ERROR: "ERROR", - FATAL: "FATAL", - OFF: "OFF" - }; - exports2.StateMachineType = { - EXPRESS: "EXPRESS", - STANDARD: "STANDARD" - }; - var InvalidArn = class _InvalidArn extends SFNServiceException_1.SFNServiceException { - constructor(opts) { - super({ - name: "InvalidArn", - $fault: "client", - ...opts - }); - this.name = "InvalidArn"; - this.$fault = "client"; - Object.setPrototypeOf(this, _InvalidArn.prototype); + __name(_DefaultRateLimiter, "DefaultRateLimiter"); + var DefaultRateLimiter = _DefaultRateLimiter; + var DEFAULT_RETRY_DELAY_BASE = 100; + var MAXIMUM_RETRY_DELAY = 20 * 1e3; + var THROTTLING_RETRY_DELAY_BASE = 500; + var INITIAL_RETRY_TOKENS = 500; + var RETRY_COST = 5; + var TIMEOUT_RETRY_COST = 10; + var NO_RETRY_INCREMENT = 1; + var INVOCATION_ID_HEADER = "amz-sdk-invocation-id"; + var REQUEST_HEADER = "amz-sdk-request"; + var getDefaultRetryBackoffStrategy = /* @__PURE__ */ __name(() => { + let delayBase = DEFAULT_RETRY_DELAY_BASE; + const computeNextBackoffDelay = /* @__PURE__ */ __name((attempts) => { + return Math.floor(Math.min(MAXIMUM_RETRY_DELAY, Math.random() * 2 ** attempts * delayBase)); + }, "computeNextBackoffDelay"); + const setDelayBase = /* @__PURE__ */ __name((delay) => { + delayBase = delay; + }, "setDelayBase"); + return { + computeNextBackoffDelay, + setDelayBase + }; + }, "getDefaultRetryBackoffStrategy"); + var createDefaultRetryToken = /* @__PURE__ */ __name(({ + retryDelay, + retryCount, + retryCost + }) => { + const getRetryCount = /* @__PURE__ */ __name(() => retryCount, "getRetryCount"); + const getRetryDelay = /* @__PURE__ */ __name(() => Math.min(MAXIMUM_RETRY_DELAY, retryDelay), "getRetryDelay"); + const getRetryCost = /* @__PURE__ */ __name(() => retryCost, "getRetryCost"); + return { + getRetryCount, + getRetryDelay, + getRetryCost + }; + }, "createDefaultRetryToken"); + var _StandardRetryStrategy = class _StandardRetryStrategy { + constructor(maxAttempts) { + this.maxAttempts = maxAttempts; + this.mode = "standard"; + this.capacity = INITIAL_RETRY_TOKENS; + this.retryBackoffStrategy = getDefaultRetryBackoffStrategy(); + this.maxAttemptsProvider = typeof maxAttempts === "function" ? maxAttempts : async () => maxAttempts; } - }; - exports2.InvalidArn = InvalidArn; - var InvalidDefinition = class _InvalidDefinition extends SFNServiceException_1.SFNServiceException { - constructor(opts) { - super({ - name: "InvalidDefinition", - $fault: "client", - ...opts + // eslint-disable-next-line @typescript-eslint/no-unused-vars + async acquireInitialRetryToken(retryTokenScope) { + return createDefaultRetryToken({ + retryDelay: DEFAULT_RETRY_DELAY_BASE, + retryCount: 0 }); - this.name = "InvalidDefinition"; - this.$fault = "client"; - Object.setPrototypeOf(this, _InvalidDefinition.prototype); } - }; - exports2.InvalidDefinition = InvalidDefinition; - var InvalidLoggingConfiguration = class _InvalidLoggingConfiguration extends SFNServiceException_1.SFNServiceException { - constructor(opts) { - super({ - name: "InvalidLoggingConfiguration", - $fault: "client", - ...opts - }); - this.name = "InvalidLoggingConfiguration"; - this.$fault = "client"; - Object.setPrototypeOf(this, _InvalidLoggingConfiguration.prototype); + async refreshRetryTokenForRetry(token, errorInfo) { + const maxAttempts = await this.getMaxAttempts(); + if (this.shouldRetry(token, errorInfo, maxAttempts)) { + const errorType = errorInfo.errorType; + this.retryBackoffStrategy.setDelayBase( + errorType === "THROTTLING" ? THROTTLING_RETRY_DELAY_BASE : DEFAULT_RETRY_DELAY_BASE + ); + const delayFromErrorType = this.retryBackoffStrategy.computeNextBackoffDelay(token.getRetryCount()); + const retryDelay = errorInfo.retryAfterHint ? Math.max(errorInfo.retryAfterHint.getTime() - Date.now() || 0, delayFromErrorType) : delayFromErrorType; + const capacityCost = this.getCapacityCost(errorType); + this.capacity -= capacityCost; + return createDefaultRetryToken({ + retryDelay, + retryCount: token.getRetryCount() + 1, + retryCost: capacityCost + }); + } + throw new Error("No retry token available"); } - }; - exports2.InvalidLoggingConfiguration = InvalidLoggingConfiguration; - var InvalidTracingConfiguration = class _InvalidTracingConfiguration extends SFNServiceException_1.SFNServiceException { - constructor(opts) { - super({ - name: "InvalidTracingConfiguration", - $fault: "client", - ...opts - }); - this.name = "InvalidTracingConfiguration"; - this.$fault = "client"; - Object.setPrototypeOf(this, _InvalidTracingConfiguration.prototype); + recordSuccess(token) { + this.capacity = Math.max(INITIAL_RETRY_TOKENS, this.capacity + (token.getRetryCost() ?? NO_RETRY_INCREMENT)); } - }; - exports2.InvalidTracingConfiguration = InvalidTracingConfiguration; - var StateMachineAlreadyExists = class _StateMachineAlreadyExists extends SFNServiceException_1.SFNServiceException { - constructor(opts) { - super({ - name: "StateMachineAlreadyExists", - $fault: "client", - ...opts - }); - this.name = "StateMachineAlreadyExists"; - this.$fault = "client"; - Object.setPrototypeOf(this, _StateMachineAlreadyExists.prototype); + /** + * @returns the current available retry capacity. + * + * This number decreases when retries are executed and refills when requests or retries succeed. + */ + getCapacity() { + return this.capacity; } - }; - exports2.StateMachineAlreadyExists = StateMachineAlreadyExists; - var StateMachineDeleting = class _StateMachineDeleting extends SFNServiceException_1.SFNServiceException { - constructor(opts) { - super({ - name: "StateMachineDeleting", - $fault: "client", - ...opts - }); - this.name = "StateMachineDeleting"; - this.$fault = "client"; - Object.setPrototypeOf(this, _StateMachineDeleting.prototype); + async getMaxAttempts() { + try { + return await this.maxAttemptsProvider(); + } catch (error) { + console.warn(`Max attempts provider could not resolve. Using default of ${DEFAULT_MAX_ATTEMPTS}`); + return DEFAULT_MAX_ATTEMPTS; + } } - }; - exports2.StateMachineDeleting = StateMachineDeleting; - var StateMachineLimitExceeded = class _StateMachineLimitExceeded extends SFNServiceException_1.SFNServiceException { - constructor(opts) { - super({ - name: "StateMachineLimitExceeded", - $fault: "client", - ...opts - }); - this.name = "StateMachineLimitExceeded"; - this.$fault = "client"; - Object.setPrototypeOf(this, _StateMachineLimitExceeded.prototype); + shouldRetry(tokenToRenew, errorInfo, maxAttempts) { + const attempts = tokenToRenew.getRetryCount() + 1; + return attempts < maxAttempts && this.capacity >= this.getCapacityCost(errorInfo.errorType) && this.isRetryableError(errorInfo.errorType); } - }; - exports2.StateMachineLimitExceeded = StateMachineLimitExceeded; - var StateMachineTypeNotSupported = class _StateMachineTypeNotSupported extends SFNServiceException_1.SFNServiceException { - constructor(opts) { - super({ - name: "StateMachineTypeNotSupported", - $fault: "client", - ...opts - }); - this.name = "StateMachineTypeNotSupported"; - this.$fault = "client"; - Object.setPrototypeOf(this, _StateMachineTypeNotSupported.prototype); + getCapacityCost(errorType) { + return errorType === "TRANSIENT" ? TIMEOUT_RETRY_COST : RETRY_COST; } - }; - exports2.StateMachineTypeNotSupported = StateMachineTypeNotSupported; - exports2.ValidationExceptionReason = { - API_DOES_NOT_SUPPORT_LABELED_ARNS: "API_DOES_NOT_SUPPORT_LABELED_ARNS", - CANNOT_UPDATE_COMPLETED_MAP_RUN: "CANNOT_UPDATE_COMPLETED_MAP_RUN", - INVALID_ROUTING_CONFIGURATION: "INVALID_ROUTING_CONFIGURATION", - MISSING_REQUIRED_PARAMETER: "MISSING_REQUIRED_PARAMETER" - }; - var ValidationException = class _ValidationException extends SFNServiceException_1.SFNServiceException { - constructor(opts) { - super({ - name: "ValidationException", - $fault: "client", - ...opts - }); - this.name = "ValidationException"; - this.$fault = "client"; - Object.setPrototypeOf(this, _ValidationException.prototype); - this.reason = opts.reason; + isRetryableError(errorType) { + return errorType === "THROTTLING" || errorType === "TRANSIENT"; } }; - exports2.ValidationException = ValidationException; - var ResourceNotFound = class _ResourceNotFound extends SFNServiceException_1.SFNServiceException { - constructor(opts) { - super({ - name: "ResourceNotFound", - $fault: "client", - ...opts - }); - this.name = "ResourceNotFound"; - this.$fault = "client"; - Object.setPrototypeOf(this, _ResourceNotFound.prototype); - this.resourceName = opts.resourceName; + __name(_StandardRetryStrategy, "StandardRetryStrategy"); + var StandardRetryStrategy = _StandardRetryStrategy; + var _AdaptiveRetryStrategy = class _AdaptiveRetryStrategy { + constructor(maxAttemptsProvider, options) { + this.maxAttemptsProvider = maxAttemptsProvider; + this.mode = "adaptive"; + const { rateLimiter } = options ?? {}; + this.rateLimiter = rateLimiter ?? new DefaultRateLimiter(); + this.standardRetryStrategy = new StandardRetryStrategy(maxAttemptsProvider); } - }; - exports2.ResourceNotFound = ResourceNotFound; - var ServiceQuotaExceededException = class _ServiceQuotaExceededException extends SFNServiceException_1.SFNServiceException { - constructor(opts) { - super({ - name: "ServiceQuotaExceededException", - $fault: "client", - ...opts - }); - this.name = "ServiceQuotaExceededException"; - this.$fault = "client"; - Object.setPrototypeOf(this, _ServiceQuotaExceededException.prototype); + async acquireInitialRetryToken(retryTokenScope) { + await this.rateLimiter.getSendToken(); + return this.standardRetryStrategy.acquireInitialRetryToken(retryTokenScope); + } + async refreshRetryTokenForRetry(tokenToRenew, errorInfo) { + this.rateLimiter.updateClientSendingRate(errorInfo); + return this.standardRetryStrategy.refreshRetryTokenForRetry(tokenToRenew, errorInfo); + } + recordSuccess(token) { + this.rateLimiter.updateClientSendingRate({}); + this.standardRetryStrategy.recordSuccess(token); } }; - exports2.ServiceQuotaExceededException = ServiceQuotaExceededException; - exports2.ExecutionStatus = { - ABORTED: "ABORTED", - FAILED: "FAILED", - RUNNING: "RUNNING", - SUCCEEDED: "SUCCEEDED", - TIMED_OUT: "TIMED_OUT" - }; - var ExecutionDoesNotExist = class _ExecutionDoesNotExist extends SFNServiceException_1.SFNServiceException { - constructor(opts) { - super({ - name: "ExecutionDoesNotExist", - $fault: "client", - ...opts - }); - this.name = "ExecutionDoesNotExist"; - this.$fault = "client"; - Object.setPrototypeOf(this, _ExecutionDoesNotExist.prototype); + __name(_AdaptiveRetryStrategy, "AdaptiveRetryStrategy"); + var AdaptiveRetryStrategy = _AdaptiveRetryStrategy; + var _ConfiguredRetryStrategy = class _ConfiguredRetryStrategy extends StandardRetryStrategy { + /** + * @param maxAttempts - the maximum number of retry attempts allowed. + * e.g., if set to 3, then 4 total requests are possible. + * @param computeNextBackoffDelay - a millisecond delay for each retry or a function that takes the retry attempt + * and returns the delay. + * + * @example exponential backoff. + * ```js + * new Client({ + * retryStrategy: new ConfiguredRetryStrategy(3, (attempt) => attempt ** 2) + * }); + * ``` + * @example constant delay. + * ```js + * new Client({ + * retryStrategy: new ConfiguredRetryStrategy(3, 2000) + * }); + * ``` + */ + constructor(maxAttempts, computeNextBackoffDelay = DEFAULT_RETRY_DELAY_BASE) { + super(typeof maxAttempts === "function" ? maxAttempts : async () => maxAttempts); + if (typeof computeNextBackoffDelay === "number") { + this.computeNextBackoffDelay = () => computeNextBackoffDelay; + } else { + this.computeNextBackoffDelay = computeNextBackoffDelay; + } + } + async refreshRetryTokenForRetry(tokenToRenew, errorInfo) { + const token = await super.refreshRetryTokenForRetry(tokenToRenew, errorInfo); + token.getRetryDelay = () => this.computeNextBackoffDelay(token.getRetryCount()); + return token; } }; - exports2.ExecutionDoesNotExist = ExecutionDoesNotExist; - exports2.MapRunStatus = { - ABORTED: "ABORTED", - FAILED: "FAILED", - RUNNING: "RUNNING", - SUCCEEDED: "SUCCEEDED" - }; - exports2.StateMachineStatus = { - ACTIVE: "ACTIVE", - DELETING: "DELETING" + __name(_ConfiguredRetryStrategy, "ConfiguredRetryStrategy"); + var ConfiguredRetryStrategy = _ConfiguredRetryStrategy; + } +}); + +// ../../../node_modules/@aws-sdk/client-sso/dist-cjs/endpoint/ruleset.js +var require_ruleset = __commonJS({ + "../../../node_modules/@aws-sdk/client-sso/dist-cjs/endpoint/ruleset.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.ruleSet = void 0; + var u = "required"; + var v = "fn"; + var w = "argv"; + var x = "ref"; + var a = true; + var b = "isSet"; + var c = "booleanEquals"; + var d = "error"; + var e = "endpoint"; + var f = "tree"; + var g = "PartitionResult"; + var h = "getAttr"; + var i = { [u]: false, "type": "String" }; + var j = { [u]: true, "default": false, "type": "Boolean" }; + var k = { [x]: "Endpoint" }; + var l = { [v]: c, [w]: [{ [x]: "UseFIPS" }, true] }; + var m = { [v]: c, [w]: [{ [x]: "UseDualStack" }, true] }; + var n = {}; + var o = { [v]: h, [w]: [{ [x]: g }, "supportsFIPS"] }; + var p = { [x]: g }; + var q = { [v]: c, [w]: [true, { [v]: h, [w]: [p, "supportsDualStack"] }] }; + var r = [l]; + var s = [m]; + var t = [{ [x]: "Region" }]; + var _data = { version: "1.0", parameters: { Region: i, UseDualStack: j, UseFIPS: j, Endpoint: i }, rules: [{ conditions: [{ [v]: b, [w]: [k] }], rules: [{ conditions: r, error: "Invalid Configuration: FIPS and custom endpoint are not supported", type: d }, { conditions: s, error: "Invalid Configuration: Dualstack and custom endpoint are not supported", type: d }, { endpoint: { url: k, properties: n, headers: n }, type: e }], type: f }, { conditions: [{ [v]: b, [w]: t }], rules: [{ conditions: [{ [v]: "aws.partition", [w]: t, assign: g }], rules: [{ conditions: [l, m], rules: [{ conditions: [{ [v]: c, [w]: [a, o] }, q], rules: [{ endpoint: { url: "https://portal.sso-fips.{Region}.{PartitionResult#dualStackDnsSuffix}", properties: n, headers: n }, type: e }], type: f }, { error: "FIPS and DualStack are enabled, but this partition does not support one or both", type: d }], type: f }, { conditions: r, rules: [{ conditions: [{ [v]: c, [w]: [o, a] }], rules: [{ conditions: [{ [v]: "stringEquals", [w]: [{ [v]: h, [w]: [p, "name"] }, "aws-us-gov"] }], endpoint: { url: "https://portal.sso.{Region}.amazonaws.com", properties: n, headers: n }, type: e }, { endpoint: { url: "https://portal.sso-fips.{Region}.{PartitionResult#dnsSuffix}", properties: n, headers: n }, type: e }], type: f }, { error: "FIPS is enabled but this partition does not support FIPS", type: d }], type: f }, { conditions: s, rules: [{ conditions: [q], rules: [{ endpoint: { url: "https://portal.sso.{Region}.{PartitionResult#dualStackDnsSuffix}", properties: n, headers: n }, type: e }], type: f }, { error: "DualStack is enabled but this partition does not support DualStack", type: d }], type: f }, { endpoint: { url: "https://portal.sso.{Region}.{PartitionResult#dnsSuffix}", properties: n, headers: n }, type: e }], type: f }], type: f }, { error: "Invalid Configuration: Missing Region", type: d }] }; + exports2.ruleSet = _data; + } +}); + +// ../../../node_modules/@aws-sdk/client-sso/dist-cjs/endpoint/endpointResolver.js +var require_endpointResolver = __commonJS({ + "../../../node_modules/@aws-sdk/client-sso/dist-cjs/endpoint/endpointResolver.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.defaultEndpointResolver = void 0; + var util_endpoints_1 = require_dist_cjs7(); + var util_endpoints_2 = require_dist_cjs6(); + var ruleset_1 = require_ruleset(); + var defaultEndpointResolver = (endpointParams, context = {}) => { + return (0, util_endpoints_2.resolveEndpoint)(ruleset_1.ruleSet, { + endpointParams, + logger: context.logger + }); }; - var StateMachineDoesNotExist = class _StateMachineDoesNotExist extends SFNServiceException_1.SFNServiceException { - constructor(opts) { - super({ - name: "StateMachineDoesNotExist", - $fault: "client", - ...opts - }); - this.name = "StateMachineDoesNotExist"; - this.$fault = "client"; - Object.setPrototypeOf(this, _StateMachineDoesNotExist.prototype); - } + exports2.defaultEndpointResolver = defaultEndpointResolver; + util_endpoints_2.customEndpointFunctions.aws = util_endpoints_1.awsEndpointFunctions; + } +}); + +// ../../../node_modules/@aws-sdk/client-sso/dist-cjs/runtimeConfig.shared.js +var require_runtimeConfig_shared = __commonJS({ + "../../../node_modules/@aws-sdk/client-sso/dist-cjs/runtimeConfig.shared.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.getRuntimeConfig = void 0; + var core_1 = (init_dist_es2(), __toCommonJS(dist_es_exports2)); + var core_2 = (init_dist_es(), __toCommonJS(dist_es_exports)); + var smithy_client_1 = require_dist_cjs37(); + var url_parser_1 = require_dist_cjs44(); + var util_base64_1 = require_dist_cjs29(); + var util_utf8_1 = require_dist_cjs28(); + var httpAuthSchemeProvider_1 = require_httpAuthSchemeProvider2(); + var endpointResolver_1 = require_endpointResolver(); + var getRuntimeConfig = (config) => { + return { + apiVersion: "2019-06-10", + base64Decoder: config?.base64Decoder ?? util_base64_1.fromBase64, + base64Encoder: config?.base64Encoder ?? util_base64_1.toBase64, + disableHostPrefix: config?.disableHostPrefix ?? false, + endpointProvider: config?.endpointProvider ?? endpointResolver_1.defaultEndpointResolver, + extensions: config?.extensions ?? [], + httpAuthSchemeProvider: config?.httpAuthSchemeProvider ?? httpAuthSchemeProvider_1.defaultSSOHttpAuthSchemeProvider, + httpAuthSchemes: config?.httpAuthSchemes ?? [ + { + schemeId: "aws.auth#sigv4", + identityProvider: (ipc) => ipc.getIdentityProvider("aws.auth#sigv4"), + signer: new core_1.AwsSdkSigV4Signer() + }, + { + schemeId: "smithy.api#noAuth", + identityProvider: (ipc) => ipc.getIdentityProvider("smithy.api#noAuth") || (async () => ({})), + signer: new core_2.NoAuthSigner() + } + ], + logger: config?.logger ?? new smithy_client_1.NoOpLogger(), + serviceId: config?.serviceId ?? "SSO", + urlParser: config?.urlParser ?? url_parser_1.parseUrl, + utf8Decoder: config?.utf8Decoder ?? util_utf8_1.fromUtf8, + utf8Encoder: config?.utf8Encoder ?? util_utf8_1.toUtf8 + }; }; - exports2.StateMachineDoesNotExist = StateMachineDoesNotExist; - exports2.HistoryEventType = { - ActivityFailed: "ActivityFailed", - ActivityScheduleFailed: "ActivityScheduleFailed", - ActivityScheduled: "ActivityScheduled", - ActivityStarted: "ActivityStarted", - ActivitySucceeded: "ActivitySucceeded", - ActivityTimedOut: "ActivityTimedOut", - ChoiceStateEntered: "ChoiceStateEntered", - ChoiceStateExited: "ChoiceStateExited", - ExecutionAborted: "ExecutionAborted", - ExecutionFailed: "ExecutionFailed", - ExecutionStarted: "ExecutionStarted", - ExecutionSucceeded: "ExecutionSucceeded", - ExecutionTimedOut: "ExecutionTimedOut", - FailStateEntered: "FailStateEntered", - LambdaFunctionFailed: "LambdaFunctionFailed", - LambdaFunctionScheduleFailed: "LambdaFunctionScheduleFailed", - LambdaFunctionScheduled: "LambdaFunctionScheduled", - LambdaFunctionStartFailed: "LambdaFunctionStartFailed", - LambdaFunctionStarted: "LambdaFunctionStarted", - LambdaFunctionSucceeded: "LambdaFunctionSucceeded", - LambdaFunctionTimedOut: "LambdaFunctionTimedOut", - MapIterationAborted: "MapIterationAborted", - MapIterationFailed: "MapIterationFailed", - MapIterationStarted: "MapIterationStarted", - MapIterationSucceeded: "MapIterationSucceeded", - MapRunAborted: "MapRunAborted", - MapRunFailed: "MapRunFailed", - MapRunStarted: "MapRunStarted", - MapRunSucceeded: "MapRunSucceeded", - MapStateAborted: "MapStateAborted", - MapStateEntered: "MapStateEntered", - MapStateExited: "MapStateExited", - MapStateFailed: "MapStateFailed", - MapStateStarted: "MapStateStarted", - MapStateSucceeded: "MapStateSucceeded", - ParallelStateAborted: "ParallelStateAborted", - ParallelStateEntered: "ParallelStateEntered", - ParallelStateExited: "ParallelStateExited", - ParallelStateFailed: "ParallelStateFailed", - ParallelStateStarted: "ParallelStateStarted", - ParallelStateSucceeded: "ParallelStateSucceeded", - PassStateEntered: "PassStateEntered", - PassStateExited: "PassStateExited", - SucceedStateEntered: "SucceedStateEntered", - SucceedStateExited: "SucceedStateExited", - TaskFailed: "TaskFailed", - TaskScheduled: "TaskScheduled", - TaskStartFailed: "TaskStartFailed", - TaskStarted: "TaskStarted", - TaskStateAborted: "TaskStateAborted", - TaskStateEntered: "TaskStateEntered", - TaskStateExited: "TaskStateExited", - TaskSubmitFailed: "TaskSubmitFailed", - TaskSubmitted: "TaskSubmitted", - TaskSucceeded: "TaskSucceeded", - TaskTimedOut: "TaskTimedOut", - WaitStateAborted: "WaitStateAborted", - WaitStateEntered: "WaitStateEntered", - WaitStateExited: "WaitStateExited" + exports2.getRuntimeConfig = getRuntimeConfig; + } +}); + +// ../../../node_modules/@smithy/util-defaults-mode-node/node_modules/@smithy/util-middleware/dist-cjs/index.js +var require_dist_cjs61 = __commonJS({ + "../../../node_modules/@smithy/util-defaults-mode-node/node_modules/@smithy/util-middleware/dist-cjs/index.js"(exports2, module2) { + var __defProp2 = Object.defineProperty; + var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; + var __getOwnPropNames2 = Object.getOwnPropertyNames; + var __hasOwnProp2 = Object.prototype.hasOwnProperty; + var __name = (target, value) => __defProp2(target, "name", { value, configurable: true }); + var __export2 = (target, all) => { + for (var name in all) + __defProp2(target, name, { get: all[name], enumerable: true }); }; - var InvalidToken = class _InvalidToken extends SFNServiceException_1.SFNServiceException { - constructor(opts) { - super({ - name: "InvalidToken", - $fault: "client", - ...opts - }); - this.name = "InvalidToken"; - this.$fault = "client"; - Object.setPrototypeOf(this, _InvalidToken.prototype); + var __copyProps2 = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames2(from)) + if (!__hasOwnProp2.call(to, key) && key !== except) + __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable }); } + return to; }; - exports2.InvalidToken = InvalidToken; - var TaskDoesNotExist = class _TaskDoesNotExist extends SFNServiceException_1.SFNServiceException { - constructor(opts) { - super({ - name: "TaskDoesNotExist", - $fault: "client", - ...opts - }); - this.name = "TaskDoesNotExist"; - this.$fault = "client"; - Object.setPrototypeOf(this, _TaskDoesNotExist.prototype); - } + var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); + var src_exports = {}; + __export2(src_exports, { + getSmithyContext: () => getSmithyContext4, + normalizeProvider: () => normalizeProvider2 + }); + module2.exports = __toCommonJS2(src_exports); + var import_types5 = require_dist_cjs(); + var getSmithyContext4 = /* @__PURE__ */ __name((context) => context[import_types5.SMITHY_CONTEXT_KEY] || (context[import_types5.SMITHY_CONTEXT_KEY] = {}), "getSmithyContext"); + var normalizeProvider2 = /* @__PURE__ */ __name((input) => { + if (typeof input === "function") + return input; + const promisified = Promise.resolve(input); + return () => promisified; + }, "normalizeProvider"); + } +}); + +// ../../../node_modules/@smithy/util-defaults-mode-node/node_modules/@smithy/config-resolver/dist-cjs/index.js +var require_dist_cjs62 = __commonJS({ + "../../../node_modules/@smithy/util-defaults-mode-node/node_modules/@smithy/config-resolver/dist-cjs/index.js"(exports2, module2) { + var __defProp2 = Object.defineProperty; + var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; + var __getOwnPropNames2 = Object.getOwnPropertyNames; + var __hasOwnProp2 = Object.prototype.hasOwnProperty; + var __name = (target, value) => __defProp2(target, "name", { value, configurable: true }); + var __export2 = (target, all) => { + for (var name in all) + __defProp2(target, name, { get: all[name], enumerable: true }); }; - exports2.TaskDoesNotExist = TaskDoesNotExist; - var TaskTimedOut = class _TaskTimedOut extends SFNServiceException_1.SFNServiceException { - constructor(opts) { - super({ - name: "TaskTimedOut", - $fault: "client", - ...opts - }); - this.name = "TaskTimedOut"; - this.$fault = "client"; - Object.setPrototypeOf(this, _TaskTimedOut.prototype); + var __copyProps2 = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames2(from)) + if (!__hasOwnProp2.call(to, key) && key !== except) + __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable }); } + return to; }; - exports2.TaskTimedOut = TaskTimedOut; - var InvalidOutput = class _InvalidOutput extends SFNServiceException_1.SFNServiceException { - constructor(opts) { - super({ - name: "InvalidOutput", - $fault: "client", - ...opts - }); - this.name = "InvalidOutput"; - this.$fault = "client"; - Object.setPrototypeOf(this, _InvalidOutput.prototype); - } + var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); + var src_exports = {}; + __export2(src_exports, { + CONFIG_USE_DUALSTACK_ENDPOINT: () => CONFIG_USE_DUALSTACK_ENDPOINT, + CONFIG_USE_FIPS_ENDPOINT: () => CONFIG_USE_FIPS_ENDPOINT, + DEFAULT_USE_DUALSTACK_ENDPOINT: () => DEFAULT_USE_DUALSTACK_ENDPOINT, + DEFAULT_USE_FIPS_ENDPOINT: () => DEFAULT_USE_FIPS_ENDPOINT, + ENV_USE_DUALSTACK_ENDPOINT: () => ENV_USE_DUALSTACK_ENDPOINT, + ENV_USE_FIPS_ENDPOINT: () => ENV_USE_FIPS_ENDPOINT, + NODE_REGION_CONFIG_FILE_OPTIONS: () => NODE_REGION_CONFIG_FILE_OPTIONS, + NODE_REGION_CONFIG_OPTIONS: () => NODE_REGION_CONFIG_OPTIONS, + NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS: () => NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS, + NODE_USE_FIPS_ENDPOINT_CONFIG_OPTIONS: () => NODE_USE_FIPS_ENDPOINT_CONFIG_OPTIONS, + REGION_ENV_NAME: () => REGION_ENV_NAME, + REGION_INI_NAME: () => REGION_INI_NAME, + getRegionInfo: () => getRegionInfo, + resolveCustomEndpointsConfig: () => resolveCustomEndpointsConfig, + resolveEndpointsConfig: () => resolveEndpointsConfig, + resolveRegionConfig: () => resolveRegionConfig + }); + module2.exports = __toCommonJS2(src_exports); + var import_util_config_provider = require_dist_cjs9(); + var ENV_USE_DUALSTACK_ENDPOINT = "AWS_USE_DUALSTACK_ENDPOINT"; + var CONFIG_USE_DUALSTACK_ENDPOINT = "use_dualstack_endpoint"; + var DEFAULT_USE_DUALSTACK_ENDPOINT = false; + var NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS = { + environmentVariableSelector: (env) => (0, import_util_config_provider.booleanSelector)(env, ENV_USE_DUALSTACK_ENDPOINT, import_util_config_provider.SelectorType.ENV), + configFileSelector: (profile) => (0, import_util_config_provider.booleanSelector)(profile, CONFIG_USE_DUALSTACK_ENDPOINT, import_util_config_provider.SelectorType.CONFIG), + default: false }; - exports2.InvalidOutput = InvalidOutput; - var ExecutionAlreadyExists = class _ExecutionAlreadyExists extends SFNServiceException_1.SFNServiceException { - constructor(opts) { - super({ - name: "ExecutionAlreadyExists", - $fault: "client", - ...opts - }); - this.name = "ExecutionAlreadyExists"; - this.$fault = "client"; - Object.setPrototypeOf(this, _ExecutionAlreadyExists.prototype); - } + var ENV_USE_FIPS_ENDPOINT = "AWS_USE_FIPS_ENDPOINT"; + var CONFIG_USE_FIPS_ENDPOINT = "use_fips_endpoint"; + var DEFAULT_USE_FIPS_ENDPOINT = false; + var NODE_USE_FIPS_ENDPOINT_CONFIG_OPTIONS = { + environmentVariableSelector: (env) => (0, import_util_config_provider.booleanSelector)(env, ENV_USE_FIPS_ENDPOINT, import_util_config_provider.SelectorType.ENV), + configFileSelector: (profile) => (0, import_util_config_provider.booleanSelector)(profile, CONFIG_USE_FIPS_ENDPOINT, import_util_config_provider.SelectorType.CONFIG), + default: false }; - exports2.ExecutionAlreadyExists = ExecutionAlreadyExists; - var ExecutionLimitExceeded = class _ExecutionLimitExceeded extends SFNServiceException_1.SFNServiceException { - constructor(opts) { - super({ - name: "ExecutionLimitExceeded", - $fault: "client", - ...opts - }); - this.name = "ExecutionLimitExceeded"; - this.$fault = "client"; - Object.setPrototypeOf(this, _ExecutionLimitExceeded.prototype); + var import_util_middleware3 = require_dist_cjs61(); + var resolveCustomEndpointsConfig = /* @__PURE__ */ __name((input) => { + const { endpoint, urlParser } = input; + return { + ...input, + tls: input.tls ?? true, + endpoint: (0, import_util_middleware3.normalizeProvider)(typeof endpoint === "string" ? urlParser(endpoint) : endpoint), + isCustomEndpoint: true, + useDualstackEndpoint: (0, import_util_middleware3.normalizeProvider)(input.useDualstackEndpoint ?? false) + }; + }, "resolveCustomEndpointsConfig"); + var getEndpointFromRegion = /* @__PURE__ */ __name(async (input) => { + const { tls = true } = input; + const region = await input.region(); + const dnsHostRegex = new RegExp(/^([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9-]{0,61}[a-zA-Z0-9])$/); + if (!dnsHostRegex.test(region)) { + throw new Error("Invalid region in client config"); } - }; - exports2.ExecutionLimitExceeded = ExecutionLimitExceeded; - var InvalidExecutionInput = class _InvalidExecutionInput extends SFNServiceException_1.SFNServiceException { - constructor(opts) { - super({ - name: "InvalidExecutionInput", - $fault: "client", - ...opts - }); - this.name = "InvalidExecutionInput"; - this.$fault = "client"; - Object.setPrototypeOf(this, _InvalidExecutionInput.prototype); + const useDualstackEndpoint = await input.useDualstackEndpoint(); + const useFipsEndpoint = await input.useFipsEndpoint(); + const { hostname } = await input.regionInfoProvider(region, { useDualstackEndpoint, useFipsEndpoint }) ?? {}; + if (!hostname) { + throw new Error("Cannot resolve hostname from client config"); + } + return input.urlParser(`${tls ? "https:" : "http:"}//${hostname}`); + }, "getEndpointFromRegion"); + var resolveEndpointsConfig = /* @__PURE__ */ __name((input) => { + const useDualstackEndpoint = (0, import_util_middleware3.normalizeProvider)(input.useDualstackEndpoint ?? false); + const { endpoint, useFipsEndpoint, urlParser } = input; + return { + ...input, + tls: input.tls ?? true, + endpoint: endpoint ? (0, import_util_middleware3.normalizeProvider)(typeof endpoint === "string" ? urlParser(endpoint) : endpoint) : () => getEndpointFromRegion({ ...input, useDualstackEndpoint, useFipsEndpoint }), + isCustomEndpoint: !!endpoint, + useDualstackEndpoint + }; + }, "resolveEndpointsConfig"); + var REGION_ENV_NAME = "AWS_REGION"; + var REGION_INI_NAME = "region"; + var NODE_REGION_CONFIG_OPTIONS = { + environmentVariableSelector: (env) => env[REGION_ENV_NAME], + configFileSelector: (profile) => profile[REGION_INI_NAME], + default: () => { + throw new Error("Region is missing"); } }; - exports2.InvalidExecutionInput = InvalidExecutionInput; - exports2.SyncExecutionStatus = { - FAILED: "FAILED", - SUCCEEDED: "SUCCEEDED", - TIMED_OUT: "TIMED_OUT" + var NODE_REGION_CONFIG_FILE_OPTIONS = { + preferredFile: "credentials" }; - var MissingRequiredParameter = class _MissingRequiredParameter extends SFNServiceException_1.SFNServiceException { - constructor(opts) { - super({ - name: "MissingRequiredParameter", - $fault: "client", - ...opts - }); - this.name = "MissingRequiredParameter"; - this.$fault = "client"; - Object.setPrototypeOf(this, _MissingRequiredParameter.prototype); + var isFipsRegion = /* @__PURE__ */ __name((region) => typeof region === "string" && (region.startsWith("fips-") || region.endsWith("-fips")), "isFipsRegion"); + var getRealRegion = /* @__PURE__ */ __name((region) => isFipsRegion(region) ? ["fips-aws-global", "aws-fips"].includes(region) ? "us-east-1" : region.replace(/fips-(dkr-|prod-)?|-fips/, "") : region, "getRealRegion"); + var resolveRegionConfig = /* @__PURE__ */ __name((input) => { + const { region, useFipsEndpoint } = input; + if (!region) { + throw new Error("Region is missing"); } - }; - exports2.MissingRequiredParameter = MissingRequiredParameter; - var ActivityFailedEventDetailsFilterSensitiveLog = (obj) => ({ - ...obj, - ...obj.error && { error: smithy_client_1.SENSITIVE_STRING }, - ...obj.cause && { cause: smithy_client_1.SENSITIVE_STRING } - }); - exports2.ActivityFailedEventDetailsFilterSensitiveLog = ActivityFailedEventDetailsFilterSensitiveLog; - var ActivityScheduledEventDetailsFilterSensitiveLog = (obj) => ({ - ...obj, - ...obj.input && { input: smithy_client_1.SENSITIVE_STRING } - }); - exports2.ActivityScheduledEventDetailsFilterSensitiveLog = ActivityScheduledEventDetailsFilterSensitiveLog; - var ActivityScheduleFailedEventDetailsFilterSensitiveLog = (obj) => ({ - ...obj, - ...obj.error && { error: smithy_client_1.SENSITIVE_STRING }, - ...obj.cause && { cause: smithy_client_1.SENSITIVE_STRING } - }); - exports2.ActivityScheduleFailedEventDetailsFilterSensitiveLog = ActivityScheduleFailedEventDetailsFilterSensitiveLog; - var ActivitySucceededEventDetailsFilterSensitiveLog = (obj) => ({ - ...obj, - ...obj.output && { output: smithy_client_1.SENSITIVE_STRING } - }); - exports2.ActivitySucceededEventDetailsFilterSensitiveLog = ActivitySucceededEventDetailsFilterSensitiveLog; - var ActivityTimedOutEventDetailsFilterSensitiveLog = (obj) => ({ - ...obj, - ...obj.error && { error: smithy_client_1.SENSITIVE_STRING }, - ...obj.cause && { cause: smithy_client_1.SENSITIVE_STRING } - }); - exports2.ActivityTimedOutEventDetailsFilterSensitiveLog = ActivityTimedOutEventDetailsFilterSensitiveLog; - var CreateStateMachineInputFilterSensitiveLog = (obj) => ({ - ...obj, - ...obj.definition && { definition: smithy_client_1.SENSITIVE_STRING }, - ...obj.versionDescription && { versionDescription: smithy_client_1.SENSITIVE_STRING } - }); - exports2.CreateStateMachineInputFilterSensitiveLog = CreateStateMachineInputFilterSensitiveLog; - var CreateStateMachineAliasInputFilterSensitiveLog = (obj) => ({ - ...obj, - ...obj.description && { description: smithy_client_1.SENSITIVE_STRING } - }); - exports2.CreateStateMachineAliasInputFilterSensitiveLog = CreateStateMachineAliasInputFilterSensitiveLog; - var DescribeExecutionOutputFilterSensitiveLog = (obj) => ({ - ...obj, - ...obj.input && { input: smithy_client_1.SENSITIVE_STRING }, - ...obj.output && { output: smithy_client_1.SENSITIVE_STRING }, - ...obj.error && { error: smithy_client_1.SENSITIVE_STRING }, - ...obj.cause && { cause: smithy_client_1.SENSITIVE_STRING } - }); - exports2.DescribeExecutionOutputFilterSensitiveLog = DescribeExecutionOutputFilterSensitiveLog; - var DescribeStateMachineOutputFilterSensitiveLog = (obj) => ({ - ...obj, - ...obj.definition && { definition: smithy_client_1.SENSITIVE_STRING }, - ...obj.description && { description: smithy_client_1.SENSITIVE_STRING } - }); - exports2.DescribeStateMachineOutputFilterSensitiveLog = DescribeStateMachineOutputFilterSensitiveLog; - var DescribeStateMachineAliasOutputFilterSensitiveLog = (obj) => ({ - ...obj, - ...obj.description && { description: smithy_client_1.SENSITIVE_STRING } - }); - exports2.DescribeStateMachineAliasOutputFilterSensitiveLog = DescribeStateMachineAliasOutputFilterSensitiveLog; - var DescribeStateMachineForExecutionOutputFilterSensitiveLog = (obj) => ({ - ...obj, - ...obj.definition && { definition: smithy_client_1.SENSITIVE_STRING } - }); - exports2.DescribeStateMachineForExecutionOutputFilterSensitiveLog = DescribeStateMachineForExecutionOutputFilterSensitiveLog; - var GetActivityTaskOutputFilterSensitiveLog = (obj) => ({ - ...obj, - ...obj.input && { input: smithy_client_1.SENSITIVE_STRING } - }); - exports2.GetActivityTaskOutputFilterSensitiveLog = GetActivityTaskOutputFilterSensitiveLog; - var ExecutionAbortedEventDetailsFilterSensitiveLog = (obj) => ({ - ...obj, - ...obj.error && { error: smithy_client_1.SENSITIVE_STRING }, - ...obj.cause && { cause: smithy_client_1.SENSITIVE_STRING } - }); - exports2.ExecutionAbortedEventDetailsFilterSensitiveLog = ExecutionAbortedEventDetailsFilterSensitiveLog; - var ExecutionFailedEventDetailsFilterSensitiveLog = (obj) => ({ - ...obj, - ...obj.error && { error: smithy_client_1.SENSITIVE_STRING }, - ...obj.cause && { cause: smithy_client_1.SENSITIVE_STRING } - }); - exports2.ExecutionFailedEventDetailsFilterSensitiveLog = ExecutionFailedEventDetailsFilterSensitiveLog; - var ExecutionStartedEventDetailsFilterSensitiveLog = (obj) => ({ - ...obj, - ...obj.input && { input: smithy_client_1.SENSITIVE_STRING } - }); - exports2.ExecutionStartedEventDetailsFilterSensitiveLog = ExecutionStartedEventDetailsFilterSensitiveLog; - var ExecutionSucceededEventDetailsFilterSensitiveLog = (obj) => ({ - ...obj, - ...obj.output && { output: smithy_client_1.SENSITIVE_STRING } - }); - exports2.ExecutionSucceededEventDetailsFilterSensitiveLog = ExecutionSucceededEventDetailsFilterSensitiveLog; - var ExecutionTimedOutEventDetailsFilterSensitiveLog = (obj) => ({ - ...obj, - ...obj.error && { error: smithy_client_1.SENSITIVE_STRING }, - ...obj.cause && { cause: smithy_client_1.SENSITIVE_STRING } - }); - exports2.ExecutionTimedOutEventDetailsFilterSensitiveLog = ExecutionTimedOutEventDetailsFilterSensitiveLog; - var LambdaFunctionFailedEventDetailsFilterSensitiveLog = (obj) => ({ - ...obj, - ...obj.error && { error: smithy_client_1.SENSITIVE_STRING }, - ...obj.cause && { cause: smithy_client_1.SENSITIVE_STRING } - }); - exports2.LambdaFunctionFailedEventDetailsFilterSensitiveLog = LambdaFunctionFailedEventDetailsFilterSensitiveLog; - var LambdaFunctionScheduledEventDetailsFilterSensitiveLog = (obj) => ({ - ...obj, - ...obj.input && { input: smithy_client_1.SENSITIVE_STRING } - }); - exports2.LambdaFunctionScheduledEventDetailsFilterSensitiveLog = LambdaFunctionScheduledEventDetailsFilterSensitiveLog; - var LambdaFunctionScheduleFailedEventDetailsFilterSensitiveLog = (obj) => ({ - ...obj, - ...obj.error && { error: smithy_client_1.SENSITIVE_STRING }, - ...obj.cause && { cause: smithy_client_1.SENSITIVE_STRING } - }); - exports2.LambdaFunctionScheduleFailedEventDetailsFilterSensitiveLog = LambdaFunctionScheduleFailedEventDetailsFilterSensitiveLog; - var LambdaFunctionStartFailedEventDetailsFilterSensitiveLog = (obj) => ({ - ...obj, - ...obj.error && { error: smithy_client_1.SENSITIVE_STRING }, - ...obj.cause && { cause: smithy_client_1.SENSITIVE_STRING } - }); - exports2.LambdaFunctionStartFailedEventDetailsFilterSensitiveLog = LambdaFunctionStartFailedEventDetailsFilterSensitiveLog; - var LambdaFunctionSucceededEventDetailsFilterSensitiveLog = (obj) => ({ - ...obj, - ...obj.output && { output: smithy_client_1.SENSITIVE_STRING } - }); - exports2.LambdaFunctionSucceededEventDetailsFilterSensitiveLog = LambdaFunctionSucceededEventDetailsFilterSensitiveLog; - var LambdaFunctionTimedOutEventDetailsFilterSensitiveLog = (obj) => ({ - ...obj, - ...obj.error && { error: smithy_client_1.SENSITIVE_STRING }, - ...obj.cause && { cause: smithy_client_1.SENSITIVE_STRING } - }); - exports2.LambdaFunctionTimedOutEventDetailsFilterSensitiveLog = LambdaFunctionTimedOutEventDetailsFilterSensitiveLog; - var MapRunFailedEventDetailsFilterSensitiveLog = (obj) => ({ - ...obj, - ...obj.error && { error: smithy_client_1.SENSITIVE_STRING }, - ...obj.cause && { cause: smithy_client_1.SENSITIVE_STRING } - }); - exports2.MapRunFailedEventDetailsFilterSensitiveLog = MapRunFailedEventDetailsFilterSensitiveLog; - var StateEnteredEventDetailsFilterSensitiveLog = (obj) => ({ - ...obj, - ...obj.input && { input: smithy_client_1.SENSITIVE_STRING } - }); - exports2.StateEnteredEventDetailsFilterSensitiveLog = StateEnteredEventDetailsFilterSensitiveLog; - var StateExitedEventDetailsFilterSensitiveLog = (obj) => ({ - ...obj, - ...obj.output && { output: smithy_client_1.SENSITIVE_STRING } - }); - exports2.StateExitedEventDetailsFilterSensitiveLog = StateExitedEventDetailsFilterSensitiveLog; - var TaskFailedEventDetailsFilterSensitiveLog = (obj) => ({ - ...obj, - ...obj.error && { error: smithy_client_1.SENSITIVE_STRING }, - ...obj.cause && { cause: smithy_client_1.SENSITIVE_STRING } - }); - exports2.TaskFailedEventDetailsFilterSensitiveLog = TaskFailedEventDetailsFilterSensitiveLog; - var TaskScheduledEventDetailsFilterSensitiveLog = (obj) => ({ - ...obj, - ...obj.parameters && { parameters: smithy_client_1.SENSITIVE_STRING } - }); - exports2.TaskScheduledEventDetailsFilterSensitiveLog = TaskScheduledEventDetailsFilterSensitiveLog; - var TaskStartFailedEventDetailsFilterSensitiveLog = (obj) => ({ - ...obj, - ...obj.error && { error: smithy_client_1.SENSITIVE_STRING }, - ...obj.cause && { cause: smithy_client_1.SENSITIVE_STRING } - }); - exports2.TaskStartFailedEventDetailsFilterSensitiveLog = TaskStartFailedEventDetailsFilterSensitiveLog; - var TaskSubmitFailedEventDetailsFilterSensitiveLog = (obj) => ({ - ...obj, - ...obj.error && { error: smithy_client_1.SENSITIVE_STRING }, - ...obj.cause && { cause: smithy_client_1.SENSITIVE_STRING } - }); - exports2.TaskSubmitFailedEventDetailsFilterSensitiveLog = TaskSubmitFailedEventDetailsFilterSensitiveLog; - var TaskSubmittedEventDetailsFilterSensitiveLog = (obj) => ({ - ...obj, - ...obj.output && { output: smithy_client_1.SENSITIVE_STRING } - }); - exports2.TaskSubmittedEventDetailsFilterSensitiveLog = TaskSubmittedEventDetailsFilterSensitiveLog; - var TaskSucceededEventDetailsFilterSensitiveLog = (obj) => ({ - ...obj, - ...obj.output && { output: smithy_client_1.SENSITIVE_STRING } - }); - exports2.TaskSucceededEventDetailsFilterSensitiveLog = TaskSucceededEventDetailsFilterSensitiveLog; - var TaskTimedOutEventDetailsFilterSensitiveLog = (obj) => ({ - ...obj, - ...obj.error && { error: smithy_client_1.SENSITIVE_STRING }, - ...obj.cause && { cause: smithy_client_1.SENSITIVE_STRING } - }); - exports2.TaskTimedOutEventDetailsFilterSensitiveLog = TaskTimedOutEventDetailsFilterSensitiveLog; - var HistoryEventFilterSensitiveLog = (obj) => ({ - ...obj, - ...obj.activityFailedEventDetails && { - activityFailedEventDetails: (0, exports2.ActivityFailedEventDetailsFilterSensitiveLog)(obj.activityFailedEventDetails) - }, - ...obj.activityScheduleFailedEventDetails && { - activityScheduleFailedEventDetails: (0, exports2.ActivityScheduleFailedEventDetailsFilterSensitiveLog)(obj.activityScheduleFailedEventDetails) - }, - ...obj.activityScheduledEventDetails && { - activityScheduledEventDetails: (0, exports2.ActivityScheduledEventDetailsFilterSensitiveLog)(obj.activityScheduledEventDetails) - }, - ...obj.activitySucceededEventDetails && { - activitySucceededEventDetails: (0, exports2.ActivitySucceededEventDetailsFilterSensitiveLog)(obj.activitySucceededEventDetails) - }, - ...obj.activityTimedOutEventDetails && { - activityTimedOutEventDetails: (0, exports2.ActivityTimedOutEventDetailsFilterSensitiveLog)(obj.activityTimedOutEventDetails) - }, - ...obj.taskFailedEventDetails && { - taskFailedEventDetails: (0, exports2.TaskFailedEventDetailsFilterSensitiveLog)(obj.taskFailedEventDetails) - }, - ...obj.taskScheduledEventDetails && { - taskScheduledEventDetails: (0, exports2.TaskScheduledEventDetailsFilterSensitiveLog)(obj.taskScheduledEventDetails) - }, - ...obj.taskStartFailedEventDetails && { - taskStartFailedEventDetails: (0, exports2.TaskStartFailedEventDetailsFilterSensitiveLog)(obj.taskStartFailedEventDetails) - }, - ...obj.taskSubmitFailedEventDetails && { - taskSubmitFailedEventDetails: (0, exports2.TaskSubmitFailedEventDetailsFilterSensitiveLog)(obj.taskSubmitFailedEventDetails) - }, - ...obj.taskSubmittedEventDetails && { - taskSubmittedEventDetails: (0, exports2.TaskSubmittedEventDetailsFilterSensitiveLog)(obj.taskSubmittedEventDetails) - }, - ...obj.taskSucceededEventDetails && { - taskSucceededEventDetails: (0, exports2.TaskSucceededEventDetailsFilterSensitiveLog)(obj.taskSucceededEventDetails) - }, - ...obj.taskTimedOutEventDetails && { - taskTimedOutEventDetails: (0, exports2.TaskTimedOutEventDetailsFilterSensitiveLog)(obj.taskTimedOutEventDetails) - }, - ...obj.executionFailedEventDetails && { - executionFailedEventDetails: (0, exports2.ExecutionFailedEventDetailsFilterSensitiveLog)(obj.executionFailedEventDetails) - }, - ...obj.executionStartedEventDetails && { - executionStartedEventDetails: (0, exports2.ExecutionStartedEventDetailsFilterSensitiveLog)(obj.executionStartedEventDetails) - }, - ...obj.executionSucceededEventDetails && { - executionSucceededEventDetails: (0, exports2.ExecutionSucceededEventDetailsFilterSensitiveLog)(obj.executionSucceededEventDetails) - }, - ...obj.executionAbortedEventDetails && { - executionAbortedEventDetails: (0, exports2.ExecutionAbortedEventDetailsFilterSensitiveLog)(obj.executionAbortedEventDetails) - }, - ...obj.executionTimedOutEventDetails && { - executionTimedOutEventDetails: (0, exports2.ExecutionTimedOutEventDetailsFilterSensitiveLog)(obj.executionTimedOutEventDetails) - }, - ...obj.lambdaFunctionFailedEventDetails && { - lambdaFunctionFailedEventDetails: (0, exports2.LambdaFunctionFailedEventDetailsFilterSensitiveLog)(obj.lambdaFunctionFailedEventDetails) - }, - ...obj.lambdaFunctionScheduleFailedEventDetails && { - lambdaFunctionScheduleFailedEventDetails: (0, exports2.LambdaFunctionScheduleFailedEventDetailsFilterSensitiveLog)(obj.lambdaFunctionScheduleFailedEventDetails) - }, - ...obj.lambdaFunctionScheduledEventDetails && { - lambdaFunctionScheduledEventDetails: (0, exports2.LambdaFunctionScheduledEventDetailsFilterSensitiveLog)(obj.lambdaFunctionScheduledEventDetails) - }, - ...obj.lambdaFunctionStartFailedEventDetails && { - lambdaFunctionStartFailedEventDetails: (0, exports2.LambdaFunctionStartFailedEventDetailsFilterSensitiveLog)(obj.lambdaFunctionStartFailedEventDetails) - }, - ...obj.lambdaFunctionSucceededEventDetails && { - lambdaFunctionSucceededEventDetails: (0, exports2.LambdaFunctionSucceededEventDetailsFilterSensitiveLog)(obj.lambdaFunctionSucceededEventDetails) - }, - ...obj.lambdaFunctionTimedOutEventDetails && { - lambdaFunctionTimedOutEventDetails: (0, exports2.LambdaFunctionTimedOutEventDetailsFilterSensitiveLog)(obj.lambdaFunctionTimedOutEventDetails) - }, - ...obj.stateEnteredEventDetails && { - stateEnteredEventDetails: (0, exports2.StateEnteredEventDetailsFilterSensitiveLog)(obj.stateEnteredEventDetails) - }, - ...obj.stateExitedEventDetails && { - stateExitedEventDetails: (0, exports2.StateExitedEventDetailsFilterSensitiveLog)(obj.stateExitedEventDetails) - }, - ...obj.mapRunFailedEventDetails && { - mapRunFailedEventDetails: (0, exports2.MapRunFailedEventDetailsFilterSensitiveLog)(obj.mapRunFailedEventDetails) + return { + ...input, + region: async () => { + if (typeof region === "string") { + return getRealRegion(region); + } + const providedRegion = await region(); + return getRealRegion(providedRegion); + }, + useFipsEndpoint: async () => { + const providedRegion = typeof region === "string" ? region : await region(); + if (isFipsRegion(providedRegion)) { + return true; + } + return typeof useFipsEndpoint !== "function" ? Promise.resolve(!!useFipsEndpoint) : useFipsEndpoint(); + } + }; + }, "resolveRegionConfig"); + var getHostnameFromVariants = /* @__PURE__ */ __name((variants = [], { useFipsEndpoint, useDualstackEndpoint }) => { + var _a; + return (_a = variants.find( + ({ tags }) => useFipsEndpoint === tags.includes("fips") && useDualstackEndpoint === tags.includes("dualstack") + )) == null ? void 0 : _a.hostname; + }, "getHostnameFromVariants"); + var getResolvedHostname = /* @__PURE__ */ __name((resolvedRegion, { regionHostname, partitionHostname }) => regionHostname ? regionHostname : partitionHostname ? partitionHostname.replace("{region}", resolvedRegion) : void 0, "getResolvedHostname"); + var getResolvedPartition = /* @__PURE__ */ __name((region, { partitionHash }) => Object.keys(partitionHash || {}).find((key) => partitionHash[key].regions.includes(region)) ?? "aws", "getResolvedPartition"); + var getResolvedSigningRegion = /* @__PURE__ */ __name((hostname, { signingRegion, regionRegex, useFipsEndpoint }) => { + if (signingRegion) { + return signingRegion; + } else if (useFipsEndpoint) { + const regionRegexJs = regionRegex.replace("\\\\", "\\").replace(/^\^/g, "\\.").replace(/\$$/g, "\\."); + const regionRegexmatchArray = hostname.match(regionRegexJs); + if (regionRegexmatchArray) { + return regionRegexmatchArray[0].slice(1, -1); + } } - }); - exports2.HistoryEventFilterSensitiveLog = HistoryEventFilterSensitiveLog; - var GetExecutionHistoryOutputFilterSensitiveLog = (obj) => ({ - ...obj, - ...obj.events && { events: obj.events.map((item) => (0, exports2.HistoryEventFilterSensitiveLog)(item)) } - }); - exports2.GetExecutionHistoryOutputFilterSensitiveLog = GetExecutionHistoryOutputFilterSensitiveLog; - var PublishStateMachineVersionInputFilterSensitiveLog = (obj) => ({ - ...obj, - ...obj.description && { description: smithy_client_1.SENSITIVE_STRING } - }); - exports2.PublishStateMachineVersionInputFilterSensitiveLog = PublishStateMachineVersionInputFilterSensitiveLog; - var SendTaskFailureInputFilterSensitiveLog = (obj) => ({ - ...obj, - ...obj.error && { error: smithy_client_1.SENSITIVE_STRING }, - ...obj.cause && { cause: smithy_client_1.SENSITIVE_STRING } - }); - exports2.SendTaskFailureInputFilterSensitiveLog = SendTaskFailureInputFilterSensitiveLog; - var SendTaskSuccessInputFilterSensitiveLog = (obj) => ({ - ...obj, - ...obj.output && { output: smithy_client_1.SENSITIVE_STRING } - }); - exports2.SendTaskSuccessInputFilterSensitiveLog = SendTaskSuccessInputFilterSensitiveLog; - var StartExecutionInputFilterSensitiveLog = (obj) => ({ - ...obj, - ...obj.input && { input: smithy_client_1.SENSITIVE_STRING } - }); - exports2.StartExecutionInputFilterSensitiveLog = StartExecutionInputFilterSensitiveLog; - var StartSyncExecutionInputFilterSensitiveLog = (obj) => ({ - ...obj, - ...obj.input && { input: smithy_client_1.SENSITIVE_STRING } - }); - exports2.StartSyncExecutionInputFilterSensitiveLog = StartSyncExecutionInputFilterSensitiveLog; - var StartSyncExecutionOutputFilterSensitiveLog = (obj) => ({ - ...obj, - ...obj.error && { error: smithy_client_1.SENSITIVE_STRING }, - ...obj.cause && { cause: smithy_client_1.SENSITIVE_STRING }, - ...obj.input && { input: smithy_client_1.SENSITIVE_STRING }, - ...obj.output && { output: smithy_client_1.SENSITIVE_STRING } - }); - exports2.StartSyncExecutionOutputFilterSensitiveLog = StartSyncExecutionOutputFilterSensitiveLog; - var StopExecutionInputFilterSensitiveLog = (obj) => ({ - ...obj, - ...obj.error && { error: smithy_client_1.SENSITIVE_STRING }, - ...obj.cause && { cause: smithy_client_1.SENSITIVE_STRING } - }); - exports2.StopExecutionInputFilterSensitiveLog = StopExecutionInputFilterSensitiveLog; - var UpdateStateMachineInputFilterSensitiveLog = (obj) => ({ - ...obj, - ...obj.definition && { definition: smithy_client_1.SENSITIVE_STRING }, - ...obj.versionDescription && { versionDescription: smithy_client_1.SENSITIVE_STRING } - }); - exports2.UpdateStateMachineInputFilterSensitiveLog = UpdateStateMachineInputFilterSensitiveLog; - var UpdateStateMachineAliasInputFilterSensitiveLog = (obj) => ({ - ...obj, - ...obj.description && { description: smithy_client_1.SENSITIVE_STRING } - }); - exports2.UpdateStateMachineAliasInputFilterSensitiveLog = UpdateStateMachineAliasInputFilterSensitiveLog; + }, "getResolvedSigningRegion"); + var getRegionInfo = /* @__PURE__ */ __name((region, { + useFipsEndpoint = false, + useDualstackEndpoint = false, + signingService, + regionHash, + partitionHash + }) => { + var _a, _b, _c, _d, _e; + const partition = getResolvedPartition(region, { partitionHash }); + const resolvedRegion = region in regionHash ? region : ((_a = partitionHash[partition]) == null ? void 0 : _a.endpoint) ?? region; + const hostnameOptions = { useFipsEndpoint, useDualstackEndpoint }; + const regionHostname = getHostnameFromVariants((_b = regionHash[resolvedRegion]) == null ? void 0 : _b.variants, hostnameOptions); + const partitionHostname = getHostnameFromVariants((_c = partitionHash[partition]) == null ? void 0 : _c.variants, hostnameOptions); + const hostname = getResolvedHostname(resolvedRegion, { regionHostname, partitionHostname }); + if (hostname === void 0) { + throw new Error(`Endpoint resolution failed for: ${{ resolvedRegion, useFipsEndpoint, useDualstackEndpoint }}`); + } + const signingRegion = getResolvedSigningRegion(hostname, { + signingRegion: (_d = regionHash[resolvedRegion]) == null ? void 0 : _d.signingRegion, + regionRegex: partitionHash[partition].regionRegex, + useFipsEndpoint + }); + return { + partition, + signingService, + hostname, + ...signingRegion && { signingRegion }, + ...((_e = regionHash[resolvedRegion]) == null ? void 0 : _e.signingService) && { + signingService: regionHash[resolvedRegion].signingService + } + }; + }, "getRegionInfo"); } }); -// ../../../node_modules/@aws-sdk/client-sfn/dist-cjs/protocols/Aws_json1_0.js -var require_Aws_json1_0 = __commonJS({ - "../../../node_modules/@aws-sdk/client-sfn/dist-cjs/protocols/Aws_json1_0.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.de_ListActivitiesCommand = exports2.de_GetExecutionHistoryCommand = exports2.de_GetActivityTaskCommand = exports2.de_DescribeStateMachineForExecutionCommand = exports2.de_DescribeStateMachineAliasCommand = exports2.de_DescribeStateMachineCommand = exports2.de_DescribeMapRunCommand = exports2.de_DescribeExecutionCommand = exports2.de_DescribeActivityCommand = exports2.de_DeleteStateMachineVersionCommand = exports2.de_DeleteStateMachineAliasCommand = exports2.de_DeleteStateMachineCommand = exports2.de_DeleteActivityCommand = exports2.de_CreateStateMachineAliasCommand = exports2.de_CreateStateMachineCommand = exports2.de_CreateActivityCommand = exports2.se_UpdateStateMachineAliasCommand = exports2.se_UpdateStateMachineCommand = exports2.se_UpdateMapRunCommand = exports2.se_UntagResourceCommand = exports2.se_TagResourceCommand = exports2.se_StopExecutionCommand = exports2.se_StartSyncExecutionCommand = exports2.se_StartExecutionCommand = exports2.se_SendTaskSuccessCommand = exports2.se_SendTaskHeartbeatCommand = exports2.se_SendTaskFailureCommand = exports2.se_PublishStateMachineVersionCommand = exports2.se_ListTagsForResourceCommand = exports2.se_ListStateMachineVersionsCommand = exports2.se_ListStateMachinesCommand = exports2.se_ListStateMachineAliasesCommand = exports2.se_ListMapRunsCommand = exports2.se_ListExecutionsCommand = exports2.se_ListActivitiesCommand = exports2.se_GetExecutionHistoryCommand = exports2.se_GetActivityTaskCommand = exports2.se_DescribeStateMachineForExecutionCommand = exports2.se_DescribeStateMachineAliasCommand = exports2.se_DescribeStateMachineCommand = exports2.se_DescribeMapRunCommand = exports2.se_DescribeExecutionCommand = exports2.se_DescribeActivityCommand = exports2.se_DeleteStateMachineVersionCommand = exports2.se_DeleteStateMachineAliasCommand = exports2.se_DeleteStateMachineCommand = exports2.se_DeleteActivityCommand = exports2.se_CreateStateMachineAliasCommand = exports2.se_CreateStateMachineCommand = exports2.se_CreateActivityCommand = void 0; - exports2.de_UpdateStateMachineAliasCommand = exports2.de_UpdateStateMachineCommand = exports2.de_UpdateMapRunCommand = exports2.de_UntagResourceCommand = exports2.de_TagResourceCommand = exports2.de_StopExecutionCommand = exports2.de_StartSyncExecutionCommand = exports2.de_StartExecutionCommand = exports2.de_SendTaskSuccessCommand = exports2.de_SendTaskHeartbeatCommand = exports2.de_SendTaskFailureCommand = exports2.de_PublishStateMachineVersionCommand = exports2.de_ListTagsForResourceCommand = exports2.de_ListStateMachineVersionsCommand = exports2.de_ListStateMachinesCommand = exports2.de_ListStateMachineAliasesCommand = exports2.de_ListMapRunsCommand = exports2.de_ListExecutionsCommand = void 0; - var protocol_http_1 = require_dist_cjs2(); - var smithy_client_1 = require_dist_cjs34(); - var models_0_1 = require_models_03(); - var SFNServiceException_1 = require_SFNServiceException(); - var se_CreateActivityCommand = async (input, context) => { - const headers = sharedHeaders("CreateActivity"); - let body; - body = JSON.stringify((0, smithy_client_1._json)(input)); - return buildHttpRpcRequest(context, headers, "/", void 0, body); - }; - exports2.se_CreateActivityCommand = se_CreateActivityCommand; - var se_CreateStateMachineCommand = async (input, context) => { - const headers = sharedHeaders("CreateStateMachine"); - let body; - body = JSON.stringify((0, smithy_client_1._json)(input)); - return buildHttpRpcRequest(context, headers, "/", void 0, body); - }; - exports2.se_CreateStateMachineCommand = se_CreateStateMachineCommand; - var se_CreateStateMachineAliasCommand = async (input, context) => { - const headers = sharedHeaders("CreateStateMachineAlias"); - let body; - body = JSON.stringify((0, smithy_client_1._json)(input)); - return buildHttpRpcRequest(context, headers, "/", void 0, body); - }; - exports2.se_CreateStateMachineAliasCommand = se_CreateStateMachineAliasCommand; - var se_DeleteActivityCommand = async (input, context) => { - const headers = sharedHeaders("DeleteActivity"); - let body; - body = JSON.stringify((0, smithy_client_1._json)(input)); - return buildHttpRpcRequest(context, headers, "/", void 0, body); - }; - exports2.se_DeleteActivityCommand = se_DeleteActivityCommand; - var se_DeleteStateMachineCommand = async (input, context) => { - const headers = sharedHeaders("DeleteStateMachine"); - let body; - body = JSON.stringify((0, smithy_client_1._json)(input)); - return buildHttpRpcRequest(context, headers, "/", void 0, body); - }; - exports2.se_DeleteStateMachineCommand = se_DeleteStateMachineCommand; - var se_DeleteStateMachineAliasCommand = async (input, context) => { - const headers = sharedHeaders("DeleteStateMachineAlias"); - let body; - body = JSON.stringify((0, smithy_client_1._json)(input)); - return buildHttpRpcRequest(context, headers, "/", void 0, body); - }; - exports2.se_DeleteStateMachineAliasCommand = se_DeleteStateMachineAliasCommand; - var se_DeleteStateMachineVersionCommand = async (input, context) => { - const headers = sharedHeaders("DeleteStateMachineVersion"); - let body; - body = JSON.stringify((0, smithy_client_1._json)(input)); - return buildHttpRpcRequest(context, headers, "/", void 0, body); - }; - exports2.se_DeleteStateMachineVersionCommand = se_DeleteStateMachineVersionCommand; - var se_DescribeActivityCommand = async (input, context) => { - const headers = sharedHeaders("DescribeActivity"); - let body; - body = JSON.stringify((0, smithy_client_1._json)(input)); - return buildHttpRpcRequest(context, headers, "/", void 0, body); - }; - exports2.se_DescribeActivityCommand = se_DescribeActivityCommand; - var se_DescribeExecutionCommand = async (input, context) => { - const headers = sharedHeaders("DescribeExecution"); - let body; - body = JSON.stringify((0, smithy_client_1._json)(input)); - return buildHttpRpcRequest(context, headers, "/", void 0, body); - }; - exports2.se_DescribeExecutionCommand = se_DescribeExecutionCommand; - var se_DescribeMapRunCommand = async (input, context) => { - const headers = sharedHeaders("DescribeMapRun"); - let body; - body = JSON.stringify((0, smithy_client_1._json)(input)); - return buildHttpRpcRequest(context, headers, "/", void 0, body); - }; - exports2.se_DescribeMapRunCommand = se_DescribeMapRunCommand; - var se_DescribeStateMachineCommand = async (input, context) => { - const headers = sharedHeaders("DescribeStateMachine"); - let body; - body = JSON.stringify((0, smithy_client_1._json)(input)); - return buildHttpRpcRequest(context, headers, "/", void 0, body); - }; - exports2.se_DescribeStateMachineCommand = se_DescribeStateMachineCommand; - var se_DescribeStateMachineAliasCommand = async (input, context) => { - const headers = sharedHeaders("DescribeStateMachineAlias"); - let body; - body = JSON.stringify((0, smithy_client_1._json)(input)); - return buildHttpRpcRequest(context, headers, "/", void 0, body); - }; - exports2.se_DescribeStateMachineAliasCommand = se_DescribeStateMachineAliasCommand; - var se_DescribeStateMachineForExecutionCommand = async (input, context) => { - const headers = sharedHeaders("DescribeStateMachineForExecution"); - let body; - body = JSON.stringify((0, smithy_client_1._json)(input)); - return buildHttpRpcRequest(context, headers, "/", void 0, body); - }; - exports2.se_DescribeStateMachineForExecutionCommand = se_DescribeStateMachineForExecutionCommand; - var se_GetActivityTaskCommand = async (input, context) => { - const headers = sharedHeaders("GetActivityTask"); - let body; - body = JSON.stringify((0, smithy_client_1._json)(input)); - return buildHttpRpcRequest(context, headers, "/", void 0, body); - }; - exports2.se_GetActivityTaskCommand = se_GetActivityTaskCommand; - var se_GetExecutionHistoryCommand = async (input, context) => { - const headers = sharedHeaders("GetExecutionHistory"); - let body; - body = JSON.stringify((0, smithy_client_1._json)(input)); - return buildHttpRpcRequest(context, headers, "/", void 0, body); - }; - exports2.se_GetExecutionHistoryCommand = se_GetExecutionHistoryCommand; - var se_ListActivitiesCommand = async (input, context) => { - const headers = sharedHeaders("ListActivities"); - let body; - body = JSON.stringify((0, smithy_client_1._json)(input)); - return buildHttpRpcRequest(context, headers, "/", void 0, body); - }; - exports2.se_ListActivitiesCommand = se_ListActivitiesCommand; - var se_ListExecutionsCommand = async (input, context) => { - const headers = sharedHeaders("ListExecutions"); - let body; - body = JSON.stringify((0, smithy_client_1._json)(input)); - return buildHttpRpcRequest(context, headers, "/", void 0, body); - }; - exports2.se_ListExecutionsCommand = se_ListExecutionsCommand; - var se_ListMapRunsCommand = async (input, context) => { - const headers = sharedHeaders("ListMapRuns"); - let body; - body = JSON.stringify((0, smithy_client_1._json)(input)); - return buildHttpRpcRequest(context, headers, "/", void 0, body); - }; - exports2.se_ListMapRunsCommand = se_ListMapRunsCommand; - var se_ListStateMachineAliasesCommand = async (input, context) => { - const headers = sharedHeaders("ListStateMachineAliases"); - let body; - body = JSON.stringify((0, smithy_client_1._json)(input)); - return buildHttpRpcRequest(context, headers, "/", void 0, body); - }; - exports2.se_ListStateMachineAliasesCommand = se_ListStateMachineAliasesCommand; - var se_ListStateMachinesCommand = async (input, context) => { - const headers = sharedHeaders("ListStateMachines"); - let body; - body = JSON.stringify((0, smithy_client_1._json)(input)); - return buildHttpRpcRequest(context, headers, "/", void 0, body); - }; - exports2.se_ListStateMachinesCommand = se_ListStateMachinesCommand; - var se_ListStateMachineVersionsCommand = async (input, context) => { - const headers = sharedHeaders("ListStateMachineVersions"); - let body; - body = JSON.stringify((0, smithy_client_1._json)(input)); - return buildHttpRpcRequest(context, headers, "/", void 0, body); - }; - exports2.se_ListStateMachineVersionsCommand = se_ListStateMachineVersionsCommand; - var se_ListTagsForResourceCommand = async (input, context) => { - const headers = sharedHeaders("ListTagsForResource"); - let body; - body = JSON.stringify((0, smithy_client_1._json)(input)); - return buildHttpRpcRequest(context, headers, "/", void 0, body); - }; - exports2.se_ListTagsForResourceCommand = se_ListTagsForResourceCommand; - var se_PublishStateMachineVersionCommand = async (input, context) => { - const headers = sharedHeaders("PublishStateMachineVersion"); - let body; - body = JSON.stringify((0, smithy_client_1._json)(input)); - return buildHttpRpcRequest(context, headers, "/", void 0, body); +// ../../../node_modules/@smithy/util-defaults-mode-node/node_modules/@smithy/property-provider/dist-cjs/index.js +var require_dist_cjs63 = __commonJS({ + "../../../node_modules/@smithy/util-defaults-mode-node/node_modules/@smithy/property-provider/dist-cjs/index.js"(exports2, module2) { + var __defProp2 = Object.defineProperty; + var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; + var __getOwnPropNames2 = Object.getOwnPropertyNames; + var __hasOwnProp2 = Object.prototype.hasOwnProperty; + var __name = (target, value) => __defProp2(target, "name", { value, configurable: true }); + var __export2 = (target, all) => { + for (var name in all) + __defProp2(target, name, { get: all[name], enumerable: true }); }; - exports2.se_PublishStateMachineVersionCommand = se_PublishStateMachineVersionCommand; - var se_SendTaskFailureCommand = async (input, context) => { - const headers = sharedHeaders("SendTaskFailure"); - let body; - body = JSON.stringify((0, smithy_client_1._json)(input)); - return buildHttpRpcRequest(context, headers, "/", void 0, body); + var __copyProps2 = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames2(from)) + if (!__hasOwnProp2.call(to, key) && key !== except) + __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable }); + } + return to; }; - exports2.se_SendTaskFailureCommand = se_SendTaskFailureCommand; - var se_SendTaskHeartbeatCommand = async (input, context) => { - const headers = sharedHeaders("SendTaskHeartbeat"); - let body; - body = JSON.stringify((0, smithy_client_1._json)(input)); - return buildHttpRpcRequest(context, headers, "/", void 0, body); + var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); + var src_exports = {}; + __export2(src_exports, { + CredentialsProviderError: () => CredentialsProviderError, + ProviderError: () => ProviderError2, + TokenProviderError: () => TokenProviderError, + chain: () => chain, + fromStatic: () => fromStatic, + memoize: () => memoize + }); + module2.exports = __toCommonJS2(src_exports); + var _ProviderError = class _ProviderError2 extends Error { + constructor(message, options = true) { + var _a; + let logger; + let tryNextLink = true; + if (typeof options === "boolean") { + logger = void 0; + tryNextLink = options; + } else if (options != null && typeof options === "object") { + logger = options.logger; + tryNextLink = options.tryNextLink ?? true; + } + super(message); + this.name = "ProviderError"; + this.tryNextLink = tryNextLink; + Object.setPrototypeOf(this, _ProviderError2.prototype); + (_a = logger == null ? void 0 : logger.debug) == null ? void 0 : _a.call(logger, `@smithy/property-provider ${tryNextLink ? "->" : "(!)"} ${message}`); + } + /** + * @deprecated use new operator. + */ + static from(error, options = true) { + return Object.assign(new this(error.message, options), error); + } }; - exports2.se_SendTaskHeartbeatCommand = se_SendTaskHeartbeatCommand; - var se_SendTaskSuccessCommand = async (input, context) => { - const headers = sharedHeaders("SendTaskSuccess"); - let body; - body = JSON.stringify((0, smithy_client_1._json)(input)); - return buildHttpRpcRequest(context, headers, "/", void 0, body); + __name(_ProviderError, "ProviderError"); + var ProviderError2 = _ProviderError; + var _CredentialsProviderError = class _CredentialsProviderError2 extends ProviderError2 { + /** + * @override + */ + constructor(message, options = true) { + super(message, options); + this.name = "CredentialsProviderError"; + Object.setPrototypeOf(this, _CredentialsProviderError2.prototype); + } }; - exports2.se_SendTaskSuccessCommand = se_SendTaskSuccessCommand; - var se_StartExecutionCommand = async (input, context) => { - const headers = sharedHeaders("StartExecution"); - let body; - body = JSON.stringify((0, smithy_client_1._json)(input)); - return buildHttpRpcRequest(context, headers, "/", void 0, body); + __name(_CredentialsProviderError, "CredentialsProviderError"); + var CredentialsProviderError = _CredentialsProviderError; + var _TokenProviderError = class _TokenProviderError2 extends ProviderError2 { + /** + * @override + */ + constructor(message, options = true) { + super(message, options); + this.name = "TokenProviderError"; + Object.setPrototypeOf(this, _TokenProviderError2.prototype); + } }; - exports2.se_StartExecutionCommand = se_StartExecutionCommand; - var se_StartSyncExecutionCommand = async (input, context) => { - const headers = sharedHeaders("StartSyncExecution"); - let body; - body = JSON.stringify((0, smithy_client_1._json)(input)); - let { hostname: resolvedHostname } = await context.endpoint(); - if (context.disableHostPrefix !== true) { - resolvedHostname = "sync-" + resolvedHostname; - if (!(0, protocol_http_1.isValidHostname)(resolvedHostname)) { - throw new Error("ValidationError: prefixed hostname must be hostname compatible."); + __name(_TokenProviderError, "TokenProviderError"); + var TokenProviderError = _TokenProviderError; + var chain = /* @__PURE__ */ __name((...providers) => async () => { + if (providers.length === 0) { + throw new ProviderError2("No providers in chain"); + } + let lastProviderError; + for (const provider of providers) { + try { + const credentials = await provider(); + return credentials; + } catch (err) { + lastProviderError = err; + if (err == null ? void 0 : err.tryNextLink) { + continue; + } + throw err; + } + } + throw lastProviderError; + }, "chain"); + var fromStatic = /* @__PURE__ */ __name((staticValue) => () => Promise.resolve(staticValue), "fromStatic"); + var memoize = /* @__PURE__ */ __name((provider, isExpired, requiresRefresh) => { + let resolved; + let pending; + let hasResult; + let isConstant = false; + const coalesceProvider = /* @__PURE__ */ __name(async () => { + if (!pending) { + pending = provider(); + } + try { + resolved = await pending; + hasResult = true; + isConstant = false; + } finally { + pending = void 0; + } + return resolved; + }, "coalesceProvider"); + if (isExpired === void 0) { + return async (options) => { + if (!hasResult || (options == null ? void 0 : options.forceRefresh)) { + resolved = await coalesceProvider(); + } + return resolved; + }; + } + return async (options) => { + if (!hasResult || (options == null ? void 0 : options.forceRefresh)) { + resolved = await coalesceProvider(); + } + if (isConstant) { + return resolved; } + if (requiresRefresh && !requiresRefresh(resolved)) { + isConstant = true; + return resolved; + } + if (isExpired(resolved)) { + await coalesceProvider(); + return resolved; + } + return resolved; + }; + }, "memoize"); + } +}); + +// ../../../node_modules/@smithy/util-defaults-mode-node/node_modules/@smithy/shared-ini-file-loader/dist-cjs/getHomeDir.js +var require_getHomeDir3 = __commonJS({ + "../../../node_modules/@smithy/util-defaults-mode-node/node_modules/@smithy/shared-ini-file-loader/dist-cjs/getHomeDir.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.getHomeDir = void 0; + var os_1 = require("os"); + var path_1 = require("path"); + var homeDirCache = {}; + var getHomeDirCacheKey = () => { + if (process && process.geteuid) { + return `${process.geteuid()}`; } - return buildHttpRpcRequest(context, headers, "/", resolvedHostname, body); + return "DEFAULT"; }; - exports2.se_StartSyncExecutionCommand = se_StartSyncExecutionCommand; - var se_StopExecutionCommand = async (input, context) => { - const headers = sharedHeaders("StopExecution"); - let body; - body = JSON.stringify((0, smithy_client_1._json)(input)); - return buildHttpRpcRequest(context, headers, "/", void 0, body); + var getHomeDir2 = () => { + const { HOME, USERPROFILE, HOMEPATH, HOMEDRIVE = `C:${path_1.sep}` } = process.env; + if (HOME) + return HOME; + if (USERPROFILE) + return USERPROFILE; + if (HOMEPATH) + return `${HOMEDRIVE}${HOMEPATH}`; + const homeDirCacheKey = getHomeDirCacheKey(); + if (!homeDirCache[homeDirCacheKey]) + homeDirCache[homeDirCacheKey] = (0, os_1.homedir)(); + return homeDirCache[homeDirCacheKey]; }; - exports2.se_StopExecutionCommand = se_StopExecutionCommand; - var se_TagResourceCommand = async (input, context) => { - const headers = sharedHeaders("TagResource"); - let body; - body = JSON.stringify((0, smithy_client_1._json)(input)); - return buildHttpRpcRequest(context, headers, "/", void 0, body); + exports2.getHomeDir = getHomeDir2; + } +}); + +// ../../../node_modules/@smithy/util-defaults-mode-node/node_modules/@smithy/shared-ini-file-loader/dist-cjs/getSSOTokenFilepath.js +var require_getSSOTokenFilepath3 = __commonJS({ + "../../../node_modules/@smithy/util-defaults-mode-node/node_modules/@smithy/shared-ini-file-loader/dist-cjs/getSSOTokenFilepath.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.getSSOTokenFilepath = void 0; + var crypto_1 = require("crypto"); + var path_1 = require("path"); + var getHomeDir_1 = require_getHomeDir3(); + var getSSOTokenFilepath2 = (id) => { + const hasher = (0, crypto_1.createHash)("sha1"); + const cacheName = hasher.update(id).digest("hex"); + return (0, path_1.join)((0, getHomeDir_1.getHomeDir)(), ".aws", "sso", "cache", `${cacheName}.json`); }; - exports2.se_TagResourceCommand = se_TagResourceCommand; - var se_UntagResourceCommand = async (input, context) => { - const headers = sharedHeaders("UntagResource"); - let body; - body = JSON.stringify((0, smithy_client_1._json)(input)); - return buildHttpRpcRequest(context, headers, "/", void 0, body); + exports2.getSSOTokenFilepath = getSSOTokenFilepath2; + } +}); + +// ../../../node_modules/@smithy/util-defaults-mode-node/node_modules/@smithy/shared-ini-file-loader/dist-cjs/getSSOTokenFromFile.js +var require_getSSOTokenFromFile3 = __commonJS({ + "../../../node_modules/@smithy/util-defaults-mode-node/node_modules/@smithy/shared-ini-file-loader/dist-cjs/getSSOTokenFromFile.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.getSSOTokenFromFile = void 0; + var fs_1 = require("fs"); + var getSSOTokenFilepath_1 = require_getSSOTokenFilepath3(); + var { readFile } = fs_1.promises; + var getSSOTokenFromFile2 = async (id) => { + const ssoTokenFilepath = (0, getSSOTokenFilepath_1.getSSOTokenFilepath)(id); + const ssoTokenText = await readFile(ssoTokenFilepath, "utf8"); + return JSON.parse(ssoTokenText); }; - exports2.se_UntagResourceCommand = se_UntagResourceCommand; - var se_UpdateMapRunCommand = async (input, context) => { - const headers = sharedHeaders("UpdateMapRun"); - let body; - body = JSON.stringify(se_UpdateMapRunInput(input, context)); - return buildHttpRpcRequest(context, headers, "/", void 0, body); + exports2.getSSOTokenFromFile = getSSOTokenFromFile2; + } +}); + +// ../../../node_modules/@smithy/util-defaults-mode-node/node_modules/@smithy/shared-ini-file-loader/dist-cjs/slurpFile.js +var require_slurpFile3 = __commonJS({ + "../../../node_modules/@smithy/util-defaults-mode-node/node_modules/@smithy/shared-ini-file-loader/dist-cjs/slurpFile.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.slurpFile = void 0; + var fs_1 = require("fs"); + var { readFile } = fs_1.promises; + var filePromisesHash = {}; + var slurpFile = (path, options) => { + if (!filePromisesHash[path] || (options === null || options === void 0 ? void 0 : options.ignoreCache)) { + filePromisesHash[path] = readFile(path, "utf8"); + } + return filePromisesHash[path]; }; - exports2.se_UpdateMapRunCommand = se_UpdateMapRunCommand; - var se_UpdateStateMachineCommand = async (input, context) => { - const headers = sharedHeaders("UpdateStateMachine"); - let body; - body = JSON.stringify((0, smithy_client_1._json)(input)); - return buildHttpRpcRequest(context, headers, "/", void 0, body); + exports2.slurpFile = slurpFile; + } +}); + +// ../../../node_modules/@smithy/util-defaults-mode-node/node_modules/@smithy/shared-ini-file-loader/dist-cjs/index.js +var require_dist_cjs64 = __commonJS({ + "../../../node_modules/@smithy/util-defaults-mode-node/node_modules/@smithy/shared-ini-file-loader/dist-cjs/index.js"(exports2, module2) { + var __defProp2 = Object.defineProperty; + var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; + var __getOwnPropNames2 = Object.getOwnPropertyNames; + var __hasOwnProp2 = Object.prototype.hasOwnProperty; + var __name = (target, value) => __defProp2(target, "name", { value, configurable: true }); + var __export2 = (target, all) => { + for (var name in all) + __defProp2(target, name, { get: all[name], enumerable: true }); }; - exports2.se_UpdateStateMachineCommand = se_UpdateStateMachineCommand; - var se_UpdateStateMachineAliasCommand = async (input, context) => { - const headers = sharedHeaders("UpdateStateMachineAlias"); - let body; - body = JSON.stringify((0, smithy_client_1._json)(input)); - return buildHttpRpcRequest(context, headers, "/", void 0, body); + var __copyProps2 = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames2(from)) + if (!__hasOwnProp2.call(to, key) && key !== except) + __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable }); + } + return to; }; - exports2.se_UpdateStateMachineAliasCommand = se_UpdateStateMachineAliasCommand; - var de_CreateActivityCommand = async (output, context) => { - if (output.statusCode >= 300) { - return de_CreateActivityCommandError(output, context); + var __reExport = (target, mod, secondTarget) => (__copyProps2(target, mod, "default"), secondTarget && __copyProps2(secondTarget, mod, "default")); + var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); + var src_exports = {}; + __export2(src_exports, { + CONFIG_PREFIX_SEPARATOR: () => CONFIG_PREFIX_SEPARATOR, + DEFAULT_PROFILE: () => DEFAULT_PROFILE, + ENV_PROFILE: () => ENV_PROFILE, + getProfileName: () => getProfileName, + loadSharedConfigFiles: () => loadSharedConfigFiles, + loadSsoSessionData: () => loadSsoSessionData, + parseKnownFiles: () => parseKnownFiles + }); + module2.exports = __toCommonJS2(src_exports); + __reExport(src_exports, require_getHomeDir3(), module2.exports); + var ENV_PROFILE = "AWS_PROFILE"; + var DEFAULT_PROFILE = "default"; + var getProfileName = /* @__PURE__ */ __name((init) => init.profile || process.env[ENV_PROFILE] || DEFAULT_PROFILE, "getProfileName"); + __reExport(src_exports, require_getSSOTokenFilepath3(), module2.exports); + __reExport(src_exports, require_getSSOTokenFromFile3(), module2.exports); + var import_types5 = require_dist_cjs(); + var getConfigData = /* @__PURE__ */ __name((data) => Object.entries(data).filter(([key]) => { + const indexOfSeparator = key.indexOf(CONFIG_PREFIX_SEPARATOR); + if (indexOfSeparator === -1) { + return false; } - const data = await parseBody(output.body, context); - let contents = {}; - contents = de_CreateActivityOutput(data, context); - const response = { - $metadata: deserializeMetadata(output), - ...contents + return Object.values(import_types5.IniSectionType).includes(key.substring(0, indexOfSeparator)); + }).reduce( + (acc, [key, value]) => { + const indexOfSeparator = key.indexOf(CONFIG_PREFIX_SEPARATOR); + const updatedKey = key.substring(0, indexOfSeparator) === import_types5.IniSectionType.PROFILE ? key.substring(indexOfSeparator + 1) : key; + acc[updatedKey] = value; + return acc; + }, + { + // Populate default profile, if present. + ...data.default && { default: data.default } + } + ), "getConfigData"); + var import_path = require("path"); + var import_getHomeDir = require_getHomeDir3(); + var ENV_CONFIG_PATH = "AWS_CONFIG_FILE"; + var getConfigFilepath = /* @__PURE__ */ __name(() => process.env[ENV_CONFIG_PATH] || (0, import_path.join)((0, import_getHomeDir.getHomeDir)(), ".aws", "config"), "getConfigFilepath"); + var import_getHomeDir2 = require_getHomeDir3(); + var ENV_CREDENTIALS_PATH = "AWS_SHARED_CREDENTIALS_FILE"; + var getCredentialsFilepath = /* @__PURE__ */ __name(() => process.env[ENV_CREDENTIALS_PATH] || (0, import_path.join)((0, import_getHomeDir2.getHomeDir)(), ".aws", "credentials"), "getCredentialsFilepath"); + var import_getHomeDir3 = require_getHomeDir3(); + var prefixKeyRegex = /^([\w-]+)\s(["'])?([\w-@\+\.%:/]+)\2$/; + var profileNameBlockList = ["__proto__", "profile __proto__"]; + var parseIni = /* @__PURE__ */ __name((iniData) => { + const map = {}; + let currentSection; + let currentSubSection; + for (const iniLine of iniData.split(/\r?\n/)) { + const trimmedLine = iniLine.split(/(^|\s)[;#]/)[0].trim(); + const isSection = trimmedLine[0] === "[" && trimmedLine[trimmedLine.length - 1] === "]"; + if (isSection) { + currentSection = void 0; + currentSubSection = void 0; + const sectionName = trimmedLine.substring(1, trimmedLine.length - 1); + const matches = prefixKeyRegex.exec(sectionName); + if (matches) { + const [, prefix, , name] = matches; + if (Object.values(import_types5.IniSectionType).includes(prefix)) { + currentSection = [prefix, name].join(CONFIG_PREFIX_SEPARATOR); + } + } else { + currentSection = sectionName; + } + if (profileNameBlockList.includes(sectionName)) { + throw new Error(`Found invalid profile name "${sectionName}"`); + } + } else if (currentSection) { + const indexOfEqualsSign = trimmedLine.indexOf("="); + if (![0, -1].includes(indexOfEqualsSign)) { + const [name, value] = [ + trimmedLine.substring(0, indexOfEqualsSign).trim(), + trimmedLine.substring(indexOfEqualsSign + 1).trim() + ]; + if (value === "") { + currentSubSection = name; + } else { + if (currentSubSection && iniLine.trimStart() === iniLine) { + currentSubSection = void 0; + } + map[currentSection] = map[currentSection] || {}; + const key = currentSubSection ? [currentSubSection, name].join(CONFIG_PREFIX_SEPARATOR) : name; + map[currentSection][key] = value; + } + } + } + } + return map; + }, "parseIni"); + var import_slurpFile = require_slurpFile3(); + var swallowError = /* @__PURE__ */ __name(() => ({}), "swallowError"); + var CONFIG_PREFIX_SEPARATOR = "."; + var loadSharedConfigFiles = /* @__PURE__ */ __name(async (init = {}) => { + const { filepath = getCredentialsFilepath(), configFilepath = getConfigFilepath() } = init; + const homeDir = (0, import_getHomeDir3.getHomeDir)(); + const relativeHomeDirPrefix = "~/"; + let resolvedFilepath = filepath; + if (filepath.startsWith(relativeHomeDirPrefix)) { + resolvedFilepath = (0, import_path.join)(homeDir, filepath.slice(2)); + } + let resolvedConfigFilepath = configFilepath; + if (configFilepath.startsWith(relativeHomeDirPrefix)) { + resolvedConfigFilepath = (0, import_path.join)(homeDir, configFilepath.slice(2)); + } + const parsedFiles = await Promise.all([ + (0, import_slurpFile.slurpFile)(resolvedConfigFilepath, { + ignoreCache: init.ignoreCache + }).then(parseIni).then(getConfigData).catch(swallowError), + (0, import_slurpFile.slurpFile)(resolvedFilepath, { + ignoreCache: init.ignoreCache + }).then(parseIni).catch(swallowError) + ]); + return { + configFile: parsedFiles[0], + credentialsFile: parsedFiles[1] }; - return response; + }, "loadSharedConfigFiles"); + var getSsoSessionData = /* @__PURE__ */ __name((data) => Object.entries(data).filter(([key]) => key.startsWith(import_types5.IniSectionType.SSO_SESSION + CONFIG_PREFIX_SEPARATOR)).reduce((acc, [key, value]) => ({ ...acc, [key.substring(key.indexOf(CONFIG_PREFIX_SEPARATOR) + 1)]: value }), {}), "getSsoSessionData"); + var import_slurpFile2 = require_slurpFile3(); + var swallowError2 = /* @__PURE__ */ __name(() => ({}), "swallowError"); + var loadSsoSessionData = /* @__PURE__ */ __name(async (init = {}) => (0, import_slurpFile2.slurpFile)(init.configFilepath ?? getConfigFilepath()).then(parseIni).then(getSsoSessionData).catch(swallowError2), "loadSsoSessionData"); + var mergeConfigFiles = /* @__PURE__ */ __name((...files) => { + const merged = {}; + for (const file of files) { + for (const [key, values] of Object.entries(file)) { + if (merged[key] !== void 0) { + Object.assign(merged[key], values); + } else { + merged[key] = values; + } + } + } + return merged; + }, "mergeConfigFiles"); + var parseKnownFiles = /* @__PURE__ */ __name(async (init) => { + const parsedFiles = await loadSharedConfigFiles(init); + return mergeConfigFiles(parsedFiles.configFile, parsedFiles.credentialsFile); + }, "parseKnownFiles"); + } +}); + +// ../../../node_modules/@smithy/util-defaults-mode-node/node_modules/@smithy/node-config-provider/dist-cjs/index.js +var require_dist_cjs65 = __commonJS({ + "../../../node_modules/@smithy/util-defaults-mode-node/node_modules/@smithy/node-config-provider/dist-cjs/index.js"(exports2, module2) { + var __defProp2 = Object.defineProperty; + var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; + var __getOwnPropNames2 = Object.getOwnPropertyNames; + var __hasOwnProp2 = Object.prototype.hasOwnProperty; + var __name = (target, value) => __defProp2(target, "name", { value, configurable: true }); + var __export2 = (target, all) => { + for (var name in all) + __defProp2(target, name, { get: all[name], enumerable: true }); }; - exports2.de_CreateActivityCommand = de_CreateActivityCommand; - var de_CreateActivityCommandError = async (output, context) => { - const parsedOutput = { - ...output, - body: await parseErrorBody(output.body, context) - }; - const errorCode = loadRestJsonErrorCode(output, parsedOutput.body); - switch (errorCode) { - case "ActivityLimitExceeded": - case "com.amazonaws.sfn#ActivityLimitExceeded": - throw await de_ActivityLimitExceededRes(parsedOutput, context); - case "InvalidName": - case "com.amazonaws.sfn#InvalidName": - throw await de_InvalidNameRes(parsedOutput, context); - case "TooManyTags": - case "com.amazonaws.sfn#TooManyTags": - throw await de_TooManyTagsRes(parsedOutput, context); - default: - const parsedBody = parsedOutput.body; - return throwDefaultError({ - output, - parsedBody, - errorCode - }); + var __copyProps2 = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames2(from)) + if (!__hasOwnProp2.call(to, key) && key !== except) + __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable }); } + return to; }; - var de_CreateStateMachineCommand = async (output, context) => { - if (output.statusCode >= 300) { - return de_CreateStateMachineCommandError(output, context); + var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); + var src_exports = {}; + __export2(src_exports, { + loadConfig: () => loadConfig + }); + module2.exports = __toCommonJS2(src_exports); + var import_property_provider2 = require_dist_cjs63(); + function getSelectorName(functionString) { + try { + const constants = new Set(Array.from(functionString.match(/([A-Z_]){3,}/g) ?? [])); + constants.delete("CONFIG"); + constants.delete("CONFIG_PREFIX_SEPARATOR"); + constants.delete("ENV"); + return [...constants].join(", "); + } catch (e) { + return functionString; } - const data = await parseBody(output.body, context); - let contents = {}; - contents = de_CreateStateMachineOutput(data, context); - const response = { - $metadata: deserializeMetadata(output), - ...contents - }; - return response; - }; - exports2.de_CreateStateMachineCommand = de_CreateStateMachineCommand; - var de_CreateStateMachineCommandError = async (output, context) => { - const parsedOutput = { - ...output, - body: await parseErrorBody(output.body, context) - }; - const errorCode = loadRestJsonErrorCode(output, parsedOutput.body); - switch (errorCode) { - case "ConflictException": - case "com.amazonaws.sfn#ConflictException": - throw await de_ConflictExceptionRes(parsedOutput, context); - case "InvalidArn": - case "com.amazonaws.sfn#InvalidArn": - throw await de_InvalidArnRes(parsedOutput, context); - case "InvalidDefinition": - case "com.amazonaws.sfn#InvalidDefinition": - throw await de_InvalidDefinitionRes(parsedOutput, context); - case "InvalidLoggingConfiguration": - case "com.amazonaws.sfn#InvalidLoggingConfiguration": - throw await de_InvalidLoggingConfigurationRes(parsedOutput, context); - case "InvalidName": - case "com.amazonaws.sfn#InvalidName": - throw await de_InvalidNameRes(parsedOutput, context); - case "InvalidTracingConfiguration": - case "com.amazonaws.sfn#InvalidTracingConfiguration": - throw await de_InvalidTracingConfigurationRes(parsedOutput, context); - case "StateMachineAlreadyExists": - case "com.amazonaws.sfn#StateMachineAlreadyExists": - throw await de_StateMachineAlreadyExistsRes(parsedOutput, context); - case "StateMachineDeleting": - case "com.amazonaws.sfn#StateMachineDeleting": - throw await de_StateMachineDeletingRes(parsedOutput, context); - case "StateMachineLimitExceeded": - case "com.amazonaws.sfn#StateMachineLimitExceeded": - throw await de_StateMachineLimitExceededRes(parsedOutput, context); - case "StateMachineTypeNotSupported": - case "com.amazonaws.sfn#StateMachineTypeNotSupported": - throw await de_StateMachineTypeNotSupportedRes(parsedOutput, context); - case "TooManyTags": - case "com.amazonaws.sfn#TooManyTags": - throw await de_TooManyTagsRes(parsedOutput, context); - case "ValidationException": - case "com.amazonaws.sfn#ValidationException": - throw await de_ValidationExceptionRes(parsedOutput, context); - default: - const parsedBody = parsedOutput.body; - return throwDefaultError({ - output, - parsedBody, - errorCode - }); + } + __name(getSelectorName, "getSelectorName"); + var fromEnv = /* @__PURE__ */ __name((envVarSelector, logger) => async () => { + try { + const config = envVarSelector(process.env); + if (config === void 0) { + throw new Error(); + } + return config; + } catch (e) { + throw new import_property_provider2.CredentialsProviderError( + e.message || `Not found in ENV: ${getSelectorName(envVarSelector.toString())}`, + { logger } + ); + } + }, "fromEnv"); + var import_shared_ini_file_loader = require_dist_cjs64(); + var fromSharedConfigFiles = /* @__PURE__ */ __name((configSelector, { preferredFile = "config", ...init } = {}) => async () => { + const profile = (0, import_shared_ini_file_loader.getProfileName)(init); + const { configFile, credentialsFile } = await (0, import_shared_ini_file_loader.loadSharedConfigFiles)(init); + const profileFromCredentials = credentialsFile[profile] || {}; + const profileFromConfig = configFile[profile] || {}; + const mergedProfile = preferredFile === "config" ? { ...profileFromCredentials, ...profileFromConfig } : { ...profileFromConfig, ...profileFromCredentials }; + try { + const cfgFile = preferredFile === "config" ? configFile : credentialsFile; + const configValue = configSelector(mergedProfile, cfgFile); + if (configValue === void 0) { + throw new Error(); + } + return configValue; + } catch (e) { + throw new import_property_provider2.CredentialsProviderError( + e.message || `Not found in config files w/ profile [${profile}]: ${getSelectorName(configSelector.toString())}`, + { logger: init.logger } + ); } + }, "fromSharedConfigFiles"); + var isFunction = /* @__PURE__ */ __name((func) => typeof func === "function", "isFunction"); + var fromStatic = /* @__PURE__ */ __name((defaultValue) => isFunction(defaultValue) ? async () => await defaultValue() : (0, import_property_provider2.fromStatic)(defaultValue), "fromStatic"); + var loadConfig = /* @__PURE__ */ __name(({ environmentVariableSelector, configFileSelector, default: defaultValue }, configuration = {}) => (0, import_property_provider2.memoize)( + (0, import_property_provider2.chain)( + fromEnv(environmentVariableSelector), + fromSharedConfigFiles(configFileSelector, configuration), + fromStatic(defaultValue) + ) + ), "loadConfig"); + } +}); + +// ../../../node_modules/@smithy/util-defaults-mode-node/node_modules/@smithy/querystring-parser/dist-cjs/index.js +var require_dist_cjs66 = __commonJS({ + "../../../node_modules/@smithy/util-defaults-mode-node/node_modules/@smithy/querystring-parser/dist-cjs/index.js"(exports2, module2) { + var __defProp2 = Object.defineProperty; + var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; + var __getOwnPropNames2 = Object.getOwnPropertyNames; + var __hasOwnProp2 = Object.prototype.hasOwnProperty; + var __name = (target, value) => __defProp2(target, "name", { value, configurable: true }); + var __export2 = (target, all) => { + for (var name in all) + __defProp2(target, name, { get: all[name], enumerable: true }); }; - var de_CreateStateMachineAliasCommand = async (output, context) => { - if (output.statusCode >= 300) { - return de_CreateStateMachineAliasCommandError(output, context); + var __copyProps2 = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames2(from)) + if (!__hasOwnProp2.call(to, key) && key !== except) + __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable }); } - const data = await parseBody(output.body, context); - let contents = {}; - contents = de_CreateStateMachineAliasOutput(data, context); - const response = { - $metadata: deserializeMetadata(output), - ...contents - }; - return response; + return to; }; - exports2.de_CreateStateMachineAliasCommand = de_CreateStateMachineAliasCommand; - var de_CreateStateMachineAliasCommandError = async (output, context) => { - const parsedOutput = { - ...output, - body: await parseErrorBody(output.body, context) - }; - const errorCode = loadRestJsonErrorCode(output, parsedOutput.body); - switch (errorCode) { - case "ConflictException": - case "com.amazonaws.sfn#ConflictException": - throw await de_ConflictExceptionRes(parsedOutput, context); - case "InvalidArn": - case "com.amazonaws.sfn#InvalidArn": - throw await de_InvalidArnRes(parsedOutput, context); - case "InvalidName": - case "com.amazonaws.sfn#InvalidName": - throw await de_InvalidNameRes(parsedOutput, context); - case "ResourceNotFound": - case "com.amazonaws.sfn#ResourceNotFound": - throw await de_ResourceNotFoundRes(parsedOutput, context); - case "ServiceQuotaExceededException": - case "com.amazonaws.sfn#ServiceQuotaExceededException": - throw await de_ServiceQuotaExceededExceptionRes(parsedOutput, context); - case "StateMachineDeleting": - case "com.amazonaws.sfn#StateMachineDeleting": - throw await de_StateMachineDeletingRes(parsedOutput, context); - case "ValidationException": - case "com.amazonaws.sfn#ValidationException": - throw await de_ValidationExceptionRes(parsedOutput, context); - default: - const parsedBody = parsedOutput.body; - return throwDefaultError({ - output, - parsedBody, - errorCode - }); + var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); + var src_exports = {}; + __export2(src_exports, { + parseQueryString: () => parseQueryString + }); + module2.exports = __toCommonJS2(src_exports); + function parseQueryString(querystring) { + const query = {}; + querystring = querystring.replace(/^\?/, ""); + if (querystring) { + for (const pair of querystring.split("&")) { + let [key, value = null] = pair.split("="); + key = decodeURIComponent(key); + if (value) { + value = decodeURIComponent(value); + } + if (!(key in query)) { + query[key] = value; + } else if (Array.isArray(query[key])) { + query[key].push(value); + } else { + query[key] = [query[key], value]; + } + } } + return query; + } + __name(parseQueryString, "parseQueryString"); + } +}); + +// ../../../node_modules/@smithy/util-defaults-mode-node/node_modules/@smithy/url-parser/dist-cjs/index.js +var require_dist_cjs67 = __commonJS({ + "../../../node_modules/@smithy/util-defaults-mode-node/node_modules/@smithy/url-parser/dist-cjs/index.js"(exports2, module2) { + var __defProp2 = Object.defineProperty; + var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; + var __getOwnPropNames2 = Object.getOwnPropertyNames; + var __hasOwnProp2 = Object.prototype.hasOwnProperty; + var __name = (target, value) => __defProp2(target, "name", { value, configurable: true }); + var __export2 = (target, all) => { + for (var name in all) + __defProp2(target, name, { get: all[name], enumerable: true }); }; - var de_DeleteActivityCommand = async (output, context) => { - if (output.statusCode >= 300) { - return de_DeleteActivityCommandError(output, context); + var __copyProps2 = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames2(from)) + if (!__hasOwnProp2.call(to, key) && key !== except) + __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable }); } - const data = await parseBody(output.body, context); - let contents = {}; - contents = (0, smithy_client_1._json)(data); - const response = { - $metadata: deserializeMetadata(output), - ...contents - }; - return response; + return to; }; - exports2.de_DeleteActivityCommand = de_DeleteActivityCommand; - var de_DeleteActivityCommandError = async (output, context) => { - const parsedOutput = { - ...output, - body: await parseErrorBody(output.body, context) - }; - const errorCode = loadRestJsonErrorCode(output, parsedOutput.body); - switch (errorCode) { - case "InvalidArn": - case "com.amazonaws.sfn#InvalidArn": - throw await de_InvalidArnRes(parsedOutput, context); - default: - const parsedBody = parsedOutput.body; - return throwDefaultError({ - output, - parsedBody, - errorCode - }); + var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); + var src_exports = {}; + __export2(src_exports, { + parseUrl: () => parseUrl + }); + module2.exports = __toCommonJS2(src_exports); + var import_querystring_parser = require_dist_cjs66(); + var parseUrl = /* @__PURE__ */ __name((url2) => { + if (typeof url2 === "string") { + return parseUrl(new URL(url2)); + } + const { hostname, pathname, port, protocol, search } = url2; + let query; + if (search) { + query = (0, import_querystring_parser.parseQueryString)(search); } + return { + hostname, + port: port ? parseInt(port) : void 0, + protocol, + path: pathname, + query + }; + }, "parseUrl"); + } +}); + +// ../../../node_modules/@smithy/util-defaults-mode-node/node_modules/@smithy/credential-provider-imds/dist-cjs/index.js +var require_dist_cjs68 = __commonJS({ + "../../../node_modules/@smithy/util-defaults-mode-node/node_modules/@smithy/credential-provider-imds/dist-cjs/index.js"(exports2, module2) { + var __defProp2 = Object.defineProperty; + var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; + var __getOwnPropNames2 = Object.getOwnPropertyNames; + var __hasOwnProp2 = Object.prototype.hasOwnProperty; + var __name = (target, value) => __defProp2(target, "name", { value, configurable: true }); + var __export2 = (target, all) => { + for (var name in all) + __defProp2(target, name, { get: all[name], enumerable: true }); }; - var de_DeleteStateMachineCommand = async (output, context) => { - if (output.statusCode >= 300) { - return de_DeleteStateMachineCommandError(output, context); + var __copyProps2 = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames2(from)) + if (!__hasOwnProp2.call(to, key) && key !== except) + __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable }); } - const data = await parseBody(output.body, context); - let contents = {}; - contents = (0, smithy_client_1._json)(data); - const response = { - $metadata: deserializeMetadata(output), - ...contents - }; - return response; + return to; }; - exports2.de_DeleteStateMachineCommand = de_DeleteStateMachineCommand; - var de_DeleteStateMachineCommandError = async (output, context) => { - const parsedOutput = { - ...output, - body: await parseErrorBody(output.body, context) - }; - const errorCode = loadRestJsonErrorCode(output, parsedOutput.body); - switch (errorCode) { - case "InvalidArn": - case "com.amazonaws.sfn#InvalidArn": - throw await de_InvalidArnRes(parsedOutput, context); - case "ValidationException": - case "com.amazonaws.sfn#ValidationException": - throw await de_ValidationExceptionRes(parsedOutput, context); - default: - const parsedBody = parsedOutput.body; - return throwDefaultError({ - output, - parsedBody, - errorCode + var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); + var src_exports = {}; + __export2(src_exports, { + DEFAULT_MAX_RETRIES: () => DEFAULT_MAX_RETRIES, + DEFAULT_TIMEOUT: () => DEFAULT_TIMEOUT, + ENV_CMDS_AUTH_TOKEN: () => ENV_CMDS_AUTH_TOKEN, + ENV_CMDS_FULL_URI: () => ENV_CMDS_FULL_URI, + ENV_CMDS_RELATIVE_URI: () => ENV_CMDS_RELATIVE_URI, + Endpoint: () => Endpoint, + fromContainerMetadata: () => fromContainerMetadata, + fromInstanceMetadata: () => fromInstanceMetadata, + getInstanceMetadataEndpoint: () => getInstanceMetadataEndpoint, + httpRequest: () => httpRequest, + providerConfigFromInit: () => providerConfigFromInit + }); + module2.exports = __toCommonJS2(src_exports); + var import_url = require("url"); + var import_property_provider2 = require_dist_cjs63(); + var import_buffer = require("buffer"); + var import_http2 = require("http"); + function httpRequest(options) { + return new Promise((resolve, reject) => { + var _a; + const req = (0, import_http2.request)({ + method: "GET", + ...options, + // Node.js http module doesn't accept hostname with square brackets + // Refs: https://github.com/nodejs/node/issues/39738 + hostname: (_a = options.hostname) == null ? void 0 : _a.replace(/^\[(.+)\]$/, "$1") + }); + req.on("error", (err) => { + reject(Object.assign(new import_property_provider2.ProviderError("Unable to connect to instance metadata service"), err)); + req.destroy(); + }); + req.on("timeout", () => { + reject(new import_property_provider2.ProviderError("TimeoutError from instance metadata service")); + req.destroy(); + }); + req.on("response", (res) => { + const { statusCode = 400 } = res; + if (statusCode < 200 || 300 <= statusCode) { + reject( + Object.assign(new import_property_provider2.ProviderError("Error response received from instance metadata service"), { statusCode }) + ); + req.destroy(); + } + const chunks = []; + res.on("data", (chunk) => { + chunks.push(chunk); }); + res.on("end", () => { + resolve(import_buffer.Buffer.concat(chunks)); + req.destroy(); + }); + }); + req.end(); + }); + } + __name(httpRequest, "httpRequest"); + var isImdsCredentials = /* @__PURE__ */ __name((arg) => Boolean(arg) && typeof arg === "object" && typeof arg.AccessKeyId === "string" && typeof arg.SecretAccessKey === "string" && typeof arg.Token === "string" && typeof arg.Expiration === "string", "isImdsCredentials"); + var fromImdsCredentials = /* @__PURE__ */ __name((creds) => ({ + accessKeyId: creds.AccessKeyId, + secretAccessKey: creds.SecretAccessKey, + sessionToken: creds.Token, + expiration: new Date(creds.Expiration), + ...creds.AccountId && { accountId: creds.AccountId } + }), "fromImdsCredentials"); + var DEFAULT_TIMEOUT = 1e3; + var DEFAULT_MAX_RETRIES = 0; + var providerConfigFromInit = /* @__PURE__ */ __name(({ + maxRetries = DEFAULT_MAX_RETRIES, + timeout = DEFAULT_TIMEOUT + }) => ({ maxRetries, timeout }), "providerConfigFromInit"); + var retry = /* @__PURE__ */ __name((toRetry, maxRetries) => { + let promise = toRetry(); + for (let i = 0; i < maxRetries; i++) { + promise = promise.catch(toRetry); } - }; - var de_DeleteStateMachineAliasCommand = async (output, context) => { - if (output.statusCode >= 300) { - return de_DeleteStateMachineAliasCommandError(output, context); - } - const data = await parseBody(output.body, context); - let contents = {}; - contents = (0, smithy_client_1._json)(data); - const response = { - $metadata: deserializeMetadata(output), - ...contents - }; - return response; - }; - exports2.de_DeleteStateMachineAliasCommand = de_DeleteStateMachineAliasCommand; - var de_DeleteStateMachineAliasCommandError = async (output, context) => { - const parsedOutput = { - ...output, - body: await parseErrorBody(output.body, context) - }; - const errorCode = loadRestJsonErrorCode(output, parsedOutput.body); - switch (errorCode) { - case "ConflictException": - case "com.amazonaws.sfn#ConflictException": - throw await de_ConflictExceptionRes(parsedOutput, context); - case "InvalidArn": - case "com.amazonaws.sfn#InvalidArn": - throw await de_InvalidArnRes(parsedOutput, context); - case "ResourceNotFound": - case "com.amazonaws.sfn#ResourceNotFound": - throw await de_ResourceNotFoundRes(parsedOutput, context); - case "ValidationException": - case "com.amazonaws.sfn#ValidationException": - throw await de_ValidationExceptionRes(parsedOutput, context); - default: - const parsedBody = parsedOutput.body; - return throwDefaultError({ - output, - parsedBody, - errorCode + return promise; + }, "retry"); + var ENV_CMDS_FULL_URI = "AWS_CONTAINER_CREDENTIALS_FULL_URI"; + var ENV_CMDS_RELATIVE_URI = "AWS_CONTAINER_CREDENTIALS_RELATIVE_URI"; + var ENV_CMDS_AUTH_TOKEN = "AWS_CONTAINER_AUTHORIZATION_TOKEN"; + var fromContainerMetadata = /* @__PURE__ */ __name((init = {}) => { + const { timeout, maxRetries } = providerConfigFromInit(init); + return () => retry(async () => { + const requestOptions = await getCmdsUri({ logger: init.logger }); + const credsResponse = JSON.parse(await requestFromEcsImds(timeout, requestOptions)); + if (!isImdsCredentials(credsResponse)) { + throw new import_property_provider2.CredentialsProviderError("Invalid response received from instance metadata service.", { + logger: init.logger }); + } + return fromImdsCredentials(credsResponse); + }, maxRetries); + }, "fromContainerMetadata"); + var requestFromEcsImds = /* @__PURE__ */ __name(async (timeout, options) => { + if (process.env[ENV_CMDS_AUTH_TOKEN]) { + options.headers = { + ...options.headers, + Authorization: process.env[ENV_CMDS_AUTH_TOKEN] + }; } + const buffer = await httpRequest({ + ...options, + timeout + }); + return buffer.toString(); + }, "requestFromEcsImds"); + var CMDS_IP = "169.254.170.2"; + var GREENGRASS_HOSTS = { + localhost: true, + "127.0.0.1": true }; - var de_DeleteStateMachineVersionCommand = async (output, context) => { - if (output.statusCode >= 300) { - return de_DeleteStateMachineVersionCommandError(output, context); - } - const data = await parseBody(output.body, context); - let contents = {}; - contents = (0, smithy_client_1._json)(data); - const response = { - $metadata: deserializeMetadata(output), - ...contents - }; - return response; + var GREENGRASS_PROTOCOLS = { + "http:": true, + "https:": true }; - exports2.de_DeleteStateMachineVersionCommand = de_DeleteStateMachineVersionCommand; - var de_DeleteStateMachineVersionCommandError = async (output, context) => { - const parsedOutput = { - ...output, - body: await parseErrorBody(output.body, context) - }; - const errorCode = loadRestJsonErrorCode(output, parsedOutput.body); - switch (errorCode) { - case "ConflictException": - case "com.amazonaws.sfn#ConflictException": - throw await de_ConflictExceptionRes(parsedOutput, context); - case "InvalidArn": - case "com.amazonaws.sfn#InvalidArn": - throw await de_InvalidArnRes(parsedOutput, context); - case "ValidationException": - case "com.amazonaws.sfn#ValidationException": - throw await de_ValidationExceptionRes(parsedOutput, context); - default: - const parsedBody = parsedOutput.body; - return throwDefaultError({ - output, - parsedBody, - errorCode + var getCmdsUri = /* @__PURE__ */ __name(async ({ logger }) => { + if (process.env[ENV_CMDS_RELATIVE_URI]) { + return { + hostname: CMDS_IP, + path: process.env[ENV_CMDS_RELATIVE_URI] + }; + } + if (process.env[ENV_CMDS_FULL_URI]) { + const parsed = (0, import_url.parse)(process.env[ENV_CMDS_FULL_URI]); + if (!parsed.hostname || !(parsed.hostname in GREENGRASS_HOSTS)) { + throw new import_property_provider2.CredentialsProviderError(`${parsed.hostname} is not a valid container metadata service hostname`, { + tryNextLink: false, + logger + }); + } + if (!parsed.protocol || !(parsed.protocol in GREENGRASS_PROTOCOLS)) { + throw new import_property_provider2.CredentialsProviderError(`${parsed.protocol} is not a valid container metadata service protocol`, { + tryNextLink: false, + logger }); + } + return { + ...parsed, + port: parsed.port ? parseInt(parsed.port, 10) : void 0 + }; + } + throw new import_property_provider2.CredentialsProviderError( + `The container metadata credential provider cannot be used unless the ${ENV_CMDS_RELATIVE_URI} or ${ENV_CMDS_FULL_URI} environment variable is set`, + { + tryNextLink: false, + logger + } + ); + }, "getCmdsUri"); + var _InstanceMetadataV1FallbackError = class _InstanceMetadataV1FallbackError2 extends import_property_provider2.CredentialsProviderError { + constructor(message, tryNextLink = true) { + super(message, tryNextLink); + this.tryNextLink = tryNextLink; + this.name = "InstanceMetadataV1FallbackError"; + Object.setPrototypeOf(this, _InstanceMetadataV1FallbackError2.prototype); } }; - var de_DescribeActivityCommand = async (output, context) => { - if (output.statusCode >= 300) { - return de_DescribeActivityCommandError(output, context); + __name(_InstanceMetadataV1FallbackError, "InstanceMetadataV1FallbackError"); + var InstanceMetadataV1FallbackError = _InstanceMetadataV1FallbackError; + var import_node_config_provider = require_dist_cjs65(); + var import_url_parser = require_dist_cjs67(); + var Endpoint = /* @__PURE__ */ ((Endpoint2) => { + Endpoint2["IPv4"] = "http://169.254.169.254"; + Endpoint2["IPv6"] = "http://[fd00:ec2::254]"; + return Endpoint2; + })(Endpoint || {}); + var ENV_ENDPOINT_NAME = "AWS_EC2_METADATA_SERVICE_ENDPOINT"; + var CONFIG_ENDPOINT_NAME = "ec2_metadata_service_endpoint"; + var ENDPOINT_CONFIG_OPTIONS = { + environmentVariableSelector: (env) => env[ENV_ENDPOINT_NAME], + configFileSelector: (profile) => profile[CONFIG_ENDPOINT_NAME], + default: void 0 + }; + var EndpointMode = /* @__PURE__ */ ((EndpointMode2) => { + EndpointMode2["IPv4"] = "IPv4"; + EndpointMode2["IPv6"] = "IPv6"; + return EndpointMode2; + })(EndpointMode || {}); + var ENV_ENDPOINT_MODE_NAME = "AWS_EC2_METADATA_SERVICE_ENDPOINT_MODE"; + var CONFIG_ENDPOINT_MODE_NAME = "ec2_metadata_service_endpoint_mode"; + var ENDPOINT_MODE_CONFIG_OPTIONS = { + environmentVariableSelector: (env) => env[ENV_ENDPOINT_MODE_NAME], + configFileSelector: (profile) => profile[CONFIG_ENDPOINT_MODE_NAME], + default: "IPv4" + /* IPv4 */ + }; + var getInstanceMetadataEndpoint = /* @__PURE__ */ __name(async () => (0, import_url_parser.parseUrl)(await getFromEndpointConfig() || await getFromEndpointModeConfig()), "getInstanceMetadataEndpoint"); + var getFromEndpointConfig = /* @__PURE__ */ __name(async () => (0, import_node_config_provider.loadConfig)(ENDPOINT_CONFIG_OPTIONS)(), "getFromEndpointConfig"); + var getFromEndpointModeConfig = /* @__PURE__ */ __name(async () => { + const endpointMode = await (0, import_node_config_provider.loadConfig)(ENDPOINT_MODE_CONFIG_OPTIONS)(); + switch (endpointMode) { + case "IPv4": + return "http://169.254.169.254"; + case "IPv6": + return "http://[fd00:ec2::254]"; + default: + throw new Error(`Unsupported endpoint mode: ${endpointMode}. Select from ${Object.values(EndpointMode)}`); } - const data = await parseBody(output.body, context); - let contents = {}; - contents = de_DescribeActivityOutput(data, context); - const response = { - $metadata: deserializeMetadata(output), - ...contents + }, "getFromEndpointModeConfig"); + var STATIC_STABILITY_REFRESH_INTERVAL_SECONDS = 5 * 60; + var STATIC_STABILITY_REFRESH_INTERVAL_JITTER_WINDOW_SECONDS = 5 * 60; + var STATIC_STABILITY_DOC_URL = "https://docs.aws.amazon.com/sdkref/latest/guide/feature-static-credentials.html"; + var getExtendedInstanceMetadataCredentials = /* @__PURE__ */ __name((credentials, logger) => { + const refreshInterval = STATIC_STABILITY_REFRESH_INTERVAL_SECONDS + Math.floor(Math.random() * STATIC_STABILITY_REFRESH_INTERVAL_JITTER_WINDOW_SECONDS); + const newExpiration = new Date(Date.now() + refreshInterval * 1e3); + logger.warn( + `Attempting credential expiration extension due to a credential service availability issue. A refresh of these credentials will be attempted after ${new Date(newExpiration)}. +For more information, please visit: ` + STATIC_STABILITY_DOC_URL + ); + const originalExpiration = credentials.originalExpiration ?? credentials.expiration; + return { + ...credentials, + ...originalExpiration ? { originalExpiration } : {}, + expiration: newExpiration }; - return response; - }; - exports2.de_DescribeActivityCommand = de_DescribeActivityCommand; - var de_DescribeActivityCommandError = async (output, context) => { - const parsedOutput = { - ...output, - body: await parseErrorBody(output.body, context) + }, "getExtendedInstanceMetadataCredentials"); + var staticStabilityProvider = /* @__PURE__ */ __name((provider, options = {}) => { + const logger = (options == null ? void 0 : options.logger) || console; + let pastCredentials; + return async () => { + let credentials; + try { + credentials = await provider(); + if (credentials.expiration && credentials.expiration.getTime() < Date.now()) { + credentials = getExtendedInstanceMetadataCredentials(credentials, logger); + } + } catch (e) { + if (pastCredentials) { + logger.warn("Credential renew failed: ", e); + credentials = getExtendedInstanceMetadataCredentials(pastCredentials, logger); + } else { + throw e; + } + } + pastCredentials = credentials; + return credentials; }; - const errorCode = loadRestJsonErrorCode(output, parsedOutput.body); - switch (errorCode) { - case "ActivityDoesNotExist": - case "com.amazonaws.sfn#ActivityDoesNotExist": - throw await de_ActivityDoesNotExistRes(parsedOutput, context); - case "InvalidArn": - case "com.amazonaws.sfn#InvalidArn": - throw await de_InvalidArnRes(parsedOutput, context); - default: - const parsedBody = parsedOutput.body; - return throwDefaultError({ - output, - parsedBody, - errorCode + }, "staticStabilityProvider"); + var IMDS_PATH = "/latest/meta-data/iam/security-credentials/"; + var IMDS_TOKEN_PATH = "/latest/api/token"; + var AWS_EC2_METADATA_V1_DISABLED = "AWS_EC2_METADATA_V1_DISABLED"; + var PROFILE_AWS_EC2_METADATA_V1_DISABLED = "ec2_metadata_v1_disabled"; + var X_AWS_EC2_METADATA_TOKEN = "x-aws-ec2-metadata-token"; + var fromInstanceMetadata = /* @__PURE__ */ __name((init = {}) => staticStabilityProvider(getInstanceMetadataProvider(init), { logger: init.logger }), "fromInstanceMetadata"); + var getInstanceMetadataProvider = /* @__PURE__ */ __name((init = {}) => { + let disableFetchToken = false; + const { logger, profile } = init; + const { timeout, maxRetries } = providerConfigFromInit(init); + const getCredentials = /* @__PURE__ */ __name(async (maxRetries2, options) => { + var _a; + const isImdsV1Fallback = disableFetchToken || ((_a = options.headers) == null ? void 0 : _a[X_AWS_EC2_METADATA_TOKEN]) == null; + if (isImdsV1Fallback) { + let fallbackBlockedFromProfile = false; + let fallbackBlockedFromProcessEnv = false; + const configValue = await (0, import_node_config_provider.loadConfig)( + { + environmentVariableSelector: (env) => { + const envValue = env[AWS_EC2_METADATA_V1_DISABLED]; + fallbackBlockedFromProcessEnv = !!envValue && envValue !== "false"; + if (envValue === void 0) { + throw new import_property_provider2.CredentialsProviderError( + `${AWS_EC2_METADATA_V1_DISABLED} not set in env, checking config file next.`, + { logger: init.logger } + ); + } + return fallbackBlockedFromProcessEnv; + }, + configFileSelector: (profile2) => { + const profileValue = profile2[PROFILE_AWS_EC2_METADATA_V1_DISABLED]; + fallbackBlockedFromProfile = !!profileValue && profileValue !== "false"; + return fallbackBlockedFromProfile; + }, + default: false + }, + { + profile + } + )(); + if (init.ec2MetadataV1Disabled || configValue) { + const causes = []; + if (init.ec2MetadataV1Disabled) + causes.push("credential provider initialization (runtime option ec2MetadataV1Disabled)"); + if (fallbackBlockedFromProfile) + causes.push(`config file profile (${PROFILE_AWS_EC2_METADATA_V1_DISABLED})`); + if (fallbackBlockedFromProcessEnv) + causes.push(`process environment variable (${AWS_EC2_METADATA_V1_DISABLED})`); + throw new InstanceMetadataV1FallbackError( + `AWS EC2 Metadata v1 fallback has been blocked by AWS SDK configuration in the following: [${causes.join( + ", " + )}].` + ); + } + } + const imdsProfile = (await retry(async () => { + let profile2; + try { + profile2 = await getProfile(options); + } catch (err) { + if (err.statusCode === 401) { + disableFetchToken = false; + } + throw err; + } + return profile2; + }, maxRetries2)).trim(); + return retry(async () => { + let creds; + try { + creds = await getCredentialsFromProfile(imdsProfile, options, init); + } catch (err) { + if (err.statusCode === 401) { + disableFetchToken = false; + } + throw err; + } + return creds; + }, maxRetries2); + }, "getCredentials"); + return async () => { + const endpoint = await getInstanceMetadataEndpoint(); + if (disableFetchToken) { + logger == null ? void 0 : logger.debug("AWS SDK Instance Metadata", "using v1 fallback (no token fetch)"); + return getCredentials(maxRetries, { ...endpoint, timeout }); + } else { + let token; + try { + token = (await getMetadataToken({ ...endpoint, timeout })).toString(); + } catch (error) { + if ((error == null ? void 0 : error.statusCode) === 400) { + throw Object.assign(error, { + message: "EC2 Metadata token request returned error" + }); + } else if (error.message === "TimeoutError" || [403, 404, 405].includes(error.statusCode)) { + disableFetchToken = true; + } + logger == null ? void 0 : logger.debug("AWS SDK Instance Metadata", "using v1 fallback (initial)"); + return getCredentials(maxRetries, { ...endpoint, timeout }); + } + return getCredentials(maxRetries, { + ...endpoint, + headers: { + [X_AWS_EC2_METADATA_TOKEN]: token + }, + timeout }); + } + }; + }, "getInstanceMetadataProvider"); + var getMetadataToken = /* @__PURE__ */ __name(async (options) => httpRequest({ + ...options, + path: IMDS_TOKEN_PATH, + method: "PUT", + headers: { + "x-aws-ec2-metadata-token-ttl-seconds": "21600" + } + }), "getMetadataToken"); + var getProfile = /* @__PURE__ */ __name(async (options) => (await httpRequest({ ...options, path: IMDS_PATH })).toString(), "getProfile"); + var getCredentialsFromProfile = /* @__PURE__ */ __name(async (profile, options, init) => { + const credentialsResponse = JSON.parse( + (await httpRequest({ + ...options, + path: IMDS_PATH + profile + })).toString() + ); + if (!isImdsCredentials(credentialsResponse)) { + throw new import_property_provider2.CredentialsProviderError("Invalid response received from instance metadata service.", { + logger: init.logger + }); } + return fromImdsCredentials(credentialsResponse); + }, "getCredentialsFromProfile"); + } +}); + +// ../../../node_modules/@smithy/util-defaults-mode-node/dist-cjs/index.js +var require_dist_cjs69 = __commonJS({ + "../../../node_modules/@smithy/util-defaults-mode-node/dist-cjs/index.js"(exports2, module2) { + var __create2 = Object.create; + var __defProp2 = Object.defineProperty; + var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; + var __getOwnPropNames2 = Object.getOwnPropertyNames; + var __getProtoOf2 = Object.getPrototypeOf; + var __hasOwnProp2 = Object.prototype.hasOwnProperty; + var __name = (target, value) => __defProp2(target, "name", { value, configurable: true }); + var __export2 = (target, all) => { + for (var name in all) + __defProp2(target, name, { get: all[name], enumerable: true }); }; - var de_DescribeExecutionCommand = async (output, context) => { - if (output.statusCode >= 300) { - return de_DescribeExecutionCommandError(output, context); + var __copyProps2 = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames2(from)) + if (!__hasOwnProp2.call(to, key) && key !== except) + __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable }); } - const data = await parseBody(output.body, context); - let contents = {}; - contents = de_DescribeExecutionOutput(data, context); - const response = { - $metadata: deserializeMetadata(output), - ...contents - }; - return response; + return to; }; - exports2.de_DescribeExecutionCommand = de_DescribeExecutionCommand; - var de_DescribeExecutionCommandError = async (output, context) => { - const parsedOutput = { - ...output, - body: await parseErrorBody(output.body, context) - }; - const errorCode = loadRestJsonErrorCode(output, parsedOutput.body); - switch (errorCode) { - case "ExecutionDoesNotExist": - case "com.amazonaws.sfn#ExecutionDoesNotExist": - throw await de_ExecutionDoesNotExistRes(parsedOutput, context); - case "InvalidArn": - case "com.amazonaws.sfn#InvalidArn": - throw await de_InvalidArnRes(parsedOutput, context); + var __toESM2 = (mod, isNodeMode, target) => (target = mod != null ? __create2(__getProtoOf2(mod)) : {}, __copyProps2( + // If the importer is in node compatibility mode or this is not an ESM + // file that has been converted to a CommonJS file using a Babel- + // compatible transform (i.e. "__esModule" has not been set), then set + // "default" to the CommonJS "module.exports" for node compatibility. + isNodeMode || !mod || !mod.__esModule ? __defProp2(target, "default", { value: mod, enumerable: true }) : target, + mod + )); + var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); + var src_exports = {}; + __export2(src_exports, { + resolveDefaultsModeConfig: () => resolveDefaultsModeConfig + }); + module2.exports = __toCommonJS2(src_exports); + var import_config_resolver = require_dist_cjs62(); + var import_node_config_provider = require_dist_cjs65(); + var import_property_provider2 = require_dist_cjs63(); + var AWS_EXECUTION_ENV = "AWS_EXECUTION_ENV"; + var AWS_REGION_ENV = "AWS_REGION"; + var AWS_DEFAULT_REGION_ENV = "AWS_DEFAULT_REGION"; + var ENV_IMDS_DISABLED = "AWS_EC2_METADATA_DISABLED"; + var DEFAULTS_MODE_OPTIONS = ["in-region", "cross-region", "mobile", "standard", "legacy"]; + var IMDS_REGION_PATH = "/latest/meta-data/placement/region"; + var AWS_DEFAULTS_MODE_ENV = "AWS_DEFAULTS_MODE"; + var AWS_DEFAULTS_MODE_CONFIG = "defaults_mode"; + var NODE_DEFAULTS_MODE_CONFIG_OPTIONS = { + environmentVariableSelector: (env) => { + return env[AWS_DEFAULTS_MODE_ENV]; + }, + configFileSelector: (profile) => { + return profile[AWS_DEFAULTS_MODE_CONFIG]; + }, + default: "legacy" + }; + var resolveDefaultsModeConfig = /* @__PURE__ */ __name(({ + region = (0, import_node_config_provider.loadConfig)(import_config_resolver.NODE_REGION_CONFIG_OPTIONS), + defaultsMode = (0, import_node_config_provider.loadConfig)(NODE_DEFAULTS_MODE_CONFIG_OPTIONS) + } = {}) => (0, import_property_provider2.memoize)(async () => { + const mode = typeof defaultsMode === "function" ? await defaultsMode() : defaultsMode; + switch (mode == null ? void 0 : mode.toLowerCase()) { + case "auto": + return resolveNodeDefaultsModeAuto(region); + case "in-region": + case "cross-region": + case "mobile": + case "standard": + case "legacy": + return Promise.resolve(mode == null ? void 0 : mode.toLocaleLowerCase()); + case void 0: + return Promise.resolve("legacy"); default: - const parsedBody = parsedOutput.body; - return throwDefaultError({ - output, - parsedBody, - errorCode - }); + throw new Error( + `Invalid parameter for "defaultsMode", expect ${DEFAULTS_MODE_OPTIONS.join(", ")}, got ${mode}` + ); } - }; - var de_DescribeMapRunCommand = async (output, context) => { - if (output.statusCode >= 300) { - return de_DescribeMapRunCommandError(output, context); + }), "resolveDefaultsModeConfig"); + var resolveNodeDefaultsModeAuto = /* @__PURE__ */ __name(async (clientRegion) => { + if (clientRegion) { + const resolvedRegion = typeof clientRegion === "function" ? await clientRegion() : clientRegion; + const inferredRegion = await inferPhysicalRegion(); + if (!inferredRegion) { + return "standard"; + } + if (resolvedRegion === inferredRegion) { + return "in-region"; + } else { + return "cross-region"; + } } - const data = await parseBody(output.body, context); - let contents = {}; - contents = de_DescribeMapRunOutput(data, context); - const response = { - $metadata: deserializeMetadata(output), - ...contents - }; - return response; - }; - exports2.de_DescribeMapRunCommand = de_DescribeMapRunCommand; - var de_DescribeMapRunCommandError = async (output, context) => { - const parsedOutput = { - ...output, - body: await parseErrorBody(output.body, context) - }; - const errorCode = loadRestJsonErrorCode(output, parsedOutput.body); - switch (errorCode) { - case "InvalidArn": - case "com.amazonaws.sfn#InvalidArn": - throw await de_InvalidArnRes(parsedOutput, context); - case "ResourceNotFound": - case "com.amazonaws.sfn#ResourceNotFound": - throw await de_ResourceNotFoundRes(parsedOutput, context); - default: - const parsedBody = parsedOutput.body; - return throwDefaultError({ - output, - parsedBody, - errorCode - }); + return "standard"; + }, "resolveNodeDefaultsModeAuto"); + var inferPhysicalRegion = /* @__PURE__ */ __name(async () => { + if (process.env[AWS_EXECUTION_ENV] && (process.env[AWS_REGION_ENV] || process.env[AWS_DEFAULT_REGION_ENV])) { + return process.env[AWS_REGION_ENV] ?? process.env[AWS_DEFAULT_REGION_ENV]; } - }; - var de_DescribeStateMachineCommand = async (output, context) => { - if (output.statusCode >= 300) { - return de_DescribeStateMachineCommandError(output, context); + if (!process.env[ENV_IMDS_DISABLED]) { + try { + const { getInstanceMetadataEndpoint, httpRequest } = await Promise.resolve().then(() => __toESM2(require_dist_cjs68())); + const endpoint = await getInstanceMetadataEndpoint(); + return (await httpRequest({ ...endpoint, path: IMDS_REGION_PATH })).toString(); + } catch (e) { + } } - const data = await parseBody(output.body, context); - let contents = {}; - contents = de_DescribeStateMachineOutput(data, context); - const response = { - $metadata: deserializeMetadata(output), - ...contents + }, "inferPhysicalRegion"); + } +}); + +// ../../../node_modules/@aws-sdk/client-sso/dist-cjs/runtimeConfig.js +var require_runtimeConfig = __commonJS({ + "../../../node_modules/@aws-sdk/client-sso/dist-cjs/runtimeConfig.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.getRuntimeConfig = void 0; + var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports)); + var package_json_1 = tslib_1.__importDefault(require_package2()); + var core_1 = (init_dist_es2(), __toCommonJS(dist_es_exports2)); + var util_user_agent_node_1 = require_dist_cjs56(); + var config_resolver_1 = require_dist_cjs11(); + var hash_node_1 = require_dist_cjs57(); + var middleware_retry_1 = require_dist_cjs38(); + var node_config_provider_1 = require_dist_cjs42(); + var node_http_handler_1 = require_dist_cjs51(); + var util_body_length_node_1 = require_dist_cjs58(); + var util_retry_1 = require_dist_cjs60(); + var runtimeConfig_shared_1 = require_runtimeConfig_shared(); + var smithy_client_1 = require_dist_cjs37(); + var util_defaults_mode_node_1 = require_dist_cjs69(); + var smithy_client_2 = require_dist_cjs37(); + var getRuntimeConfig = (config) => { + (0, smithy_client_2.emitWarningIfUnsupportedVersion)(process.version); + const defaultsMode = (0, util_defaults_mode_node_1.resolveDefaultsModeConfig)(config); + const defaultConfigProvider = () => defaultsMode().then(smithy_client_1.loadConfigsForDefaultMode); + const clientSharedValues = (0, runtimeConfig_shared_1.getRuntimeConfig)(config); + (0, core_1.emitWarningIfUnsupportedVersion)(process.version); + return { + ...clientSharedValues, + ...config, + runtime: "node", + defaultsMode, + bodyLengthChecker: config?.bodyLengthChecker ?? util_body_length_node_1.calculateBodyLength, + defaultUserAgentProvider: config?.defaultUserAgentProvider ?? (0, util_user_agent_node_1.defaultUserAgent)({ serviceId: clientSharedValues.serviceId, clientVersion: package_json_1.default.version }), + maxAttempts: config?.maxAttempts ?? (0, node_config_provider_1.loadConfig)(middleware_retry_1.NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config?.region ?? (0, node_config_provider_1.loadConfig)(config_resolver_1.NODE_REGION_CONFIG_OPTIONS, config_resolver_1.NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: node_http_handler_1.NodeHttpHandler.create(config?.requestHandler ?? defaultConfigProvider), + retryMode: config?.retryMode ?? (0, node_config_provider_1.loadConfig)({ + ...middleware_retry_1.NODE_RETRY_MODE_CONFIG_OPTIONS, + default: async () => (await defaultConfigProvider()).retryMode || util_retry_1.DEFAULT_RETRY_MODE + }), + sha256: config?.sha256 ?? hash_node_1.Hash.bind(null, "sha256"), + streamCollector: config?.streamCollector ?? node_http_handler_1.streamCollector, + useDualstackEndpoint: config?.useDualstackEndpoint ?? (0, node_config_provider_1.loadConfig)(config_resolver_1.NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS), + useFipsEndpoint: config?.useFipsEndpoint ?? (0, node_config_provider_1.loadConfig)(config_resolver_1.NODE_USE_FIPS_ENDPOINT_CONFIG_OPTIONS) }; - return response; }; - exports2.de_DescribeStateMachineCommand = de_DescribeStateMachineCommand; - var de_DescribeStateMachineCommandError = async (output, context) => { - const parsedOutput = { - ...output, - body: await parseErrorBody(output.body, context) - }; - const errorCode = loadRestJsonErrorCode(output, parsedOutput.body); - switch (errorCode) { - case "InvalidArn": - case "com.amazonaws.sfn#InvalidArn": - throw await de_InvalidArnRes(parsedOutput, context); - case "StateMachineDoesNotExist": - case "com.amazonaws.sfn#StateMachineDoesNotExist": - throw await de_StateMachineDoesNotExistRes(parsedOutput, context); - default: - const parsedBody = parsedOutput.body; - return throwDefaultError({ - output, - parsedBody, - errorCode - }); - } + exports2.getRuntimeConfig = getRuntimeConfig; + } +}); + +// ../../../node_modules/@aws-sdk/region-config-resolver/dist-cjs/index.js +var require_dist_cjs70 = __commonJS({ + "../../../node_modules/@aws-sdk/region-config-resolver/dist-cjs/index.js"(exports2, module2) { + "use strict"; + var __defProp2 = Object.defineProperty; + var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; + var __getOwnPropNames2 = Object.getOwnPropertyNames; + var __hasOwnProp2 = Object.prototype.hasOwnProperty; + var __name = (target, value) => __defProp2(target, "name", { value, configurable: true }); + var __export2 = (target, all) => { + for (var name in all) + __defProp2(target, name, { get: all[name], enumerable: true }); }; - var de_DescribeStateMachineAliasCommand = async (output, context) => { - if (output.statusCode >= 300) { - return de_DescribeStateMachineAliasCommandError(output, context); + var __copyProps2 = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames2(from)) + if (!__hasOwnProp2.call(to, key) && key !== except) + __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable }); } - const data = await parseBody(output.body, context); - let contents = {}; - contents = de_DescribeStateMachineAliasOutput(data, context); - const response = { - $metadata: deserializeMetadata(output), - ...contents - }; - return response; + return to; }; - exports2.de_DescribeStateMachineAliasCommand = de_DescribeStateMachineAliasCommand; - var de_DescribeStateMachineAliasCommandError = async (output, context) => { - const parsedOutput = { - ...output, - body: await parseErrorBody(output.body, context) + var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); + var src_exports = {}; + __export2(src_exports, { + NODE_REGION_CONFIG_FILE_OPTIONS: () => NODE_REGION_CONFIG_FILE_OPTIONS, + NODE_REGION_CONFIG_OPTIONS: () => NODE_REGION_CONFIG_OPTIONS, + REGION_ENV_NAME: () => REGION_ENV_NAME, + REGION_INI_NAME: () => REGION_INI_NAME, + getAwsRegionExtensionConfiguration: () => getAwsRegionExtensionConfiguration, + resolveAwsRegionExtensionConfiguration: () => resolveAwsRegionExtensionConfiguration, + resolveRegionConfig: () => resolveRegionConfig + }); + module2.exports = __toCommonJS2(src_exports); + var getAwsRegionExtensionConfiguration = /* @__PURE__ */ __name((runtimeConfig) => { + let runtimeConfigRegion = /* @__PURE__ */ __name(async () => { + if (runtimeConfig.region === void 0) { + throw new Error("Region is missing from runtimeConfig"); + } + const region = runtimeConfig.region; + if (typeof region === "string") { + return region; + } + return region(); + }, "runtimeConfigRegion"); + return { + setRegion(region) { + runtimeConfigRegion = region; + }, + region() { + return runtimeConfigRegion; + } }; - const errorCode = loadRestJsonErrorCode(output, parsedOutput.body); - switch (errorCode) { - case "InvalidArn": - case "com.amazonaws.sfn#InvalidArn": - throw await de_InvalidArnRes(parsedOutput, context); - case "ResourceNotFound": - case "com.amazonaws.sfn#ResourceNotFound": - throw await de_ResourceNotFoundRes(parsedOutput, context); - case "ValidationException": - case "com.amazonaws.sfn#ValidationException": - throw await de_ValidationExceptionRes(parsedOutput, context); - default: - const parsedBody = parsedOutput.body; - return throwDefaultError({ - output, - parsedBody, - errorCode - }); + }, "getAwsRegionExtensionConfiguration"); + var resolveAwsRegionExtensionConfiguration = /* @__PURE__ */ __name((awsRegionExtensionConfiguration) => { + return { + region: awsRegionExtensionConfiguration.region() + }; + }, "resolveAwsRegionExtensionConfiguration"); + var REGION_ENV_NAME = "AWS_REGION"; + var REGION_INI_NAME = "region"; + var NODE_REGION_CONFIG_OPTIONS = { + environmentVariableSelector: (env) => env[REGION_ENV_NAME], + configFileSelector: (profile) => profile[REGION_INI_NAME], + default: () => { + throw new Error("Region is missing"); } }; - var de_DescribeStateMachineForExecutionCommand = async (output, context) => { - if (output.statusCode >= 300) { - return de_DescribeStateMachineForExecutionCommandError(output, context); + var NODE_REGION_CONFIG_FILE_OPTIONS = { + preferredFile: "credentials" + }; + var isFipsRegion = /* @__PURE__ */ __name((region) => typeof region === "string" && (region.startsWith("fips-") || region.endsWith("-fips")), "isFipsRegion"); + var getRealRegion = /* @__PURE__ */ __name((region) => isFipsRegion(region) ? ["fips-aws-global", "aws-fips"].includes(region) ? "us-east-1" : region.replace(/fips-(dkr-|prod-)?|-fips/, "") : region, "getRealRegion"); + var resolveRegionConfig = /* @__PURE__ */ __name((input) => { + const { region, useFipsEndpoint } = input; + if (!region) { + throw new Error("Region is missing"); } - const data = await parseBody(output.body, context); - let contents = {}; - contents = de_DescribeStateMachineForExecutionOutput(data, context); - const response = { - $metadata: deserializeMetadata(output), - ...contents + return { + ...input, + region: async () => { + if (typeof region === "string") { + return getRealRegion(region); + } + const providedRegion = await region(); + return getRealRegion(providedRegion); + }, + useFipsEndpoint: async () => { + const providedRegion = typeof region === "string" ? region : await region(); + if (isFipsRegion(providedRegion)) { + return true; + } + return typeof useFipsEndpoint !== "function" ? Promise.resolve(!!useFipsEndpoint) : useFipsEndpoint(); + } }; - return response; + }, "resolveRegionConfig"); + } +}); + +// ../../../node_modules/@aws-sdk/client-sso/dist-cjs/index.js +var require_dist_cjs71 = __commonJS({ + "../../../node_modules/@aws-sdk/client-sso/dist-cjs/index.js"(exports2, module2) { + "use strict"; + var __defProp2 = Object.defineProperty; + var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; + var __getOwnPropNames2 = Object.getOwnPropertyNames; + var __hasOwnProp2 = Object.prototype.hasOwnProperty; + var __name = (target, value) => __defProp2(target, "name", { value, configurable: true }); + var __export2 = (target, all) => { + for (var name in all) + __defProp2(target, name, { get: all[name], enumerable: true }); }; - exports2.de_DescribeStateMachineForExecutionCommand = de_DescribeStateMachineForExecutionCommand; - var de_DescribeStateMachineForExecutionCommandError = async (output, context) => { - const parsedOutput = { - ...output, - body: await parseErrorBody(output.body, context) - }; - const errorCode = loadRestJsonErrorCode(output, parsedOutput.body); - switch (errorCode) { - case "ExecutionDoesNotExist": - case "com.amazonaws.sfn#ExecutionDoesNotExist": - throw await de_ExecutionDoesNotExistRes(parsedOutput, context); - case "InvalidArn": - case "com.amazonaws.sfn#InvalidArn": - throw await de_InvalidArnRes(parsedOutput, context); - default: - const parsedBody = parsedOutput.body; - return throwDefaultError({ - output, - parsedBody, - errorCode - }); + var __copyProps2 = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames2(from)) + if (!__hasOwnProp2.call(to, key) && key !== except) + __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable }); } + return to; }; - var de_GetActivityTaskCommand = async (output, context) => { - if (output.statusCode >= 300) { - return de_GetActivityTaskCommandError(output, context); - } - const data = await parseBody(output.body, context); - let contents = {}; - contents = (0, smithy_client_1._json)(data); - const response = { - $metadata: deserializeMetadata(output), - ...contents + var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); + var src_exports = {}; + __export2(src_exports, { + GetRoleCredentialsCommand: () => GetRoleCredentialsCommand, + GetRoleCredentialsRequestFilterSensitiveLog: () => GetRoleCredentialsRequestFilterSensitiveLog, + GetRoleCredentialsResponseFilterSensitiveLog: () => GetRoleCredentialsResponseFilterSensitiveLog, + InvalidRequestException: () => InvalidRequestException, + ListAccountRolesCommand: () => ListAccountRolesCommand, + ListAccountRolesRequestFilterSensitiveLog: () => ListAccountRolesRequestFilterSensitiveLog, + ListAccountsCommand: () => ListAccountsCommand, + ListAccountsRequestFilterSensitiveLog: () => ListAccountsRequestFilterSensitiveLog, + LogoutCommand: () => LogoutCommand, + LogoutRequestFilterSensitiveLog: () => LogoutRequestFilterSensitiveLog, + ResourceNotFoundException: () => ResourceNotFoundException, + RoleCredentialsFilterSensitiveLog: () => RoleCredentialsFilterSensitiveLog, + SSO: () => SSO, + SSOClient: () => SSOClient, + SSOServiceException: () => SSOServiceException, + TooManyRequestsException: () => TooManyRequestsException, + UnauthorizedException: () => UnauthorizedException, + __Client: () => import_smithy_client5.Client, + paginateListAccountRoles: () => paginateListAccountRoles, + paginateListAccounts: () => paginateListAccounts + }); + module2.exports = __toCommonJS2(src_exports); + var import_middleware_host_header = require_dist_cjs3(); + var import_middleware_logger = require_dist_cjs4(); + var import_middleware_recursion_detection = require_dist_cjs5(); + var import_middleware_user_agent = require_dist_cjs8(); + var import_config_resolver = require_dist_cjs11(); + var import_core3 = (init_dist_es(), __toCommonJS(dist_es_exports)); + var import_middleware_content_length = require_dist_cjs39(); + var import_middleware_endpoint2 = require_dist_cjs46(); + var import_middleware_retry2 = require_dist_cjs38(); + var import_httpAuthSchemeProvider = require_httpAuthSchemeProvider2(); + var resolveClientEndpointParameters = /* @__PURE__ */ __name((options) => { + return { + ...options, + useDualstackEndpoint: options.useDualstackEndpoint ?? false, + useFipsEndpoint: options.useFipsEndpoint ?? false, + defaultSigningName: "awsssoportal" }; - return response; - }; - exports2.de_GetActivityTaskCommand = de_GetActivityTaskCommand; - var de_GetActivityTaskCommandError = async (output, context) => { - const parsedOutput = { - ...output, - body: await parseErrorBody(output.body, context) + }, "resolveClientEndpointParameters"); + var commonParams = { + UseFIPS: { type: "builtInParams", name: "useFipsEndpoint" }, + Endpoint: { type: "builtInParams", name: "endpoint" }, + Region: { type: "builtInParams", name: "region" }, + UseDualStack: { type: "builtInParams", name: "useDualstackEndpoint" } + }; + var import_runtimeConfig = require_runtimeConfig(); + var import_region_config_resolver = require_dist_cjs70(); + var import_protocol_http8 = require_dist_cjs2(); + var import_smithy_client5 = require_dist_cjs37(); + var getHttpAuthExtensionConfiguration = /* @__PURE__ */ __name((runtimeConfig) => { + const _httpAuthSchemes = runtimeConfig.httpAuthSchemes; + let _httpAuthSchemeProvider = runtimeConfig.httpAuthSchemeProvider; + let _credentials = runtimeConfig.credentials; + return { + setHttpAuthScheme(httpAuthScheme) { + const index = _httpAuthSchemes.findIndex((scheme) => scheme.schemeId === httpAuthScheme.schemeId); + if (index === -1) { + _httpAuthSchemes.push(httpAuthScheme); + } else { + _httpAuthSchemes.splice(index, 1, httpAuthScheme); + } + }, + httpAuthSchemes() { + return _httpAuthSchemes; + }, + setHttpAuthSchemeProvider(httpAuthSchemeProvider) { + _httpAuthSchemeProvider = httpAuthSchemeProvider; + }, + httpAuthSchemeProvider() { + return _httpAuthSchemeProvider; + }, + setCredentials(credentials) { + _credentials = credentials; + }, + credentials() { + return _credentials; + } }; - const errorCode = loadRestJsonErrorCode(output, parsedOutput.body); - switch (errorCode) { - case "ActivityDoesNotExist": - case "com.amazonaws.sfn#ActivityDoesNotExist": - throw await de_ActivityDoesNotExistRes(parsedOutput, context); - case "ActivityWorkerLimitExceeded": - case "com.amazonaws.sfn#ActivityWorkerLimitExceeded": - throw await de_ActivityWorkerLimitExceededRes(parsedOutput, context); - case "InvalidArn": - case "com.amazonaws.sfn#InvalidArn": - throw await de_InvalidArnRes(parsedOutput, context); - default: - const parsedBody = parsedOutput.body; - return throwDefaultError({ - output, - parsedBody, - errorCode - }); + }, "getHttpAuthExtensionConfiguration"); + var resolveHttpAuthRuntimeConfig = /* @__PURE__ */ __name((config) => { + return { + httpAuthSchemes: config.httpAuthSchemes(), + httpAuthSchemeProvider: config.httpAuthSchemeProvider(), + credentials: config.credentials() + }; + }, "resolveHttpAuthRuntimeConfig"); + var asPartial = /* @__PURE__ */ __name((t) => t, "asPartial"); + var resolveRuntimeExtensions = /* @__PURE__ */ __name((runtimeConfig, extensions) => { + const extensionConfiguration = { + ...asPartial((0, import_region_config_resolver.getAwsRegionExtensionConfiguration)(runtimeConfig)), + ...asPartial((0, import_smithy_client5.getDefaultExtensionConfiguration)(runtimeConfig)), + ...asPartial((0, import_protocol_http8.getHttpHandlerExtensionConfiguration)(runtimeConfig)), + ...asPartial(getHttpAuthExtensionConfiguration(runtimeConfig)) + }; + extensions.forEach((extension) => extension.configure(extensionConfiguration)); + return { + ...runtimeConfig, + ...(0, import_region_config_resolver.resolveAwsRegionExtensionConfiguration)(extensionConfiguration), + ...(0, import_smithy_client5.resolveDefaultRuntimeConfig)(extensionConfiguration), + ...(0, import_protocol_http8.resolveHttpHandlerRuntimeConfig)(extensionConfiguration), + ...resolveHttpAuthRuntimeConfig(extensionConfiguration) + }; + }, "resolveRuntimeExtensions"); + var _SSOClient = class _SSOClient extends import_smithy_client5.Client { + constructor(...[configuration]) { + const _config_0 = (0, import_runtimeConfig.getRuntimeConfig)(configuration || {}); + const _config_1 = resolveClientEndpointParameters(_config_0); + const _config_2 = (0, import_middleware_user_agent.resolveUserAgentConfig)(_config_1); + const _config_3 = (0, import_middleware_retry2.resolveRetryConfig)(_config_2); + const _config_4 = (0, import_config_resolver.resolveRegionConfig)(_config_3); + const _config_5 = (0, import_middleware_host_header.resolveHostHeaderConfig)(_config_4); + const _config_6 = (0, import_middleware_endpoint2.resolveEndpointConfig)(_config_5); + const _config_7 = (0, import_httpAuthSchemeProvider.resolveHttpAuthSchemeConfig)(_config_6); + const _config_8 = resolveRuntimeExtensions(_config_7, (configuration == null ? void 0 : configuration.extensions) || []); + super(_config_8); + this.config = _config_8; + this.middlewareStack.use((0, import_middleware_user_agent.getUserAgentPlugin)(this.config)); + this.middlewareStack.use((0, import_middleware_retry2.getRetryPlugin)(this.config)); + this.middlewareStack.use((0, import_middleware_content_length.getContentLengthPlugin)(this.config)); + this.middlewareStack.use((0, import_middleware_host_header.getHostHeaderPlugin)(this.config)); + this.middlewareStack.use((0, import_middleware_logger.getLoggerPlugin)(this.config)); + this.middlewareStack.use((0, import_middleware_recursion_detection.getRecursionDetectionPlugin)(this.config)); + this.middlewareStack.use( + (0, import_core3.getHttpAuthSchemeEndpointRuleSetPlugin)(this.config, { + httpAuthSchemeParametersProvider: import_httpAuthSchemeProvider.defaultSSOHttpAuthSchemeParametersProvider, + identityProviderConfigProvider: async (config) => new import_core3.DefaultIdentityProviderConfig({ + "aws.auth#sigv4": config.credentials + }) + }) + ); + this.middlewareStack.use((0, import_core3.getHttpSigningPlugin)(this.config)); + } + /** + * Destroy underlying resources, like sockets. It's usually not necessary to do this. + * However in Node.js, it's best to explicitly shut down the client's agent when it is no longer needed. + * Otherwise, sockets might stay open for quite a long time before the server terminates them. + */ + destroy() { + super.destroy(); } }; - var de_GetExecutionHistoryCommand = async (output, context) => { - if (output.statusCode >= 300) { - return de_GetExecutionHistoryCommandError(output, context); + __name(_SSOClient, "SSOClient"); + var SSOClient = _SSOClient; + var import_middleware_serde2 = require_dist_cjs45(); + var _SSOServiceException = class _SSOServiceException2 extends import_smithy_client5.ServiceException { + /** + * @internal + */ + constructor(options) { + super(options); + Object.setPrototypeOf(this, _SSOServiceException2.prototype); } - const data = await parseBody(output.body, context); - let contents = {}; - contents = de_GetExecutionHistoryOutput(data, context); - const response = { - $metadata: deserializeMetadata(output), - ...contents - }; - return response; }; - exports2.de_GetExecutionHistoryCommand = de_GetExecutionHistoryCommand; - var de_GetExecutionHistoryCommandError = async (output, context) => { - const parsedOutput = { - ...output, - body: await parseErrorBody(output.body, context) - }; - const errorCode = loadRestJsonErrorCode(output, parsedOutput.body); - switch (errorCode) { - case "ExecutionDoesNotExist": - case "com.amazonaws.sfn#ExecutionDoesNotExist": - throw await de_ExecutionDoesNotExistRes(parsedOutput, context); - case "InvalidArn": - case "com.amazonaws.sfn#InvalidArn": - throw await de_InvalidArnRes(parsedOutput, context); - case "InvalidToken": - case "com.amazonaws.sfn#InvalidToken": - throw await de_InvalidTokenRes(parsedOutput, context); - default: - const parsedBody = parsedOutput.body; - return throwDefaultError({ - output, - parsedBody, - errorCode - }); + __name(_SSOServiceException, "SSOServiceException"); + var SSOServiceException = _SSOServiceException; + var _InvalidRequestException = class _InvalidRequestException2 extends SSOServiceException { + /** + * @internal + */ + constructor(opts) { + super({ + name: "InvalidRequestException", + $fault: "client", + ...opts + }); + this.name = "InvalidRequestException"; + this.$fault = "client"; + Object.setPrototypeOf(this, _InvalidRequestException2.prototype); } }; - var de_ListActivitiesCommand = async (output, context) => { - if (output.statusCode >= 300) { - return de_ListActivitiesCommandError(output, context); + __name(_InvalidRequestException, "InvalidRequestException"); + var InvalidRequestException = _InvalidRequestException; + var _ResourceNotFoundException = class _ResourceNotFoundException2 extends SSOServiceException { + /** + * @internal + */ + constructor(opts) { + super({ + name: "ResourceNotFoundException", + $fault: "client", + ...opts + }); + this.name = "ResourceNotFoundException"; + this.$fault = "client"; + Object.setPrototypeOf(this, _ResourceNotFoundException2.prototype); } - const data = await parseBody(output.body, context); - let contents = {}; - contents = de_ListActivitiesOutput(data, context); - const response = { - $metadata: deserializeMetadata(output), - ...contents - }; - return response; }; - exports2.de_ListActivitiesCommand = de_ListActivitiesCommand; - var de_ListActivitiesCommandError = async (output, context) => { - const parsedOutput = { - ...output, - body: await parseErrorBody(output.body, context) - }; - const errorCode = loadRestJsonErrorCode(output, parsedOutput.body); - switch (errorCode) { - case "InvalidToken": - case "com.amazonaws.sfn#InvalidToken": - throw await de_InvalidTokenRes(parsedOutput, context); - default: - const parsedBody = parsedOutput.body; - return throwDefaultError({ - output, - parsedBody, - errorCode - }); + __name(_ResourceNotFoundException, "ResourceNotFoundException"); + var ResourceNotFoundException = _ResourceNotFoundException; + var _TooManyRequestsException = class _TooManyRequestsException2 extends SSOServiceException { + /** + * @internal + */ + constructor(opts) { + super({ + name: "TooManyRequestsException", + $fault: "client", + ...opts + }); + this.name = "TooManyRequestsException"; + this.$fault = "client"; + Object.setPrototypeOf(this, _TooManyRequestsException2.prototype); } }; - var de_ListExecutionsCommand = async (output, context) => { - if (output.statusCode >= 300) { - return de_ListExecutionsCommandError(output, context); + __name(_TooManyRequestsException, "TooManyRequestsException"); + var TooManyRequestsException = _TooManyRequestsException; + var _UnauthorizedException = class _UnauthorizedException2 extends SSOServiceException { + /** + * @internal + */ + constructor(opts) { + super({ + name: "UnauthorizedException", + $fault: "client", + ...opts + }); + this.name = "UnauthorizedException"; + this.$fault = "client"; + Object.setPrototypeOf(this, _UnauthorizedException2.prototype); } - const data = await parseBody(output.body, context); - let contents = {}; - contents = de_ListExecutionsOutput(data, context); - const response = { - $metadata: deserializeMetadata(output), - ...contents - }; - return response; }; - exports2.de_ListExecutionsCommand = de_ListExecutionsCommand; - var de_ListExecutionsCommandError = async (output, context) => { - const parsedOutput = { - ...output, - body: await parseErrorBody(output.body, context) - }; - const errorCode = loadRestJsonErrorCode(output, parsedOutput.body); - switch (errorCode) { - case "InvalidArn": - case "com.amazonaws.sfn#InvalidArn": - throw await de_InvalidArnRes(parsedOutput, context); - case "InvalidToken": - case "com.amazonaws.sfn#InvalidToken": - throw await de_InvalidTokenRes(parsedOutput, context); - case "ResourceNotFound": - case "com.amazonaws.sfn#ResourceNotFound": - throw await de_ResourceNotFoundRes(parsedOutput, context); - case "StateMachineDoesNotExist": - case "com.amazonaws.sfn#StateMachineDoesNotExist": - throw await de_StateMachineDoesNotExistRes(parsedOutput, context); - case "StateMachineTypeNotSupported": - case "com.amazonaws.sfn#StateMachineTypeNotSupported": - throw await de_StateMachineTypeNotSupportedRes(parsedOutput, context); - case "ValidationException": - case "com.amazonaws.sfn#ValidationException": - throw await de_ValidationExceptionRes(parsedOutput, context); - default: - const parsedBody = parsedOutput.body; - return throwDefaultError({ - output, - parsedBody, - errorCode - }); + __name(_UnauthorizedException, "UnauthorizedException"); + var UnauthorizedException = _UnauthorizedException; + var GetRoleCredentialsRequestFilterSensitiveLog = /* @__PURE__ */ __name((obj) => ({ + ...obj, + ...obj.accessToken && { accessToken: import_smithy_client5.SENSITIVE_STRING } + }), "GetRoleCredentialsRequestFilterSensitiveLog"); + var RoleCredentialsFilterSensitiveLog = /* @__PURE__ */ __name((obj) => ({ + ...obj, + ...obj.secretAccessKey && { secretAccessKey: import_smithy_client5.SENSITIVE_STRING }, + ...obj.sessionToken && { sessionToken: import_smithy_client5.SENSITIVE_STRING } + }), "RoleCredentialsFilterSensitiveLog"); + var GetRoleCredentialsResponseFilterSensitiveLog = /* @__PURE__ */ __name((obj) => ({ + ...obj, + ...obj.roleCredentials && { roleCredentials: RoleCredentialsFilterSensitiveLog(obj.roleCredentials) } + }), "GetRoleCredentialsResponseFilterSensitiveLog"); + var ListAccountRolesRequestFilterSensitiveLog = /* @__PURE__ */ __name((obj) => ({ + ...obj, + ...obj.accessToken && { accessToken: import_smithy_client5.SENSITIVE_STRING } + }), "ListAccountRolesRequestFilterSensitiveLog"); + var ListAccountsRequestFilterSensitiveLog = /* @__PURE__ */ __name((obj) => ({ + ...obj, + ...obj.accessToken && { accessToken: import_smithy_client5.SENSITIVE_STRING } + }), "ListAccountsRequestFilterSensitiveLog"); + var LogoutRequestFilterSensitiveLog = /* @__PURE__ */ __name((obj) => ({ + ...obj, + ...obj.accessToken && { accessToken: import_smithy_client5.SENSITIVE_STRING } + }), "LogoutRequestFilterSensitiveLog"); + var import_core22 = (init_dist_es2(), __toCommonJS(dist_es_exports2)); + var se_GetRoleCredentialsCommand = /* @__PURE__ */ __name(async (input, context) => { + const b = (0, import_core3.requestBuilder)(input, context); + const headers = (0, import_smithy_client5.map)({}, isSerializableHeaderValue, { + [_xasbt]: input[_aT] + }); + b.bp("/federation/credentials"); + const query = (0, import_smithy_client5.map)({ + [_rn]: [, (0, import_smithy_client5.expectNonNull)(input[_rN], `roleName`)], + [_ai]: [, (0, import_smithy_client5.expectNonNull)(input[_aI], `accountId`)] + }); + let body; + b.m("GET").h(headers).q(query).b(body); + return b.build(); + }, "se_GetRoleCredentialsCommand"); + var se_ListAccountRolesCommand = /* @__PURE__ */ __name(async (input, context) => { + const b = (0, import_core3.requestBuilder)(input, context); + const headers = (0, import_smithy_client5.map)({}, isSerializableHeaderValue, { + [_xasbt]: input[_aT] + }); + b.bp("/assignment/roles"); + const query = (0, import_smithy_client5.map)({ + [_nt]: [, input[_nT]], + [_mr]: [() => input.maxResults !== void 0, () => input[_mR].toString()], + [_ai]: [, (0, import_smithy_client5.expectNonNull)(input[_aI], `accountId`)] + }); + let body; + b.m("GET").h(headers).q(query).b(body); + return b.build(); + }, "se_ListAccountRolesCommand"); + var se_ListAccountsCommand = /* @__PURE__ */ __name(async (input, context) => { + const b = (0, import_core3.requestBuilder)(input, context); + const headers = (0, import_smithy_client5.map)({}, isSerializableHeaderValue, { + [_xasbt]: input[_aT] + }); + b.bp("/assignment/accounts"); + const query = (0, import_smithy_client5.map)({ + [_nt]: [, input[_nT]], + [_mr]: [() => input.maxResults !== void 0, () => input[_mR].toString()] + }); + let body; + b.m("GET").h(headers).q(query).b(body); + return b.build(); + }, "se_ListAccountsCommand"); + var se_LogoutCommand = /* @__PURE__ */ __name(async (input, context) => { + const b = (0, import_core3.requestBuilder)(input, context); + const headers = (0, import_smithy_client5.map)({}, isSerializableHeaderValue, { + [_xasbt]: input[_aT] + }); + b.bp("/logout"); + let body; + b.m("POST").h(headers).b(body); + return b.build(); + }, "se_LogoutCommand"); + var de_GetRoleCredentialsCommand = /* @__PURE__ */ __name(async (output, context) => { + if (output.statusCode !== 200 && output.statusCode >= 300) { + return de_CommandError(output, context); + } + const contents = (0, import_smithy_client5.map)({ + $metadata: deserializeMetadata(output) + }); + const data = (0, import_smithy_client5.expectNonNull)((0, import_smithy_client5.expectObject)(await (0, import_core22.parseJsonBody)(output.body, context)), "body"); + const doc = (0, import_smithy_client5.take)(data, { + roleCredentials: import_smithy_client5._json + }); + Object.assign(contents, doc); + return contents; + }, "de_GetRoleCredentialsCommand"); + var de_ListAccountRolesCommand = /* @__PURE__ */ __name(async (output, context) => { + if (output.statusCode !== 200 && output.statusCode >= 300) { + return de_CommandError(output, context); + } + const contents = (0, import_smithy_client5.map)({ + $metadata: deserializeMetadata(output) + }); + const data = (0, import_smithy_client5.expectNonNull)((0, import_smithy_client5.expectObject)(await (0, import_core22.parseJsonBody)(output.body, context)), "body"); + const doc = (0, import_smithy_client5.take)(data, { + nextToken: import_smithy_client5.expectString, + roleList: import_smithy_client5._json + }); + Object.assign(contents, doc); + return contents; + }, "de_ListAccountRolesCommand"); + var de_ListAccountsCommand = /* @__PURE__ */ __name(async (output, context) => { + if (output.statusCode !== 200 && output.statusCode >= 300) { + return de_CommandError(output, context); } - }; - var de_ListMapRunsCommand = async (output, context) => { - if (output.statusCode >= 300) { - return de_ListMapRunsCommandError(output, context); + const contents = (0, import_smithy_client5.map)({ + $metadata: deserializeMetadata(output) + }); + const data = (0, import_smithy_client5.expectNonNull)((0, import_smithy_client5.expectObject)(await (0, import_core22.parseJsonBody)(output.body, context)), "body"); + const doc = (0, import_smithy_client5.take)(data, { + accountList: import_smithy_client5._json, + nextToken: import_smithy_client5.expectString + }); + Object.assign(contents, doc); + return contents; + }, "de_ListAccountsCommand"); + var de_LogoutCommand = /* @__PURE__ */ __name(async (output, context) => { + if (output.statusCode !== 200 && output.statusCode >= 300) { + return de_CommandError(output, context); } - const data = await parseBody(output.body, context); - let contents = {}; - contents = de_ListMapRunsOutput(data, context); - const response = { - $metadata: deserializeMetadata(output), - ...contents - }; - return response; - }; - exports2.de_ListMapRunsCommand = de_ListMapRunsCommand; - var de_ListMapRunsCommandError = async (output, context) => { + const contents = (0, import_smithy_client5.map)({ + $metadata: deserializeMetadata(output) + }); + await (0, import_smithy_client5.collectBody)(output.body, context); + return contents; + }, "de_LogoutCommand"); + var de_CommandError = /* @__PURE__ */ __name(async (output, context) => { const parsedOutput = { ...output, - body: await parseErrorBody(output.body, context) + body: await (0, import_core22.parseJsonErrorBody)(output.body, context) }; - const errorCode = loadRestJsonErrorCode(output, parsedOutput.body); + const errorCode = (0, import_core22.loadRestJsonErrorCode)(output, parsedOutput.body); switch (errorCode) { - case "ExecutionDoesNotExist": - case "com.amazonaws.sfn#ExecutionDoesNotExist": - throw await de_ExecutionDoesNotExistRes(parsedOutput, context); - case "InvalidArn": - case "com.amazonaws.sfn#InvalidArn": - throw await de_InvalidArnRes(parsedOutput, context); - case "InvalidToken": - case "com.amazonaws.sfn#InvalidToken": - throw await de_InvalidTokenRes(parsedOutput, context); + case "InvalidRequestException": + case "com.amazonaws.sso#InvalidRequestException": + throw await de_InvalidRequestExceptionRes(parsedOutput, context); + case "ResourceNotFoundException": + case "com.amazonaws.sso#ResourceNotFoundException": + throw await de_ResourceNotFoundExceptionRes(parsedOutput, context); + case "TooManyRequestsException": + case "com.amazonaws.sso#TooManyRequestsException": + throw await de_TooManyRequestsExceptionRes(parsedOutput, context); + case "UnauthorizedException": + case "com.amazonaws.sso#UnauthorizedException": + throw await de_UnauthorizedExceptionRes(parsedOutput, context); default: const parsedBody = parsedOutput.body; return throwDefaultError({ @@ -19012,676 +18644,1172 @@ var require_Aws_json1_0 = __commonJS({ errorCode }); } - }; - var de_ListStateMachineAliasesCommand = async (output, context) => { - if (output.statusCode >= 300) { - return de_ListStateMachineAliasesCommandError(output, context); - } - const data = await parseBody(output.body, context); - let contents = {}; - contents = de_ListStateMachineAliasesOutput(data, context); - const response = { - $metadata: deserializeMetadata(output), + }, "de_CommandError"); + var throwDefaultError = (0, import_smithy_client5.withBaseException)(SSOServiceException); + var de_InvalidRequestExceptionRes = /* @__PURE__ */ __name(async (parsedOutput, context) => { + const contents = (0, import_smithy_client5.map)({}); + const data = parsedOutput.body; + const doc = (0, import_smithy_client5.take)(data, { + message: import_smithy_client5.expectString + }); + Object.assign(contents, doc); + const exception = new InvalidRequestException({ + $metadata: deserializeMetadata(parsedOutput), ...contents - }; - return response; + }); + return (0, import_smithy_client5.decorateServiceException)(exception, parsedOutput.body); + }, "de_InvalidRequestExceptionRes"); + var de_ResourceNotFoundExceptionRes = /* @__PURE__ */ __name(async (parsedOutput, context) => { + const contents = (0, import_smithy_client5.map)({}); + const data = parsedOutput.body; + const doc = (0, import_smithy_client5.take)(data, { + message: import_smithy_client5.expectString + }); + Object.assign(contents, doc); + const exception = new ResourceNotFoundException({ + $metadata: deserializeMetadata(parsedOutput), + ...contents + }); + return (0, import_smithy_client5.decorateServiceException)(exception, parsedOutput.body); + }, "de_ResourceNotFoundExceptionRes"); + var de_TooManyRequestsExceptionRes = /* @__PURE__ */ __name(async (parsedOutput, context) => { + const contents = (0, import_smithy_client5.map)({}); + const data = parsedOutput.body; + const doc = (0, import_smithy_client5.take)(data, { + message: import_smithy_client5.expectString + }); + Object.assign(contents, doc); + const exception = new TooManyRequestsException({ + $metadata: deserializeMetadata(parsedOutput), + ...contents + }); + return (0, import_smithy_client5.decorateServiceException)(exception, parsedOutput.body); + }, "de_TooManyRequestsExceptionRes"); + var de_UnauthorizedExceptionRes = /* @__PURE__ */ __name(async (parsedOutput, context) => { + const contents = (0, import_smithy_client5.map)({}); + const data = parsedOutput.body; + const doc = (0, import_smithy_client5.take)(data, { + message: import_smithy_client5.expectString + }); + Object.assign(contents, doc); + const exception = new UnauthorizedException({ + $metadata: deserializeMetadata(parsedOutput), + ...contents + }); + return (0, import_smithy_client5.decorateServiceException)(exception, parsedOutput.body); + }, "de_UnauthorizedExceptionRes"); + var deserializeMetadata = /* @__PURE__ */ __name((output) => ({ + httpStatusCode: output.statusCode, + requestId: output.headers["x-amzn-requestid"] ?? output.headers["x-amzn-request-id"] ?? output.headers["x-amz-request-id"], + extendedRequestId: output.headers["x-amz-id-2"], + cfId: output.headers["x-amz-cf-id"] + }), "deserializeMetadata"); + var isSerializableHeaderValue = /* @__PURE__ */ __name((value) => value !== void 0 && value !== null && value !== "" && (!Object.getOwnPropertyNames(value).includes("length") || value.length != 0) && (!Object.getOwnPropertyNames(value).includes("size") || value.size != 0), "isSerializableHeaderValue"); + var _aI = "accountId"; + var _aT = "accessToken"; + var _ai = "account_id"; + var _mR = "maxResults"; + var _mr = "max_result"; + var _nT = "nextToken"; + var _nt = "next_token"; + var _rN = "roleName"; + var _rn = "role_name"; + var _xasbt = "x-amz-sso_bearer_token"; + var _GetRoleCredentialsCommand = class _GetRoleCredentialsCommand extends import_smithy_client5.Command.classBuilder().ep({ + ...commonParams + }).m(function(Command, cs, config, o) { + return [ + (0, import_middleware_serde2.getSerdePlugin)(config, this.serialize, this.deserialize), + (0, import_middleware_endpoint2.getEndpointPlugin)(config, Command.getEndpointParameterInstructions()) + ]; + }).s("SWBPortalService", "GetRoleCredentials", {}).n("SSOClient", "GetRoleCredentialsCommand").f(GetRoleCredentialsRequestFilterSensitiveLog, GetRoleCredentialsResponseFilterSensitiveLog).ser(se_GetRoleCredentialsCommand).de(de_GetRoleCredentialsCommand).build() { + }; + __name(_GetRoleCredentialsCommand, "GetRoleCredentialsCommand"); + var GetRoleCredentialsCommand = _GetRoleCredentialsCommand; + var _ListAccountRolesCommand = class _ListAccountRolesCommand extends import_smithy_client5.Command.classBuilder().ep({ + ...commonParams + }).m(function(Command, cs, config, o) { + return [ + (0, import_middleware_serde2.getSerdePlugin)(config, this.serialize, this.deserialize), + (0, import_middleware_endpoint2.getEndpointPlugin)(config, Command.getEndpointParameterInstructions()) + ]; + }).s("SWBPortalService", "ListAccountRoles", {}).n("SSOClient", "ListAccountRolesCommand").f(ListAccountRolesRequestFilterSensitiveLog, void 0).ser(se_ListAccountRolesCommand).de(de_ListAccountRolesCommand).build() { + }; + __name(_ListAccountRolesCommand, "ListAccountRolesCommand"); + var ListAccountRolesCommand = _ListAccountRolesCommand; + var _ListAccountsCommand = class _ListAccountsCommand extends import_smithy_client5.Command.classBuilder().ep({ + ...commonParams + }).m(function(Command, cs, config, o) { + return [ + (0, import_middleware_serde2.getSerdePlugin)(config, this.serialize, this.deserialize), + (0, import_middleware_endpoint2.getEndpointPlugin)(config, Command.getEndpointParameterInstructions()) + ]; + }).s("SWBPortalService", "ListAccounts", {}).n("SSOClient", "ListAccountsCommand").f(ListAccountsRequestFilterSensitiveLog, void 0).ser(se_ListAccountsCommand).de(de_ListAccountsCommand).build() { + }; + __name(_ListAccountsCommand, "ListAccountsCommand"); + var ListAccountsCommand = _ListAccountsCommand; + var _LogoutCommand = class _LogoutCommand extends import_smithy_client5.Command.classBuilder().ep({ + ...commonParams + }).m(function(Command, cs, config, o) { + return [ + (0, import_middleware_serde2.getSerdePlugin)(config, this.serialize, this.deserialize), + (0, import_middleware_endpoint2.getEndpointPlugin)(config, Command.getEndpointParameterInstructions()) + ]; + }).s("SWBPortalService", "Logout", {}).n("SSOClient", "LogoutCommand").f(LogoutRequestFilterSensitiveLog, void 0).ser(se_LogoutCommand).de(de_LogoutCommand).build() { }; - exports2.de_ListStateMachineAliasesCommand = de_ListStateMachineAliasesCommand; - var de_ListStateMachineAliasesCommandError = async (output, context) => { - const parsedOutput = { - ...output, - body: await parseErrorBody(output.body, context) - }; - const errorCode = loadRestJsonErrorCode(output, parsedOutput.body); - switch (errorCode) { - case "InvalidArn": - case "com.amazonaws.sfn#InvalidArn": - throw await de_InvalidArnRes(parsedOutput, context); - case "InvalidToken": - case "com.amazonaws.sfn#InvalidToken": - throw await de_InvalidTokenRes(parsedOutput, context); - case "ResourceNotFound": - case "com.amazonaws.sfn#ResourceNotFound": - throw await de_ResourceNotFoundRes(parsedOutput, context); - case "StateMachineDeleting": - case "com.amazonaws.sfn#StateMachineDeleting": - throw await de_StateMachineDeletingRes(parsedOutput, context); - case "StateMachineDoesNotExist": - case "com.amazonaws.sfn#StateMachineDoesNotExist": - throw await de_StateMachineDoesNotExistRes(parsedOutput, context); - default: - const parsedBody = parsedOutput.body; - return throwDefaultError({ - output, - parsedBody, - errorCode - }); - } + __name(_LogoutCommand, "LogoutCommand"); + var LogoutCommand = _LogoutCommand; + var commands = { + GetRoleCredentialsCommand, + ListAccountRolesCommand, + ListAccountsCommand, + LogoutCommand }; - var de_ListStateMachinesCommand = async (output, context) => { - if (output.statusCode >= 300) { - return de_ListStateMachinesCommandError(output, context); - } - const data = await parseBody(output.body, context); - let contents = {}; - contents = de_ListStateMachinesOutput(data, context); - const response = { - $metadata: deserializeMetadata(output), - ...contents + var _SSO = class _SSO extends SSOClient { + }; + __name(_SSO, "SSO"); + var SSO = _SSO; + (0, import_smithy_client5.createAggregatedClient)(commands, SSO); + var paginateListAccountRoles = (0, import_core3.createPaginator)(SSOClient, ListAccountRolesCommand, "nextToken", "nextToken", "maxResults"); + var paginateListAccounts = (0, import_core3.createPaginator)(SSOClient, ListAccountsCommand, "nextToken", "nextToken", "maxResults"); + } +}); + +// ../../../node_modules/@aws-sdk/client-sso-oidc/dist-cjs/auth/httpAuthSchemeProvider.js +var require_httpAuthSchemeProvider3 = __commonJS({ + "../../../node_modules/@aws-sdk/client-sso-oidc/dist-cjs/auth/httpAuthSchemeProvider.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.resolveHttpAuthSchemeConfig = exports2.defaultSSOOIDCHttpAuthSchemeProvider = exports2.defaultSSOOIDCHttpAuthSchemeParametersProvider = void 0; + var core_1 = (init_dist_es2(), __toCommonJS(dist_es_exports2)); + var util_middleware_1 = require_dist_cjs10(); + var defaultSSOOIDCHttpAuthSchemeParametersProvider = async (config, context, input) => { + return { + operation: (0, util_middleware_1.getSmithyContext)(context).operation, + region: await (0, util_middleware_1.normalizeProvider)(config.region)() || (() => { + throw new Error("expected `region` to be configured for `aws.auth#sigv4`"); + })() }; - return response; }; - exports2.de_ListStateMachinesCommand = de_ListStateMachinesCommand; - var de_ListStateMachinesCommandError = async (output, context) => { - const parsedOutput = { - ...output, - body: await parseErrorBody(output.body, context) + exports2.defaultSSOOIDCHttpAuthSchemeParametersProvider = defaultSSOOIDCHttpAuthSchemeParametersProvider; + function createAwsAuthSigv4HttpAuthOption(authParameters) { + return { + schemeId: "aws.auth#sigv4", + signingProperties: { + name: "sso-oauth", + region: authParameters.region + }, + propertiesExtractor: (config, context) => ({ + signingProperties: { + config, + context + } + }) }; - const errorCode = loadRestJsonErrorCode(output, parsedOutput.body); - switch (errorCode) { - case "InvalidToken": - case "com.amazonaws.sfn#InvalidToken": - throw await de_InvalidTokenRes(parsedOutput, context); - default: - const parsedBody = parsedOutput.body; - return throwDefaultError({ - output, - parsedBody, - errorCode - }); + } + function createSmithyApiNoAuthHttpAuthOption(authParameters) { + return { + schemeId: "smithy.api#noAuth" + }; + } + var defaultSSOOIDCHttpAuthSchemeProvider = (authParameters) => { + const options = []; + switch (authParameters.operation) { + case "CreateToken": { + options.push(createSmithyApiNoAuthHttpAuthOption(authParameters)); + break; + } + case "RegisterClient": { + options.push(createSmithyApiNoAuthHttpAuthOption(authParameters)); + break; + } + case "StartDeviceAuthorization": { + options.push(createSmithyApiNoAuthHttpAuthOption(authParameters)); + break; + } + default: { + options.push(createAwsAuthSigv4HttpAuthOption(authParameters)); + } } + return options; }; - var de_ListStateMachineVersionsCommand = async (output, context) => { - if (output.statusCode >= 300) { - return de_ListStateMachineVersionsCommandError(output, context); - } - const data = await parseBody(output.body, context); - let contents = {}; - contents = de_ListStateMachineVersionsOutput(data, context); - const response = { - $metadata: deserializeMetadata(output), - ...contents + exports2.defaultSSOOIDCHttpAuthSchemeProvider = defaultSSOOIDCHttpAuthSchemeProvider; + var resolveHttpAuthSchemeConfig = (config) => { + const config_0 = (0, core_1.resolveAwsSdkSigV4Config)(config); + return { + ...config_0 }; - return response; }; - exports2.de_ListStateMachineVersionsCommand = de_ListStateMachineVersionsCommand; - var de_ListStateMachineVersionsCommandError = async (output, context) => { - const parsedOutput = { - ...output, - body: await parseErrorBody(output.body, context) - }; - const errorCode = loadRestJsonErrorCode(output, parsedOutput.body); - switch (errorCode) { - case "InvalidArn": - case "com.amazonaws.sfn#InvalidArn": - throw await de_InvalidArnRes(parsedOutput, context); - case "InvalidToken": - case "com.amazonaws.sfn#InvalidToken": - throw await de_InvalidTokenRes(parsedOutput, context); - case "ValidationException": - case "com.amazonaws.sfn#ValidationException": - throw await de_ValidationExceptionRes(parsedOutput, context); - default: - const parsedBody = parsedOutput.body; - return throwDefaultError({ - output, - parsedBody, - errorCode - }); + exports2.resolveHttpAuthSchemeConfig = resolveHttpAuthSchemeConfig; + } +}); + +// ../../../node_modules/@aws-sdk/client-sso-oidc/package.json +var require_package3 = __commonJS({ + "../../../node_modules/@aws-sdk/client-sso-oidc/package.json"(exports2, module2) { + module2.exports = { + name: "@aws-sdk/client-sso-oidc", + description: "AWS SDK for JavaScript Sso Oidc Client for Node.js, Browser and React Native", + version: "3.632.0", + scripts: { + build: "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'", + "build:cjs": "node ../../scripts/compilation/inline client-sso-oidc", + "build:es": "tsc -p tsconfig.es.json", + "build:include:deps": "lerna run --scope $npm_package_name --include-dependencies build", + "build:types": "tsc -p tsconfig.types.json", + "build:types:downlevel": "downlevel-dts dist-types dist-types/ts3.4", + clean: "rimraf ./dist-* && rimraf *.tsbuildinfo", + "extract:docs": "api-extractor run --local", + "generate:client": "node ../../scripts/generate-clients/single-service --solo sso-oidc" + }, + main: "./dist-cjs/index.js", + types: "./dist-types/index.d.ts", + module: "./dist-es/index.js", + sideEffects: false, + dependencies: { + "@aws-crypto/sha256-browser": "5.2.0", + "@aws-crypto/sha256-js": "5.2.0", + "@aws-sdk/core": "3.629.0", + "@aws-sdk/credential-provider-node": "3.632.0", + "@aws-sdk/middleware-host-header": "3.620.0", + "@aws-sdk/middleware-logger": "3.609.0", + "@aws-sdk/middleware-recursion-detection": "3.620.0", + "@aws-sdk/middleware-user-agent": "3.632.0", + "@aws-sdk/region-config-resolver": "3.614.0", + "@aws-sdk/types": "3.609.0", + "@aws-sdk/util-endpoints": "3.632.0", + "@aws-sdk/util-user-agent-browser": "3.609.0", + "@aws-sdk/util-user-agent-node": "3.614.0", + "@smithy/config-resolver": "^3.0.5", + "@smithy/core": "^2.3.2", + "@smithy/fetch-http-handler": "^3.2.4", + "@smithy/hash-node": "^3.0.3", + "@smithy/invalid-dependency": "^3.0.3", + "@smithy/middleware-content-length": "^3.0.5", + "@smithy/middleware-endpoint": "^3.1.0", + "@smithy/middleware-retry": "^3.0.14", + "@smithy/middleware-serde": "^3.0.3", + "@smithy/middleware-stack": "^3.0.3", + "@smithy/node-config-provider": "^3.1.4", + "@smithy/node-http-handler": "^3.1.4", + "@smithy/protocol-http": "^4.1.0", + "@smithy/smithy-client": "^3.1.12", + "@smithy/types": "^3.3.0", + "@smithy/url-parser": "^3.0.3", + "@smithy/util-base64": "^3.0.0", + "@smithy/util-body-length-browser": "^3.0.0", + "@smithy/util-body-length-node": "^3.0.0", + "@smithy/util-defaults-mode-browser": "^3.0.14", + "@smithy/util-defaults-mode-node": "^3.0.14", + "@smithy/util-endpoints": "^2.0.5", + "@smithy/util-middleware": "^3.0.3", + "@smithy/util-retry": "^3.0.3", + "@smithy/util-utf8": "^3.0.0", + tslib: "^2.6.2" + }, + devDependencies: { + "@tsconfig/node16": "16.1.3", + "@types/node": "^16.18.96", + concurrently: "7.0.0", + "downlevel-dts": "0.10.1", + rimraf: "3.0.2", + typescript: "~4.9.5" + }, + engines: { + node: ">=16.0.0" + }, + typesVersions: { + "<4.0": { + "dist-types/*": [ + "dist-types/ts3.4/*" + ] + } + }, + files: [ + "dist-*/**" + ], + author: { + name: "AWS SDK for JavaScript Team", + url: "https://aws.amazon.com/javascript/" + }, + license: "Apache-2.0", + peerDependencies: { + "@aws-sdk/client-sts": "^3.632.0" + }, + browser: { + "./dist-es/runtimeConfig": "./dist-es/runtimeConfig.browser" + }, + "react-native": { + "./dist-es/runtimeConfig": "./dist-es/runtimeConfig.native" + }, + homepage: "https://github.com/aws/aws-sdk-js-v3/tree/main/clients/client-sso-oidc", + repository: { + type: "git", + url: "https://github.com/aws/aws-sdk-js-v3.git", + directory: "clients/client-sso-oidc" } }; - var de_ListTagsForResourceCommand = async (output, context) => { - if (output.statusCode >= 300) { - return de_ListTagsForResourceCommandError(output, context); - } - const data = await parseBody(output.body, context); - let contents = {}; - contents = (0, smithy_client_1._json)(data); - const response = { - $metadata: deserializeMetadata(output), - ...contents + } +}); + +// ../../../node_modules/@aws-sdk/client-sso-oidc/dist-cjs/endpoint/ruleset.js +var require_ruleset2 = __commonJS({ + "../../../node_modules/@aws-sdk/client-sso-oidc/dist-cjs/endpoint/ruleset.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.ruleSet = void 0; + var u = "required"; + var v = "fn"; + var w = "argv"; + var x = "ref"; + var a = true; + var b = "isSet"; + var c = "booleanEquals"; + var d = "error"; + var e = "endpoint"; + var f = "tree"; + var g = "PartitionResult"; + var h = "getAttr"; + var i = { [u]: false, "type": "String" }; + var j = { [u]: true, "default": false, "type": "Boolean" }; + var k = { [x]: "Endpoint" }; + var l = { [v]: c, [w]: [{ [x]: "UseFIPS" }, true] }; + var m = { [v]: c, [w]: [{ [x]: "UseDualStack" }, true] }; + var n = {}; + var o = { [v]: h, [w]: [{ [x]: g }, "supportsFIPS"] }; + var p = { [x]: g }; + var q = { [v]: c, [w]: [true, { [v]: h, [w]: [p, "supportsDualStack"] }] }; + var r = [l]; + var s = [m]; + var t = [{ [x]: "Region" }]; + var _data = { version: "1.0", parameters: { Region: i, UseDualStack: j, UseFIPS: j, Endpoint: i }, rules: [{ conditions: [{ [v]: b, [w]: [k] }], rules: [{ conditions: r, error: "Invalid Configuration: FIPS and custom endpoint are not supported", type: d }, { conditions: s, error: "Invalid Configuration: Dualstack and custom endpoint are not supported", type: d }, { endpoint: { url: k, properties: n, headers: n }, type: e }], type: f }, { conditions: [{ [v]: b, [w]: t }], rules: [{ conditions: [{ [v]: "aws.partition", [w]: t, assign: g }], rules: [{ conditions: [l, m], rules: [{ conditions: [{ [v]: c, [w]: [a, o] }, q], rules: [{ endpoint: { url: "https://oidc-fips.{Region}.{PartitionResult#dualStackDnsSuffix}", properties: n, headers: n }, type: e }], type: f }, { error: "FIPS and DualStack are enabled, but this partition does not support one or both", type: d }], type: f }, { conditions: r, rules: [{ conditions: [{ [v]: c, [w]: [o, a] }], rules: [{ conditions: [{ [v]: "stringEquals", [w]: [{ [v]: h, [w]: [p, "name"] }, "aws-us-gov"] }], endpoint: { url: "https://oidc.{Region}.amazonaws.com", properties: n, headers: n }, type: e }, { endpoint: { url: "https://oidc-fips.{Region}.{PartitionResult#dnsSuffix}", properties: n, headers: n }, type: e }], type: f }, { error: "FIPS is enabled but this partition does not support FIPS", type: d }], type: f }, { conditions: s, rules: [{ conditions: [q], rules: [{ endpoint: { url: "https://oidc.{Region}.{PartitionResult#dualStackDnsSuffix}", properties: n, headers: n }, type: e }], type: f }, { error: "DualStack is enabled but this partition does not support DualStack", type: d }], type: f }, { endpoint: { url: "https://oidc.{Region}.{PartitionResult#dnsSuffix}", properties: n, headers: n }, type: e }], type: f }], type: f }, { error: "Invalid Configuration: Missing Region", type: d }] }; + exports2.ruleSet = _data; + } +}); + +// ../../../node_modules/@aws-sdk/client-sso-oidc/dist-cjs/endpoint/endpointResolver.js +var require_endpointResolver2 = __commonJS({ + "../../../node_modules/@aws-sdk/client-sso-oidc/dist-cjs/endpoint/endpointResolver.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.defaultEndpointResolver = void 0; + var util_endpoints_1 = require_dist_cjs7(); + var util_endpoints_2 = require_dist_cjs6(); + var ruleset_1 = require_ruleset2(); + var defaultEndpointResolver = (endpointParams, context = {}) => { + return (0, util_endpoints_2.resolveEndpoint)(ruleset_1.ruleSet, { + endpointParams, + logger: context.logger + }); + }; + exports2.defaultEndpointResolver = defaultEndpointResolver; + util_endpoints_2.customEndpointFunctions.aws = util_endpoints_1.awsEndpointFunctions; + } +}); + +// ../../../node_modules/@aws-sdk/client-sso-oidc/dist-cjs/runtimeConfig.shared.js +var require_runtimeConfig_shared2 = __commonJS({ + "../../../node_modules/@aws-sdk/client-sso-oidc/dist-cjs/runtimeConfig.shared.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.getRuntimeConfig = void 0; + var core_1 = (init_dist_es2(), __toCommonJS(dist_es_exports2)); + var core_2 = (init_dist_es(), __toCommonJS(dist_es_exports)); + var smithy_client_1 = require_dist_cjs37(); + var url_parser_1 = require_dist_cjs44(); + var util_base64_1 = require_dist_cjs29(); + var util_utf8_1 = require_dist_cjs28(); + var httpAuthSchemeProvider_1 = require_httpAuthSchemeProvider3(); + var endpointResolver_1 = require_endpointResolver2(); + var getRuntimeConfig = (config) => { + return { + apiVersion: "2019-06-10", + base64Decoder: config?.base64Decoder ?? util_base64_1.fromBase64, + base64Encoder: config?.base64Encoder ?? util_base64_1.toBase64, + disableHostPrefix: config?.disableHostPrefix ?? false, + endpointProvider: config?.endpointProvider ?? endpointResolver_1.defaultEndpointResolver, + extensions: config?.extensions ?? [], + httpAuthSchemeProvider: config?.httpAuthSchemeProvider ?? httpAuthSchemeProvider_1.defaultSSOOIDCHttpAuthSchemeProvider, + httpAuthSchemes: config?.httpAuthSchemes ?? [ + { + schemeId: "aws.auth#sigv4", + identityProvider: (ipc) => ipc.getIdentityProvider("aws.auth#sigv4"), + signer: new core_1.AwsSdkSigV4Signer() + }, + { + schemeId: "smithy.api#noAuth", + identityProvider: (ipc) => ipc.getIdentityProvider("smithy.api#noAuth") || (async () => ({})), + signer: new core_2.NoAuthSigner() + } + ], + logger: config?.logger ?? new smithy_client_1.NoOpLogger(), + serviceId: config?.serviceId ?? "SSO OIDC", + urlParser: config?.urlParser ?? url_parser_1.parseUrl, + utf8Decoder: config?.utf8Decoder ?? util_utf8_1.fromUtf8, + utf8Encoder: config?.utf8Encoder ?? util_utf8_1.toUtf8 }; - return response; }; - exports2.de_ListTagsForResourceCommand = de_ListTagsForResourceCommand; - var de_ListTagsForResourceCommandError = async (output, context) => { - const parsedOutput = { - ...output, - body: await parseErrorBody(output.body, context) + exports2.getRuntimeConfig = getRuntimeConfig; + } +}); + +// ../../../node_modules/@aws-sdk/client-sso-oidc/dist-cjs/runtimeConfig.js +var require_runtimeConfig2 = __commonJS({ + "../../../node_modules/@aws-sdk/client-sso-oidc/dist-cjs/runtimeConfig.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.getRuntimeConfig = void 0; + var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports)); + var package_json_1 = tslib_1.__importDefault(require_package3()); + var core_1 = (init_dist_es2(), __toCommonJS(dist_es_exports2)); + var credential_provider_node_1 = require_dist_cjs79(); + var util_user_agent_node_1 = require_dist_cjs56(); + var config_resolver_1 = require_dist_cjs11(); + var hash_node_1 = require_dist_cjs57(); + var middleware_retry_1 = require_dist_cjs38(); + var node_config_provider_1 = require_dist_cjs42(); + var node_http_handler_1 = require_dist_cjs51(); + var util_body_length_node_1 = require_dist_cjs58(); + var util_retry_1 = require_dist_cjs60(); + var runtimeConfig_shared_1 = require_runtimeConfig_shared2(); + var smithy_client_1 = require_dist_cjs37(); + var util_defaults_mode_node_1 = require_dist_cjs69(); + var smithy_client_2 = require_dist_cjs37(); + var getRuntimeConfig = (config) => { + (0, smithy_client_2.emitWarningIfUnsupportedVersion)(process.version); + const defaultsMode = (0, util_defaults_mode_node_1.resolveDefaultsModeConfig)(config); + const defaultConfigProvider = () => defaultsMode().then(smithy_client_1.loadConfigsForDefaultMode); + const clientSharedValues = (0, runtimeConfig_shared_1.getRuntimeConfig)(config); + (0, core_1.emitWarningIfUnsupportedVersion)(process.version); + return { + ...clientSharedValues, + ...config, + runtime: "node", + defaultsMode, + bodyLengthChecker: config?.bodyLengthChecker ?? util_body_length_node_1.calculateBodyLength, + credentialDefaultProvider: config?.credentialDefaultProvider ?? credential_provider_node_1.defaultProvider, + defaultUserAgentProvider: config?.defaultUserAgentProvider ?? (0, util_user_agent_node_1.defaultUserAgent)({ serviceId: clientSharedValues.serviceId, clientVersion: package_json_1.default.version }), + maxAttempts: config?.maxAttempts ?? (0, node_config_provider_1.loadConfig)(middleware_retry_1.NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config?.region ?? (0, node_config_provider_1.loadConfig)(config_resolver_1.NODE_REGION_CONFIG_OPTIONS, config_resolver_1.NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: node_http_handler_1.NodeHttpHandler.create(config?.requestHandler ?? defaultConfigProvider), + retryMode: config?.retryMode ?? (0, node_config_provider_1.loadConfig)({ + ...middleware_retry_1.NODE_RETRY_MODE_CONFIG_OPTIONS, + default: async () => (await defaultConfigProvider()).retryMode || util_retry_1.DEFAULT_RETRY_MODE + }), + sha256: config?.sha256 ?? hash_node_1.Hash.bind(null, "sha256"), + streamCollector: config?.streamCollector ?? node_http_handler_1.streamCollector, + useDualstackEndpoint: config?.useDualstackEndpoint ?? (0, node_config_provider_1.loadConfig)(config_resolver_1.NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS), + useFipsEndpoint: config?.useFipsEndpoint ?? (0, node_config_provider_1.loadConfig)(config_resolver_1.NODE_USE_FIPS_ENDPOINT_CONFIG_OPTIONS) }; - const errorCode = loadRestJsonErrorCode(output, parsedOutput.body); - switch (errorCode) { - case "InvalidArn": - case "com.amazonaws.sfn#InvalidArn": - throw await de_InvalidArnRes(parsedOutput, context); - case "ResourceNotFound": - case "com.amazonaws.sfn#ResourceNotFound": - throw await de_ResourceNotFoundRes(parsedOutput, context); - default: - const parsedBody = parsedOutput.body; - return throwDefaultError({ - output, - parsedBody, - errorCode - }); - } }; - var de_PublishStateMachineVersionCommand = async (output, context) => { - if (output.statusCode >= 300) { - return de_PublishStateMachineVersionCommandError(output, context); - } - const data = await parseBody(output.body, context); - let contents = {}; - contents = de_PublishStateMachineVersionOutput(data, context); - const response = { - $metadata: deserializeMetadata(output), - ...contents - }; - return response; + exports2.getRuntimeConfig = getRuntimeConfig; + } +}); + +// ../../../node_modules/@aws-sdk/client-sso-oidc/dist-cjs/index.js +var require_dist_cjs72 = __commonJS({ + "../../../node_modules/@aws-sdk/client-sso-oidc/dist-cjs/index.js"(exports2, module2) { + "use strict"; + var __defProp2 = Object.defineProperty; + var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; + var __getOwnPropNames2 = Object.getOwnPropertyNames; + var __hasOwnProp2 = Object.prototype.hasOwnProperty; + var __name = (target, value) => __defProp2(target, "name", { value, configurable: true }); + var __export2 = (target, all) => { + for (var name in all) + __defProp2(target, name, { get: all[name], enumerable: true }); }; - exports2.de_PublishStateMachineVersionCommand = de_PublishStateMachineVersionCommand; - var de_PublishStateMachineVersionCommandError = async (output, context) => { - const parsedOutput = { - ...output, - body: await parseErrorBody(output.body, context) - }; - const errorCode = loadRestJsonErrorCode(output, parsedOutput.body); - switch (errorCode) { - case "ConflictException": - case "com.amazonaws.sfn#ConflictException": - throw await de_ConflictExceptionRes(parsedOutput, context); - case "InvalidArn": - case "com.amazonaws.sfn#InvalidArn": - throw await de_InvalidArnRes(parsedOutput, context); - case "ServiceQuotaExceededException": - case "com.amazonaws.sfn#ServiceQuotaExceededException": - throw await de_ServiceQuotaExceededExceptionRes(parsedOutput, context); - case "StateMachineDeleting": - case "com.amazonaws.sfn#StateMachineDeleting": - throw await de_StateMachineDeletingRes(parsedOutput, context); - case "StateMachineDoesNotExist": - case "com.amazonaws.sfn#StateMachineDoesNotExist": - throw await de_StateMachineDoesNotExistRes(parsedOutput, context); - case "ValidationException": - case "com.amazonaws.sfn#ValidationException": - throw await de_ValidationExceptionRes(parsedOutput, context); - default: - const parsedBody = parsedOutput.body; - return throwDefaultError({ - output, - parsedBody, - errorCode - }); + var __copyProps2 = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames2(from)) + if (!__hasOwnProp2.call(to, key) && key !== except) + __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable }); } + return to; }; - var de_SendTaskFailureCommand = async (output, context) => { - if (output.statusCode >= 300) { - return de_SendTaskFailureCommandError(output, context); - } - const data = await parseBody(output.body, context); - let contents = {}; - contents = (0, smithy_client_1._json)(data); - const response = { - $metadata: deserializeMetadata(output), - ...contents + var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); + var src_exports = {}; + __export2(src_exports, { + AccessDeniedException: () => AccessDeniedException, + AuthorizationPendingException: () => AuthorizationPendingException, + CreateTokenCommand: () => CreateTokenCommand, + CreateTokenRequestFilterSensitiveLog: () => CreateTokenRequestFilterSensitiveLog, + CreateTokenResponseFilterSensitiveLog: () => CreateTokenResponseFilterSensitiveLog, + CreateTokenWithIAMCommand: () => CreateTokenWithIAMCommand, + CreateTokenWithIAMRequestFilterSensitiveLog: () => CreateTokenWithIAMRequestFilterSensitiveLog, + CreateTokenWithIAMResponseFilterSensitiveLog: () => CreateTokenWithIAMResponseFilterSensitiveLog, + ExpiredTokenException: () => ExpiredTokenException, + InternalServerException: () => InternalServerException, + InvalidClientException: () => InvalidClientException, + InvalidClientMetadataException: () => InvalidClientMetadataException, + InvalidGrantException: () => InvalidGrantException, + InvalidRedirectUriException: () => InvalidRedirectUriException, + InvalidRequestException: () => InvalidRequestException, + InvalidRequestRegionException: () => InvalidRequestRegionException, + InvalidScopeException: () => InvalidScopeException, + RegisterClientCommand: () => RegisterClientCommand, + RegisterClientResponseFilterSensitiveLog: () => RegisterClientResponseFilterSensitiveLog, + SSOOIDC: () => SSOOIDC, + SSOOIDCClient: () => SSOOIDCClient, + SSOOIDCServiceException: () => SSOOIDCServiceException, + SlowDownException: () => SlowDownException, + StartDeviceAuthorizationCommand: () => StartDeviceAuthorizationCommand, + StartDeviceAuthorizationRequestFilterSensitiveLog: () => StartDeviceAuthorizationRequestFilterSensitiveLog, + UnauthorizedClientException: () => UnauthorizedClientException, + UnsupportedGrantTypeException: () => UnsupportedGrantTypeException, + __Client: () => import_smithy_client5.Client + }); + module2.exports = __toCommonJS2(src_exports); + var import_middleware_host_header = require_dist_cjs3(); + var import_middleware_logger = require_dist_cjs4(); + var import_middleware_recursion_detection = require_dist_cjs5(); + var import_middleware_user_agent = require_dist_cjs8(); + var import_config_resolver = require_dist_cjs11(); + var import_core3 = (init_dist_es(), __toCommonJS(dist_es_exports)); + var import_middleware_content_length = require_dist_cjs39(); + var import_middleware_endpoint2 = require_dist_cjs46(); + var import_middleware_retry2 = require_dist_cjs38(); + var import_httpAuthSchemeProvider = require_httpAuthSchemeProvider3(); + var resolveClientEndpointParameters = /* @__PURE__ */ __name((options) => { + return { + ...options, + useDualstackEndpoint: options.useDualstackEndpoint ?? false, + useFipsEndpoint: options.useFipsEndpoint ?? false, + defaultSigningName: "sso-oauth" }; - return response; - }; - exports2.de_SendTaskFailureCommand = de_SendTaskFailureCommand; - var de_SendTaskFailureCommandError = async (output, context) => { - const parsedOutput = { - ...output, - body: await parseErrorBody(output.body, context) + }, "resolveClientEndpointParameters"); + var commonParams = { + UseFIPS: { type: "builtInParams", name: "useFipsEndpoint" }, + Endpoint: { type: "builtInParams", name: "endpoint" }, + Region: { type: "builtInParams", name: "region" }, + UseDualStack: { type: "builtInParams", name: "useDualstackEndpoint" } + }; + var import_runtimeConfig = require_runtimeConfig2(); + var import_region_config_resolver = require_dist_cjs70(); + var import_protocol_http8 = require_dist_cjs2(); + var import_smithy_client5 = require_dist_cjs37(); + var getHttpAuthExtensionConfiguration = /* @__PURE__ */ __name((runtimeConfig) => { + const _httpAuthSchemes = runtimeConfig.httpAuthSchemes; + let _httpAuthSchemeProvider = runtimeConfig.httpAuthSchemeProvider; + let _credentials = runtimeConfig.credentials; + return { + setHttpAuthScheme(httpAuthScheme) { + const index = _httpAuthSchemes.findIndex((scheme) => scheme.schemeId === httpAuthScheme.schemeId); + if (index === -1) { + _httpAuthSchemes.push(httpAuthScheme); + } else { + _httpAuthSchemes.splice(index, 1, httpAuthScheme); + } + }, + httpAuthSchemes() { + return _httpAuthSchemes; + }, + setHttpAuthSchemeProvider(httpAuthSchemeProvider) { + _httpAuthSchemeProvider = httpAuthSchemeProvider; + }, + httpAuthSchemeProvider() { + return _httpAuthSchemeProvider; + }, + setCredentials(credentials) { + _credentials = credentials; + }, + credentials() { + return _credentials; + } }; - const errorCode = loadRestJsonErrorCode(output, parsedOutput.body); - switch (errorCode) { - case "InvalidToken": - case "com.amazonaws.sfn#InvalidToken": - throw await de_InvalidTokenRes(parsedOutput, context); - case "TaskDoesNotExist": - case "com.amazonaws.sfn#TaskDoesNotExist": - throw await de_TaskDoesNotExistRes(parsedOutput, context); - case "TaskTimedOut": - case "com.amazonaws.sfn#TaskTimedOut": - throw await de_TaskTimedOutRes(parsedOutput, context); - default: - const parsedBody = parsedOutput.body; - return throwDefaultError({ - output, - parsedBody, - errorCode - }); - } - }; - var de_SendTaskHeartbeatCommand = async (output, context) => { - if (output.statusCode >= 300) { - return de_SendTaskHeartbeatCommandError(output, context); - } - const data = await parseBody(output.body, context); - let contents = {}; - contents = (0, smithy_client_1._json)(data); - const response = { - $metadata: deserializeMetadata(output), - ...contents + }, "getHttpAuthExtensionConfiguration"); + var resolveHttpAuthRuntimeConfig = /* @__PURE__ */ __name((config) => { + return { + httpAuthSchemes: config.httpAuthSchemes(), + httpAuthSchemeProvider: config.httpAuthSchemeProvider(), + credentials: config.credentials() }; - return response; - }; - exports2.de_SendTaskHeartbeatCommand = de_SendTaskHeartbeatCommand; - var de_SendTaskHeartbeatCommandError = async (output, context) => { - const parsedOutput = { - ...output, - body: await parseErrorBody(output.body, context) + }, "resolveHttpAuthRuntimeConfig"); + var asPartial = /* @__PURE__ */ __name((t) => t, "asPartial"); + var resolveRuntimeExtensions = /* @__PURE__ */ __name((runtimeConfig, extensions) => { + const extensionConfiguration = { + ...asPartial((0, import_region_config_resolver.getAwsRegionExtensionConfiguration)(runtimeConfig)), + ...asPartial((0, import_smithy_client5.getDefaultExtensionConfiguration)(runtimeConfig)), + ...asPartial((0, import_protocol_http8.getHttpHandlerExtensionConfiguration)(runtimeConfig)), + ...asPartial(getHttpAuthExtensionConfiguration(runtimeConfig)) }; - const errorCode = loadRestJsonErrorCode(output, parsedOutput.body); - switch (errorCode) { - case "InvalidToken": - case "com.amazonaws.sfn#InvalidToken": - throw await de_InvalidTokenRes(parsedOutput, context); - case "TaskDoesNotExist": - case "com.amazonaws.sfn#TaskDoesNotExist": - throw await de_TaskDoesNotExistRes(parsedOutput, context); - case "TaskTimedOut": - case "com.amazonaws.sfn#TaskTimedOut": - throw await de_TaskTimedOutRes(parsedOutput, context); - default: - const parsedBody = parsedOutput.body; - return throwDefaultError({ - output, - parsedBody, - errorCode - }); + extensions.forEach((extension) => extension.configure(extensionConfiguration)); + return { + ...runtimeConfig, + ...(0, import_region_config_resolver.resolveAwsRegionExtensionConfiguration)(extensionConfiguration), + ...(0, import_smithy_client5.resolveDefaultRuntimeConfig)(extensionConfiguration), + ...(0, import_protocol_http8.resolveHttpHandlerRuntimeConfig)(extensionConfiguration), + ...resolveHttpAuthRuntimeConfig(extensionConfiguration) + }; + }, "resolveRuntimeExtensions"); + var _SSOOIDCClient = class _SSOOIDCClient extends import_smithy_client5.Client { + constructor(...[configuration]) { + const _config_0 = (0, import_runtimeConfig.getRuntimeConfig)(configuration || {}); + const _config_1 = resolveClientEndpointParameters(_config_0); + const _config_2 = (0, import_middleware_user_agent.resolveUserAgentConfig)(_config_1); + const _config_3 = (0, import_middleware_retry2.resolveRetryConfig)(_config_2); + const _config_4 = (0, import_config_resolver.resolveRegionConfig)(_config_3); + const _config_5 = (0, import_middleware_host_header.resolveHostHeaderConfig)(_config_4); + const _config_6 = (0, import_middleware_endpoint2.resolveEndpointConfig)(_config_5); + const _config_7 = (0, import_httpAuthSchemeProvider.resolveHttpAuthSchemeConfig)(_config_6); + const _config_8 = resolveRuntimeExtensions(_config_7, (configuration == null ? void 0 : configuration.extensions) || []); + super(_config_8); + this.config = _config_8; + this.middlewareStack.use((0, import_middleware_user_agent.getUserAgentPlugin)(this.config)); + this.middlewareStack.use((0, import_middleware_retry2.getRetryPlugin)(this.config)); + this.middlewareStack.use((0, import_middleware_content_length.getContentLengthPlugin)(this.config)); + this.middlewareStack.use((0, import_middleware_host_header.getHostHeaderPlugin)(this.config)); + this.middlewareStack.use((0, import_middleware_logger.getLoggerPlugin)(this.config)); + this.middlewareStack.use((0, import_middleware_recursion_detection.getRecursionDetectionPlugin)(this.config)); + this.middlewareStack.use( + (0, import_core3.getHttpAuthSchemeEndpointRuleSetPlugin)(this.config, { + httpAuthSchemeParametersProvider: import_httpAuthSchemeProvider.defaultSSOOIDCHttpAuthSchemeParametersProvider, + identityProviderConfigProvider: async (config) => new import_core3.DefaultIdentityProviderConfig({ + "aws.auth#sigv4": config.credentials + }) + }) + ); + this.middlewareStack.use((0, import_core3.getHttpSigningPlugin)(this.config)); } - }; - var de_SendTaskSuccessCommand = async (output, context) => { - if (output.statusCode >= 300) { - return de_SendTaskSuccessCommandError(output, context); + /** + * Destroy underlying resources, like sockets. It's usually not necessary to do this. + * However in Node.js, it's best to explicitly shut down the client's agent when it is no longer needed. + * Otherwise, sockets might stay open for quite a long time before the server terminates them. + */ + destroy() { + super.destroy(); } - const data = await parseBody(output.body, context); - let contents = {}; - contents = (0, smithy_client_1._json)(data); - const response = { - $metadata: deserializeMetadata(output), - ...contents - }; - return response; }; - exports2.de_SendTaskSuccessCommand = de_SendTaskSuccessCommand; - var de_SendTaskSuccessCommandError = async (output, context) => { - const parsedOutput = { - ...output, - body: await parseErrorBody(output.body, context) - }; - const errorCode = loadRestJsonErrorCode(output, parsedOutput.body); - switch (errorCode) { - case "InvalidOutput": - case "com.amazonaws.sfn#InvalidOutput": - throw await de_InvalidOutputRes(parsedOutput, context); - case "InvalidToken": - case "com.amazonaws.sfn#InvalidToken": - throw await de_InvalidTokenRes(parsedOutput, context); - case "TaskDoesNotExist": - case "com.amazonaws.sfn#TaskDoesNotExist": - throw await de_TaskDoesNotExistRes(parsedOutput, context); - case "TaskTimedOut": - case "com.amazonaws.sfn#TaskTimedOut": - throw await de_TaskTimedOutRes(parsedOutput, context); - default: - const parsedBody = parsedOutput.body; - return throwDefaultError({ - output, - parsedBody, - errorCode - }); + __name(_SSOOIDCClient, "SSOOIDCClient"); + var SSOOIDCClient = _SSOOIDCClient; + var import_middleware_serde2 = require_dist_cjs45(); + var _SSOOIDCServiceException = class _SSOOIDCServiceException2 extends import_smithy_client5.ServiceException { + /** + * @internal + */ + constructor(options) { + super(options); + Object.setPrototypeOf(this, _SSOOIDCServiceException2.prototype); } }; - var de_StartExecutionCommand = async (output, context) => { - if (output.statusCode >= 300) { - return de_StartExecutionCommandError(output, context); + __name(_SSOOIDCServiceException, "SSOOIDCServiceException"); + var SSOOIDCServiceException = _SSOOIDCServiceException; + var _AccessDeniedException = class _AccessDeniedException2 extends SSOOIDCServiceException { + /** + * @internal + */ + constructor(opts) { + super({ + name: "AccessDeniedException", + $fault: "client", + ...opts + }); + this.name = "AccessDeniedException"; + this.$fault = "client"; + Object.setPrototypeOf(this, _AccessDeniedException2.prototype); + this.error = opts.error; + this.error_description = opts.error_description; } - const data = await parseBody(output.body, context); - let contents = {}; - contents = de_StartExecutionOutput(data, context); - const response = { - $metadata: deserializeMetadata(output), - ...contents - }; - return response; }; - exports2.de_StartExecutionCommand = de_StartExecutionCommand; - var de_StartExecutionCommandError = async (output, context) => { - const parsedOutput = { - ...output, - body: await parseErrorBody(output.body, context) - }; - const errorCode = loadRestJsonErrorCode(output, parsedOutput.body); - switch (errorCode) { - case "ExecutionAlreadyExists": - case "com.amazonaws.sfn#ExecutionAlreadyExists": - throw await de_ExecutionAlreadyExistsRes(parsedOutput, context); - case "ExecutionLimitExceeded": - case "com.amazonaws.sfn#ExecutionLimitExceeded": - throw await de_ExecutionLimitExceededRes(parsedOutput, context); - case "InvalidArn": - case "com.amazonaws.sfn#InvalidArn": - throw await de_InvalidArnRes(parsedOutput, context); - case "InvalidExecutionInput": - case "com.amazonaws.sfn#InvalidExecutionInput": - throw await de_InvalidExecutionInputRes(parsedOutput, context); - case "InvalidName": - case "com.amazonaws.sfn#InvalidName": - throw await de_InvalidNameRes(parsedOutput, context); - case "StateMachineDeleting": - case "com.amazonaws.sfn#StateMachineDeleting": - throw await de_StateMachineDeletingRes(parsedOutput, context); - case "StateMachineDoesNotExist": - case "com.amazonaws.sfn#StateMachineDoesNotExist": - throw await de_StateMachineDoesNotExistRes(parsedOutput, context); - case "ValidationException": - case "com.amazonaws.sfn#ValidationException": - throw await de_ValidationExceptionRes(parsedOutput, context); - default: - const parsedBody = parsedOutput.body; - return throwDefaultError({ - output, - parsedBody, - errorCode - }); + __name(_AccessDeniedException, "AccessDeniedException"); + var AccessDeniedException = _AccessDeniedException; + var _AuthorizationPendingException = class _AuthorizationPendingException2 extends SSOOIDCServiceException { + /** + * @internal + */ + constructor(opts) { + super({ + name: "AuthorizationPendingException", + $fault: "client", + ...opts + }); + this.name = "AuthorizationPendingException"; + this.$fault = "client"; + Object.setPrototypeOf(this, _AuthorizationPendingException2.prototype); + this.error = opts.error; + this.error_description = opts.error_description; } }; - var de_StartSyncExecutionCommand = async (output, context) => { - if (output.statusCode >= 300) { - return de_StartSyncExecutionCommandError(output, context); + __name(_AuthorizationPendingException, "AuthorizationPendingException"); + var AuthorizationPendingException = _AuthorizationPendingException; + var _ExpiredTokenException = class _ExpiredTokenException2 extends SSOOIDCServiceException { + /** + * @internal + */ + constructor(opts) { + super({ + name: "ExpiredTokenException", + $fault: "client", + ...opts + }); + this.name = "ExpiredTokenException"; + this.$fault = "client"; + Object.setPrototypeOf(this, _ExpiredTokenException2.prototype); + this.error = opts.error; + this.error_description = opts.error_description; } - const data = await parseBody(output.body, context); - let contents = {}; - contents = de_StartSyncExecutionOutput(data, context); - const response = { - $metadata: deserializeMetadata(output), - ...contents - }; - return response; }; - exports2.de_StartSyncExecutionCommand = de_StartSyncExecutionCommand; - var de_StartSyncExecutionCommandError = async (output, context) => { - const parsedOutput = { - ...output, - body: await parseErrorBody(output.body, context) - }; - const errorCode = loadRestJsonErrorCode(output, parsedOutput.body); - switch (errorCode) { - case "InvalidArn": - case "com.amazonaws.sfn#InvalidArn": - throw await de_InvalidArnRes(parsedOutput, context); - case "InvalidExecutionInput": - case "com.amazonaws.sfn#InvalidExecutionInput": - throw await de_InvalidExecutionInputRes(parsedOutput, context); - case "InvalidName": - case "com.amazonaws.sfn#InvalidName": - throw await de_InvalidNameRes(parsedOutput, context); - case "StateMachineDeleting": - case "com.amazonaws.sfn#StateMachineDeleting": - throw await de_StateMachineDeletingRes(parsedOutput, context); - case "StateMachineDoesNotExist": - case "com.amazonaws.sfn#StateMachineDoesNotExist": - throw await de_StateMachineDoesNotExistRes(parsedOutput, context); - case "StateMachineTypeNotSupported": - case "com.amazonaws.sfn#StateMachineTypeNotSupported": - throw await de_StateMachineTypeNotSupportedRes(parsedOutput, context); - default: - const parsedBody = parsedOutput.body; - return throwDefaultError({ - output, - parsedBody, - errorCode - }); + __name(_ExpiredTokenException, "ExpiredTokenException"); + var ExpiredTokenException = _ExpiredTokenException; + var _InternalServerException = class _InternalServerException2 extends SSOOIDCServiceException { + /** + * @internal + */ + constructor(opts) { + super({ + name: "InternalServerException", + $fault: "server", + ...opts + }); + this.name = "InternalServerException"; + this.$fault = "server"; + Object.setPrototypeOf(this, _InternalServerException2.prototype); + this.error = opts.error; + this.error_description = opts.error_description; } }; - var de_StopExecutionCommand = async (output, context) => { - if (output.statusCode >= 300) { - return de_StopExecutionCommandError(output, context); + __name(_InternalServerException, "InternalServerException"); + var InternalServerException = _InternalServerException; + var _InvalidClientException = class _InvalidClientException2 extends SSOOIDCServiceException { + /** + * @internal + */ + constructor(opts) { + super({ + name: "InvalidClientException", + $fault: "client", + ...opts + }); + this.name = "InvalidClientException"; + this.$fault = "client"; + Object.setPrototypeOf(this, _InvalidClientException2.prototype); + this.error = opts.error; + this.error_description = opts.error_description; } - const data = await parseBody(output.body, context); - let contents = {}; - contents = de_StopExecutionOutput(data, context); - const response = { - $metadata: deserializeMetadata(output), - ...contents - }; - return response; }; - exports2.de_StopExecutionCommand = de_StopExecutionCommand; - var de_StopExecutionCommandError = async (output, context) => { - const parsedOutput = { - ...output, - body: await parseErrorBody(output.body, context) - }; - const errorCode = loadRestJsonErrorCode(output, parsedOutput.body); - switch (errorCode) { - case "ExecutionDoesNotExist": - case "com.amazonaws.sfn#ExecutionDoesNotExist": - throw await de_ExecutionDoesNotExistRes(parsedOutput, context); - case "InvalidArn": - case "com.amazonaws.sfn#InvalidArn": - throw await de_InvalidArnRes(parsedOutput, context); - case "ValidationException": - case "com.amazonaws.sfn#ValidationException": - throw await de_ValidationExceptionRes(parsedOutput, context); - default: - const parsedBody = parsedOutput.body; - return throwDefaultError({ - output, - parsedBody, - errorCode - }); + __name(_InvalidClientException, "InvalidClientException"); + var InvalidClientException = _InvalidClientException; + var _InvalidGrantException = class _InvalidGrantException2 extends SSOOIDCServiceException { + /** + * @internal + */ + constructor(opts) { + super({ + name: "InvalidGrantException", + $fault: "client", + ...opts + }); + this.name = "InvalidGrantException"; + this.$fault = "client"; + Object.setPrototypeOf(this, _InvalidGrantException2.prototype); + this.error = opts.error; + this.error_description = opts.error_description; } }; - var de_TagResourceCommand = async (output, context) => { - if (output.statusCode >= 300) { - return de_TagResourceCommandError(output, context); + __name(_InvalidGrantException, "InvalidGrantException"); + var InvalidGrantException = _InvalidGrantException; + var _InvalidRequestException = class _InvalidRequestException2 extends SSOOIDCServiceException { + /** + * @internal + */ + constructor(opts) { + super({ + name: "InvalidRequestException", + $fault: "client", + ...opts + }); + this.name = "InvalidRequestException"; + this.$fault = "client"; + Object.setPrototypeOf(this, _InvalidRequestException2.prototype); + this.error = opts.error; + this.error_description = opts.error_description; } - const data = await parseBody(output.body, context); - let contents = {}; - contents = (0, smithy_client_1._json)(data); - const response = { - $metadata: deserializeMetadata(output), - ...contents - }; - return response; }; - exports2.de_TagResourceCommand = de_TagResourceCommand; - var de_TagResourceCommandError = async (output, context) => { - const parsedOutput = { - ...output, - body: await parseErrorBody(output.body, context) - }; - const errorCode = loadRestJsonErrorCode(output, parsedOutput.body); - switch (errorCode) { - case "InvalidArn": - case "com.amazonaws.sfn#InvalidArn": - throw await de_InvalidArnRes(parsedOutput, context); - case "ResourceNotFound": - case "com.amazonaws.sfn#ResourceNotFound": - throw await de_ResourceNotFoundRes(parsedOutput, context); - case "TooManyTags": - case "com.amazonaws.sfn#TooManyTags": - throw await de_TooManyTagsRes(parsedOutput, context); - default: - const parsedBody = parsedOutput.body; - return throwDefaultError({ - output, - parsedBody, - errorCode - }); + __name(_InvalidRequestException, "InvalidRequestException"); + var InvalidRequestException = _InvalidRequestException; + var _InvalidScopeException = class _InvalidScopeException2 extends SSOOIDCServiceException { + /** + * @internal + */ + constructor(opts) { + super({ + name: "InvalidScopeException", + $fault: "client", + ...opts + }); + this.name = "InvalidScopeException"; + this.$fault = "client"; + Object.setPrototypeOf(this, _InvalidScopeException2.prototype); + this.error = opts.error; + this.error_description = opts.error_description; + } + }; + __name(_InvalidScopeException, "InvalidScopeException"); + var InvalidScopeException = _InvalidScopeException; + var _SlowDownException = class _SlowDownException2 extends SSOOIDCServiceException { + /** + * @internal + */ + constructor(opts) { + super({ + name: "SlowDownException", + $fault: "client", + ...opts + }); + this.name = "SlowDownException"; + this.$fault = "client"; + Object.setPrototypeOf(this, _SlowDownException2.prototype); + this.error = opts.error; + this.error_description = opts.error_description; } }; - var de_UntagResourceCommand = async (output, context) => { - if (output.statusCode >= 300) { - return de_UntagResourceCommandError(output, context); + __name(_SlowDownException, "SlowDownException"); + var SlowDownException = _SlowDownException; + var _UnauthorizedClientException = class _UnauthorizedClientException2 extends SSOOIDCServiceException { + /** + * @internal + */ + constructor(opts) { + super({ + name: "UnauthorizedClientException", + $fault: "client", + ...opts + }); + this.name = "UnauthorizedClientException"; + this.$fault = "client"; + Object.setPrototypeOf(this, _UnauthorizedClientException2.prototype); + this.error = opts.error; + this.error_description = opts.error_description; } - const data = await parseBody(output.body, context); - let contents = {}; - contents = (0, smithy_client_1._json)(data); - const response = { - $metadata: deserializeMetadata(output), - ...contents - }; - return response; }; - exports2.de_UntagResourceCommand = de_UntagResourceCommand; - var de_UntagResourceCommandError = async (output, context) => { - const parsedOutput = { - ...output, - body: await parseErrorBody(output.body, context) - }; - const errorCode = loadRestJsonErrorCode(output, parsedOutput.body); - switch (errorCode) { - case "InvalidArn": - case "com.amazonaws.sfn#InvalidArn": - throw await de_InvalidArnRes(parsedOutput, context); - case "ResourceNotFound": - case "com.amazonaws.sfn#ResourceNotFound": - throw await de_ResourceNotFoundRes(parsedOutput, context); - default: - const parsedBody = parsedOutput.body; - return throwDefaultError({ - output, - parsedBody, - errorCode - }); + __name(_UnauthorizedClientException, "UnauthorizedClientException"); + var UnauthorizedClientException = _UnauthorizedClientException; + var _UnsupportedGrantTypeException = class _UnsupportedGrantTypeException2 extends SSOOIDCServiceException { + /** + * @internal + */ + constructor(opts) { + super({ + name: "UnsupportedGrantTypeException", + $fault: "client", + ...opts + }); + this.name = "UnsupportedGrantTypeException"; + this.$fault = "client"; + Object.setPrototypeOf(this, _UnsupportedGrantTypeException2.prototype); + this.error = opts.error; + this.error_description = opts.error_description; } }; - var de_UpdateMapRunCommand = async (output, context) => { - if (output.statusCode >= 300) { - return de_UpdateMapRunCommandError(output, context); + __name(_UnsupportedGrantTypeException, "UnsupportedGrantTypeException"); + var UnsupportedGrantTypeException = _UnsupportedGrantTypeException; + var _InvalidRequestRegionException = class _InvalidRequestRegionException2 extends SSOOIDCServiceException { + /** + * @internal + */ + constructor(opts) { + super({ + name: "InvalidRequestRegionException", + $fault: "client", + ...opts + }); + this.name = "InvalidRequestRegionException"; + this.$fault = "client"; + Object.setPrototypeOf(this, _InvalidRequestRegionException2.prototype); + this.error = opts.error; + this.error_description = opts.error_description; + this.endpoint = opts.endpoint; + this.region = opts.region; } - const data = await parseBody(output.body, context); - let contents = {}; - contents = (0, smithy_client_1._json)(data); - const response = { - $metadata: deserializeMetadata(output), - ...contents - }; - return response; }; - exports2.de_UpdateMapRunCommand = de_UpdateMapRunCommand; - var de_UpdateMapRunCommandError = async (output, context) => { - const parsedOutput = { - ...output, - body: await parseErrorBody(output.body, context) - }; - const errorCode = loadRestJsonErrorCode(output, parsedOutput.body); - switch (errorCode) { - case "InvalidArn": - case "com.amazonaws.sfn#InvalidArn": - throw await de_InvalidArnRes(parsedOutput, context); - case "ResourceNotFound": - case "com.amazonaws.sfn#ResourceNotFound": - throw await de_ResourceNotFoundRes(parsedOutput, context); - case "ValidationException": - case "com.amazonaws.sfn#ValidationException": - throw await de_ValidationExceptionRes(parsedOutput, context); - default: - const parsedBody = parsedOutput.body; - return throwDefaultError({ - output, - parsedBody, - errorCode - }); + __name(_InvalidRequestRegionException, "InvalidRequestRegionException"); + var InvalidRequestRegionException = _InvalidRequestRegionException; + var _InvalidClientMetadataException = class _InvalidClientMetadataException2 extends SSOOIDCServiceException { + /** + * @internal + */ + constructor(opts) { + super({ + name: "InvalidClientMetadataException", + $fault: "client", + ...opts + }); + this.name = "InvalidClientMetadataException"; + this.$fault = "client"; + Object.setPrototypeOf(this, _InvalidClientMetadataException2.prototype); + this.error = opts.error; + this.error_description = opts.error_description; } }; - var de_UpdateStateMachineCommand = async (output, context) => { - if (output.statusCode >= 300) { - return de_UpdateStateMachineCommandError(output, context); + __name(_InvalidClientMetadataException, "InvalidClientMetadataException"); + var InvalidClientMetadataException = _InvalidClientMetadataException; + var _InvalidRedirectUriException = class _InvalidRedirectUriException2 extends SSOOIDCServiceException { + /** + * @internal + */ + constructor(opts) { + super({ + name: "InvalidRedirectUriException", + $fault: "client", + ...opts + }); + this.name = "InvalidRedirectUriException"; + this.$fault = "client"; + Object.setPrototypeOf(this, _InvalidRedirectUriException2.prototype); + this.error = opts.error; + this.error_description = opts.error_description; } - const data = await parseBody(output.body, context); - let contents = {}; - contents = de_UpdateStateMachineOutput(data, context); - const response = { - $metadata: deserializeMetadata(output), - ...contents - }; - return response; }; - exports2.de_UpdateStateMachineCommand = de_UpdateStateMachineCommand; - var de_UpdateStateMachineCommandError = async (output, context) => { - const parsedOutput = { - ...output, - body: await parseErrorBody(output.body, context) + __name(_InvalidRedirectUriException, "InvalidRedirectUriException"); + var InvalidRedirectUriException = _InvalidRedirectUriException; + var CreateTokenRequestFilterSensitiveLog = /* @__PURE__ */ __name((obj) => ({ + ...obj, + ...obj.clientSecret && { clientSecret: import_smithy_client5.SENSITIVE_STRING }, + ...obj.refreshToken && { refreshToken: import_smithy_client5.SENSITIVE_STRING }, + ...obj.codeVerifier && { codeVerifier: import_smithy_client5.SENSITIVE_STRING } + }), "CreateTokenRequestFilterSensitiveLog"); + var CreateTokenResponseFilterSensitiveLog = /* @__PURE__ */ __name((obj) => ({ + ...obj, + ...obj.accessToken && { accessToken: import_smithy_client5.SENSITIVE_STRING }, + ...obj.refreshToken && { refreshToken: import_smithy_client5.SENSITIVE_STRING }, + ...obj.idToken && { idToken: import_smithy_client5.SENSITIVE_STRING } + }), "CreateTokenResponseFilterSensitiveLog"); + var CreateTokenWithIAMRequestFilterSensitiveLog = /* @__PURE__ */ __name((obj) => ({ + ...obj, + ...obj.refreshToken && { refreshToken: import_smithy_client5.SENSITIVE_STRING }, + ...obj.assertion && { assertion: import_smithy_client5.SENSITIVE_STRING }, + ...obj.subjectToken && { subjectToken: import_smithy_client5.SENSITIVE_STRING }, + ...obj.codeVerifier && { codeVerifier: import_smithy_client5.SENSITIVE_STRING } + }), "CreateTokenWithIAMRequestFilterSensitiveLog"); + var CreateTokenWithIAMResponseFilterSensitiveLog = /* @__PURE__ */ __name((obj) => ({ + ...obj, + ...obj.accessToken && { accessToken: import_smithy_client5.SENSITIVE_STRING }, + ...obj.refreshToken && { refreshToken: import_smithy_client5.SENSITIVE_STRING }, + ...obj.idToken && { idToken: import_smithy_client5.SENSITIVE_STRING } + }), "CreateTokenWithIAMResponseFilterSensitiveLog"); + var RegisterClientResponseFilterSensitiveLog = /* @__PURE__ */ __name((obj) => ({ + ...obj, + ...obj.clientSecret && { clientSecret: import_smithy_client5.SENSITIVE_STRING } + }), "RegisterClientResponseFilterSensitiveLog"); + var StartDeviceAuthorizationRequestFilterSensitiveLog = /* @__PURE__ */ __name((obj) => ({ + ...obj, + ...obj.clientSecret && { clientSecret: import_smithy_client5.SENSITIVE_STRING } + }), "StartDeviceAuthorizationRequestFilterSensitiveLog"); + var import_core22 = (init_dist_es2(), __toCommonJS(dist_es_exports2)); + var se_CreateTokenCommand = /* @__PURE__ */ __name(async (input, context) => { + const b = (0, import_core3.requestBuilder)(input, context); + const headers = { + "content-type": "application/json" }; - const errorCode = loadRestJsonErrorCode(output, parsedOutput.body); - switch (errorCode) { - case "ConflictException": - case "com.amazonaws.sfn#ConflictException": - throw await de_ConflictExceptionRes(parsedOutput, context); - case "InvalidArn": - case "com.amazonaws.sfn#InvalidArn": - throw await de_InvalidArnRes(parsedOutput, context); - case "InvalidDefinition": - case "com.amazonaws.sfn#InvalidDefinition": - throw await de_InvalidDefinitionRes(parsedOutput, context); - case "InvalidLoggingConfiguration": - case "com.amazonaws.sfn#InvalidLoggingConfiguration": - throw await de_InvalidLoggingConfigurationRes(parsedOutput, context); - case "InvalidTracingConfiguration": - case "com.amazonaws.sfn#InvalidTracingConfiguration": - throw await de_InvalidTracingConfigurationRes(parsedOutput, context); - case "MissingRequiredParameter": - case "com.amazonaws.sfn#MissingRequiredParameter": - throw await de_MissingRequiredParameterRes(parsedOutput, context); - case "ServiceQuotaExceededException": - case "com.amazonaws.sfn#ServiceQuotaExceededException": - throw await de_ServiceQuotaExceededExceptionRes(parsedOutput, context); - case "StateMachineDeleting": - case "com.amazonaws.sfn#StateMachineDeleting": - throw await de_StateMachineDeletingRes(parsedOutput, context); - case "StateMachineDoesNotExist": - case "com.amazonaws.sfn#StateMachineDoesNotExist": - throw await de_StateMachineDoesNotExistRes(parsedOutput, context); - case "ValidationException": - case "com.amazonaws.sfn#ValidationException": - throw await de_ValidationExceptionRes(parsedOutput, context); - default: - const parsedBody = parsedOutput.body; - return throwDefaultError({ - output, - parsedBody, - errorCode - }); + b.bp("/token"); + let body; + body = JSON.stringify( + (0, import_smithy_client5.take)(input, { + clientId: [], + clientSecret: [], + code: [], + codeVerifier: [], + deviceCode: [], + grantType: [], + redirectUri: [], + refreshToken: [], + scope: (_) => (0, import_smithy_client5._json)(_) + }) + ); + b.m("POST").h(headers).b(body); + return b.build(); + }, "se_CreateTokenCommand"); + var se_CreateTokenWithIAMCommand = /* @__PURE__ */ __name(async (input, context) => { + const b = (0, import_core3.requestBuilder)(input, context); + const headers = { + "content-type": "application/json" + }; + b.bp("/token"); + const query = (0, import_smithy_client5.map)({ + [_ai]: [, "t"] + }); + let body; + body = JSON.stringify( + (0, import_smithy_client5.take)(input, { + assertion: [], + clientId: [], + code: [], + codeVerifier: [], + grantType: [], + redirectUri: [], + refreshToken: [], + requestedTokenType: [], + scope: (_) => (0, import_smithy_client5._json)(_), + subjectToken: [], + subjectTokenType: [] + }) + ); + b.m("POST").h(headers).q(query).b(body); + return b.build(); + }, "se_CreateTokenWithIAMCommand"); + var se_RegisterClientCommand = /* @__PURE__ */ __name(async (input, context) => { + const b = (0, import_core3.requestBuilder)(input, context); + const headers = { + "content-type": "application/json" + }; + b.bp("/client/register"); + let body; + body = JSON.stringify( + (0, import_smithy_client5.take)(input, { + clientName: [], + clientType: [], + entitledApplicationArn: [], + grantTypes: (_) => (0, import_smithy_client5._json)(_), + issuerUrl: [], + redirectUris: (_) => (0, import_smithy_client5._json)(_), + scopes: (_) => (0, import_smithy_client5._json)(_) + }) + ); + b.m("POST").h(headers).b(body); + return b.build(); + }, "se_RegisterClientCommand"); + var se_StartDeviceAuthorizationCommand = /* @__PURE__ */ __name(async (input, context) => { + const b = (0, import_core3.requestBuilder)(input, context); + const headers = { + "content-type": "application/json" + }; + b.bp("/device_authorization"); + let body; + body = JSON.stringify( + (0, import_smithy_client5.take)(input, { + clientId: [], + clientSecret: [], + startUrl: [] + }) + ); + b.m("POST").h(headers).b(body); + return b.build(); + }, "se_StartDeviceAuthorizationCommand"); + var de_CreateTokenCommand = /* @__PURE__ */ __name(async (output, context) => { + if (output.statusCode !== 200 && output.statusCode >= 300) { + return de_CommandError(output, context); } - }; - var de_UpdateStateMachineAliasCommand = async (output, context) => { - if (output.statusCode >= 300) { - return de_UpdateStateMachineAliasCommandError(output, context); + const contents = (0, import_smithy_client5.map)({ + $metadata: deserializeMetadata(output) + }); + const data = (0, import_smithy_client5.expectNonNull)((0, import_smithy_client5.expectObject)(await (0, import_core22.parseJsonBody)(output.body, context)), "body"); + const doc = (0, import_smithy_client5.take)(data, { + accessToken: import_smithy_client5.expectString, + expiresIn: import_smithy_client5.expectInt32, + idToken: import_smithy_client5.expectString, + refreshToken: import_smithy_client5.expectString, + tokenType: import_smithy_client5.expectString + }); + Object.assign(contents, doc); + return contents; + }, "de_CreateTokenCommand"); + var de_CreateTokenWithIAMCommand = /* @__PURE__ */ __name(async (output, context) => { + if (output.statusCode !== 200 && output.statusCode >= 300) { + return de_CommandError(output, context); } - const data = await parseBody(output.body, context); - let contents = {}; - contents = de_UpdateStateMachineAliasOutput(data, context); - const response = { - $metadata: deserializeMetadata(output), - ...contents - }; - return response; - }; - exports2.de_UpdateStateMachineAliasCommand = de_UpdateStateMachineAliasCommand; - var de_UpdateStateMachineAliasCommandError = async (output, context) => { + const contents = (0, import_smithy_client5.map)({ + $metadata: deserializeMetadata(output) + }); + const data = (0, import_smithy_client5.expectNonNull)((0, import_smithy_client5.expectObject)(await (0, import_core22.parseJsonBody)(output.body, context)), "body"); + const doc = (0, import_smithy_client5.take)(data, { + accessToken: import_smithy_client5.expectString, + expiresIn: import_smithy_client5.expectInt32, + idToken: import_smithy_client5.expectString, + issuedTokenType: import_smithy_client5.expectString, + refreshToken: import_smithy_client5.expectString, + scope: import_smithy_client5._json, + tokenType: import_smithy_client5.expectString + }); + Object.assign(contents, doc); + return contents; + }, "de_CreateTokenWithIAMCommand"); + var de_RegisterClientCommand = /* @__PURE__ */ __name(async (output, context) => { + if (output.statusCode !== 200 && output.statusCode >= 300) { + return de_CommandError(output, context); + } + const contents = (0, import_smithy_client5.map)({ + $metadata: deserializeMetadata(output) + }); + const data = (0, import_smithy_client5.expectNonNull)((0, import_smithy_client5.expectObject)(await (0, import_core22.parseJsonBody)(output.body, context)), "body"); + const doc = (0, import_smithy_client5.take)(data, { + authorizationEndpoint: import_smithy_client5.expectString, + clientId: import_smithy_client5.expectString, + clientIdIssuedAt: import_smithy_client5.expectLong, + clientSecret: import_smithy_client5.expectString, + clientSecretExpiresAt: import_smithy_client5.expectLong, + tokenEndpoint: import_smithy_client5.expectString + }); + Object.assign(contents, doc); + return contents; + }, "de_RegisterClientCommand"); + var de_StartDeviceAuthorizationCommand = /* @__PURE__ */ __name(async (output, context) => { + if (output.statusCode !== 200 && output.statusCode >= 300) { + return de_CommandError(output, context); + } + const contents = (0, import_smithy_client5.map)({ + $metadata: deserializeMetadata(output) + }); + const data = (0, import_smithy_client5.expectNonNull)((0, import_smithy_client5.expectObject)(await (0, import_core22.parseJsonBody)(output.body, context)), "body"); + const doc = (0, import_smithy_client5.take)(data, { + deviceCode: import_smithy_client5.expectString, + expiresIn: import_smithy_client5.expectInt32, + interval: import_smithy_client5.expectInt32, + userCode: import_smithy_client5.expectString, + verificationUri: import_smithy_client5.expectString, + verificationUriComplete: import_smithy_client5.expectString + }); + Object.assign(contents, doc); + return contents; + }, "de_StartDeviceAuthorizationCommand"); + var de_CommandError = /* @__PURE__ */ __name(async (output, context) => { const parsedOutput = { ...output, - body: await parseErrorBody(output.body, context) + body: await (0, import_core22.parseJsonErrorBody)(output.body, context) }; - const errorCode = loadRestJsonErrorCode(output, parsedOutput.body); + const errorCode = (0, import_core22.loadRestJsonErrorCode)(output, parsedOutput.body); switch (errorCode) { - case "ConflictException": - case "com.amazonaws.sfn#ConflictException": - throw await de_ConflictExceptionRes(parsedOutput, context); - case "InvalidArn": - case "com.amazonaws.sfn#InvalidArn": - throw await de_InvalidArnRes(parsedOutput, context); - case "ResourceNotFound": - case "com.amazonaws.sfn#ResourceNotFound": - throw await de_ResourceNotFoundRes(parsedOutput, context); - case "ValidationException": - case "com.amazonaws.sfn#ValidationException": - throw await de_ValidationExceptionRes(parsedOutput, context); + case "AccessDeniedException": + case "com.amazonaws.ssooidc#AccessDeniedException": + throw await de_AccessDeniedExceptionRes(parsedOutput, context); + case "AuthorizationPendingException": + case "com.amazonaws.ssooidc#AuthorizationPendingException": + throw await de_AuthorizationPendingExceptionRes(parsedOutput, context); + case "ExpiredTokenException": + case "com.amazonaws.ssooidc#ExpiredTokenException": + throw await de_ExpiredTokenExceptionRes(parsedOutput, context); + case "InternalServerException": + case "com.amazonaws.ssooidc#InternalServerException": + throw await de_InternalServerExceptionRes(parsedOutput, context); + case "InvalidClientException": + case "com.amazonaws.ssooidc#InvalidClientException": + throw await de_InvalidClientExceptionRes(parsedOutput, context); + case "InvalidGrantException": + case "com.amazonaws.ssooidc#InvalidGrantException": + throw await de_InvalidGrantExceptionRes(parsedOutput, context); + case "InvalidRequestException": + case "com.amazonaws.ssooidc#InvalidRequestException": + throw await de_InvalidRequestExceptionRes(parsedOutput, context); + case "InvalidScopeException": + case "com.amazonaws.ssooidc#InvalidScopeException": + throw await de_InvalidScopeExceptionRes(parsedOutput, context); + case "SlowDownException": + case "com.amazonaws.ssooidc#SlowDownException": + throw await de_SlowDownExceptionRes(parsedOutput, context); + case "UnauthorizedClientException": + case "com.amazonaws.ssooidc#UnauthorizedClientException": + throw await de_UnauthorizedClientExceptionRes(parsedOutput, context); + case "UnsupportedGrantTypeException": + case "com.amazonaws.ssooidc#UnsupportedGrantTypeException": + throw await de_UnsupportedGrantTypeExceptionRes(parsedOutput, context); + case "InvalidRequestRegionException": + case "com.amazonaws.ssooidc#InvalidRequestRegionException": + throw await de_InvalidRequestRegionExceptionRes(parsedOutput, context); + case "InvalidClientMetadataException": + case "com.amazonaws.ssooidc#InvalidClientMetadataException": + throw await de_InvalidClientMetadataExceptionRes(parsedOutput, context); + case "InvalidRedirectUriException": + case "com.amazonaws.ssooidc#InvalidRedirectUriException": + throw await de_InvalidRedirectUriExceptionRes(parsedOutput, context); default: const parsedBody = parsedOutput.body; return throwDefaultError({ @@ -19690,590 +19818,2227 @@ var require_Aws_json1_0 = __commonJS({ errorCode }); } - }; - var de_ActivityDoesNotExistRes = async (parsedOutput, context) => { - const body = parsedOutput.body; - const deserialized = (0, smithy_client_1._json)(body); - const exception = new models_0_1.ActivityDoesNotExist({ - $metadata: deserializeMetadata(parsedOutput), - ...deserialized + }, "de_CommandError"); + var throwDefaultError = (0, import_smithy_client5.withBaseException)(SSOOIDCServiceException); + var de_AccessDeniedExceptionRes = /* @__PURE__ */ __name(async (parsedOutput, context) => { + const contents = (0, import_smithy_client5.map)({}); + const data = parsedOutput.body; + const doc = (0, import_smithy_client5.take)(data, { + error: import_smithy_client5.expectString, + error_description: import_smithy_client5.expectString }); - return (0, smithy_client_1.decorateServiceException)(exception, body); - }; - var de_ActivityLimitExceededRes = async (parsedOutput, context) => { - const body = parsedOutput.body; - const deserialized = (0, smithy_client_1._json)(body); - const exception = new models_0_1.ActivityLimitExceeded({ + Object.assign(contents, doc); + const exception = new AccessDeniedException({ $metadata: deserializeMetadata(parsedOutput), - ...deserialized + ...contents }); - return (0, smithy_client_1.decorateServiceException)(exception, body); - }; - var de_ActivityWorkerLimitExceededRes = async (parsedOutput, context) => { - const body = parsedOutput.body; - const deserialized = (0, smithy_client_1._json)(body); - const exception = new models_0_1.ActivityWorkerLimitExceeded({ - $metadata: deserializeMetadata(parsedOutput), - ...deserialized + return (0, import_smithy_client5.decorateServiceException)(exception, parsedOutput.body); + }, "de_AccessDeniedExceptionRes"); + var de_AuthorizationPendingExceptionRes = /* @__PURE__ */ __name(async (parsedOutput, context) => { + const contents = (0, import_smithy_client5.map)({}); + const data = parsedOutput.body; + const doc = (0, import_smithy_client5.take)(data, { + error: import_smithy_client5.expectString, + error_description: import_smithy_client5.expectString }); - return (0, smithy_client_1.decorateServiceException)(exception, body); - }; - var de_ConflictExceptionRes = async (parsedOutput, context) => { - const body = parsedOutput.body; - const deserialized = (0, smithy_client_1._json)(body); - const exception = new models_0_1.ConflictException({ + Object.assign(contents, doc); + const exception = new AuthorizationPendingException({ $metadata: deserializeMetadata(parsedOutput), - ...deserialized + ...contents }); - return (0, smithy_client_1.decorateServiceException)(exception, body); - }; - var de_ExecutionAlreadyExistsRes = async (parsedOutput, context) => { - const body = parsedOutput.body; - const deserialized = (0, smithy_client_1._json)(body); - const exception = new models_0_1.ExecutionAlreadyExists({ - $metadata: deserializeMetadata(parsedOutput), - ...deserialized + return (0, import_smithy_client5.decorateServiceException)(exception, parsedOutput.body); + }, "de_AuthorizationPendingExceptionRes"); + var de_ExpiredTokenExceptionRes = /* @__PURE__ */ __name(async (parsedOutput, context) => { + const contents = (0, import_smithy_client5.map)({}); + const data = parsedOutput.body; + const doc = (0, import_smithy_client5.take)(data, { + error: import_smithy_client5.expectString, + error_description: import_smithy_client5.expectString }); - return (0, smithy_client_1.decorateServiceException)(exception, body); - }; - var de_ExecutionDoesNotExistRes = async (parsedOutput, context) => { - const body = parsedOutput.body; - const deserialized = (0, smithy_client_1._json)(body); - const exception = new models_0_1.ExecutionDoesNotExist({ + Object.assign(contents, doc); + const exception = new ExpiredTokenException({ $metadata: deserializeMetadata(parsedOutput), - ...deserialized + ...contents }); - return (0, smithy_client_1.decorateServiceException)(exception, body); - }; - var de_ExecutionLimitExceededRes = async (parsedOutput, context) => { - const body = parsedOutput.body; - const deserialized = (0, smithy_client_1._json)(body); - const exception = new models_0_1.ExecutionLimitExceeded({ - $metadata: deserializeMetadata(parsedOutput), - ...deserialized + return (0, import_smithy_client5.decorateServiceException)(exception, parsedOutput.body); + }, "de_ExpiredTokenExceptionRes"); + var de_InternalServerExceptionRes = /* @__PURE__ */ __name(async (parsedOutput, context) => { + const contents = (0, import_smithy_client5.map)({}); + const data = parsedOutput.body; + const doc = (0, import_smithy_client5.take)(data, { + error: import_smithy_client5.expectString, + error_description: import_smithy_client5.expectString }); - return (0, smithy_client_1.decorateServiceException)(exception, body); - }; - var de_InvalidArnRes = async (parsedOutput, context) => { - const body = parsedOutput.body; - const deserialized = (0, smithy_client_1._json)(body); - const exception = new models_0_1.InvalidArn({ + Object.assign(contents, doc); + const exception = new InternalServerException({ $metadata: deserializeMetadata(parsedOutput), - ...deserialized + ...contents }); - return (0, smithy_client_1.decorateServiceException)(exception, body); - }; - var de_InvalidDefinitionRes = async (parsedOutput, context) => { - const body = parsedOutput.body; - const deserialized = (0, smithy_client_1._json)(body); - const exception = new models_0_1.InvalidDefinition({ - $metadata: deserializeMetadata(parsedOutput), - ...deserialized + return (0, import_smithy_client5.decorateServiceException)(exception, parsedOutput.body); + }, "de_InternalServerExceptionRes"); + var de_InvalidClientExceptionRes = /* @__PURE__ */ __name(async (parsedOutput, context) => { + const contents = (0, import_smithy_client5.map)({}); + const data = parsedOutput.body; + const doc = (0, import_smithy_client5.take)(data, { + error: import_smithy_client5.expectString, + error_description: import_smithy_client5.expectString }); - return (0, smithy_client_1.decorateServiceException)(exception, body); - }; - var de_InvalidExecutionInputRes = async (parsedOutput, context) => { - const body = parsedOutput.body; - const deserialized = (0, smithy_client_1._json)(body); - const exception = new models_0_1.InvalidExecutionInput({ + Object.assign(contents, doc); + const exception = new InvalidClientException({ $metadata: deserializeMetadata(parsedOutput), - ...deserialized + ...contents }); - return (0, smithy_client_1.decorateServiceException)(exception, body); - }; - var de_InvalidLoggingConfigurationRes = async (parsedOutput, context) => { - const body = parsedOutput.body; - const deserialized = (0, smithy_client_1._json)(body); - const exception = new models_0_1.InvalidLoggingConfiguration({ - $metadata: deserializeMetadata(parsedOutput), - ...deserialized + return (0, import_smithy_client5.decorateServiceException)(exception, parsedOutput.body); + }, "de_InvalidClientExceptionRes"); + var de_InvalidClientMetadataExceptionRes = /* @__PURE__ */ __name(async (parsedOutput, context) => { + const contents = (0, import_smithy_client5.map)({}); + const data = parsedOutput.body; + const doc = (0, import_smithy_client5.take)(data, { + error: import_smithy_client5.expectString, + error_description: import_smithy_client5.expectString }); - return (0, smithy_client_1.decorateServiceException)(exception, body); - }; - var de_InvalidNameRes = async (parsedOutput, context) => { - const body = parsedOutput.body; - const deserialized = (0, smithy_client_1._json)(body); - const exception = new models_0_1.InvalidName({ + Object.assign(contents, doc); + const exception = new InvalidClientMetadataException({ $metadata: deserializeMetadata(parsedOutput), - ...deserialized + ...contents }); - return (0, smithy_client_1.decorateServiceException)(exception, body); - }; - var de_InvalidOutputRes = async (parsedOutput, context) => { - const body = parsedOutput.body; - const deserialized = (0, smithy_client_1._json)(body); - const exception = new models_0_1.InvalidOutput({ - $metadata: deserializeMetadata(parsedOutput), - ...deserialized + return (0, import_smithy_client5.decorateServiceException)(exception, parsedOutput.body); + }, "de_InvalidClientMetadataExceptionRes"); + var de_InvalidGrantExceptionRes = /* @__PURE__ */ __name(async (parsedOutput, context) => { + const contents = (0, import_smithy_client5.map)({}); + const data = parsedOutput.body; + const doc = (0, import_smithy_client5.take)(data, { + error: import_smithy_client5.expectString, + error_description: import_smithy_client5.expectString }); - return (0, smithy_client_1.decorateServiceException)(exception, body); - }; - var de_InvalidTokenRes = async (parsedOutput, context) => { - const body = parsedOutput.body; - const deserialized = (0, smithy_client_1._json)(body); - const exception = new models_0_1.InvalidToken({ + Object.assign(contents, doc); + const exception = new InvalidGrantException({ $metadata: deserializeMetadata(parsedOutput), - ...deserialized + ...contents }); - return (0, smithy_client_1.decorateServiceException)(exception, body); - }; - var de_InvalidTracingConfigurationRes = async (parsedOutput, context) => { - const body = parsedOutput.body; - const deserialized = (0, smithy_client_1._json)(body); - const exception = new models_0_1.InvalidTracingConfiguration({ - $metadata: deserializeMetadata(parsedOutput), - ...deserialized + return (0, import_smithy_client5.decorateServiceException)(exception, parsedOutput.body); + }, "de_InvalidGrantExceptionRes"); + var de_InvalidRedirectUriExceptionRes = /* @__PURE__ */ __name(async (parsedOutput, context) => { + const contents = (0, import_smithy_client5.map)({}); + const data = parsedOutput.body; + const doc = (0, import_smithy_client5.take)(data, { + error: import_smithy_client5.expectString, + error_description: import_smithy_client5.expectString }); - return (0, smithy_client_1.decorateServiceException)(exception, body); - }; - var de_MissingRequiredParameterRes = async (parsedOutput, context) => { - const body = parsedOutput.body; - const deserialized = (0, smithy_client_1._json)(body); - const exception = new models_0_1.MissingRequiredParameter({ + Object.assign(contents, doc); + const exception = new InvalidRedirectUriException({ $metadata: deserializeMetadata(parsedOutput), - ...deserialized + ...contents }); - return (0, smithy_client_1.decorateServiceException)(exception, body); - }; - var de_ResourceNotFoundRes = async (parsedOutput, context) => { - const body = parsedOutput.body; - const deserialized = (0, smithy_client_1._json)(body); - const exception = new models_0_1.ResourceNotFound({ + return (0, import_smithy_client5.decorateServiceException)(exception, parsedOutput.body); + }, "de_InvalidRedirectUriExceptionRes"); + var de_InvalidRequestExceptionRes = /* @__PURE__ */ __name(async (parsedOutput, context) => { + const contents = (0, import_smithy_client5.map)({}); + const data = parsedOutput.body; + const doc = (0, import_smithy_client5.take)(data, { + error: import_smithy_client5.expectString, + error_description: import_smithy_client5.expectString + }); + Object.assign(contents, doc); + const exception = new InvalidRequestException({ $metadata: deserializeMetadata(parsedOutput), - ...deserialized + ...contents }); - return (0, smithy_client_1.decorateServiceException)(exception, body); - }; - var de_ServiceQuotaExceededExceptionRes = async (parsedOutput, context) => { - const body = parsedOutput.body; - const deserialized = (0, smithy_client_1._json)(body); - const exception = new models_0_1.ServiceQuotaExceededException({ + return (0, import_smithy_client5.decorateServiceException)(exception, parsedOutput.body); + }, "de_InvalidRequestExceptionRes"); + var de_InvalidRequestRegionExceptionRes = /* @__PURE__ */ __name(async (parsedOutput, context) => { + const contents = (0, import_smithy_client5.map)({}); + const data = parsedOutput.body; + const doc = (0, import_smithy_client5.take)(data, { + endpoint: import_smithy_client5.expectString, + error: import_smithy_client5.expectString, + error_description: import_smithy_client5.expectString, + region: import_smithy_client5.expectString + }); + Object.assign(contents, doc); + const exception = new InvalidRequestRegionException({ $metadata: deserializeMetadata(parsedOutput), - ...deserialized + ...contents }); - return (0, smithy_client_1.decorateServiceException)(exception, body); - }; - var de_StateMachineAlreadyExistsRes = async (parsedOutput, context) => { - const body = parsedOutput.body; - const deserialized = (0, smithy_client_1._json)(body); - const exception = new models_0_1.StateMachineAlreadyExists({ + return (0, import_smithy_client5.decorateServiceException)(exception, parsedOutput.body); + }, "de_InvalidRequestRegionExceptionRes"); + var de_InvalidScopeExceptionRes = /* @__PURE__ */ __name(async (parsedOutput, context) => { + const contents = (0, import_smithy_client5.map)({}); + const data = parsedOutput.body; + const doc = (0, import_smithy_client5.take)(data, { + error: import_smithy_client5.expectString, + error_description: import_smithy_client5.expectString + }); + Object.assign(contents, doc); + const exception = new InvalidScopeException({ $metadata: deserializeMetadata(parsedOutput), - ...deserialized + ...contents }); - return (0, smithy_client_1.decorateServiceException)(exception, body); - }; - var de_StateMachineDeletingRes = async (parsedOutput, context) => { - const body = parsedOutput.body; - const deserialized = (0, smithy_client_1._json)(body); - const exception = new models_0_1.StateMachineDeleting({ + return (0, import_smithy_client5.decorateServiceException)(exception, parsedOutput.body); + }, "de_InvalidScopeExceptionRes"); + var de_SlowDownExceptionRes = /* @__PURE__ */ __name(async (parsedOutput, context) => { + const contents = (0, import_smithy_client5.map)({}); + const data = parsedOutput.body; + const doc = (0, import_smithy_client5.take)(data, { + error: import_smithy_client5.expectString, + error_description: import_smithy_client5.expectString + }); + Object.assign(contents, doc); + const exception = new SlowDownException({ $metadata: deserializeMetadata(parsedOutput), - ...deserialized + ...contents }); - return (0, smithy_client_1.decorateServiceException)(exception, body); - }; - var de_StateMachineDoesNotExistRes = async (parsedOutput, context) => { - const body = parsedOutput.body; - const deserialized = (0, smithy_client_1._json)(body); - const exception = new models_0_1.StateMachineDoesNotExist({ + return (0, import_smithy_client5.decorateServiceException)(exception, parsedOutput.body); + }, "de_SlowDownExceptionRes"); + var de_UnauthorizedClientExceptionRes = /* @__PURE__ */ __name(async (parsedOutput, context) => { + const contents = (0, import_smithy_client5.map)({}); + const data = parsedOutput.body; + const doc = (0, import_smithy_client5.take)(data, { + error: import_smithy_client5.expectString, + error_description: import_smithy_client5.expectString + }); + Object.assign(contents, doc); + const exception = new UnauthorizedClientException({ $metadata: deserializeMetadata(parsedOutput), - ...deserialized + ...contents }); - return (0, smithy_client_1.decorateServiceException)(exception, body); - }; - var de_StateMachineLimitExceededRes = async (parsedOutput, context) => { - const body = parsedOutput.body; - const deserialized = (0, smithy_client_1._json)(body); - const exception = new models_0_1.StateMachineLimitExceeded({ + return (0, import_smithy_client5.decorateServiceException)(exception, parsedOutput.body); + }, "de_UnauthorizedClientExceptionRes"); + var de_UnsupportedGrantTypeExceptionRes = /* @__PURE__ */ __name(async (parsedOutput, context) => { + const contents = (0, import_smithy_client5.map)({}); + const data = parsedOutput.body; + const doc = (0, import_smithy_client5.take)(data, { + error: import_smithy_client5.expectString, + error_description: import_smithy_client5.expectString + }); + Object.assign(contents, doc); + const exception = new UnsupportedGrantTypeException({ $metadata: deserializeMetadata(parsedOutput), - ...deserialized + ...contents }); - return (0, smithy_client_1.decorateServiceException)(exception, body); + return (0, import_smithy_client5.decorateServiceException)(exception, parsedOutput.body); + }, "de_UnsupportedGrantTypeExceptionRes"); + var deserializeMetadata = /* @__PURE__ */ __name((output) => ({ + httpStatusCode: output.statusCode, + requestId: output.headers["x-amzn-requestid"] ?? output.headers["x-amzn-request-id"] ?? output.headers["x-amz-request-id"], + extendedRequestId: output.headers["x-amz-id-2"], + cfId: output.headers["x-amz-cf-id"] + }), "deserializeMetadata"); + var _ai = "aws_iam"; + var _CreateTokenCommand = class _CreateTokenCommand extends import_smithy_client5.Command.classBuilder().ep({ + ...commonParams + }).m(function(Command, cs, config, o) { + return [ + (0, import_middleware_serde2.getSerdePlugin)(config, this.serialize, this.deserialize), + (0, import_middleware_endpoint2.getEndpointPlugin)(config, Command.getEndpointParameterInstructions()) + ]; + }).s("AWSSSOOIDCService", "CreateToken", {}).n("SSOOIDCClient", "CreateTokenCommand").f(CreateTokenRequestFilterSensitiveLog, CreateTokenResponseFilterSensitiveLog).ser(se_CreateTokenCommand).de(de_CreateTokenCommand).build() { + }; + __name(_CreateTokenCommand, "CreateTokenCommand"); + var CreateTokenCommand = _CreateTokenCommand; + var _CreateTokenWithIAMCommand = class _CreateTokenWithIAMCommand extends import_smithy_client5.Command.classBuilder().ep({ + ...commonParams + }).m(function(Command, cs, config, o) { + return [ + (0, import_middleware_serde2.getSerdePlugin)(config, this.serialize, this.deserialize), + (0, import_middleware_endpoint2.getEndpointPlugin)(config, Command.getEndpointParameterInstructions()) + ]; + }).s("AWSSSOOIDCService", "CreateTokenWithIAM", {}).n("SSOOIDCClient", "CreateTokenWithIAMCommand").f(CreateTokenWithIAMRequestFilterSensitiveLog, CreateTokenWithIAMResponseFilterSensitiveLog).ser(se_CreateTokenWithIAMCommand).de(de_CreateTokenWithIAMCommand).build() { + }; + __name(_CreateTokenWithIAMCommand, "CreateTokenWithIAMCommand"); + var CreateTokenWithIAMCommand = _CreateTokenWithIAMCommand; + var _RegisterClientCommand = class _RegisterClientCommand extends import_smithy_client5.Command.classBuilder().ep({ + ...commonParams + }).m(function(Command, cs, config, o) { + return [ + (0, import_middleware_serde2.getSerdePlugin)(config, this.serialize, this.deserialize), + (0, import_middleware_endpoint2.getEndpointPlugin)(config, Command.getEndpointParameterInstructions()) + ]; + }).s("AWSSSOOIDCService", "RegisterClient", {}).n("SSOOIDCClient", "RegisterClientCommand").f(void 0, RegisterClientResponseFilterSensitiveLog).ser(se_RegisterClientCommand).de(de_RegisterClientCommand).build() { + }; + __name(_RegisterClientCommand, "RegisterClientCommand"); + var RegisterClientCommand = _RegisterClientCommand; + var _StartDeviceAuthorizationCommand = class _StartDeviceAuthorizationCommand extends import_smithy_client5.Command.classBuilder().ep({ + ...commonParams + }).m(function(Command, cs, config, o) { + return [ + (0, import_middleware_serde2.getSerdePlugin)(config, this.serialize, this.deserialize), + (0, import_middleware_endpoint2.getEndpointPlugin)(config, Command.getEndpointParameterInstructions()) + ]; + }).s("AWSSSOOIDCService", "StartDeviceAuthorization", {}).n("SSOOIDCClient", "StartDeviceAuthorizationCommand").f(StartDeviceAuthorizationRequestFilterSensitiveLog, void 0).ser(se_StartDeviceAuthorizationCommand).de(de_StartDeviceAuthorizationCommand).build() { + }; + __name(_StartDeviceAuthorizationCommand, "StartDeviceAuthorizationCommand"); + var StartDeviceAuthorizationCommand = _StartDeviceAuthorizationCommand; + var commands = { + CreateTokenCommand, + CreateTokenWithIAMCommand, + RegisterClientCommand, + StartDeviceAuthorizationCommand + }; + var _SSOOIDC = class _SSOOIDC extends SSOOIDCClient { + }; + __name(_SSOOIDC, "SSOOIDC"); + var SSOOIDC = _SSOOIDC; + (0, import_smithy_client5.createAggregatedClient)(commands, SSOOIDC); + } +}); + +// ../../../node_modules/@aws-sdk/token-providers/dist-cjs/index.js +var require_dist_cjs73 = __commonJS({ + "../../../node_modules/@aws-sdk/token-providers/dist-cjs/index.js"(exports2, module2) { + "use strict"; + var __create2 = Object.create; + var __defProp2 = Object.defineProperty; + var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; + var __getOwnPropNames2 = Object.getOwnPropertyNames; + var __getProtoOf2 = Object.getPrototypeOf; + var __hasOwnProp2 = Object.prototype.hasOwnProperty; + var __name = (target, value) => __defProp2(target, "name", { value, configurable: true }); + var __export2 = (target, all) => { + for (var name in all) + __defProp2(target, name, { get: all[name], enumerable: true }); + }; + var __copyProps2 = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames2(from)) + if (!__hasOwnProp2.call(to, key) && key !== except) + __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable }); + } + return to; + }; + var __toESM2 = (mod, isNodeMode, target) => (target = mod != null ? __create2(__getProtoOf2(mod)) : {}, __copyProps2( + // If the importer is in node compatibility mode or this is not an ESM + // file that has been converted to a CommonJS file using a Babel- + // compatible transform (i.e. "__esModule" has not been set), then set + // "default" to the CommonJS "module.exports" for node compatibility. + isNodeMode || !mod || !mod.__esModule ? __defProp2(target, "default", { value: mod, enumerable: true }) : target, + mod + )); + var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); + var src_exports = {}; + __export2(src_exports, { + fromSso: () => fromSso, + fromStatic: () => fromStatic, + nodeProvider: () => nodeProvider + }); + module2.exports = __toCommonJS2(src_exports); + var EXPIRE_WINDOW_MS = 5 * 60 * 1e3; + var REFRESH_MESSAGE = `To refresh this SSO session run 'aws sso login' with the corresponding profile.`; + var ssoOidcClientsHash = {}; + var getSsoOidcClient = /* @__PURE__ */ __name(async (ssoRegion) => { + const { SSOOIDCClient } = await Promise.resolve().then(() => __toESM2(require_dist_cjs72())); + if (ssoOidcClientsHash[ssoRegion]) { + return ssoOidcClientsHash[ssoRegion]; + } + const ssoOidcClient = new SSOOIDCClient({ region: ssoRegion }); + ssoOidcClientsHash[ssoRegion] = ssoOidcClient; + return ssoOidcClient; + }, "getSsoOidcClient"); + var getNewSsoOidcToken = /* @__PURE__ */ __name(async (ssoToken, ssoRegion) => { + const { CreateTokenCommand } = await Promise.resolve().then(() => __toESM2(require_dist_cjs72())); + const ssoOidcClient = await getSsoOidcClient(ssoRegion); + return ssoOidcClient.send( + new CreateTokenCommand({ + clientId: ssoToken.clientId, + clientSecret: ssoToken.clientSecret, + refreshToken: ssoToken.refreshToken, + grantType: "refresh_token" + }) + ); + }, "getNewSsoOidcToken"); + var import_property_provider2 = require_dist_cjs40(); + var validateTokenExpiry = /* @__PURE__ */ __name((token) => { + if (token.expiration && token.expiration.getTime() < Date.now()) { + throw new import_property_provider2.TokenProviderError(`Token is expired. ${REFRESH_MESSAGE}`, false); + } + }, "validateTokenExpiry"); + var validateTokenKey = /* @__PURE__ */ __name((key, value, forRefresh = false) => { + if (typeof value === "undefined") { + throw new import_property_provider2.TokenProviderError( + `Value not present for '${key}' in SSO Token${forRefresh ? ". Cannot refresh" : ""}. ${REFRESH_MESSAGE}`, + false + ); + } + }, "validateTokenKey"); + var import_shared_ini_file_loader = require_dist_cjs41(); + var import_fs = require("fs"); + var { writeFile } = import_fs.promises; + var writeSSOTokenToFile = /* @__PURE__ */ __name((id, ssoToken) => { + const tokenFilepath = (0, import_shared_ini_file_loader.getSSOTokenFilepath)(id); + const tokenString = JSON.stringify(ssoToken, null, 2); + return writeFile(tokenFilepath, tokenString); + }, "writeSSOTokenToFile"); + var lastRefreshAttemptTime = /* @__PURE__ */ new Date(0); + var fromSso = /* @__PURE__ */ __name((init = {}) => async () => { + var _a; + (_a = init.logger) == null ? void 0 : _a.debug("@aws-sdk/token-providers - fromSso"); + const profiles = await (0, import_shared_ini_file_loader.parseKnownFiles)(init); + const profileName = (0, import_shared_ini_file_loader.getProfileName)(init); + const profile = profiles[profileName]; + if (!profile) { + throw new import_property_provider2.TokenProviderError(`Profile '${profileName}' could not be found in shared credentials file.`, false); + } else if (!profile["sso_session"]) { + throw new import_property_provider2.TokenProviderError(`Profile '${profileName}' is missing required property 'sso_session'.`); + } + const ssoSessionName = profile["sso_session"]; + const ssoSessions = await (0, import_shared_ini_file_loader.loadSsoSessionData)(init); + const ssoSession = ssoSessions[ssoSessionName]; + if (!ssoSession) { + throw new import_property_provider2.TokenProviderError( + `Sso session '${ssoSessionName}' could not be found in shared credentials file.`, + false + ); + } + for (const ssoSessionRequiredKey of ["sso_start_url", "sso_region"]) { + if (!ssoSession[ssoSessionRequiredKey]) { + throw new import_property_provider2.TokenProviderError( + `Sso session '${ssoSessionName}' is missing required property '${ssoSessionRequiredKey}'.`, + false + ); + } + } + const ssoStartUrl = ssoSession["sso_start_url"]; + const ssoRegion = ssoSession["sso_region"]; + let ssoToken; + try { + ssoToken = await (0, import_shared_ini_file_loader.getSSOTokenFromFile)(ssoSessionName); + } catch (e) { + throw new import_property_provider2.TokenProviderError( + `The SSO session token associated with profile=${profileName} was not found or is invalid. ${REFRESH_MESSAGE}`, + false + ); + } + validateTokenKey("accessToken", ssoToken.accessToken); + validateTokenKey("expiresAt", ssoToken.expiresAt); + const { accessToken, expiresAt } = ssoToken; + const existingToken = { token: accessToken, expiration: new Date(expiresAt) }; + if (existingToken.expiration.getTime() - Date.now() > EXPIRE_WINDOW_MS) { + return existingToken; + } + if (Date.now() - lastRefreshAttemptTime.getTime() < 30 * 1e3) { + validateTokenExpiry(existingToken); + return existingToken; + } + validateTokenKey("clientId", ssoToken.clientId, true); + validateTokenKey("clientSecret", ssoToken.clientSecret, true); + validateTokenKey("refreshToken", ssoToken.refreshToken, true); + try { + lastRefreshAttemptTime.setTime(Date.now()); + const newSsoOidcToken = await getNewSsoOidcToken(ssoToken, ssoRegion); + validateTokenKey("accessToken", newSsoOidcToken.accessToken); + validateTokenKey("expiresIn", newSsoOidcToken.expiresIn); + const newTokenExpiration = new Date(Date.now() + newSsoOidcToken.expiresIn * 1e3); + try { + await writeSSOTokenToFile(ssoSessionName, { + ...ssoToken, + accessToken: newSsoOidcToken.accessToken, + expiresAt: newTokenExpiration.toISOString(), + refreshToken: newSsoOidcToken.refreshToken + }); + } catch (error) { + } + return { + token: newSsoOidcToken.accessToken, + expiration: newTokenExpiration + }; + } catch (error) { + validateTokenExpiry(existingToken); + return existingToken; + } + }, "fromSso"); + var fromStatic = /* @__PURE__ */ __name(({ token, logger }) => async () => { + logger == null ? void 0 : logger.debug("@aws-sdk/token-providers - fromStatic"); + if (!token || !token.token) { + throw new import_property_provider2.TokenProviderError(`Please pass a valid token to fromStatic`, false); + } + return token; + }, "fromStatic"); + var nodeProvider = /* @__PURE__ */ __name((init = {}) => (0, import_property_provider2.memoize)( + (0, import_property_provider2.chain)(fromSso(init), async () => { + throw new import_property_provider2.TokenProviderError("Could not load token from any providers", false); + }), + (token) => token.expiration !== void 0 && token.expiration.getTime() - Date.now() < 3e5, + (token) => token.expiration !== void 0 + ), "nodeProvider"); + } +}); + +// ../../../node_modules/@aws-sdk/credential-provider-sso/dist-cjs/index.js +var require_dist_cjs74 = __commonJS({ + "../../../node_modules/@aws-sdk/credential-provider-sso/dist-cjs/index.js"(exports2, module2) { + "use strict"; + var __defProp2 = Object.defineProperty; + var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; + var __getOwnPropNames2 = Object.getOwnPropertyNames; + var __hasOwnProp2 = Object.prototype.hasOwnProperty; + var __name = (target, value) => __defProp2(target, "name", { value, configurable: true }); + var __esm2 = (fn, res) => function __init() { + return fn && (res = (0, fn[__getOwnPropNames2(fn)[0]])(fn = 0)), res; }; - var de_StateMachineTypeNotSupportedRes = async (parsedOutput, context) => { - const body = parsedOutput.body; - const deserialized = (0, smithy_client_1._json)(body); - const exception = new models_0_1.StateMachineTypeNotSupported({ - $metadata: deserializeMetadata(parsedOutput), - ...deserialized - }); - return (0, smithy_client_1.decorateServiceException)(exception, body); + var __export2 = (target, all) => { + for (var name in all) + __defProp2(target, name, { get: all[name], enumerable: true }); }; - var de_TaskDoesNotExistRes = async (parsedOutput, context) => { - const body = parsedOutput.body; - const deserialized = (0, smithy_client_1._json)(body); - const exception = new models_0_1.TaskDoesNotExist({ - $metadata: deserializeMetadata(parsedOutput), - ...deserialized - }); - return (0, smithy_client_1.decorateServiceException)(exception, body); + var __copyProps2 = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames2(from)) + if (!__hasOwnProp2.call(to, key) && key !== except) + __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable }); + } + return to; }; - var de_TaskTimedOutRes = async (parsedOutput, context) => { - const body = parsedOutput.body; - const deserialized = (0, smithy_client_1._json)(body); - const exception = new models_0_1.TaskTimedOut({ - $metadata: deserializeMetadata(parsedOutput), - ...deserialized - }); - return (0, smithy_client_1.decorateServiceException)(exception, body); + var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); + var loadSso_exports = {}; + __export2(loadSso_exports, { + GetRoleCredentialsCommand: () => import_client_sso.GetRoleCredentialsCommand, + SSOClient: () => import_client_sso.SSOClient + }); + var import_client_sso; + var init_loadSso = __esm2({ + "src/loadSso.ts"() { + "use strict"; + import_client_sso = require_dist_cjs71(); + } + }); + var src_exports = {}; + __export2(src_exports, { + fromSSO: () => fromSSO, + isSsoProfile: () => isSsoProfile, + validateSsoProfile: () => validateSsoProfile + }); + module2.exports = __toCommonJS2(src_exports); + var isSsoProfile = /* @__PURE__ */ __name((arg) => arg && (typeof arg.sso_start_url === "string" || typeof arg.sso_account_id === "string" || typeof arg.sso_session === "string" || typeof arg.sso_region === "string" || typeof arg.sso_role_name === "string"), "isSsoProfile"); + var import_token_providers = require_dist_cjs73(); + var import_property_provider2 = require_dist_cjs40(); + var import_shared_ini_file_loader = require_dist_cjs41(); + var SHOULD_FAIL_CREDENTIAL_CHAIN = false; + var resolveSSOCredentials = /* @__PURE__ */ __name(async ({ + ssoStartUrl, + ssoSession, + ssoAccountId, + ssoRegion, + ssoRoleName, + ssoClient, + clientConfig, + profile, + logger + }) => { + let token; + const refreshMessage = `To refresh this SSO session run aws sso login with the corresponding profile.`; + if (ssoSession) { + try { + const _token = await (0, import_token_providers.fromSso)({ profile })(); + token = { + accessToken: _token.token, + expiresAt: new Date(_token.expiration).toISOString() + }; + } catch (e) { + throw new import_property_provider2.CredentialsProviderError(e.message, { + tryNextLink: SHOULD_FAIL_CREDENTIAL_CHAIN, + logger + }); + } + } else { + try { + token = await (0, import_shared_ini_file_loader.getSSOTokenFromFile)(ssoStartUrl); + } catch (e) { + throw new import_property_provider2.CredentialsProviderError(`The SSO session associated with this profile is invalid. ${refreshMessage}`, { + tryNextLink: SHOULD_FAIL_CREDENTIAL_CHAIN, + logger + }); + } + } + if (new Date(token.expiresAt).getTime() - Date.now() <= 0) { + throw new import_property_provider2.CredentialsProviderError(`The SSO session associated with this profile has expired. ${refreshMessage}`, { + tryNextLink: SHOULD_FAIL_CREDENTIAL_CHAIN, + logger + }); + } + const { accessToken } = token; + const { SSOClient: SSOClient2, GetRoleCredentialsCommand: GetRoleCredentialsCommand2 } = await Promise.resolve().then(() => (init_loadSso(), loadSso_exports)); + const sso = ssoClient || new SSOClient2( + Object.assign({}, clientConfig ?? {}, { + region: (clientConfig == null ? void 0 : clientConfig.region) ?? ssoRegion + }) + ); + let ssoResp; + try { + ssoResp = await sso.send( + new GetRoleCredentialsCommand2({ + accountId: ssoAccountId, + roleName: ssoRoleName, + accessToken + }) + ); + } catch (e) { + throw new import_property_provider2.CredentialsProviderError(e, { + tryNextLink: SHOULD_FAIL_CREDENTIAL_CHAIN, + logger + }); + } + const { + roleCredentials: { accessKeyId, secretAccessKey, sessionToken, expiration, credentialScope, accountId } = {} + } = ssoResp; + if (!accessKeyId || !secretAccessKey || !sessionToken || !expiration) { + throw new import_property_provider2.CredentialsProviderError("SSO returns an invalid temporary credential.", { + tryNextLink: SHOULD_FAIL_CREDENTIAL_CHAIN, + logger + }); + } + return { + accessKeyId, + secretAccessKey, + sessionToken, + expiration: new Date(expiration), + ...credentialScope && { credentialScope }, + ...accountId && { accountId } + }; + }, "resolveSSOCredentials"); + var validateSsoProfile = /* @__PURE__ */ __name((profile, logger) => { + const { sso_start_url, sso_account_id, sso_region, sso_role_name } = profile; + if (!sso_start_url || !sso_account_id || !sso_region || !sso_role_name) { + throw new import_property_provider2.CredentialsProviderError( + `Profile is configured with invalid SSO credentials. Required parameters "sso_account_id", "sso_region", "sso_role_name", "sso_start_url". Got ${Object.keys(profile).join( + ", " + )} +Reference: https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-sso.html`, + { tryNextLink: false, logger } + ); + } + return profile; + }, "validateSsoProfile"); + var fromSSO = /* @__PURE__ */ __name((init = {}) => async () => { + var _a; + (_a = init.logger) == null ? void 0 : _a.debug("@aws-sdk/credential-provider-sso - fromSSO"); + const { ssoStartUrl, ssoAccountId, ssoRegion, ssoRoleName, ssoSession } = init; + const { ssoClient } = init; + const profileName = (0, import_shared_ini_file_loader.getProfileName)(init); + if (!ssoStartUrl && !ssoAccountId && !ssoRegion && !ssoRoleName && !ssoSession) { + const profiles = await (0, import_shared_ini_file_loader.parseKnownFiles)(init); + const profile = profiles[profileName]; + if (!profile) { + throw new import_property_provider2.CredentialsProviderError(`Profile ${profileName} was not found.`, { logger: init.logger }); + } + if (!isSsoProfile(profile)) { + throw new import_property_provider2.CredentialsProviderError(`Profile ${profileName} is not configured with SSO credentials.`, { + logger: init.logger + }); + } + if (profile == null ? void 0 : profile.sso_session) { + const ssoSessions = await (0, import_shared_ini_file_loader.loadSsoSessionData)(init); + const session = ssoSessions[profile.sso_session]; + const conflictMsg = ` configurations in profile ${profileName} and sso-session ${profile.sso_session}`; + if (ssoRegion && ssoRegion !== session.sso_region) { + throw new import_property_provider2.CredentialsProviderError(`Conflicting SSO region` + conflictMsg, { + tryNextLink: false, + logger: init.logger + }); + } + if (ssoStartUrl && ssoStartUrl !== session.sso_start_url) { + throw new import_property_provider2.CredentialsProviderError(`Conflicting SSO start_url` + conflictMsg, { + tryNextLink: false, + logger: init.logger + }); + } + profile.sso_region = session.sso_region; + profile.sso_start_url = session.sso_start_url; + } + const { sso_start_url, sso_account_id, sso_region, sso_role_name, sso_session } = validateSsoProfile( + profile, + init.logger + ); + return resolveSSOCredentials({ + ssoStartUrl: sso_start_url, + ssoSession: sso_session, + ssoAccountId: sso_account_id, + ssoRegion: sso_region, + ssoRoleName: sso_role_name, + ssoClient, + clientConfig: init.clientConfig, + profile: profileName + }); + } else if (!ssoStartUrl || !ssoAccountId || !ssoRegion || !ssoRoleName) { + throw new import_property_provider2.CredentialsProviderError( + 'Incomplete configuration. The fromSSO() argument hash must include "ssoStartUrl", "ssoAccountId", "ssoRegion", "ssoRoleName"', + { tryNextLink: false, logger: init.logger } + ); + } else { + return resolveSSOCredentials({ + ssoStartUrl, + ssoSession, + ssoAccountId, + ssoRegion, + ssoRoleName, + ssoClient, + clientConfig: init.clientConfig, + profile: profileName + }); + } + }, "fromSSO"); + } +}); + +// ../../../node_modules/@aws-sdk/client-sts/dist-cjs/auth/httpAuthSchemeProvider.js +var require_httpAuthSchemeProvider4 = __commonJS({ + "../../../node_modules/@aws-sdk/client-sts/dist-cjs/auth/httpAuthSchemeProvider.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.resolveHttpAuthSchemeConfig = exports2.resolveStsAuthConfig = exports2.defaultSTSHttpAuthSchemeProvider = exports2.defaultSTSHttpAuthSchemeParametersProvider = void 0; + var core_1 = (init_dist_es2(), __toCommonJS(dist_es_exports2)); + var util_middleware_1 = require_dist_cjs10(); + var STSClient_1 = require_STSClient(); + var defaultSTSHttpAuthSchemeParametersProvider = async (config, context, input) => { + return { + operation: (0, util_middleware_1.getSmithyContext)(context).operation, + region: await (0, util_middleware_1.normalizeProvider)(config.region)() || (() => { + throw new Error("expected `region` to be configured for `aws.auth#sigv4`"); + })() + }; }; - var de_TooManyTagsRes = async (parsedOutput, context) => { - const body = parsedOutput.body; - const deserialized = (0, smithy_client_1._json)(body); - const exception = new models_0_1.TooManyTags({ - $metadata: deserializeMetadata(parsedOutput), - ...deserialized - }); - return (0, smithy_client_1.decorateServiceException)(exception, body); + exports2.defaultSTSHttpAuthSchemeParametersProvider = defaultSTSHttpAuthSchemeParametersProvider; + function createAwsAuthSigv4HttpAuthOption(authParameters) { + return { + schemeId: "aws.auth#sigv4", + signingProperties: { + name: "sts", + region: authParameters.region + }, + propertiesExtractor: (config, context) => ({ + signingProperties: { + config, + context + } + }) + }; + } + function createSmithyApiNoAuthHttpAuthOption(authParameters) { + return { + schemeId: "smithy.api#noAuth" + }; + } + var defaultSTSHttpAuthSchemeProvider = (authParameters) => { + const options = []; + switch (authParameters.operation) { + case "AssumeRoleWithSAML": { + options.push(createSmithyApiNoAuthHttpAuthOption(authParameters)); + break; + } + case "AssumeRoleWithWebIdentity": { + options.push(createSmithyApiNoAuthHttpAuthOption(authParameters)); + break; + } + default: { + options.push(createAwsAuthSigv4HttpAuthOption(authParameters)); + } + } + return options; }; - var de_ValidationExceptionRes = async (parsedOutput, context) => { - const body = parsedOutput.body; - const deserialized = (0, smithy_client_1._json)(body); - const exception = new models_0_1.ValidationException({ - $metadata: deserializeMetadata(parsedOutput), - ...deserialized - }); - return (0, smithy_client_1.decorateServiceException)(exception, body); + exports2.defaultSTSHttpAuthSchemeProvider = defaultSTSHttpAuthSchemeProvider; + var resolveStsAuthConfig = (input) => ({ + ...input, + stsClientCtor: STSClient_1.STSClient + }); + exports2.resolveStsAuthConfig = resolveStsAuthConfig; + var resolveHttpAuthSchemeConfig = (config) => { + const config_0 = (0, exports2.resolveStsAuthConfig)(config); + const config_1 = (0, core_1.resolveAwsSdkSigV4Config)(config_0); + return { + ...config_1 + }; }; - var se_UpdateMapRunInput = (input, context) => { - return (0, smithy_client_1.take)(input, { - mapRunArn: [], - maxConcurrency: [], - toleratedFailureCount: [], - toleratedFailurePercentage: smithy_client_1.serializeFloat - }); + exports2.resolveHttpAuthSchemeConfig = resolveHttpAuthSchemeConfig; + } +}); + +// ../../../node_modules/@aws-sdk/client-sts/dist-cjs/endpoint/EndpointParameters.js +var require_EndpointParameters = __commonJS({ + "../../../node_modules/@aws-sdk/client-sts/dist-cjs/endpoint/EndpointParameters.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.commonParams = exports2.resolveClientEndpointParameters = void 0; + var resolveClientEndpointParameters = (options) => { + return { + ...options, + useDualstackEndpoint: options.useDualstackEndpoint ?? false, + useFipsEndpoint: options.useFipsEndpoint ?? false, + useGlobalEndpoint: options.useGlobalEndpoint ?? false, + defaultSigningName: "sts" + }; }; - var de_ActivityList = (output, context) => { - const retVal = (output || []).filter((e) => e != null).map((entry) => { - return de_ActivityListItem(entry, context); - }); - return retVal; + exports2.resolveClientEndpointParameters = resolveClientEndpointParameters; + exports2.commonParams = { + UseGlobalEndpoint: { type: "builtInParams", name: "useGlobalEndpoint" }, + UseFIPS: { type: "builtInParams", name: "useFipsEndpoint" }, + Endpoint: { type: "builtInParams", name: "endpoint" }, + Region: { type: "builtInParams", name: "region" }, + UseDualStack: { type: "builtInParams", name: "useDualstackEndpoint" } }; - var de_ActivityListItem = (output, context) => { - return (0, smithy_client_1.take)(output, { - activityArn: smithy_client_1.expectString, - creationDate: (_) => (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseEpochTimestamp)((0, smithy_client_1.expectNumber)(_))), - name: smithy_client_1.expectString - }); + } +}); + +// ../../../node_modules/@aws-sdk/client-sts/package.json +var require_package4 = __commonJS({ + "../../../node_modules/@aws-sdk/client-sts/package.json"(exports2, module2) { + module2.exports = { + name: "@aws-sdk/client-sts", + description: "AWS SDK for JavaScript Sts Client for Node.js, Browser and React Native", + version: "3.632.0", + scripts: { + build: "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'", + "build:cjs": "node ../../scripts/compilation/inline client-sts", + "build:es": "tsc -p tsconfig.es.json", + "build:include:deps": "lerna run --scope $npm_package_name --include-dependencies build", + "build:types": "rimraf ./dist-types tsconfig.types.tsbuildinfo && tsc -p tsconfig.types.json", + "build:types:downlevel": "downlevel-dts dist-types dist-types/ts3.4", + clean: "rimraf ./dist-* && rimraf *.tsbuildinfo", + "extract:docs": "api-extractor run --local", + "generate:client": "node ../../scripts/generate-clients/single-service --solo sts", + test: "yarn test:unit", + "test:unit": "jest" + }, + main: "./dist-cjs/index.js", + types: "./dist-types/index.d.ts", + module: "./dist-es/index.js", + sideEffects: false, + dependencies: { + "@aws-crypto/sha256-browser": "5.2.0", + "@aws-crypto/sha256-js": "5.2.0", + "@aws-sdk/client-sso-oidc": "3.632.0", + "@aws-sdk/core": "3.629.0", + "@aws-sdk/credential-provider-node": "3.632.0", + "@aws-sdk/middleware-host-header": "3.620.0", + "@aws-sdk/middleware-logger": "3.609.0", + "@aws-sdk/middleware-recursion-detection": "3.620.0", + "@aws-sdk/middleware-user-agent": "3.632.0", + "@aws-sdk/region-config-resolver": "3.614.0", + "@aws-sdk/types": "3.609.0", + "@aws-sdk/util-endpoints": "3.632.0", + "@aws-sdk/util-user-agent-browser": "3.609.0", + "@aws-sdk/util-user-agent-node": "3.614.0", + "@smithy/config-resolver": "^3.0.5", + "@smithy/core": "^2.3.2", + "@smithy/fetch-http-handler": "^3.2.4", + "@smithy/hash-node": "^3.0.3", + "@smithy/invalid-dependency": "^3.0.3", + "@smithy/middleware-content-length": "^3.0.5", + "@smithy/middleware-endpoint": "^3.1.0", + "@smithy/middleware-retry": "^3.0.14", + "@smithy/middleware-serde": "^3.0.3", + "@smithy/middleware-stack": "^3.0.3", + "@smithy/node-config-provider": "^3.1.4", + "@smithy/node-http-handler": "^3.1.4", + "@smithy/protocol-http": "^4.1.0", + "@smithy/smithy-client": "^3.1.12", + "@smithy/types": "^3.3.0", + "@smithy/url-parser": "^3.0.3", + "@smithy/util-base64": "^3.0.0", + "@smithy/util-body-length-browser": "^3.0.0", + "@smithy/util-body-length-node": "^3.0.0", + "@smithy/util-defaults-mode-browser": "^3.0.14", + "@smithy/util-defaults-mode-node": "^3.0.14", + "@smithy/util-endpoints": "^2.0.5", + "@smithy/util-middleware": "^3.0.3", + "@smithy/util-retry": "^3.0.3", + "@smithy/util-utf8": "^3.0.0", + tslib: "^2.6.2" + }, + devDependencies: { + "@tsconfig/node16": "16.1.3", + "@types/node": "^16.18.96", + concurrently: "7.0.0", + "downlevel-dts": "0.10.1", + rimraf: "3.0.2", + typescript: "~4.9.5" + }, + engines: { + node: ">=16.0.0" + }, + typesVersions: { + "<4.0": { + "dist-types/*": [ + "dist-types/ts3.4/*" + ] + } + }, + files: [ + "dist-*/**" + ], + author: { + name: "AWS SDK for JavaScript Team", + url: "https://aws.amazon.com/javascript/" + }, + license: "Apache-2.0", + browser: { + "./dist-es/runtimeConfig": "./dist-es/runtimeConfig.browser" + }, + "react-native": { + "./dist-es/runtimeConfig": "./dist-es/runtimeConfig.native" + }, + homepage: "https://github.com/aws/aws-sdk-js-v3/tree/main/clients/client-sts", + repository: { + type: "git", + url: "https://github.com/aws/aws-sdk-js-v3.git", + directory: "clients/client-sts" + } }; - var de_CreateActivityOutput = (output, context) => { - return (0, smithy_client_1.take)(output, { - activityArn: smithy_client_1.expectString, - creationDate: (_) => (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseEpochTimestamp)((0, smithy_client_1.expectNumber)(_))) + } +}); + +// ../../../node_modules/@aws-sdk/client-sts/dist-cjs/endpoint/ruleset.js +var require_ruleset3 = __commonJS({ + "../../../node_modules/@aws-sdk/client-sts/dist-cjs/endpoint/ruleset.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.ruleSet = void 0; + var F = "required"; + var G = "type"; + var H = "fn"; + var I = "argv"; + var J = "ref"; + var a = false; + var b = true; + var c = "booleanEquals"; + var d = "stringEquals"; + var e = "sigv4"; + var f = "sts"; + var g = "us-east-1"; + var h = "endpoint"; + var i = "https://sts.{Region}.{PartitionResult#dnsSuffix}"; + var j = "tree"; + var k = "error"; + var l = "getAttr"; + var m = { [F]: false, [G]: "String" }; + var n = { [F]: true, "default": false, [G]: "Boolean" }; + var o = { [J]: "Endpoint" }; + var p = { [H]: "isSet", [I]: [{ [J]: "Region" }] }; + var q = { [J]: "Region" }; + var r = { [H]: "aws.partition", [I]: [q], "assign": "PartitionResult" }; + var s = { [J]: "UseFIPS" }; + var t = { [J]: "UseDualStack" }; + var u = { "url": "https://sts.amazonaws.com", "properties": { "authSchemes": [{ "name": e, "signingName": f, "signingRegion": g }] }, "headers": {} }; + var v = {}; + var w = { "conditions": [{ [H]: d, [I]: [q, "aws-global"] }], [h]: u, [G]: h }; + var x = { [H]: c, [I]: [s, true] }; + var y = { [H]: c, [I]: [t, true] }; + var z = { [H]: l, [I]: [{ [J]: "PartitionResult" }, "supportsFIPS"] }; + var A = { [J]: "PartitionResult" }; + var B = { [H]: c, [I]: [true, { [H]: l, [I]: [A, "supportsDualStack"] }] }; + var C = [{ [H]: "isSet", [I]: [o] }]; + var D = [x]; + var E = [y]; + var _data = { version: "1.0", parameters: { Region: m, UseDualStack: n, UseFIPS: n, Endpoint: m, UseGlobalEndpoint: n }, rules: [{ conditions: [{ [H]: c, [I]: [{ [J]: "UseGlobalEndpoint" }, b] }, { [H]: "not", [I]: C }, p, r, { [H]: c, [I]: [s, a] }, { [H]: c, [I]: [t, a] }], rules: [{ conditions: [{ [H]: d, [I]: [q, "ap-northeast-1"] }], endpoint: u, [G]: h }, { conditions: [{ [H]: d, [I]: [q, "ap-south-1"] }], endpoint: u, [G]: h }, { conditions: [{ [H]: d, [I]: [q, "ap-southeast-1"] }], endpoint: u, [G]: h }, { conditions: [{ [H]: d, [I]: [q, "ap-southeast-2"] }], endpoint: u, [G]: h }, w, { conditions: [{ [H]: d, [I]: [q, "ca-central-1"] }], endpoint: u, [G]: h }, { conditions: [{ [H]: d, [I]: [q, "eu-central-1"] }], endpoint: u, [G]: h }, { conditions: [{ [H]: d, [I]: [q, "eu-north-1"] }], endpoint: u, [G]: h }, { conditions: [{ [H]: d, [I]: [q, "eu-west-1"] }], endpoint: u, [G]: h }, { conditions: [{ [H]: d, [I]: [q, "eu-west-2"] }], endpoint: u, [G]: h }, { conditions: [{ [H]: d, [I]: [q, "eu-west-3"] }], endpoint: u, [G]: h }, { conditions: [{ [H]: d, [I]: [q, "sa-east-1"] }], endpoint: u, [G]: h }, { conditions: [{ [H]: d, [I]: [q, g] }], endpoint: u, [G]: h }, { conditions: [{ [H]: d, [I]: [q, "us-east-2"] }], endpoint: u, [G]: h }, { conditions: [{ [H]: d, [I]: [q, "us-west-1"] }], endpoint: u, [G]: h }, { conditions: [{ [H]: d, [I]: [q, "us-west-2"] }], endpoint: u, [G]: h }, { endpoint: { url: i, properties: { authSchemes: [{ name: e, signingName: f, signingRegion: "{Region}" }] }, headers: v }, [G]: h }], [G]: j }, { conditions: C, rules: [{ conditions: D, error: "Invalid Configuration: FIPS and custom endpoint are not supported", [G]: k }, { conditions: E, error: "Invalid Configuration: Dualstack and custom endpoint are not supported", [G]: k }, { endpoint: { url: o, properties: v, headers: v }, [G]: h }], [G]: j }, { conditions: [p], rules: [{ conditions: [r], rules: [{ conditions: [x, y], rules: [{ conditions: [{ [H]: c, [I]: [b, z] }, B], rules: [{ endpoint: { url: "https://sts-fips.{Region}.{PartitionResult#dualStackDnsSuffix}", properties: v, headers: v }, [G]: h }], [G]: j }, { error: "FIPS and DualStack are enabled, but this partition does not support one or both", [G]: k }], [G]: j }, { conditions: D, rules: [{ conditions: [{ [H]: c, [I]: [z, b] }], rules: [{ conditions: [{ [H]: d, [I]: [{ [H]: l, [I]: [A, "name"] }, "aws-us-gov"] }], endpoint: { url: "https://sts.{Region}.amazonaws.com", properties: v, headers: v }, [G]: h }, { endpoint: { url: "https://sts-fips.{Region}.{PartitionResult#dnsSuffix}", properties: v, headers: v }, [G]: h }], [G]: j }, { error: "FIPS is enabled but this partition does not support FIPS", [G]: k }], [G]: j }, { conditions: E, rules: [{ conditions: [B], rules: [{ endpoint: { url: "https://sts.{Region}.{PartitionResult#dualStackDnsSuffix}", properties: v, headers: v }, [G]: h }], [G]: j }, { error: "DualStack is enabled but this partition does not support DualStack", [G]: k }], [G]: j }, w, { endpoint: { url: i, properties: v, headers: v }, [G]: h }], [G]: j }], [G]: j }, { error: "Invalid Configuration: Missing Region", [G]: k }] }; + exports2.ruleSet = _data; + } +}); + +// ../../../node_modules/@aws-sdk/client-sts/dist-cjs/endpoint/endpointResolver.js +var require_endpointResolver3 = __commonJS({ + "../../../node_modules/@aws-sdk/client-sts/dist-cjs/endpoint/endpointResolver.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.defaultEndpointResolver = void 0; + var util_endpoints_1 = require_dist_cjs7(); + var util_endpoints_2 = require_dist_cjs6(); + var ruleset_1 = require_ruleset3(); + var defaultEndpointResolver = (endpointParams, context = {}) => { + return (0, util_endpoints_2.resolveEndpoint)(ruleset_1.ruleSet, { + endpointParams, + logger: context.logger }); }; - var de_CreateStateMachineAliasOutput = (output, context) => { - return (0, smithy_client_1.take)(output, { - creationDate: (_) => (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseEpochTimestamp)((0, smithy_client_1.expectNumber)(_))), - stateMachineAliasArn: smithy_client_1.expectString - }); + exports2.defaultEndpointResolver = defaultEndpointResolver; + util_endpoints_2.customEndpointFunctions.aws = util_endpoints_1.awsEndpointFunctions; + } +}); + +// ../../../node_modules/@aws-sdk/client-sts/dist-cjs/runtimeConfig.shared.js +var require_runtimeConfig_shared3 = __commonJS({ + "../../../node_modules/@aws-sdk/client-sts/dist-cjs/runtimeConfig.shared.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.getRuntimeConfig = void 0; + var core_1 = (init_dist_es2(), __toCommonJS(dist_es_exports2)); + var core_2 = (init_dist_es(), __toCommonJS(dist_es_exports)); + var smithy_client_1 = require_dist_cjs37(); + var url_parser_1 = require_dist_cjs44(); + var util_base64_1 = require_dist_cjs29(); + var util_utf8_1 = require_dist_cjs28(); + var httpAuthSchemeProvider_1 = require_httpAuthSchemeProvider4(); + var endpointResolver_1 = require_endpointResolver3(); + var getRuntimeConfig = (config) => { + return { + apiVersion: "2011-06-15", + base64Decoder: config?.base64Decoder ?? util_base64_1.fromBase64, + base64Encoder: config?.base64Encoder ?? util_base64_1.toBase64, + disableHostPrefix: config?.disableHostPrefix ?? false, + endpointProvider: config?.endpointProvider ?? endpointResolver_1.defaultEndpointResolver, + extensions: config?.extensions ?? [], + httpAuthSchemeProvider: config?.httpAuthSchemeProvider ?? httpAuthSchemeProvider_1.defaultSTSHttpAuthSchemeProvider, + httpAuthSchemes: config?.httpAuthSchemes ?? [ + { + schemeId: "aws.auth#sigv4", + identityProvider: (ipc) => ipc.getIdentityProvider("aws.auth#sigv4"), + signer: new core_1.AwsSdkSigV4Signer() + }, + { + schemeId: "smithy.api#noAuth", + identityProvider: (ipc) => ipc.getIdentityProvider("smithy.api#noAuth") || (async () => ({})), + signer: new core_2.NoAuthSigner() + } + ], + logger: config?.logger ?? new smithy_client_1.NoOpLogger(), + serviceId: config?.serviceId ?? "STS", + urlParser: config?.urlParser ?? url_parser_1.parseUrl, + utf8Decoder: config?.utf8Decoder ?? util_utf8_1.fromUtf8, + utf8Encoder: config?.utf8Encoder ?? util_utf8_1.toUtf8 + }; }; - var de_CreateStateMachineOutput = (output, context) => { - return (0, smithy_client_1.take)(output, { - creationDate: (_) => (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseEpochTimestamp)((0, smithy_client_1.expectNumber)(_))), - stateMachineArn: smithy_client_1.expectString, - stateMachineVersionArn: smithy_client_1.expectString - }); + exports2.getRuntimeConfig = getRuntimeConfig; + } +}); + +// ../../../node_modules/@aws-sdk/client-sts/dist-cjs/runtimeConfig.js +var require_runtimeConfig3 = __commonJS({ + "../../../node_modules/@aws-sdk/client-sts/dist-cjs/runtimeConfig.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.getRuntimeConfig = void 0; + var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports)); + var package_json_1 = tslib_1.__importDefault(require_package4()); + var core_1 = (init_dist_es2(), __toCommonJS(dist_es_exports2)); + var credential_provider_node_1 = require_dist_cjs79(); + var util_user_agent_node_1 = require_dist_cjs56(); + var config_resolver_1 = require_dist_cjs11(); + var core_2 = (init_dist_es(), __toCommonJS(dist_es_exports)); + var hash_node_1 = require_dist_cjs57(); + var middleware_retry_1 = require_dist_cjs38(); + var node_config_provider_1 = require_dist_cjs42(); + var node_http_handler_1 = require_dist_cjs51(); + var util_body_length_node_1 = require_dist_cjs58(); + var util_retry_1 = require_dist_cjs60(); + var runtimeConfig_shared_1 = require_runtimeConfig_shared3(); + var smithy_client_1 = require_dist_cjs37(); + var util_defaults_mode_node_1 = require_dist_cjs69(); + var smithy_client_2 = require_dist_cjs37(); + var getRuntimeConfig = (config) => { + (0, smithy_client_2.emitWarningIfUnsupportedVersion)(process.version); + const defaultsMode = (0, util_defaults_mode_node_1.resolveDefaultsModeConfig)(config); + const defaultConfigProvider = () => defaultsMode().then(smithy_client_1.loadConfigsForDefaultMode); + const clientSharedValues = (0, runtimeConfig_shared_1.getRuntimeConfig)(config); + (0, core_1.emitWarningIfUnsupportedVersion)(process.version); + return { + ...clientSharedValues, + ...config, + runtime: "node", + defaultsMode, + bodyLengthChecker: config?.bodyLengthChecker ?? util_body_length_node_1.calculateBodyLength, + credentialDefaultProvider: config?.credentialDefaultProvider ?? credential_provider_node_1.defaultProvider, + defaultUserAgentProvider: config?.defaultUserAgentProvider ?? (0, util_user_agent_node_1.defaultUserAgent)({ serviceId: clientSharedValues.serviceId, clientVersion: package_json_1.default.version }), + httpAuthSchemes: config?.httpAuthSchemes ?? [ + { + schemeId: "aws.auth#sigv4", + identityProvider: (ipc) => ipc.getIdentityProvider("aws.auth#sigv4") || (async (idProps) => await (0, credential_provider_node_1.defaultProvider)(idProps?.__config || {})()), + signer: new core_1.AwsSdkSigV4Signer() + }, + { + schemeId: "smithy.api#noAuth", + identityProvider: (ipc) => ipc.getIdentityProvider("smithy.api#noAuth") || (async () => ({})), + signer: new core_2.NoAuthSigner() + } + ], + maxAttempts: config?.maxAttempts ?? (0, node_config_provider_1.loadConfig)(middleware_retry_1.NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config?.region ?? (0, node_config_provider_1.loadConfig)(config_resolver_1.NODE_REGION_CONFIG_OPTIONS, config_resolver_1.NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: node_http_handler_1.NodeHttpHandler.create(config?.requestHandler ?? defaultConfigProvider), + retryMode: config?.retryMode ?? (0, node_config_provider_1.loadConfig)({ + ...middleware_retry_1.NODE_RETRY_MODE_CONFIG_OPTIONS, + default: async () => (await defaultConfigProvider()).retryMode || util_retry_1.DEFAULT_RETRY_MODE + }), + sha256: config?.sha256 ?? hash_node_1.Hash.bind(null, "sha256"), + streamCollector: config?.streamCollector ?? node_http_handler_1.streamCollector, + useDualstackEndpoint: config?.useDualstackEndpoint ?? (0, node_config_provider_1.loadConfig)(config_resolver_1.NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS), + useFipsEndpoint: config?.useFipsEndpoint ?? (0, node_config_provider_1.loadConfig)(config_resolver_1.NODE_USE_FIPS_ENDPOINT_CONFIG_OPTIONS) + }; }; - var de_DescribeActivityOutput = (output, context) => { - return (0, smithy_client_1.take)(output, { - activityArn: smithy_client_1.expectString, - creationDate: (_) => (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseEpochTimestamp)((0, smithy_client_1.expectNumber)(_))), - name: smithy_client_1.expectString - }); + exports2.getRuntimeConfig = getRuntimeConfig; + } +}); + +// ../../../node_modules/@aws-sdk/client-sts/dist-cjs/auth/httpAuthExtensionConfiguration.js +var require_httpAuthExtensionConfiguration = __commonJS({ + "../../../node_modules/@aws-sdk/client-sts/dist-cjs/auth/httpAuthExtensionConfiguration.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.resolveHttpAuthRuntimeConfig = exports2.getHttpAuthExtensionConfiguration = void 0; + var getHttpAuthExtensionConfiguration = (runtimeConfig) => { + const _httpAuthSchemes = runtimeConfig.httpAuthSchemes; + let _httpAuthSchemeProvider = runtimeConfig.httpAuthSchemeProvider; + let _credentials = runtimeConfig.credentials; + return { + setHttpAuthScheme(httpAuthScheme) { + const index = _httpAuthSchemes.findIndex((scheme) => scheme.schemeId === httpAuthScheme.schemeId); + if (index === -1) { + _httpAuthSchemes.push(httpAuthScheme); + } else { + _httpAuthSchemes.splice(index, 1, httpAuthScheme); + } + }, + httpAuthSchemes() { + return _httpAuthSchemes; + }, + setHttpAuthSchemeProvider(httpAuthSchemeProvider) { + _httpAuthSchemeProvider = httpAuthSchemeProvider; + }, + httpAuthSchemeProvider() { + return _httpAuthSchemeProvider; + }, + setCredentials(credentials) { + _credentials = credentials; + }, + credentials() { + return _credentials; + } + }; }; - var de_DescribeExecutionOutput = (output, context) => { - return (0, smithy_client_1.take)(output, { - cause: smithy_client_1.expectString, - error: smithy_client_1.expectString, - executionArn: smithy_client_1.expectString, - input: smithy_client_1.expectString, - inputDetails: smithy_client_1._json, - mapRunArn: smithy_client_1.expectString, - name: smithy_client_1.expectString, - output: smithy_client_1.expectString, - outputDetails: smithy_client_1._json, - startDate: (_) => (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseEpochTimestamp)((0, smithy_client_1.expectNumber)(_))), - stateMachineAliasArn: smithy_client_1.expectString, - stateMachineArn: smithy_client_1.expectString, - stateMachineVersionArn: smithy_client_1.expectString, - status: smithy_client_1.expectString, - stopDate: (_) => (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseEpochTimestamp)((0, smithy_client_1.expectNumber)(_))), - traceHeader: smithy_client_1.expectString - }); + exports2.getHttpAuthExtensionConfiguration = getHttpAuthExtensionConfiguration; + var resolveHttpAuthRuntimeConfig = (config) => { + return { + httpAuthSchemes: config.httpAuthSchemes(), + httpAuthSchemeProvider: config.httpAuthSchemeProvider(), + credentials: config.credentials() + }; }; - var de_DescribeMapRunOutput = (output, context) => { - return (0, smithy_client_1.take)(output, { - executionArn: smithy_client_1.expectString, - executionCounts: smithy_client_1._json, - itemCounts: smithy_client_1._json, - mapRunArn: smithy_client_1.expectString, - maxConcurrency: smithy_client_1.expectInt32, - startDate: (_) => (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseEpochTimestamp)((0, smithy_client_1.expectNumber)(_))), - status: smithy_client_1.expectString, - stopDate: (_) => (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseEpochTimestamp)((0, smithy_client_1.expectNumber)(_))), - toleratedFailureCount: smithy_client_1.expectLong, - toleratedFailurePercentage: smithy_client_1.limitedParseFloat32 - }); + exports2.resolveHttpAuthRuntimeConfig = resolveHttpAuthRuntimeConfig; + } +}); + +// ../../../node_modules/@aws-sdk/client-sts/dist-cjs/runtimeExtensions.js +var require_runtimeExtensions = __commonJS({ + "../../../node_modules/@aws-sdk/client-sts/dist-cjs/runtimeExtensions.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.resolveRuntimeExtensions = void 0; + var region_config_resolver_1 = require_dist_cjs70(); + var protocol_http_1 = require_dist_cjs2(); + var smithy_client_1 = require_dist_cjs37(); + var httpAuthExtensionConfiguration_1 = require_httpAuthExtensionConfiguration(); + var asPartial = (t) => t; + var resolveRuntimeExtensions = (runtimeConfig, extensions) => { + const extensionConfiguration = { + ...asPartial((0, region_config_resolver_1.getAwsRegionExtensionConfiguration)(runtimeConfig)), + ...asPartial((0, smithy_client_1.getDefaultExtensionConfiguration)(runtimeConfig)), + ...asPartial((0, protocol_http_1.getHttpHandlerExtensionConfiguration)(runtimeConfig)), + ...asPartial((0, httpAuthExtensionConfiguration_1.getHttpAuthExtensionConfiguration)(runtimeConfig)) + }; + extensions.forEach((extension) => extension.configure(extensionConfiguration)); + return { + ...runtimeConfig, + ...(0, region_config_resolver_1.resolveAwsRegionExtensionConfiguration)(extensionConfiguration), + ...(0, smithy_client_1.resolveDefaultRuntimeConfig)(extensionConfiguration), + ...(0, protocol_http_1.resolveHttpHandlerRuntimeConfig)(extensionConfiguration), + ...(0, httpAuthExtensionConfiguration_1.resolveHttpAuthRuntimeConfig)(extensionConfiguration) + }; }; - var de_DescribeStateMachineAliasOutput = (output, context) => { - return (0, smithy_client_1.take)(output, { - creationDate: (_) => (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseEpochTimestamp)((0, smithy_client_1.expectNumber)(_))), - description: smithy_client_1.expectString, - name: smithy_client_1.expectString, - routingConfiguration: smithy_client_1._json, - stateMachineAliasArn: smithy_client_1.expectString, - updateDate: (_) => (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseEpochTimestamp)((0, smithy_client_1.expectNumber)(_))) - }); + exports2.resolveRuntimeExtensions = resolveRuntimeExtensions; + } +}); + +// ../../../node_modules/@aws-sdk/client-sts/dist-cjs/STSClient.js +var require_STSClient = __commonJS({ + "../../../node_modules/@aws-sdk/client-sts/dist-cjs/STSClient.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.STSClient = exports2.__Client = void 0; + var middleware_host_header_1 = require_dist_cjs3(); + var middleware_logger_1 = require_dist_cjs4(); + var middleware_recursion_detection_1 = require_dist_cjs5(); + var middleware_user_agent_1 = require_dist_cjs8(); + var config_resolver_1 = require_dist_cjs11(); + var core_1 = (init_dist_es(), __toCommonJS(dist_es_exports)); + var middleware_content_length_1 = require_dist_cjs39(); + var middleware_endpoint_1 = require_dist_cjs46(); + var middleware_retry_1 = require_dist_cjs38(); + var smithy_client_1 = require_dist_cjs37(); + Object.defineProperty(exports2, "__Client", { enumerable: true, get: function() { + return smithy_client_1.Client; + } }); + var httpAuthSchemeProvider_1 = require_httpAuthSchemeProvider4(); + var EndpointParameters_1 = require_EndpointParameters(); + var runtimeConfig_1 = require_runtimeConfig3(); + var runtimeExtensions_1 = require_runtimeExtensions(); + var STSClient2 = class extends smithy_client_1.Client { + constructor(...[configuration]) { + const _config_0 = (0, runtimeConfig_1.getRuntimeConfig)(configuration || {}); + const _config_1 = (0, EndpointParameters_1.resolveClientEndpointParameters)(_config_0); + const _config_2 = (0, middleware_user_agent_1.resolveUserAgentConfig)(_config_1); + const _config_3 = (0, middleware_retry_1.resolveRetryConfig)(_config_2); + const _config_4 = (0, config_resolver_1.resolveRegionConfig)(_config_3); + const _config_5 = (0, middleware_host_header_1.resolveHostHeaderConfig)(_config_4); + const _config_6 = (0, middleware_endpoint_1.resolveEndpointConfig)(_config_5); + const _config_7 = (0, httpAuthSchemeProvider_1.resolveHttpAuthSchemeConfig)(_config_6); + const _config_8 = (0, runtimeExtensions_1.resolveRuntimeExtensions)(_config_7, configuration?.extensions || []); + super(_config_8); + this.config = _config_8; + this.middlewareStack.use((0, middleware_user_agent_1.getUserAgentPlugin)(this.config)); + this.middlewareStack.use((0, middleware_retry_1.getRetryPlugin)(this.config)); + this.middlewareStack.use((0, middleware_content_length_1.getContentLengthPlugin)(this.config)); + this.middlewareStack.use((0, middleware_host_header_1.getHostHeaderPlugin)(this.config)); + this.middlewareStack.use((0, middleware_logger_1.getLoggerPlugin)(this.config)); + this.middlewareStack.use((0, middleware_recursion_detection_1.getRecursionDetectionPlugin)(this.config)); + this.middlewareStack.use((0, core_1.getHttpAuthSchemeEndpointRuleSetPlugin)(this.config, { + httpAuthSchemeParametersProvider: httpAuthSchemeProvider_1.defaultSTSHttpAuthSchemeParametersProvider, + identityProviderConfigProvider: async (config) => new core_1.DefaultIdentityProviderConfig({ + "aws.auth#sigv4": config.credentials + }) + })); + this.middlewareStack.use((0, core_1.getHttpSigningPlugin)(this.config)); + } + destroy() { + super.destroy(); + } }; - var de_DescribeStateMachineForExecutionOutput = (output, context) => { - return (0, smithy_client_1.take)(output, { - definition: smithy_client_1.expectString, - label: smithy_client_1.expectString, - loggingConfiguration: smithy_client_1._json, - mapRunArn: smithy_client_1.expectString, - name: smithy_client_1.expectString, - revisionId: smithy_client_1.expectString, - roleArn: smithy_client_1.expectString, - stateMachineArn: smithy_client_1.expectString, - tracingConfiguration: smithy_client_1._json, - updateDate: (_) => (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseEpochTimestamp)((0, smithy_client_1.expectNumber)(_))) - }); + exports2.STSClient = STSClient2; + } +}); + +// ../../../node_modules/@aws-sdk/client-sts/dist-cjs/index.js +var require_dist_cjs75 = __commonJS({ + "../../../node_modules/@aws-sdk/client-sts/dist-cjs/index.js"(exports2, module2) { + "use strict"; + var __defProp2 = Object.defineProperty; + var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; + var __getOwnPropNames2 = Object.getOwnPropertyNames; + var __hasOwnProp2 = Object.prototype.hasOwnProperty; + var __name = (target, value) => __defProp2(target, "name", { value, configurable: true }); + var __export2 = (target, all) => { + for (var name in all) + __defProp2(target, name, { get: all[name], enumerable: true }); }; - var de_DescribeStateMachineOutput = (output, context) => { - return (0, smithy_client_1.take)(output, { - creationDate: (_) => (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseEpochTimestamp)((0, smithy_client_1.expectNumber)(_))), - definition: smithy_client_1.expectString, - description: smithy_client_1.expectString, - label: smithy_client_1.expectString, - loggingConfiguration: smithy_client_1._json, - name: smithy_client_1.expectString, - revisionId: smithy_client_1.expectString, - roleArn: smithy_client_1.expectString, - stateMachineArn: smithy_client_1.expectString, - status: smithy_client_1.expectString, - tracingConfiguration: smithy_client_1._json, - type: smithy_client_1.expectString - }); + var __copyProps2 = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames2(from)) + if (!__hasOwnProp2.call(to, key) && key !== except) + __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable }); + } + return to; }; - var de_ExecutionList = (output, context) => { - const retVal = (output || []).filter((e) => e != null).map((entry) => { - return de_ExecutionListItem(entry, context); - }); - return retVal; + var __reExport = (target, mod, secondTarget) => (__copyProps2(target, mod, "default"), secondTarget && __copyProps2(secondTarget, mod, "default")); + var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); + var src_exports = {}; + __export2(src_exports, { + AssumeRoleCommand: () => AssumeRoleCommand, + AssumeRoleResponseFilterSensitiveLog: () => AssumeRoleResponseFilterSensitiveLog, + AssumeRoleWithSAMLCommand: () => AssumeRoleWithSAMLCommand, + AssumeRoleWithSAMLRequestFilterSensitiveLog: () => AssumeRoleWithSAMLRequestFilterSensitiveLog, + AssumeRoleWithSAMLResponseFilterSensitiveLog: () => AssumeRoleWithSAMLResponseFilterSensitiveLog, + AssumeRoleWithWebIdentityCommand: () => AssumeRoleWithWebIdentityCommand, + AssumeRoleWithWebIdentityRequestFilterSensitiveLog: () => AssumeRoleWithWebIdentityRequestFilterSensitiveLog, + AssumeRoleWithWebIdentityResponseFilterSensitiveLog: () => AssumeRoleWithWebIdentityResponseFilterSensitiveLog, + ClientInputEndpointParameters: () => import_EndpointParameters9.ClientInputEndpointParameters, + CredentialsFilterSensitiveLog: () => CredentialsFilterSensitiveLog, + DecodeAuthorizationMessageCommand: () => DecodeAuthorizationMessageCommand, + ExpiredTokenException: () => ExpiredTokenException, + GetAccessKeyInfoCommand: () => GetAccessKeyInfoCommand, + GetCallerIdentityCommand: () => GetCallerIdentityCommand, + GetFederationTokenCommand: () => GetFederationTokenCommand, + GetFederationTokenResponseFilterSensitiveLog: () => GetFederationTokenResponseFilterSensitiveLog, + GetSessionTokenCommand: () => GetSessionTokenCommand, + GetSessionTokenResponseFilterSensitiveLog: () => GetSessionTokenResponseFilterSensitiveLog, + IDPCommunicationErrorException: () => IDPCommunicationErrorException, + IDPRejectedClaimException: () => IDPRejectedClaimException, + InvalidAuthorizationMessageException: () => InvalidAuthorizationMessageException, + InvalidIdentityTokenException: () => InvalidIdentityTokenException, + MalformedPolicyDocumentException: () => MalformedPolicyDocumentException, + PackedPolicyTooLargeException: () => PackedPolicyTooLargeException, + RegionDisabledException: () => RegionDisabledException, + STS: () => STS, + STSServiceException: () => STSServiceException, + decorateDefaultCredentialProvider: () => decorateDefaultCredentialProvider, + getDefaultRoleAssumer: () => getDefaultRoleAssumer2, + getDefaultRoleAssumerWithWebIdentity: () => getDefaultRoleAssumerWithWebIdentity2 + }); + module2.exports = __toCommonJS2(src_exports); + __reExport(src_exports, require_STSClient(), module2.exports); + var import_middleware_endpoint2 = require_dist_cjs46(); + var import_middleware_serde2 = require_dist_cjs45(); + var import_EndpointParameters = require_EndpointParameters(); + var import_smithy_client5 = require_dist_cjs37(); + var _STSServiceException = class _STSServiceException2 extends import_smithy_client5.ServiceException { + /** + * @internal + */ + constructor(options) { + super(options); + Object.setPrototypeOf(this, _STSServiceException2.prototype); + } }; - var de_ExecutionListItem = (output, context) => { - return (0, smithy_client_1.take)(output, { - executionArn: smithy_client_1.expectString, - itemCount: smithy_client_1.expectInt32, - mapRunArn: smithy_client_1.expectString, - name: smithy_client_1.expectString, - startDate: (_) => (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseEpochTimestamp)((0, smithy_client_1.expectNumber)(_))), - stateMachineAliasArn: smithy_client_1.expectString, - stateMachineArn: smithy_client_1.expectString, - stateMachineVersionArn: smithy_client_1.expectString, - status: smithy_client_1.expectString, - stopDate: (_) => (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseEpochTimestamp)((0, smithy_client_1.expectNumber)(_))) - }); + __name(_STSServiceException, "STSServiceException"); + var STSServiceException = _STSServiceException; + var _ExpiredTokenException = class _ExpiredTokenException2 extends STSServiceException { + /** + * @internal + */ + constructor(opts) { + super({ + name: "ExpiredTokenException", + $fault: "client", + ...opts + }); + this.name = "ExpiredTokenException"; + this.$fault = "client"; + Object.setPrototypeOf(this, _ExpiredTokenException2.prototype); + } }; - var de_GetExecutionHistoryOutput = (output, context) => { - return (0, smithy_client_1.take)(output, { - events: (_) => de_HistoryEventList(_, context), - nextToken: smithy_client_1.expectString - }); + __name(_ExpiredTokenException, "ExpiredTokenException"); + var ExpiredTokenException = _ExpiredTokenException; + var _MalformedPolicyDocumentException = class _MalformedPolicyDocumentException2 extends STSServiceException { + /** + * @internal + */ + constructor(opts) { + super({ + name: "MalformedPolicyDocumentException", + $fault: "client", + ...opts + }); + this.name = "MalformedPolicyDocumentException"; + this.$fault = "client"; + Object.setPrototypeOf(this, _MalformedPolicyDocumentException2.prototype); + } }; - var de_HistoryEvent = (output, context) => { - return (0, smithy_client_1.take)(output, { - activityFailedEventDetails: smithy_client_1._json, - activityScheduleFailedEventDetails: smithy_client_1._json, - activityScheduledEventDetails: smithy_client_1._json, - activityStartedEventDetails: smithy_client_1._json, - activitySucceededEventDetails: smithy_client_1._json, - activityTimedOutEventDetails: smithy_client_1._json, - executionAbortedEventDetails: smithy_client_1._json, - executionFailedEventDetails: smithy_client_1._json, - executionStartedEventDetails: smithy_client_1._json, - executionSucceededEventDetails: smithy_client_1._json, - executionTimedOutEventDetails: smithy_client_1._json, - id: smithy_client_1.expectLong, - lambdaFunctionFailedEventDetails: smithy_client_1._json, - lambdaFunctionScheduleFailedEventDetails: smithy_client_1._json, - lambdaFunctionScheduledEventDetails: smithy_client_1._json, - lambdaFunctionStartFailedEventDetails: smithy_client_1._json, - lambdaFunctionSucceededEventDetails: smithy_client_1._json, - lambdaFunctionTimedOutEventDetails: smithy_client_1._json, - mapIterationAbortedEventDetails: smithy_client_1._json, - mapIterationFailedEventDetails: smithy_client_1._json, - mapIterationStartedEventDetails: smithy_client_1._json, - mapIterationSucceededEventDetails: smithy_client_1._json, - mapRunFailedEventDetails: smithy_client_1._json, - mapRunStartedEventDetails: smithy_client_1._json, - mapStateStartedEventDetails: smithy_client_1._json, - previousEventId: smithy_client_1.expectLong, - stateEnteredEventDetails: smithy_client_1._json, - stateExitedEventDetails: smithy_client_1._json, - taskFailedEventDetails: smithy_client_1._json, - taskScheduledEventDetails: smithy_client_1._json, - taskStartFailedEventDetails: smithy_client_1._json, - taskStartedEventDetails: smithy_client_1._json, - taskSubmitFailedEventDetails: smithy_client_1._json, - taskSubmittedEventDetails: smithy_client_1._json, - taskSucceededEventDetails: smithy_client_1._json, - taskTimedOutEventDetails: smithy_client_1._json, - timestamp: (_) => (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseEpochTimestamp)((0, smithy_client_1.expectNumber)(_))), - type: smithy_client_1.expectString - }); + __name(_MalformedPolicyDocumentException, "MalformedPolicyDocumentException"); + var MalformedPolicyDocumentException = _MalformedPolicyDocumentException; + var _PackedPolicyTooLargeException = class _PackedPolicyTooLargeException2 extends STSServiceException { + /** + * @internal + */ + constructor(opts) { + super({ + name: "PackedPolicyTooLargeException", + $fault: "client", + ...opts + }); + this.name = "PackedPolicyTooLargeException"; + this.$fault = "client"; + Object.setPrototypeOf(this, _PackedPolicyTooLargeException2.prototype); + } }; - var de_HistoryEventList = (output, context) => { - const retVal = (output || []).filter((e) => e != null).map((entry) => { - return de_HistoryEvent(entry, context); - }); - return retVal; + __name(_PackedPolicyTooLargeException, "PackedPolicyTooLargeException"); + var PackedPolicyTooLargeException = _PackedPolicyTooLargeException; + var _RegionDisabledException = class _RegionDisabledException2 extends STSServiceException { + /** + * @internal + */ + constructor(opts) { + super({ + name: "RegionDisabledException", + $fault: "client", + ...opts + }); + this.name = "RegionDisabledException"; + this.$fault = "client"; + Object.setPrototypeOf(this, _RegionDisabledException2.prototype); + } }; - var de_ListActivitiesOutput = (output, context) => { - return (0, smithy_client_1.take)(output, { - activities: (_) => de_ActivityList(_, context), - nextToken: smithy_client_1.expectString - }); + __name(_RegionDisabledException, "RegionDisabledException"); + var RegionDisabledException = _RegionDisabledException; + var _IDPRejectedClaimException = class _IDPRejectedClaimException2 extends STSServiceException { + /** + * @internal + */ + constructor(opts) { + super({ + name: "IDPRejectedClaimException", + $fault: "client", + ...opts + }); + this.name = "IDPRejectedClaimException"; + this.$fault = "client"; + Object.setPrototypeOf(this, _IDPRejectedClaimException2.prototype); + } }; - var de_ListExecutionsOutput = (output, context) => { - return (0, smithy_client_1.take)(output, { - executions: (_) => de_ExecutionList(_, context), - nextToken: smithy_client_1.expectString - }); + __name(_IDPRejectedClaimException, "IDPRejectedClaimException"); + var IDPRejectedClaimException = _IDPRejectedClaimException; + var _InvalidIdentityTokenException = class _InvalidIdentityTokenException2 extends STSServiceException { + /** + * @internal + */ + constructor(opts) { + super({ + name: "InvalidIdentityTokenException", + $fault: "client", + ...opts + }); + this.name = "InvalidIdentityTokenException"; + this.$fault = "client"; + Object.setPrototypeOf(this, _InvalidIdentityTokenException2.prototype); + } }; - var de_ListMapRunsOutput = (output, context) => { - return (0, smithy_client_1.take)(output, { - mapRuns: (_) => de_MapRunList(_, context), - nextToken: smithy_client_1.expectString - }); + __name(_InvalidIdentityTokenException, "InvalidIdentityTokenException"); + var InvalidIdentityTokenException = _InvalidIdentityTokenException; + var _IDPCommunicationErrorException = class _IDPCommunicationErrorException2 extends STSServiceException { + /** + * @internal + */ + constructor(opts) { + super({ + name: "IDPCommunicationErrorException", + $fault: "client", + ...opts + }); + this.name = "IDPCommunicationErrorException"; + this.$fault = "client"; + Object.setPrototypeOf(this, _IDPCommunicationErrorException2.prototype); + } }; - var de_ListStateMachineAliasesOutput = (output, context) => { - return (0, smithy_client_1.take)(output, { - nextToken: smithy_client_1.expectString, - stateMachineAliases: (_) => de_StateMachineAliasList(_, context) - }); + __name(_IDPCommunicationErrorException, "IDPCommunicationErrorException"); + var IDPCommunicationErrorException = _IDPCommunicationErrorException; + var _InvalidAuthorizationMessageException = class _InvalidAuthorizationMessageException2 extends STSServiceException { + /** + * @internal + */ + constructor(opts) { + super({ + name: "InvalidAuthorizationMessageException", + $fault: "client", + ...opts + }); + this.name = "InvalidAuthorizationMessageException"; + this.$fault = "client"; + Object.setPrototypeOf(this, _InvalidAuthorizationMessageException2.prototype); + } }; - var de_ListStateMachinesOutput = (output, context) => { - return (0, smithy_client_1.take)(output, { - nextToken: smithy_client_1.expectString, - stateMachines: (_) => de_StateMachineList(_, context) + __name(_InvalidAuthorizationMessageException, "InvalidAuthorizationMessageException"); + var InvalidAuthorizationMessageException = _InvalidAuthorizationMessageException; + var CredentialsFilterSensitiveLog = /* @__PURE__ */ __name((obj) => ({ + ...obj, + ...obj.SecretAccessKey && { SecretAccessKey: import_smithy_client5.SENSITIVE_STRING } + }), "CredentialsFilterSensitiveLog"); + var AssumeRoleResponseFilterSensitiveLog = /* @__PURE__ */ __name((obj) => ({ + ...obj, + ...obj.Credentials && { Credentials: CredentialsFilterSensitiveLog(obj.Credentials) } + }), "AssumeRoleResponseFilterSensitiveLog"); + var AssumeRoleWithSAMLRequestFilterSensitiveLog = /* @__PURE__ */ __name((obj) => ({ + ...obj, + ...obj.SAMLAssertion && { SAMLAssertion: import_smithy_client5.SENSITIVE_STRING } + }), "AssumeRoleWithSAMLRequestFilterSensitiveLog"); + var AssumeRoleWithSAMLResponseFilterSensitiveLog = /* @__PURE__ */ __name((obj) => ({ + ...obj, + ...obj.Credentials && { Credentials: CredentialsFilterSensitiveLog(obj.Credentials) } + }), "AssumeRoleWithSAMLResponseFilterSensitiveLog"); + var AssumeRoleWithWebIdentityRequestFilterSensitiveLog = /* @__PURE__ */ __name((obj) => ({ + ...obj, + ...obj.WebIdentityToken && { WebIdentityToken: import_smithy_client5.SENSITIVE_STRING } + }), "AssumeRoleWithWebIdentityRequestFilterSensitiveLog"); + var AssumeRoleWithWebIdentityResponseFilterSensitiveLog = /* @__PURE__ */ __name((obj) => ({ + ...obj, + ...obj.Credentials && { Credentials: CredentialsFilterSensitiveLog(obj.Credentials) } + }), "AssumeRoleWithWebIdentityResponseFilterSensitiveLog"); + var GetFederationTokenResponseFilterSensitiveLog = /* @__PURE__ */ __name((obj) => ({ + ...obj, + ...obj.Credentials && { Credentials: CredentialsFilterSensitiveLog(obj.Credentials) } + }), "GetFederationTokenResponseFilterSensitiveLog"); + var GetSessionTokenResponseFilterSensitiveLog = /* @__PURE__ */ __name((obj) => ({ + ...obj, + ...obj.Credentials && { Credentials: CredentialsFilterSensitiveLog(obj.Credentials) } + }), "GetSessionTokenResponseFilterSensitiveLog"); + var import_core3 = (init_dist_es2(), __toCommonJS(dist_es_exports2)); + var import_protocol_http8 = require_dist_cjs2(); + var se_AssumeRoleCommand = /* @__PURE__ */ __name(async (input, context) => { + const headers = SHARED_HEADERS; + let body; + body = buildFormUrlencodedString({ + ...se_AssumeRoleRequest(input, context), + [_A]: _AR, + [_V]: _ }); - }; - var de_ListStateMachineVersionsOutput = (output, context) => { - return (0, smithy_client_1.take)(output, { - nextToken: smithy_client_1.expectString, - stateMachineVersions: (_) => de_StateMachineVersionList(_, context) + return buildHttpRpcRequest(context, headers, "/", void 0, body); + }, "se_AssumeRoleCommand"); + var se_AssumeRoleWithSAMLCommand = /* @__PURE__ */ __name(async (input, context) => { + const headers = SHARED_HEADERS; + let body; + body = buildFormUrlencodedString({ + ...se_AssumeRoleWithSAMLRequest(input, context), + [_A]: _ARWSAML, + [_V]: _ }); - }; - var de_MapRunList = (output, context) => { - const retVal = (output || []).filter((e) => e != null).map((entry) => { - return de_MapRunListItem(entry, context); + return buildHttpRpcRequest(context, headers, "/", void 0, body); + }, "se_AssumeRoleWithSAMLCommand"); + var se_AssumeRoleWithWebIdentityCommand = /* @__PURE__ */ __name(async (input, context) => { + const headers = SHARED_HEADERS; + let body; + body = buildFormUrlencodedString({ + ...se_AssumeRoleWithWebIdentityRequest(input, context), + [_A]: _ARWWI, + [_V]: _ }); - return retVal; - }; - var de_MapRunListItem = (output, context) => { - return (0, smithy_client_1.take)(output, { - executionArn: smithy_client_1.expectString, - mapRunArn: smithy_client_1.expectString, - startDate: (_) => (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseEpochTimestamp)((0, smithy_client_1.expectNumber)(_))), - stateMachineArn: smithy_client_1.expectString, - stopDate: (_) => (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseEpochTimestamp)((0, smithy_client_1.expectNumber)(_))) + return buildHttpRpcRequest(context, headers, "/", void 0, body); + }, "se_AssumeRoleWithWebIdentityCommand"); + var se_DecodeAuthorizationMessageCommand = /* @__PURE__ */ __name(async (input, context) => { + const headers = SHARED_HEADERS; + let body; + body = buildFormUrlencodedString({ + ...se_DecodeAuthorizationMessageRequest(input, context), + [_A]: _DAM, + [_V]: _ }); - }; - var de_PublishStateMachineVersionOutput = (output, context) => { - return (0, smithy_client_1.take)(output, { - creationDate: (_) => (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseEpochTimestamp)((0, smithy_client_1.expectNumber)(_))), - stateMachineVersionArn: smithy_client_1.expectString + return buildHttpRpcRequest(context, headers, "/", void 0, body); + }, "se_DecodeAuthorizationMessageCommand"); + var se_GetAccessKeyInfoCommand = /* @__PURE__ */ __name(async (input, context) => { + const headers = SHARED_HEADERS; + let body; + body = buildFormUrlencodedString({ + ...se_GetAccessKeyInfoRequest(input, context), + [_A]: _GAKI, + [_V]: _ }); - }; - var de_StartExecutionOutput = (output, context) => { - return (0, smithy_client_1.take)(output, { - executionArn: smithy_client_1.expectString, - startDate: (_) => (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseEpochTimestamp)((0, smithy_client_1.expectNumber)(_))) + return buildHttpRpcRequest(context, headers, "/", void 0, body); + }, "se_GetAccessKeyInfoCommand"); + var se_GetCallerIdentityCommand = /* @__PURE__ */ __name(async (input, context) => { + const headers = SHARED_HEADERS; + let body; + body = buildFormUrlencodedString({ + ...se_GetCallerIdentityRequest(input, context), + [_A]: _GCI, + [_V]: _ }); - }; - var de_StartSyncExecutionOutput = (output, context) => { - return (0, smithy_client_1.take)(output, { - billingDetails: smithy_client_1._json, - cause: smithy_client_1.expectString, - error: smithy_client_1.expectString, - executionArn: smithy_client_1.expectString, - input: smithy_client_1.expectString, - inputDetails: smithy_client_1._json, - name: smithy_client_1.expectString, - output: smithy_client_1.expectString, - outputDetails: smithy_client_1._json, - startDate: (_) => (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseEpochTimestamp)((0, smithy_client_1.expectNumber)(_))), - stateMachineArn: smithy_client_1.expectString, - status: smithy_client_1.expectString, - stopDate: (_) => (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseEpochTimestamp)((0, smithy_client_1.expectNumber)(_))), - traceHeader: smithy_client_1.expectString + return buildHttpRpcRequest(context, headers, "/", void 0, body); + }, "se_GetCallerIdentityCommand"); + var se_GetFederationTokenCommand = /* @__PURE__ */ __name(async (input, context) => { + const headers = SHARED_HEADERS; + let body; + body = buildFormUrlencodedString({ + ...se_GetFederationTokenRequest(input, context), + [_A]: _GFT, + [_V]: _ }); - }; - var de_StateMachineAliasList = (output, context) => { - const retVal = (output || []).filter((e) => e != null).map((entry) => { - return de_StateMachineAliasListItem(entry, context); + return buildHttpRpcRequest(context, headers, "/", void 0, body); + }, "se_GetFederationTokenCommand"); + var se_GetSessionTokenCommand = /* @__PURE__ */ __name(async (input, context) => { + const headers = SHARED_HEADERS; + let body; + body = buildFormUrlencodedString({ + ...se_GetSessionTokenRequest(input, context), + [_A]: _GST, + [_V]: _ }); - return retVal; - }; - var de_StateMachineAliasListItem = (output, context) => { - return (0, smithy_client_1.take)(output, { - creationDate: (_) => (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseEpochTimestamp)((0, smithy_client_1.expectNumber)(_))), - stateMachineAliasArn: smithy_client_1.expectString + return buildHttpRpcRequest(context, headers, "/", void 0, body); + }, "se_GetSessionTokenCommand"); + var de_AssumeRoleCommand = /* @__PURE__ */ __name(async (output, context) => { + if (output.statusCode >= 300) { + return de_CommandError(output, context); + } + const data = await (0, import_core3.parseXmlBody)(output.body, context); + let contents = {}; + contents = de_AssumeRoleResponse(data.AssumeRoleResult, context); + const response = { + $metadata: deserializeMetadata(output), + ...contents + }; + return response; + }, "de_AssumeRoleCommand"); + var de_AssumeRoleWithSAMLCommand = /* @__PURE__ */ __name(async (output, context) => { + if (output.statusCode >= 300) { + return de_CommandError(output, context); + } + const data = await (0, import_core3.parseXmlBody)(output.body, context); + let contents = {}; + contents = de_AssumeRoleWithSAMLResponse(data.AssumeRoleWithSAMLResult, context); + const response = { + $metadata: deserializeMetadata(output), + ...contents + }; + return response; + }, "de_AssumeRoleWithSAMLCommand"); + var de_AssumeRoleWithWebIdentityCommand = /* @__PURE__ */ __name(async (output, context) => { + if (output.statusCode >= 300) { + return de_CommandError(output, context); + } + const data = await (0, import_core3.parseXmlBody)(output.body, context); + let contents = {}; + contents = de_AssumeRoleWithWebIdentityResponse(data.AssumeRoleWithWebIdentityResult, context); + const response = { + $metadata: deserializeMetadata(output), + ...contents + }; + return response; + }, "de_AssumeRoleWithWebIdentityCommand"); + var de_DecodeAuthorizationMessageCommand = /* @__PURE__ */ __name(async (output, context) => { + if (output.statusCode >= 300) { + return de_CommandError(output, context); + } + const data = await (0, import_core3.parseXmlBody)(output.body, context); + let contents = {}; + contents = de_DecodeAuthorizationMessageResponse(data.DecodeAuthorizationMessageResult, context); + const response = { + $metadata: deserializeMetadata(output), + ...contents + }; + return response; + }, "de_DecodeAuthorizationMessageCommand"); + var de_GetAccessKeyInfoCommand = /* @__PURE__ */ __name(async (output, context) => { + if (output.statusCode >= 300) { + return de_CommandError(output, context); + } + const data = await (0, import_core3.parseXmlBody)(output.body, context); + let contents = {}; + contents = de_GetAccessKeyInfoResponse(data.GetAccessKeyInfoResult, context); + const response = { + $metadata: deserializeMetadata(output), + ...contents + }; + return response; + }, "de_GetAccessKeyInfoCommand"); + var de_GetCallerIdentityCommand = /* @__PURE__ */ __name(async (output, context) => { + if (output.statusCode >= 300) { + return de_CommandError(output, context); + } + const data = await (0, import_core3.parseXmlBody)(output.body, context); + let contents = {}; + contents = de_GetCallerIdentityResponse(data.GetCallerIdentityResult, context); + const response = { + $metadata: deserializeMetadata(output), + ...contents + }; + return response; + }, "de_GetCallerIdentityCommand"); + var de_GetFederationTokenCommand = /* @__PURE__ */ __name(async (output, context) => { + if (output.statusCode >= 300) { + return de_CommandError(output, context); + } + const data = await (0, import_core3.parseXmlBody)(output.body, context); + let contents = {}; + contents = de_GetFederationTokenResponse(data.GetFederationTokenResult, context); + const response = { + $metadata: deserializeMetadata(output), + ...contents + }; + return response; + }, "de_GetFederationTokenCommand"); + var de_GetSessionTokenCommand = /* @__PURE__ */ __name(async (output, context) => { + if (output.statusCode >= 300) { + return de_CommandError(output, context); + } + const data = await (0, import_core3.parseXmlBody)(output.body, context); + let contents = {}; + contents = de_GetSessionTokenResponse(data.GetSessionTokenResult, context); + const response = { + $metadata: deserializeMetadata(output), + ...contents + }; + return response; + }, "de_GetSessionTokenCommand"); + var de_CommandError = /* @__PURE__ */ __name(async (output, context) => { + const parsedOutput = { + ...output, + body: await (0, import_core3.parseXmlErrorBody)(output.body, context) + }; + const errorCode = loadQueryErrorCode(output, parsedOutput.body); + switch (errorCode) { + case "ExpiredTokenException": + case "com.amazonaws.sts#ExpiredTokenException": + throw await de_ExpiredTokenExceptionRes(parsedOutput, context); + case "MalformedPolicyDocument": + case "com.amazonaws.sts#MalformedPolicyDocumentException": + throw await de_MalformedPolicyDocumentExceptionRes(parsedOutput, context); + case "PackedPolicyTooLarge": + case "com.amazonaws.sts#PackedPolicyTooLargeException": + throw await de_PackedPolicyTooLargeExceptionRes(parsedOutput, context); + case "RegionDisabledException": + case "com.amazonaws.sts#RegionDisabledException": + throw await de_RegionDisabledExceptionRes(parsedOutput, context); + case "IDPRejectedClaim": + case "com.amazonaws.sts#IDPRejectedClaimException": + throw await de_IDPRejectedClaimExceptionRes(parsedOutput, context); + case "InvalidIdentityToken": + case "com.amazonaws.sts#InvalidIdentityTokenException": + throw await de_InvalidIdentityTokenExceptionRes(parsedOutput, context); + case "IDPCommunicationError": + case "com.amazonaws.sts#IDPCommunicationErrorException": + throw await de_IDPCommunicationErrorExceptionRes(parsedOutput, context); + case "InvalidAuthorizationMessageException": + case "com.amazonaws.sts#InvalidAuthorizationMessageException": + throw await de_InvalidAuthorizationMessageExceptionRes(parsedOutput, context); + default: + const parsedBody = parsedOutput.body; + return throwDefaultError({ + output, + parsedBody: parsedBody.Error, + errorCode + }); + } + }, "de_CommandError"); + var de_ExpiredTokenExceptionRes = /* @__PURE__ */ __name(async (parsedOutput, context) => { + const body = parsedOutput.body; + const deserialized = de_ExpiredTokenException(body.Error, context); + const exception = new ExpiredTokenException({ + $metadata: deserializeMetadata(parsedOutput), + ...deserialized }); - }; - var de_StateMachineList = (output, context) => { - const retVal = (output || []).filter((e) => e != null).map((entry) => { - return de_StateMachineListItem(entry, context); + return (0, import_smithy_client5.decorateServiceException)(exception, body); + }, "de_ExpiredTokenExceptionRes"); + var de_IDPCommunicationErrorExceptionRes = /* @__PURE__ */ __name(async (parsedOutput, context) => { + const body = parsedOutput.body; + const deserialized = de_IDPCommunicationErrorException(body.Error, context); + const exception = new IDPCommunicationErrorException({ + $metadata: deserializeMetadata(parsedOutput), + ...deserialized }); - return retVal; - }; - var de_StateMachineListItem = (output, context) => { - return (0, smithy_client_1.take)(output, { - creationDate: (_) => (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseEpochTimestamp)((0, smithy_client_1.expectNumber)(_))), - name: smithy_client_1.expectString, - stateMachineArn: smithy_client_1.expectString, - type: smithy_client_1.expectString + return (0, import_smithy_client5.decorateServiceException)(exception, body); + }, "de_IDPCommunicationErrorExceptionRes"); + var de_IDPRejectedClaimExceptionRes = /* @__PURE__ */ __name(async (parsedOutput, context) => { + const body = parsedOutput.body; + const deserialized = de_IDPRejectedClaimException(body.Error, context); + const exception = new IDPRejectedClaimException({ + $metadata: deserializeMetadata(parsedOutput), + ...deserialized }); - }; - var de_StateMachineVersionList = (output, context) => { - const retVal = (output || []).filter((e) => e != null).map((entry) => { - return de_StateMachineVersionListItem(entry, context); + return (0, import_smithy_client5.decorateServiceException)(exception, body); + }, "de_IDPRejectedClaimExceptionRes"); + var de_InvalidAuthorizationMessageExceptionRes = /* @__PURE__ */ __name(async (parsedOutput, context) => { + const body = parsedOutput.body; + const deserialized = de_InvalidAuthorizationMessageException(body.Error, context); + const exception = new InvalidAuthorizationMessageException({ + $metadata: deserializeMetadata(parsedOutput), + ...deserialized }); - return retVal; - }; - var de_StateMachineVersionListItem = (output, context) => { - return (0, smithy_client_1.take)(output, { - creationDate: (_) => (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseEpochTimestamp)((0, smithy_client_1.expectNumber)(_))), - stateMachineVersionArn: smithy_client_1.expectString + return (0, import_smithy_client5.decorateServiceException)(exception, body); + }, "de_InvalidAuthorizationMessageExceptionRes"); + var de_InvalidIdentityTokenExceptionRes = /* @__PURE__ */ __name(async (parsedOutput, context) => { + const body = parsedOutput.body; + const deserialized = de_InvalidIdentityTokenException(body.Error, context); + const exception = new InvalidIdentityTokenException({ + $metadata: deserializeMetadata(parsedOutput), + ...deserialized }); - }; - var de_StopExecutionOutput = (output, context) => { - return (0, smithy_client_1.take)(output, { - stopDate: (_) => (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseEpochTimestamp)((0, smithy_client_1.expectNumber)(_))) + return (0, import_smithy_client5.decorateServiceException)(exception, body); + }, "de_InvalidIdentityTokenExceptionRes"); + var de_MalformedPolicyDocumentExceptionRes = /* @__PURE__ */ __name(async (parsedOutput, context) => { + const body = parsedOutput.body; + const deserialized = de_MalformedPolicyDocumentException(body.Error, context); + const exception = new MalformedPolicyDocumentException({ + $metadata: deserializeMetadata(parsedOutput), + ...deserialized }); - }; - var de_UpdateStateMachineAliasOutput = (output, context) => { - return (0, smithy_client_1.take)(output, { - updateDate: (_) => (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseEpochTimestamp)((0, smithy_client_1.expectNumber)(_))) + return (0, import_smithy_client5.decorateServiceException)(exception, body); + }, "de_MalformedPolicyDocumentExceptionRes"); + var de_PackedPolicyTooLargeExceptionRes = /* @__PURE__ */ __name(async (parsedOutput, context) => { + const body = parsedOutput.body; + const deserialized = de_PackedPolicyTooLargeException(body.Error, context); + const exception = new PackedPolicyTooLargeException({ + $metadata: deserializeMetadata(parsedOutput), + ...deserialized }); - }; - var de_UpdateStateMachineOutput = (output, context) => { - return (0, smithy_client_1.take)(output, { - revisionId: smithy_client_1.expectString, - stateMachineVersionArn: smithy_client_1.expectString, - updateDate: (_) => (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseEpochTimestamp)((0, smithy_client_1.expectNumber)(_))) + return (0, import_smithy_client5.decorateServiceException)(exception, body); + }, "de_PackedPolicyTooLargeExceptionRes"); + var de_RegionDisabledExceptionRes = /* @__PURE__ */ __name(async (parsedOutput, context) => { + const body = parsedOutput.body; + const deserialized = de_RegionDisabledException(body.Error, context); + const exception = new RegionDisabledException({ + $metadata: deserializeMetadata(parsedOutput), + ...deserialized }); - }; - var deserializeMetadata = (output) => ({ + return (0, import_smithy_client5.decorateServiceException)(exception, body); + }, "de_RegionDisabledExceptionRes"); + var se_AssumeRoleRequest = /* @__PURE__ */ __name((input, context) => { + var _a2, _b, _c, _d; + const entries = {}; + if (input[_RA] != null) { + entries[_RA] = input[_RA]; + } + if (input[_RSN] != null) { + entries[_RSN] = input[_RSN]; + } + if (input[_PA] != null) { + const memberEntries = se_policyDescriptorListType(input[_PA], context); + if (((_a2 = input[_PA]) == null ? void 0 : _a2.length) === 0) { + entries.PolicyArns = []; + } + Object.entries(memberEntries).forEach(([key, value]) => { + const loc = `PolicyArns.${key}`; + entries[loc] = value; + }); + } + if (input[_P] != null) { + entries[_P] = input[_P]; + } + if (input[_DS] != null) { + entries[_DS] = input[_DS]; + } + if (input[_T] != null) { + const memberEntries = se_tagListType(input[_T], context); + if (((_b = input[_T]) == null ? void 0 : _b.length) === 0) { + entries.Tags = []; + } + Object.entries(memberEntries).forEach(([key, value]) => { + const loc = `Tags.${key}`; + entries[loc] = value; + }); + } + if (input[_TTK] != null) { + const memberEntries = se_tagKeyListType(input[_TTK], context); + if (((_c = input[_TTK]) == null ? void 0 : _c.length) === 0) { + entries.TransitiveTagKeys = []; + } + Object.entries(memberEntries).forEach(([key, value]) => { + const loc = `TransitiveTagKeys.${key}`; + entries[loc] = value; + }); + } + if (input[_EI] != null) { + entries[_EI] = input[_EI]; + } + if (input[_SN] != null) { + entries[_SN] = input[_SN]; + } + if (input[_TC] != null) { + entries[_TC] = input[_TC]; + } + if (input[_SI] != null) { + entries[_SI] = input[_SI]; + } + if (input[_PC] != null) { + const memberEntries = se_ProvidedContextsListType(input[_PC], context); + if (((_d = input[_PC]) == null ? void 0 : _d.length) === 0) { + entries.ProvidedContexts = []; + } + Object.entries(memberEntries).forEach(([key, value]) => { + const loc = `ProvidedContexts.${key}`; + entries[loc] = value; + }); + } + return entries; + }, "se_AssumeRoleRequest"); + var se_AssumeRoleWithSAMLRequest = /* @__PURE__ */ __name((input, context) => { + var _a2; + const entries = {}; + if (input[_RA] != null) { + entries[_RA] = input[_RA]; + } + if (input[_PAr] != null) { + entries[_PAr] = input[_PAr]; + } + if (input[_SAMLA] != null) { + entries[_SAMLA] = input[_SAMLA]; + } + if (input[_PA] != null) { + const memberEntries = se_policyDescriptorListType(input[_PA], context); + if (((_a2 = input[_PA]) == null ? void 0 : _a2.length) === 0) { + entries.PolicyArns = []; + } + Object.entries(memberEntries).forEach(([key, value]) => { + const loc = `PolicyArns.${key}`; + entries[loc] = value; + }); + } + if (input[_P] != null) { + entries[_P] = input[_P]; + } + if (input[_DS] != null) { + entries[_DS] = input[_DS]; + } + return entries; + }, "se_AssumeRoleWithSAMLRequest"); + var se_AssumeRoleWithWebIdentityRequest = /* @__PURE__ */ __name((input, context) => { + var _a2; + const entries = {}; + if (input[_RA] != null) { + entries[_RA] = input[_RA]; + } + if (input[_RSN] != null) { + entries[_RSN] = input[_RSN]; + } + if (input[_WIT] != null) { + entries[_WIT] = input[_WIT]; + } + if (input[_PI] != null) { + entries[_PI] = input[_PI]; + } + if (input[_PA] != null) { + const memberEntries = se_policyDescriptorListType(input[_PA], context); + if (((_a2 = input[_PA]) == null ? void 0 : _a2.length) === 0) { + entries.PolicyArns = []; + } + Object.entries(memberEntries).forEach(([key, value]) => { + const loc = `PolicyArns.${key}`; + entries[loc] = value; + }); + } + if (input[_P] != null) { + entries[_P] = input[_P]; + } + if (input[_DS] != null) { + entries[_DS] = input[_DS]; + } + return entries; + }, "se_AssumeRoleWithWebIdentityRequest"); + var se_DecodeAuthorizationMessageRequest = /* @__PURE__ */ __name((input, context) => { + const entries = {}; + if (input[_EM] != null) { + entries[_EM] = input[_EM]; + } + return entries; + }, "se_DecodeAuthorizationMessageRequest"); + var se_GetAccessKeyInfoRequest = /* @__PURE__ */ __name((input, context) => { + const entries = {}; + if (input[_AKI] != null) { + entries[_AKI] = input[_AKI]; + } + return entries; + }, "se_GetAccessKeyInfoRequest"); + var se_GetCallerIdentityRequest = /* @__PURE__ */ __name((input, context) => { + const entries = {}; + return entries; + }, "se_GetCallerIdentityRequest"); + var se_GetFederationTokenRequest = /* @__PURE__ */ __name((input, context) => { + var _a2, _b; + const entries = {}; + if (input[_N] != null) { + entries[_N] = input[_N]; + } + if (input[_P] != null) { + entries[_P] = input[_P]; + } + if (input[_PA] != null) { + const memberEntries = se_policyDescriptorListType(input[_PA], context); + if (((_a2 = input[_PA]) == null ? void 0 : _a2.length) === 0) { + entries.PolicyArns = []; + } + Object.entries(memberEntries).forEach(([key, value]) => { + const loc = `PolicyArns.${key}`; + entries[loc] = value; + }); + } + if (input[_DS] != null) { + entries[_DS] = input[_DS]; + } + if (input[_T] != null) { + const memberEntries = se_tagListType(input[_T], context); + if (((_b = input[_T]) == null ? void 0 : _b.length) === 0) { + entries.Tags = []; + } + Object.entries(memberEntries).forEach(([key, value]) => { + const loc = `Tags.${key}`; + entries[loc] = value; + }); + } + return entries; + }, "se_GetFederationTokenRequest"); + var se_GetSessionTokenRequest = /* @__PURE__ */ __name((input, context) => { + const entries = {}; + if (input[_DS] != null) { + entries[_DS] = input[_DS]; + } + if (input[_SN] != null) { + entries[_SN] = input[_SN]; + } + if (input[_TC] != null) { + entries[_TC] = input[_TC]; + } + return entries; + }, "se_GetSessionTokenRequest"); + var se_policyDescriptorListType = /* @__PURE__ */ __name((input, context) => { + const entries = {}; + let counter = 1; + for (const entry of input) { + if (entry === null) { + continue; + } + const memberEntries = se_PolicyDescriptorType(entry, context); + Object.entries(memberEntries).forEach(([key, value]) => { + entries[`member.${counter}.${key}`] = value; + }); + counter++; + } + return entries; + }, "se_policyDescriptorListType"); + var se_PolicyDescriptorType = /* @__PURE__ */ __name((input, context) => { + const entries = {}; + if (input[_a] != null) { + entries[_a] = input[_a]; + } + return entries; + }, "se_PolicyDescriptorType"); + var se_ProvidedContext = /* @__PURE__ */ __name((input, context) => { + const entries = {}; + if (input[_PAro] != null) { + entries[_PAro] = input[_PAro]; + } + if (input[_CA] != null) { + entries[_CA] = input[_CA]; + } + return entries; + }, "se_ProvidedContext"); + var se_ProvidedContextsListType = /* @__PURE__ */ __name((input, context) => { + const entries = {}; + let counter = 1; + for (const entry of input) { + if (entry === null) { + continue; + } + const memberEntries = se_ProvidedContext(entry, context); + Object.entries(memberEntries).forEach(([key, value]) => { + entries[`member.${counter}.${key}`] = value; + }); + counter++; + } + return entries; + }, "se_ProvidedContextsListType"); + var se_Tag = /* @__PURE__ */ __name((input, context) => { + const entries = {}; + if (input[_K] != null) { + entries[_K] = input[_K]; + } + if (input[_Va] != null) { + entries[_Va] = input[_Va]; + } + return entries; + }, "se_Tag"); + var se_tagKeyListType = /* @__PURE__ */ __name((input, context) => { + const entries = {}; + let counter = 1; + for (const entry of input) { + if (entry === null) { + continue; + } + entries[`member.${counter}`] = entry; + counter++; + } + return entries; + }, "se_tagKeyListType"); + var se_tagListType = /* @__PURE__ */ __name((input, context) => { + const entries = {}; + let counter = 1; + for (const entry of input) { + if (entry === null) { + continue; + } + const memberEntries = se_Tag(entry, context); + Object.entries(memberEntries).forEach(([key, value]) => { + entries[`member.${counter}.${key}`] = value; + }); + counter++; + } + return entries; + }, "se_tagListType"); + var de_AssumedRoleUser = /* @__PURE__ */ __name((output, context) => { + const contents = {}; + if (output[_ARI] != null) { + contents[_ARI] = (0, import_smithy_client5.expectString)(output[_ARI]); + } + if (output[_Ar] != null) { + contents[_Ar] = (0, import_smithy_client5.expectString)(output[_Ar]); + } + return contents; + }, "de_AssumedRoleUser"); + var de_AssumeRoleResponse = /* @__PURE__ */ __name((output, context) => { + const contents = {}; + if (output[_C] != null) { + contents[_C] = de_Credentials(output[_C], context); + } + if (output[_ARU] != null) { + contents[_ARU] = de_AssumedRoleUser(output[_ARU], context); + } + if (output[_PPS] != null) { + contents[_PPS] = (0, import_smithy_client5.strictParseInt32)(output[_PPS]); + } + if (output[_SI] != null) { + contents[_SI] = (0, import_smithy_client5.expectString)(output[_SI]); + } + return contents; + }, "de_AssumeRoleResponse"); + var de_AssumeRoleWithSAMLResponse = /* @__PURE__ */ __name((output, context) => { + const contents = {}; + if (output[_C] != null) { + contents[_C] = de_Credentials(output[_C], context); + } + if (output[_ARU] != null) { + contents[_ARU] = de_AssumedRoleUser(output[_ARU], context); + } + if (output[_PPS] != null) { + contents[_PPS] = (0, import_smithy_client5.strictParseInt32)(output[_PPS]); + } + if (output[_S] != null) { + contents[_S] = (0, import_smithy_client5.expectString)(output[_S]); + } + if (output[_ST] != null) { + contents[_ST] = (0, import_smithy_client5.expectString)(output[_ST]); + } + if (output[_I] != null) { + contents[_I] = (0, import_smithy_client5.expectString)(output[_I]); + } + if (output[_Au] != null) { + contents[_Au] = (0, import_smithy_client5.expectString)(output[_Au]); + } + if (output[_NQ] != null) { + contents[_NQ] = (0, import_smithy_client5.expectString)(output[_NQ]); + } + if (output[_SI] != null) { + contents[_SI] = (0, import_smithy_client5.expectString)(output[_SI]); + } + return contents; + }, "de_AssumeRoleWithSAMLResponse"); + var de_AssumeRoleWithWebIdentityResponse = /* @__PURE__ */ __name((output, context) => { + const contents = {}; + if (output[_C] != null) { + contents[_C] = de_Credentials(output[_C], context); + } + if (output[_SFWIT] != null) { + contents[_SFWIT] = (0, import_smithy_client5.expectString)(output[_SFWIT]); + } + if (output[_ARU] != null) { + contents[_ARU] = de_AssumedRoleUser(output[_ARU], context); + } + if (output[_PPS] != null) { + contents[_PPS] = (0, import_smithy_client5.strictParseInt32)(output[_PPS]); + } + if (output[_Pr] != null) { + contents[_Pr] = (0, import_smithy_client5.expectString)(output[_Pr]); + } + if (output[_Au] != null) { + contents[_Au] = (0, import_smithy_client5.expectString)(output[_Au]); + } + if (output[_SI] != null) { + contents[_SI] = (0, import_smithy_client5.expectString)(output[_SI]); + } + return contents; + }, "de_AssumeRoleWithWebIdentityResponse"); + var de_Credentials = /* @__PURE__ */ __name((output, context) => { + const contents = {}; + if (output[_AKI] != null) { + contents[_AKI] = (0, import_smithy_client5.expectString)(output[_AKI]); + } + if (output[_SAK] != null) { + contents[_SAK] = (0, import_smithy_client5.expectString)(output[_SAK]); + } + if (output[_STe] != null) { + contents[_STe] = (0, import_smithy_client5.expectString)(output[_STe]); + } + if (output[_E] != null) { + contents[_E] = (0, import_smithy_client5.expectNonNull)((0, import_smithy_client5.parseRfc3339DateTimeWithOffset)(output[_E])); + } + return contents; + }, "de_Credentials"); + var de_DecodeAuthorizationMessageResponse = /* @__PURE__ */ __name((output, context) => { + const contents = {}; + if (output[_DM] != null) { + contents[_DM] = (0, import_smithy_client5.expectString)(output[_DM]); + } + return contents; + }, "de_DecodeAuthorizationMessageResponse"); + var de_ExpiredTokenException = /* @__PURE__ */ __name((output, context) => { + const contents = {}; + if (output[_m] != null) { + contents[_m] = (0, import_smithy_client5.expectString)(output[_m]); + } + return contents; + }, "de_ExpiredTokenException"); + var de_FederatedUser = /* @__PURE__ */ __name((output, context) => { + const contents = {}; + if (output[_FUI] != null) { + contents[_FUI] = (0, import_smithy_client5.expectString)(output[_FUI]); + } + if (output[_Ar] != null) { + contents[_Ar] = (0, import_smithy_client5.expectString)(output[_Ar]); + } + return contents; + }, "de_FederatedUser"); + var de_GetAccessKeyInfoResponse = /* @__PURE__ */ __name((output, context) => { + const contents = {}; + if (output[_Ac] != null) { + contents[_Ac] = (0, import_smithy_client5.expectString)(output[_Ac]); + } + return contents; + }, "de_GetAccessKeyInfoResponse"); + var de_GetCallerIdentityResponse = /* @__PURE__ */ __name((output, context) => { + const contents = {}; + if (output[_UI] != null) { + contents[_UI] = (0, import_smithy_client5.expectString)(output[_UI]); + } + if (output[_Ac] != null) { + contents[_Ac] = (0, import_smithy_client5.expectString)(output[_Ac]); + } + if (output[_Ar] != null) { + contents[_Ar] = (0, import_smithy_client5.expectString)(output[_Ar]); + } + return contents; + }, "de_GetCallerIdentityResponse"); + var de_GetFederationTokenResponse = /* @__PURE__ */ __name((output, context) => { + const contents = {}; + if (output[_C] != null) { + contents[_C] = de_Credentials(output[_C], context); + } + if (output[_FU] != null) { + contents[_FU] = de_FederatedUser(output[_FU], context); + } + if (output[_PPS] != null) { + contents[_PPS] = (0, import_smithy_client5.strictParseInt32)(output[_PPS]); + } + return contents; + }, "de_GetFederationTokenResponse"); + var de_GetSessionTokenResponse = /* @__PURE__ */ __name((output, context) => { + const contents = {}; + if (output[_C] != null) { + contents[_C] = de_Credentials(output[_C], context); + } + return contents; + }, "de_GetSessionTokenResponse"); + var de_IDPCommunicationErrorException = /* @__PURE__ */ __name((output, context) => { + const contents = {}; + if (output[_m] != null) { + contents[_m] = (0, import_smithy_client5.expectString)(output[_m]); + } + return contents; + }, "de_IDPCommunicationErrorException"); + var de_IDPRejectedClaimException = /* @__PURE__ */ __name((output, context) => { + const contents = {}; + if (output[_m] != null) { + contents[_m] = (0, import_smithy_client5.expectString)(output[_m]); + } + return contents; + }, "de_IDPRejectedClaimException"); + var de_InvalidAuthorizationMessageException = /* @__PURE__ */ __name((output, context) => { + const contents = {}; + if (output[_m] != null) { + contents[_m] = (0, import_smithy_client5.expectString)(output[_m]); + } + return contents; + }, "de_InvalidAuthorizationMessageException"); + var de_InvalidIdentityTokenException = /* @__PURE__ */ __name((output, context) => { + const contents = {}; + if (output[_m] != null) { + contents[_m] = (0, import_smithy_client5.expectString)(output[_m]); + } + return contents; + }, "de_InvalidIdentityTokenException"); + var de_MalformedPolicyDocumentException = /* @__PURE__ */ __name((output, context) => { + const contents = {}; + if (output[_m] != null) { + contents[_m] = (0, import_smithy_client5.expectString)(output[_m]); + } + return contents; + }, "de_MalformedPolicyDocumentException"); + var de_PackedPolicyTooLargeException = /* @__PURE__ */ __name((output, context) => { + const contents = {}; + if (output[_m] != null) { + contents[_m] = (0, import_smithy_client5.expectString)(output[_m]); + } + return contents; + }, "de_PackedPolicyTooLargeException"); + var de_RegionDisabledException = /* @__PURE__ */ __name((output, context) => { + const contents = {}; + if (output[_m] != null) { + contents[_m] = (0, import_smithy_client5.expectString)(output[_m]); + } + return contents; + }, "de_RegionDisabledException"); + var deserializeMetadata = /* @__PURE__ */ __name((output) => ({ httpStatusCode: output.statusCode, requestId: output.headers["x-amzn-requestid"] ?? output.headers["x-amzn-request-id"] ?? output.headers["x-amz-request-id"], extendedRequestId: output.headers["x-amz-id-2"], cfId: output.headers["x-amz-cf-id"] - }); - var collectBodyString = (streamBody, context) => (0, smithy_client_1.collectBody)(streamBody, context).then((body) => context.utf8Encoder(body)); - var throwDefaultError = (0, smithy_client_1.withBaseException)(SFNServiceException_1.SFNServiceException); - var buildHttpRpcRequest = async (context, headers, path, resolvedHostname, body) => { + }), "deserializeMetadata"); + var throwDefaultError = (0, import_smithy_client5.withBaseException)(STSServiceException); + var buildHttpRpcRequest = /* @__PURE__ */ __name(async (context, headers, path, resolvedHostname, body) => { const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const contents = { protocol, @@ -20289,2431 +22054,4360 @@ var require_Aws_json1_0 = __commonJS({ if (body !== void 0) { contents.body = body; } - return new protocol_http_1.HttpRequest(contents); + return new import_protocol_http8.HttpRequest(contents); + }, "buildHttpRpcRequest"); + var SHARED_HEADERS = { + "content-type": "application/x-www-form-urlencoded" }; - function sharedHeaders(operation) { - return { - "content-type": "application/x-amz-json-1.0", - "x-amz-target": `AWSStepFunctions.${operation}` - }; - } - var parseBody = (streamBody, context) => collectBodyString(streamBody, context).then((encoded) => { - if (encoded.length) { - return JSON.parse(encoded); + var _ = "2011-06-15"; + var _A = "Action"; + var _AKI = "AccessKeyId"; + var _AR = "AssumeRole"; + var _ARI = "AssumedRoleId"; + var _ARU = "AssumedRoleUser"; + var _ARWSAML = "AssumeRoleWithSAML"; + var _ARWWI = "AssumeRoleWithWebIdentity"; + var _Ac = "Account"; + var _Ar = "Arn"; + var _Au = "Audience"; + var _C = "Credentials"; + var _CA = "ContextAssertion"; + var _DAM = "DecodeAuthorizationMessage"; + var _DM = "DecodedMessage"; + var _DS = "DurationSeconds"; + var _E = "Expiration"; + var _EI = "ExternalId"; + var _EM = "EncodedMessage"; + var _FU = "FederatedUser"; + var _FUI = "FederatedUserId"; + var _GAKI = "GetAccessKeyInfo"; + var _GCI = "GetCallerIdentity"; + var _GFT = "GetFederationToken"; + var _GST = "GetSessionToken"; + var _I = "Issuer"; + var _K = "Key"; + var _N = "Name"; + var _NQ = "NameQualifier"; + var _P = "Policy"; + var _PA = "PolicyArns"; + var _PAr = "PrincipalArn"; + var _PAro = "ProviderArn"; + var _PC = "ProvidedContexts"; + var _PI = "ProviderId"; + var _PPS = "PackedPolicySize"; + var _Pr = "Provider"; + var _RA = "RoleArn"; + var _RSN = "RoleSessionName"; + var _S = "Subject"; + var _SAK = "SecretAccessKey"; + var _SAMLA = "SAMLAssertion"; + var _SFWIT = "SubjectFromWebIdentityToken"; + var _SI = "SourceIdentity"; + var _SN = "SerialNumber"; + var _ST = "SubjectType"; + var _STe = "SessionToken"; + var _T = "Tags"; + var _TC = "TokenCode"; + var _TTK = "TransitiveTagKeys"; + var _UI = "UserId"; + var _V = "Version"; + var _Va = "Value"; + var _WIT = "WebIdentityToken"; + var _a = "arn"; + var _m = "message"; + var buildFormUrlencodedString = /* @__PURE__ */ __name((formEntries) => Object.entries(formEntries).map(([key, value]) => (0, import_smithy_client5.extendedEncodeURIComponent)(key) + "=" + (0, import_smithy_client5.extendedEncodeURIComponent)(value)).join("&"), "buildFormUrlencodedString"); + var loadQueryErrorCode = /* @__PURE__ */ __name((output, data) => { + var _a2; + if (((_a2 = data.Error) == null ? void 0 : _a2.Code) !== void 0) { + return data.Error.Code; } - return {}; - }); - var parseErrorBody = async (errorBody, context) => { - const value = await parseBody(errorBody, context); - value.message = value.message ?? value.Message; - return value; + if (output.statusCode == 404) { + return "NotFound"; + } + }, "loadQueryErrorCode"); + var _AssumeRoleCommand = class _AssumeRoleCommand extends import_smithy_client5.Command.classBuilder().ep({ + ...import_EndpointParameters.commonParams + }).m(function(Command, cs, config, o) { + return [ + (0, import_middleware_serde2.getSerdePlugin)(config, this.serialize, this.deserialize), + (0, import_middleware_endpoint2.getEndpointPlugin)(config, Command.getEndpointParameterInstructions()) + ]; + }).s("AWSSecurityTokenServiceV20110615", "AssumeRole", {}).n("STSClient", "AssumeRoleCommand").f(void 0, AssumeRoleResponseFilterSensitiveLog).ser(se_AssumeRoleCommand).de(de_AssumeRoleCommand).build() { + }; + __name(_AssumeRoleCommand, "AssumeRoleCommand"); + var AssumeRoleCommand = _AssumeRoleCommand; + var import_EndpointParameters2 = require_EndpointParameters(); + var _AssumeRoleWithSAMLCommand = class _AssumeRoleWithSAMLCommand extends import_smithy_client5.Command.classBuilder().ep({ + ...import_EndpointParameters2.commonParams + }).m(function(Command, cs, config, o) { + return [ + (0, import_middleware_serde2.getSerdePlugin)(config, this.serialize, this.deserialize), + (0, import_middleware_endpoint2.getEndpointPlugin)(config, Command.getEndpointParameterInstructions()) + ]; + }).s("AWSSecurityTokenServiceV20110615", "AssumeRoleWithSAML", {}).n("STSClient", "AssumeRoleWithSAMLCommand").f(AssumeRoleWithSAMLRequestFilterSensitiveLog, AssumeRoleWithSAMLResponseFilterSensitiveLog).ser(se_AssumeRoleWithSAMLCommand).de(de_AssumeRoleWithSAMLCommand).build() { + }; + __name(_AssumeRoleWithSAMLCommand, "AssumeRoleWithSAMLCommand"); + var AssumeRoleWithSAMLCommand = _AssumeRoleWithSAMLCommand; + var import_EndpointParameters3 = require_EndpointParameters(); + var _AssumeRoleWithWebIdentityCommand = class _AssumeRoleWithWebIdentityCommand extends import_smithy_client5.Command.classBuilder().ep({ + ...import_EndpointParameters3.commonParams + }).m(function(Command, cs, config, o) { + return [ + (0, import_middleware_serde2.getSerdePlugin)(config, this.serialize, this.deserialize), + (0, import_middleware_endpoint2.getEndpointPlugin)(config, Command.getEndpointParameterInstructions()) + ]; + }).s("AWSSecurityTokenServiceV20110615", "AssumeRoleWithWebIdentity", {}).n("STSClient", "AssumeRoleWithWebIdentityCommand").f(AssumeRoleWithWebIdentityRequestFilterSensitiveLog, AssumeRoleWithWebIdentityResponseFilterSensitiveLog).ser(se_AssumeRoleWithWebIdentityCommand).de(de_AssumeRoleWithWebIdentityCommand).build() { + }; + __name(_AssumeRoleWithWebIdentityCommand, "AssumeRoleWithWebIdentityCommand"); + var AssumeRoleWithWebIdentityCommand = _AssumeRoleWithWebIdentityCommand; + var import_EndpointParameters4 = require_EndpointParameters(); + var _DecodeAuthorizationMessageCommand = class _DecodeAuthorizationMessageCommand extends import_smithy_client5.Command.classBuilder().ep({ + ...import_EndpointParameters4.commonParams + }).m(function(Command, cs, config, o) { + return [ + (0, import_middleware_serde2.getSerdePlugin)(config, this.serialize, this.deserialize), + (0, import_middleware_endpoint2.getEndpointPlugin)(config, Command.getEndpointParameterInstructions()) + ]; + }).s("AWSSecurityTokenServiceV20110615", "DecodeAuthorizationMessage", {}).n("STSClient", "DecodeAuthorizationMessageCommand").f(void 0, void 0).ser(se_DecodeAuthorizationMessageCommand).de(de_DecodeAuthorizationMessageCommand).build() { + }; + __name(_DecodeAuthorizationMessageCommand, "DecodeAuthorizationMessageCommand"); + var DecodeAuthorizationMessageCommand = _DecodeAuthorizationMessageCommand; + var import_EndpointParameters5 = require_EndpointParameters(); + var _GetAccessKeyInfoCommand = class _GetAccessKeyInfoCommand extends import_smithy_client5.Command.classBuilder().ep({ + ...import_EndpointParameters5.commonParams + }).m(function(Command, cs, config, o) { + return [ + (0, import_middleware_serde2.getSerdePlugin)(config, this.serialize, this.deserialize), + (0, import_middleware_endpoint2.getEndpointPlugin)(config, Command.getEndpointParameterInstructions()) + ]; + }).s("AWSSecurityTokenServiceV20110615", "GetAccessKeyInfo", {}).n("STSClient", "GetAccessKeyInfoCommand").f(void 0, void 0).ser(se_GetAccessKeyInfoCommand).de(de_GetAccessKeyInfoCommand).build() { + }; + __name(_GetAccessKeyInfoCommand, "GetAccessKeyInfoCommand"); + var GetAccessKeyInfoCommand = _GetAccessKeyInfoCommand; + var import_EndpointParameters6 = require_EndpointParameters(); + var _GetCallerIdentityCommand = class _GetCallerIdentityCommand extends import_smithy_client5.Command.classBuilder().ep({ + ...import_EndpointParameters6.commonParams + }).m(function(Command, cs, config, o) { + return [ + (0, import_middleware_serde2.getSerdePlugin)(config, this.serialize, this.deserialize), + (0, import_middleware_endpoint2.getEndpointPlugin)(config, Command.getEndpointParameterInstructions()) + ]; + }).s("AWSSecurityTokenServiceV20110615", "GetCallerIdentity", {}).n("STSClient", "GetCallerIdentityCommand").f(void 0, void 0).ser(se_GetCallerIdentityCommand).de(de_GetCallerIdentityCommand).build() { + }; + __name(_GetCallerIdentityCommand, "GetCallerIdentityCommand"); + var GetCallerIdentityCommand = _GetCallerIdentityCommand; + var import_EndpointParameters7 = require_EndpointParameters(); + var _GetFederationTokenCommand = class _GetFederationTokenCommand extends import_smithy_client5.Command.classBuilder().ep({ + ...import_EndpointParameters7.commonParams + }).m(function(Command, cs, config, o) { + return [ + (0, import_middleware_serde2.getSerdePlugin)(config, this.serialize, this.deserialize), + (0, import_middleware_endpoint2.getEndpointPlugin)(config, Command.getEndpointParameterInstructions()) + ]; + }).s("AWSSecurityTokenServiceV20110615", "GetFederationToken", {}).n("STSClient", "GetFederationTokenCommand").f(void 0, GetFederationTokenResponseFilterSensitiveLog).ser(se_GetFederationTokenCommand).de(de_GetFederationTokenCommand).build() { + }; + __name(_GetFederationTokenCommand, "GetFederationTokenCommand"); + var GetFederationTokenCommand = _GetFederationTokenCommand; + var import_EndpointParameters8 = require_EndpointParameters(); + var _GetSessionTokenCommand = class _GetSessionTokenCommand extends import_smithy_client5.Command.classBuilder().ep({ + ...import_EndpointParameters8.commonParams + }).m(function(Command, cs, config, o) { + return [ + (0, import_middleware_serde2.getSerdePlugin)(config, this.serialize, this.deserialize), + (0, import_middleware_endpoint2.getEndpointPlugin)(config, Command.getEndpointParameterInstructions()) + ]; + }).s("AWSSecurityTokenServiceV20110615", "GetSessionToken", {}).n("STSClient", "GetSessionTokenCommand").f(void 0, GetSessionTokenResponseFilterSensitiveLog).ser(se_GetSessionTokenCommand).de(de_GetSessionTokenCommand).build() { }; - var loadRestJsonErrorCode = (output, data) => { - const findKey = (object, key) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase()); - const sanitizeErrorCode = (rawValue) => { - let cleanValue = rawValue; - if (typeof cleanValue === "number") { - cleanValue = cleanValue.toString(); - } - if (cleanValue.indexOf(",") >= 0) { - cleanValue = cleanValue.split(",")[0]; + __name(_GetSessionTokenCommand, "GetSessionTokenCommand"); + var GetSessionTokenCommand = _GetSessionTokenCommand; + var import_STSClient = require_STSClient(); + var commands = { + AssumeRoleCommand, + AssumeRoleWithSAMLCommand, + AssumeRoleWithWebIdentityCommand, + DecodeAuthorizationMessageCommand, + GetAccessKeyInfoCommand, + GetCallerIdentityCommand, + GetFederationTokenCommand, + GetSessionTokenCommand + }; + var _STS = class _STS extends import_STSClient.STSClient { + }; + __name(_STS, "STS"); + var STS = _STS; + (0, import_smithy_client5.createAggregatedClient)(commands, STS); + var import_EndpointParameters9 = require_EndpointParameters(); + var ASSUME_ROLE_DEFAULT_REGION = "us-east-1"; + var getAccountIdFromAssumedRoleUser = /* @__PURE__ */ __name((assumedRoleUser) => { + if (typeof (assumedRoleUser == null ? void 0 : assumedRoleUser.Arn) === "string") { + const arnComponents = assumedRoleUser.Arn.split(":"); + if (arnComponents.length > 4 && arnComponents[4] !== "") { + return arnComponents[4]; } - if (cleanValue.indexOf(":") >= 0) { - cleanValue = cleanValue.split(":")[0]; + } + return void 0; + }, "getAccountIdFromAssumedRoleUser"); + var resolveRegion = /* @__PURE__ */ __name(async (_region, _parentRegion, credentialProviderLogger) => { + var _a2; + const region = typeof _region === "function" ? await _region() : _region; + const parentRegion = typeof _parentRegion === "function" ? await _parentRegion() : _parentRegion; + (_a2 = credentialProviderLogger == null ? void 0 : credentialProviderLogger.debug) == null ? void 0 : _a2.call( + credentialProviderLogger, + "@aws-sdk/client-sts::resolveRegion", + "accepting first of:", + `${region} (provider)`, + `${parentRegion} (parent client)`, + `${ASSUME_ROLE_DEFAULT_REGION} (STS default)` + ); + return region ?? parentRegion ?? ASSUME_ROLE_DEFAULT_REGION; + }, "resolveRegion"); + var getDefaultRoleAssumer = /* @__PURE__ */ __name((stsOptions, stsClientCtor) => { + let stsClient; + let closureSourceCreds; + return async (sourceCreds, params) => { + var _a2, _b, _c; + closureSourceCreds = sourceCreds; + if (!stsClient) { + const { + logger = (_a2 = stsOptions == null ? void 0 : stsOptions.parentClientConfig) == null ? void 0 : _a2.logger, + region, + requestHandler = (_b = stsOptions == null ? void 0 : stsOptions.parentClientConfig) == null ? void 0 : _b.requestHandler, + credentialProviderLogger + } = stsOptions; + const resolvedRegion = await resolveRegion( + region, + (_c = stsOptions == null ? void 0 : stsOptions.parentClientConfig) == null ? void 0 : _c.region, + credentialProviderLogger + ); + const isCompatibleRequestHandler = !isH2(requestHandler); + stsClient = new stsClientCtor({ + // A hack to make sts client uses the credential in current closure. + credentialDefaultProvider: () => async () => closureSourceCreds, + region: resolvedRegion, + requestHandler: isCompatibleRequestHandler ? requestHandler : void 0, + logger + }); } - if (cleanValue.indexOf("#") >= 0) { - cleanValue = cleanValue.split("#")[1]; + const { Credentials: Credentials2, AssumedRoleUser: AssumedRoleUser2 } = await stsClient.send(new AssumeRoleCommand(params)); + if (!Credentials2 || !Credentials2.AccessKeyId || !Credentials2.SecretAccessKey) { + throw new Error(`Invalid response from STS.assumeRole call with role ${params.RoleArn}`); } - return cleanValue; - }; - const headerKey = findKey(output.headers, "x-amzn-errortype"); - if (headerKey !== void 0) { - return sanitizeErrorCode(output.headers[headerKey]); - } - if (data.code !== void 0) { - return sanitizeErrorCode(data.code); - } - if (data["__type"] !== void 0) { - return sanitizeErrorCode(data["__type"]); - } - }; - } -}); - -// ../../../node_modules/@aws-sdk/client-sfn/dist-cjs/commands/CreateActivityCommand.js -var require_CreateActivityCommand = __commonJS({ - "../../../node_modules/@aws-sdk/client-sfn/dist-cjs/commands/CreateActivityCommand.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.CreateActivityCommand = exports2.$Command = void 0; - var middleware_endpoint_1 = require_dist_cjs26(); - var middleware_serde_1 = require_dist_cjs25(); - var smithy_client_1 = require_dist_cjs34(); - Object.defineProperty(exports2, "$Command", { enumerable: true, get: function() { - return smithy_client_1.Command; - } }); - var types_1 = require_dist_cjs(); - var Aws_json1_0_1 = require_Aws_json1_0(); - var CreateActivityCommand = class _CreateActivityCommand extends smithy_client_1.Command { - static getEndpointParameterInstructions() { + const accountId = getAccountIdFromAssumedRoleUser(AssumedRoleUser2); return { - UseFIPS: { type: "builtInParams", name: "useFipsEndpoint" }, - Endpoint: { type: "builtInParams", name: "endpoint" }, - Region: { type: "builtInParams", name: "region" }, - UseDualStack: { type: "builtInParams", name: "useDualstackEndpoint" } - }; - } - constructor(input) { - super(); - this.input = input; - } - resolveMiddleware(clientStack, configuration, options) { - this.middlewareStack.use((0, middleware_serde_1.getSerdePlugin)(configuration, this.serialize, this.deserialize)); - this.middlewareStack.use((0, middleware_endpoint_1.getEndpointPlugin)(configuration, _CreateActivityCommand.getEndpointParameterInstructions())); - const stack = clientStack.concat(this.middlewareStack); - const { logger } = configuration; - const clientName = "SFNClient"; - const commandName = "CreateActivityCommand"; - const handlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: (_) => _, - outputFilterSensitiveLog: (_) => _, - [types_1.SMITHY_CONTEXT_KEY]: { - service: "AWSStepFunctions", - operation: "CreateActivity" - } + accessKeyId: Credentials2.AccessKeyId, + secretAccessKey: Credentials2.SecretAccessKey, + sessionToken: Credentials2.SessionToken, + expiration: Credentials2.Expiration, + // TODO(credentialScope): access normally when shape is updated. + ...Credentials2.CredentialScope && { credentialScope: Credentials2.CredentialScope }, + ...accountId && { accountId } }; - const { requestHandler } = configuration; - return stack.resolve((request2) => requestHandler.handle(request2.request, options || {}), handlerExecutionContext); - } - serialize(input, context) { - return (0, Aws_json1_0_1.se_CreateActivityCommand)(input, context); - } - deserialize(output, context) { - return (0, Aws_json1_0_1.de_CreateActivityCommand)(output, context); - } - }; - exports2.CreateActivityCommand = CreateActivityCommand; - } -}); - -// ../../../node_modules/@aws-sdk/client-sfn/dist-cjs/commands/CreateStateMachineAliasCommand.js -var require_CreateStateMachineAliasCommand = __commonJS({ - "../../../node_modules/@aws-sdk/client-sfn/dist-cjs/commands/CreateStateMachineAliasCommand.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.CreateStateMachineAliasCommand = exports2.$Command = void 0; - var middleware_endpoint_1 = require_dist_cjs26(); - var middleware_serde_1 = require_dist_cjs25(); - var smithy_client_1 = require_dist_cjs34(); - Object.defineProperty(exports2, "$Command", { enumerable: true, get: function() { - return smithy_client_1.Command; - } }); - var types_1 = require_dist_cjs(); - var models_0_1 = require_models_03(); - var Aws_json1_0_1 = require_Aws_json1_0(); - var CreateStateMachineAliasCommand = class _CreateStateMachineAliasCommand extends smithy_client_1.Command { - static getEndpointParameterInstructions() { + }; + }, "getDefaultRoleAssumer"); + var getDefaultRoleAssumerWithWebIdentity = /* @__PURE__ */ __name((stsOptions, stsClientCtor) => { + let stsClient; + return async (params) => { + var _a2, _b, _c; + if (!stsClient) { + const { + logger = (_a2 = stsOptions == null ? void 0 : stsOptions.parentClientConfig) == null ? void 0 : _a2.logger, + region, + requestHandler = (_b = stsOptions == null ? void 0 : stsOptions.parentClientConfig) == null ? void 0 : _b.requestHandler, + credentialProviderLogger + } = stsOptions; + const resolvedRegion = await resolveRegion( + region, + (_c = stsOptions == null ? void 0 : stsOptions.parentClientConfig) == null ? void 0 : _c.region, + credentialProviderLogger + ); + const isCompatibleRequestHandler = !isH2(requestHandler); + stsClient = new stsClientCtor({ + region: resolvedRegion, + requestHandler: isCompatibleRequestHandler ? requestHandler : void 0, + logger + }); + } + const { Credentials: Credentials2, AssumedRoleUser: AssumedRoleUser2 } = await stsClient.send(new AssumeRoleWithWebIdentityCommand(params)); + if (!Credentials2 || !Credentials2.AccessKeyId || !Credentials2.SecretAccessKey) { + throw new Error(`Invalid response from STS.assumeRoleWithWebIdentity call with role ${params.RoleArn}`); + } + const accountId = getAccountIdFromAssumedRoleUser(AssumedRoleUser2); return { - UseFIPS: { type: "builtInParams", name: "useFipsEndpoint" }, - Endpoint: { type: "builtInParams", name: "endpoint" }, - Region: { type: "builtInParams", name: "region" }, - UseDualStack: { type: "builtInParams", name: "useDualstackEndpoint" } + accessKeyId: Credentials2.AccessKeyId, + secretAccessKey: Credentials2.SecretAccessKey, + sessionToken: Credentials2.SessionToken, + expiration: Credentials2.Expiration, + // TODO(credentialScope): access normally when shape is updated. + ...Credentials2.CredentialScope && { credentialScope: Credentials2.CredentialScope }, + ...accountId && { accountId } }; - } - constructor(input) { - super(); - this.input = input; - } - resolveMiddleware(clientStack, configuration, options) { - this.middlewareStack.use((0, middleware_serde_1.getSerdePlugin)(configuration, this.serialize, this.deserialize)); - this.middlewareStack.use((0, middleware_endpoint_1.getEndpointPlugin)(configuration, _CreateStateMachineAliasCommand.getEndpointParameterInstructions())); - const stack = clientStack.concat(this.middlewareStack); - const { logger } = configuration; - const clientName = "SFNClient"; - const commandName = "CreateStateMachineAliasCommand"; - const handlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: models_0_1.CreateStateMachineAliasInputFilterSensitiveLog, - outputFilterSensitiveLog: (_) => _, - [types_1.SMITHY_CONTEXT_KEY]: { - service: "AWSStepFunctions", - operation: "CreateStateMachineAlias" + }; + }, "getDefaultRoleAssumerWithWebIdentity"); + var isH2 = /* @__PURE__ */ __name((requestHandler) => { + var _a2; + return ((_a2 = requestHandler == null ? void 0 : requestHandler.metadata) == null ? void 0 : _a2.handlerProtocol) === "h2"; + }, "isH2"); + var import_STSClient2 = require_STSClient(); + var getCustomizableStsClientCtor = /* @__PURE__ */ __name((baseCtor, customizations) => { + var _a2; + if (!customizations) + return baseCtor; + else + return _a2 = class extends baseCtor { + constructor(config) { + super(config); + for (const customization of customizations) { + this.middlewareStack.use(customization); + } } - }; - const { requestHandler } = configuration; - return stack.resolve((request2) => requestHandler.handle(request2.request, options || {}), handlerExecutionContext); - } - serialize(input, context) { - return (0, Aws_json1_0_1.se_CreateStateMachineAliasCommand)(input, context); - } - deserialize(output, context) { - return (0, Aws_json1_0_1.de_CreateStateMachineAliasCommand)(output, context); - } - }; - exports2.CreateStateMachineAliasCommand = CreateStateMachineAliasCommand; + }, __name(_a2, "CustomizableSTSClient"), _a2; + }, "getCustomizableStsClientCtor"); + var getDefaultRoleAssumer2 = /* @__PURE__ */ __name((stsOptions = {}, stsPlugins) => getDefaultRoleAssumer(stsOptions, getCustomizableStsClientCtor(import_STSClient2.STSClient, stsPlugins)), "getDefaultRoleAssumer"); + var getDefaultRoleAssumerWithWebIdentity2 = /* @__PURE__ */ __name((stsOptions = {}, stsPlugins) => getDefaultRoleAssumerWithWebIdentity(stsOptions, getCustomizableStsClientCtor(import_STSClient2.STSClient, stsPlugins)), "getDefaultRoleAssumerWithWebIdentity"); + var decorateDefaultCredentialProvider = /* @__PURE__ */ __name((provider) => (input) => provider({ + roleAssumer: getDefaultRoleAssumer2(input), + roleAssumerWithWebIdentity: getDefaultRoleAssumerWithWebIdentity2(input), + ...input + }), "decorateDefaultCredentialProvider"); } }); -// ../../../node_modules/@aws-sdk/client-sfn/dist-cjs/commands/CreateStateMachineCommand.js -var require_CreateStateMachineCommand = __commonJS({ - "../../../node_modules/@aws-sdk/client-sfn/dist-cjs/commands/CreateStateMachineCommand.js"(exports2) { +// ../../../node_modules/@aws-sdk/credential-provider-process/dist-cjs/index.js +var require_dist_cjs76 = __commonJS({ + "../../../node_modules/@aws-sdk/credential-provider-process/dist-cjs/index.js"(exports2, module2) { "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.CreateStateMachineCommand = exports2.$Command = void 0; - var middleware_endpoint_1 = require_dist_cjs26(); - var middleware_serde_1 = require_dist_cjs25(); - var smithy_client_1 = require_dist_cjs34(); - Object.defineProperty(exports2, "$Command", { enumerable: true, get: function() { - return smithy_client_1.Command; - } }); - var types_1 = require_dist_cjs(); - var models_0_1 = require_models_03(); - var Aws_json1_0_1 = require_Aws_json1_0(); - var CreateStateMachineCommand = class _CreateStateMachineCommand extends smithy_client_1.Command { - static getEndpointParameterInstructions() { - return { - UseFIPS: { type: "builtInParams", name: "useFipsEndpoint" }, - Endpoint: { type: "builtInParams", name: "endpoint" }, - Region: { type: "builtInParams", name: "region" }, - UseDualStack: { type: "builtInParams", name: "useDualstackEndpoint" } - }; - } - constructor(input) { - super(); - this.input = input; - } - resolveMiddleware(clientStack, configuration, options) { - this.middlewareStack.use((0, middleware_serde_1.getSerdePlugin)(configuration, this.serialize, this.deserialize)); - this.middlewareStack.use((0, middleware_endpoint_1.getEndpointPlugin)(configuration, _CreateStateMachineCommand.getEndpointParameterInstructions())); - const stack = clientStack.concat(this.middlewareStack); - const { logger } = configuration; - const clientName = "SFNClient"; - const commandName = "CreateStateMachineCommand"; - const handlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: models_0_1.CreateStateMachineInputFilterSensitiveLog, - outputFilterSensitiveLog: (_) => _, - [types_1.SMITHY_CONTEXT_KEY]: { - service: "AWSStepFunctions", - operation: "CreateStateMachine" - } - }; - const { requestHandler } = configuration; - return stack.resolve((request2) => requestHandler.handle(request2.request, options || {}), handlerExecutionContext); - } - serialize(input, context) { - return (0, Aws_json1_0_1.se_CreateStateMachineCommand)(input, context); - } - deserialize(output, context) { - return (0, Aws_json1_0_1.de_CreateStateMachineCommand)(output, context); - } + var __defProp2 = Object.defineProperty; + var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; + var __getOwnPropNames2 = Object.getOwnPropertyNames; + var __hasOwnProp2 = Object.prototype.hasOwnProperty; + var __name = (target, value) => __defProp2(target, "name", { value, configurable: true }); + var __export2 = (target, all) => { + for (var name in all) + __defProp2(target, name, { get: all[name], enumerable: true }); }; - exports2.CreateStateMachineCommand = CreateStateMachineCommand; - } -}); - -// ../../../node_modules/@aws-sdk/client-sfn/dist-cjs/commands/DeleteActivityCommand.js -var require_DeleteActivityCommand = __commonJS({ - "../../../node_modules/@aws-sdk/client-sfn/dist-cjs/commands/DeleteActivityCommand.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.DeleteActivityCommand = exports2.$Command = void 0; - var middleware_endpoint_1 = require_dist_cjs26(); - var middleware_serde_1 = require_dist_cjs25(); - var smithy_client_1 = require_dist_cjs34(); - Object.defineProperty(exports2, "$Command", { enumerable: true, get: function() { - return smithy_client_1.Command; - } }); - var types_1 = require_dist_cjs(); - var Aws_json1_0_1 = require_Aws_json1_0(); - var DeleteActivityCommand = class _DeleteActivityCommand extends smithy_client_1.Command { - static getEndpointParameterInstructions() { - return { - UseFIPS: { type: "builtInParams", name: "useFipsEndpoint" }, - Endpoint: { type: "builtInParams", name: "endpoint" }, - Region: { type: "builtInParams", name: "region" }, - UseDualStack: { type: "builtInParams", name: "useDualstackEndpoint" } - }; - } - constructor(input) { - super(); - this.input = input; - } - resolveMiddleware(clientStack, configuration, options) { - this.middlewareStack.use((0, middleware_serde_1.getSerdePlugin)(configuration, this.serialize, this.deserialize)); - this.middlewareStack.use((0, middleware_endpoint_1.getEndpointPlugin)(configuration, _DeleteActivityCommand.getEndpointParameterInstructions())); - const stack = clientStack.concat(this.middlewareStack); - const { logger } = configuration; - const clientName = "SFNClient"; - const commandName = "DeleteActivityCommand"; - const handlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: (_) => _, - outputFilterSensitiveLog: (_) => _, - [types_1.SMITHY_CONTEXT_KEY]: { - service: "AWSStepFunctions", - operation: "DeleteActivity" - } - }; - const { requestHandler } = configuration; - return stack.resolve((request2) => requestHandler.handle(request2.request, options || {}), handlerExecutionContext); - } - serialize(input, context) { - return (0, Aws_json1_0_1.se_DeleteActivityCommand)(input, context); - } - deserialize(output, context) { - return (0, Aws_json1_0_1.de_DeleteActivityCommand)(output, context); + var __copyProps2 = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames2(from)) + if (!__hasOwnProp2.call(to, key) && key !== except) + __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable }); } + return to; }; - exports2.DeleteActivityCommand = DeleteActivityCommand; - } -}); - -// ../../../node_modules/@aws-sdk/client-sfn/dist-cjs/commands/DeleteStateMachineAliasCommand.js -var require_DeleteStateMachineAliasCommand = __commonJS({ - "../../../node_modules/@aws-sdk/client-sfn/dist-cjs/commands/DeleteStateMachineAliasCommand.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.DeleteStateMachineAliasCommand = exports2.$Command = void 0; - var middleware_endpoint_1 = require_dist_cjs26(); - var middleware_serde_1 = require_dist_cjs25(); - var smithy_client_1 = require_dist_cjs34(); - Object.defineProperty(exports2, "$Command", { enumerable: true, get: function() { - return smithy_client_1.Command; - } }); - var types_1 = require_dist_cjs(); - var Aws_json1_0_1 = require_Aws_json1_0(); - var DeleteStateMachineAliasCommand = class _DeleteStateMachineAliasCommand extends smithy_client_1.Command { - static getEndpointParameterInstructions() { - return { - UseFIPS: { type: "builtInParams", name: "useFipsEndpoint" }, - Endpoint: { type: "builtInParams", name: "endpoint" }, - Region: { type: "builtInParams", name: "region" }, - UseDualStack: { type: "builtInParams", name: "useDualstackEndpoint" } - }; - } - constructor(input) { - super(); - this.input = input; - } - resolveMiddleware(clientStack, configuration, options) { - this.middlewareStack.use((0, middleware_serde_1.getSerdePlugin)(configuration, this.serialize, this.deserialize)); - this.middlewareStack.use((0, middleware_endpoint_1.getEndpointPlugin)(configuration, _DeleteStateMachineAliasCommand.getEndpointParameterInstructions())); - const stack = clientStack.concat(this.middlewareStack); - const { logger } = configuration; - const clientName = "SFNClient"; - const commandName = "DeleteStateMachineAliasCommand"; - const handlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: (_) => _, - outputFilterSensitiveLog: (_) => _, - [types_1.SMITHY_CONTEXT_KEY]: { - service: "AWSStepFunctions", - operation: "DeleteStateMachineAlias" - } - }; - const { requestHandler } = configuration; - return stack.resolve((request2) => requestHandler.handle(request2.request, options || {}), handlerExecutionContext); - } - serialize(input, context) { - return (0, Aws_json1_0_1.se_DeleteStateMachineAliasCommand)(input, context); + var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); + var src_exports = {}; + __export2(src_exports, { + fromProcess: () => fromProcess + }); + module2.exports = __toCommonJS2(src_exports); + var import_shared_ini_file_loader = require_dist_cjs41(); + var import_property_provider2 = require_dist_cjs40(); + var import_child_process = require("child_process"); + var import_util = require("util"); + var getValidatedProcessCredentials = /* @__PURE__ */ __name((profileName, data, profiles) => { + var _a; + if (data.Version !== 1) { + throw Error(`Profile ${profileName} credential_process did not return Version 1.`); } - deserialize(output, context) { - return (0, Aws_json1_0_1.de_DeleteStateMachineAliasCommand)(output, context); + if (data.AccessKeyId === void 0 || data.SecretAccessKey === void 0) { + throw Error(`Profile ${profileName} credential_process returned invalid credentials.`); } - }; - exports2.DeleteStateMachineAliasCommand = DeleteStateMachineAliasCommand; - } -}); - -// ../../../node_modules/@aws-sdk/client-sfn/dist-cjs/commands/DeleteStateMachineCommand.js -var require_DeleteStateMachineCommand = __commonJS({ - "../../../node_modules/@aws-sdk/client-sfn/dist-cjs/commands/DeleteStateMachineCommand.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.DeleteStateMachineCommand = exports2.$Command = void 0; - var middleware_endpoint_1 = require_dist_cjs26(); - var middleware_serde_1 = require_dist_cjs25(); - var smithy_client_1 = require_dist_cjs34(); - Object.defineProperty(exports2, "$Command", { enumerable: true, get: function() { - return smithy_client_1.Command; - } }); - var types_1 = require_dist_cjs(); - var Aws_json1_0_1 = require_Aws_json1_0(); - var DeleteStateMachineCommand = class _DeleteStateMachineCommand extends smithy_client_1.Command { - static getEndpointParameterInstructions() { - return { - UseFIPS: { type: "builtInParams", name: "useFipsEndpoint" }, - Endpoint: { type: "builtInParams", name: "endpoint" }, - Region: { type: "builtInParams", name: "region" }, - UseDualStack: { type: "builtInParams", name: "useDualstackEndpoint" } - }; + if (data.Expiration) { + const currentTime = /* @__PURE__ */ new Date(); + const expireTime = new Date(data.Expiration); + if (expireTime < currentTime) { + throw Error(`Profile ${profileName} credential_process returned expired credentials.`); + } } - constructor(input) { - super(); - this.input = input; + let accountId = data.AccountId; + if (!accountId && ((_a = profiles == null ? void 0 : profiles[profileName]) == null ? void 0 : _a.aws_account_id)) { + accountId = profiles[profileName].aws_account_id; } - resolveMiddleware(clientStack, configuration, options) { - this.middlewareStack.use((0, middleware_serde_1.getSerdePlugin)(configuration, this.serialize, this.deserialize)); - this.middlewareStack.use((0, middleware_endpoint_1.getEndpointPlugin)(configuration, _DeleteStateMachineCommand.getEndpointParameterInstructions())); - const stack = clientStack.concat(this.middlewareStack); - const { logger } = configuration; - const clientName = "SFNClient"; - const commandName = "DeleteStateMachineCommand"; - const handlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: (_) => _, - outputFilterSensitiveLog: (_) => _, - [types_1.SMITHY_CONTEXT_KEY]: { - service: "AWSStepFunctions", - operation: "DeleteStateMachine" + return { + accessKeyId: data.AccessKeyId, + secretAccessKey: data.SecretAccessKey, + ...data.SessionToken && { sessionToken: data.SessionToken }, + ...data.Expiration && { expiration: new Date(data.Expiration) }, + ...data.CredentialScope && { credentialScope: data.CredentialScope }, + ...accountId && { accountId } + }; + }, "getValidatedProcessCredentials"); + var resolveProcessCredentials = /* @__PURE__ */ __name(async (profileName, profiles, logger) => { + const profile = profiles[profileName]; + if (profiles[profileName]) { + const credentialProcess = profile["credential_process"]; + if (credentialProcess !== void 0) { + const execPromise = (0, import_util.promisify)(import_child_process.exec); + try { + const { stdout } = await execPromise(credentialProcess); + let data; + try { + data = JSON.parse(stdout.trim()); + } catch { + throw Error(`Profile ${profileName} credential_process returned invalid JSON.`); + } + return getValidatedProcessCredentials(profileName, data, profiles); + } catch (error) { + throw new import_property_provider2.CredentialsProviderError(error.message, { logger }); } - }; - const { requestHandler } = configuration; - return stack.resolve((request2) => requestHandler.handle(request2.request, options || {}), handlerExecutionContext); - } - serialize(input, context) { - return (0, Aws_json1_0_1.se_DeleteStateMachineCommand)(input, context); - } - deserialize(output, context) { - return (0, Aws_json1_0_1.de_DeleteStateMachineCommand)(output, context); + } else { + throw new import_property_provider2.CredentialsProviderError(`Profile ${profileName} did not contain credential_process.`, { logger }); + } + } else { + throw new import_property_provider2.CredentialsProviderError(`Profile ${profileName} could not be found in shared credentials file.`, { + logger + }); } - }; - exports2.DeleteStateMachineCommand = DeleteStateMachineCommand; + }, "resolveProcessCredentials"); + var fromProcess = /* @__PURE__ */ __name((init = {}) => async () => { + var _a; + (_a = init.logger) == null ? void 0 : _a.debug("@aws-sdk/credential-provider-process - fromProcess"); + const profiles = await (0, import_shared_ini_file_loader.parseKnownFiles)(init); + return resolveProcessCredentials((0, import_shared_ini_file_loader.getProfileName)(init), profiles, init.logger); + }, "fromProcess"); } }); -// ../../../node_modules/@aws-sdk/client-sfn/dist-cjs/commands/DeleteStateMachineVersionCommand.js -var require_DeleteStateMachineVersionCommand = __commonJS({ - "../../../node_modules/@aws-sdk/client-sfn/dist-cjs/commands/DeleteStateMachineVersionCommand.js"(exports2) { +// ../../../node_modules/@aws-sdk/credential-provider-web-identity/dist-cjs/fromWebToken.js +var require_fromWebToken = __commonJS({ + "../../../node_modules/@aws-sdk/credential-provider-web-identity/dist-cjs/fromWebToken.js"(exports2) { "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.DeleteStateMachineVersionCommand = exports2.$Command = void 0; - var middleware_endpoint_1 = require_dist_cjs26(); - var middleware_serde_1 = require_dist_cjs25(); - var smithy_client_1 = require_dist_cjs34(); - Object.defineProperty(exports2, "$Command", { enumerable: true, get: function() { - return smithy_client_1.Command; - } }); - var types_1 = require_dist_cjs(); - var Aws_json1_0_1 = require_Aws_json1_0(); - var DeleteStateMachineVersionCommand = class _DeleteStateMachineVersionCommand extends smithy_client_1.Command { - static getEndpointParameterInstructions() { - return { - UseFIPS: { type: "builtInParams", name: "useFipsEndpoint" }, - Endpoint: { type: "builtInParams", name: "endpoint" }, - Region: { type: "builtInParams", name: "region" }, - UseDualStack: { type: "builtInParams", name: "useDualstackEndpoint" } - }; - } - constructor(input) { - super(); - this.input = input; - } - resolveMiddleware(clientStack, configuration, options) { - this.middlewareStack.use((0, middleware_serde_1.getSerdePlugin)(configuration, this.serialize, this.deserialize)); - this.middlewareStack.use((0, middleware_endpoint_1.getEndpointPlugin)(configuration, _DeleteStateMachineVersionCommand.getEndpointParameterInstructions())); - const stack = clientStack.concat(this.middlewareStack); - const { logger } = configuration; - const clientName = "SFNClient"; - const commandName = "DeleteStateMachineVersionCommand"; - const handlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: (_) => _, - outputFilterSensitiveLog: (_) => _, - [types_1.SMITHY_CONTEXT_KEY]: { - service: "AWSStepFunctions", - operation: "DeleteStateMachineVersion" - } - }; - const { requestHandler } = configuration; - return stack.resolve((request2) => requestHandler.handle(request2.request, options || {}), handlerExecutionContext); + var __createBinding2 = exports2 && exports2.__createBinding || (Object.create ? function(o, m, k, k2) { + if (k2 === void 0) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { + return m[k]; + } }; } - serialize(input, context) { - return (0, Aws_json1_0_1.se_DeleteStateMachineVersionCommand)(input, context); + Object.defineProperty(o, k2, desc); + } : function(o, m, k, k2) { + if (k2 === void 0) k2 = k; + o[k2] = m[k]; + }); + var __setModuleDefault2 = exports2 && exports2.__setModuleDefault || (Object.create ? function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); + } : function(o, v) { + o["default"] = v; + }); + var __importStar2 = exports2 && exports2.__importStar || function(mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) { + for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding2(result, mod, k); } - deserialize(output, context) { - return (0, Aws_json1_0_1.de_DeleteStateMachineVersionCommand)(output, context); + __setModuleDefault2(result, mod); + return result; + }; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.fromWebToken = void 0; + var fromWebToken2 = (init) => async () => { + init.logger?.debug("@aws-sdk/credential-provider-web-identity - fromWebToken"); + const { roleArn, roleSessionName, webIdentityToken, providerId, policyArns, policy, durationSeconds } = init; + let { roleAssumerWithWebIdentity } = init; + if (!roleAssumerWithWebIdentity) { + const { getDefaultRoleAssumerWithWebIdentity } = await Promise.resolve().then(() => __importStar2(require_dist_cjs75())); + roleAssumerWithWebIdentity = getDefaultRoleAssumerWithWebIdentity({ + ...init.clientConfig, + credentialProviderLogger: init.logger, + parentClientConfig: init.parentClientConfig + }, init.clientPlugins); } + return roleAssumerWithWebIdentity({ + RoleArn: roleArn, + RoleSessionName: roleSessionName ?? `aws-sdk-js-session-${Date.now()}`, + WebIdentityToken: webIdentityToken, + ProviderId: providerId, + PolicyArns: policyArns, + Policy: policy, + DurationSeconds: durationSeconds + }); }; - exports2.DeleteStateMachineVersionCommand = DeleteStateMachineVersionCommand; + exports2.fromWebToken = fromWebToken2; } }); -// ../../../node_modules/@aws-sdk/client-sfn/dist-cjs/commands/DescribeActivityCommand.js -var require_DescribeActivityCommand = __commonJS({ - "../../../node_modules/@aws-sdk/client-sfn/dist-cjs/commands/DescribeActivityCommand.js"(exports2) { +// ../../../node_modules/@aws-sdk/credential-provider-web-identity/dist-cjs/fromTokenFile.js +var require_fromTokenFile = __commonJS({ + "../../../node_modules/@aws-sdk/credential-provider-web-identity/dist-cjs/fromTokenFile.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.DescribeActivityCommand = exports2.$Command = void 0; - var middleware_endpoint_1 = require_dist_cjs26(); - var middleware_serde_1 = require_dist_cjs25(); - var smithy_client_1 = require_dist_cjs34(); - Object.defineProperty(exports2, "$Command", { enumerable: true, get: function() { - return smithy_client_1.Command; - } }); - var types_1 = require_dist_cjs(); - var Aws_json1_0_1 = require_Aws_json1_0(); - var DescribeActivityCommand = class _DescribeActivityCommand extends smithy_client_1.Command { - static getEndpointParameterInstructions() { - return { - UseFIPS: { type: "builtInParams", name: "useFipsEndpoint" }, - Endpoint: { type: "builtInParams", name: "endpoint" }, - Region: { type: "builtInParams", name: "region" }, - UseDualStack: { type: "builtInParams", name: "useDualstackEndpoint" } - }; - } - constructor(input) { - super(); - this.input = input; - } - resolveMiddleware(clientStack, configuration, options) { - this.middlewareStack.use((0, middleware_serde_1.getSerdePlugin)(configuration, this.serialize, this.deserialize)); - this.middlewareStack.use((0, middleware_endpoint_1.getEndpointPlugin)(configuration, _DescribeActivityCommand.getEndpointParameterInstructions())); - const stack = clientStack.concat(this.middlewareStack); - const { logger } = configuration; - const clientName = "SFNClient"; - const commandName = "DescribeActivityCommand"; - const handlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: (_) => _, - outputFilterSensitiveLog: (_) => _, - [types_1.SMITHY_CONTEXT_KEY]: { - service: "AWSStepFunctions", - operation: "DescribeActivity" - } - }; - const { requestHandler } = configuration; - return stack.resolve((request2) => requestHandler.handle(request2.request, options || {}), handlerExecutionContext); - } - serialize(input, context) { - return (0, Aws_json1_0_1.se_DescribeActivityCommand)(input, context); - } - deserialize(output, context) { - return (0, Aws_json1_0_1.de_DescribeActivityCommand)(output, context); + exports2.fromTokenFile = void 0; + var property_provider_1 = require_dist_cjs40(); + var fs_1 = require("fs"); + var fromWebToken_1 = require_fromWebToken(); + var ENV_TOKEN_FILE = "AWS_WEB_IDENTITY_TOKEN_FILE"; + var ENV_ROLE_ARN = "AWS_ROLE_ARN"; + var ENV_ROLE_SESSION_NAME = "AWS_ROLE_SESSION_NAME"; + var fromTokenFile2 = (init = {}) => async () => { + init.logger?.debug("@aws-sdk/credential-provider-web-identity - fromTokenFile"); + const webIdentityTokenFile = init?.webIdentityTokenFile ?? process.env[ENV_TOKEN_FILE]; + const roleArn = init?.roleArn ?? process.env[ENV_ROLE_ARN]; + const roleSessionName = init?.roleSessionName ?? process.env[ENV_ROLE_SESSION_NAME]; + if (!webIdentityTokenFile || !roleArn) { + throw new property_provider_1.CredentialsProviderError("Web identity configuration not specified", { + logger: init.logger + }); } + return (0, fromWebToken_1.fromWebToken)({ + ...init, + webIdentityToken: (0, fs_1.readFileSync)(webIdentityTokenFile, { encoding: "ascii" }), + roleArn, + roleSessionName + })(); }; - exports2.DescribeActivityCommand = DescribeActivityCommand; + exports2.fromTokenFile = fromTokenFile2; } }); -// ../../../node_modules/@aws-sdk/client-sfn/dist-cjs/commands/DescribeExecutionCommand.js -var require_DescribeExecutionCommand = __commonJS({ - "../../../node_modules/@aws-sdk/client-sfn/dist-cjs/commands/DescribeExecutionCommand.js"(exports2) { +// ../../../node_modules/@aws-sdk/credential-provider-web-identity/dist-cjs/index.js +var require_dist_cjs77 = __commonJS({ + "../../../node_modules/@aws-sdk/credential-provider-web-identity/dist-cjs/index.js"(exports2, module2) { "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.DescribeExecutionCommand = exports2.$Command = void 0; - var middleware_endpoint_1 = require_dist_cjs26(); - var middleware_serde_1 = require_dist_cjs25(); - var smithy_client_1 = require_dist_cjs34(); - Object.defineProperty(exports2, "$Command", { enumerable: true, get: function() { - return smithy_client_1.Command; - } }); - var types_1 = require_dist_cjs(); - var models_0_1 = require_models_03(); - var Aws_json1_0_1 = require_Aws_json1_0(); - var DescribeExecutionCommand = class _DescribeExecutionCommand extends smithy_client_1.Command { - static getEndpointParameterInstructions() { - return { - UseFIPS: { type: "builtInParams", name: "useFipsEndpoint" }, - Endpoint: { type: "builtInParams", name: "endpoint" }, - Region: { type: "builtInParams", name: "region" }, - UseDualStack: { type: "builtInParams", name: "useDualstackEndpoint" } - }; - } - constructor(input) { - super(); - this.input = input; - } - resolveMiddleware(clientStack, configuration, options) { - this.middlewareStack.use((0, middleware_serde_1.getSerdePlugin)(configuration, this.serialize, this.deserialize)); - this.middlewareStack.use((0, middleware_endpoint_1.getEndpointPlugin)(configuration, _DescribeExecutionCommand.getEndpointParameterInstructions())); - const stack = clientStack.concat(this.middlewareStack); - const { logger } = configuration; - const clientName = "SFNClient"; - const commandName = "DescribeExecutionCommand"; - const handlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: (_) => _, - outputFilterSensitiveLog: models_0_1.DescribeExecutionOutputFilterSensitiveLog, - [types_1.SMITHY_CONTEXT_KEY]: { - service: "AWSStepFunctions", - operation: "DescribeExecution" - } - }; - const { requestHandler } = configuration; - return stack.resolve((request2) => requestHandler.handle(request2.request, options || {}), handlerExecutionContext); - } - serialize(input, context) { - return (0, Aws_json1_0_1.se_DescribeExecutionCommand)(input, context); - } - deserialize(output, context) { - return (0, Aws_json1_0_1.de_DescribeExecutionCommand)(output, context); + var __defProp2 = Object.defineProperty; + var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; + var __getOwnPropNames2 = Object.getOwnPropertyNames; + var __hasOwnProp2 = Object.prototype.hasOwnProperty; + var __copyProps2 = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames2(from)) + if (!__hasOwnProp2.call(to, key) && key !== except) + __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable }); } + return to; }; - exports2.DescribeExecutionCommand = DescribeExecutionCommand; + var __reExport = (target, mod, secondTarget) => (__copyProps2(target, mod, "default"), secondTarget && __copyProps2(secondTarget, mod, "default")); + var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); + var src_exports = {}; + module2.exports = __toCommonJS2(src_exports); + __reExport(src_exports, require_fromTokenFile(), module2.exports); + __reExport(src_exports, require_fromWebToken(), module2.exports); } }); -// ../../../node_modules/@aws-sdk/client-sfn/dist-cjs/commands/DescribeMapRunCommand.js -var require_DescribeMapRunCommand = __commonJS({ - "../../../node_modules/@aws-sdk/client-sfn/dist-cjs/commands/DescribeMapRunCommand.js"(exports2) { +// ../../../node_modules/@aws-sdk/credential-provider-ini/dist-cjs/index.js +var require_dist_cjs78 = __commonJS({ + "../../../node_modules/@aws-sdk/credential-provider-ini/dist-cjs/index.js"(exports2, module2) { "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.DescribeMapRunCommand = exports2.$Command = void 0; - var middleware_endpoint_1 = require_dist_cjs26(); - var middleware_serde_1 = require_dist_cjs25(); - var smithy_client_1 = require_dist_cjs34(); - Object.defineProperty(exports2, "$Command", { enumerable: true, get: function() { - return smithy_client_1.Command; - } }); - var types_1 = require_dist_cjs(); - var Aws_json1_0_1 = require_Aws_json1_0(); - var DescribeMapRunCommand = class _DescribeMapRunCommand extends smithy_client_1.Command { - static getEndpointParameterInstructions() { - return { - UseFIPS: { type: "builtInParams", name: "useFipsEndpoint" }, - Endpoint: { type: "builtInParams", name: "endpoint" }, - Region: { type: "builtInParams", name: "region" }, - UseDualStack: { type: "builtInParams", name: "useDualstackEndpoint" } - }; - } - constructor(input) { - super(); - this.input = input; + var __create2 = Object.create; + var __defProp2 = Object.defineProperty; + var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; + var __getOwnPropNames2 = Object.getOwnPropertyNames; + var __getProtoOf2 = Object.getPrototypeOf; + var __hasOwnProp2 = Object.prototype.hasOwnProperty; + var __name = (target, value) => __defProp2(target, "name", { value, configurable: true }); + var __export2 = (target, all) => { + for (var name in all) + __defProp2(target, name, { get: all[name], enumerable: true }); + }; + var __copyProps2 = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames2(from)) + if (!__hasOwnProp2.call(to, key) && key !== except) + __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable }); } - resolveMiddleware(clientStack, configuration, options) { - this.middlewareStack.use((0, middleware_serde_1.getSerdePlugin)(configuration, this.serialize, this.deserialize)); - this.middlewareStack.use((0, middleware_endpoint_1.getEndpointPlugin)(configuration, _DescribeMapRunCommand.getEndpointParameterInstructions())); - const stack = clientStack.concat(this.middlewareStack); - const { logger } = configuration; - const clientName = "SFNClient"; - const commandName = "DescribeMapRunCommand"; - const handlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: (_) => _, - outputFilterSensitiveLog: (_) => _, - [types_1.SMITHY_CONTEXT_KEY]: { - service: "AWSStepFunctions", - operation: "DescribeMapRun" - } - }; - const { requestHandler } = configuration; - return stack.resolve((request2) => requestHandler.handle(request2.request, options || {}), handlerExecutionContext); + return to; + }; + var __toESM2 = (mod, isNodeMode, target) => (target = mod != null ? __create2(__getProtoOf2(mod)) : {}, __copyProps2( + // If the importer is in node compatibility mode or this is not an ESM + // file that has been converted to a CommonJS file using a Babel- + // compatible transform (i.e. "__esModule" has not been set), then set + // "default" to the CommonJS "module.exports" for node compatibility. + isNodeMode || !mod || !mod.__esModule ? __defProp2(target, "default", { value: mod, enumerable: true }) : target, + mod + )); + var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); + var src_exports = {}; + __export2(src_exports, { + fromIni: () => fromIni + }); + module2.exports = __toCommonJS2(src_exports); + var import_shared_ini_file_loader = require_dist_cjs41(); + var import_property_provider2 = require_dist_cjs40(); + var resolveCredentialSource = /* @__PURE__ */ __name((credentialSource, profileName, logger) => { + const sourceProvidersMap = { + EcsContainer: async (options) => { + const { fromHttp } = await Promise.resolve().then(() => __toESM2(require_dist_cjs55())); + const { fromContainerMetadata } = await Promise.resolve().then(() => __toESM2(require_dist_cjs49())); + logger == null ? void 0 : logger.debug("@aws-sdk/credential-provider-ini - credential_source is EcsContainer"); + return (0, import_property_provider2.chain)(fromHttp(options ?? {}), fromContainerMetadata(options)); + }, + Ec2InstanceMetadata: async (options) => { + logger == null ? void 0 : logger.debug("@aws-sdk/credential-provider-ini - credential_source is Ec2InstanceMetadata"); + const { fromInstanceMetadata } = await Promise.resolve().then(() => __toESM2(require_dist_cjs49())); + return fromInstanceMetadata(options); + }, + Environment: async (options) => { + logger == null ? void 0 : logger.debug("@aws-sdk/credential-provider-ini - credential_source is Environment"); + const { fromEnv } = await Promise.resolve().then(() => __toESM2(require_dist_cjs48())); + return fromEnv(options); + } + }; + if (credentialSource in sourceProvidersMap) { + return sourceProvidersMap[credentialSource]; + } else { + throw new import_property_provider2.CredentialsProviderError( + `Unsupported credential source in profile ${profileName}. Got ${credentialSource}, expected EcsContainer or Ec2InstanceMetadata or Environment.`, + { logger } + ); } - serialize(input, context) { - return (0, Aws_json1_0_1.se_DescribeMapRunCommand)(input, context); + }, "resolveCredentialSource"); + var isAssumeRoleProfile = /* @__PURE__ */ __name((arg, { profile = "default", logger } = {}) => { + return Boolean(arg) && typeof arg === "object" && typeof arg.role_arn === "string" && ["undefined", "string"].indexOf(typeof arg.role_session_name) > -1 && ["undefined", "string"].indexOf(typeof arg.external_id) > -1 && ["undefined", "string"].indexOf(typeof arg.mfa_serial) > -1 && (isAssumeRoleWithSourceProfile(arg, { profile, logger }) || isCredentialSourceProfile(arg, { profile, logger })); + }, "isAssumeRoleProfile"); + var isAssumeRoleWithSourceProfile = /* @__PURE__ */ __name((arg, { profile, logger }) => { + var _a; + const withSourceProfile = typeof arg.source_profile === "string" && typeof arg.credential_source === "undefined"; + if (withSourceProfile) { + (_a = logger == null ? void 0 : logger.debug) == null ? void 0 : _a.call(logger, ` ${profile} isAssumeRoleWithSourceProfile source_profile=${arg.source_profile}`); } - deserialize(output, context) { - return (0, Aws_json1_0_1.de_DescribeMapRunCommand)(output, context); + return withSourceProfile; + }, "isAssumeRoleWithSourceProfile"); + var isCredentialSourceProfile = /* @__PURE__ */ __name((arg, { profile, logger }) => { + var _a; + const withProviderProfile = typeof arg.credential_source === "string" && typeof arg.source_profile === "undefined"; + if (withProviderProfile) { + (_a = logger == null ? void 0 : logger.debug) == null ? void 0 : _a.call(logger, ` ${profile} isCredentialSourceProfile credential_source=${arg.credential_source}`); } - }; - exports2.DescribeMapRunCommand = DescribeMapRunCommand; - } -}); - -// ../../../node_modules/@aws-sdk/client-sfn/dist-cjs/commands/DescribeStateMachineAliasCommand.js -var require_DescribeStateMachineAliasCommand = __commonJS({ - "../../../node_modules/@aws-sdk/client-sfn/dist-cjs/commands/DescribeStateMachineAliasCommand.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.DescribeStateMachineAliasCommand = exports2.$Command = void 0; - var middleware_endpoint_1 = require_dist_cjs26(); - var middleware_serde_1 = require_dist_cjs25(); - var smithy_client_1 = require_dist_cjs34(); - Object.defineProperty(exports2, "$Command", { enumerable: true, get: function() { - return smithy_client_1.Command; - } }); - var types_1 = require_dist_cjs(); - var models_0_1 = require_models_03(); - var Aws_json1_0_1 = require_Aws_json1_0(); - var DescribeStateMachineAliasCommand = class _DescribeStateMachineAliasCommand extends smithy_client_1.Command { - static getEndpointParameterInstructions() { - return { - UseFIPS: { type: "builtInParams", name: "useFipsEndpoint" }, - Endpoint: { type: "builtInParams", name: "endpoint" }, - Region: { type: "builtInParams", name: "region" }, - UseDualStack: { type: "builtInParams", name: "useDualstackEndpoint" } - }; + return withProviderProfile; + }, "isCredentialSourceProfile"); + var resolveAssumeRoleCredentials = /* @__PURE__ */ __name(async (profileName, profiles, options, visitedProfiles = {}) => { + var _a, _b; + (_a = options.logger) == null ? void 0 : _a.debug("@aws-sdk/credential-provider-ini - resolveAssumeRoleCredentials (STS)"); + const data = profiles[profileName]; + if (!options.roleAssumer) { + const { getDefaultRoleAssumer } = await Promise.resolve().then(() => __toESM2(require_dist_cjs75())); + options.roleAssumer = getDefaultRoleAssumer( + { + ...options.clientConfig, + credentialProviderLogger: options.logger, + parentClientConfig: options == null ? void 0 : options.parentClientConfig + }, + options.clientPlugins + ); } - constructor(input) { - super(); - this.input = input; + const { source_profile } = data; + if (source_profile && source_profile in visitedProfiles) { + throw new import_property_provider2.CredentialsProviderError( + `Detected a cycle attempting to resolve credentials for profile ${(0, import_shared_ini_file_loader.getProfileName)(options)}. Profiles visited: ` + Object.keys(visitedProfiles).join(", "), + { logger: options.logger } + ); } - resolveMiddleware(clientStack, configuration, options) { - this.middlewareStack.use((0, middleware_serde_1.getSerdePlugin)(configuration, this.serialize, this.deserialize)); - this.middlewareStack.use((0, middleware_endpoint_1.getEndpointPlugin)(configuration, _DescribeStateMachineAliasCommand.getEndpointParameterInstructions())); - const stack = clientStack.concat(this.middlewareStack); - const { logger } = configuration; - const clientName = "SFNClient"; - const commandName = "DescribeStateMachineAliasCommand"; - const handlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: (_) => _, - outputFilterSensitiveLog: models_0_1.DescribeStateMachineAliasOutputFilterSensitiveLog, - [types_1.SMITHY_CONTEXT_KEY]: { - service: "AWSStepFunctions", - operation: "DescribeStateMachineAlias" + (_b = options.logger) == null ? void 0 : _b.debug( + `@aws-sdk/credential-provider-ini - finding credential resolver using ${source_profile ? `source_profile=[${source_profile}]` : `profile=[${profileName}]`}` + ); + const sourceCredsProvider = source_profile ? resolveProfileData( + source_profile, + { + ...profiles, + [source_profile]: { + ...profiles[source_profile], + // This assigns the role_arn of the "root" profile + // to the credential_source profile so this recursive call knows + // what role to assume. + role_arn: data.role_arn ?? profiles[source_profile].role_arn } - }; - const { requestHandler } = configuration; - return stack.resolve((request2) => requestHandler.handle(request2.request, options || {}), handlerExecutionContext); - } - serialize(input, context) { - return (0, Aws_json1_0_1.se_DescribeStateMachineAliasCommand)(input, context); + }, + options, + { + ...visitedProfiles, + [source_profile]: true + } + ) : (await resolveCredentialSource(data.credential_source, profileName, options.logger)(options))(); + const params = { + RoleArn: data.role_arn, + RoleSessionName: data.role_session_name || `aws-sdk-js-${Date.now()}`, + ExternalId: data.external_id, + DurationSeconds: parseInt(data.duration_seconds || "3600", 10) + }; + const { mfa_serial } = data; + if (mfa_serial) { + if (!options.mfaCodeProvider) { + throw new import_property_provider2.CredentialsProviderError( + `Profile ${profileName} requires multi-factor authentication, but no MFA code callback was provided.`, + { logger: options.logger, tryNextLink: false } + ); + } + params.SerialNumber = mfa_serial; + params.TokenCode = await options.mfaCodeProvider(mfa_serial); } - deserialize(output, context) { - return (0, Aws_json1_0_1.de_DescribeStateMachineAliasCommand)(output, context); + const sourceCreds = await sourceCredsProvider; + return options.roleAssumer(sourceCreds, params); + }, "resolveAssumeRoleCredentials"); + var isProcessProfile = /* @__PURE__ */ __name((arg) => Boolean(arg) && typeof arg === "object" && typeof arg.credential_process === "string", "isProcessProfile"); + var resolveProcessCredentials = /* @__PURE__ */ __name(async (options, profile) => Promise.resolve().then(() => __toESM2(require_dist_cjs76())).then( + ({ fromProcess }) => fromProcess({ + ...options, + profile + })() + ), "resolveProcessCredentials"); + var resolveSsoCredentials = /* @__PURE__ */ __name(async (profile, options = {}) => { + const { fromSSO } = await Promise.resolve().then(() => __toESM2(require_dist_cjs74())); + return fromSSO({ + profile, + logger: options.logger + })(); + }, "resolveSsoCredentials"); + var isSsoProfile = /* @__PURE__ */ __name((arg) => arg && (typeof arg.sso_start_url === "string" || typeof arg.sso_account_id === "string" || typeof arg.sso_session === "string" || typeof arg.sso_region === "string" || typeof arg.sso_role_name === "string"), "isSsoProfile"); + var isStaticCredsProfile = /* @__PURE__ */ __name((arg) => Boolean(arg) && typeof arg === "object" && typeof arg.aws_access_key_id === "string" && typeof arg.aws_secret_access_key === "string" && ["undefined", "string"].indexOf(typeof arg.aws_session_token) > -1 && ["undefined", "string"].indexOf(typeof arg.aws_account_id) > -1, "isStaticCredsProfile"); + var resolveStaticCredentials = /* @__PURE__ */ __name((profile, options) => { + var _a; + (_a = options == null ? void 0 : options.logger) == null ? void 0 : _a.debug("@aws-sdk/credential-provider-ini - resolveStaticCredentials"); + return Promise.resolve({ + accessKeyId: profile.aws_access_key_id, + secretAccessKey: profile.aws_secret_access_key, + sessionToken: profile.aws_session_token, + ...profile.aws_credential_scope && { credentialScope: profile.aws_credential_scope }, + ...profile.aws_account_id && { accountId: profile.aws_account_id } + }); + }, "resolveStaticCredentials"); + var isWebIdentityProfile = /* @__PURE__ */ __name((arg) => Boolean(arg) && typeof arg === "object" && typeof arg.web_identity_token_file === "string" && typeof arg.role_arn === "string" && ["undefined", "string"].indexOf(typeof arg.role_session_name) > -1, "isWebIdentityProfile"); + var resolveWebIdentityCredentials = /* @__PURE__ */ __name(async (profile, options) => Promise.resolve().then(() => __toESM2(require_dist_cjs77())).then( + ({ fromTokenFile: fromTokenFile2 }) => fromTokenFile2({ + webIdentityTokenFile: profile.web_identity_token_file, + roleArn: profile.role_arn, + roleSessionName: profile.role_session_name, + roleAssumerWithWebIdentity: options.roleAssumerWithWebIdentity, + logger: options.logger, + parentClientConfig: options.parentClientConfig + })() + ), "resolveWebIdentityCredentials"); + var resolveProfileData = /* @__PURE__ */ __name(async (profileName, profiles, options, visitedProfiles = {}) => { + const data = profiles[profileName]; + if (Object.keys(visitedProfiles).length > 0 && isStaticCredsProfile(data)) { + return resolveStaticCredentials(data, options); } - }; - exports2.DescribeStateMachineAliasCommand = DescribeStateMachineAliasCommand; - } -}); - -// ../../../node_modules/@aws-sdk/client-sfn/dist-cjs/commands/DescribeStateMachineCommand.js -var require_DescribeStateMachineCommand = __commonJS({ - "../../../node_modules/@aws-sdk/client-sfn/dist-cjs/commands/DescribeStateMachineCommand.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.DescribeStateMachineCommand = exports2.$Command = void 0; - var middleware_endpoint_1 = require_dist_cjs26(); - var middleware_serde_1 = require_dist_cjs25(); - var smithy_client_1 = require_dist_cjs34(); - Object.defineProperty(exports2, "$Command", { enumerable: true, get: function() { - return smithy_client_1.Command; - } }); - var types_1 = require_dist_cjs(); - var models_0_1 = require_models_03(); - var Aws_json1_0_1 = require_Aws_json1_0(); - var DescribeStateMachineCommand = class _DescribeStateMachineCommand extends smithy_client_1.Command { - static getEndpointParameterInstructions() { - return { - UseFIPS: { type: "builtInParams", name: "useFipsEndpoint" }, - Endpoint: { type: "builtInParams", name: "endpoint" }, - Region: { type: "builtInParams", name: "region" }, - UseDualStack: { type: "builtInParams", name: "useDualstackEndpoint" } - }; + if (isAssumeRoleProfile(data, { profile: profileName, logger: options.logger })) { + return resolveAssumeRoleCredentials(profileName, profiles, options, visitedProfiles); } - constructor(input) { - super(); - this.input = input; + if (isStaticCredsProfile(data)) { + return resolveStaticCredentials(data, options); } - resolveMiddleware(clientStack, configuration, options) { - this.middlewareStack.use((0, middleware_serde_1.getSerdePlugin)(configuration, this.serialize, this.deserialize)); - this.middlewareStack.use((0, middleware_endpoint_1.getEndpointPlugin)(configuration, _DescribeStateMachineCommand.getEndpointParameterInstructions())); - const stack = clientStack.concat(this.middlewareStack); - const { logger } = configuration; - const clientName = "SFNClient"; - const commandName = "DescribeStateMachineCommand"; - const handlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: (_) => _, - outputFilterSensitiveLog: models_0_1.DescribeStateMachineOutputFilterSensitiveLog, - [types_1.SMITHY_CONTEXT_KEY]: { - service: "AWSStepFunctions", - operation: "DescribeStateMachine" - } - }; - const { requestHandler } = configuration; - return stack.resolve((request2) => requestHandler.handle(request2.request, options || {}), handlerExecutionContext); + if (isWebIdentityProfile(data)) { + return resolveWebIdentityCredentials(data, options); } - serialize(input, context) { - return (0, Aws_json1_0_1.se_DescribeStateMachineCommand)(input, context); + if (isProcessProfile(data)) { + return resolveProcessCredentials(options, profileName); } - deserialize(output, context) { - return (0, Aws_json1_0_1.de_DescribeStateMachineCommand)(output, context); + if (isSsoProfile(data)) { + return await resolveSsoCredentials(profileName, options); } - }; - exports2.DescribeStateMachineCommand = DescribeStateMachineCommand; + throw new import_property_provider2.CredentialsProviderError( + `Could not resolve credentials using profile: [${profileName}] in configuration/credentials file(s).`, + { logger: options.logger } + ); + }, "resolveProfileData"); + var fromIni = /* @__PURE__ */ __name((init = {}) => async () => { + var _a; + (_a = init.logger) == null ? void 0 : _a.debug("@aws-sdk/credential-provider-ini - fromIni"); + const profiles = await (0, import_shared_ini_file_loader.parseKnownFiles)(init); + return resolveProfileData((0, import_shared_ini_file_loader.getProfileName)(init), profiles, init); + }, "fromIni"); } }); -// ../../../node_modules/@aws-sdk/client-sfn/dist-cjs/commands/DescribeStateMachineForExecutionCommand.js -var require_DescribeStateMachineForExecutionCommand = __commonJS({ - "../../../node_modules/@aws-sdk/client-sfn/dist-cjs/commands/DescribeStateMachineForExecutionCommand.js"(exports2) { +// ../../../node_modules/@aws-sdk/credential-provider-node/dist-cjs/index.js +var require_dist_cjs79 = __commonJS({ + "../../../node_modules/@aws-sdk/credential-provider-node/dist-cjs/index.js"(exports2, module2) { "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.DescribeStateMachineForExecutionCommand = exports2.$Command = void 0; - var middleware_endpoint_1 = require_dist_cjs26(); - var middleware_serde_1 = require_dist_cjs25(); - var smithy_client_1 = require_dist_cjs34(); - Object.defineProperty(exports2, "$Command", { enumerable: true, get: function() { - return smithy_client_1.Command; - } }); - var types_1 = require_dist_cjs(); - var models_0_1 = require_models_03(); - var Aws_json1_0_1 = require_Aws_json1_0(); - var DescribeStateMachineForExecutionCommand = class _DescribeStateMachineForExecutionCommand extends smithy_client_1.Command { - static getEndpointParameterInstructions() { - return { - UseFIPS: { type: "builtInParams", name: "useFipsEndpoint" }, - Endpoint: { type: "builtInParams", name: "endpoint" }, - Region: { type: "builtInParams", name: "region" }, - UseDualStack: { type: "builtInParams", name: "useDualstackEndpoint" } - }; + var __create2 = Object.create; + var __defProp2 = Object.defineProperty; + var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; + var __getOwnPropNames2 = Object.getOwnPropertyNames; + var __getProtoOf2 = Object.getPrototypeOf; + var __hasOwnProp2 = Object.prototype.hasOwnProperty; + var __name = (target, value) => __defProp2(target, "name", { value, configurable: true }); + var __export2 = (target, all) => { + for (var name in all) + __defProp2(target, name, { get: all[name], enumerable: true }); + }; + var __copyProps2 = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames2(from)) + if (!__hasOwnProp2.call(to, key) && key !== except) + __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable }); } - constructor(input) { - super(); - this.input = input; + return to; + }; + var __toESM2 = (mod, isNodeMode, target) => (target = mod != null ? __create2(__getProtoOf2(mod)) : {}, __copyProps2( + // If the importer is in node compatibility mode or this is not an ESM + // file that has been converted to a CommonJS file using a Babel- + // compatible transform (i.e. "__esModule" has not been set), then set + // "default" to the CommonJS "module.exports" for node compatibility. + isNodeMode || !mod || !mod.__esModule ? __defProp2(target, "default", { value: mod, enumerable: true }) : target, + mod + )); + var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); + var src_exports = {}; + __export2(src_exports, { + credentialsTreatedAsExpired: () => credentialsTreatedAsExpired, + credentialsWillNeedRefresh: () => credentialsWillNeedRefresh, + defaultProvider: () => defaultProvider + }); + module2.exports = __toCommonJS2(src_exports); + var import_credential_provider_env = require_dist_cjs48(); + var import_shared_ini_file_loader = require_dist_cjs41(); + var import_property_provider2 = require_dist_cjs40(); + var ENV_IMDS_DISABLED = "AWS_EC2_METADATA_DISABLED"; + var remoteProvider = /* @__PURE__ */ __name(async (init) => { + var _a, _b; + const { ENV_CMDS_FULL_URI, ENV_CMDS_RELATIVE_URI, fromContainerMetadata, fromInstanceMetadata } = await Promise.resolve().then(() => __toESM2(require_dist_cjs49())); + if (process.env[ENV_CMDS_RELATIVE_URI] || process.env[ENV_CMDS_FULL_URI]) { + (_a = init.logger) == null ? void 0 : _a.debug("@aws-sdk/credential-provider-node - remoteProvider::fromHttp/fromContainerMetadata"); + const { fromHttp } = await Promise.resolve().then(() => __toESM2(require_dist_cjs55())); + return (0, import_property_provider2.chain)(fromHttp(init), fromContainerMetadata(init)); } - resolveMiddleware(clientStack, configuration, options) { - this.middlewareStack.use((0, middleware_serde_1.getSerdePlugin)(configuration, this.serialize, this.deserialize)); - this.middlewareStack.use((0, middleware_endpoint_1.getEndpointPlugin)(configuration, _DescribeStateMachineForExecutionCommand.getEndpointParameterInstructions())); - const stack = clientStack.concat(this.middlewareStack); - const { logger } = configuration; - const clientName = "SFNClient"; - const commandName = "DescribeStateMachineForExecutionCommand"; - const handlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: (_) => _, - outputFilterSensitiveLog: models_0_1.DescribeStateMachineForExecutionOutputFilterSensitiveLog, - [types_1.SMITHY_CONTEXT_KEY]: { - service: "AWSStepFunctions", - operation: "DescribeStateMachineForExecution" - } + if (process.env[ENV_IMDS_DISABLED]) { + return async () => { + throw new import_property_provider2.CredentialsProviderError("EC2 Instance Metadata Service access disabled", { logger: init.logger }); }; - const { requestHandler } = configuration; - return stack.resolve((request2) => requestHandler.handle(request2.request, options || {}), handlerExecutionContext); - } - serialize(input, context) { - return (0, Aws_json1_0_1.se_DescribeStateMachineForExecutionCommand)(input, context); - } - deserialize(output, context) { - return (0, Aws_json1_0_1.de_DescribeStateMachineForExecutionCommand)(output, context); } - }; - exports2.DescribeStateMachineForExecutionCommand = DescribeStateMachineForExecutionCommand; + (_b = init.logger) == null ? void 0 : _b.debug("@aws-sdk/credential-provider-node - remoteProvider::fromInstanceMetadata"); + return fromInstanceMetadata(init); + }, "remoteProvider"); + var multipleCredentialSourceWarningEmitted = false; + var defaultProvider = /* @__PURE__ */ __name((init = {}) => (0, import_property_provider2.memoize)( + (0, import_property_provider2.chain)( + async () => { + var _a, _b, _c, _d; + const profile = init.profile ?? process.env[import_shared_ini_file_loader.ENV_PROFILE]; + if (profile) { + const envStaticCredentialsAreSet = process.env[import_credential_provider_env.ENV_KEY] && process.env[import_credential_provider_env.ENV_SECRET]; + if (envStaticCredentialsAreSet) { + if (!multipleCredentialSourceWarningEmitted) { + const warnFn = ((_a = init.logger) == null ? void 0 : _a.warn) && ((_c = (_b = init.logger) == null ? void 0 : _b.constructor) == null ? void 0 : _c.name) !== "NoOpLogger" ? init.logger.warn : console.warn; + warnFn( + `@aws-sdk/credential-provider-node - defaultProvider::fromEnv WARNING: + Multiple credential sources detected: + Both AWS_PROFILE and the pair AWS_ACCESS_KEY_ID/AWS_SECRET_ACCESS_KEY static credentials are set. + This SDK will proceed with the AWS_PROFILE value. + + However, a future version may change this behavior to prefer the ENV static credentials. + Please ensure that your environment only sets either the AWS_PROFILE or the + AWS_ACCESS_KEY_ID/AWS_SECRET_ACCESS_KEY pair. +` + ); + multipleCredentialSourceWarningEmitted = true; + } + } + throw new import_property_provider2.CredentialsProviderError("AWS_PROFILE is set, skipping fromEnv provider.", { + logger: init.logger, + tryNextLink: true + }); + } + (_d = init.logger) == null ? void 0 : _d.debug("@aws-sdk/credential-provider-node - defaultProvider::fromEnv"); + return (0, import_credential_provider_env.fromEnv)(init)(); + }, + async () => { + var _a; + (_a = init.logger) == null ? void 0 : _a.debug("@aws-sdk/credential-provider-node - defaultProvider::fromSSO"); + const { ssoStartUrl, ssoAccountId, ssoRegion, ssoRoleName, ssoSession } = init; + if (!ssoStartUrl && !ssoAccountId && !ssoRegion && !ssoRoleName && !ssoSession) { + throw new import_property_provider2.CredentialsProviderError( + "Skipping SSO provider in default chain (inputs do not include SSO fields).", + { logger: init.logger } + ); + } + const { fromSSO } = await Promise.resolve().then(() => __toESM2(require_dist_cjs74())); + return fromSSO(init)(); + }, + async () => { + var _a; + (_a = init.logger) == null ? void 0 : _a.debug("@aws-sdk/credential-provider-node - defaultProvider::fromIni"); + const { fromIni } = await Promise.resolve().then(() => __toESM2(require_dist_cjs78())); + return fromIni(init)(); + }, + async () => { + var _a; + (_a = init.logger) == null ? void 0 : _a.debug("@aws-sdk/credential-provider-node - defaultProvider::fromProcess"); + const { fromProcess } = await Promise.resolve().then(() => __toESM2(require_dist_cjs76())); + return fromProcess(init)(); + }, + async () => { + var _a; + (_a = init.logger) == null ? void 0 : _a.debug("@aws-sdk/credential-provider-node - defaultProvider::fromTokenFile"); + const { fromTokenFile: fromTokenFile2 } = await Promise.resolve().then(() => __toESM2(require_dist_cjs77())); + return fromTokenFile2(init)(); + }, + async () => { + var _a; + (_a = init.logger) == null ? void 0 : _a.debug("@aws-sdk/credential-provider-node - defaultProvider::remoteProvider"); + return (await remoteProvider(init))(); + }, + async () => { + throw new import_property_provider2.CredentialsProviderError("Could not load credentials from any providers", { + tryNextLink: false, + logger: init.logger + }); + } + ), + credentialsTreatedAsExpired, + credentialsWillNeedRefresh + ), "defaultProvider"); + var credentialsWillNeedRefresh = /* @__PURE__ */ __name((credentials) => (credentials == null ? void 0 : credentials.expiration) !== void 0, "credentialsWillNeedRefresh"); + var credentialsTreatedAsExpired = /* @__PURE__ */ __name((credentials) => (credentials == null ? void 0 : credentials.expiration) !== void 0 && credentials.expiration.getTime() - Date.now() < 3e5, "credentialsTreatedAsExpired"); } }); -// ../../../node_modules/@aws-sdk/client-sfn/dist-cjs/commands/GetActivityTaskCommand.js -var require_GetActivityTaskCommand = __commonJS({ - "../../../node_modules/@aws-sdk/client-sfn/dist-cjs/commands/GetActivityTaskCommand.js"(exports2) { +// ../../../node_modules/@aws-sdk/client-sfn/dist-cjs/endpoint/ruleset.js +var require_ruleset4 = __commonJS({ + "../../../node_modules/@aws-sdk/client-sfn/dist-cjs/endpoint/ruleset.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.GetActivityTaskCommand = exports2.$Command = void 0; - var middleware_endpoint_1 = require_dist_cjs26(); - var middleware_serde_1 = require_dist_cjs25(); - var smithy_client_1 = require_dist_cjs34(); - Object.defineProperty(exports2, "$Command", { enumerable: true, get: function() { - return smithy_client_1.Command; - } }); - var types_1 = require_dist_cjs(); - var models_0_1 = require_models_03(); - var Aws_json1_0_1 = require_Aws_json1_0(); - var GetActivityTaskCommand = class _GetActivityTaskCommand extends smithy_client_1.Command { - static getEndpointParameterInstructions() { - return { - UseFIPS: { type: "builtInParams", name: "useFipsEndpoint" }, - Endpoint: { type: "builtInParams", name: "endpoint" }, - Region: { type: "builtInParams", name: "region" }, - UseDualStack: { type: "builtInParams", name: "useDualstackEndpoint" } - }; - } - constructor(input) { - super(); - this.input = input; - } - resolveMiddleware(clientStack, configuration, options) { - this.middlewareStack.use((0, middleware_serde_1.getSerdePlugin)(configuration, this.serialize, this.deserialize)); - this.middlewareStack.use((0, middleware_endpoint_1.getEndpointPlugin)(configuration, _GetActivityTaskCommand.getEndpointParameterInstructions())); - const stack = clientStack.concat(this.middlewareStack); - const { logger } = configuration; - const clientName = "SFNClient"; - const commandName = "GetActivityTaskCommand"; - const handlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: (_) => _, - outputFilterSensitiveLog: models_0_1.GetActivityTaskOutputFilterSensitiveLog, - [types_1.SMITHY_CONTEXT_KEY]: { - service: "AWSStepFunctions", - operation: "GetActivityTask" - } - }; - const { requestHandler } = configuration; - return stack.resolve((request2) => requestHandler.handle(request2.request, options || {}), handlerExecutionContext); - } - serialize(input, context) { - return (0, Aws_json1_0_1.se_GetActivityTaskCommand)(input, context); - } - deserialize(output, context) { - return (0, Aws_json1_0_1.de_GetActivityTaskCommand)(output, context); - } - }; - exports2.GetActivityTaskCommand = GetActivityTaskCommand; + exports2.ruleSet = void 0; + var t = "required"; + var u = "fn"; + var v = "argv"; + var w = "ref"; + var a = true; + var b = "isSet"; + var c = "booleanEquals"; + var d = "error"; + var e = "endpoint"; + var f = "tree"; + var g = "PartitionResult"; + var h = { [t]: false, "type": "String" }; + var i = { [t]: true, "default": false, "type": "Boolean" }; + var j = { [w]: "Endpoint" }; + var k = { [u]: c, [v]: [{ [w]: "UseFIPS" }, true] }; + var l = { [u]: c, [v]: [{ [w]: "UseDualStack" }, true] }; + var m = {}; + var n = { [w]: "Region" }; + var o = { [u]: "getAttr", [v]: [{ [w]: g }, "supportsFIPS"] }; + var p = { [u]: c, [v]: [true, { [u]: "getAttr", [v]: [{ [w]: g }, "supportsDualStack"] }] }; + var q = [k]; + var r = [l]; + var s = [n]; + var _data = { version: "1.0", parameters: { Region: h, UseDualStack: i, UseFIPS: i, Endpoint: h }, rules: [{ conditions: [{ [u]: b, [v]: [j] }], rules: [{ conditions: q, error: "Invalid Configuration: FIPS and custom endpoint are not supported", type: d }, { conditions: r, error: "Invalid Configuration: Dualstack and custom endpoint are not supported", type: d }, { endpoint: { url: j, properties: m, headers: m }, type: e }], type: f }, { conditions: [{ [u]: b, [v]: s }], rules: [{ conditions: [{ [u]: "aws.partition", [v]: s, assign: g }], rules: [{ conditions: [k, l], rules: [{ conditions: [{ [u]: c, [v]: [a, o] }, p], rules: [{ endpoint: { url: "https://states-fips.{Region}.{PartitionResult#dualStackDnsSuffix}", properties: m, headers: m }, type: e }], type: f }, { error: "FIPS and DualStack are enabled, but this partition does not support one or both", type: d }], type: f }, { conditions: q, rules: [{ conditions: [{ [u]: c, [v]: [o, a] }], rules: [{ conditions: [{ [u]: "stringEquals", [v]: [n, "us-gov-west-1"] }], endpoint: { url: "https://states.us-gov-west-1.amazonaws.com", properties: m, headers: m }, type: e }, { endpoint: { url: "https://states-fips.{Region}.{PartitionResult#dnsSuffix}", properties: m, headers: m }, type: e }], type: f }, { error: "FIPS is enabled but this partition does not support FIPS", type: d }], type: f }, { conditions: r, rules: [{ conditions: [p], rules: [{ endpoint: { url: "https://states.{Region}.{PartitionResult#dualStackDnsSuffix}", properties: m, headers: m }, type: e }], type: f }, { error: "DualStack is enabled but this partition does not support DualStack", type: d }], type: f }, { endpoint: { url: "https://states.{Region}.{PartitionResult#dnsSuffix}", properties: m, headers: m }, type: e }], type: f }], type: f }, { error: "Invalid Configuration: Missing Region", type: d }] }; + exports2.ruleSet = _data; } }); -// ../../../node_modules/@aws-sdk/client-sfn/dist-cjs/commands/GetExecutionHistoryCommand.js -var require_GetExecutionHistoryCommand = __commonJS({ - "../../../node_modules/@aws-sdk/client-sfn/dist-cjs/commands/GetExecutionHistoryCommand.js"(exports2) { +// ../../../node_modules/@aws-sdk/client-sfn/dist-cjs/endpoint/endpointResolver.js +var require_endpointResolver4 = __commonJS({ + "../../../node_modules/@aws-sdk/client-sfn/dist-cjs/endpoint/endpointResolver.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.GetExecutionHistoryCommand = exports2.$Command = void 0; - var middleware_endpoint_1 = require_dist_cjs26(); - var middleware_serde_1 = require_dist_cjs25(); - var smithy_client_1 = require_dist_cjs34(); - Object.defineProperty(exports2, "$Command", { enumerable: true, get: function() { - return smithy_client_1.Command; - } }); - var types_1 = require_dist_cjs(); - var models_0_1 = require_models_03(); - var Aws_json1_0_1 = require_Aws_json1_0(); - var GetExecutionHistoryCommand = class _GetExecutionHistoryCommand extends smithy_client_1.Command { - static getEndpointParameterInstructions() { - return { - UseFIPS: { type: "builtInParams", name: "useFipsEndpoint" }, - Endpoint: { type: "builtInParams", name: "endpoint" }, - Region: { type: "builtInParams", name: "region" }, - UseDualStack: { type: "builtInParams", name: "useDualstackEndpoint" } - }; - } - constructor(input) { - super(); - this.input = input; - } - resolveMiddleware(clientStack, configuration, options) { - this.middlewareStack.use((0, middleware_serde_1.getSerdePlugin)(configuration, this.serialize, this.deserialize)); - this.middlewareStack.use((0, middleware_endpoint_1.getEndpointPlugin)(configuration, _GetExecutionHistoryCommand.getEndpointParameterInstructions())); - const stack = clientStack.concat(this.middlewareStack); - const { logger } = configuration; - const clientName = "SFNClient"; - const commandName = "GetExecutionHistoryCommand"; - const handlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: (_) => _, - outputFilterSensitiveLog: models_0_1.GetExecutionHistoryOutputFilterSensitiveLog, - [types_1.SMITHY_CONTEXT_KEY]: { - service: "AWSStepFunctions", - operation: "GetExecutionHistory" - } - }; - const { requestHandler } = configuration; - return stack.resolve((request2) => requestHandler.handle(request2.request, options || {}), handlerExecutionContext); - } - serialize(input, context) { - return (0, Aws_json1_0_1.se_GetExecutionHistoryCommand)(input, context); - } - deserialize(output, context) { - return (0, Aws_json1_0_1.de_GetExecutionHistoryCommand)(output, context); - } + exports2.defaultEndpointResolver = void 0; + var util_endpoints_1 = require_dist_cjs7(); + var util_endpoints_2 = require_dist_cjs6(); + var ruleset_1 = require_ruleset4(); + var defaultEndpointResolver = (endpointParams, context = {}) => { + return (0, util_endpoints_2.resolveEndpoint)(ruleset_1.ruleSet, { + endpointParams, + logger: context.logger + }); }; - exports2.GetExecutionHistoryCommand = GetExecutionHistoryCommand; + exports2.defaultEndpointResolver = defaultEndpointResolver; + util_endpoints_2.customEndpointFunctions.aws = util_endpoints_1.awsEndpointFunctions; } }); -// ../../../node_modules/@aws-sdk/client-sfn/dist-cjs/commands/ListActivitiesCommand.js -var require_ListActivitiesCommand = __commonJS({ - "../../../node_modules/@aws-sdk/client-sfn/dist-cjs/commands/ListActivitiesCommand.js"(exports2) { +// ../../../node_modules/@aws-sdk/client-sfn/dist-cjs/runtimeConfig.shared.js +var require_runtimeConfig_shared4 = __commonJS({ + "../../../node_modules/@aws-sdk/client-sfn/dist-cjs/runtimeConfig.shared.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.ListActivitiesCommand = exports2.$Command = void 0; - var middleware_endpoint_1 = require_dist_cjs26(); - var middleware_serde_1 = require_dist_cjs25(); - var smithy_client_1 = require_dist_cjs34(); - Object.defineProperty(exports2, "$Command", { enumerable: true, get: function() { - return smithy_client_1.Command; - } }); - var types_1 = require_dist_cjs(); - var Aws_json1_0_1 = require_Aws_json1_0(); - var ListActivitiesCommand = class _ListActivitiesCommand extends smithy_client_1.Command { - static getEndpointParameterInstructions() { - return { - UseFIPS: { type: "builtInParams", name: "useFipsEndpoint" }, - Endpoint: { type: "builtInParams", name: "endpoint" }, - Region: { type: "builtInParams", name: "region" }, - UseDualStack: { type: "builtInParams", name: "useDualstackEndpoint" } - }; - } - constructor(input) { - super(); - this.input = input; - } - resolveMiddleware(clientStack, configuration, options) { - this.middlewareStack.use((0, middleware_serde_1.getSerdePlugin)(configuration, this.serialize, this.deserialize)); - this.middlewareStack.use((0, middleware_endpoint_1.getEndpointPlugin)(configuration, _ListActivitiesCommand.getEndpointParameterInstructions())); - const stack = clientStack.concat(this.middlewareStack); - const { logger } = configuration; - const clientName = "SFNClient"; - const commandName = "ListActivitiesCommand"; - const handlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: (_) => _, - outputFilterSensitiveLog: (_) => _, - [types_1.SMITHY_CONTEXT_KEY]: { - service: "AWSStepFunctions", - operation: "ListActivities" - } - }; - const { requestHandler } = configuration; - return stack.resolve((request2) => requestHandler.handle(request2.request, options || {}), handlerExecutionContext); - } - serialize(input, context) { - return (0, Aws_json1_0_1.se_ListActivitiesCommand)(input, context); - } - deserialize(output, context) { - return (0, Aws_json1_0_1.de_ListActivitiesCommand)(output, context); - } + exports2.getRuntimeConfig = void 0; + var core_1 = (init_dist_es2(), __toCommonJS(dist_es_exports2)); + var smithy_client_1 = require_dist_cjs37(); + var url_parser_1 = require_dist_cjs44(); + var util_base64_1 = require_dist_cjs29(); + var util_utf8_1 = require_dist_cjs28(); + var httpAuthSchemeProvider_1 = require_httpAuthSchemeProvider(); + var endpointResolver_1 = require_endpointResolver4(); + var getRuntimeConfig = (config) => { + return { + apiVersion: "2016-11-23", + base64Decoder: config?.base64Decoder ?? util_base64_1.fromBase64, + base64Encoder: config?.base64Encoder ?? util_base64_1.toBase64, + disableHostPrefix: config?.disableHostPrefix ?? false, + endpointProvider: config?.endpointProvider ?? endpointResolver_1.defaultEndpointResolver, + extensions: config?.extensions ?? [], + httpAuthSchemeProvider: config?.httpAuthSchemeProvider ?? httpAuthSchemeProvider_1.defaultSFNHttpAuthSchemeProvider, + httpAuthSchemes: config?.httpAuthSchemes ?? [ + { + schemeId: "aws.auth#sigv4", + identityProvider: (ipc) => ipc.getIdentityProvider("aws.auth#sigv4"), + signer: new core_1.AwsSdkSigV4Signer() + } + ], + logger: config?.logger ?? new smithy_client_1.NoOpLogger(), + serviceId: config?.serviceId ?? "SFN", + urlParser: config?.urlParser ?? url_parser_1.parseUrl, + utf8Decoder: config?.utf8Decoder ?? util_utf8_1.fromUtf8, + utf8Encoder: config?.utf8Encoder ?? util_utf8_1.toUtf8 + }; }; - exports2.ListActivitiesCommand = ListActivitiesCommand; + exports2.getRuntimeConfig = getRuntimeConfig; } }); -// ../../../node_modules/@aws-sdk/client-sfn/dist-cjs/commands/ListExecutionsCommand.js -var require_ListExecutionsCommand = __commonJS({ - "../../../node_modules/@aws-sdk/client-sfn/dist-cjs/commands/ListExecutionsCommand.js"(exports2) { +// ../../../node_modules/@aws-sdk/client-sfn/dist-cjs/runtimeConfig.js +var require_runtimeConfig4 = __commonJS({ + "../../../node_modules/@aws-sdk/client-sfn/dist-cjs/runtimeConfig.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.ListExecutionsCommand = exports2.$Command = void 0; - var middleware_endpoint_1 = require_dist_cjs26(); - var middleware_serde_1 = require_dist_cjs25(); - var smithy_client_1 = require_dist_cjs34(); - Object.defineProperty(exports2, "$Command", { enumerable: true, get: function() { - return smithy_client_1.Command; - } }); - var types_1 = require_dist_cjs(); - var Aws_json1_0_1 = require_Aws_json1_0(); - var ListExecutionsCommand = class _ListExecutionsCommand extends smithy_client_1.Command { - static getEndpointParameterInstructions() { - return { - UseFIPS: { type: "builtInParams", name: "useFipsEndpoint" }, - Endpoint: { type: "builtInParams", name: "endpoint" }, - Region: { type: "builtInParams", name: "region" }, - UseDualStack: { type: "builtInParams", name: "useDualstackEndpoint" } - }; - } - constructor(input) { - super(); - this.input = input; - } - resolveMiddleware(clientStack, configuration, options) { - this.middlewareStack.use((0, middleware_serde_1.getSerdePlugin)(configuration, this.serialize, this.deserialize)); - this.middlewareStack.use((0, middleware_endpoint_1.getEndpointPlugin)(configuration, _ListExecutionsCommand.getEndpointParameterInstructions())); - const stack = clientStack.concat(this.middlewareStack); - const { logger } = configuration; - const clientName = "SFNClient"; - const commandName = "ListExecutionsCommand"; - const handlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: (_) => _, - outputFilterSensitiveLog: (_) => _, - [types_1.SMITHY_CONTEXT_KEY]: { - service: "AWSStepFunctions", - operation: "ListExecutions" - } - }; - const { requestHandler } = configuration; - return stack.resolve((request2) => requestHandler.handle(request2.request, options || {}), handlerExecutionContext); - } - serialize(input, context) { - return (0, Aws_json1_0_1.se_ListExecutionsCommand)(input, context); - } - deserialize(output, context) { - return (0, Aws_json1_0_1.de_ListExecutionsCommand)(output, context); - } + exports2.getRuntimeConfig = void 0; + var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports)); + var package_json_1 = tslib_1.__importDefault(require_package()); + var core_1 = (init_dist_es2(), __toCommonJS(dist_es_exports2)); + var credential_provider_node_1 = require_dist_cjs79(); + var util_user_agent_node_1 = require_dist_cjs56(); + var config_resolver_1 = require_dist_cjs11(); + var hash_node_1 = require_dist_cjs57(); + var middleware_retry_1 = require_dist_cjs38(); + var node_config_provider_1 = require_dist_cjs42(); + var node_http_handler_1 = require_dist_cjs51(); + var util_body_length_node_1 = require_dist_cjs58(); + var util_retry_1 = require_dist_cjs60(); + var runtimeConfig_shared_1 = require_runtimeConfig_shared4(); + var smithy_client_1 = require_dist_cjs37(); + var util_defaults_mode_node_1 = require_dist_cjs69(); + var smithy_client_2 = require_dist_cjs37(); + var getRuntimeConfig = (config) => { + (0, smithy_client_2.emitWarningIfUnsupportedVersion)(process.version); + const defaultsMode = (0, util_defaults_mode_node_1.resolveDefaultsModeConfig)(config); + const defaultConfigProvider = () => defaultsMode().then(smithy_client_1.loadConfigsForDefaultMode); + const clientSharedValues = (0, runtimeConfig_shared_1.getRuntimeConfig)(config); + (0, core_1.emitWarningIfUnsupportedVersion)(process.version); + return { + ...clientSharedValues, + ...config, + runtime: "node", + defaultsMode, + bodyLengthChecker: config?.bodyLengthChecker ?? util_body_length_node_1.calculateBodyLength, + credentialDefaultProvider: config?.credentialDefaultProvider ?? credential_provider_node_1.defaultProvider, + defaultUserAgentProvider: config?.defaultUserAgentProvider ?? (0, util_user_agent_node_1.defaultUserAgent)({ serviceId: clientSharedValues.serviceId, clientVersion: package_json_1.default.version }), + maxAttempts: config?.maxAttempts ?? (0, node_config_provider_1.loadConfig)(middleware_retry_1.NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config?.region ?? (0, node_config_provider_1.loadConfig)(config_resolver_1.NODE_REGION_CONFIG_OPTIONS, config_resolver_1.NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: node_http_handler_1.NodeHttpHandler.create(config?.requestHandler ?? defaultConfigProvider), + retryMode: config?.retryMode ?? (0, node_config_provider_1.loadConfig)({ + ...middleware_retry_1.NODE_RETRY_MODE_CONFIG_OPTIONS, + default: async () => (await defaultConfigProvider()).retryMode || util_retry_1.DEFAULT_RETRY_MODE + }), + sha256: config?.sha256 ?? hash_node_1.Hash.bind(null, "sha256"), + streamCollector: config?.streamCollector ?? node_http_handler_1.streamCollector, + useDualstackEndpoint: config?.useDualstackEndpoint ?? (0, node_config_provider_1.loadConfig)(config_resolver_1.NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS), + useFipsEndpoint: config?.useFipsEndpoint ?? (0, node_config_provider_1.loadConfig)(config_resolver_1.NODE_USE_FIPS_ENDPOINT_CONFIG_OPTIONS) + }; }; - exports2.ListExecutionsCommand = ListExecutionsCommand; + exports2.getRuntimeConfig = getRuntimeConfig; } }); -// ../../../node_modules/@aws-sdk/client-sfn/dist-cjs/commands/ListMapRunsCommand.js -var require_ListMapRunsCommand = __commonJS({ - "../../../node_modules/@aws-sdk/client-sfn/dist-cjs/commands/ListMapRunsCommand.js"(exports2) { +// ../../../node_modules/@aws-sdk/client-sfn/dist-cjs/index.js +var require_dist_cjs80 = __commonJS({ + "../../../node_modules/@aws-sdk/client-sfn/dist-cjs/index.js"(exports2, module2) { "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.ListMapRunsCommand = exports2.$Command = void 0; - var middleware_endpoint_1 = require_dist_cjs26(); - var middleware_serde_1 = require_dist_cjs25(); - var smithy_client_1 = require_dist_cjs34(); - Object.defineProperty(exports2, "$Command", { enumerable: true, get: function() { - return smithy_client_1.Command; - } }); - var types_1 = require_dist_cjs(); - var Aws_json1_0_1 = require_Aws_json1_0(); - var ListMapRunsCommand = class _ListMapRunsCommand extends smithy_client_1.Command { - static getEndpointParameterInstructions() { - return { - UseFIPS: { type: "builtInParams", name: "useFipsEndpoint" }, - Endpoint: { type: "builtInParams", name: "endpoint" }, - Region: { type: "builtInParams", name: "region" }, - UseDualStack: { type: "builtInParams", name: "useDualstackEndpoint" } - }; - } - constructor(input) { - super(); - this.input = input; + var __defProp2 = Object.defineProperty; + var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; + var __getOwnPropNames2 = Object.getOwnPropertyNames; + var __hasOwnProp2 = Object.prototype.hasOwnProperty; + var __name = (target, value) => __defProp2(target, "name", { value, configurable: true }); + var __export2 = (target, all) => { + for (var name in all) + __defProp2(target, name, { get: all[name], enumerable: true }); + }; + var __copyProps2 = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames2(from)) + if (!__hasOwnProp2.call(to, key) && key !== except) + __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable }); } - resolveMiddleware(clientStack, configuration, options) { - this.middlewareStack.use((0, middleware_serde_1.getSerdePlugin)(configuration, this.serialize, this.deserialize)); - this.middlewareStack.use((0, middleware_endpoint_1.getEndpointPlugin)(configuration, _ListMapRunsCommand.getEndpointParameterInstructions())); - const stack = clientStack.concat(this.middlewareStack); - const { logger } = configuration; - const clientName = "SFNClient"; - const commandName = "ListMapRunsCommand"; - const handlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: (_) => _, - outputFilterSensitiveLog: (_) => _, - [types_1.SMITHY_CONTEXT_KEY]: { - service: "AWSStepFunctions", - operation: "ListMapRuns" + return to; + }; + var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); + var src_exports = {}; + __export2(src_exports, { + ActivityAlreadyExists: () => ActivityAlreadyExists, + ActivityDoesNotExist: () => ActivityDoesNotExist, + ActivityFailedEventDetailsFilterSensitiveLog: () => ActivityFailedEventDetailsFilterSensitiveLog, + ActivityLimitExceeded: () => ActivityLimitExceeded, + ActivityScheduleFailedEventDetailsFilterSensitiveLog: () => ActivityScheduleFailedEventDetailsFilterSensitiveLog, + ActivityScheduledEventDetailsFilterSensitiveLog: () => ActivityScheduledEventDetailsFilterSensitiveLog, + ActivitySucceededEventDetailsFilterSensitiveLog: () => ActivitySucceededEventDetailsFilterSensitiveLog, + ActivityTimedOutEventDetailsFilterSensitiveLog: () => ActivityTimedOutEventDetailsFilterSensitiveLog, + ActivityWorkerLimitExceeded: () => ActivityWorkerLimitExceeded, + ConflictException: () => ConflictException, + CreateActivityCommand: () => CreateActivityCommand, + CreateStateMachineAliasCommand: () => CreateStateMachineAliasCommand, + CreateStateMachineAliasInputFilterSensitiveLog: () => CreateStateMachineAliasInputFilterSensitiveLog, + CreateStateMachineCommand: () => CreateStateMachineCommand, + CreateStateMachineInputFilterSensitiveLog: () => CreateStateMachineInputFilterSensitiveLog, + DeleteActivityCommand: () => DeleteActivityCommand, + DeleteStateMachineAliasCommand: () => DeleteStateMachineAliasCommand, + DeleteStateMachineCommand: () => DeleteStateMachineCommand, + DeleteStateMachineVersionCommand: () => DeleteStateMachineVersionCommand, + DescribeActivityCommand: () => DescribeActivityCommand, + DescribeExecutionCommand: () => DescribeExecutionCommand, + DescribeExecutionOutputFilterSensitiveLog: () => DescribeExecutionOutputFilterSensitiveLog, + DescribeMapRunCommand: () => DescribeMapRunCommand, + DescribeStateMachineAliasCommand: () => DescribeStateMachineAliasCommand, + DescribeStateMachineAliasOutputFilterSensitiveLog: () => DescribeStateMachineAliasOutputFilterSensitiveLog, + DescribeStateMachineCommand: () => DescribeStateMachineCommand, + DescribeStateMachineForExecutionCommand: () => DescribeStateMachineForExecutionCommand, + DescribeStateMachineForExecutionOutputFilterSensitiveLog: () => DescribeStateMachineForExecutionOutputFilterSensitiveLog, + DescribeStateMachineOutputFilterSensitiveLog: () => DescribeStateMachineOutputFilterSensitiveLog, + EncryptionType: () => EncryptionType, + ExecutionAbortedEventDetailsFilterSensitiveLog: () => ExecutionAbortedEventDetailsFilterSensitiveLog, + ExecutionAlreadyExists: () => ExecutionAlreadyExists, + ExecutionDoesNotExist: () => ExecutionDoesNotExist, + ExecutionFailedEventDetailsFilterSensitiveLog: () => ExecutionFailedEventDetailsFilterSensitiveLog, + ExecutionLimitExceeded: () => ExecutionLimitExceeded, + ExecutionNotRedrivable: () => ExecutionNotRedrivable, + ExecutionRedriveFilter: () => ExecutionRedriveFilter, + ExecutionRedriveStatus: () => ExecutionRedriveStatus, + ExecutionStartedEventDetailsFilterSensitiveLog: () => ExecutionStartedEventDetailsFilterSensitiveLog, + ExecutionStatus: () => ExecutionStatus, + ExecutionSucceededEventDetailsFilterSensitiveLog: () => ExecutionSucceededEventDetailsFilterSensitiveLog, + ExecutionTimedOutEventDetailsFilterSensitiveLog: () => ExecutionTimedOutEventDetailsFilterSensitiveLog, + GetActivityTaskCommand: () => GetActivityTaskCommand, + GetActivityTaskOutputFilterSensitiveLog: () => GetActivityTaskOutputFilterSensitiveLog, + GetExecutionHistoryCommand: () => GetExecutionHistoryCommand, + GetExecutionHistoryOutputFilterSensitiveLog: () => GetExecutionHistoryOutputFilterSensitiveLog, + HistoryEventFilterSensitiveLog: () => HistoryEventFilterSensitiveLog, + HistoryEventType: () => HistoryEventType, + IncludedData: () => IncludedData, + InspectionDataFilterSensitiveLog: () => InspectionDataFilterSensitiveLog, + InspectionLevel: () => InspectionLevel, + InvalidArn: () => InvalidArn, + InvalidDefinition: () => InvalidDefinition, + InvalidEncryptionConfiguration: () => InvalidEncryptionConfiguration, + InvalidExecutionInput: () => InvalidExecutionInput, + InvalidLoggingConfiguration: () => InvalidLoggingConfiguration, + InvalidName: () => InvalidName, + InvalidOutput: () => InvalidOutput, + InvalidToken: () => InvalidToken, + InvalidTracingConfiguration: () => InvalidTracingConfiguration, + KmsAccessDeniedException: () => KmsAccessDeniedException, + KmsInvalidStateException: () => KmsInvalidStateException, + KmsKeyState: () => KmsKeyState, + KmsThrottlingException: () => KmsThrottlingException, + LambdaFunctionFailedEventDetailsFilterSensitiveLog: () => LambdaFunctionFailedEventDetailsFilterSensitiveLog, + LambdaFunctionScheduleFailedEventDetailsFilterSensitiveLog: () => LambdaFunctionScheduleFailedEventDetailsFilterSensitiveLog, + LambdaFunctionScheduledEventDetailsFilterSensitiveLog: () => LambdaFunctionScheduledEventDetailsFilterSensitiveLog, + LambdaFunctionStartFailedEventDetailsFilterSensitiveLog: () => LambdaFunctionStartFailedEventDetailsFilterSensitiveLog, + LambdaFunctionSucceededEventDetailsFilterSensitiveLog: () => LambdaFunctionSucceededEventDetailsFilterSensitiveLog, + LambdaFunctionTimedOutEventDetailsFilterSensitiveLog: () => LambdaFunctionTimedOutEventDetailsFilterSensitiveLog, + ListActivitiesCommand: () => ListActivitiesCommand, + ListExecutionsCommand: () => ListExecutionsCommand, + ListMapRunsCommand: () => ListMapRunsCommand, + ListStateMachineAliasesCommand: () => ListStateMachineAliasesCommand, + ListStateMachineVersionsCommand: () => ListStateMachineVersionsCommand, + ListStateMachinesCommand: () => ListStateMachinesCommand, + ListTagsForResourceCommand: () => ListTagsForResourceCommand, + LogLevel: () => LogLevel, + MapRunFailedEventDetailsFilterSensitiveLog: () => MapRunFailedEventDetailsFilterSensitiveLog, + MapRunStatus: () => MapRunStatus, + MissingRequiredParameter: () => MissingRequiredParameter, + PublishStateMachineVersionCommand: () => PublishStateMachineVersionCommand, + PublishStateMachineVersionInputFilterSensitiveLog: () => PublishStateMachineVersionInputFilterSensitiveLog, + RedriveExecutionCommand: () => RedriveExecutionCommand, + ResourceNotFound: () => ResourceNotFound, + SFN: () => SFN2, + SFNClient: () => SFNClient, + SFNServiceException: () => SFNServiceException, + SendTaskFailureCommand: () => SendTaskFailureCommand, + SendTaskFailureInputFilterSensitiveLog: () => SendTaskFailureInputFilterSensitiveLog, + SendTaskHeartbeatCommand: () => SendTaskHeartbeatCommand, + SendTaskSuccessCommand: () => SendTaskSuccessCommand, + SendTaskSuccessInputFilterSensitiveLog: () => SendTaskSuccessInputFilterSensitiveLog, + ServiceQuotaExceededException: () => ServiceQuotaExceededException, + StartExecutionCommand: () => StartExecutionCommand, + StartExecutionInputFilterSensitiveLog: () => StartExecutionInputFilterSensitiveLog, + StartSyncExecutionCommand: () => StartSyncExecutionCommand, + StartSyncExecutionInputFilterSensitiveLog: () => StartSyncExecutionInputFilterSensitiveLog, + StartSyncExecutionOutputFilterSensitiveLog: () => StartSyncExecutionOutputFilterSensitiveLog, + StateEnteredEventDetailsFilterSensitiveLog: () => StateEnteredEventDetailsFilterSensitiveLog, + StateExitedEventDetailsFilterSensitiveLog: () => StateExitedEventDetailsFilterSensitiveLog, + StateMachineAlreadyExists: () => StateMachineAlreadyExists, + StateMachineDeleting: () => StateMachineDeleting, + StateMachineDoesNotExist: () => StateMachineDoesNotExist, + StateMachineLimitExceeded: () => StateMachineLimitExceeded, + StateMachineStatus: () => StateMachineStatus, + StateMachineType: () => StateMachineType, + StateMachineTypeNotSupported: () => StateMachineTypeNotSupported, + StopExecutionCommand: () => StopExecutionCommand, + StopExecutionInputFilterSensitiveLog: () => StopExecutionInputFilterSensitiveLog, + SyncExecutionStatus: () => SyncExecutionStatus, + TagResourceCommand: () => TagResourceCommand, + TaskDoesNotExist: () => TaskDoesNotExist, + TaskFailedEventDetailsFilterSensitiveLog: () => TaskFailedEventDetailsFilterSensitiveLog, + TaskScheduledEventDetailsFilterSensitiveLog: () => TaskScheduledEventDetailsFilterSensitiveLog, + TaskStartFailedEventDetailsFilterSensitiveLog: () => TaskStartFailedEventDetailsFilterSensitiveLog, + TaskSubmitFailedEventDetailsFilterSensitiveLog: () => TaskSubmitFailedEventDetailsFilterSensitiveLog, + TaskSubmittedEventDetailsFilterSensitiveLog: () => TaskSubmittedEventDetailsFilterSensitiveLog, + TaskSucceededEventDetailsFilterSensitiveLog: () => TaskSucceededEventDetailsFilterSensitiveLog, + TaskTimedOut: () => TaskTimedOut, + TaskTimedOutEventDetailsFilterSensitiveLog: () => TaskTimedOutEventDetailsFilterSensitiveLog, + TestExecutionStatus: () => TestExecutionStatus, + TestStateCommand: () => TestStateCommand, + TestStateInputFilterSensitiveLog: () => TestStateInputFilterSensitiveLog, + TestStateOutputFilterSensitiveLog: () => TestStateOutputFilterSensitiveLog, + TooManyTags: () => TooManyTags, + UntagResourceCommand: () => UntagResourceCommand, + UpdateMapRunCommand: () => UpdateMapRunCommand, + UpdateStateMachineAliasCommand: () => UpdateStateMachineAliasCommand, + UpdateStateMachineAliasInputFilterSensitiveLog: () => UpdateStateMachineAliasInputFilterSensitiveLog, + UpdateStateMachineCommand: () => UpdateStateMachineCommand, + UpdateStateMachineInputFilterSensitiveLog: () => UpdateStateMachineInputFilterSensitiveLog, + ValidateStateMachineDefinitionCommand: () => ValidateStateMachineDefinitionCommand, + ValidateStateMachineDefinitionInputFilterSensitiveLog: () => ValidateStateMachineDefinitionInputFilterSensitiveLog, + ValidateStateMachineDefinitionResultCode: () => ValidateStateMachineDefinitionResultCode, + ValidateStateMachineDefinitionSeverity: () => ValidateStateMachineDefinitionSeverity, + ValidationException: () => ValidationException, + ValidationExceptionReason: () => ValidationExceptionReason, + __Client: () => import_smithy_client5.Client, + paginateGetExecutionHistory: () => paginateGetExecutionHistory, + paginateListActivities: () => paginateListActivities, + paginateListExecutions: () => paginateListExecutions, + paginateListMapRuns: () => paginateListMapRuns, + paginateListStateMachines: () => paginateListStateMachines + }); + module2.exports = __toCommonJS2(src_exports); + var import_middleware_host_header = require_dist_cjs3(); + var import_middleware_logger = require_dist_cjs4(); + var import_middleware_recursion_detection = require_dist_cjs5(); + var import_middleware_user_agent = require_dist_cjs8(); + var import_config_resolver = require_dist_cjs11(); + var import_core3 = (init_dist_es(), __toCommonJS(dist_es_exports)); + var import_middleware_content_length = require_dist_cjs39(); + var import_middleware_endpoint2 = require_dist_cjs46(); + var import_middleware_retry2 = require_dist_cjs38(); + var import_httpAuthSchemeProvider = require_httpAuthSchemeProvider(); + var resolveClientEndpointParameters = /* @__PURE__ */ __name((options) => { + return { + ...options, + useDualstackEndpoint: options.useDualstackEndpoint ?? false, + useFipsEndpoint: options.useFipsEndpoint ?? false, + defaultSigningName: "states" + }; + }, "resolveClientEndpointParameters"); + var commonParams = { + UseFIPS: { type: "builtInParams", name: "useFipsEndpoint" }, + Endpoint: { type: "builtInParams", name: "endpoint" }, + Region: { type: "builtInParams", name: "region" }, + UseDualStack: { type: "builtInParams", name: "useDualstackEndpoint" } + }; + var import_runtimeConfig = require_runtimeConfig4(); + var import_region_config_resolver = require_dist_cjs70(); + var import_protocol_http8 = require_dist_cjs2(); + var import_smithy_client5 = require_dist_cjs37(); + var getHttpAuthExtensionConfiguration = /* @__PURE__ */ __name((runtimeConfig) => { + const _httpAuthSchemes = runtimeConfig.httpAuthSchemes; + let _httpAuthSchemeProvider = runtimeConfig.httpAuthSchemeProvider; + let _credentials = runtimeConfig.credentials; + return { + setHttpAuthScheme(httpAuthScheme) { + const index = _httpAuthSchemes.findIndex((scheme) => scheme.schemeId === httpAuthScheme.schemeId); + if (index === -1) { + _httpAuthSchemes.push(httpAuthScheme); + } else { + _httpAuthSchemes.splice(index, 1, httpAuthScheme); } - }; - const { requestHandler } = configuration; - return stack.resolve((request2) => requestHandler.handle(request2.request, options || {}), handlerExecutionContext); - } - serialize(input, context) { - return (0, Aws_json1_0_1.se_ListMapRunsCommand)(input, context); + }, + httpAuthSchemes() { + return _httpAuthSchemes; + }, + setHttpAuthSchemeProvider(httpAuthSchemeProvider) { + _httpAuthSchemeProvider = httpAuthSchemeProvider; + }, + httpAuthSchemeProvider() { + return _httpAuthSchemeProvider; + }, + setCredentials(credentials) { + _credentials = credentials; + }, + credentials() { + return _credentials; + } + }; + }, "getHttpAuthExtensionConfiguration"); + var resolveHttpAuthRuntimeConfig = /* @__PURE__ */ __name((config) => { + return { + httpAuthSchemes: config.httpAuthSchemes(), + httpAuthSchemeProvider: config.httpAuthSchemeProvider(), + credentials: config.credentials() + }; + }, "resolveHttpAuthRuntimeConfig"); + var asPartial = /* @__PURE__ */ __name((t) => t, "asPartial"); + var resolveRuntimeExtensions = /* @__PURE__ */ __name((runtimeConfig, extensions) => { + const extensionConfiguration = { + ...asPartial((0, import_region_config_resolver.getAwsRegionExtensionConfiguration)(runtimeConfig)), + ...asPartial((0, import_smithy_client5.getDefaultExtensionConfiguration)(runtimeConfig)), + ...asPartial((0, import_protocol_http8.getHttpHandlerExtensionConfiguration)(runtimeConfig)), + ...asPartial(getHttpAuthExtensionConfiguration(runtimeConfig)) + }; + extensions.forEach((extension) => extension.configure(extensionConfiguration)); + return { + ...runtimeConfig, + ...(0, import_region_config_resolver.resolveAwsRegionExtensionConfiguration)(extensionConfiguration), + ...(0, import_smithy_client5.resolveDefaultRuntimeConfig)(extensionConfiguration), + ...(0, import_protocol_http8.resolveHttpHandlerRuntimeConfig)(extensionConfiguration), + ...resolveHttpAuthRuntimeConfig(extensionConfiguration) + }; + }, "resolveRuntimeExtensions"); + var _SFNClient = class _SFNClient extends import_smithy_client5.Client { + constructor(...[configuration]) { + const _config_0 = (0, import_runtimeConfig.getRuntimeConfig)(configuration || {}); + const _config_1 = resolveClientEndpointParameters(_config_0); + const _config_2 = (0, import_middleware_user_agent.resolveUserAgentConfig)(_config_1); + const _config_3 = (0, import_middleware_retry2.resolveRetryConfig)(_config_2); + const _config_4 = (0, import_config_resolver.resolveRegionConfig)(_config_3); + const _config_5 = (0, import_middleware_host_header.resolveHostHeaderConfig)(_config_4); + const _config_6 = (0, import_middleware_endpoint2.resolveEndpointConfig)(_config_5); + const _config_7 = (0, import_httpAuthSchemeProvider.resolveHttpAuthSchemeConfig)(_config_6); + const _config_8 = resolveRuntimeExtensions(_config_7, (configuration == null ? void 0 : configuration.extensions) || []); + super(_config_8); + this.config = _config_8; + this.middlewareStack.use((0, import_middleware_user_agent.getUserAgentPlugin)(this.config)); + this.middlewareStack.use((0, import_middleware_retry2.getRetryPlugin)(this.config)); + this.middlewareStack.use((0, import_middleware_content_length.getContentLengthPlugin)(this.config)); + this.middlewareStack.use((0, import_middleware_host_header.getHostHeaderPlugin)(this.config)); + this.middlewareStack.use((0, import_middleware_logger.getLoggerPlugin)(this.config)); + this.middlewareStack.use((0, import_middleware_recursion_detection.getRecursionDetectionPlugin)(this.config)); + this.middlewareStack.use( + (0, import_core3.getHttpAuthSchemeEndpointRuleSetPlugin)(this.config, { + httpAuthSchemeParametersProvider: import_httpAuthSchemeProvider.defaultSFNHttpAuthSchemeParametersProvider, + identityProviderConfigProvider: async (config) => new import_core3.DefaultIdentityProviderConfig({ + "aws.auth#sigv4": config.credentials + }) + }) + ); + this.middlewareStack.use((0, import_core3.getHttpSigningPlugin)(this.config)); } - deserialize(output, context) { - return (0, Aws_json1_0_1.de_ListMapRunsCommand)(output, context); + /** + * Destroy underlying resources, like sockets. It's usually not necessary to do this. + * However in Node.js, it's best to explicitly shut down the client's agent when it is no longer needed. + * Otherwise, sockets might stay open for quite a long time before the server terminates them. + */ + destroy() { + super.destroy(); } }; - exports2.ListMapRunsCommand = ListMapRunsCommand; - } -}); - -// ../../../node_modules/@aws-sdk/client-sfn/dist-cjs/commands/ListStateMachineAliasesCommand.js -var require_ListStateMachineAliasesCommand = __commonJS({ - "../../../node_modules/@aws-sdk/client-sfn/dist-cjs/commands/ListStateMachineAliasesCommand.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.ListStateMachineAliasesCommand = exports2.$Command = void 0; - var middleware_endpoint_1 = require_dist_cjs26(); - var middleware_serde_1 = require_dist_cjs25(); - var smithy_client_1 = require_dist_cjs34(); - Object.defineProperty(exports2, "$Command", { enumerable: true, get: function() { - return smithy_client_1.Command; - } }); - var types_1 = require_dist_cjs(); - var Aws_json1_0_1 = require_Aws_json1_0(); - var ListStateMachineAliasesCommand = class _ListStateMachineAliasesCommand extends smithy_client_1.Command { - static getEndpointParameterInstructions() { - return { - UseFIPS: { type: "builtInParams", name: "useFipsEndpoint" }, - Endpoint: { type: "builtInParams", name: "endpoint" }, - Region: { type: "builtInParams", name: "region" }, - UseDualStack: { type: "builtInParams", name: "useDualstackEndpoint" } - }; + __name(_SFNClient, "SFNClient"); + var SFNClient = _SFNClient; + var import_middleware_serde2 = require_dist_cjs45(); + var import_core22 = (init_dist_es2(), __toCommonJS(dist_es_exports2)); + var import_uuid = (init_esm_node(), __toCommonJS(esm_node_exports)); + var _SFNServiceException = class _SFNServiceException2 extends import_smithy_client5.ServiceException { + /** + * @internal + */ + constructor(options) { + super(options); + Object.setPrototypeOf(this, _SFNServiceException2.prototype); } - constructor(input) { - super(); - this.input = input; + }; + __name(_SFNServiceException, "SFNServiceException"); + var SFNServiceException = _SFNServiceException; + var _ActivityAlreadyExists = class _ActivityAlreadyExists2 extends SFNServiceException { + /** + * @internal + */ + constructor(opts) { + super({ + name: "ActivityAlreadyExists", + $fault: "client", + ...opts + }); + this.name = "ActivityAlreadyExists"; + this.$fault = "client"; + Object.setPrototypeOf(this, _ActivityAlreadyExists2.prototype); } - resolveMiddleware(clientStack, configuration, options) { - this.middlewareStack.use((0, middleware_serde_1.getSerdePlugin)(configuration, this.serialize, this.deserialize)); - this.middlewareStack.use((0, middleware_endpoint_1.getEndpointPlugin)(configuration, _ListStateMachineAliasesCommand.getEndpointParameterInstructions())); - const stack = clientStack.concat(this.middlewareStack); - const { logger } = configuration; - const clientName = "SFNClient"; - const commandName = "ListStateMachineAliasesCommand"; - const handlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: (_) => _, - outputFilterSensitiveLog: (_) => _, - [types_1.SMITHY_CONTEXT_KEY]: { - service: "AWSStepFunctions", - operation: "ListStateMachineAliases" - } - }; - const { requestHandler } = configuration; - return stack.resolve((request2) => requestHandler.handle(request2.request, options || {}), handlerExecutionContext); + }; + __name(_ActivityAlreadyExists, "ActivityAlreadyExists"); + var ActivityAlreadyExists = _ActivityAlreadyExists; + var _ActivityDoesNotExist = class _ActivityDoesNotExist2 extends SFNServiceException { + /** + * @internal + */ + constructor(opts) { + super({ + name: "ActivityDoesNotExist", + $fault: "client", + ...opts + }); + this.name = "ActivityDoesNotExist"; + this.$fault = "client"; + Object.setPrototypeOf(this, _ActivityDoesNotExist2.prototype); } - serialize(input, context) { - return (0, Aws_json1_0_1.se_ListStateMachineAliasesCommand)(input, context); + }; + __name(_ActivityDoesNotExist, "ActivityDoesNotExist"); + var ActivityDoesNotExist = _ActivityDoesNotExist; + var _ActivityLimitExceeded = class _ActivityLimitExceeded2 extends SFNServiceException { + /** + * @internal + */ + constructor(opts) { + super({ + name: "ActivityLimitExceeded", + $fault: "client", + ...opts + }); + this.name = "ActivityLimitExceeded"; + this.$fault = "client"; + Object.setPrototypeOf(this, _ActivityLimitExceeded2.prototype); } - deserialize(output, context) { - return (0, Aws_json1_0_1.de_ListStateMachineAliasesCommand)(output, context); + }; + __name(_ActivityLimitExceeded, "ActivityLimitExceeded"); + var ActivityLimitExceeded = _ActivityLimitExceeded; + var _ActivityWorkerLimitExceeded = class _ActivityWorkerLimitExceeded2 extends SFNServiceException { + /** + * @internal + */ + constructor(opts) { + super({ + name: "ActivityWorkerLimitExceeded", + $fault: "client", + ...opts + }); + this.name = "ActivityWorkerLimitExceeded"; + this.$fault = "client"; + Object.setPrototypeOf(this, _ActivityWorkerLimitExceeded2.prototype); } }; - exports2.ListStateMachineAliasesCommand = ListStateMachineAliasesCommand; - } -}); - -// ../../../node_modules/@aws-sdk/client-sfn/dist-cjs/commands/ListStateMachinesCommand.js -var require_ListStateMachinesCommand = __commonJS({ - "../../../node_modules/@aws-sdk/client-sfn/dist-cjs/commands/ListStateMachinesCommand.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.ListStateMachinesCommand = exports2.$Command = void 0; - var middleware_endpoint_1 = require_dist_cjs26(); - var middleware_serde_1 = require_dist_cjs25(); - var smithy_client_1 = require_dist_cjs34(); - Object.defineProperty(exports2, "$Command", { enumerable: true, get: function() { - return smithy_client_1.Command; - } }); - var types_1 = require_dist_cjs(); - var Aws_json1_0_1 = require_Aws_json1_0(); - var ListStateMachinesCommand = class _ListStateMachinesCommand extends smithy_client_1.Command { - static getEndpointParameterInstructions() { - return { - UseFIPS: { type: "builtInParams", name: "useFipsEndpoint" }, - Endpoint: { type: "builtInParams", name: "endpoint" }, - Region: { type: "builtInParams", name: "region" }, - UseDualStack: { type: "builtInParams", name: "useDualstackEndpoint" } - }; + __name(_ActivityWorkerLimitExceeded, "ActivityWorkerLimitExceeded"); + var ActivityWorkerLimitExceeded = _ActivityWorkerLimitExceeded; + var EncryptionType = { + AWS_OWNED_KEY: "AWS_OWNED_KEY", + CUSTOMER_MANAGED_KMS_KEY: "CUSTOMER_MANAGED_KMS_KEY" + }; + var _InvalidEncryptionConfiguration = class _InvalidEncryptionConfiguration2 extends SFNServiceException { + /** + * @internal + */ + constructor(opts) { + super({ + name: "InvalidEncryptionConfiguration", + $fault: "client", + ...opts + }); + this.name = "InvalidEncryptionConfiguration"; + this.$fault = "client"; + Object.setPrototypeOf(this, _InvalidEncryptionConfiguration2.prototype); } - constructor(input) { - super(); - this.input = input; + }; + __name(_InvalidEncryptionConfiguration, "InvalidEncryptionConfiguration"); + var InvalidEncryptionConfiguration = _InvalidEncryptionConfiguration; + var _InvalidName = class _InvalidName2 extends SFNServiceException { + /** + * @internal + */ + constructor(opts) { + super({ + name: "InvalidName", + $fault: "client", + ...opts + }); + this.name = "InvalidName"; + this.$fault = "client"; + Object.setPrototypeOf(this, _InvalidName2.prototype); } - resolveMiddleware(clientStack, configuration, options) { - this.middlewareStack.use((0, middleware_serde_1.getSerdePlugin)(configuration, this.serialize, this.deserialize)); - this.middlewareStack.use((0, middleware_endpoint_1.getEndpointPlugin)(configuration, _ListStateMachinesCommand.getEndpointParameterInstructions())); - const stack = clientStack.concat(this.middlewareStack); - const { logger } = configuration; - const clientName = "SFNClient"; - const commandName = "ListStateMachinesCommand"; - const handlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: (_) => _, - outputFilterSensitiveLog: (_) => _, - [types_1.SMITHY_CONTEXT_KEY]: { - service: "AWSStepFunctions", - operation: "ListStateMachines" - } - }; - const { requestHandler } = configuration; - return stack.resolve((request2) => requestHandler.handle(request2.request, options || {}), handlerExecutionContext); + }; + __name(_InvalidName, "InvalidName"); + var InvalidName = _InvalidName; + var _KmsAccessDeniedException = class _KmsAccessDeniedException2 extends SFNServiceException { + /** + * @internal + */ + constructor(opts) { + super({ + name: "KmsAccessDeniedException", + $fault: "client", + ...opts + }); + this.name = "KmsAccessDeniedException"; + this.$fault = "client"; + Object.setPrototypeOf(this, _KmsAccessDeniedException2.prototype); } - serialize(input, context) { - return (0, Aws_json1_0_1.se_ListStateMachinesCommand)(input, context); + }; + __name(_KmsAccessDeniedException, "KmsAccessDeniedException"); + var KmsAccessDeniedException = _KmsAccessDeniedException; + var _KmsThrottlingException = class _KmsThrottlingException2 extends SFNServiceException { + /** + * @internal + */ + constructor(opts) { + super({ + name: "KmsThrottlingException", + $fault: "client", + ...opts + }); + this.name = "KmsThrottlingException"; + this.$fault = "client"; + Object.setPrototypeOf(this, _KmsThrottlingException2.prototype); } - deserialize(output, context) { - return (0, Aws_json1_0_1.de_ListStateMachinesCommand)(output, context); + }; + __name(_KmsThrottlingException, "KmsThrottlingException"); + var KmsThrottlingException = _KmsThrottlingException; + var _TooManyTags = class _TooManyTags2 extends SFNServiceException { + /** + * @internal + */ + constructor(opts) { + super({ + name: "TooManyTags", + $fault: "client", + ...opts + }); + this.name = "TooManyTags"; + this.$fault = "client"; + Object.setPrototypeOf(this, _TooManyTags2.prototype); + this.resourceName = opts.resourceName; } }; - exports2.ListStateMachinesCommand = ListStateMachinesCommand; - } -}); - -// ../../../node_modules/@aws-sdk/client-sfn/dist-cjs/commands/ListStateMachineVersionsCommand.js -var require_ListStateMachineVersionsCommand = __commonJS({ - "../../../node_modules/@aws-sdk/client-sfn/dist-cjs/commands/ListStateMachineVersionsCommand.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.ListStateMachineVersionsCommand = exports2.$Command = void 0; - var middleware_endpoint_1 = require_dist_cjs26(); - var middleware_serde_1 = require_dist_cjs25(); - var smithy_client_1 = require_dist_cjs34(); - Object.defineProperty(exports2, "$Command", { enumerable: true, get: function() { - return smithy_client_1.Command; - } }); - var types_1 = require_dist_cjs(); - var Aws_json1_0_1 = require_Aws_json1_0(); - var ListStateMachineVersionsCommand = class _ListStateMachineVersionsCommand extends smithy_client_1.Command { - static getEndpointParameterInstructions() { - return { - UseFIPS: { type: "builtInParams", name: "useFipsEndpoint" }, - Endpoint: { type: "builtInParams", name: "endpoint" }, - Region: { type: "builtInParams", name: "region" }, - UseDualStack: { type: "builtInParams", name: "useDualstackEndpoint" } - }; + __name(_TooManyTags, "TooManyTags"); + var TooManyTags = _TooManyTags; + var _ConflictException = class _ConflictException2 extends SFNServiceException { + /** + * @internal + */ + constructor(opts) { + super({ + name: "ConflictException", + $fault: "client", + ...opts + }); + this.name = "ConflictException"; + this.$fault = "client"; + Object.setPrototypeOf(this, _ConflictException2.prototype); } - constructor(input) { - super(); - this.input = input; + }; + __name(_ConflictException, "ConflictException"); + var ConflictException = _ConflictException; + var LogLevel = { + ALL: "ALL", + ERROR: "ERROR", + FATAL: "FATAL", + OFF: "OFF" + }; + var StateMachineType = { + EXPRESS: "EXPRESS", + STANDARD: "STANDARD" + }; + var _InvalidArn = class _InvalidArn2 extends SFNServiceException { + /** + * @internal + */ + constructor(opts) { + super({ + name: "InvalidArn", + $fault: "client", + ...opts + }); + this.name = "InvalidArn"; + this.$fault = "client"; + Object.setPrototypeOf(this, _InvalidArn2.prototype); } - resolveMiddleware(clientStack, configuration, options) { - this.middlewareStack.use((0, middleware_serde_1.getSerdePlugin)(configuration, this.serialize, this.deserialize)); - this.middlewareStack.use((0, middleware_endpoint_1.getEndpointPlugin)(configuration, _ListStateMachineVersionsCommand.getEndpointParameterInstructions())); - const stack = clientStack.concat(this.middlewareStack); - const { logger } = configuration; - const clientName = "SFNClient"; - const commandName = "ListStateMachineVersionsCommand"; - const handlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: (_) => _, - outputFilterSensitiveLog: (_) => _, - [types_1.SMITHY_CONTEXT_KEY]: { - service: "AWSStepFunctions", - operation: "ListStateMachineVersions" - } - }; - const { requestHandler } = configuration; - return stack.resolve((request2) => requestHandler.handle(request2.request, options || {}), handlerExecutionContext); + }; + __name(_InvalidArn, "InvalidArn"); + var InvalidArn = _InvalidArn; + var _InvalidDefinition = class _InvalidDefinition2 extends SFNServiceException { + /** + * @internal + */ + constructor(opts) { + super({ + name: "InvalidDefinition", + $fault: "client", + ...opts + }); + this.name = "InvalidDefinition"; + this.$fault = "client"; + Object.setPrototypeOf(this, _InvalidDefinition2.prototype); } - serialize(input, context) { - return (0, Aws_json1_0_1.se_ListStateMachineVersionsCommand)(input, context); + }; + __name(_InvalidDefinition, "InvalidDefinition"); + var InvalidDefinition = _InvalidDefinition; + var _InvalidLoggingConfiguration = class _InvalidLoggingConfiguration2 extends SFNServiceException { + /** + * @internal + */ + constructor(opts) { + super({ + name: "InvalidLoggingConfiguration", + $fault: "client", + ...opts + }); + this.name = "InvalidLoggingConfiguration"; + this.$fault = "client"; + Object.setPrototypeOf(this, _InvalidLoggingConfiguration2.prototype); } - deserialize(output, context) { - return (0, Aws_json1_0_1.de_ListStateMachineVersionsCommand)(output, context); + }; + __name(_InvalidLoggingConfiguration, "InvalidLoggingConfiguration"); + var InvalidLoggingConfiguration = _InvalidLoggingConfiguration; + var _InvalidTracingConfiguration = class _InvalidTracingConfiguration2 extends SFNServiceException { + /** + * @internal + */ + constructor(opts) { + super({ + name: "InvalidTracingConfiguration", + $fault: "client", + ...opts + }); + this.name = "InvalidTracingConfiguration"; + this.$fault = "client"; + Object.setPrototypeOf(this, _InvalidTracingConfiguration2.prototype); } }; - exports2.ListStateMachineVersionsCommand = ListStateMachineVersionsCommand; - } -}); - -// ../../../node_modules/@aws-sdk/client-sfn/dist-cjs/commands/ListTagsForResourceCommand.js -var require_ListTagsForResourceCommand = __commonJS({ - "../../../node_modules/@aws-sdk/client-sfn/dist-cjs/commands/ListTagsForResourceCommand.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.ListTagsForResourceCommand = exports2.$Command = void 0; - var middleware_endpoint_1 = require_dist_cjs26(); - var middleware_serde_1 = require_dist_cjs25(); - var smithy_client_1 = require_dist_cjs34(); - Object.defineProperty(exports2, "$Command", { enumerable: true, get: function() { - return smithy_client_1.Command; - } }); - var types_1 = require_dist_cjs(); - var Aws_json1_0_1 = require_Aws_json1_0(); - var ListTagsForResourceCommand = class _ListTagsForResourceCommand extends smithy_client_1.Command { - static getEndpointParameterInstructions() { - return { - UseFIPS: { type: "builtInParams", name: "useFipsEndpoint" }, - Endpoint: { type: "builtInParams", name: "endpoint" }, - Region: { type: "builtInParams", name: "region" }, - UseDualStack: { type: "builtInParams", name: "useDualstackEndpoint" } - }; + __name(_InvalidTracingConfiguration, "InvalidTracingConfiguration"); + var InvalidTracingConfiguration = _InvalidTracingConfiguration; + var _StateMachineAlreadyExists = class _StateMachineAlreadyExists2 extends SFNServiceException { + /** + * @internal + */ + constructor(opts) { + super({ + name: "StateMachineAlreadyExists", + $fault: "client", + ...opts + }); + this.name = "StateMachineAlreadyExists"; + this.$fault = "client"; + Object.setPrototypeOf(this, _StateMachineAlreadyExists2.prototype); } - constructor(input) { - super(); - this.input = input; + }; + __name(_StateMachineAlreadyExists, "StateMachineAlreadyExists"); + var StateMachineAlreadyExists = _StateMachineAlreadyExists; + var _StateMachineDeleting = class _StateMachineDeleting2 extends SFNServiceException { + /** + * @internal + */ + constructor(opts) { + super({ + name: "StateMachineDeleting", + $fault: "client", + ...opts + }); + this.name = "StateMachineDeleting"; + this.$fault = "client"; + Object.setPrototypeOf(this, _StateMachineDeleting2.prototype); } - resolveMiddleware(clientStack, configuration, options) { - this.middlewareStack.use((0, middleware_serde_1.getSerdePlugin)(configuration, this.serialize, this.deserialize)); - this.middlewareStack.use((0, middleware_endpoint_1.getEndpointPlugin)(configuration, _ListTagsForResourceCommand.getEndpointParameterInstructions())); - const stack = clientStack.concat(this.middlewareStack); - const { logger } = configuration; - const clientName = "SFNClient"; - const commandName = "ListTagsForResourceCommand"; - const handlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: (_) => _, - outputFilterSensitiveLog: (_) => _, - [types_1.SMITHY_CONTEXT_KEY]: { - service: "AWSStepFunctions", - operation: "ListTagsForResource" - } - }; - const { requestHandler } = configuration; - return stack.resolve((request2) => requestHandler.handle(request2.request, options || {}), handlerExecutionContext); + }; + __name(_StateMachineDeleting, "StateMachineDeleting"); + var StateMachineDeleting = _StateMachineDeleting; + var _StateMachineLimitExceeded = class _StateMachineLimitExceeded2 extends SFNServiceException { + /** + * @internal + */ + constructor(opts) { + super({ + name: "StateMachineLimitExceeded", + $fault: "client", + ...opts + }); + this.name = "StateMachineLimitExceeded"; + this.$fault = "client"; + Object.setPrototypeOf(this, _StateMachineLimitExceeded2.prototype); } - serialize(input, context) { - return (0, Aws_json1_0_1.se_ListTagsForResourceCommand)(input, context); + }; + __name(_StateMachineLimitExceeded, "StateMachineLimitExceeded"); + var StateMachineLimitExceeded = _StateMachineLimitExceeded; + var _StateMachineTypeNotSupported = class _StateMachineTypeNotSupported2 extends SFNServiceException { + /** + * @internal + */ + constructor(opts) { + super({ + name: "StateMachineTypeNotSupported", + $fault: "client", + ...opts + }); + this.name = "StateMachineTypeNotSupported"; + this.$fault = "client"; + Object.setPrototypeOf(this, _StateMachineTypeNotSupported2.prototype); } - deserialize(output, context) { - return (0, Aws_json1_0_1.de_ListTagsForResourceCommand)(output, context); + }; + __name(_StateMachineTypeNotSupported, "StateMachineTypeNotSupported"); + var StateMachineTypeNotSupported = _StateMachineTypeNotSupported; + var ValidationExceptionReason = { + API_DOES_NOT_SUPPORT_LABELED_ARNS: "API_DOES_NOT_SUPPORT_LABELED_ARNS", + CANNOT_UPDATE_COMPLETED_MAP_RUN: "CANNOT_UPDATE_COMPLETED_MAP_RUN", + INVALID_ROUTING_CONFIGURATION: "INVALID_ROUTING_CONFIGURATION", + MISSING_REQUIRED_PARAMETER: "MISSING_REQUIRED_PARAMETER" + }; + var _ValidationException = class _ValidationException2 extends SFNServiceException { + /** + * @internal + */ + constructor(opts) { + super({ + name: "ValidationException", + $fault: "client", + ...opts + }); + this.name = "ValidationException"; + this.$fault = "client"; + Object.setPrototypeOf(this, _ValidationException2.prototype); + this.reason = opts.reason; } }; - exports2.ListTagsForResourceCommand = ListTagsForResourceCommand; - } -}); - -// ../../../node_modules/@aws-sdk/client-sfn/dist-cjs/commands/PublishStateMachineVersionCommand.js -var require_PublishStateMachineVersionCommand = __commonJS({ - "../../../node_modules/@aws-sdk/client-sfn/dist-cjs/commands/PublishStateMachineVersionCommand.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.PublishStateMachineVersionCommand = exports2.$Command = void 0; - var middleware_endpoint_1 = require_dist_cjs26(); - var middleware_serde_1 = require_dist_cjs25(); - var smithy_client_1 = require_dist_cjs34(); - Object.defineProperty(exports2, "$Command", { enumerable: true, get: function() { - return smithy_client_1.Command; - } }); - var types_1 = require_dist_cjs(); - var models_0_1 = require_models_03(); - var Aws_json1_0_1 = require_Aws_json1_0(); - var PublishStateMachineVersionCommand = class _PublishStateMachineVersionCommand extends smithy_client_1.Command { - static getEndpointParameterInstructions() { - return { - UseFIPS: { type: "builtInParams", name: "useFipsEndpoint" }, - Endpoint: { type: "builtInParams", name: "endpoint" }, - Region: { type: "builtInParams", name: "region" }, - UseDualStack: { type: "builtInParams", name: "useDualstackEndpoint" } - }; + __name(_ValidationException, "ValidationException"); + var ValidationException = _ValidationException; + var _ResourceNotFound = class _ResourceNotFound2 extends SFNServiceException { + /** + * @internal + */ + constructor(opts) { + super({ + name: "ResourceNotFound", + $fault: "client", + ...opts + }); + this.name = "ResourceNotFound"; + this.$fault = "client"; + Object.setPrototypeOf(this, _ResourceNotFound2.prototype); + this.resourceName = opts.resourceName; } - constructor(input) { - super(); - this.input = input; + }; + __name(_ResourceNotFound, "ResourceNotFound"); + var ResourceNotFound = _ResourceNotFound; + var _ServiceQuotaExceededException = class _ServiceQuotaExceededException2 extends SFNServiceException { + /** + * @internal + */ + constructor(opts) { + super({ + name: "ServiceQuotaExceededException", + $fault: "client", + ...opts + }); + this.name = "ServiceQuotaExceededException"; + this.$fault = "client"; + Object.setPrototypeOf(this, _ServiceQuotaExceededException2.prototype); } - resolveMiddleware(clientStack, configuration, options) { - this.middlewareStack.use((0, middleware_serde_1.getSerdePlugin)(configuration, this.serialize, this.deserialize)); - this.middlewareStack.use((0, middleware_endpoint_1.getEndpointPlugin)(configuration, _PublishStateMachineVersionCommand.getEndpointParameterInstructions())); - const stack = clientStack.concat(this.middlewareStack); - const { logger } = configuration; - const clientName = "SFNClient"; - const commandName = "PublishStateMachineVersionCommand"; - const handlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: models_0_1.PublishStateMachineVersionInputFilterSensitiveLog, - outputFilterSensitiveLog: (_) => _, - [types_1.SMITHY_CONTEXT_KEY]: { - service: "AWSStepFunctions", - operation: "PublishStateMachineVersion" - } - }; - const { requestHandler } = configuration; - return stack.resolve((request2) => requestHandler.handle(request2.request, options || {}), handlerExecutionContext); + }; + __name(_ServiceQuotaExceededException, "ServiceQuotaExceededException"); + var ServiceQuotaExceededException = _ServiceQuotaExceededException; + var IncludedData = { + ALL_DATA: "ALL_DATA", + METADATA_ONLY: "METADATA_ONLY" + }; + var ExecutionRedriveStatus = { + NOT_REDRIVABLE: "NOT_REDRIVABLE", + REDRIVABLE: "REDRIVABLE", + REDRIVABLE_BY_MAP_RUN: "REDRIVABLE_BY_MAP_RUN" + }; + var ExecutionStatus = { + ABORTED: "ABORTED", + FAILED: "FAILED", + PENDING_REDRIVE: "PENDING_REDRIVE", + RUNNING: "RUNNING", + SUCCEEDED: "SUCCEEDED", + TIMED_OUT: "TIMED_OUT" + }; + var _ExecutionDoesNotExist = class _ExecutionDoesNotExist2 extends SFNServiceException { + /** + * @internal + */ + constructor(opts) { + super({ + name: "ExecutionDoesNotExist", + $fault: "client", + ...opts + }); + this.name = "ExecutionDoesNotExist"; + this.$fault = "client"; + Object.setPrototypeOf(this, _ExecutionDoesNotExist2.prototype); } - serialize(input, context) { - return (0, Aws_json1_0_1.se_PublishStateMachineVersionCommand)(input, context); + }; + __name(_ExecutionDoesNotExist, "ExecutionDoesNotExist"); + var ExecutionDoesNotExist = _ExecutionDoesNotExist; + var KmsKeyState = { + CREATING: "CREATING", + DISABLED: "DISABLED", + PENDING_DELETION: "PENDING_DELETION", + PENDING_IMPORT: "PENDING_IMPORT", + UNAVAILABLE: "UNAVAILABLE" + }; + var _KmsInvalidStateException = class _KmsInvalidStateException2 extends SFNServiceException { + /** + * @internal + */ + constructor(opts) { + super({ + name: "KmsInvalidStateException", + $fault: "client", + ...opts + }); + this.name = "KmsInvalidStateException"; + this.$fault = "client"; + Object.setPrototypeOf(this, _KmsInvalidStateException2.prototype); + this.kmsKeyState = opts.kmsKeyState; } - deserialize(output, context) { - return (0, Aws_json1_0_1.de_PublishStateMachineVersionCommand)(output, context); + }; + __name(_KmsInvalidStateException, "KmsInvalidStateException"); + var KmsInvalidStateException = _KmsInvalidStateException; + var MapRunStatus = { + ABORTED: "ABORTED", + FAILED: "FAILED", + RUNNING: "RUNNING", + SUCCEEDED: "SUCCEEDED" + }; + var StateMachineStatus = { + ACTIVE: "ACTIVE", + DELETING: "DELETING" + }; + var _StateMachineDoesNotExist = class _StateMachineDoesNotExist2 extends SFNServiceException { + /** + * @internal + */ + constructor(opts) { + super({ + name: "StateMachineDoesNotExist", + $fault: "client", + ...opts + }); + this.name = "StateMachineDoesNotExist"; + this.$fault = "client"; + Object.setPrototypeOf(this, _StateMachineDoesNotExist2.prototype); } }; - exports2.PublishStateMachineVersionCommand = PublishStateMachineVersionCommand; - } -}); - -// ../../../node_modules/@aws-sdk/client-sfn/dist-cjs/commands/SendTaskFailureCommand.js -var require_SendTaskFailureCommand = __commonJS({ - "../../../node_modules/@aws-sdk/client-sfn/dist-cjs/commands/SendTaskFailureCommand.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.SendTaskFailureCommand = exports2.$Command = void 0; - var middleware_endpoint_1 = require_dist_cjs26(); - var middleware_serde_1 = require_dist_cjs25(); - var smithy_client_1 = require_dist_cjs34(); - Object.defineProperty(exports2, "$Command", { enumerable: true, get: function() { - return smithy_client_1.Command; - } }); - var types_1 = require_dist_cjs(); - var models_0_1 = require_models_03(); - var Aws_json1_0_1 = require_Aws_json1_0(); - var SendTaskFailureCommand = class _SendTaskFailureCommand extends smithy_client_1.Command { - static getEndpointParameterInstructions() { - return { - UseFIPS: { type: "builtInParams", name: "useFipsEndpoint" }, - Endpoint: { type: "builtInParams", name: "endpoint" }, - Region: { type: "builtInParams", name: "region" }, - UseDualStack: { type: "builtInParams", name: "useDualstackEndpoint" } - }; - } - constructor(input) { - super(); - this.input = input; - } - resolveMiddleware(clientStack, configuration, options) { - this.middlewareStack.use((0, middleware_serde_1.getSerdePlugin)(configuration, this.serialize, this.deserialize)); - this.middlewareStack.use((0, middleware_endpoint_1.getEndpointPlugin)(configuration, _SendTaskFailureCommand.getEndpointParameterInstructions())); - const stack = clientStack.concat(this.middlewareStack); - const { logger } = configuration; - const clientName = "SFNClient"; - const commandName = "SendTaskFailureCommand"; - const handlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: models_0_1.SendTaskFailureInputFilterSensitiveLog, - outputFilterSensitiveLog: (_) => _, - [types_1.SMITHY_CONTEXT_KEY]: { - service: "AWSStepFunctions", - operation: "SendTaskFailure" - } - }; - const { requestHandler } = configuration; - return stack.resolve((request2) => requestHandler.handle(request2.request, options || {}), handlerExecutionContext); - } - serialize(input, context) { - return (0, Aws_json1_0_1.se_SendTaskFailureCommand)(input, context); - } - deserialize(output, context) { - return (0, Aws_json1_0_1.de_SendTaskFailureCommand)(output, context); + __name(_StateMachineDoesNotExist, "StateMachineDoesNotExist"); + var StateMachineDoesNotExist = _StateMachineDoesNotExist; + var HistoryEventType = { + ActivityFailed: "ActivityFailed", + ActivityScheduleFailed: "ActivityScheduleFailed", + ActivityScheduled: "ActivityScheduled", + ActivityStarted: "ActivityStarted", + ActivitySucceeded: "ActivitySucceeded", + ActivityTimedOut: "ActivityTimedOut", + ChoiceStateEntered: "ChoiceStateEntered", + ChoiceStateExited: "ChoiceStateExited", + ExecutionAborted: "ExecutionAborted", + ExecutionFailed: "ExecutionFailed", + ExecutionRedriven: "ExecutionRedriven", + ExecutionStarted: "ExecutionStarted", + ExecutionSucceeded: "ExecutionSucceeded", + ExecutionTimedOut: "ExecutionTimedOut", + FailStateEntered: "FailStateEntered", + LambdaFunctionFailed: "LambdaFunctionFailed", + LambdaFunctionScheduleFailed: "LambdaFunctionScheduleFailed", + LambdaFunctionScheduled: "LambdaFunctionScheduled", + LambdaFunctionStartFailed: "LambdaFunctionStartFailed", + LambdaFunctionStarted: "LambdaFunctionStarted", + LambdaFunctionSucceeded: "LambdaFunctionSucceeded", + LambdaFunctionTimedOut: "LambdaFunctionTimedOut", + MapIterationAborted: "MapIterationAborted", + MapIterationFailed: "MapIterationFailed", + MapIterationStarted: "MapIterationStarted", + MapIterationSucceeded: "MapIterationSucceeded", + MapRunAborted: "MapRunAborted", + MapRunFailed: "MapRunFailed", + MapRunRedriven: "MapRunRedriven", + MapRunStarted: "MapRunStarted", + MapRunSucceeded: "MapRunSucceeded", + MapStateAborted: "MapStateAborted", + MapStateEntered: "MapStateEntered", + MapStateExited: "MapStateExited", + MapStateFailed: "MapStateFailed", + MapStateStarted: "MapStateStarted", + MapStateSucceeded: "MapStateSucceeded", + ParallelStateAborted: "ParallelStateAborted", + ParallelStateEntered: "ParallelStateEntered", + ParallelStateExited: "ParallelStateExited", + ParallelStateFailed: "ParallelStateFailed", + ParallelStateStarted: "ParallelStateStarted", + ParallelStateSucceeded: "ParallelStateSucceeded", + PassStateEntered: "PassStateEntered", + PassStateExited: "PassStateExited", + SucceedStateEntered: "SucceedStateEntered", + SucceedStateExited: "SucceedStateExited", + TaskFailed: "TaskFailed", + TaskScheduled: "TaskScheduled", + TaskStartFailed: "TaskStartFailed", + TaskStarted: "TaskStarted", + TaskStateAborted: "TaskStateAborted", + TaskStateEntered: "TaskStateEntered", + TaskStateExited: "TaskStateExited", + TaskSubmitFailed: "TaskSubmitFailed", + TaskSubmitted: "TaskSubmitted", + TaskSucceeded: "TaskSucceeded", + TaskTimedOut: "TaskTimedOut", + WaitStateAborted: "WaitStateAborted", + WaitStateEntered: "WaitStateEntered", + WaitStateExited: "WaitStateExited" + }; + var _InvalidToken = class _InvalidToken2 extends SFNServiceException { + /** + * @internal + */ + constructor(opts) { + super({ + name: "InvalidToken", + $fault: "client", + ...opts + }); + this.name = "InvalidToken"; + this.$fault = "client"; + Object.setPrototypeOf(this, _InvalidToken2.prototype); } }; - exports2.SendTaskFailureCommand = SendTaskFailureCommand; - } -}); - -// ../../../node_modules/@aws-sdk/client-sfn/dist-cjs/commands/SendTaskHeartbeatCommand.js -var require_SendTaskHeartbeatCommand = __commonJS({ - "../../../node_modules/@aws-sdk/client-sfn/dist-cjs/commands/SendTaskHeartbeatCommand.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.SendTaskHeartbeatCommand = exports2.$Command = void 0; - var middleware_endpoint_1 = require_dist_cjs26(); - var middleware_serde_1 = require_dist_cjs25(); - var smithy_client_1 = require_dist_cjs34(); - Object.defineProperty(exports2, "$Command", { enumerable: true, get: function() { - return smithy_client_1.Command; - } }); - var types_1 = require_dist_cjs(); - var Aws_json1_0_1 = require_Aws_json1_0(); - var SendTaskHeartbeatCommand = class _SendTaskHeartbeatCommand extends smithy_client_1.Command { - static getEndpointParameterInstructions() { - return { - UseFIPS: { type: "builtInParams", name: "useFipsEndpoint" }, - Endpoint: { type: "builtInParams", name: "endpoint" }, - Region: { type: "builtInParams", name: "region" }, - UseDualStack: { type: "builtInParams", name: "useDualstackEndpoint" } - }; + __name(_InvalidToken, "InvalidToken"); + var InvalidToken = _InvalidToken; + var ExecutionRedriveFilter = { + NOT_REDRIVEN: "NOT_REDRIVEN", + REDRIVEN: "REDRIVEN" + }; + var _ExecutionLimitExceeded = class _ExecutionLimitExceeded2 extends SFNServiceException { + /** + * @internal + */ + constructor(opts) { + super({ + name: "ExecutionLimitExceeded", + $fault: "client", + ...opts + }); + this.name = "ExecutionLimitExceeded"; + this.$fault = "client"; + Object.setPrototypeOf(this, _ExecutionLimitExceeded2.prototype); } - constructor(input) { - super(); - this.input = input; + }; + __name(_ExecutionLimitExceeded, "ExecutionLimitExceeded"); + var ExecutionLimitExceeded = _ExecutionLimitExceeded; + var _ExecutionNotRedrivable = class _ExecutionNotRedrivable2 extends SFNServiceException { + /** + * @internal + */ + constructor(opts) { + super({ + name: "ExecutionNotRedrivable", + $fault: "client", + ...opts + }); + this.name = "ExecutionNotRedrivable"; + this.$fault = "client"; + Object.setPrototypeOf(this, _ExecutionNotRedrivable2.prototype); } - resolveMiddleware(clientStack, configuration, options) { - this.middlewareStack.use((0, middleware_serde_1.getSerdePlugin)(configuration, this.serialize, this.deserialize)); - this.middlewareStack.use((0, middleware_endpoint_1.getEndpointPlugin)(configuration, _SendTaskHeartbeatCommand.getEndpointParameterInstructions())); - const stack = clientStack.concat(this.middlewareStack); - const { logger } = configuration; - const clientName = "SFNClient"; - const commandName = "SendTaskHeartbeatCommand"; - const handlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: (_) => _, - outputFilterSensitiveLog: (_) => _, - [types_1.SMITHY_CONTEXT_KEY]: { - service: "AWSStepFunctions", - operation: "SendTaskHeartbeat" - } - }; - const { requestHandler } = configuration; - return stack.resolve((request2) => requestHandler.handle(request2.request, options || {}), handlerExecutionContext); + }; + __name(_ExecutionNotRedrivable, "ExecutionNotRedrivable"); + var ExecutionNotRedrivable = _ExecutionNotRedrivable; + var _TaskDoesNotExist = class _TaskDoesNotExist2 extends SFNServiceException { + /** + * @internal + */ + constructor(opts) { + super({ + name: "TaskDoesNotExist", + $fault: "client", + ...opts + }); + this.name = "TaskDoesNotExist"; + this.$fault = "client"; + Object.setPrototypeOf(this, _TaskDoesNotExist2.prototype); } - serialize(input, context) { - return (0, Aws_json1_0_1.se_SendTaskHeartbeatCommand)(input, context); + }; + __name(_TaskDoesNotExist, "TaskDoesNotExist"); + var TaskDoesNotExist = _TaskDoesNotExist; + var _TaskTimedOut = class _TaskTimedOut2 extends SFNServiceException { + /** + * @internal + */ + constructor(opts) { + super({ + name: "TaskTimedOut", + $fault: "client", + ...opts + }); + this.name = "TaskTimedOut"; + this.$fault = "client"; + Object.setPrototypeOf(this, _TaskTimedOut2.prototype); } - deserialize(output, context) { - return (0, Aws_json1_0_1.de_SendTaskHeartbeatCommand)(output, context); + }; + __name(_TaskTimedOut, "TaskTimedOut"); + var TaskTimedOut = _TaskTimedOut; + var _InvalidOutput = class _InvalidOutput2 extends SFNServiceException { + /** + * @internal + */ + constructor(opts) { + super({ + name: "InvalidOutput", + $fault: "client", + ...opts + }); + this.name = "InvalidOutput"; + this.$fault = "client"; + Object.setPrototypeOf(this, _InvalidOutput2.prototype); } }; - exports2.SendTaskHeartbeatCommand = SendTaskHeartbeatCommand; - } -}); - -// ../../../node_modules/@aws-sdk/client-sfn/dist-cjs/commands/SendTaskSuccessCommand.js -var require_SendTaskSuccessCommand = __commonJS({ - "../../../node_modules/@aws-sdk/client-sfn/dist-cjs/commands/SendTaskSuccessCommand.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.SendTaskSuccessCommand = exports2.$Command = void 0; - var middleware_endpoint_1 = require_dist_cjs26(); - var middleware_serde_1 = require_dist_cjs25(); - var smithy_client_1 = require_dist_cjs34(); - Object.defineProperty(exports2, "$Command", { enumerable: true, get: function() { - return smithy_client_1.Command; - } }); - var types_1 = require_dist_cjs(); - var models_0_1 = require_models_03(); - var Aws_json1_0_1 = require_Aws_json1_0(); - var SendTaskSuccessCommand = class _SendTaskSuccessCommand extends smithy_client_1.Command { - static getEndpointParameterInstructions() { - return { - UseFIPS: { type: "builtInParams", name: "useFipsEndpoint" }, - Endpoint: { type: "builtInParams", name: "endpoint" }, - Region: { type: "builtInParams", name: "region" }, - UseDualStack: { type: "builtInParams", name: "useDualstackEndpoint" } - }; + __name(_InvalidOutput, "InvalidOutput"); + var InvalidOutput = _InvalidOutput; + var _ExecutionAlreadyExists = class _ExecutionAlreadyExists2 extends SFNServiceException { + /** + * @internal + */ + constructor(opts) { + super({ + name: "ExecutionAlreadyExists", + $fault: "client", + ...opts + }); + this.name = "ExecutionAlreadyExists"; + this.$fault = "client"; + Object.setPrototypeOf(this, _ExecutionAlreadyExists2.prototype); } - constructor(input) { - super(); - this.input = input; + }; + __name(_ExecutionAlreadyExists, "ExecutionAlreadyExists"); + var ExecutionAlreadyExists = _ExecutionAlreadyExists; + var _InvalidExecutionInput = class _InvalidExecutionInput2 extends SFNServiceException { + /** + * @internal + */ + constructor(opts) { + super({ + name: "InvalidExecutionInput", + $fault: "client", + ...opts + }); + this.name = "InvalidExecutionInput"; + this.$fault = "client"; + Object.setPrototypeOf(this, _InvalidExecutionInput2.prototype); } - resolveMiddleware(clientStack, configuration, options) { - this.middlewareStack.use((0, middleware_serde_1.getSerdePlugin)(configuration, this.serialize, this.deserialize)); - this.middlewareStack.use((0, middleware_endpoint_1.getEndpointPlugin)(configuration, _SendTaskSuccessCommand.getEndpointParameterInstructions())); - const stack = clientStack.concat(this.middlewareStack); - const { logger } = configuration; - const clientName = "SFNClient"; - const commandName = "SendTaskSuccessCommand"; - const handlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: models_0_1.SendTaskSuccessInputFilterSensitiveLog, - outputFilterSensitiveLog: (_) => _, - [types_1.SMITHY_CONTEXT_KEY]: { - service: "AWSStepFunctions", - operation: "SendTaskSuccess" - } - }; - const { requestHandler } = configuration; - return stack.resolve((request2) => requestHandler.handle(request2.request, options || {}), handlerExecutionContext); + }; + __name(_InvalidExecutionInput, "InvalidExecutionInput"); + var InvalidExecutionInput = _InvalidExecutionInput; + var SyncExecutionStatus = { + FAILED: "FAILED", + SUCCEEDED: "SUCCEEDED", + TIMED_OUT: "TIMED_OUT" + }; + var InspectionLevel = { + DEBUG: "DEBUG", + INFO: "INFO", + TRACE: "TRACE" + }; + var TestExecutionStatus = { + CAUGHT_ERROR: "CAUGHT_ERROR", + FAILED: "FAILED", + RETRIABLE: "RETRIABLE", + SUCCEEDED: "SUCCEEDED" + }; + var _MissingRequiredParameter = class _MissingRequiredParameter2 extends SFNServiceException { + /** + * @internal + */ + constructor(opts) { + super({ + name: "MissingRequiredParameter", + $fault: "client", + ...opts + }); + this.name = "MissingRequiredParameter"; + this.$fault = "client"; + Object.setPrototypeOf(this, _MissingRequiredParameter2.prototype); } - serialize(input, context) { - return (0, Aws_json1_0_1.se_SendTaskSuccessCommand)(input, context); + }; + __name(_MissingRequiredParameter, "MissingRequiredParameter"); + var MissingRequiredParameter = _MissingRequiredParameter; + var ValidateStateMachineDefinitionSeverity = { + ERROR: "ERROR" + }; + var ValidateStateMachineDefinitionResultCode = { + FAIL: "FAIL", + OK: "OK" + }; + var ActivityFailedEventDetailsFilterSensitiveLog = /* @__PURE__ */ __name((obj) => ({ + ...obj, + ...obj.error && { error: import_smithy_client5.SENSITIVE_STRING }, + ...obj.cause && { cause: import_smithy_client5.SENSITIVE_STRING } + }), "ActivityFailedEventDetailsFilterSensitiveLog"); + var ActivityScheduledEventDetailsFilterSensitiveLog = /* @__PURE__ */ __name((obj) => ({ + ...obj, + ...obj.input && { input: import_smithy_client5.SENSITIVE_STRING } + }), "ActivityScheduledEventDetailsFilterSensitiveLog"); + var ActivityScheduleFailedEventDetailsFilterSensitiveLog = /* @__PURE__ */ __name((obj) => ({ + ...obj, + ...obj.error && { error: import_smithy_client5.SENSITIVE_STRING }, + ...obj.cause && { cause: import_smithy_client5.SENSITIVE_STRING } + }), "ActivityScheduleFailedEventDetailsFilterSensitiveLog"); + var ActivitySucceededEventDetailsFilterSensitiveLog = /* @__PURE__ */ __name((obj) => ({ + ...obj, + ...obj.output && { output: import_smithy_client5.SENSITIVE_STRING } + }), "ActivitySucceededEventDetailsFilterSensitiveLog"); + var ActivityTimedOutEventDetailsFilterSensitiveLog = /* @__PURE__ */ __name((obj) => ({ + ...obj, + ...obj.error && { error: import_smithy_client5.SENSITIVE_STRING }, + ...obj.cause && { cause: import_smithy_client5.SENSITIVE_STRING } + }), "ActivityTimedOutEventDetailsFilterSensitiveLog"); + var CreateStateMachineInputFilterSensitiveLog = /* @__PURE__ */ __name((obj) => ({ + ...obj, + ...obj.definition && { definition: import_smithy_client5.SENSITIVE_STRING }, + ...obj.versionDescription && { versionDescription: import_smithy_client5.SENSITIVE_STRING } + }), "CreateStateMachineInputFilterSensitiveLog"); + var CreateStateMachineAliasInputFilterSensitiveLog = /* @__PURE__ */ __name((obj) => ({ + ...obj, + ...obj.description && { description: import_smithy_client5.SENSITIVE_STRING } + }), "CreateStateMachineAliasInputFilterSensitiveLog"); + var DescribeExecutionOutputFilterSensitiveLog = /* @__PURE__ */ __name((obj) => ({ + ...obj, + ...obj.input && { input: import_smithy_client5.SENSITIVE_STRING }, + ...obj.output && { output: import_smithy_client5.SENSITIVE_STRING }, + ...obj.error && { error: import_smithy_client5.SENSITIVE_STRING }, + ...obj.cause && { cause: import_smithy_client5.SENSITIVE_STRING }, + ...obj.redriveStatusReason && { redriveStatusReason: import_smithy_client5.SENSITIVE_STRING } + }), "DescribeExecutionOutputFilterSensitiveLog"); + var DescribeStateMachineOutputFilterSensitiveLog = /* @__PURE__ */ __name((obj) => ({ + ...obj, + ...obj.definition && { definition: import_smithy_client5.SENSITIVE_STRING }, + ...obj.description && { description: import_smithy_client5.SENSITIVE_STRING } + }), "DescribeStateMachineOutputFilterSensitiveLog"); + var DescribeStateMachineAliasOutputFilterSensitiveLog = /* @__PURE__ */ __name((obj) => ({ + ...obj, + ...obj.description && { description: import_smithy_client5.SENSITIVE_STRING } + }), "DescribeStateMachineAliasOutputFilterSensitiveLog"); + var DescribeStateMachineForExecutionOutputFilterSensitiveLog = /* @__PURE__ */ __name((obj) => ({ + ...obj, + ...obj.definition && { definition: import_smithy_client5.SENSITIVE_STRING } + }), "DescribeStateMachineForExecutionOutputFilterSensitiveLog"); + var GetActivityTaskOutputFilterSensitiveLog = /* @__PURE__ */ __name((obj) => ({ + ...obj, + ...obj.input && { input: import_smithy_client5.SENSITIVE_STRING } + }), "GetActivityTaskOutputFilterSensitiveLog"); + var ExecutionAbortedEventDetailsFilterSensitiveLog = /* @__PURE__ */ __name((obj) => ({ + ...obj, + ...obj.error && { error: import_smithy_client5.SENSITIVE_STRING }, + ...obj.cause && { cause: import_smithy_client5.SENSITIVE_STRING } + }), "ExecutionAbortedEventDetailsFilterSensitiveLog"); + var ExecutionFailedEventDetailsFilterSensitiveLog = /* @__PURE__ */ __name((obj) => ({ + ...obj, + ...obj.error && { error: import_smithy_client5.SENSITIVE_STRING }, + ...obj.cause && { cause: import_smithy_client5.SENSITIVE_STRING } + }), "ExecutionFailedEventDetailsFilterSensitiveLog"); + var ExecutionStartedEventDetailsFilterSensitiveLog = /* @__PURE__ */ __name((obj) => ({ + ...obj, + ...obj.input && { input: import_smithy_client5.SENSITIVE_STRING } + }), "ExecutionStartedEventDetailsFilterSensitiveLog"); + var ExecutionSucceededEventDetailsFilterSensitiveLog = /* @__PURE__ */ __name((obj) => ({ + ...obj, + ...obj.output && { output: import_smithy_client5.SENSITIVE_STRING } + }), "ExecutionSucceededEventDetailsFilterSensitiveLog"); + var ExecutionTimedOutEventDetailsFilterSensitiveLog = /* @__PURE__ */ __name((obj) => ({ + ...obj, + ...obj.error && { error: import_smithy_client5.SENSITIVE_STRING }, + ...obj.cause && { cause: import_smithy_client5.SENSITIVE_STRING } + }), "ExecutionTimedOutEventDetailsFilterSensitiveLog"); + var LambdaFunctionFailedEventDetailsFilterSensitiveLog = /* @__PURE__ */ __name((obj) => ({ + ...obj, + ...obj.error && { error: import_smithy_client5.SENSITIVE_STRING }, + ...obj.cause && { cause: import_smithy_client5.SENSITIVE_STRING } + }), "LambdaFunctionFailedEventDetailsFilterSensitiveLog"); + var LambdaFunctionScheduledEventDetailsFilterSensitiveLog = /* @__PURE__ */ __name((obj) => ({ + ...obj, + ...obj.input && { input: import_smithy_client5.SENSITIVE_STRING } + }), "LambdaFunctionScheduledEventDetailsFilterSensitiveLog"); + var LambdaFunctionScheduleFailedEventDetailsFilterSensitiveLog = /* @__PURE__ */ __name((obj) => ({ + ...obj, + ...obj.error && { error: import_smithy_client5.SENSITIVE_STRING }, + ...obj.cause && { cause: import_smithy_client5.SENSITIVE_STRING } + }), "LambdaFunctionScheduleFailedEventDetailsFilterSensitiveLog"); + var LambdaFunctionStartFailedEventDetailsFilterSensitiveLog = /* @__PURE__ */ __name((obj) => ({ + ...obj, + ...obj.error && { error: import_smithy_client5.SENSITIVE_STRING }, + ...obj.cause && { cause: import_smithy_client5.SENSITIVE_STRING } + }), "LambdaFunctionStartFailedEventDetailsFilterSensitiveLog"); + var LambdaFunctionSucceededEventDetailsFilterSensitiveLog = /* @__PURE__ */ __name((obj) => ({ + ...obj, + ...obj.output && { output: import_smithy_client5.SENSITIVE_STRING } + }), "LambdaFunctionSucceededEventDetailsFilterSensitiveLog"); + var LambdaFunctionTimedOutEventDetailsFilterSensitiveLog = /* @__PURE__ */ __name((obj) => ({ + ...obj, + ...obj.error && { error: import_smithy_client5.SENSITIVE_STRING }, + ...obj.cause && { cause: import_smithy_client5.SENSITIVE_STRING } + }), "LambdaFunctionTimedOutEventDetailsFilterSensitiveLog"); + var MapRunFailedEventDetailsFilterSensitiveLog = /* @__PURE__ */ __name((obj) => ({ + ...obj, + ...obj.error && { error: import_smithy_client5.SENSITIVE_STRING }, + ...obj.cause && { cause: import_smithy_client5.SENSITIVE_STRING } + }), "MapRunFailedEventDetailsFilterSensitiveLog"); + var StateEnteredEventDetailsFilterSensitiveLog = /* @__PURE__ */ __name((obj) => ({ + ...obj, + ...obj.input && { input: import_smithy_client5.SENSITIVE_STRING } + }), "StateEnteredEventDetailsFilterSensitiveLog"); + var StateExitedEventDetailsFilterSensitiveLog = /* @__PURE__ */ __name((obj) => ({ + ...obj, + ...obj.output && { output: import_smithy_client5.SENSITIVE_STRING } + }), "StateExitedEventDetailsFilterSensitiveLog"); + var TaskFailedEventDetailsFilterSensitiveLog = /* @__PURE__ */ __name((obj) => ({ + ...obj, + ...obj.error && { error: import_smithy_client5.SENSITIVE_STRING }, + ...obj.cause && { cause: import_smithy_client5.SENSITIVE_STRING } + }), "TaskFailedEventDetailsFilterSensitiveLog"); + var TaskScheduledEventDetailsFilterSensitiveLog = /* @__PURE__ */ __name((obj) => ({ + ...obj, + ...obj.parameters && { parameters: import_smithy_client5.SENSITIVE_STRING } + }), "TaskScheduledEventDetailsFilterSensitiveLog"); + var TaskStartFailedEventDetailsFilterSensitiveLog = /* @__PURE__ */ __name((obj) => ({ + ...obj, + ...obj.error && { error: import_smithy_client5.SENSITIVE_STRING }, + ...obj.cause && { cause: import_smithy_client5.SENSITIVE_STRING } + }), "TaskStartFailedEventDetailsFilterSensitiveLog"); + var TaskSubmitFailedEventDetailsFilterSensitiveLog = /* @__PURE__ */ __name((obj) => ({ + ...obj, + ...obj.error && { error: import_smithy_client5.SENSITIVE_STRING }, + ...obj.cause && { cause: import_smithy_client5.SENSITIVE_STRING } + }), "TaskSubmitFailedEventDetailsFilterSensitiveLog"); + var TaskSubmittedEventDetailsFilterSensitiveLog = /* @__PURE__ */ __name((obj) => ({ + ...obj, + ...obj.output && { output: import_smithy_client5.SENSITIVE_STRING } + }), "TaskSubmittedEventDetailsFilterSensitiveLog"); + var TaskSucceededEventDetailsFilterSensitiveLog = /* @__PURE__ */ __name((obj) => ({ + ...obj, + ...obj.output && { output: import_smithy_client5.SENSITIVE_STRING } + }), "TaskSucceededEventDetailsFilterSensitiveLog"); + var TaskTimedOutEventDetailsFilterSensitiveLog = /* @__PURE__ */ __name((obj) => ({ + ...obj, + ...obj.error && { error: import_smithy_client5.SENSITIVE_STRING }, + ...obj.cause && { cause: import_smithy_client5.SENSITIVE_STRING } + }), "TaskTimedOutEventDetailsFilterSensitiveLog"); + var HistoryEventFilterSensitiveLog = /* @__PURE__ */ __name((obj) => ({ + ...obj, + ...obj.activityFailedEventDetails && { + activityFailedEventDetails: ActivityFailedEventDetailsFilterSensitiveLog(obj.activityFailedEventDetails) + }, + ...obj.activityScheduleFailedEventDetails && { + activityScheduleFailedEventDetails: ActivityScheduleFailedEventDetailsFilterSensitiveLog( + obj.activityScheduleFailedEventDetails + ) + }, + ...obj.activityScheduledEventDetails && { + activityScheduledEventDetails: ActivityScheduledEventDetailsFilterSensitiveLog(obj.activityScheduledEventDetails) + }, + ...obj.activitySucceededEventDetails && { + activitySucceededEventDetails: ActivitySucceededEventDetailsFilterSensitiveLog(obj.activitySucceededEventDetails) + }, + ...obj.activityTimedOutEventDetails && { + activityTimedOutEventDetails: ActivityTimedOutEventDetailsFilterSensitiveLog(obj.activityTimedOutEventDetails) + }, + ...obj.taskFailedEventDetails && { + taskFailedEventDetails: TaskFailedEventDetailsFilterSensitiveLog(obj.taskFailedEventDetails) + }, + ...obj.taskScheduledEventDetails && { + taskScheduledEventDetails: TaskScheduledEventDetailsFilterSensitiveLog(obj.taskScheduledEventDetails) + }, + ...obj.taskStartFailedEventDetails && { + taskStartFailedEventDetails: TaskStartFailedEventDetailsFilterSensitiveLog(obj.taskStartFailedEventDetails) + }, + ...obj.taskSubmitFailedEventDetails && { + taskSubmitFailedEventDetails: TaskSubmitFailedEventDetailsFilterSensitiveLog(obj.taskSubmitFailedEventDetails) + }, + ...obj.taskSubmittedEventDetails && { + taskSubmittedEventDetails: TaskSubmittedEventDetailsFilterSensitiveLog(obj.taskSubmittedEventDetails) + }, + ...obj.taskSucceededEventDetails && { + taskSucceededEventDetails: TaskSucceededEventDetailsFilterSensitiveLog(obj.taskSucceededEventDetails) + }, + ...obj.taskTimedOutEventDetails && { + taskTimedOutEventDetails: TaskTimedOutEventDetailsFilterSensitiveLog(obj.taskTimedOutEventDetails) + }, + ...obj.executionFailedEventDetails && { + executionFailedEventDetails: ExecutionFailedEventDetailsFilterSensitiveLog(obj.executionFailedEventDetails) + }, + ...obj.executionStartedEventDetails && { + executionStartedEventDetails: ExecutionStartedEventDetailsFilterSensitiveLog(obj.executionStartedEventDetails) + }, + ...obj.executionSucceededEventDetails && { + executionSucceededEventDetails: ExecutionSucceededEventDetailsFilterSensitiveLog( + obj.executionSucceededEventDetails + ) + }, + ...obj.executionAbortedEventDetails && { + executionAbortedEventDetails: ExecutionAbortedEventDetailsFilterSensitiveLog(obj.executionAbortedEventDetails) + }, + ...obj.executionTimedOutEventDetails && { + executionTimedOutEventDetails: ExecutionTimedOutEventDetailsFilterSensitiveLog(obj.executionTimedOutEventDetails) + }, + ...obj.lambdaFunctionFailedEventDetails && { + lambdaFunctionFailedEventDetails: LambdaFunctionFailedEventDetailsFilterSensitiveLog( + obj.lambdaFunctionFailedEventDetails + ) + }, + ...obj.lambdaFunctionScheduleFailedEventDetails && { + lambdaFunctionScheduleFailedEventDetails: LambdaFunctionScheduleFailedEventDetailsFilterSensitiveLog( + obj.lambdaFunctionScheduleFailedEventDetails + ) + }, + ...obj.lambdaFunctionScheduledEventDetails && { + lambdaFunctionScheduledEventDetails: LambdaFunctionScheduledEventDetailsFilterSensitiveLog( + obj.lambdaFunctionScheduledEventDetails + ) + }, + ...obj.lambdaFunctionStartFailedEventDetails && { + lambdaFunctionStartFailedEventDetails: LambdaFunctionStartFailedEventDetailsFilterSensitiveLog( + obj.lambdaFunctionStartFailedEventDetails + ) + }, + ...obj.lambdaFunctionSucceededEventDetails && { + lambdaFunctionSucceededEventDetails: LambdaFunctionSucceededEventDetailsFilterSensitiveLog( + obj.lambdaFunctionSucceededEventDetails + ) + }, + ...obj.lambdaFunctionTimedOutEventDetails && { + lambdaFunctionTimedOutEventDetails: LambdaFunctionTimedOutEventDetailsFilterSensitiveLog( + obj.lambdaFunctionTimedOutEventDetails + ) + }, + ...obj.stateEnteredEventDetails && { + stateEnteredEventDetails: StateEnteredEventDetailsFilterSensitiveLog(obj.stateEnteredEventDetails) + }, + ...obj.stateExitedEventDetails && { + stateExitedEventDetails: StateExitedEventDetailsFilterSensitiveLog(obj.stateExitedEventDetails) + }, + ...obj.mapRunFailedEventDetails && { + mapRunFailedEventDetails: MapRunFailedEventDetailsFilterSensitiveLog(obj.mapRunFailedEventDetails) } - deserialize(output, context) { - return (0, Aws_json1_0_1.de_SendTaskSuccessCommand)(output, context); + }), "HistoryEventFilterSensitiveLog"); + var GetExecutionHistoryOutputFilterSensitiveLog = /* @__PURE__ */ __name((obj) => ({ + ...obj, + ...obj.events && { events: obj.events.map((item) => HistoryEventFilterSensitiveLog(item)) } + }), "GetExecutionHistoryOutputFilterSensitiveLog"); + var PublishStateMachineVersionInputFilterSensitiveLog = /* @__PURE__ */ __name((obj) => ({ + ...obj, + ...obj.description && { description: import_smithy_client5.SENSITIVE_STRING } + }), "PublishStateMachineVersionInputFilterSensitiveLog"); + var SendTaskFailureInputFilterSensitiveLog = /* @__PURE__ */ __name((obj) => ({ + ...obj, + ...obj.error && { error: import_smithy_client5.SENSITIVE_STRING }, + ...obj.cause && { cause: import_smithy_client5.SENSITIVE_STRING } + }), "SendTaskFailureInputFilterSensitiveLog"); + var SendTaskSuccessInputFilterSensitiveLog = /* @__PURE__ */ __name((obj) => ({ + ...obj, + ...obj.output && { output: import_smithy_client5.SENSITIVE_STRING } + }), "SendTaskSuccessInputFilterSensitiveLog"); + var StartExecutionInputFilterSensitiveLog = /* @__PURE__ */ __name((obj) => ({ + ...obj, + ...obj.input && { input: import_smithy_client5.SENSITIVE_STRING } + }), "StartExecutionInputFilterSensitiveLog"); + var StartSyncExecutionInputFilterSensitiveLog = /* @__PURE__ */ __name((obj) => ({ + ...obj, + ...obj.input && { input: import_smithy_client5.SENSITIVE_STRING } + }), "StartSyncExecutionInputFilterSensitiveLog"); + var StartSyncExecutionOutputFilterSensitiveLog = /* @__PURE__ */ __name((obj) => ({ + ...obj, + ...obj.error && { error: import_smithy_client5.SENSITIVE_STRING }, + ...obj.cause && { cause: import_smithy_client5.SENSITIVE_STRING }, + ...obj.input && { input: import_smithy_client5.SENSITIVE_STRING }, + ...obj.output && { output: import_smithy_client5.SENSITIVE_STRING } + }), "StartSyncExecutionOutputFilterSensitiveLog"); + var StopExecutionInputFilterSensitiveLog = /* @__PURE__ */ __name((obj) => ({ + ...obj, + ...obj.error && { error: import_smithy_client5.SENSITIVE_STRING }, + ...obj.cause && { cause: import_smithy_client5.SENSITIVE_STRING } + }), "StopExecutionInputFilterSensitiveLog"); + var TestStateInputFilterSensitiveLog = /* @__PURE__ */ __name((obj) => ({ + ...obj, + ...obj.definition && { definition: import_smithy_client5.SENSITIVE_STRING }, + ...obj.input && { input: import_smithy_client5.SENSITIVE_STRING } + }), "TestStateInputFilterSensitiveLog"); + var InspectionDataFilterSensitiveLog = /* @__PURE__ */ __name((obj) => ({ + ...obj, + ...obj.input && { input: import_smithy_client5.SENSITIVE_STRING }, + ...obj.afterInputPath && { afterInputPath: import_smithy_client5.SENSITIVE_STRING }, + ...obj.afterParameters && { afterParameters: import_smithy_client5.SENSITIVE_STRING }, + ...obj.result && { result: import_smithy_client5.SENSITIVE_STRING }, + ...obj.afterResultSelector && { afterResultSelector: import_smithy_client5.SENSITIVE_STRING }, + ...obj.afterResultPath && { afterResultPath: import_smithy_client5.SENSITIVE_STRING } + }), "InspectionDataFilterSensitiveLog"); + var TestStateOutputFilterSensitiveLog = /* @__PURE__ */ __name((obj) => ({ + ...obj, + ...obj.output && { output: import_smithy_client5.SENSITIVE_STRING }, + ...obj.error && { error: import_smithy_client5.SENSITIVE_STRING }, + ...obj.cause && { cause: import_smithy_client5.SENSITIVE_STRING }, + ...obj.inspectionData && { inspectionData: import_smithy_client5.SENSITIVE_STRING } + }), "TestStateOutputFilterSensitiveLog"); + var UpdateStateMachineInputFilterSensitiveLog = /* @__PURE__ */ __name((obj) => ({ + ...obj, + ...obj.definition && { definition: import_smithy_client5.SENSITIVE_STRING }, + ...obj.versionDescription && { versionDescription: import_smithy_client5.SENSITIVE_STRING } + }), "UpdateStateMachineInputFilterSensitiveLog"); + var UpdateStateMachineAliasInputFilterSensitiveLog = /* @__PURE__ */ __name((obj) => ({ + ...obj, + ...obj.description && { description: import_smithy_client5.SENSITIVE_STRING } + }), "UpdateStateMachineAliasInputFilterSensitiveLog"); + var ValidateStateMachineDefinitionInputFilterSensitiveLog = /* @__PURE__ */ __name((obj) => ({ + ...obj, + ...obj.definition && { definition: import_smithy_client5.SENSITIVE_STRING } + }), "ValidateStateMachineDefinitionInputFilterSensitiveLog"); + var se_CreateActivityCommand = /* @__PURE__ */ __name(async (input, context) => { + const headers = sharedHeaders("CreateActivity"); + let body; + body = JSON.stringify((0, import_smithy_client5._json)(input)); + return buildHttpRpcRequest(context, headers, "/", void 0, body); + }, "se_CreateActivityCommand"); + var se_CreateStateMachineCommand = /* @__PURE__ */ __name(async (input, context) => { + const headers = sharedHeaders("CreateStateMachine"); + let body; + body = JSON.stringify((0, import_smithy_client5._json)(input)); + return buildHttpRpcRequest(context, headers, "/", void 0, body); + }, "se_CreateStateMachineCommand"); + var se_CreateStateMachineAliasCommand = /* @__PURE__ */ __name(async (input, context) => { + const headers = sharedHeaders("CreateStateMachineAlias"); + let body; + body = JSON.stringify((0, import_smithy_client5._json)(input)); + return buildHttpRpcRequest(context, headers, "/", void 0, body); + }, "se_CreateStateMachineAliasCommand"); + var se_DeleteActivityCommand = /* @__PURE__ */ __name(async (input, context) => { + const headers = sharedHeaders("DeleteActivity"); + let body; + body = JSON.stringify((0, import_smithy_client5._json)(input)); + return buildHttpRpcRequest(context, headers, "/", void 0, body); + }, "se_DeleteActivityCommand"); + var se_DeleteStateMachineCommand = /* @__PURE__ */ __name(async (input, context) => { + const headers = sharedHeaders("DeleteStateMachine"); + let body; + body = JSON.stringify((0, import_smithy_client5._json)(input)); + return buildHttpRpcRequest(context, headers, "/", void 0, body); + }, "se_DeleteStateMachineCommand"); + var se_DeleteStateMachineAliasCommand = /* @__PURE__ */ __name(async (input, context) => { + const headers = sharedHeaders("DeleteStateMachineAlias"); + let body; + body = JSON.stringify((0, import_smithy_client5._json)(input)); + return buildHttpRpcRequest(context, headers, "/", void 0, body); + }, "se_DeleteStateMachineAliasCommand"); + var se_DeleteStateMachineVersionCommand = /* @__PURE__ */ __name(async (input, context) => { + const headers = sharedHeaders("DeleteStateMachineVersion"); + let body; + body = JSON.stringify((0, import_smithy_client5._json)(input)); + return buildHttpRpcRequest(context, headers, "/", void 0, body); + }, "se_DeleteStateMachineVersionCommand"); + var se_DescribeActivityCommand = /* @__PURE__ */ __name(async (input, context) => { + const headers = sharedHeaders("DescribeActivity"); + let body; + body = JSON.stringify((0, import_smithy_client5._json)(input)); + return buildHttpRpcRequest(context, headers, "/", void 0, body); + }, "se_DescribeActivityCommand"); + var se_DescribeExecutionCommand = /* @__PURE__ */ __name(async (input, context) => { + const headers = sharedHeaders("DescribeExecution"); + let body; + body = JSON.stringify((0, import_smithy_client5._json)(input)); + return buildHttpRpcRequest(context, headers, "/", void 0, body); + }, "se_DescribeExecutionCommand"); + var se_DescribeMapRunCommand = /* @__PURE__ */ __name(async (input, context) => { + const headers = sharedHeaders("DescribeMapRun"); + let body; + body = JSON.stringify((0, import_smithy_client5._json)(input)); + return buildHttpRpcRequest(context, headers, "/", void 0, body); + }, "se_DescribeMapRunCommand"); + var se_DescribeStateMachineCommand = /* @__PURE__ */ __name(async (input, context) => { + const headers = sharedHeaders("DescribeStateMachine"); + let body; + body = JSON.stringify((0, import_smithy_client5._json)(input)); + return buildHttpRpcRequest(context, headers, "/", void 0, body); + }, "se_DescribeStateMachineCommand"); + var se_DescribeStateMachineAliasCommand = /* @__PURE__ */ __name(async (input, context) => { + const headers = sharedHeaders("DescribeStateMachineAlias"); + let body; + body = JSON.stringify((0, import_smithy_client5._json)(input)); + return buildHttpRpcRequest(context, headers, "/", void 0, body); + }, "se_DescribeStateMachineAliasCommand"); + var se_DescribeStateMachineForExecutionCommand = /* @__PURE__ */ __name(async (input, context) => { + const headers = sharedHeaders("DescribeStateMachineForExecution"); + let body; + body = JSON.stringify((0, import_smithy_client5._json)(input)); + return buildHttpRpcRequest(context, headers, "/", void 0, body); + }, "se_DescribeStateMachineForExecutionCommand"); + var se_GetActivityTaskCommand = /* @__PURE__ */ __name(async (input, context) => { + const headers = sharedHeaders("GetActivityTask"); + let body; + body = JSON.stringify((0, import_smithy_client5._json)(input)); + return buildHttpRpcRequest(context, headers, "/", void 0, body); + }, "se_GetActivityTaskCommand"); + var se_GetExecutionHistoryCommand = /* @__PURE__ */ __name(async (input, context) => { + const headers = sharedHeaders("GetExecutionHistory"); + let body; + body = JSON.stringify((0, import_smithy_client5._json)(input)); + return buildHttpRpcRequest(context, headers, "/", void 0, body); + }, "se_GetExecutionHistoryCommand"); + var se_ListActivitiesCommand = /* @__PURE__ */ __name(async (input, context) => { + const headers = sharedHeaders("ListActivities"); + let body; + body = JSON.stringify((0, import_smithy_client5._json)(input)); + return buildHttpRpcRequest(context, headers, "/", void 0, body); + }, "se_ListActivitiesCommand"); + var se_ListExecutionsCommand = /* @__PURE__ */ __name(async (input, context) => { + const headers = sharedHeaders("ListExecutions"); + let body; + body = JSON.stringify((0, import_smithy_client5._json)(input)); + return buildHttpRpcRequest(context, headers, "/", void 0, body); + }, "se_ListExecutionsCommand"); + var se_ListMapRunsCommand = /* @__PURE__ */ __name(async (input, context) => { + const headers = sharedHeaders("ListMapRuns"); + let body; + body = JSON.stringify((0, import_smithy_client5._json)(input)); + return buildHttpRpcRequest(context, headers, "/", void 0, body); + }, "se_ListMapRunsCommand"); + var se_ListStateMachineAliasesCommand = /* @__PURE__ */ __name(async (input, context) => { + const headers = sharedHeaders("ListStateMachineAliases"); + let body; + body = JSON.stringify((0, import_smithy_client5._json)(input)); + return buildHttpRpcRequest(context, headers, "/", void 0, body); + }, "se_ListStateMachineAliasesCommand"); + var se_ListStateMachinesCommand = /* @__PURE__ */ __name(async (input, context) => { + const headers = sharedHeaders("ListStateMachines"); + let body; + body = JSON.stringify((0, import_smithy_client5._json)(input)); + return buildHttpRpcRequest(context, headers, "/", void 0, body); + }, "se_ListStateMachinesCommand"); + var se_ListStateMachineVersionsCommand = /* @__PURE__ */ __name(async (input, context) => { + const headers = sharedHeaders("ListStateMachineVersions"); + let body; + body = JSON.stringify((0, import_smithy_client5._json)(input)); + return buildHttpRpcRequest(context, headers, "/", void 0, body); + }, "se_ListStateMachineVersionsCommand"); + var se_ListTagsForResourceCommand = /* @__PURE__ */ __name(async (input, context) => { + const headers = sharedHeaders("ListTagsForResource"); + let body; + body = JSON.stringify((0, import_smithy_client5._json)(input)); + return buildHttpRpcRequest(context, headers, "/", void 0, body); + }, "se_ListTagsForResourceCommand"); + var se_PublishStateMachineVersionCommand = /* @__PURE__ */ __name(async (input, context) => { + const headers = sharedHeaders("PublishStateMachineVersion"); + let body; + body = JSON.stringify((0, import_smithy_client5._json)(input)); + return buildHttpRpcRequest(context, headers, "/", void 0, body); + }, "se_PublishStateMachineVersionCommand"); + var se_RedriveExecutionCommand = /* @__PURE__ */ __name(async (input, context) => { + const headers = sharedHeaders("RedriveExecution"); + let body; + body = JSON.stringify(se_RedriveExecutionInput(input, context)); + return buildHttpRpcRequest(context, headers, "/", void 0, body); + }, "se_RedriveExecutionCommand"); + var se_SendTaskFailureCommand = /* @__PURE__ */ __name(async (input, context) => { + const headers = sharedHeaders("SendTaskFailure"); + let body; + body = JSON.stringify((0, import_smithy_client5._json)(input)); + return buildHttpRpcRequest(context, headers, "/", void 0, body); + }, "se_SendTaskFailureCommand"); + var se_SendTaskHeartbeatCommand = /* @__PURE__ */ __name(async (input, context) => { + const headers = sharedHeaders("SendTaskHeartbeat"); + let body; + body = JSON.stringify((0, import_smithy_client5._json)(input)); + return buildHttpRpcRequest(context, headers, "/", void 0, body); + }, "se_SendTaskHeartbeatCommand"); + var se_SendTaskSuccessCommand = /* @__PURE__ */ __name(async (input, context) => { + const headers = sharedHeaders("SendTaskSuccess"); + let body; + body = JSON.stringify((0, import_smithy_client5._json)(input)); + return buildHttpRpcRequest(context, headers, "/", void 0, body); + }, "se_SendTaskSuccessCommand"); + var se_StartExecutionCommand = /* @__PURE__ */ __name(async (input, context) => { + const headers = sharedHeaders("StartExecution"); + let body; + body = JSON.stringify((0, import_smithy_client5._json)(input)); + return buildHttpRpcRequest(context, headers, "/", void 0, body); + }, "se_StartExecutionCommand"); + var se_StartSyncExecutionCommand = /* @__PURE__ */ __name(async (input, context) => { + const headers = sharedHeaders("StartSyncExecution"); + let body; + body = JSON.stringify((0, import_smithy_client5._json)(input)); + let { hostname: resolvedHostname } = await context.endpoint(); + if (context.disableHostPrefix !== true) { + resolvedHostname = "sync-" + resolvedHostname; + if (!(0, import_protocol_http8.isValidHostname)(resolvedHostname)) { + throw new Error("ValidationError: prefixed hostname must be hostname compatible."); + } } - }; - exports2.SendTaskSuccessCommand = SendTaskSuccessCommand; - } -}); - -// ../../../node_modules/@aws-sdk/client-sfn/dist-cjs/commands/StartExecutionCommand.js -var require_StartExecutionCommand = __commonJS({ - "../../../node_modules/@aws-sdk/client-sfn/dist-cjs/commands/StartExecutionCommand.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.StartExecutionCommand = exports2.$Command = void 0; - var middleware_endpoint_1 = require_dist_cjs26(); - var middleware_serde_1 = require_dist_cjs25(); - var smithy_client_1 = require_dist_cjs34(); - Object.defineProperty(exports2, "$Command", { enumerable: true, get: function() { - return smithy_client_1.Command; - } }); - var types_1 = require_dist_cjs(); - var models_0_1 = require_models_03(); - var Aws_json1_0_1 = require_Aws_json1_0(); - var StartExecutionCommand = class _StartExecutionCommand extends smithy_client_1.Command { - static getEndpointParameterInstructions() { - return { - UseFIPS: { type: "builtInParams", name: "useFipsEndpoint" }, - Endpoint: { type: "builtInParams", name: "endpoint" }, - Region: { type: "builtInParams", name: "region" }, - UseDualStack: { type: "builtInParams", name: "useDualstackEndpoint" } - }; + return buildHttpRpcRequest(context, headers, "/", resolvedHostname, body); + }, "se_StartSyncExecutionCommand"); + var se_StopExecutionCommand = /* @__PURE__ */ __name(async (input, context) => { + const headers = sharedHeaders("StopExecution"); + let body; + body = JSON.stringify((0, import_smithy_client5._json)(input)); + return buildHttpRpcRequest(context, headers, "/", void 0, body); + }, "se_StopExecutionCommand"); + var se_TagResourceCommand = /* @__PURE__ */ __name(async (input, context) => { + const headers = sharedHeaders("TagResource"); + let body; + body = JSON.stringify((0, import_smithy_client5._json)(input)); + return buildHttpRpcRequest(context, headers, "/", void 0, body); + }, "se_TagResourceCommand"); + var se_TestStateCommand = /* @__PURE__ */ __name(async (input, context) => { + const headers = sharedHeaders("TestState"); + let body; + body = JSON.stringify((0, import_smithy_client5._json)(input)); + let { hostname: resolvedHostname } = await context.endpoint(); + if (context.disableHostPrefix !== true) { + resolvedHostname = "sync-" + resolvedHostname; + if (!(0, import_protocol_http8.isValidHostname)(resolvedHostname)) { + throw new Error("ValidationError: prefixed hostname must be hostname compatible."); + } } - constructor(input) { - super(); - this.input = input; + return buildHttpRpcRequest(context, headers, "/", resolvedHostname, body); + }, "se_TestStateCommand"); + var se_UntagResourceCommand = /* @__PURE__ */ __name(async (input, context) => { + const headers = sharedHeaders("UntagResource"); + let body; + body = JSON.stringify((0, import_smithy_client5._json)(input)); + return buildHttpRpcRequest(context, headers, "/", void 0, body); + }, "se_UntagResourceCommand"); + var se_UpdateMapRunCommand = /* @__PURE__ */ __name(async (input, context) => { + const headers = sharedHeaders("UpdateMapRun"); + let body; + body = JSON.stringify(se_UpdateMapRunInput(input, context)); + return buildHttpRpcRequest(context, headers, "/", void 0, body); + }, "se_UpdateMapRunCommand"); + var se_UpdateStateMachineCommand = /* @__PURE__ */ __name(async (input, context) => { + const headers = sharedHeaders("UpdateStateMachine"); + let body; + body = JSON.stringify((0, import_smithy_client5._json)(input)); + return buildHttpRpcRequest(context, headers, "/", void 0, body); + }, "se_UpdateStateMachineCommand"); + var se_UpdateStateMachineAliasCommand = /* @__PURE__ */ __name(async (input, context) => { + const headers = sharedHeaders("UpdateStateMachineAlias"); + let body; + body = JSON.stringify((0, import_smithy_client5._json)(input)); + return buildHttpRpcRequest(context, headers, "/", void 0, body); + }, "se_UpdateStateMachineAliasCommand"); + var se_ValidateStateMachineDefinitionCommand = /* @__PURE__ */ __name(async (input, context) => { + const headers = sharedHeaders("ValidateStateMachineDefinition"); + let body; + body = JSON.stringify((0, import_smithy_client5._json)(input)); + return buildHttpRpcRequest(context, headers, "/", void 0, body); + }, "se_ValidateStateMachineDefinitionCommand"); + var de_CreateActivityCommand = /* @__PURE__ */ __name(async (output, context) => { + if (output.statusCode >= 300) { + return de_CommandError(output, context); } - resolveMiddleware(clientStack, configuration, options) { - this.middlewareStack.use((0, middleware_serde_1.getSerdePlugin)(configuration, this.serialize, this.deserialize)); - this.middlewareStack.use((0, middleware_endpoint_1.getEndpointPlugin)(configuration, _StartExecutionCommand.getEndpointParameterInstructions())); - const stack = clientStack.concat(this.middlewareStack); - const { logger } = configuration; - const clientName = "SFNClient"; - const commandName = "StartExecutionCommand"; - const handlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: models_0_1.StartExecutionInputFilterSensitiveLog, - outputFilterSensitiveLog: (_) => _, - [types_1.SMITHY_CONTEXT_KEY]: { - service: "AWSStepFunctions", - operation: "StartExecution" - } - }; - const { requestHandler } = configuration; - return stack.resolve((request2) => requestHandler.handle(request2.request, options || {}), handlerExecutionContext); + const data = await (0, import_core22.parseJsonBody)(output.body, context); + let contents = {}; + contents = de_CreateActivityOutput(data, context); + const response = { + $metadata: deserializeMetadata(output), + ...contents + }; + return response; + }, "de_CreateActivityCommand"); + var de_CreateStateMachineCommand = /* @__PURE__ */ __name(async (output, context) => { + if (output.statusCode >= 300) { + return de_CommandError(output, context); } - serialize(input, context) { - return (0, Aws_json1_0_1.se_StartExecutionCommand)(input, context); + const data = await (0, import_core22.parseJsonBody)(output.body, context); + let contents = {}; + contents = de_CreateStateMachineOutput(data, context); + const response = { + $metadata: deserializeMetadata(output), + ...contents + }; + return response; + }, "de_CreateStateMachineCommand"); + var de_CreateStateMachineAliasCommand = /* @__PURE__ */ __name(async (output, context) => { + if (output.statusCode >= 300) { + return de_CommandError(output, context); } - deserialize(output, context) { - return (0, Aws_json1_0_1.de_StartExecutionCommand)(output, context); + const data = await (0, import_core22.parseJsonBody)(output.body, context); + let contents = {}; + contents = de_CreateStateMachineAliasOutput(data, context); + const response = { + $metadata: deserializeMetadata(output), + ...contents + }; + return response; + }, "de_CreateStateMachineAliasCommand"); + var de_DeleteActivityCommand = /* @__PURE__ */ __name(async (output, context) => { + if (output.statusCode >= 300) { + return de_CommandError(output, context); } - }; - exports2.StartExecutionCommand = StartExecutionCommand; - } -}); - -// ../../../node_modules/@aws-sdk/client-sfn/dist-cjs/commands/StartSyncExecutionCommand.js -var require_StartSyncExecutionCommand = __commonJS({ - "../../../node_modules/@aws-sdk/client-sfn/dist-cjs/commands/StartSyncExecutionCommand.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.StartSyncExecutionCommand = exports2.$Command = void 0; - var middleware_endpoint_1 = require_dist_cjs26(); - var middleware_serde_1 = require_dist_cjs25(); - var smithy_client_1 = require_dist_cjs34(); - Object.defineProperty(exports2, "$Command", { enumerable: true, get: function() { - return smithy_client_1.Command; - } }); - var types_1 = require_dist_cjs(); - var models_0_1 = require_models_03(); - var Aws_json1_0_1 = require_Aws_json1_0(); - var StartSyncExecutionCommand = class _StartSyncExecutionCommand extends smithy_client_1.Command { - static getEndpointParameterInstructions() { - return { - UseFIPS: { type: "builtInParams", name: "useFipsEndpoint" }, - Endpoint: { type: "builtInParams", name: "endpoint" }, - Region: { type: "builtInParams", name: "region" }, - UseDualStack: { type: "builtInParams", name: "useDualstackEndpoint" } - }; + const data = await (0, import_core22.parseJsonBody)(output.body, context); + let contents = {}; + contents = (0, import_smithy_client5._json)(data); + const response = { + $metadata: deserializeMetadata(output), + ...contents + }; + return response; + }, "de_DeleteActivityCommand"); + var de_DeleteStateMachineCommand = /* @__PURE__ */ __name(async (output, context) => { + if (output.statusCode >= 300) { + return de_CommandError(output, context); } - constructor(input) { - super(); - this.input = input; + const data = await (0, import_core22.parseJsonBody)(output.body, context); + let contents = {}; + contents = (0, import_smithy_client5._json)(data); + const response = { + $metadata: deserializeMetadata(output), + ...contents + }; + return response; + }, "de_DeleteStateMachineCommand"); + var de_DeleteStateMachineAliasCommand = /* @__PURE__ */ __name(async (output, context) => { + if (output.statusCode >= 300) { + return de_CommandError(output, context); } - resolveMiddleware(clientStack, configuration, options) { - this.middlewareStack.use((0, middleware_serde_1.getSerdePlugin)(configuration, this.serialize, this.deserialize)); - this.middlewareStack.use((0, middleware_endpoint_1.getEndpointPlugin)(configuration, _StartSyncExecutionCommand.getEndpointParameterInstructions())); - const stack = clientStack.concat(this.middlewareStack); - const { logger } = configuration; - const clientName = "SFNClient"; - const commandName = "StartSyncExecutionCommand"; - const handlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: models_0_1.StartSyncExecutionInputFilterSensitiveLog, - outputFilterSensitiveLog: models_0_1.StartSyncExecutionOutputFilterSensitiveLog, - [types_1.SMITHY_CONTEXT_KEY]: { - service: "AWSStepFunctions", - operation: "StartSyncExecution" - } - }; - const { requestHandler } = configuration; - return stack.resolve((request2) => requestHandler.handle(request2.request, options || {}), handlerExecutionContext); + const data = await (0, import_core22.parseJsonBody)(output.body, context); + let contents = {}; + contents = (0, import_smithy_client5._json)(data); + const response = { + $metadata: deserializeMetadata(output), + ...contents + }; + return response; + }, "de_DeleteStateMachineAliasCommand"); + var de_DeleteStateMachineVersionCommand = /* @__PURE__ */ __name(async (output, context) => { + if (output.statusCode >= 300) { + return de_CommandError(output, context); } - serialize(input, context) { - return (0, Aws_json1_0_1.se_StartSyncExecutionCommand)(input, context); + const data = await (0, import_core22.parseJsonBody)(output.body, context); + let contents = {}; + contents = (0, import_smithy_client5._json)(data); + const response = { + $metadata: deserializeMetadata(output), + ...contents + }; + return response; + }, "de_DeleteStateMachineVersionCommand"); + var de_DescribeActivityCommand = /* @__PURE__ */ __name(async (output, context) => { + if (output.statusCode >= 300) { + return de_CommandError(output, context); } - deserialize(output, context) { - return (0, Aws_json1_0_1.de_StartSyncExecutionCommand)(output, context); + const data = await (0, import_core22.parseJsonBody)(output.body, context); + let contents = {}; + contents = de_DescribeActivityOutput(data, context); + const response = { + $metadata: deserializeMetadata(output), + ...contents + }; + return response; + }, "de_DescribeActivityCommand"); + var de_DescribeExecutionCommand = /* @__PURE__ */ __name(async (output, context) => { + if (output.statusCode >= 300) { + return de_CommandError(output, context); } - }; - exports2.StartSyncExecutionCommand = StartSyncExecutionCommand; - } -}); - -// ../../../node_modules/@aws-sdk/client-sfn/dist-cjs/commands/StopExecutionCommand.js -var require_StopExecutionCommand = __commonJS({ - "../../../node_modules/@aws-sdk/client-sfn/dist-cjs/commands/StopExecutionCommand.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.StopExecutionCommand = exports2.$Command = void 0; - var middleware_endpoint_1 = require_dist_cjs26(); - var middleware_serde_1 = require_dist_cjs25(); - var smithy_client_1 = require_dist_cjs34(); - Object.defineProperty(exports2, "$Command", { enumerable: true, get: function() { - return smithy_client_1.Command; - } }); - var types_1 = require_dist_cjs(); - var models_0_1 = require_models_03(); - var Aws_json1_0_1 = require_Aws_json1_0(); - var StopExecutionCommand = class _StopExecutionCommand extends smithy_client_1.Command { - static getEndpointParameterInstructions() { - return { - UseFIPS: { type: "builtInParams", name: "useFipsEndpoint" }, - Endpoint: { type: "builtInParams", name: "endpoint" }, - Region: { type: "builtInParams", name: "region" }, - UseDualStack: { type: "builtInParams", name: "useDualstackEndpoint" } - }; + const data = await (0, import_core22.parseJsonBody)(output.body, context); + let contents = {}; + contents = de_DescribeExecutionOutput(data, context); + const response = { + $metadata: deserializeMetadata(output), + ...contents + }; + return response; + }, "de_DescribeExecutionCommand"); + var de_DescribeMapRunCommand = /* @__PURE__ */ __name(async (output, context) => { + if (output.statusCode >= 300) { + return de_CommandError(output, context); } - constructor(input) { - super(); - this.input = input; + const data = await (0, import_core22.parseJsonBody)(output.body, context); + let contents = {}; + contents = de_DescribeMapRunOutput(data, context); + const response = { + $metadata: deserializeMetadata(output), + ...contents + }; + return response; + }, "de_DescribeMapRunCommand"); + var de_DescribeStateMachineCommand = /* @__PURE__ */ __name(async (output, context) => { + if (output.statusCode >= 300) { + return de_CommandError(output, context); } - resolveMiddleware(clientStack, configuration, options) { - this.middlewareStack.use((0, middleware_serde_1.getSerdePlugin)(configuration, this.serialize, this.deserialize)); - this.middlewareStack.use((0, middleware_endpoint_1.getEndpointPlugin)(configuration, _StopExecutionCommand.getEndpointParameterInstructions())); - const stack = clientStack.concat(this.middlewareStack); - const { logger } = configuration; - const clientName = "SFNClient"; - const commandName = "StopExecutionCommand"; - const handlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: models_0_1.StopExecutionInputFilterSensitiveLog, - outputFilterSensitiveLog: (_) => _, - [types_1.SMITHY_CONTEXT_KEY]: { - service: "AWSStepFunctions", - operation: "StopExecution" - } - }; - const { requestHandler } = configuration; - return stack.resolve((request2) => requestHandler.handle(request2.request, options || {}), handlerExecutionContext); + const data = await (0, import_core22.parseJsonBody)(output.body, context); + let contents = {}; + contents = de_DescribeStateMachineOutput(data, context); + const response = { + $metadata: deserializeMetadata(output), + ...contents + }; + return response; + }, "de_DescribeStateMachineCommand"); + var de_DescribeStateMachineAliasCommand = /* @__PURE__ */ __name(async (output, context) => { + if (output.statusCode >= 300) { + return de_CommandError(output, context); } - serialize(input, context) { - return (0, Aws_json1_0_1.se_StopExecutionCommand)(input, context); + const data = await (0, import_core22.parseJsonBody)(output.body, context); + let contents = {}; + contents = de_DescribeStateMachineAliasOutput(data, context); + const response = { + $metadata: deserializeMetadata(output), + ...contents + }; + return response; + }, "de_DescribeStateMachineAliasCommand"); + var de_DescribeStateMachineForExecutionCommand = /* @__PURE__ */ __name(async (output, context) => { + if (output.statusCode >= 300) { + return de_CommandError(output, context); } - deserialize(output, context) { - return (0, Aws_json1_0_1.de_StopExecutionCommand)(output, context); + const data = await (0, import_core22.parseJsonBody)(output.body, context); + let contents = {}; + contents = de_DescribeStateMachineForExecutionOutput(data, context); + const response = { + $metadata: deserializeMetadata(output), + ...contents + }; + return response; + }, "de_DescribeStateMachineForExecutionCommand"); + var de_GetActivityTaskCommand = /* @__PURE__ */ __name(async (output, context) => { + if (output.statusCode >= 300) { + return de_CommandError(output, context); } - }; - exports2.StopExecutionCommand = StopExecutionCommand; - } -}); - -// ../../../node_modules/@aws-sdk/client-sfn/dist-cjs/commands/TagResourceCommand.js -var require_TagResourceCommand = __commonJS({ - "../../../node_modules/@aws-sdk/client-sfn/dist-cjs/commands/TagResourceCommand.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.TagResourceCommand = exports2.$Command = void 0; - var middleware_endpoint_1 = require_dist_cjs26(); - var middleware_serde_1 = require_dist_cjs25(); - var smithy_client_1 = require_dist_cjs34(); - Object.defineProperty(exports2, "$Command", { enumerable: true, get: function() { - return smithy_client_1.Command; - } }); - var types_1 = require_dist_cjs(); - var Aws_json1_0_1 = require_Aws_json1_0(); - var TagResourceCommand = class _TagResourceCommand extends smithy_client_1.Command { - static getEndpointParameterInstructions() { - return { - UseFIPS: { type: "builtInParams", name: "useFipsEndpoint" }, - Endpoint: { type: "builtInParams", name: "endpoint" }, - Region: { type: "builtInParams", name: "region" }, - UseDualStack: { type: "builtInParams", name: "useDualstackEndpoint" } - }; + const data = await (0, import_core22.parseJsonBody)(output.body, context); + let contents = {}; + contents = (0, import_smithy_client5._json)(data); + const response = { + $metadata: deserializeMetadata(output), + ...contents + }; + return response; + }, "de_GetActivityTaskCommand"); + var de_GetExecutionHistoryCommand = /* @__PURE__ */ __name(async (output, context) => { + if (output.statusCode >= 300) { + return de_CommandError(output, context); } - constructor(input) { - super(); - this.input = input; + const data = await (0, import_core22.parseJsonBody)(output.body, context); + let contents = {}; + contents = de_GetExecutionHistoryOutput(data, context); + const response = { + $metadata: deserializeMetadata(output), + ...contents + }; + return response; + }, "de_GetExecutionHistoryCommand"); + var de_ListActivitiesCommand = /* @__PURE__ */ __name(async (output, context) => { + if (output.statusCode >= 300) { + return de_CommandError(output, context); } - resolveMiddleware(clientStack, configuration, options) { - this.middlewareStack.use((0, middleware_serde_1.getSerdePlugin)(configuration, this.serialize, this.deserialize)); - this.middlewareStack.use((0, middleware_endpoint_1.getEndpointPlugin)(configuration, _TagResourceCommand.getEndpointParameterInstructions())); - const stack = clientStack.concat(this.middlewareStack); - const { logger } = configuration; - const clientName = "SFNClient"; - const commandName = "TagResourceCommand"; - const handlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: (_) => _, - outputFilterSensitiveLog: (_) => _, - [types_1.SMITHY_CONTEXT_KEY]: { - service: "AWSStepFunctions", - operation: "TagResource" - } - }; - const { requestHandler } = configuration; - return stack.resolve((request2) => requestHandler.handle(request2.request, options || {}), handlerExecutionContext); + const data = await (0, import_core22.parseJsonBody)(output.body, context); + let contents = {}; + contents = de_ListActivitiesOutput(data, context); + const response = { + $metadata: deserializeMetadata(output), + ...contents + }; + return response; + }, "de_ListActivitiesCommand"); + var de_ListExecutionsCommand = /* @__PURE__ */ __name(async (output, context) => { + if (output.statusCode >= 300) { + return de_CommandError(output, context); } - serialize(input, context) { - return (0, Aws_json1_0_1.se_TagResourceCommand)(input, context); + const data = await (0, import_core22.parseJsonBody)(output.body, context); + let contents = {}; + contents = de_ListExecutionsOutput(data, context); + const response = { + $metadata: deserializeMetadata(output), + ...contents + }; + return response; + }, "de_ListExecutionsCommand"); + var de_ListMapRunsCommand = /* @__PURE__ */ __name(async (output, context) => { + if (output.statusCode >= 300) { + return de_CommandError(output, context); } - deserialize(output, context) { - return (0, Aws_json1_0_1.de_TagResourceCommand)(output, context); + const data = await (0, import_core22.parseJsonBody)(output.body, context); + let contents = {}; + contents = de_ListMapRunsOutput(data, context); + const response = { + $metadata: deserializeMetadata(output), + ...contents + }; + return response; + }, "de_ListMapRunsCommand"); + var de_ListStateMachineAliasesCommand = /* @__PURE__ */ __name(async (output, context) => { + if (output.statusCode >= 300) { + return de_CommandError(output, context); } - }; - exports2.TagResourceCommand = TagResourceCommand; - } -}); - -// ../../../node_modules/@aws-sdk/client-sfn/dist-cjs/commands/UntagResourceCommand.js -var require_UntagResourceCommand = __commonJS({ - "../../../node_modules/@aws-sdk/client-sfn/dist-cjs/commands/UntagResourceCommand.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.UntagResourceCommand = exports2.$Command = void 0; - var middleware_endpoint_1 = require_dist_cjs26(); - var middleware_serde_1 = require_dist_cjs25(); - var smithy_client_1 = require_dist_cjs34(); - Object.defineProperty(exports2, "$Command", { enumerable: true, get: function() { - return smithy_client_1.Command; - } }); - var types_1 = require_dist_cjs(); - var Aws_json1_0_1 = require_Aws_json1_0(); - var UntagResourceCommand = class _UntagResourceCommand extends smithy_client_1.Command { - static getEndpointParameterInstructions() { - return { - UseFIPS: { type: "builtInParams", name: "useFipsEndpoint" }, - Endpoint: { type: "builtInParams", name: "endpoint" }, - Region: { type: "builtInParams", name: "region" }, - UseDualStack: { type: "builtInParams", name: "useDualstackEndpoint" } - }; + const data = await (0, import_core22.parseJsonBody)(output.body, context); + let contents = {}; + contents = de_ListStateMachineAliasesOutput(data, context); + const response = { + $metadata: deserializeMetadata(output), + ...contents + }; + return response; + }, "de_ListStateMachineAliasesCommand"); + var de_ListStateMachinesCommand = /* @__PURE__ */ __name(async (output, context) => { + if (output.statusCode >= 300) { + return de_CommandError(output, context); } - constructor(input) { - super(); - this.input = input; + const data = await (0, import_core22.parseJsonBody)(output.body, context); + let contents = {}; + contents = de_ListStateMachinesOutput(data, context); + const response = { + $metadata: deserializeMetadata(output), + ...contents + }; + return response; + }, "de_ListStateMachinesCommand"); + var de_ListStateMachineVersionsCommand = /* @__PURE__ */ __name(async (output, context) => { + if (output.statusCode >= 300) { + return de_CommandError(output, context); } - resolveMiddleware(clientStack, configuration, options) { - this.middlewareStack.use((0, middleware_serde_1.getSerdePlugin)(configuration, this.serialize, this.deserialize)); - this.middlewareStack.use((0, middleware_endpoint_1.getEndpointPlugin)(configuration, _UntagResourceCommand.getEndpointParameterInstructions())); - const stack = clientStack.concat(this.middlewareStack); - const { logger } = configuration; - const clientName = "SFNClient"; - const commandName = "UntagResourceCommand"; - const handlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: (_) => _, - outputFilterSensitiveLog: (_) => _, - [types_1.SMITHY_CONTEXT_KEY]: { - service: "AWSStepFunctions", - operation: "UntagResource" - } - }; - const { requestHandler } = configuration; - return stack.resolve((request2) => requestHandler.handle(request2.request, options || {}), handlerExecutionContext); + const data = await (0, import_core22.parseJsonBody)(output.body, context); + let contents = {}; + contents = de_ListStateMachineVersionsOutput(data, context); + const response = { + $metadata: deserializeMetadata(output), + ...contents + }; + return response; + }, "de_ListStateMachineVersionsCommand"); + var de_ListTagsForResourceCommand = /* @__PURE__ */ __name(async (output, context) => { + if (output.statusCode >= 300) { + return de_CommandError(output, context); } - serialize(input, context) { - return (0, Aws_json1_0_1.se_UntagResourceCommand)(input, context); + const data = await (0, import_core22.parseJsonBody)(output.body, context); + let contents = {}; + contents = (0, import_smithy_client5._json)(data); + const response = { + $metadata: deserializeMetadata(output), + ...contents + }; + return response; + }, "de_ListTagsForResourceCommand"); + var de_PublishStateMachineVersionCommand = /* @__PURE__ */ __name(async (output, context) => { + if (output.statusCode >= 300) { + return de_CommandError(output, context); } - deserialize(output, context) { - return (0, Aws_json1_0_1.de_UntagResourceCommand)(output, context); + const data = await (0, import_core22.parseJsonBody)(output.body, context); + let contents = {}; + contents = de_PublishStateMachineVersionOutput(data, context); + const response = { + $metadata: deserializeMetadata(output), + ...contents + }; + return response; + }, "de_PublishStateMachineVersionCommand"); + var de_RedriveExecutionCommand = /* @__PURE__ */ __name(async (output, context) => { + if (output.statusCode >= 300) { + return de_CommandError(output, context); } - }; - exports2.UntagResourceCommand = UntagResourceCommand; - } -}); - -// ../../../node_modules/@aws-sdk/client-sfn/dist-cjs/commands/UpdateMapRunCommand.js -var require_UpdateMapRunCommand = __commonJS({ - "../../../node_modules/@aws-sdk/client-sfn/dist-cjs/commands/UpdateMapRunCommand.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.UpdateMapRunCommand = exports2.$Command = void 0; - var middleware_endpoint_1 = require_dist_cjs26(); - var middleware_serde_1 = require_dist_cjs25(); - var smithy_client_1 = require_dist_cjs34(); - Object.defineProperty(exports2, "$Command", { enumerable: true, get: function() { - return smithy_client_1.Command; - } }); - var types_1 = require_dist_cjs(); - var Aws_json1_0_1 = require_Aws_json1_0(); - var UpdateMapRunCommand = class _UpdateMapRunCommand extends smithy_client_1.Command { - static getEndpointParameterInstructions() { - return { - UseFIPS: { type: "builtInParams", name: "useFipsEndpoint" }, - Endpoint: { type: "builtInParams", name: "endpoint" }, - Region: { type: "builtInParams", name: "region" }, - UseDualStack: { type: "builtInParams", name: "useDualstackEndpoint" } - }; + const data = await (0, import_core22.parseJsonBody)(output.body, context); + let contents = {}; + contents = de_RedriveExecutionOutput(data, context); + const response = { + $metadata: deserializeMetadata(output), + ...contents + }; + return response; + }, "de_RedriveExecutionCommand"); + var de_SendTaskFailureCommand = /* @__PURE__ */ __name(async (output, context) => { + if (output.statusCode >= 300) { + return de_CommandError(output, context); } - constructor(input) { - super(); - this.input = input; + const data = await (0, import_core22.parseJsonBody)(output.body, context); + let contents = {}; + contents = (0, import_smithy_client5._json)(data); + const response = { + $metadata: deserializeMetadata(output), + ...contents + }; + return response; + }, "de_SendTaskFailureCommand"); + var de_SendTaskHeartbeatCommand = /* @__PURE__ */ __name(async (output, context) => { + if (output.statusCode >= 300) { + return de_CommandError(output, context); } - resolveMiddleware(clientStack, configuration, options) { - this.middlewareStack.use((0, middleware_serde_1.getSerdePlugin)(configuration, this.serialize, this.deserialize)); - this.middlewareStack.use((0, middleware_endpoint_1.getEndpointPlugin)(configuration, _UpdateMapRunCommand.getEndpointParameterInstructions())); - const stack = clientStack.concat(this.middlewareStack); - const { logger } = configuration; - const clientName = "SFNClient"; - const commandName = "UpdateMapRunCommand"; - const handlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: (_) => _, - outputFilterSensitiveLog: (_) => _, - [types_1.SMITHY_CONTEXT_KEY]: { - service: "AWSStepFunctions", - operation: "UpdateMapRun" - } - }; - const { requestHandler } = configuration; - return stack.resolve((request2) => requestHandler.handle(request2.request, options || {}), handlerExecutionContext); + const data = await (0, import_core22.parseJsonBody)(output.body, context); + let contents = {}; + contents = (0, import_smithy_client5._json)(data); + const response = { + $metadata: deserializeMetadata(output), + ...contents + }; + return response; + }, "de_SendTaskHeartbeatCommand"); + var de_SendTaskSuccessCommand = /* @__PURE__ */ __name(async (output, context) => { + if (output.statusCode >= 300) { + return de_CommandError(output, context); } - serialize(input, context) { - return (0, Aws_json1_0_1.se_UpdateMapRunCommand)(input, context); + const data = await (0, import_core22.parseJsonBody)(output.body, context); + let contents = {}; + contents = (0, import_smithy_client5._json)(data); + const response = { + $metadata: deserializeMetadata(output), + ...contents + }; + return response; + }, "de_SendTaskSuccessCommand"); + var de_StartExecutionCommand = /* @__PURE__ */ __name(async (output, context) => { + if (output.statusCode >= 300) { + return de_CommandError(output, context); } - deserialize(output, context) { - return (0, Aws_json1_0_1.de_UpdateMapRunCommand)(output, context); + const data = await (0, import_core22.parseJsonBody)(output.body, context); + let contents = {}; + contents = de_StartExecutionOutput(data, context); + const response = { + $metadata: deserializeMetadata(output), + ...contents + }; + return response; + }, "de_StartExecutionCommand"); + var de_StartSyncExecutionCommand = /* @__PURE__ */ __name(async (output, context) => { + if (output.statusCode >= 300) { + return de_CommandError(output, context); } - }; - exports2.UpdateMapRunCommand = UpdateMapRunCommand; - } -}); - -// ../../../node_modules/@aws-sdk/client-sfn/dist-cjs/commands/UpdateStateMachineAliasCommand.js -var require_UpdateStateMachineAliasCommand = __commonJS({ - "../../../node_modules/@aws-sdk/client-sfn/dist-cjs/commands/UpdateStateMachineAliasCommand.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.UpdateStateMachineAliasCommand = exports2.$Command = void 0; - var middleware_endpoint_1 = require_dist_cjs26(); - var middleware_serde_1 = require_dist_cjs25(); - var smithy_client_1 = require_dist_cjs34(); - Object.defineProperty(exports2, "$Command", { enumerable: true, get: function() { - return smithy_client_1.Command; - } }); - var types_1 = require_dist_cjs(); - var models_0_1 = require_models_03(); - var Aws_json1_0_1 = require_Aws_json1_0(); - var UpdateStateMachineAliasCommand = class _UpdateStateMachineAliasCommand extends smithy_client_1.Command { - static getEndpointParameterInstructions() { - return { - UseFIPS: { type: "builtInParams", name: "useFipsEndpoint" }, - Endpoint: { type: "builtInParams", name: "endpoint" }, - Region: { type: "builtInParams", name: "region" }, - UseDualStack: { type: "builtInParams", name: "useDualstackEndpoint" } - }; + const data = await (0, import_core22.parseJsonBody)(output.body, context); + let contents = {}; + contents = de_StartSyncExecutionOutput(data, context); + const response = { + $metadata: deserializeMetadata(output), + ...contents + }; + return response; + }, "de_StartSyncExecutionCommand"); + var de_StopExecutionCommand = /* @__PURE__ */ __name(async (output, context) => { + if (output.statusCode >= 300) { + return de_CommandError(output, context); } - constructor(input) { - super(); - this.input = input; + const data = await (0, import_core22.parseJsonBody)(output.body, context); + let contents = {}; + contents = de_StopExecutionOutput(data, context); + const response = { + $metadata: deserializeMetadata(output), + ...contents + }; + return response; + }, "de_StopExecutionCommand"); + var de_TagResourceCommand = /* @__PURE__ */ __name(async (output, context) => { + if (output.statusCode >= 300) { + return de_CommandError(output, context); } - resolveMiddleware(clientStack, configuration, options) { - this.middlewareStack.use((0, middleware_serde_1.getSerdePlugin)(configuration, this.serialize, this.deserialize)); - this.middlewareStack.use((0, middleware_endpoint_1.getEndpointPlugin)(configuration, _UpdateStateMachineAliasCommand.getEndpointParameterInstructions())); - const stack = clientStack.concat(this.middlewareStack); - const { logger } = configuration; - const clientName = "SFNClient"; - const commandName = "UpdateStateMachineAliasCommand"; - const handlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: models_0_1.UpdateStateMachineAliasInputFilterSensitiveLog, - outputFilterSensitiveLog: (_) => _, - [types_1.SMITHY_CONTEXT_KEY]: { - service: "AWSStepFunctions", - operation: "UpdateStateMachineAlias" - } - }; - const { requestHandler } = configuration; - return stack.resolve((request2) => requestHandler.handle(request2.request, options || {}), handlerExecutionContext); + const data = await (0, import_core22.parseJsonBody)(output.body, context); + let contents = {}; + contents = (0, import_smithy_client5._json)(data); + const response = { + $metadata: deserializeMetadata(output), + ...contents + }; + return response; + }, "de_TagResourceCommand"); + var de_TestStateCommand = /* @__PURE__ */ __name(async (output, context) => { + if (output.statusCode >= 300) { + return de_CommandError(output, context); } - serialize(input, context) { - return (0, Aws_json1_0_1.se_UpdateStateMachineAliasCommand)(input, context); + const data = await (0, import_core22.parseJsonBody)(output.body, context); + let contents = {}; + contents = (0, import_smithy_client5._json)(data); + const response = { + $metadata: deserializeMetadata(output), + ...contents + }; + return response; + }, "de_TestStateCommand"); + var de_UntagResourceCommand = /* @__PURE__ */ __name(async (output, context) => { + if (output.statusCode >= 300) { + return de_CommandError(output, context); } - deserialize(output, context) { - return (0, Aws_json1_0_1.de_UpdateStateMachineAliasCommand)(output, context); + const data = await (0, import_core22.parseJsonBody)(output.body, context); + let contents = {}; + contents = (0, import_smithy_client5._json)(data); + const response = { + $metadata: deserializeMetadata(output), + ...contents + }; + return response; + }, "de_UntagResourceCommand"); + var de_UpdateMapRunCommand = /* @__PURE__ */ __name(async (output, context) => { + if (output.statusCode >= 300) { + return de_CommandError(output, context); } - }; - exports2.UpdateStateMachineAliasCommand = UpdateStateMachineAliasCommand; - } -}); - -// ../../../node_modules/@aws-sdk/client-sfn/dist-cjs/commands/UpdateStateMachineCommand.js -var require_UpdateStateMachineCommand = __commonJS({ - "../../../node_modules/@aws-sdk/client-sfn/dist-cjs/commands/UpdateStateMachineCommand.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.UpdateStateMachineCommand = exports2.$Command = void 0; - var middleware_endpoint_1 = require_dist_cjs26(); - var middleware_serde_1 = require_dist_cjs25(); - var smithy_client_1 = require_dist_cjs34(); - Object.defineProperty(exports2, "$Command", { enumerable: true, get: function() { - return smithy_client_1.Command; - } }); - var types_1 = require_dist_cjs(); - var models_0_1 = require_models_03(); - var Aws_json1_0_1 = require_Aws_json1_0(); - var UpdateStateMachineCommand = class _UpdateStateMachineCommand extends smithy_client_1.Command { - static getEndpointParameterInstructions() { - return { - UseFIPS: { type: "builtInParams", name: "useFipsEndpoint" }, - Endpoint: { type: "builtInParams", name: "endpoint" }, - Region: { type: "builtInParams", name: "region" }, - UseDualStack: { type: "builtInParams", name: "useDualstackEndpoint" } - }; + const data = await (0, import_core22.parseJsonBody)(output.body, context); + let contents = {}; + contents = (0, import_smithy_client5._json)(data); + const response = { + $metadata: deserializeMetadata(output), + ...contents + }; + return response; + }, "de_UpdateMapRunCommand"); + var de_UpdateStateMachineCommand = /* @__PURE__ */ __name(async (output, context) => { + if (output.statusCode >= 300) { + return de_CommandError(output, context); } - constructor(input) { - super(); - this.input = input; + const data = await (0, import_core22.parseJsonBody)(output.body, context); + let contents = {}; + contents = de_UpdateStateMachineOutput(data, context); + const response = { + $metadata: deserializeMetadata(output), + ...contents + }; + return response; + }, "de_UpdateStateMachineCommand"); + var de_UpdateStateMachineAliasCommand = /* @__PURE__ */ __name(async (output, context) => { + if (output.statusCode >= 300) { + return de_CommandError(output, context); } - resolveMiddleware(clientStack, configuration, options) { - this.middlewareStack.use((0, middleware_serde_1.getSerdePlugin)(configuration, this.serialize, this.deserialize)); - this.middlewareStack.use((0, middleware_endpoint_1.getEndpointPlugin)(configuration, _UpdateStateMachineCommand.getEndpointParameterInstructions())); - const stack = clientStack.concat(this.middlewareStack); - const { logger } = configuration; - const clientName = "SFNClient"; - const commandName = "UpdateStateMachineCommand"; - const handlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: models_0_1.UpdateStateMachineInputFilterSensitiveLog, - outputFilterSensitiveLog: (_) => _, - [types_1.SMITHY_CONTEXT_KEY]: { - service: "AWSStepFunctions", - operation: "UpdateStateMachine" - } - }; - const { requestHandler } = configuration; - return stack.resolve((request2) => requestHandler.handle(request2.request, options || {}), handlerExecutionContext); + const data = await (0, import_core22.parseJsonBody)(output.body, context); + let contents = {}; + contents = de_UpdateStateMachineAliasOutput(data, context); + const response = { + $metadata: deserializeMetadata(output), + ...contents + }; + return response; + }, "de_UpdateStateMachineAliasCommand"); + var de_ValidateStateMachineDefinitionCommand = /* @__PURE__ */ __name(async (output, context) => { + if (output.statusCode >= 300) { + return de_CommandError(output, context); + } + const data = await (0, import_core22.parseJsonBody)(output.body, context); + let contents = {}; + contents = (0, import_smithy_client5._json)(data); + const response = { + $metadata: deserializeMetadata(output), + ...contents + }; + return response; + }, "de_ValidateStateMachineDefinitionCommand"); + var de_CommandError = /* @__PURE__ */ __name(async (output, context) => { + const parsedOutput = { + ...output, + body: await (0, import_core22.parseJsonErrorBody)(output.body, context) + }; + const errorCode = (0, import_core22.loadRestJsonErrorCode)(output, parsedOutput.body); + switch (errorCode) { + case "ActivityAlreadyExists": + case "com.amazonaws.sfn#ActivityAlreadyExists": + throw await de_ActivityAlreadyExistsRes(parsedOutput, context); + case "ActivityLimitExceeded": + case "com.amazonaws.sfn#ActivityLimitExceeded": + throw await de_ActivityLimitExceededRes(parsedOutput, context); + case "InvalidEncryptionConfiguration": + case "com.amazonaws.sfn#InvalidEncryptionConfiguration": + throw await de_InvalidEncryptionConfigurationRes(parsedOutput, context); + case "InvalidName": + case "com.amazonaws.sfn#InvalidName": + throw await de_InvalidNameRes(parsedOutput, context); + case "KmsAccessDeniedException": + case "com.amazonaws.sfn#KmsAccessDeniedException": + throw await de_KmsAccessDeniedExceptionRes(parsedOutput, context); + case "KmsThrottlingException": + case "com.amazonaws.sfn#KmsThrottlingException": + throw await de_KmsThrottlingExceptionRes(parsedOutput, context); + case "TooManyTags": + case "com.amazonaws.sfn#TooManyTags": + throw await de_TooManyTagsRes(parsedOutput, context); + case "ConflictException": + case "com.amazonaws.sfn#ConflictException": + throw await de_ConflictExceptionRes(parsedOutput, context); + case "InvalidArn": + case "com.amazonaws.sfn#InvalidArn": + throw await de_InvalidArnRes(parsedOutput, context); + case "InvalidDefinition": + case "com.amazonaws.sfn#InvalidDefinition": + throw await de_InvalidDefinitionRes(parsedOutput, context); + case "InvalidLoggingConfiguration": + case "com.amazonaws.sfn#InvalidLoggingConfiguration": + throw await de_InvalidLoggingConfigurationRes(parsedOutput, context); + case "InvalidTracingConfiguration": + case "com.amazonaws.sfn#InvalidTracingConfiguration": + throw await de_InvalidTracingConfigurationRes(parsedOutput, context); + case "StateMachineAlreadyExists": + case "com.amazonaws.sfn#StateMachineAlreadyExists": + throw await de_StateMachineAlreadyExistsRes(parsedOutput, context); + case "StateMachineDeleting": + case "com.amazonaws.sfn#StateMachineDeleting": + throw await de_StateMachineDeletingRes(parsedOutput, context); + case "StateMachineLimitExceeded": + case "com.amazonaws.sfn#StateMachineLimitExceeded": + throw await de_StateMachineLimitExceededRes(parsedOutput, context); + case "StateMachineTypeNotSupported": + case "com.amazonaws.sfn#StateMachineTypeNotSupported": + throw await de_StateMachineTypeNotSupportedRes(parsedOutput, context); + case "ValidationException": + case "com.amazonaws.sfn#ValidationException": + throw await de_ValidationExceptionRes(parsedOutput, context); + case "ResourceNotFound": + case "com.amazonaws.sfn#ResourceNotFound": + throw await de_ResourceNotFoundRes(parsedOutput, context); + case "ServiceQuotaExceededException": + case "com.amazonaws.sfn#ServiceQuotaExceededException": + throw await de_ServiceQuotaExceededExceptionRes(parsedOutput, context); + case "ActivityDoesNotExist": + case "com.amazonaws.sfn#ActivityDoesNotExist": + throw await de_ActivityDoesNotExistRes(parsedOutput, context); + case "ExecutionDoesNotExist": + case "com.amazonaws.sfn#ExecutionDoesNotExist": + throw await de_ExecutionDoesNotExistRes(parsedOutput, context); + case "KmsInvalidStateException": + case "com.amazonaws.sfn#KmsInvalidStateException": + throw await de_KmsInvalidStateExceptionRes(parsedOutput, context); + case "StateMachineDoesNotExist": + case "com.amazonaws.sfn#StateMachineDoesNotExist": + throw await de_StateMachineDoesNotExistRes(parsedOutput, context); + case "ActivityWorkerLimitExceeded": + case "com.amazonaws.sfn#ActivityWorkerLimitExceeded": + throw await de_ActivityWorkerLimitExceededRes(parsedOutput, context); + case "InvalidToken": + case "com.amazonaws.sfn#InvalidToken": + throw await de_InvalidTokenRes(parsedOutput, context); + case "ExecutionLimitExceeded": + case "com.amazonaws.sfn#ExecutionLimitExceeded": + throw await de_ExecutionLimitExceededRes(parsedOutput, context); + case "ExecutionNotRedrivable": + case "com.amazonaws.sfn#ExecutionNotRedrivable": + throw await de_ExecutionNotRedrivableRes(parsedOutput, context); + case "TaskDoesNotExist": + case "com.amazonaws.sfn#TaskDoesNotExist": + throw await de_TaskDoesNotExistRes(parsedOutput, context); + case "TaskTimedOut": + case "com.amazonaws.sfn#TaskTimedOut": + throw await de_TaskTimedOutRes(parsedOutput, context); + case "InvalidOutput": + case "com.amazonaws.sfn#InvalidOutput": + throw await de_InvalidOutputRes(parsedOutput, context); + case "ExecutionAlreadyExists": + case "com.amazonaws.sfn#ExecutionAlreadyExists": + throw await de_ExecutionAlreadyExistsRes(parsedOutput, context); + case "InvalidExecutionInput": + case "com.amazonaws.sfn#InvalidExecutionInput": + throw await de_InvalidExecutionInputRes(parsedOutput, context); + case "MissingRequiredParameter": + case "com.amazonaws.sfn#MissingRequiredParameter": + throw await de_MissingRequiredParameterRes(parsedOutput, context); + default: + const parsedBody = parsedOutput.body; + return throwDefaultError({ + output, + parsedBody, + errorCode + }); } - serialize(input, context) { - return (0, Aws_json1_0_1.se_UpdateStateMachineCommand)(input, context); + }, "de_CommandError"); + var de_ActivityAlreadyExistsRes = /* @__PURE__ */ __name(async (parsedOutput, context) => { + const body = parsedOutput.body; + const deserialized = (0, import_smithy_client5._json)(body); + const exception = new ActivityAlreadyExists({ + $metadata: deserializeMetadata(parsedOutput), + ...deserialized + }); + return (0, import_smithy_client5.decorateServiceException)(exception, body); + }, "de_ActivityAlreadyExistsRes"); + var de_ActivityDoesNotExistRes = /* @__PURE__ */ __name(async (parsedOutput, context) => { + const body = parsedOutput.body; + const deserialized = (0, import_smithy_client5._json)(body); + const exception = new ActivityDoesNotExist({ + $metadata: deserializeMetadata(parsedOutput), + ...deserialized + }); + return (0, import_smithy_client5.decorateServiceException)(exception, body); + }, "de_ActivityDoesNotExistRes"); + var de_ActivityLimitExceededRes = /* @__PURE__ */ __name(async (parsedOutput, context) => { + const body = parsedOutput.body; + const deserialized = (0, import_smithy_client5._json)(body); + const exception = new ActivityLimitExceeded({ + $metadata: deserializeMetadata(parsedOutput), + ...deserialized + }); + return (0, import_smithy_client5.decorateServiceException)(exception, body); + }, "de_ActivityLimitExceededRes"); + var de_ActivityWorkerLimitExceededRes = /* @__PURE__ */ __name(async (parsedOutput, context) => { + const body = parsedOutput.body; + const deserialized = (0, import_smithy_client5._json)(body); + const exception = new ActivityWorkerLimitExceeded({ + $metadata: deserializeMetadata(parsedOutput), + ...deserialized + }); + return (0, import_smithy_client5.decorateServiceException)(exception, body); + }, "de_ActivityWorkerLimitExceededRes"); + var de_ConflictExceptionRes = /* @__PURE__ */ __name(async (parsedOutput, context) => { + const body = parsedOutput.body; + const deserialized = (0, import_smithy_client5._json)(body); + const exception = new ConflictException({ + $metadata: deserializeMetadata(parsedOutput), + ...deserialized + }); + return (0, import_smithy_client5.decorateServiceException)(exception, body); + }, "de_ConflictExceptionRes"); + var de_ExecutionAlreadyExistsRes = /* @__PURE__ */ __name(async (parsedOutput, context) => { + const body = parsedOutput.body; + const deserialized = (0, import_smithy_client5._json)(body); + const exception = new ExecutionAlreadyExists({ + $metadata: deserializeMetadata(parsedOutput), + ...deserialized + }); + return (0, import_smithy_client5.decorateServiceException)(exception, body); + }, "de_ExecutionAlreadyExistsRes"); + var de_ExecutionDoesNotExistRes = /* @__PURE__ */ __name(async (parsedOutput, context) => { + const body = parsedOutput.body; + const deserialized = (0, import_smithy_client5._json)(body); + const exception = new ExecutionDoesNotExist({ + $metadata: deserializeMetadata(parsedOutput), + ...deserialized + }); + return (0, import_smithy_client5.decorateServiceException)(exception, body); + }, "de_ExecutionDoesNotExistRes"); + var de_ExecutionLimitExceededRes = /* @__PURE__ */ __name(async (parsedOutput, context) => { + const body = parsedOutput.body; + const deserialized = (0, import_smithy_client5._json)(body); + const exception = new ExecutionLimitExceeded({ + $metadata: deserializeMetadata(parsedOutput), + ...deserialized + }); + return (0, import_smithy_client5.decorateServiceException)(exception, body); + }, "de_ExecutionLimitExceededRes"); + var de_ExecutionNotRedrivableRes = /* @__PURE__ */ __name(async (parsedOutput, context) => { + const body = parsedOutput.body; + const deserialized = (0, import_smithy_client5._json)(body); + const exception = new ExecutionNotRedrivable({ + $metadata: deserializeMetadata(parsedOutput), + ...deserialized + }); + return (0, import_smithy_client5.decorateServiceException)(exception, body); + }, "de_ExecutionNotRedrivableRes"); + var de_InvalidArnRes = /* @__PURE__ */ __name(async (parsedOutput, context) => { + const body = parsedOutput.body; + const deserialized = (0, import_smithy_client5._json)(body); + const exception = new InvalidArn({ + $metadata: deserializeMetadata(parsedOutput), + ...deserialized + }); + return (0, import_smithy_client5.decorateServiceException)(exception, body); + }, "de_InvalidArnRes"); + var de_InvalidDefinitionRes = /* @__PURE__ */ __name(async (parsedOutput, context) => { + const body = parsedOutput.body; + const deserialized = (0, import_smithy_client5._json)(body); + const exception = new InvalidDefinition({ + $metadata: deserializeMetadata(parsedOutput), + ...deserialized + }); + return (0, import_smithy_client5.decorateServiceException)(exception, body); + }, "de_InvalidDefinitionRes"); + var de_InvalidEncryptionConfigurationRes = /* @__PURE__ */ __name(async (parsedOutput, context) => { + const body = parsedOutput.body; + const deserialized = (0, import_smithy_client5._json)(body); + const exception = new InvalidEncryptionConfiguration({ + $metadata: deserializeMetadata(parsedOutput), + ...deserialized + }); + return (0, import_smithy_client5.decorateServiceException)(exception, body); + }, "de_InvalidEncryptionConfigurationRes"); + var de_InvalidExecutionInputRes = /* @__PURE__ */ __name(async (parsedOutput, context) => { + const body = parsedOutput.body; + const deserialized = (0, import_smithy_client5._json)(body); + const exception = new InvalidExecutionInput({ + $metadata: deserializeMetadata(parsedOutput), + ...deserialized + }); + return (0, import_smithy_client5.decorateServiceException)(exception, body); + }, "de_InvalidExecutionInputRes"); + var de_InvalidLoggingConfigurationRes = /* @__PURE__ */ __name(async (parsedOutput, context) => { + const body = parsedOutput.body; + const deserialized = (0, import_smithy_client5._json)(body); + const exception = new InvalidLoggingConfiguration({ + $metadata: deserializeMetadata(parsedOutput), + ...deserialized + }); + return (0, import_smithy_client5.decorateServiceException)(exception, body); + }, "de_InvalidLoggingConfigurationRes"); + var de_InvalidNameRes = /* @__PURE__ */ __name(async (parsedOutput, context) => { + const body = parsedOutput.body; + const deserialized = (0, import_smithy_client5._json)(body); + const exception = new InvalidName({ + $metadata: deserializeMetadata(parsedOutput), + ...deserialized + }); + return (0, import_smithy_client5.decorateServiceException)(exception, body); + }, "de_InvalidNameRes"); + var de_InvalidOutputRes = /* @__PURE__ */ __name(async (parsedOutput, context) => { + const body = parsedOutput.body; + const deserialized = (0, import_smithy_client5._json)(body); + const exception = new InvalidOutput({ + $metadata: deserializeMetadata(parsedOutput), + ...deserialized + }); + return (0, import_smithy_client5.decorateServiceException)(exception, body); + }, "de_InvalidOutputRes"); + var de_InvalidTokenRes = /* @__PURE__ */ __name(async (parsedOutput, context) => { + const body = parsedOutput.body; + const deserialized = (0, import_smithy_client5._json)(body); + const exception = new InvalidToken({ + $metadata: deserializeMetadata(parsedOutput), + ...deserialized + }); + return (0, import_smithy_client5.decorateServiceException)(exception, body); + }, "de_InvalidTokenRes"); + var de_InvalidTracingConfigurationRes = /* @__PURE__ */ __name(async (parsedOutput, context) => { + const body = parsedOutput.body; + const deserialized = (0, import_smithy_client5._json)(body); + const exception = new InvalidTracingConfiguration({ + $metadata: deserializeMetadata(parsedOutput), + ...deserialized + }); + return (0, import_smithy_client5.decorateServiceException)(exception, body); + }, "de_InvalidTracingConfigurationRes"); + var de_KmsAccessDeniedExceptionRes = /* @__PURE__ */ __name(async (parsedOutput, context) => { + const body = parsedOutput.body; + const deserialized = (0, import_smithy_client5._json)(body); + const exception = new KmsAccessDeniedException({ + $metadata: deserializeMetadata(parsedOutput), + ...deserialized + }); + return (0, import_smithy_client5.decorateServiceException)(exception, body); + }, "de_KmsAccessDeniedExceptionRes"); + var de_KmsInvalidStateExceptionRes = /* @__PURE__ */ __name(async (parsedOutput, context) => { + const body = parsedOutput.body; + const deserialized = (0, import_smithy_client5._json)(body); + const exception = new KmsInvalidStateException({ + $metadata: deserializeMetadata(parsedOutput), + ...deserialized + }); + return (0, import_smithy_client5.decorateServiceException)(exception, body); + }, "de_KmsInvalidStateExceptionRes"); + var de_KmsThrottlingExceptionRes = /* @__PURE__ */ __name(async (parsedOutput, context) => { + const body = parsedOutput.body; + const deserialized = (0, import_smithy_client5._json)(body); + const exception = new KmsThrottlingException({ + $metadata: deserializeMetadata(parsedOutput), + ...deserialized + }); + return (0, import_smithy_client5.decorateServiceException)(exception, body); + }, "de_KmsThrottlingExceptionRes"); + var de_MissingRequiredParameterRes = /* @__PURE__ */ __name(async (parsedOutput, context) => { + const body = parsedOutput.body; + const deserialized = (0, import_smithy_client5._json)(body); + const exception = new MissingRequiredParameter({ + $metadata: deserializeMetadata(parsedOutput), + ...deserialized + }); + return (0, import_smithy_client5.decorateServiceException)(exception, body); + }, "de_MissingRequiredParameterRes"); + var de_ResourceNotFoundRes = /* @__PURE__ */ __name(async (parsedOutput, context) => { + const body = parsedOutput.body; + const deserialized = (0, import_smithy_client5._json)(body); + const exception = new ResourceNotFound({ + $metadata: deserializeMetadata(parsedOutput), + ...deserialized + }); + return (0, import_smithy_client5.decorateServiceException)(exception, body); + }, "de_ResourceNotFoundRes"); + var de_ServiceQuotaExceededExceptionRes = /* @__PURE__ */ __name(async (parsedOutput, context) => { + const body = parsedOutput.body; + const deserialized = (0, import_smithy_client5._json)(body); + const exception = new ServiceQuotaExceededException({ + $metadata: deserializeMetadata(parsedOutput), + ...deserialized + }); + return (0, import_smithy_client5.decorateServiceException)(exception, body); + }, "de_ServiceQuotaExceededExceptionRes"); + var de_StateMachineAlreadyExistsRes = /* @__PURE__ */ __name(async (parsedOutput, context) => { + const body = parsedOutput.body; + const deserialized = (0, import_smithy_client5._json)(body); + const exception = new StateMachineAlreadyExists({ + $metadata: deserializeMetadata(parsedOutput), + ...deserialized + }); + return (0, import_smithy_client5.decorateServiceException)(exception, body); + }, "de_StateMachineAlreadyExistsRes"); + var de_StateMachineDeletingRes = /* @__PURE__ */ __name(async (parsedOutput, context) => { + const body = parsedOutput.body; + const deserialized = (0, import_smithy_client5._json)(body); + const exception = new StateMachineDeleting({ + $metadata: deserializeMetadata(parsedOutput), + ...deserialized + }); + return (0, import_smithy_client5.decorateServiceException)(exception, body); + }, "de_StateMachineDeletingRes"); + var de_StateMachineDoesNotExistRes = /* @__PURE__ */ __name(async (parsedOutput, context) => { + const body = parsedOutput.body; + const deserialized = (0, import_smithy_client5._json)(body); + const exception = new StateMachineDoesNotExist({ + $metadata: deserializeMetadata(parsedOutput), + ...deserialized + }); + return (0, import_smithy_client5.decorateServiceException)(exception, body); + }, "de_StateMachineDoesNotExistRes"); + var de_StateMachineLimitExceededRes = /* @__PURE__ */ __name(async (parsedOutput, context) => { + const body = parsedOutput.body; + const deserialized = (0, import_smithy_client5._json)(body); + const exception = new StateMachineLimitExceeded({ + $metadata: deserializeMetadata(parsedOutput), + ...deserialized + }); + return (0, import_smithy_client5.decorateServiceException)(exception, body); + }, "de_StateMachineLimitExceededRes"); + var de_StateMachineTypeNotSupportedRes = /* @__PURE__ */ __name(async (parsedOutput, context) => { + const body = parsedOutput.body; + const deserialized = (0, import_smithy_client5._json)(body); + const exception = new StateMachineTypeNotSupported({ + $metadata: deserializeMetadata(parsedOutput), + ...deserialized + }); + return (0, import_smithy_client5.decorateServiceException)(exception, body); + }, "de_StateMachineTypeNotSupportedRes"); + var de_TaskDoesNotExistRes = /* @__PURE__ */ __name(async (parsedOutput, context) => { + const body = parsedOutput.body; + const deserialized = (0, import_smithy_client5._json)(body); + const exception = new TaskDoesNotExist({ + $metadata: deserializeMetadata(parsedOutput), + ...deserialized + }); + return (0, import_smithy_client5.decorateServiceException)(exception, body); + }, "de_TaskDoesNotExistRes"); + var de_TaskTimedOutRes = /* @__PURE__ */ __name(async (parsedOutput, context) => { + const body = parsedOutput.body; + const deserialized = (0, import_smithy_client5._json)(body); + const exception = new TaskTimedOut({ + $metadata: deserializeMetadata(parsedOutput), + ...deserialized + }); + return (0, import_smithy_client5.decorateServiceException)(exception, body); + }, "de_TaskTimedOutRes"); + var de_TooManyTagsRes = /* @__PURE__ */ __name(async (parsedOutput, context) => { + const body = parsedOutput.body; + const deserialized = (0, import_smithy_client5._json)(body); + const exception = new TooManyTags({ + $metadata: deserializeMetadata(parsedOutput), + ...deserialized + }); + return (0, import_smithy_client5.decorateServiceException)(exception, body); + }, "de_TooManyTagsRes"); + var de_ValidationExceptionRes = /* @__PURE__ */ __name(async (parsedOutput, context) => { + const body = parsedOutput.body; + const deserialized = (0, import_smithy_client5._json)(body); + const exception = new ValidationException({ + $metadata: deserializeMetadata(parsedOutput), + ...deserialized + }); + return (0, import_smithy_client5.decorateServiceException)(exception, body); + }, "de_ValidationExceptionRes"); + var se_RedriveExecutionInput = /* @__PURE__ */ __name((input, context) => { + return (0, import_smithy_client5.take)(input, { + clientToken: [true, (_) => _ ?? (0, import_uuid.v4)()], + executionArn: [] + }); + }, "se_RedriveExecutionInput"); + var se_UpdateMapRunInput = /* @__PURE__ */ __name((input, context) => { + return (0, import_smithy_client5.take)(input, { + mapRunArn: [], + maxConcurrency: [], + toleratedFailureCount: [], + toleratedFailurePercentage: import_smithy_client5.serializeFloat + }); + }, "se_UpdateMapRunInput"); + var de_ActivityList = /* @__PURE__ */ __name((output, context) => { + const retVal = (output || []).filter((e) => e != null).map((entry) => { + return de_ActivityListItem(entry, context); + }); + return retVal; + }, "de_ActivityList"); + var de_ActivityListItem = /* @__PURE__ */ __name((output, context) => { + return (0, import_smithy_client5.take)(output, { + activityArn: import_smithy_client5.expectString, + creationDate: (_) => (0, import_smithy_client5.expectNonNull)((0, import_smithy_client5.parseEpochTimestamp)((0, import_smithy_client5.expectNumber)(_))), + name: import_smithy_client5.expectString + }); + }, "de_ActivityListItem"); + var de_CreateActivityOutput = /* @__PURE__ */ __name((output, context) => { + return (0, import_smithy_client5.take)(output, { + activityArn: import_smithy_client5.expectString, + creationDate: (_) => (0, import_smithy_client5.expectNonNull)((0, import_smithy_client5.parseEpochTimestamp)((0, import_smithy_client5.expectNumber)(_))) + }); + }, "de_CreateActivityOutput"); + var de_CreateStateMachineAliasOutput = /* @__PURE__ */ __name((output, context) => { + return (0, import_smithy_client5.take)(output, { + creationDate: (_) => (0, import_smithy_client5.expectNonNull)((0, import_smithy_client5.parseEpochTimestamp)((0, import_smithy_client5.expectNumber)(_))), + stateMachineAliasArn: import_smithy_client5.expectString + }); + }, "de_CreateStateMachineAliasOutput"); + var de_CreateStateMachineOutput = /* @__PURE__ */ __name((output, context) => { + return (0, import_smithy_client5.take)(output, { + creationDate: (_) => (0, import_smithy_client5.expectNonNull)((0, import_smithy_client5.parseEpochTimestamp)((0, import_smithy_client5.expectNumber)(_))), + stateMachineArn: import_smithy_client5.expectString, + stateMachineVersionArn: import_smithy_client5.expectString + }); + }, "de_CreateStateMachineOutput"); + var de_DescribeActivityOutput = /* @__PURE__ */ __name((output, context) => { + return (0, import_smithy_client5.take)(output, { + activityArn: import_smithy_client5.expectString, + creationDate: (_) => (0, import_smithy_client5.expectNonNull)((0, import_smithy_client5.parseEpochTimestamp)((0, import_smithy_client5.expectNumber)(_))), + encryptionConfiguration: import_smithy_client5._json, + name: import_smithy_client5.expectString + }); + }, "de_DescribeActivityOutput"); + var de_DescribeExecutionOutput = /* @__PURE__ */ __name((output, context) => { + return (0, import_smithy_client5.take)(output, { + cause: import_smithy_client5.expectString, + error: import_smithy_client5.expectString, + executionArn: import_smithy_client5.expectString, + input: import_smithy_client5.expectString, + inputDetails: import_smithy_client5._json, + mapRunArn: import_smithy_client5.expectString, + name: import_smithy_client5.expectString, + output: import_smithy_client5.expectString, + outputDetails: import_smithy_client5._json, + redriveCount: import_smithy_client5.expectInt32, + redriveDate: (_) => (0, import_smithy_client5.expectNonNull)((0, import_smithy_client5.parseEpochTimestamp)((0, import_smithy_client5.expectNumber)(_))), + redriveStatus: import_smithy_client5.expectString, + redriveStatusReason: import_smithy_client5.expectString, + startDate: (_) => (0, import_smithy_client5.expectNonNull)((0, import_smithy_client5.parseEpochTimestamp)((0, import_smithy_client5.expectNumber)(_))), + stateMachineAliasArn: import_smithy_client5.expectString, + stateMachineArn: import_smithy_client5.expectString, + stateMachineVersionArn: import_smithy_client5.expectString, + status: import_smithy_client5.expectString, + stopDate: (_) => (0, import_smithy_client5.expectNonNull)((0, import_smithy_client5.parseEpochTimestamp)((0, import_smithy_client5.expectNumber)(_))), + traceHeader: import_smithy_client5.expectString + }); + }, "de_DescribeExecutionOutput"); + var de_DescribeMapRunOutput = /* @__PURE__ */ __name((output, context) => { + return (0, import_smithy_client5.take)(output, { + executionArn: import_smithy_client5.expectString, + executionCounts: import_smithy_client5._json, + itemCounts: import_smithy_client5._json, + mapRunArn: import_smithy_client5.expectString, + maxConcurrency: import_smithy_client5.expectInt32, + redriveCount: import_smithy_client5.expectInt32, + redriveDate: (_) => (0, import_smithy_client5.expectNonNull)((0, import_smithy_client5.parseEpochTimestamp)((0, import_smithy_client5.expectNumber)(_))), + startDate: (_) => (0, import_smithy_client5.expectNonNull)((0, import_smithy_client5.parseEpochTimestamp)((0, import_smithy_client5.expectNumber)(_))), + status: import_smithy_client5.expectString, + stopDate: (_) => (0, import_smithy_client5.expectNonNull)((0, import_smithy_client5.parseEpochTimestamp)((0, import_smithy_client5.expectNumber)(_))), + toleratedFailureCount: import_smithy_client5.expectLong, + toleratedFailurePercentage: import_smithy_client5.limitedParseFloat32 + }); + }, "de_DescribeMapRunOutput"); + var de_DescribeStateMachineAliasOutput = /* @__PURE__ */ __name((output, context) => { + return (0, import_smithy_client5.take)(output, { + creationDate: (_) => (0, import_smithy_client5.expectNonNull)((0, import_smithy_client5.parseEpochTimestamp)((0, import_smithy_client5.expectNumber)(_))), + description: import_smithy_client5.expectString, + name: import_smithy_client5.expectString, + routingConfiguration: import_smithy_client5._json, + stateMachineAliasArn: import_smithy_client5.expectString, + updateDate: (_) => (0, import_smithy_client5.expectNonNull)((0, import_smithy_client5.parseEpochTimestamp)((0, import_smithy_client5.expectNumber)(_))) + }); + }, "de_DescribeStateMachineAliasOutput"); + var de_DescribeStateMachineForExecutionOutput = /* @__PURE__ */ __name((output, context) => { + return (0, import_smithy_client5.take)(output, { + definition: import_smithy_client5.expectString, + encryptionConfiguration: import_smithy_client5._json, + label: import_smithy_client5.expectString, + loggingConfiguration: import_smithy_client5._json, + mapRunArn: import_smithy_client5.expectString, + name: import_smithy_client5.expectString, + revisionId: import_smithy_client5.expectString, + roleArn: import_smithy_client5.expectString, + stateMachineArn: import_smithy_client5.expectString, + tracingConfiguration: import_smithy_client5._json, + updateDate: (_) => (0, import_smithy_client5.expectNonNull)((0, import_smithy_client5.parseEpochTimestamp)((0, import_smithy_client5.expectNumber)(_))) + }); + }, "de_DescribeStateMachineForExecutionOutput"); + var de_DescribeStateMachineOutput = /* @__PURE__ */ __name((output, context) => { + return (0, import_smithy_client5.take)(output, { + creationDate: (_) => (0, import_smithy_client5.expectNonNull)((0, import_smithy_client5.parseEpochTimestamp)((0, import_smithy_client5.expectNumber)(_))), + definition: import_smithy_client5.expectString, + description: import_smithy_client5.expectString, + encryptionConfiguration: import_smithy_client5._json, + label: import_smithy_client5.expectString, + loggingConfiguration: import_smithy_client5._json, + name: import_smithy_client5.expectString, + revisionId: import_smithy_client5.expectString, + roleArn: import_smithy_client5.expectString, + stateMachineArn: import_smithy_client5.expectString, + status: import_smithy_client5.expectString, + tracingConfiguration: import_smithy_client5._json, + type: import_smithy_client5.expectString + }); + }, "de_DescribeStateMachineOutput"); + var de_ExecutionList = /* @__PURE__ */ __name((output, context) => { + const retVal = (output || []).filter((e) => e != null).map((entry) => { + return de_ExecutionListItem(entry, context); + }); + return retVal; + }, "de_ExecutionList"); + var de_ExecutionListItem = /* @__PURE__ */ __name((output, context) => { + return (0, import_smithy_client5.take)(output, { + executionArn: import_smithy_client5.expectString, + itemCount: import_smithy_client5.expectInt32, + mapRunArn: import_smithy_client5.expectString, + name: import_smithy_client5.expectString, + redriveCount: import_smithy_client5.expectInt32, + redriveDate: (_) => (0, import_smithy_client5.expectNonNull)((0, import_smithy_client5.parseEpochTimestamp)((0, import_smithy_client5.expectNumber)(_))), + startDate: (_) => (0, import_smithy_client5.expectNonNull)((0, import_smithy_client5.parseEpochTimestamp)((0, import_smithy_client5.expectNumber)(_))), + stateMachineAliasArn: import_smithy_client5.expectString, + stateMachineArn: import_smithy_client5.expectString, + stateMachineVersionArn: import_smithy_client5.expectString, + status: import_smithy_client5.expectString, + stopDate: (_) => (0, import_smithy_client5.expectNonNull)((0, import_smithy_client5.parseEpochTimestamp)((0, import_smithy_client5.expectNumber)(_))) + }); + }, "de_ExecutionListItem"); + var de_GetExecutionHistoryOutput = /* @__PURE__ */ __name((output, context) => { + return (0, import_smithy_client5.take)(output, { + events: (_) => de_HistoryEventList(_, context), + nextToken: import_smithy_client5.expectString + }); + }, "de_GetExecutionHistoryOutput"); + var de_HistoryEvent = /* @__PURE__ */ __name((output, context) => { + return (0, import_smithy_client5.take)(output, { + activityFailedEventDetails: import_smithy_client5._json, + activityScheduleFailedEventDetails: import_smithy_client5._json, + activityScheduledEventDetails: import_smithy_client5._json, + activityStartedEventDetails: import_smithy_client5._json, + activitySucceededEventDetails: import_smithy_client5._json, + activityTimedOutEventDetails: import_smithy_client5._json, + executionAbortedEventDetails: import_smithy_client5._json, + executionFailedEventDetails: import_smithy_client5._json, + executionRedrivenEventDetails: import_smithy_client5._json, + executionStartedEventDetails: import_smithy_client5._json, + executionSucceededEventDetails: import_smithy_client5._json, + executionTimedOutEventDetails: import_smithy_client5._json, + id: import_smithy_client5.expectLong, + lambdaFunctionFailedEventDetails: import_smithy_client5._json, + lambdaFunctionScheduleFailedEventDetails: import_smithy_client5._json, + lambdaFunctionScheduledEventDetails: import_smithy_client5._json, + lambdaFunctionStartFailedEventDetails: import_smithy_client5._json, + lambdaFunctionSucceededEventDetails: import_smithy_client5._json, + lambdaFunctionTimedOutEventDetails: import_smithy_client5._json, + mapIterationAbortedEventDetails: import_smithy_client5._json, + mapIterationFailedEventDetails: import_smithy_client5._json, + mapIterationStartedEventDetails: import_smithy_client5._json, + mapIterationSucceededEventDetails: import_smithy_client5._json, + mapRunFailedEventDetails: import_smithy_client5._json, + mapRunRedrivenEventDetails: import_smithy_client5._json, + mapRunStartedEventDetails: import_smithy_client5._json, + mapStateStartedEventDetails: import_smithy_client5._json, + previousEventId: import_smithy_client5.expectLong, + stateEnteredEventDetails: import_smithy_client5._json, + stateExitedEventDetails: import_smithy_client5._json, + taskFailedEventDetails: import_smithy_client5._json, + taskScheduledEventDetails: import_smithy_client5._json, + taskStartFailedEventDetails: import_smithy_client5._json, + taskStartedEventDetails: import_smithy_client5._json, + taskSubmitFailedEventDetails: import_smithy_client5._json, + taskSubmittedEventDetails: import_smithy_client5._json, + taskSucceededEventDetails: import_smithy_client5._json, + taskTimedOutEventDetails: import_smithy_client5._json, + timestamp: (_) => (0, import_smithy_client5.expectNonNull)((0, import_smithy_client5.parseEpochTimestamp)((0, import_smithy_client5.expectNumber)(_))), + type: import_smithy_client5.expectString + }); + }, "de_HistoryEvent"); + var de_HistoryEventList = /* @__PURE__ */ __name((output, context) => { + const retVal = (output || []).filter((e) => e != null).map((entry) => { + return de_HistoryEvent(entry, context); + }); + return retVal; + }, "de_HistoryEventList"); + var de_ListActivitiesOutput = /* @__PURE__ */ __name((output, context) => { + return (0, import_smithy_client5.take)(output, { + activities: (_) => de_ActivityList(_, context), + nextToken: import_smithy_client5.expectString + }); + }, "de_ListActivitiesOutput"); + var de_ListExecutionsOutput = /* @__PURE__ */ __name((output, context) => { + return (0, import_smithy_client5.take)(output, { + executions: (_) => de_ExecutionList(_, context), + nextToken: import_smithy_client5.expectString + }); + }, "de_ListExecutionsOutput"); + var de_ListMapRunsOutput = /* @__PURE__ */ __name((output, context) => { + return (0, import_smithy_client5.take)(output, { + mapRuns: (_) => de_MapRunList(_, context), + nextToken: import_smithy_client5.expectString + }); + }, "de_ListMapRunsOutput"); + var de_ListStateMachineAliasesOutput = /* @__PURE__ */ __name((output, context) => { + return (0, import_smithy_client5.take)(output, { + nextToken: import_smithy_client5.expectString, + stateMachineAliases: (_) => de_StateMachineAliasList(_, context) + }); + }, "de_ListStateMachineAliasesOutput"); + var de_ListStateMachinesOutput = /* @__PURE__ */ __name((output, context) => { + return (0, import_smithy_client5.take)(output, { + nextToken: import_smithy_client5.expectString, + stateMachines: (_) => de_StateMachineList(_, context) + }); + }, "de_ListStateMachinesOutput"); + var de_ListStateMachineVersionsOutput = /* @__PURE__ */ __name((output, context) => { + return (0, import_smithy_client5.take)(output, { + nextToken: import_smithy_client5.expectString, + stateMachineVersions: (_) => de_StateMachineVersionList(_, context) + }); + }, "de_ListStateMachineVersionsOutput"); + var de_MapRunList = /* @__PURE__ */ __name((output, context) => { + const retVal = (output || []).filter((e) => e != null).map((entry) => { + return de_MapRunListItem(entry, context); + }); + return retVal; + }, "de_MapRunList"); + var de_MapRunListItem = /* @__PURE__ */ __name((output, context) => { + return (0, import_smithy_client5.take)(output, { + executionArn: import_smithy_client5.expectString, + mapRunArn: import_smithy_client5.expectString, + startDate: (_) => (0, import_smithy_client5.expectNonNull)((0, import_smithy_client5.parseEpochTimestamp)((0, import_smithy_client5.expectNumber)(_))), + stateMachineArn: import_smithy_client5.expectString, + stopDate: (_) => (0, import_smithy_client5.expectNonNull)((0, import_smithy_client5.parseEpochTimestamp)((0, import_smithy_client5.expectNumber)(_))) + }); + }, "de_MapRunListItem"); + var de_PublishStateMachineVersionOutput = /* @__PURE__ */ __name((output, context) => { + return (0, import_smithy_client5.take)(output, { + creationDate: (_) => (0, import_smithy_client5.expectNonNull)((0, import_smithy_client5.parseEpochTimestamp)((0, import_smithy_client5.expectNumber)(_))), + stateMachineVersionArn: import_smithy_client5.expectString + }); + }, "de_PublishStateMachineVersionOutput"); + var de_RedriveExecutionOutput = /* @__PURE__ */ __name((output, context) => { + return (0, import_smithy_client5.take)(output, { + redriveDate: (_) => (0, import_smithy_client5.expectNonNull)((0, import_smithy_client5.parseEpochTimestamp)((0, import_smithy_client5.expectNumber)(_))) + }); + }, "de_RedriveExecutionOutput"); + var de_StartExecutionOutput = /* @__PURE__ */ __name((output, context) => { + return (0, import_smithy_client5.take)(output, { + executionArn: import_smithy_client5.expectString, + startDate: (_) => (0, import_smithy_client5.expectNonNull)((0, import_smithy_client5.parseEpochTimestamp)((0, import_smithy_client5.expectNumber)(_))) + }); + }, "de_StartExecutionOutput"); + var de_StartSyncExecutionOutput = /* @__PURE__ */ __name((output, context) => { + return (0, import_smithy_client5.take)(output, { + billingDetails: import_smithy_client5._json, + cause: import_smithy_client5.expectString, + error: import_smithy_client5.expectString, + executionArn: import_smithy_client5.expectString, + input: import_smithy_client5.expectString, + inputDetails: import_smithy_client5._json, + name: import_smithy_client5.expectString, + output: import_smithy_client5.expectString, + outputDetails: import_smithy_client5._json, + startDate: (_) => (0, import_smithy_client5.expectNonNull)((0, import_smithy_client5.parseEpochTimestamp)((0, import_smithy_client5.expectNumber)(_))), + stateMachineArn: import_smithy_client5.expectString, + status: import_smithy_client5.expectString, + stopDate: (_) => (0, import_smithy_client5.expectNonNull)((0, import_smithy_client5.parseEpochTimestamp)((0, import_smithy_client5.expectNumber)(_))), + traceHeader: import_smithy_client5.expectString + }); + }, "de_StartSyncExecutionOutput"); + var de_StateMachineAliasList = /* @__PURE__ */ __name((output, context) => { + const retVal = (output || []).filter((e) => e != null).map((entry) => { + return de_StateMachineAliasListItem(entry, context); + }); + return retVal; + }, "de_StateMachineAliasList"); + var de_StateMachineAliasListItem = /* @__PURE__ */ __name((output, context) => { + return (0, import_smithy_client5.take)(output, { + creationDate: (_) => (0, import_smithy_client5.expectNonNull)((0, import_smithy_client5.parseEpochTimestamp)((0, import_smithy_client5.expectNumber)(_))), + stateMachineAliasArn: import_smithy_client5.expectString + }); + }, "de_StateMachineAliasListItem"); + var de_StateMachineList = /* @__PURE__ */ __name((output, context) => { + const retVal = (output || []).filter((e) => e != null).map((entry) => { + return de_StateMachineListItem(entry, context); + }); + return retVal; + }, "de_StateMachineList"); + var de_StateMachineListItem = /* @__PURE__ */ __name((output, context) => { + return (0, import_smithy_client5.take)(output, { + creationDate: (_) => (0, import_smithy_client5.expectNonNull)((0, import_smithy_client5.parseEpochTimestamp)((0, import_smithy_client5.expectNumber)(_))), + name: import_smithy_client5.expectString, + stateMachineArn: import_smithy_client5.expectString, + type: import_smithy_client5.expectString + }); + }, "de_StateMachineListItem"); + var de_StateMachineVersionList = /* @__PURE__ */ __name((output, context) => { + const retVal = (output || []).filter((e) => e != null).map((entry) => { + return de_StateMachineVersionListItem(entry, context); + }); + return retVal; + }, "de_StateMachineVersionList"); + var de_StateMachineVersionListItem = /* @__PURE__ */ __name((output, context) => { + return (0, import_smithy_client5.take)(output, { + creationDate: (_) => (0, import_smithy_client5.expectNonNull)((0, import_smithy_client5.parseEpochTimestamp)((0, import_smithy_client5.expectNumber)(_))), + stateMachineVersionArn: import_smithy_client5.expectString + }); + }, "de_StateMachineVersionListItem"); + var de_StopExecutionOutput = /* @__PURE__ */ __name((output, context) => { + return (0, import_smithy_client5.take)(output, { + stopDate: (_) => (0, import_smithy_client5.expectNonNull)((0, import_smithy_client5.parseEpochTimestamp)((0, import_smithy_client5.expectNumber)(_))) + }); + }, "de_StopExecutionOutput"); + var de_UpdateStateMachineAliasOutput = /* @__PURE__ */ __name((output, context) => { + return (0, import_smithy_client5.take)(output, { + updateDate: (_) => (0, import_smithy_client5.expectNonNull)((0, import_smithy_client5.parseEpochTimestamp)((0, import_smithy_client5.expectNumber)(_))) + }); + }, "de_UpdateStateMachineAliasOutput"); + var de_UpdateStateMachineOutput = /* @__PURE__ */ __name((output, context) => { + return (0, import_smithy_client5.take)(output, { + revisionId: import_smithy_client5.expectString, + stateMachineVersionArn: import_smithy_client5.expectString, + updateDate: (_) => (0, import_smithy_client5.expectNonNull)((0, import_smithy_client5.parseEpochTimestamp)((0, import_smithy_client5.expectNumber)(_))) + }); + }, "de_UpdateStateMachineOutput"); + var deserializeMetadata = /* @__PURE__ */ __name((output) => ({ + httpStatusCode: output.statusCode, + requestId: output.headers["x-amzn-requestid"] ?? output.headers["x-amzn-request-id"] ?? output.headers["x-amz-request-id"], + extendedRequestId: output.headers["x-amz-id-2"], + cfId: output.headers["x-amz-cf-id"] + }), "deserializeMetadata"); + var throwDefaultError = (0, import_smithy_client5.withBaseException)(SFNServiceException); + var buildHttpRpcRequest = /* @__PURE__ */ __name(async (context, headers, path, resolvedHostname, body) => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); + const contents = { + protocol, + hostname, + port, + method: "POST", + path: basePath.endsWith("/") ? basePath.slice(0, -1) + path : basePath + path, + headers + }; + if (resolvedHostname !== void 0) { + contents.hostname = resolvedHostname; } - deserialize(output, context) { - return (0, Aws_json1_0_1.de_UpdateStateMachineCommand)(output, context); + if (body !== void 0) { + contents.body = body; } + return new import_protocol_http8.HttpRequest(contents); + }, "buildHttpRpcRequest"); + function sharedHeaders(operation) { + return { + "content-type": "application/x-amz-json-1.0", + "x-amz-target": `AWSStepFunctions.${operation}` + }; + } + __name(sharedHeaders, "sharedHeaders"); + var _CreateActivityCommand = class _CreateActivityCommand extends import_smithy_client5.Command.classBuilder().ep({ + ...commonParams + }).m(function(Command, cs, config, o) { + return [ + (0, import_middleware_serde2.getSerdePlugin)(config, this.serialize, this.deserialize), + (0, import_middleware_endpoint2.getEndpointPlugin)(config, Command.getEndpointParameterInstructions()) + ]; + }).s("AWSStepFunctions", "CreateActivity", {}).n("SFNClient", "CreateActivityCommand").f(void 0, void 0).ser(se_CreateActivityCommand).de(de_CreateActivityCommand).build() { + }; + __name(_CreateActivityCommand, "CreateActivityCommand"); + var CreateActivityCommand = _CreateActivityCommand; + var _CreateStateMachineAliasCommand = class _CreateStateMachineAliasCommand extends import_smithy_client5.Command.classBuilder().ep({ + ...commonParams + }).m(function(Command, cs, config, o) { + return [ + (0, import_middleware_serde2.getSerdePlugin)(config, this.serialize, this.deserialize), + (0, import_middleware_endpoint2.getEndpointPlugin)(config, Command.getEndpointParameterInstructions()) + ]; + }).s("AWSStepFunctions", "CreateStateMachineAlias", {}).n("SFNClient", "CreateStateMachineAliasCommand").f(CreateStateMachineAliasInputFilterSensitiveLog, void 0).ser(se_CreateStateMachineAliasCommand).de(de_CreateStateMachineAliasCommand).build() { + }; + __name(_CreateStateMachineAliasCommand, "CreateStateMachineAliasCommand"); + var CreateStateMachineAliasCommand = _CreateStateMachineAliasCommand; + var _CreateStateMachineCommand = class _CreateStateMachineCommand extends import_smithy_client5.Command.classBuilder().ep({ + ...commonParams + }).m(function(Command, cs, config, o) { + return [ + (0, import_middleware_serde2.getSerdePlugin)(config, this.serialize, this.deserialize), + (0, import_middleware_endpoint2.getEndpointPlugin)(config, Command.getEndpointParameterInstructions()) + ]; + }).s("AWSStepFunctions", "CreateStateMachine", {}).n("SFNClient", "CreateStateMachineCommand").f(CreateStateMachineInputFilterSensitiveLog, void 0).ser(se_CreateStateMachineCommand).de(de_CreateStateMachineCommand).build() { + }; + __name(_CreateStateMachineCommand, "CreateStateMachineCommand"); + var CreateStateMachineCommand = _CreateStateMachineCommand; + var _DeleteActivityCommand = class _DeleteActivityCommand extends import_smithy_client5.Command.classBuilder().ep({ + ...commonParams + }).m(function(Command, cs, config, o) { + return [ + (0, import_middleware_serde2.getSerdePlugin)(config, this.serialize, this.deserialize), + (0, import_middleware_endpoint2.getEndpointPlugin)(config, Command.getEndpointParameterInstructions()) + ]; + }).s("AWSStepFunctions", "DeleteActivity", {}).n("SFNClient", "DeleteActivityCommand").f(void 0, void 0).ser(se_DeleteActivityCommand).de(de_DeleteActivityCommand).build() { + }; + __name(_DeleteActivityCommand, "DeleteActivityCommand"); + var DeleteActivityCommand = _DeleteActivityCommand; + var _DeleteStateMachineAliasCommand = class _DeleteStateMachineAliasCommand extends import_smithy_client5.Command.classBuilder().ep({ + ...commonParams + }).m(function(Command, cs, config, o) { + return [ + (0, import_middleware_serde2.getSerdePlugin)(config, this.serialize, this.deserialize), + (0, import_middleware_endpoint2.getEndpointPlugin)(config, Command.getEndpointParameterInstructions()) + ]; + }).s("AWSStepFunctions", "DeleteStateMachineAlias", {}).n("SFNClient", "DeleteStateMachineAliasCommand").f(void 0, void 0).ser(se_DeleteStateMachineAliasCommand).de(de_DeleteStateMachineAliasCommand).build() { + }; + __name(_DeleteStateMachineAliasCommand, "DeleteStateMachineAliasCommand"); + var DeleteStateMachineAliasCommand = _DeleteStateMachineAliasCommand; + var _DeleteStateMachineCommand = class _DeleteStateMachineCommand extends import_smithy_client5.Command.classBuilder().ep({ + ...commonParams + }).m(function(Command, cs, config, o) { + return [ + (0, import_middleware_serde2.getSerdePlugin)(config, this.serialize, this.deserialize), + (0, import_middleware_endpoint2.getEndpointPlugin)(config, Command.getEndpointParameterInstructions()) + ]; + }).s("AWSStepFunctions", "DeleteStateMachine", {}).n("SFNClient", "DeleteStateMachineCommand").f(void 0, void 0).ser(se_DeleteStateMachineCommand).de(de_DeleteStateMachineCommand).build() { + }; + __name(_DeleteStateMachineCommand, "DeleteStateMachineCommand"); + var DeleteStateMachineCommand = _DeleteStateMachineCommand; + var _DeleteStateMachineVersionCommand = class _DeleteStateMachineVersionCommand extends import_smithy_client5.Command.classBuilder().ep({ + ...commonParams + }).m(function(Command, cs, config, o) { + return [ + (0, import_middleware_serde2.getSerdePlugin)(config, this.serialize, this.deserialize), + (0, import_middleware_endpoint2.getEndpointPlugin)(config, Command.getEndpointParameterInstructions()) + ]; + }).s("AWSStepFunctions", "DeleteStateMachineVersion", {}).n("SFNClient", "DeleteStateMachineVersionCommand").f(void 0, void 0).ser(se_DeleteStateMachineVersionCommand).de(de_DeleteStateMachineVersionCommand).build() { + }; + __name(_DeleteStateMachineVersionCommand, "DeleteStateMachineVersionCommand"); + var DeleteStateMachineVersionCommand = _DeleteStateMachineVersionCommand; + var _DescribeActivityCommand = class _DescribeActivityCommand extends import_smithy_client5.Command.classBuilder().ep({ + ...commonParams + }).m(function(Command, cs, config, o) { + return [ + (0, import_middleware_serde2.getSerdePlugin)(config, this.serialize, this.deserialize), + (0, import_middleware_endpoint2.getEndpointPlugin)(config, Command.getEndpointParameterInstructions()) + ]; + }).s("AWSStepFunctions", "DescribeActivity", {}).n("SFNClient", "DescribeActivityCommand").f(void 0, void 0).ser(se_DescribeActivityCommand).de(de_DescribeActivityCommand).build() { + }; + __name(_DescribeActivityCommand, "DescribeActivityCommand"); + var DescribeActivityCommand = _DescribeActivityCommand; + var _DescribeExecutionCommand = class _DescribeExecutionCommand extends import_smithy_client5.Command.classBuilder().ep({ + ...commonParams + }).m(function(Command, cs, config, o) { + return [ + (0, import_middleware_serde2.getSerdePlugin)(config, this.serialize, this.deserialize), + (0, import_middleware_endpoint2.getEndpointPlugin)(config, Command.getEndpointParameterInstructions()) + ]; + }).s("AWSStepFunctions", "DescribeExecution", {}).n("SFNClient", "DescribeExecutionCommand").f(void 0, DescribeExecutionOutputFilterSensitiveLog).ser(se_DescribeExecutionCommand).de(de_DescribeExecutionCommand).build() { + }; + __name(_DescribeExecutionCommand, "DescribeExecutionCommand"); + var DescribeExecutionCommand = _DescribeExecutionCommand; + var _DescribeMapRunCommand = class _DescribeMapRunCommand extends import_smithy_client5.Command.classBuilder().ep({ + ...commonParams + }).m(function(Command, cs, config, o) { + return [ + (0, import_middleware_serde2.getSerdePlugin)(config, this.serialize, this.deserialize), + (0, import_middleware_endpoint2.getEndpointPlugin)(config, Command.getEndpointParameterInstructions()) + ]; + }).s("AWSStepFunctions", "DescribeMapRun", {}).n("SFNClient", "DescribeMapRunCommand").f(void 0, void 0).ser(se_DescribeMapRunCommand).de(de_DescribeMapRunCommand).build() { + }; + __name(_DescribeMapRunCommand, "DescribeMapRunCommand"); + var DescribeMapRunCommand = _DescribeMapRunCommand; + var _DescribeStateMachineAliasCommand = class _DescribeStateMachineAliasCommand extends import_smithy_client5.Command.classBuilder().ep({ + ...commonParams + }).m(function(Command, cs, config, o) { + return [ + (0, import_middleware_serde2.getSerdePlugin)(config, this.serialize, this.deserialize), + (0, import_middleware_endpoint2.getEndpointPlugin)(config, Command.getEndpointParameterInstructions()) + ]; + }).s("AWSStepFunctions", "DescribeStateMachineAlias", {}).n("SFNClient", "DescribeStateMachineAliasCommand").f(void 0, DescribeStateMachineAliasOutputFilterSensitiveLog).ser(se_DescribeStateMachineAliasCommand).de(de_DescribeStateMachineAliasCommand).build() { + }; + __name(_DescribeStateMachineAliasCommand, "DescribeStateMachineAliasCommand"); + var DescribeStateMachineAliasCommand = _DescribeStateMachineAliasCommand; + var _DescribeStateMachineCommand = class _DescribeStateMachineCommand extends import_smithy_client5.Command.classBuilder().ep({ + ...commonParams + }).m(function(Command, cs, config, o) { + return [ + (0, import_middleware_serde2.getSerdePlugin)(config, this.serialize, this.deserialize), + (0, import_middleware_endpoint2.getEndpointPlugin)(config, Command.getEndpointParameterInstructions()) + ]; + }).s("AWSStepFunctions", "DescribeStateMachine", {}).n("SFNClient", "DescribeStateMachineCommand").f(void 0, DescribeStateMachineOutputFilterSensitiveLog).ser(se_DescribeStateMachineCommand).de(de_DescribeStateMachineCommand).build() { + }; + __name(_DescribeStateMachineCommand, "DescribeStateMachineCommand"); + var DescribeStateMachineCommand = _DescribeStateMachineCommand; + var _DescribeStateMachineForExecutionCommand = class _DescribeStateMachineForExecutionCommand extends import_smithy_client5.Command.classBuilder().ep({ + ...commonParams + }).m(function(Command, cs, config, o) { + return [ + (0, import_middleware_serde2.getSerdePlugin)(config, this.serialize, this.deserialize), + (0, import_middleware_endpoint2.getEndpointPlugin)(config, Command.getEndpointParameterInstructions()) + ]; + }).s("AWSStepFunctions", "DescribeStateMachineForExecution", {}).n("SFNClient", "DescribeStateMachineForExecutionCommand").f(void 0, DescribeStateMachineForExecutionOutputFilterSensitiveLog).ser(se_DescribeStateMachineForExecutionCommand).de(de_DescribeStateMachineForExecutionCommand).build() { + }; + __name(_DescribeStateMachineForExecutionCommand, "DescribeStateMachineForExecutionCommand"); + var DescribeStateMachineForExecutionCommand = _DescribeStateMachineForExecutionCommand; + var _GetActivityTaskCommand = class _GetActivityTaskCommand extends import_smithy_client5.Command.classBuilder().ep({ + ...commonParams + }).m(function(Command, cs, config, o) { + return [ + (0, import_middleware_serde2.getSerdePlugin)(config, this.serialize, this.deserialize), + (0, import_middleware_endpoint2.getEndpointPlugin)(config, Command.getEndpointParameterInstructions()) + ]; + }).s("AWSStepFunctions", "GetActivityTask", {}).n("SFNClient", "GetActivityTaskCommand").f(void 0, GetActivityTaskOutputFilterSensitiveLog).ser(se_GetActivityTaskCommand).de(de_GetActivityTaskCommand).build() { + }; + __name(_GetActivityTaskCommand, "GetActivityTaskCommand"); + var GetActivityTaskCommand = _GetActivityTaskCommand; + var _GetExecutionHistoryCommand = class _GetExecutionHistoryCommand extends import_smithy_client5.Command.classBuilder().ep({ + ...commonParams + }).m(function(Command, cs, config, o) { + return [ + (0, import_middleware_serde2.getSerdePlugin)(config, this.serialize, this.deserialize), + (0, import_middleware_endpoint2.getEndpointPlugin)(config, Command.getEndpointParameterInstructions()) + ]; + }).s("AWSStepFunctions", "GetExecutionHistory", {}).n("SFNClient", "GetExecutionHistoryCommand").f(void 0, GetExecutionHistoryOutputFilterSensitiveLog).ser(se_GetExecutionHistoryCommand).de(de_GetExecutionHistoryCommand).build() { + }; + __name(_GetExecutionHistoryCommand, "GetExecutionHistoryCommand"); + var GetExecutionHistoryCommand = _GetExecutionHistoryCommand; + var _ListActivitiesCommand = class _ListActivitiesCommand extends import_smithy_client5.Command.classBuilder().ep({ + ...commonParams + }).m(function(Command, cs, config, o) { + return [ + (0, import_middleware_serde2.getSerdePlugin)(config, this.serialize, this.deserialize), + (0, import_middleware_endpoint2.getEndpointPlugin)(config, Command.getEndpointParameterInstructions()) + ]; + }).s("AWSStepFunctions", "ListActivities", {}).n("SFNClient", "ListActivitiesCommand").f(void 0, void 0).ser(se_ListActivitiesCommand).de(de_ListActivitiesCommand).build() { + }; + __name(_ListActivitiesCommand, "ListActivitiesCommand"); + var ListActivitiesCommand = _ListActivitiesCommand; + var _ListExecutionsCommand = class _ListExecutionsCommand extends import_smithy_client5.Command.classBuilder().ep({ + ...commonParams + }).m(function(Command, cs, config, o) { + return [ + (0, import_middleware_serde2.getSerdePlugin)(config, this.serialize, this.deserialize), + (0, import_middleware_endpoint2.getEndpointPlugin)(config, Command.getEndpointParameterInstructions()) + ]; + }).s("AWSStepFunctions", "ListExecutions", {}).n("SFNClient", "ListExecutionsCommand").f(void 0, void 0).ser(se_ListExecutionsCommand).de(de_ListExecutionsCommand).build() { + }; + __name(_ListExecutionsCommand, "ListExecutionsCommand"); + var ListExecutionsCommand = _ListExecutionsCommand; + var _ListMapRunsCommand = class _ListMapRunsCommand extends import_smithy_client5.Command.classBuilder().ep({ + ...commonParams + }).m(function(Command, cs, config, o) { + return [ + (0, import_middleware_serde2.getSerdePlugin)(config, this.serialize, this.deserialize), + (0, import_middleware_endpoint2.getEndpointPlugin)(config, Command.getEndpointParameterInstructions()) + ]; + }).s("AWSStepFunctions", "ListMapRuns", {}).n("SFNClient", "ListMapRunsCommand").f(void 0, void 0).ser(se_ListMapRunsCommand).de(de_ListMapRunsCommand).build() { + }; + __name(_ListMapRunsCommand, "ListMapRunsCommand"); + var ListMapRunsCommand = _ListMapRunsCommand; + var _ListStateMachineAliasesCommand = class _ListStateMachineAliasesCommand extends import_smithy_client5.Command.classBuilder().ep({ + ...commonParams + }).m(function(Command, cs, config, o) { + return [ + (0, import_middleware_serde2.getSerdePlugin)(config, this.serialize, this.deserialize), + (0, import_middleware_endpoint2.getEndpointPlugin)(config, Command.getEndpointParameterInstructions()) + ]; + }).s("AWSStepFunctions", "ListStateMachineAliases", {}).n("SFNClient", "ListStateMachineAliasesCommand").f(void 0, void 0).ser(se_ListStateMachineAliasesCommand).de(de_ListStateMachineAliasesCommand).build() { + }; + __name(_ListStateMachineAliasesCommand, "ListStateMachineAliasesCommand"); + var ListStateMachineAliasesCommand = _ListStateMachineAliasesCommand; + var _ListStateMachinesCommand = class _ListStateMachinesCommand extends import_smithy_client5.Command.classBuilder().ep({ + ...commonParams + }).m(function(Command, cs, config, o) { + return [ + (0, import_middleware_serde2.getSerdePlugin)(config, this.serialize, this.deserialize), + (0, import_middleware_endpoint2.getEndpointPlugin)(config, Command.getEndpointParameterInstructions()) + ]; + }).s("AWSStepFunctions", "ListStateMachines", {}).n("SFNClient", "ListStateMachinesCommand").f(void 0, void 0).ser(se_ListStateMachinesCommand).de(de_ListStateMachinesCommand).build() { + }; + __name(_ListStateMachinesCommand, "ListStateMachinesCommand"); + var ListStateMachinesCommand = _ListStateMachinesCommand; + var _ListStateMachineVersionsCommand = class _ListStateMachineVersionsCommand extends import_smithy_client5.Command.classBuilder().ep({ + ...commonParams + }).m(function(Command, cs, config, o) { + return [ + (0, import_middleware_serde2.getSerdePlugin)(config, this.serialize, this.deserialize), + (0, import_middleware_endpoint2.getEndpointPlugin)(config, Command.getEndpointParameterInstructions()) + ]; + }).s("AWSStepFunctions", "ListStateMachineVersions", {}).n("SFNClient", "ListStateMachineVersionsCommand").f(void 0, void 0).ser(se_ListStateMachineVersionsCommand).de(de_ListStateMachineVersionsCommand).build() { + }; + __name(_ListStateMachineVersionsCommand, "ListStateMachineVersionsCommand"); + var ListStateMachineVersionsCommand = _ListStateMachineVersionsCommand; + var _ListTagsForResourceCommand = class _ListTagsForResourceCommand extends import_smithy_client5.Command.classBuilder().ep({ + ...commonParams + }).m(function(Command, cs, config, o) { + return [ + (0, import_middleware_serde2.getSerdePlugin)(config, this.serialize, this.deserialize), + (0, import_middleware_endpoint2.getEndpointPlugin)(config, Command.getEndpointParameterInstructions()) + ]; + }).s("AWSStepFunctions", "ListTagsForResource", {}).n("SFNClient", "ListTagsForResourceCommand").f(void 0, void 0).ser(se_ListTagsForResourceCommand).de(de_ListTagsForResourceCommand).build() { + }; + __name(_ListTagsForResourceCommand, "ListTagsForResourceCommand"); + var ListTagsForResourceCommand = _ListTagsForResourceCommand; + var _PublishStateMachineVersionCommand = class _PublishStateMachineVersionCommand extends import_smithy_client5.Command.classBuilder().ep({ + ...commonParams + }).m(function(Command, cs, config, o) { + return [ + (0, import_middleware_serde2.getSerdePlugin)(config, this.serialize, this.deserialize), + (0, import_middleware_endpoint2.getEndpointPlugin)(config, Command.getEndpointParameterInstructions()) + ]; + }).s("AWSStepFunctions", "PublishStateMachineVersion", {}).n("SFNClient", "PublishStateMachineVersionCommand").f(PublishStateMachineVersionInputFilterSensitiveLog, void 0).ser(se_PublishStateMachineVersionCommand).de(de_PublishStateMachineVersionCommand).build() { + }; + __name(_PublishStateMachineVersionCommand, "PublishStateMachineVersionCommand"); + var PublishStateMachineVersionCommand = _PublishStateMachineVersionCommand; + var _RedriveExecutionCommand = class _RedriveExecutionCommand extends import_smithy_client5.Command.classBuilder().ep({ + ...commonParams + }).m(function(Command, cs, config, o) { + return [ + (0, import_middleware_serde2.getSerdePlugin)(config, this.serialize, this.deserialize), + (0, import_middleware_endpoint2.getEndpointPlugin)(config, Command.getEndpointParameterInstructions()) + ]; + }).s("AWSStepFunctions", "RedriveExecution", {}).n("SFNClient", "RedriveExecutionCommand").f(void 0, void 0).ser(se_RedriveExecutionCommand).de(de_RedriveExecutionCommand).build() { + }; + __name(_RedriveExecutionCommand, "RedriveExecutionCommand"); + var RedriveExecutionCommand = _RedriveExecutionCommand; + var _SendTaskFailureCommand = class _SendTaskFailureCommand extends import_smithy_client5.Command.classBuilder().ep({ + ...commonParams + }).m(function(Command, cs, config, o) { + return [ + (0, import_middleware_serde2.getSerdePlugin)(config, this.serialize, this.deserialize), + (0, import_middleware_endpoint2.getEndpointPlugin)(config, Command.getEndpointParameterInstructions()) + ]; + }).s("AWSStepFunctions", "SendTaskFailure", {}).n("SFNClient", "SendTaskFailureCommand").f(SendTaskFailureInputFilterSensitiveLog, void 0).ser(se_SendTaskFailureCommand).de(de_SendTaskFailureCommand).build() { + }; + __name(_SendTaskFailureCommand, "SendTaskFailureCommand"); + var SendTaskFailureCommand = _SendTaskFailureCommand; + var _SendTaskHeartbeatCommand = class _SendTaskHeartbeatCommand extends import_smithy_client5.Command.classBuilder().ep({ + ...commonParams + }).m(function(Command, cs, config, o) { + return [ + (0, import_middleware_serde2.getSerdePlugin)(config, this.serialize, this.deserialize), + (0, import_middleware_endpoint2.getEndpointPlugin)(config, Command.getEndpointParameterInstructions()) + ]; + }).s("AWSStepFunctions", "SendTaskHeartbeat", {}).n("SFNClient", "SendTaskHeartbeatCommand").f(void 0, void 0).ser(se_SendTaskHeartbeatCommand).de(de_SendTaskHeartbeatCommand).build() { + }; + __name(_SendTaskHeartbeatCommand, "SendTaskHeartbeatCommand"); + var SendTaskHeartbeatCommand = _SendTaskHeartbeatCommand; + var _SendTaskSuccessCommand = class _SendTaskSuccessCommand extends import_smithy_client5.Command.classBuilder().ep({ + ...commonParams + }).m(function(Command, cs, config, o) { + return [ + (0, import_middleware_serde2.getSerdePlugin)(config, this.serialize, this.deserialize), + (0, import_middleware_endpoint2.getEndpointPlugin)(config, Command.getEndpointParameterInstructions()) + ]; + }).s("AWSStepFunctions", "SendTaskSuccess", {}).n("SFNClient", "SendTaskSuccessCommand").f(SendTaskSuccessInputFilterSensitiveLog, void 0).ser(se_SendTaskSuccessCommand).de(de_SendTaskSuccessCommand).build() { + }; + __name(_SendTaskSuccessCommand, "SendTaskSuccessCommand"); + var SendTaskSuccessCommand = _SendTaskSuccessCommand; + var _StartExecutionCommand = class _StartExecutionCommand extends import_smithy_client5.Command.classBuilder().ep({ + ...commonParams + }).m(function(Command, cs, config, o) { + return [ + (0, import_middleware_serde2.getSerdePlugin)(config, this.serialize, this.deserialize), + (0, import_middleware_endpoint2.getEndpointPlugin)(config, Command.getEndpointParameterInstructions()) + ]; + }).s("AWSStepFunctions", "StartExecution", {}).n("SFNClient", "StartExecutionCommand").f(StartExecutionInputFilterSensitiveLog, void 0).ser(se_StartExecutionCommand).de(de_StartExecutionCommand).build() { + }; + __name(_StartExecutionCommand, "StartExecutionCommand"); + var StartExecutionCommand = _StartExecutionCommand; + var _StartSyncExecutionCommand = class _StartSyncExecutionCommand extends import_smithy_client5.Command.classBuilder().ep({ + ...commonParams + }).m(function(Command, cs, config, o) { + return [ + (0, import_middleware_serde2.getSerdePlugin)(config, this.serialize, this.deserialize), + (0, import_middleware_endpoint2.getEndpointPlugin)(config, Command.getEndpointParameterInstructions()) + ]; + }).s("AWSStepFunctions", "StartSyncExecution", {}).n("SFNClient", "StartSyncExecutionCommand").f(StartSyncExecutionInputFilterSensitiveLog, StartSyncExecutionOutputFilterSensitiveLog).ser(se_StartSyncExecutionCommand).de(de_StartSyncExecutionCommand).build() { + }; + __name(_StartSyncExecutionCommand, "StartSyncExecutionCommand"); + var StartSyncExecutionCommand = _StartSyncExecutionCommand; + var _StopExecutionCommand = class _StopExecutionCommand extends import_smithy_client5.Command.classBuilder().ep({ + ...commonParams + }).m(function(Command, cs, config, o) { + return [ + (0, import_middleware_serde2.getSerdePlugin)(config, this.serialize, this.deserialize), + (0, import_middleware_endpoint2.getEndpointPlugin)(config, Command.getEndpointParameterInstructions()) + ]; + }).s("AWSStepFunctions", "StopExecution", {}).n("SFNClient", "StopExecutionCommand").f(StopExecutionInputFilterSensitiveLog, void 0).ser(se_StopExecutionCommand).de(de_StopExecutionCommand).build() { + }; + __name(_StopExecutionCommand, "StopExecutionCommand"); + var StopExecutionCommand = _StopExecutionCommand; + var _TagResourceCommand = class _TagResourceCommand extends import_smithy_client5.Command.classBuilder().ep({ + ...commonParams + }).m(function(Command, cs, config, o) { + return [ + (0, import_middleware_serde2.getSerdePlugin)(config, this.serialize, this.deserialize), + (0, import_middleware_endpoint2.getEndpointPlugin)(config, Command.getEndpointParameterInstructions()) + ]; + }).s("AWSStepFunctions", "TagResource", {}).n("SFNClient", "TagResourceCommand").f(void 0, void 0).ser(se_TagResourceCommand).de(de_TagResourceCommand).build() { + }; + __name(_TagResourceCommand, "TagResourceCommand"); + var TagResourceCommand = _TagResourceCommand; + var _TestStateCommand = class _TestStateCommand extends import_smithy_client5.Command.classBuilder().ep({ + ...commonParams + }).m(function(Command, cs, config, o) { + return [ + (0, import_middleware_serde2.getSerdePlugin)(config, this.serialize, this.deserialize), + (0, import_middleware_endpoint2.getEndpointPlugin)(config, Command.getEndpointParameterInstructions()) + ]; + }).s("AWSStepFunctions", "TestState", {}).n("SFNClient", "TestStateCommand").f(TestStateInputFilterSensitiveLog, TestStateOutputFilterSensitiveLog).ser(se_TestStateCommand).de(de_TestStateCommand).build() { + }; + __name(_TestStateCommand, "TestStateCommand"); + var TestStateCommand = _TestStateCommand; + var _UntagResourceCommand = class _UntagResourceCommand extends import_smithy_client5.Command.classBuilder().ep({ + ...commonParams + }).m(function(Command, cs, config, o) { + return [ + (0, import_middleware_serde2.getSerdePlugin)(config, this.serialize, this.deserialize), + (0, import_middleware_endpoint2.getEndpointPlugin)(config, Command.getEndpointParameterInstructions()) + ]; + }).s("AWSStepFunctions", "UntagResource", {}).n("SFNClient", "UntagResourceCommand").f(void 0, void 0).ser(se_UntagResourceCommand).de(de_UntagResourceCommand).build() { + }; + __name(_UntagResourceCommand, "UntagResourceCommand"); + var UntagResourceCommand = _UntagResourceCommand; + var _UpdateMapRunCommand = class _UpdateMapRunCommand extends import_smithy_client5.Command.classBuilder().ep({ + ...commonParams + }).m(function(Command, cs, config, o) { + return [ + (0, import_middleware_serde2.getSerdePlugin)(config, this.serialize, this.deserialize), + (0, import_middleware_endpoint2.getEndpointPlugin)(config, Command.getEndpointParameterInstructions()) + ]; + }).s("AWSStepFunctions", "UpdateMapRun", {}).n("SFNClient", "UpdateMapRunCommand").f(void 0, void 0).ser(se_UpdateMapRunCommand).de(de_UpdateMapRunCommand).build() { + }; + __name(_UpdateMapRunCommand, "UpdateMapRunCommand"); + var UpdateMapRunCommand = _UpdateMapRunCommand; + var _UpdateStateMachineAliasCommand = class _UpdateStateMachineAliasCommand extends import_smithy_client5.Command.classBuilder().ep({ + ...commonParams + }).m(function(Command, cs, config, o) { + return [ + (0, import_middleware_serde2.getSerdePlugin)(config, this.serialize, this.deserialize), + (0, import_middleware_endpoint2.getEndpointPlugin)(config, Command.getEndpointParameterInstructions()) + ]; + }).s("AWSStepFunctions", "UpdateStateMachineAlias", {}).n("SFNClient", "UpdateStateMachineAliasCommand").f(UpdateStateMachineAliasInputFilterSensitiveLog, void 0).ser(se_UpdateStateMachineAliasCommand).de(de_UpdateStateMachineAliasCommand).build() { + }; + __name(_UpdateStateMachineAliasCommand, "UpdateStateMachineAliasCommand"); + var UpdateStateMachineAliasCommand = _UpdateStateMachineAliasCommand; + var _UpdateStateMachineCommand = class _UpdateStateMachineCommand extends import_smithy_client5.Command.classBuilder().ep({ + ...commonParams + }).m(function(Command, cs, config, o) { + return [ + (0, import_middleware_serde2.getSerdePlugin)(config, this.serialize, this.deserialize), + (0, import_middleware_endpoint2.getEndpointPlugin)(config, Command.getEndpointParameterInstructions()) + ]; + }).s("AWSStepFunctions", "UpdateStateMachine", {}).n("SFNClient", "UpdateStateMachineCommand").f(UpdateStateMachineInputFilterSensitiveLog, void 0).ser(se_UpdateStateMachineCommand).de(de_UpdateStateMachineCommand).build() { + }; + __name(_UpdateStateMachineCommand, "UpdateStateMachineCommand"); + var UpdateStateMachineCommand = _UpdateStateMachineCommand; + var _ValidateStateMachineDefinitionCommand = class _ValidateStateMachineDefinitionCommand extends import_smithy_client5.Command.classBuilder().ep({ + ...commonParams + }).m(function(Command, cs, config, o) { + return [ + (0, import_middleware_serde2.getSerdePlugin)(config, this.serialize, this.deserialize), + (0, import_middleware_endpoint2.getEndpointPlugin)(config, Command.getEndpointParameterInstructions()) + ]; + }).s("AWSStepFunctions", "ValidateStateMachineDefinition", {}).n("SFNClient", "ValidateStateMachineDefinitionCommand").f(ValidateStateMachineDefinitionInputFilterSensitiveLog, void 0).ser(se_ValidateStateMachineDefinitionCommand).de(de_ValidateStateMachineDefinitionCommand).build() { }; - exports2.UpdateStateMachineCommand = UpdateStateMachineCommand; - } -}); - -// ../../../node_modules/@aws-sdk/client-sfn/dist-cjs/SFN.js -var require_SFN = __commonJS({ - "../../../node_modules/@aws-sdk/client-sfn/dist-cjs/SFN.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.SFN = void 0; - var smithy_client_1 = require_dist_cjs34(); - var CreateActivityCommand_1 = require_CreateActivityCommand(); - var CreateStateMachineAliasCommand_1 = require_CreateStateMachineAliasCommand(); - var CreateStateMachineCommand_1 = require_CreateStateMachineCommand(); - var DeleteActivityCommand_1 = require_DeleteActivityCommand(); - var DeleteStateMachineAliasCommand_1 = require_DeleteStateMachineAliasCommand(); - var DeleteStateMachineCommand_1 = require_DeleteStateMachineCommand(); - var DeleteStateMachineVersionCommand_1 = require_DeleteStateMachineVersionCommand(); - var DescribeActivityCommand_1 = require_DescribeActivityCommand(); - var DescribeExecutionCommand_1 = require_DescribeExecutionCommand(); - var DescribeMapRunCommand_1 = require_DescribeMapRunCommand(); - var DescribeStateMachineAliasCommand_1 = require_DescribeStateMachineAliasCommand(); - var DescribeStateMachineCommand_1 = require_DescribeStateMachineCommand(); - var DescribeStateMachineForExecutionCommand_1 = require_DescribeStateMachineForExecutionCommand(); - var GetActivityTaskCommand_1 = require_GetActivityTaskCommand(); - var GetExecutionHistoryCommand_1 = require_GetExecutionHistoryCommand(); - var ListActivitiesCommand_1 = require_ListActivitiesCommand(); - var ListExecutionsCommand_1 = require_ListExecutionsCommand(); - var ListMapRunsCommand_1 = require_ListMapRunsCommand(); - var ListStateMachineAliasesCommand_1 = require_ListStateMachineAliasesCommand(); - var ListStateMachinesCommand_1 = require_ListStateMachinesCommand(); - var ListStateMachineVersionsCommand_1 = require_ListStateMachineVersionsCommand(); - var ListTagsForResourceCommand_1 = require_ListTagsForResourceCommand(); - var PublishStateMachineVersionCommand_1 = require_PublishStateMachineVersionCommand(); - var SendTaskFailureCommand_1 = require_SendTaskFailureCommand(); - var SendTaskHeartbeatCommand_1 = require_SendTaskHeartbeatCommand(); - var SendTaskSuccessCommand_1 = require_SendTaskSuccessCommand(); - var StartExecutionCommand_1 = require_StartExecutionCommand(); - var StartSyncExecutionCommand_1 = require_StartSyncExecutionCommand(); - var StopExecutionCommand_1 = require_StopExecutionCommand(); - var TagResourceCommand_1 = require_TagResourceCommand(); - var UntagResourceCommand_1 = require_UntagResourceCommand(); - var UpdateMapRunCommand_1 = require_UpdateMapRunCommand(); - var UpdateStateMachineAliasCommand_1 = require_UpdateStateMachineAliasCommand(); - var UpdateStateMachineCommand_1 = require_UpdateStateMachineCommand(); - var SFNClient_1 = require_SFNClient(); + __name(_ValidateStateMachineDefinitionCommand, "ValidateStateMachineDefinitionCommand"); + var ValidateStateMachineDefinitionCommand = _ValidateStateMachineDefinitionCommand; var commands = { - CreateActivityCommand: CreateActivityCommand_1.CreateActivityCommand, - CreateStateMachineCommand: CreateStateMachineCommand_1.CreateStateMachineCommand, - CreateStateMachineAliasCommand: CreateStateMachineAliasCommand_1.CreateStateMachineAliasCommand, - DeleteActivityCommand: DeleteActivityCommand_1.DeleteActivityCommand, - DeleteStateMachineCommand: DeleteStateMachineCommand_1.DeleteStateMachineCommand, - DeleteStateMachineAliasCommand: DeleteStateMachineAliasCommand_1.DeleteStateMachineAliasCommand, - DeleteStateMachineVersionCommand: DeleteStateMachineVersionCommand_1.DeleteStateMachineVersionCommand, - DescribeActivityCommand: DescribeActivityCommand_1.DescribeActivityCommand, - DescribeExecutionCommand: DescribeExecutionCommand_1.DescribeExecutionCommand, - DescribeMapRunCommand: DescribeMapRunCommand_1.DescribeMapRunCommand, - DescribeStateMachineCommand: DescribeStateMachineCommand_1.DescribeStateMachineCommand, - DescribeStateMachineAliasCommand: DescribeStateMachineAliasCommand_1.DescribeStateMachineAliasCommand, - DescribeStateMachineForExecutionCommand: DescribeStateMachineForExecutionCommand_1.DescribeStateMachineForExecutionCommand, - GetActivityTaskCommand: GetActivityTaskCommand_1.GetActivityTaskCommand, - GetExecutionHistoryCommand: GetExecutionHistoryCommand_1.GetExecutionHistoryCommand, - ListActivitiesCommand: ListActivitiesCommand_1.ListActivitiesCommand, - ListExecutionsCommand: ListExecutionsCommand_1.ListExecutionsCommand, - ListMapRunsCommand: ListMapRunsCommand_1.ListMapRunsCommand, - ListStateMachineAliasesCommand: ListStateMachineAliasesCommand_1.ListStateMachineAliasesCommand, - ListStateMachinesCommand: ListStateMachinesCommand_1.ListStateMachinesCommand, - ListStateMachineVersionsCommand: ListStateMachineVersionsCommand_1.ListStateMachineVersionsCommand, - ListTagsForResourceCommand: ListTagsForResourceCommand_1.ListTagsForResourceCommand, - PublishStateMachineVersionCommand: PublishStateMachineVersionCommand_1.PublishStateMachineVersionCommand, - SendTaskFailureCommand: SendTaskFailureCommand_1.SendTaskFailureCommand, - SendTaskHeartbeatCommand: SendTaskHeartbeatCommand_1.SendTaskHeartbeatCommand, - SendTaskSuccessCommand: SendTaskSuccessCommand_1.SendTaskSuccessCommand, - StartExecutionCommand: StartExecutionCommand_1.StartExecutionCommand, - StartSyncExecutionCommand: StartSyncExecutionCommand_1.StartSyncExecutionCommand, - StopExecutionCommand: StopExecutionCommand_1.StopExecutionCommand, - TagResourceCommand: TagResourceCommand_1.TagResourceCommand, - UntagResourceCommand: UntagResourceCommand_1.UntagResourceCommand, - UpdateMapRunCommand: UpdateMapRunCommand_1.UpdateMapRunCommand, - UpdateStateMachineCommand: UpdateStateMachineCommand_1.UpdateStateMachineCommand, - UpdateStateMachineAliasCommand: UpdateStateMachineAliasCommand_1.UpdateStateMachineAliasCommand - }; - var SFN2 = class extends SFNClient_1.SFNClient { - }; - exports2.SFN = SFN2; - (0, smithy_client_1.createAggregatedClient)(commands, SFN2); - } -}); - -// ../../../node_modules/@aws-sdk/client-sfn/dist-cjs/commands/index.js -var require_commands3 = __commonJS({ - "../../../node_modules/@aws-sdk/client-sfn/dist-cjs/commands/index.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports)); - tslib_1.__exportStar(require_CreateActivityCommand(), exports2); - tslib_1.__exportStar(require_CreateStateMachineAliasCommand(), exports2); - tslib_1.__exportStar(require_CreateStateMachineCommand(), exports2); - tslib_1.__exportStar(require_DeleteActivityCommand(), exports2); - tslib_1.__exportStar(require_DeleteStateMachineAliasCommand(), exports2); - tslib_1.__exportStar(require_DeleteStateMachineCommand(), exports2); - tslib_1.__exportStar(require_DeleteStateMachineVersionCommand(), exports2); - tslib_1.__exportStar(require_DescribeActivityCommand(), exports2); - tslib_1.__exportStar(require_DescribeExecutionCommand(), exports2); - tslib_1.__exportStar(require_DescribeMapRunCommand(), exports2); - tslib_1.__exportStar(require_DescribeStateMachineAliasCommand(), exports2); - tslib_1.__exportStar(require_DescribeStateMachineCommand(), exports2); - tslib_1.__exportStar(require_DescribeStateMachineForExecutionCommand(), exports2); - tslib_1.__exportStar(require_GetActivityTaskCommand(), exports2); - tslib_1.__exportStar(require_GetExecutionHistoryCommand(), exports2); - tslib_1.__exportStar(require_ListActivitiesCommand(), exports2); - tslib_1.__exportStar(require_ListExecutionsCommand(), exports2); - tslib_1.__exportStar(require_ListMapRunsCommand(), exports2); - tslib_1.__exportStar(require_ListStateMachineAliasesCommand(), exports2); - tslib_1.__exportStar(require_ListStateMachineVersionsCommand(), exports2); - tslib_1.__exportStar(require_ListStateMachinesCommand(), exports2); - tslib_1.__exportStar(require_ListTagsForResourceCommand(), exports2); - tslib_1.__exportStar(require_PublishStateMachineVersionCommand(), exports2); - tslib_1.__exportStar(require_SendTaskFailureCommand(), exports2); - tslib_1.__exportStar(require_SendTaskHeartbeatCommand(), exports2); - tslib_1.__exportStar(require_SendTaskSuccessCommand(), exports2); - tslib_1.__exportStar(require_StartExecutionCommand(), exports2); - tslib_1.__exportStar(require_StartSyncExecutionCommand(), exports2); - tslib_1.__exportStar(require_StopExecutionCommand(), exports2); - tslib_1.__exportStar(require_TagResourceCommand(), exports2); - tslib_1.__exportStar(require_UntagResourceCommand(), exports2); - tslib_1.__exportStar(require_UpdateMapRunCommand(), exports2); - tslib_1.__exportStar(require_UpdateStateMachineAliasCommand(), exports2); - tslib_1.__exportStar(require_UpdateStateMachineCommand(), exports2); - } -}); - -// ../../../node_modules/@aws-sdk/client-sfn/dist-cjs/pagination/GetExecutionHistoryPaginator.js -var require_GetExecutionHistoryPaginator = __commonJS({ - "../../../node_modules/@aws-sdk/client-sfn/dist-cjs/pagination/GetExecutionHistoryPaginator.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.paginateGetExecutionHistory = void 0; - var GetExecutionHistoryCommand_1 = require_GetExecutionHistoryCommand(); - var SFNClient_1 = require_SFNClient(); - var makePagedClientRequest = async (client, input, ...args) => { - return await client.send(new GetExecutionHistoryCommand_1.GetExecutionHistoryCommand(input), ...args); - }; - async function* paginateGetExecutionHistory(config, input, ...additionalArguments) { - let token = config.startingToken || void 0; - let hasNext = true; - let page; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof SFNClient_1.SFNClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SFN | SFNClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - return void 0; - } - exports2.paginateGetExecutionHistory = paginateGetExecutionHistory; - } -}); - -// ../../../node_modules/@aws-sdk/client-sfn/dist-cjs/pagination/Interfaces.js -var require_Interfaces2 = __commonJS({ - "../../../node_modules/@aws-sdk/client-sfn/dist-cjs/pagination/Interfaces.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - } -}); - -// ../../../node_modules/@aws-sdk/client-sfn/dist-cjs/pagination/ListActivitiesPaginator.js -var require_ListActivitiesPaginator = __commonJS({ - "../../../node_modules/@aws-sdk/client-sfn/dist-cjs/pagination/ListActivitiesPaginator.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.paginateListActivities = void 0; - var ListActivitiesCommand_1 = require_ListActivitiesCommand(); - var SFNClient_1 = require_SFNClient(); - var makePagedClientRequest = async (client, input, ...args) => { - return await client.send(new ListActivitiesCommand_1.ListActivitiesCommand(input), ...args); - }; - async function* paginateListActivities(config, input, ...additionalArguments) { - let token = config.startingToken || void 0; - let hasNext = true; - let page; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof SFNClient_1.SFNClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SFN | SFNClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - return void 0; - } - exports2.paginateListActivities = paginateListActivities; - } -}); - -// ../../../node_modules/@aws-sdk/client-sfn/dist-cjs/pagination/ListExecutionsPaginator.js -var require_ListExecutionsPaginator = __commonJS({ - "../../../node_modules/@aws-sdk/client-sfn/dist-cjs/pagination/ListExecutionsPaginator.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.paginateListExecutions = void 0; - var ListExecutionsCommand_1 = require_ListExecutionsCommand(); - var SFNClient_1 = require_SFNClient(); - var makePagedClientRequest = async (client, input, ...args) => { - return await client.send(new ListExecutionsCommand_1.ListExecutionsCommand(input), ...args); - }; - async function* paginateListExecutions(config, input, ...additionalArguments) { - let token = config.startingToken || void 0; - let hasNext = true; - let page; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof SFNClient_1.SFNClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SFN | SFNClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - return void 0; - } - exports2.paginateListExecutions = paginateListExecutions; - } -}); - -// ../../../node_modules/@aws-sdk/client-sfn/dist-cjs/pagination/ListMapRunsPaginator.js -var require_ListMapRunsPaginator = __commonJS({ - "../../../node_modules/@aws-sdk/client-sfn/dist-cjs/pagination/ListMapRunsPaginator.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.paginateListMapRuns = void 0; - var ListMapRunsCommand_1 = require_ListMapRunsCommand(); - var SFNClient_1 = require_SFNClient(); - var makePagedClientRequest = async (client, input, ...args) => { - return await client.send(new ListMapRunsCommand_1.ListMapRunsCommand(input), ...args); - }; - async function* paginateListMapRuns(config, input, ...additionalArguments) { - let token = config.startingToken || void 0; - let hasNext = true; - let page; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof SFNClient_1.SFNClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SFN | SFNClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - return void 0; - } - exports2.paginateListMapRuns = paginateListMapRuns; - } -}); - -// ../../../node_modules/@aws-sdk/client-sfn/dist-cjs/pagination/ListStateMachinesPaginator.js -var require_ListStateMachinesPaginator = __commonJS({ - "../../../node_modules/@aws-sdk/client-sfn/dist-cjs/pagination/ListStateMachinesPaginator.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.paginateListStateMachines = void 0; - var ListStateMachinesCommand_1 = require_ListStateMachinesCommand(); - var SFNClient_1 = require_SFNClient(); - var makePagedClientRequest = async (client, input, ...args) => { - return await client.send(new ListStateMachinesCommand_1.ListStateMachinesCommand(input), ...args); - }; - async function* paginateListStateMachines(config, input, ...additionalArguments) { - let token = config.startingToken || void 0; - let hasNext = true; - let page; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof SFNClient_1.SFNClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SFN | SFNClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - return void 0; - } - exports2.paginateListStateMachines = paginateListStateMachines; - } -}); - -// ../../../node_modules/@aws-sdk/client-sfn/dist-cjs/pagination/index.js -var require_pagination3 = __commonJS({ - "../../../node_modules/@aws-sdk/client-sfn/dist-cjs/pagination/index.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports)); - tslib_1.__exportStar(require_GetExecutionHistoryPaginator(), exports2); - tslib_1.__exportStar(require_Interfaces2(), exports2); - tslib_1.__exportStar(require_ListActivitiesPaginator(), exports2); - tslib_1.__exportStar(require_ListExecutionsPaginator(), exports2); - tslib_1.__exportStar(require_ListMapRunsPaginator(), exports2); - tslib_1.__exportStar(require_ListStateMachinesPaginator(), exports2); - } -}); - -// ../../../node_modules/@aws-sdk/client-sfn/dist-cjs/models/index.js -var require_models3 = __commonJS({ - "../../../node_modules/@aws-sdk/client-sfn/dist-cjs/models/index.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports)); - tslib_1.__exportStar(require_models_03(), exports2); - } -}); - -// ../../../node_modules/@aws-sdk/client-sfn/dist-cjs/index.js -var require_dist_cjs52 = __commonJS({ - "../../../node_modules/@aws-sdk/client-sfn/dist-cjs/index.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.SFNServiceException = void 0; - var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports)); - tslib_1.__exportStar(require_SFNClient(), exports2); - tslib_1.__exportStar(require_SFN(), exports2); - tslib_1.__exportStar(require_commands3(), exports2); - tslib_1.__exportStar(require_pagination3(), exports2); - tslib_1.__exportStar(require_models3(), exports2); - var SFNServiceException_1 = require_SFNServiceException(); - Object.defineProperty(exports2, "SFNServiceException", { enumerable: true, get: function() { - return SFNServiceException_1.SFNServiceException; - } }); + CreateActivityCommand, + CreateStateMachineCommand, + CreateStateMachineAliasCommand, + DeleteActivityCommand, + DeleteStateMachineCommand, + DeleteStateMachineAliasCommand, + DeleteStateMachineVersionCommand, + DescribeActivityCommand, + DescribeExecutionCommand, + DescribeMapRunCommand, + DescribeStateMachineCommand, + DescribeStateMachineAliasCommand, + DescribeStateMachineForExecutionCommand, + GetActivityTaskCommand, + GetExecutionHistoryCommand, + ListActivitiesCommand, + ListExecutionsCommand, + ListMapRunsCommand, + ListStateMachineAliasesCommand, + ListStateMachinesCommand, + ListStateMachineVersionsCommand, + ListTagsForResourceCommand, + PublishStateMachineVersionCommand, + RedriveExecutionCommand, + SendTaskFailureCommand, + SendTaskHeartbeatCommand, + SendTaskSuccessCommand, + StartExecutionCommand, + StartSyncExecutionCommand, + StopExecutionCommand, + TagResourceCommand, + TestStateCommand, + UntagResourceCommand, + UpdateMapRunCommand, + UpdateStateMachineCommand, + UpdateStateMachineAliasCommand, + ValidateStateMachineDefinitionCommand + }; + var _SFN = class _SFN extends SFNClient { + }; + __name(_SFN, "SFN"); + var SFN2 = _SFN; + (0, import_smithy_client5.createAggregatedClient)(commands, SFN2); + var paginateGetExecutionHistory = (0, import_core3.createPaginator)(SFNClient, GetExecutionHistoryCommand, "nextToken", "nextToken", "maxResults"); + var paginateListActivities = (0, import_core3.createPaginator)(SFNClient, ListActivitiesCommand, "nextToken", "nextToken", "maxResults"); + var paginateListExecutions = (0, import_core3.createPaginator)(SFNClient, ListExecutionsCommand, "nextToken", "nextToken", "maxResults"); + var paginateListMapRuns = (0, import_core3.createPaginator)(SFNClient, ListMapRunsCommand, "nextToken", "nextToken", "maxResults"); + var paginateListStateMachines = (0, import_core3.createPaginator)(SFNClient, ListStateMachinesCommand, "nextToken", "nextToken", "maxResults"); } }); // ../../../node_modules/webidl-conversions/lib/index.js -var require_lib2 = __commonJS({ +var require_lib = __commonJS({ "../../../node_modules/webidl-conversions/lib/index.js"(exports2, module2) { "use strict"; var conversions = {}; @@ -22866,7 +26560,7 @@ var require_lib2 = __commonJS({ }); // ../../../node_modules/whatwg-url/lib/utils.js -var require_utils2 = __commonJS({ +var require_utils = __commonJS({ "../../../node_modules/whatwg-url/lib/utils.js"(exports2, module2) { "use strict"; module2.exports.mixin = function mixin(target, source) { @@ -24287,8 +27981,8 @@ var require_URL_impl = __commonJS({ var require_URL = __commonJS({ "../../../node_modules/whatwg-url/lib/URL.js"(exports2, module2) { "use strict"; - var conversions = require_lib2(); - var utils = require_utils2(); + var conversions = require_lib(); + var utils = require_utils(); var Impl = require_URL_impl(); var impl = utils.implSymbol; function URL3(url2) { @@ -27998,7 +31692,7 @@ var require_streams = __commonJS({ }); // ../../../node_modules/iconv-lite/lib/index.js -var require_lib3 = __commonJS({ +var require_lib2 = __commonJS({ "../../../node_modules/iconv-lite/lib/index.js"(exports2, module2) { "use strict"; var Buffer2 = require_safer().Buffer; @@ -28121,7 +31815,7 @@ var require_lib3 = __commonJS({ var require_encoding = __commonJS({ "../../../node_modules/encoding/lib/encoding.js"(exports2, module2) { "use strict"; - var iconvLite = require_lib3(); + var iconvLite = require_lib2(); module2.exports.convert = convert; function convert(str, to, from) { from = checkEncoding(from || "UTF-8"); @@ -28166,7 +31860,7 @@ var require_encoding = __commonJS({ }); // ../../../node_modules/node-fetch/lib/index.js -var require_lib4 = __commonJS({ +var require_lib3 = __commonJS({ "../../../node_modules/node-fetch/lib/index.js"(exports2, module2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); @@ -28182,7 +31876,7 @@ var require_lib4 = __commonJS({ var Readable = Stream.Readable; var BUFFER = Symbol("buffer"); var TYPE = Symbol("type"); - var Blob = class _Blob { + var Blob2 = class _Blob { constructor() { this[TYPE] = ""; const blobParts = arguments[0]; @@ -28268,12 +31962,12 @@ var require_lib4 = __commonJS({ return blob; } }; - Object.defineProperties(Blob.prototype, { + Object.defineProperties(Blob2.prototype, { size: { enumerable: true }, type: { enumerable: true }, slice: { enumerable: true } }); - Object.defineProperty(Blob.prototype, Symbol.toStringTag, { + Object.defineProperty(Blob2.prototype, Symbol.toStringTag, { value: "Blob", writable: false, enumerable: false, @@ -28359,7 +32053,7 @@ var require_lib4 = __commonJS({ return consumeBody.call(this).then(function(buf) { return Object.assign( // Prevent copying - new Blob([], { + new Blob2([], { type: ct.toLowerCase() }), { @@ -28637,7 +32331,7 @@ var require_lib4 = __commonJS({ return void 0; } var MAP = Symbol("map"); - var Headers = class _Headers { + var Headers2 = class _Headers { /** * Headers class * @@ -28815,14 +32509,14 @@ var require_lib4 = __commonJS({ return createHeadersIterator(this, "key+value"); } }; - Headers.prototype.entries = Headers.prototype[Symbol.iterator]; - Object.defineProperty(Headers.prototype, Symbol.toStringTag, { + Headers2.prototype.entries = Headers2.prototype[Symbol.iterator]; + Object.defineProperty(Headers2.prototype, Symbol.toStringTag, { value: "Headers", writable: false, enumerable: false, configurable: true }); - Object.defineProperties(Headers.prototype, { + Object.defineProperties(Headers2.prototype, { get: { enumerable: true }, forEach: { enumerable: true }, set: { enumerable: true }, @@ -28891,7 +32585,7 @@ var require_lib4 = __commonJS({ return obj; } function createHeadersLenient(obj) { - const headers = new Headers(); + const headers = new Headers2(); for (const name of Object.keys(obj)) { if (invalidTokenRegex.test(name)) { continue; @@ -28921,7 +32615,7 @@ var require_lib4 = __commonJS({ let opts = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}; Body.call(this, body, opts); const status = opts.status || 200; - const headers = new Headers(opts.headers); + const headers = new Headers2(opts.headers); if (body != null && !headers.has("Content-Type")) { const contentType = extractContentType(body); if (contentType) { @@ -29007,7 +32701,7 @@ var require_lib4 = __commonJS({ const proto = signal && typeof signal === "object" && Object.getPrototypeOf(signal); return !!(proto && proto.constructor.name === "AbortSignal"); } - var Request = class _Request { + var Request2 = class _Request { constructor(input) { let init = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}; let parsedURL; @@ -29031,7 +32725,7 @@ var require_lib4 = __commonJS({ timeout: init.timeout || input.timeout || 0, size: init.size || input.size || 0 }); - const headers = new Headers(init.headers || input.headers || {}); + const headers = new Headers2(init.headers || input.headers || {}); if (inputBody != null && !headers.has("Content-Type")) { const contentType = extractContentType(inputBody); if (contentType) { @@ -29079,14 +32773,14 @@ var require_lib4 = __commonJS({ return new _Request(this); } }; - Body.mixIn(Request.prototype); - Object.defineProperty(Request.prototype, Symbol.toStringTag, { + Body.mixIn(Request2.prototype); + Object.defineProperty(Request2.prototype, Symbol.toStringTag, { value: "Request", writable: false, enumerable: false, configurable: true }); - Object.defineProperties(Request.prototype, { + Object.defineProperties(Request2.prototype, { method: { enumerable: true }, url: { enumerable: true }, headers: { enumerable: true }, @@ -29096,7 +32790,7 @@ var require_lib4 = __commonJS({ }); function getNodeRequestOptions(request2) { const parsedURL = request2[INTERNALS$2].parsedURL; - const headers = new Headers(request2[INTERNALS$2].headers); + const headers = new Headers2(request2[INTERNALS$2].headers); if (!headers.has("Accept")) { headers.set("Accept", "*/*"); } @@ -29159,13 +32853,13 @@ var require_lib4 = __commonJS({ const dest = new URL$1(destination).protocol; return orig === dest; }; - function fetch2(url2, opts) { - if (!fetch2.Promise) { + function fetch3(url2, opts) { + if (!fetch3.Promise) { throw new Error("native promise missing, set fetch.Promise to your favorite alternative"); } - Body.Promise = fetch2.Promise; - return new fetch2.Promise(function(resolve, reject) { - const request2 = new Request(url2, opts); + Body.Promise = fetch3.Promise; + return new fetch3.Promise(function(resolve, reject) { + const request2 = new Request2(url2, opts); const options = getNodeRequestOptions(request2); const send = (options.protocol === "https:" ? https2 : http).request; const signal = request2.signal; @@ -29235,7 +32929,7 @@ var require_lib4 = __commonJS({ req.on("response", function(res) { clearTimeout(reqTimeout); const headers = createHeadersLenient(res.headers); - if (fetch2.isRedirect(res.statusCode)) { + if (fetch3.isRedirect(res.statusCode)) { const location = headers.get("Location"); let locationURL = null; try { @@ -29271,7 +32965,7 @@ var require_lib4 = __commonJS({ return; } const requestOpts = { - headers: new Headers(request2.headers), + headers: new Headers2(request2.headers), follow: request2.follow, counter: request2.counter + 1, agent: request2.agent, @@ -29297,7 +32991,7 @@ var require_lib4 = __commonJS({ requestOpts.body = void 0; requestOpts.headers.delete("content-length"); } - resolve(fetch2(new Request(locationURL, requestOpts))); + resolve(fetch3(new Request2(locationURL, requestOpts))); finalize(); return; } @@ -29389,15 +33083,15 @@ var require_lib4 = __commonJS({ stream.end(); } } - fetch2.isRedirect = function(code) { + fetch3.isRedirect = function(code) { return code === 301 || code === 302 || code === 303 || code === 307 || code === 308; }; - fetch2.Promise = global.Promise; - module2.exports = exports2 = fetch2; + fetch3.Promise = global.Promise; + module2.exports = exports2 = fetch3; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.default = exports2; - exports2.Headers = Headers; - exports2.Request = Request; + exports2.Headers = Headers2; + exports2.Request = Request2; exports2.Response = Response2; exports2.FetchError = FetchError; exports2.AbortError = AbortError; @@ -30992,7 +34686,7 @@ var init_api_call = __esm({ }); // ../aws-custom-resource-sdk-adapter/lib/index.js -var require_lib5 = __commonJS({ +var require_lib4 = __commonJS({ "../aws-custom-resource-sdk-adapter/lib/index.js"(exports2) { "use strict"; var __createBinding2 = exports2 && exports2.__createBinding || (Object.create ? function(o, m, k, k2) { @@ -31047,11 +34741,12 @@ var import_helpers_internal = __toESM(require_helpers_internal()); // lib/assertions/providers/lambda-handler/base.ts var https = __toESM(require("https")); var url = __toESM(require("url")); -var import_client_sfn = __toESM(require_dist_cjs52()); +var import_client_sfn = __toESM(require_dist_cjs80()); var CustomResourceHandler = class { constructor(event, context) { this.event = event; this.context = context; + this.timedOut = false; this.timeout = setTimeout(async () => { await this.respond({ status: "FAILED", @@ -31063,9 +34758,6 @@ var CustomResourceHandler = class { this.event = event; this.physicalResourceId = extractPhysicalResourceId(event); } - physicalResourceId; - timeout; - timedOut = false; /** * Handles executing the custom resource event. If `stateMachineArn` is present * in the props then trigger the waiter statemachine @@ -31199,7 +34891,6 @@ var AssertionHandler = class extends CustomResourceHandler { } }; var MatchCreator = class { - parsedObj; constructor(obj) { this.parsedObj = { matcher: obj @@ -31303,7 +34994,7 @@ function decodeCall(call) { } // lib/assertions/providers/lambda-handler/http.ts -var import_node_fetch = __toESM(require_lib4()); +var import_node_fetch = __toESM(require_lib3()); var HttpHandler = class extends CustomResourceHandler { async processEvent(request2) { console.log("request", request2); @@ -31326,7 +35017,7 @@ var HttpHandler = class extends CustomResourceHandler { }; // lib/assertions/providers/lambda-handler/sdk.ts -var import_aws_custom_resource_sdk_adapter = __toESM(require_lib5()); +var import_aws_custom_resource_sdk_adapter = __toESM(require_lib4()); // lib/assertions/providers/lambda-handler/utils.ts function deepParseJson(x) { diff --git a/packages/@aws-cdk/aws-scheduler-targets-alpha/test/integ.lambda-invoke.js.snapshot/aws-cdk-schedule-lambda.assets.json b/packages/@aws-cdk/aws-scheduler-targets-alpha/test/integ.lambda-invoke.js.snapshot/aws-cdk-schedule-lambda.assets.json new file mode 100644 index 0000000000000..823f111659d45 --- /dev/null +++ b/packages/@aws-cdk/aws-scheduler-targets-alpha/test/integ.lambda-invoke.js.snapshot/aws-cdk-schedule-lambda.assets.json @@ -0,0 +1,32 @@ +{ + "version": "38.0.1", + "files": { + "7f6fc8a416807b6be0ca2397479cd45d43dfe989a95bc81708f269e993296d34": { + "source": { + "path": "asset.7f6fc8a416807b6be0ca2397479cd45d43dfe989a95bc81708f269e993296d34.handler", + "packaging": "zip" + }, + "destinations": { + "current_account-current_region": { + "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", + "objectKey": "7f6fc8a416807b6be0ca2397479cd45d43dfe989a95bc81708f269e993296d34.zip", + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" + } + } + }, + "be833ee096af567e7c39c110f906891002888273cb55fdc71d72997bde436ab9": { + "source": { + "path": "aws-cdk-schedule-lambda.template.json", + "packaging": "file" + }, + "destinations": { + "current_account-current_region": { + "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", + "objectKey": "be833ee096af567e7c39c110f906891002888273cb55fdc71d72997bde436ab9.json", + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" + } + } + } + }, + "dockerImages": {} +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-scheduler-targets-alpha/test/integ.lambda-invoke.js.snapshot/aws-cdk-schedule-lambda.template.json b/packages/@aws-cdk/aws-scheduler-targets-alpha/test/integ.lambda-invoke.js.snapshot/aws-cdk-schedule-lambda.template.json new file mode 100644 index 0000000000000..08e63f8cbcf56 --- /dev/null +++ b/packages/@aws-cdk/aws-scheduler-targets-alpha/test/integ.lambda-invoke.js.snapshot/aws-cdk-schedule-lambda.template.json @@ -0,0 +1,139 @@ +{ + "Resources": { + "MyLambdaServiceRole4539ECB6": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "lambda.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + }, + "ManagedPolicyArns": [ + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" + ] + ] + } + ] + } + }, + "MyLambdaServiceRoleDefaultPolicy5BBC6F68": { + "Type": "AWS::IAM::Policy", + "Properties": { + "PolicyDocument": { + "Statement": [ + { + "Action": "lambda:TagResource", + "Effect": "Allow", + "Resource": "*" + } + ], + "Version": "2012-10-17" + }, + "PolicyName": "MyLambdaServiceRoleDefaultPolicy5BBC6F68", + "Roles": [ + { + "Ref": "MyLambdaServiceRole4539ECB6" + } + ] + } + }, + "MyLambdaCCE802FB": { + "Type": "AWS::Lambda::Function", + "Properties": { + "Code": { + "S3Bucket": { + "Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}" + }, + "S3Key": "7f6fc8a416807b6be0ca2397479cd45d43dfe989a95bc81708f269e993296d34.zip" + }, + "Environment": { + "Variables": { + "FUNC_ARN": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":lambda:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":function:FirstSelfTaggingLambda" + ] + ] + } + } + }, + "FunctionName": "FirstSelfTaggingLambda", + "Handler": "index.handler", + "Role": { + "Fn::GetAtt": [ + "MyLambdaServiceRole4539ECB6", + "Arn" + ] + }, + "Runtime": "nodejs18.x", + "Timeout": 30 + }, + "DependsOn": [ + "MyLambdaServiceRoleDefaultPolicy5BBC6F68", + "MyLambdaServiceRole4539ECB6" + ] + } + }, + "Parameters": { + "BootstrapVersion": { + "Type": "AWS::SSM::Parameter::Value", + "Default": "/cdk-bootstrap/hnb659fds/version", + "Description": "Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]" + } + }, + "Rules": { + "CheckBootstrapVersion": { + "Assertions": [ + { + "Assert": { + "Fn::Not": [ + { + "Fn::Contains": [ + [ + "1", + "2", + "3", + "4", + "5" + ], + { + "Ref": "BootstrapVersion" + } + ] + } + ] + }, + "AssertDescription": "CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI." + } + ] + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-scheduler-targets-alpha/test/integ.lambda-invoke.js.snapshot/aws-cdk-schedule.assets.json b/packages/@aws-cdk/aws-scheduler-targets-alpha/test/integ.lambda-invoke.js.snapshot/aws-cdk-schedule.assets.json index 91cf1e99afd3e..d208fe31871d5 100644 --- a/packages/@aws-cdk/aws-scheduler-targets-alpha/test/integ.lambda-invoke.js.snapshot/aws-cdk-schedule.assets.json +++ b/packages/@aws-cdk/aws-scheduler-targets-alpha/test/integ.lambda-invoke.js.snapshot/aws-cdk-schedule.assets.json @@ -1,5 +1,5 @@ { - "version": "36.0.0", + "version": "38.0.1", "files": { "7f6fc8a416807b6be0ca2397479cd45d43dfe989a95bc81708f269e993296d34": { "source": { @@ -14,7 +14,7 @@ } } }, - "999dc2fc3701af82856f5e22b1837fa360a4730eb16cf047b9cf97b1050c1089": { + "a659d0e16232815135c40f60ac6045cae13287002f893f68edae8d5e9e5ef4b9": { "source": { "path": "aws-cdk-schedule.template.json", "packaging": "file" @@ -22,7 +22,7 @@ "destinations": { "current_account-current_region": { "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", - "objectKey": "999dc2fc3701af82856f5e22b1837fa360a4730eb16cf047b9cf97b1050c1089.json", + "objectKey": "a659d0e16232815135c40f60ac6045cae13287002f893f68edae8d5e9e5ef4b9.json", "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" } } diff --git a/packages/@aws-cdk/aws-scheduler-targets-alpha/test/integ.lambda-invoke.js.snapshot/aws-cdk-schedule.template.json b/packages/@aws-cdk/aws-scheduler-targets-alpha/test/integ.lambda-invoke.js.snapshot/aws-cdk-schedule.template.json index 7d82a52fa3649..f56e65ac425f4 100644 --- a/packages/@aws-cdk/aws-scheduler-targets-alpha/test/integ.lambda-invoke.js.snapshot/aws-cdk-schedule.template.json +++ b/packages/@aws-cdk/aws-scheduler-targets-alpha/test/integ.lambda-invoke.js.snapshot/aws-cdk-schedule.template.json @@ -1,5 +1,155 @@ { "Resources": { + "ScheduleWithImportedLambda1C2110DF": { + "Type": "AWS::Scheduler::Schedule", + "Properties": { + "FlexibleTimeWindow": { + "Mode": "OFF" + }, + "ScheduleExpression": "rate(1 minute)", + "ScheduleExpressionTimezone": "Etc/UTC", + "State": "ENABLED", + "Target": { + "Arn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":lambda:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":function:FirstSelfTaggingLambda" + ] + ] + }, + "Input": "\"importedLambdaTagValue\"", + "RetryPolicy": { + "MaximumEventAgeInSeconds": 86400, + "MaximumRetryAttempts": 185 + }, + "RoleArn": { + "Fn::GetAtt": [ + "SchedulerRoleForTarget1441a743A31888", + "Arn" + ] + } + } + } + }, + "SchedulerRoleForTarget1441a743A31888": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Condition": { + "StringEquals": { + "aws:SourceAccount": { + "Ref": "AWS::AccountId" + } + } + }, + "Effect": "Allow", + "Principal": { + "Service": "scheduler.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + } + } + }, + "SchedulerRoleForTarget1441a7DefaultPolicy885B6BFD": { + "Type": "AWS::IAM::Policy", + "Properties": { + "PolicyDocument": { + "Statement": [ + { + "Action": "lambda:InvokeFunction", + "Effect": "Allow", + "Resource": [ + { + "Fn::GetAtt": [ + "MyLambdaCCE802FB", + "Arn" + ] + }, + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":lambda:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":function:FirstSelfTaggingLambda" + ] + ] + }, + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":lambda:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":function:FirstSelfTaggingLambda:*" + ] + ] + }, + { + "Fn::Join": [ + "", + [ + { + "Fn::GetAtt": [ + "MyLambdaCCE802FB", + "Arn" + ] + }, + ":*" + ] + ] + } + ] + } + ], + "Version": "2012-10-17" + }, + "PolicyName": "SchedulerRoleForTarget1441a7DefaultPolicy885B6BFD", + "Roles": [ + { + "Ref": "SchedulerRoleForTarget1441a743A31888" + } + ] + } + }, "MyLambdaServiceRole4539ECB6": { "Type": "AWS::IAM::Role", "Properties": { @@ -79,13 +229,13 @@ { "Ref": "AWS::AccountId" }, - ":function:TestSchedulerLambdaInvokeTarget" + ":function:SecondSelfTaggingLambda" ] ] } } }, - "FunctionName": "TestSchedulerLambdaInvokeTarget", + "FunctionName": "SecondSelfTaggingLambda", "Handler": "index.handler", "Role": { "Fn::GetAtt": [ @@ -101,7 +251,7 @@ "MyLambdaServiceRole4539ECB6" ] }, - "Schedule83A77FD1": { + "ScheduleWithSameStackLambda41F66AE8": { "Type": "AWS::Scheduler::Schedule", "Properties": { "FlexibleTimeWindow": { @@ -117,7 +267,7 @@ "Arn" ] }, - "Input": "\"test\"", + "Input": "\"sameStackLambdaTagValue\"", "RetryPolicy": { "MaximumEventAgeInSeconds": 86400, "MaximumRetryAttempts": 185 @@ -131,73 +281,7 @@ } } }, - "SchedulerRoleForTarget1441a743A31888": { - "Type": "AWS::IAM::Role", - "Properties": { - "AssumeRolePolicyDocument": { - "Statement": [ - { - "Action": "sts:AssumeRole", - "Condition": { - "StringEquals": { - "aws:SourceAccount": { - "Ref": "AWS::AccountId" - } - } - }, - "Effect": "Allow", - "Principal": { - "Service": "scheduler.amazonaws.com" - } - } - ], - "Version": "2012-10-17" - } - } - }, - "SchedulerRoleForTarget1441a7DefaultPolicy885B6BFD": { - "Type": "AWS::IAM::Policy", - "Properties": { - "PolicyDocument": { - "Statement": [ - { - "Action": "lambda:InvokeFunction", - "Effect": "Allow", - "Resource": [ - { - "Fn::GetAtt": [ - "MyLambdaCCE802FB", - "Arn" - ] - }, - { - "Fn::Join": [ - "", - [ - { - "Fn::GetAtt": [ - "MyLambdaCCE802FB", - "Arn" - ] - }, - ":*" - ] - ] - } - ] - } - ], - "Version": "2012-10-17" - }, - "PolicyName": "SchedulerRoleForTarget1441a7DefaultPolicy885B6BFD", - "Roles": [ - { - "Ref": "SchedulerRoleForTarget1441a743A31888" - } - ] - } - }, - "Schedule2750DFBB1": { + "ScheduleWithStaticDate9FC69014": { "Type": "AWS::Scheduler::Schedule", "Properties": { "FlexibleTimeWindow": { @@ -227,19 +311,6 @@ } } }, - "Outputs": { - "ExportsOutputFnGetAttMyLambdaCCE802FBArn91287F74": { - "Value": { - "Fn::GetAtt": [ - "MyLambdaCCE802FB", - "Arn" - ] - }, - "Export": { - "Name": "aws-cdk-schedule:ExportsOutputFnGetAttMyLambdaCCE802FBArn91287F74" - } - } - }, "Parameters": { "BootstrapVersion": { "Type": "AWS::SSM::Parameter::Value", diff --git a/packages/@aws-cdk/aws-scheduler-targets-alpha/test/integ.lambda-invoke.js.snapshot/cdk.out b/packages/@aws-cdk/aws-scheduler-targets-alpha/test/integ.lambda-invoke.js.snapshot/cdk.out index 1f0068d32659a..c6e612584e352 100644 --- a/packages/@aws-cdk/aws-scheduler-targets-alpha/test/integ.lambda-invoke.js.snapshot/cdk.out +++ b/packages/@aws-cdk/aws-scheduler-targets-alpha/test/integ.lambda-invoke.js.snapshot/cdk.out @@ -1 +1 @@ -{"version":"36.0.0"} \ No newline at end of file +{"version":"38.0.1"} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-scheduler-targets-alpha/test/integ.lambda-invoke.js.snapshot/integ.json b/packages/@aws-cdk/aws-scheduler-targets-alpha/test/integ.lambda-invoke.js.snapshot/integ.json index 478ac7e280963..245f481dea6a2 100644 --- a/packages/@aws-cdk/aws-scheduler-targets-alpha/test/integ.lambda-invoke.js.snapshot/integ.json +++ b/packages/@aws-cdk/aws-scheduler-targets-alpha/test/integ.lambda-invoke.js.snapshot/integ.json @@ -1,5 +1,5 @@ { - "version": "36.0.0", + "version": "38.0.1", "testCases": { "integtest-lambda-invoke/DefaultTest": { "stacks": [ diff --git a/packages/@aws-cdk/aws-scheduler-targets-alpha/test/integ.lambda-invoke.js.snapshot/integtestlambdainvokeDefaultTestDeployAssertEC6565E6.assets.json b/packages/@aws-cdk/aws-scheduler-targets-alpha/test/integ.lambda-invoke.js.snapshot/integtestlambdainvokeDefaultTestDeployAssertEC6565E6.assets.json index 2123029a95082..ed6bef1660d69 100644 --- a/packages/@aws-cdk/aws-scheduler-targets-alpha/test/integ.lambda-invoke.js.snapshot/integtestlambdainvokeDefaultTestDeployAssertEC6565E6.assets.json +++ b/packages/@aws-cdk/aws-scheduler-targets-alpha/test/integ.lambda-invoke.js.snapshot/integtestlambdainvokeDefaultTestDeployAssertEC6565E6.assets.json @@ -1,20 +1,20 @@ { - "version": "36.0.0", + "version": "38.0.1", "files": { - "eafc02f6925151c95ac6a6ae81a3e36d4cf4e77db52eec8e467ce2a69454a41a": { + "e77649078c9dea5bbb707b7fe68014cfa5d919a38d31b467f6a205b51ea63a83": { "source": { - "path": "asset.eafc02f6925151c95ac6a6ae81a3e36d4cf4e77db52eec8e467ce2a69454a41a.bundle", + "path": "asset.e77649078c9dea5bbb707b7fe68014cfa5d919a38d31b467f6a205b51ea63a83.bundle", "packaging": "zip" }, "destinations": { "current_account-current_region": { "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", - "objectKey": "eafc02f6925151c95ac6a6ae81a3e36d4cf4e77db52eec8e467ce2a69454a41a.zip", + "objectKey": "e77649078c9dea5bbb707b7fe68014cfa5d919a38d31b467f6a205b51ea63a83.zip", "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" } } }, - "2125a43ef383820f4e6b47f40aef7c18bae12b2dc5cce3d493f9dd1898d5259d": { + "02d1ab525daaf145591856547abf91ecf627687732633fdbcbc496886fa476c8": { "source": { "path": "integtestlambdainvokeDefaultTestDeployAssertEC6565E6.template.json", "packaging": "file" @@ -22,7 +22,7 @@ "destinations": { "current_account-current_region": { "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", - "objectKey": "2125a43ef383820f4e6b47f40aef7c18bae12b2dc5cce3d493f9dd1898d5259d.json", + "objectKey": "02d1ab525daaf145591856547abf91ecf627687732633fdbcbc496886fa476c8.json", "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" } } diff --git a/packages/@aws-cdk/aws-scheduler-targets-alpha/test/integ.lambda-invoke.js.snapshot/integtestlambdainvokeDefaultTestDeployAssertEC6565E6.template.json b/packages/@aws-cdk/aws-scheduler-targets-alpha/test/integ.lambda-invoke.js.snapshot/integtestlambdainvokeDefaultTestDeployAssertEC6565E6.template.json index 11e6a7a4c1512..5ce528892e8ae 100644 --- a/packages/@aws-cdk/aws-scheduler-targets-alpha/test/integ.lambda-invoke.js.snapshot/integtestlambdainvokeDefaultTestDeployAssertEC6565E6.template.json +++ b/packages/@aws-cdk/aws-scheduler-targets-alpha/test/integ.lambda-invoke.js.snapshot/integtestlambdainvokeDefaultTestDeployAssertEC6565E6.template.json @@ -1,6 +1,6 @@ { "Resources": { - "AwsApiCallLambdalistTags945cd5006c8a66eb7345b9b56ea54068": { + "AwsApiCallLambdalistTagsfa577ce284ecabe6c15ac48d4f4b77f5": { "Type": "Custom::DeployAssert@SdkCallLambdalistTags", "Properties": { "ServiceToken": { @@ -11,31 +11,39 @@ }, "service": "Lambda", "api": "listTags", - "expected": "{\"$ObjectLike\":{\"Tags\":{\"OutputValue\":\"InRlc3Qi\"}}}", + "expected": "{\"$ObjectLike\":{\"Tags\":{\"OutputValue\":\"ImltcG9ydGVkTGFtYmRhVGFnVmFsdWUi\"}}}", "stateMachineArn": { - "Ref": "AwsApiCallLambdalistTags945cd5006c8a66eb7345b9b56ea54068WaitFor1F6E5BE8" + "Ref": "AwsApiCallLambdalistTagsfa577ce284ecabe6c15ac48d4f4b77f5WaitForDC36C07E" }, "parameters": { "Resource": { "Fn::Join": [ "", [ - "\"", + "\"arn:", { - "Fn::ImportValue": "aws-cdk-schedule:ExportsOutputFnGetAttMyLambdaCCE802FBArn91287F74" + "Ref": "AWS::Partition" }, - "\"" + ":lambda:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":function:FirstSelfTaggingLambda\"" ] ] } }, "flattenResponse": "false", - "salt": "1719212944641" + "salt": "1729535442276" }, "UpdateReplacePolicy": "Delete", "DeletionPolicy": "Delete" }, - "AwsApiCallLambdalistTags945cd5006c8a66eb7345b9b56ea54068WaitForIsCompleteProviderInvoke3952D0F2": { + "AwsApiCallLambdalistTagsfa577ce284ecabe6c15ac48d4f4b77f5WaitForIsCompleteProviderInvoke660A76A6": { "Type": "AWS::Lambda::Permission", "Properties": { "Action": "lambda:InvokeFunction", @@ -47,13 +55,13 @@ }, "Principal": { "Fn::GetAtt": [ - "AwsApiCallLambdalistTags945cd5006c8a66eb7345b9b56ea54068WaitForRole9ECC1C92", + "AwsApiCallLambdalistTagsfa577ce284ecabe6c15ac48d4f4b77f5WaitForRole10BE3E13", "Arn" ] } } }, - "AwsApiCallLambdalistTags945cd5006c8a66eb7345b9b56ea54068WaitForTimeoutProviderInvoke8BE88C64": { + "AwsApiCallLambdalistTagsfa577ce284ecabe6c15ac48d4f4b77f5WaitForTimeoutProviderInvoke41B0F0A8": { "Type": "AWS::Lambda::Permission", "Properties": { "Action": "lambda:InvokeFunction", @@ -65,13 +73,13 @@ }, "Principal": { "Fn::GetAtt": [ - "AwsApiCallLambdalistTags945cd5006c8a66eb7345b9b56ea54068WaitForRole9ECC1C92", + "AwsApiCallLambdalistTagsfa577ce284ecabe6c15ac48d4f4b77f5WaitForRole10BE3E13", "Arn" ] } } }, - "AwsApiCallLambdalistTags945cd5006c8a66eb7345b9b56ea54068WaitForRole9ECC1C92": { + "AwsApiCallLambdalistTagsfa577ce284ecabe6c15ac48d4f4b77f5WaitForRole10BE3E13": { "Type": "AWS::IAM::Role", "Properties": { "AssumeRolePolicyDocument": { @@ -116,14 +124,14 @@ ] } }, - "AwsApiCallLambdalistTags945cd5006c8a66eb7345b9b56ea54068WaitFor1F6E5BE8": { + "AwsApiCallLambdalistTagsfa577ce284ecabe6c15ac48d4f4b77f5WaitForDC36C07E": { "Type": "AWS::StepFunctions::StateMachine", "Properties": { "DefinitionString": { "Fn::Join": [ "", [ - "{\"StartAt\":\"framework-isComplete-task\",\"States\":{\"framework-isComplete-task\":{\"End\":true,\"Retry\":[{\"ErrorEquals\":[\"States.ALL\"],\"IntervalSeconds\":5,\"MaxAttempts\":120,\"BackoffRate\":1}],\"Catch\":[{\"ErrorEquals\":[\"States.ALL\"],\"Next\":\"framework-onTimeout-task\"}],\"Type\":\"Task\",\"Resource\":\"", + "{\"StartAt\":\"framework-isComplete-task\",\"States\":{\"framework-isComplete-task\":{\"End\":true,\"Retry\":[{\"ErrorEquals\":[\"States.ALL\"],\"IntervalSeconds\":10,\"MaxAttempts\":60,\"BackoffRate\":1}],\"Catch\":[{\"ErrorEquals\":[\"States.ALL\"],\"Next\":\"framework-onTimeout-task\"}],\"Type\":\"Task\",\"Resource\":\"", { "Fn::GetAtt": [ "SingletonFunction76b3e830a873425f8453eddd85c86925Handler81461ECE", @@ -143,13 +151,13 @@ }, "RoleArn": { "Fn::GetAtt": [ - "AwsApiCallLambdalistTags945cd5006c8a66eb7345b9b56ea54068WaitForRole9ECC1C92", + "AwsApiCallLambdalistTagsfa577ce284ecabe6c15ac48d4f4b77f5WaitForRole10BE3E13", "Arn" ] } }, "DependsOn": [ - "AwsApiCallLambdalistTags945cd5006c8a66eb7345b9b56ea54068WaitForRole9ECC1C92" + "AwsApiCallLambdalistTagsfa577ce284ecabe6c15ac48d4f4b77f5WaitForRole10BE3E13" ] }, "SingletonFunction1488541a7b23466481b69b4408076b81Role37ABCE73": { @@ -178,6 +186,24 @@ "PolicyDocument": { "Version": "2012-10-17", "Statement": [ + { + "Action": [ + "lambda:ListTags" + ], + "Effect": "Allow", + "Resource": [ + "*" + ] + }, + { + "Action": [ + "states:StartExecution" + ], + "Effect": "Allow", + "Resource": [ + "*" + ] + }, { "Action": [ "lambda:ListTags" @@ -218,7 +244,7 @@ "S3Bucket": { "Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}" }, - "S3Key": "eafc02f6925151c95ac6a6ae81a3e36d4cf4e77db52eec8e467ce2a69454a41a.zip" + "S3Key": "e77649078c9dea5bbb707b7fe68014cfa5d919a38d31b467f6a205b51ea63a83.zip" }, "Timeout": 120, "Handler": "index.handler", @@ -256,6 +282,15 @@ "PolicyDocument": { "Version": "2012-10-17", "Statement": [ + { + "Action": [ + "lambda:ListTags" + ], + "Effect": "Allow", + "Resource": [ + "*" + ] + }, { "Action": [ "lambda:ListTags" @@ -287,7 +322,7 @@ "S3Bucket": { "Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}" }, - "S3Key": "eafc02f6925151c95ac6a6ae81a3e36d4cf4e77db52eec8e467ce2a69454a41a.zip" + "S3Key": "e77649078c9dea5bbb707b7fe68014cfa5d919a38d31b467f6a205b51ea63a83.zip" }, "Timeout": 120, "Handler": "index.isComplete", @@ -337,7 +372,7 @@ "S3Bucket": { "Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}" }, - "S3Key": "eafc02f6925151c95ac6a6ae81a3e36d4cf4e77db52eec8e467ce2a69454a41a.zip" + "S3Key": "e77649078c9dea5bbb707b7fe68014cfa5d919a38d31b467f6a205b51ea63a83.zip" }, "Timeout": 120, "Handler": "index.onTimeout", @@ -348,13 +383,181 @@ ] } } + }, + "AwsApiCallLambdalistTagsc9aff8891471a47d011153d8741b2276": { + "Type": "Custom::DeployAssert@SdkCallLambdalistTags", + "Properties": { + "ServiceToken": { + "Fn::GetAtt": [ + "SingletonFunction1488541a7b23466481b69b4408076b81HandlerCD40AE9F", + "Arn" + ] + }, + "service": "Lambda", + "api": "listTags", + "expected": "{\"$ObjectLike\":{\"Tags\":{\"OutputValue\":\"InNhbWVTdGFja0xhbWJkYVRhZ1ZhbHVlIg==\"}}}", + "stateMachineArn": { + "Ref": "AwsApiCallLambdalistTagsc9aff8891471a47d011153d8741b2276WaitFor0F7A5AD8" + }, + "parameters": { + "Resource": { + "Fn::Join": [ + "", + [ + "\"arn:", + { + "Ref": "AWS::Partition" + }, + ":lambda:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":function:SecondSelfTaggingLambda\"" + ] + ] + } + }, + "flattenResponse": "false", + "salt": "1729535442282" + }, + "UpdateReplacePolicy": "Delete", + "DeletionPolicy": "Delete" + }, + "AwsApiCallLambdalistTagsc9aff8891471a47d011153d8741b2276WaitForIsCompleteProviderInvoke3F067184": { + "Type": "AWS::Lambda::Permission", + "Properties": { + "Action": "lambda:InvokeFunction", + "FunctionName": { + "Fn::GetAtt": [ + "SingletonFunction76b3e830a873425f8453eddd85c86925Handler81461ECE", + "Arn" + ] + }, + "Principal": { + "Fn::GetAtt": [ + "AwsApiCallLambdalistTagsc9aff8891471a47d011153d8741b2276WaitForRole0D010B44", + "Arn" + ] + } + } + }, + "AwsApiCallLambdalistTagsc9aff8891471a47d011153d8741b2276WaitForTimeoutProviderInvoke11B424C0": { + "Type": "AWS::Lambda::Permission", + "Properties": { + "Action": "lambda:InvokeFunction", + "FunctionName": { + "Fn::GetAtt": [ + "SingletonFunction5c1898e096fb4e3e95d5f6c67f3ce41aHandlerADF3E6EA", + "Arn" + ] + }, + "Principal": { + "Fn::GetAtt": [ + "AwsApiCallLambdalistTagsc9aff8891471a47d011153d8741b2276WaitForRole0D010B44", + "Arn" + ] + } + } + }, + "AwsApiCallLambdalistTagsc9aff8891471a47d011153d8741b2276WaitForRole0D010B44": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Version": "2012-10-17", + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "states.amazonaws.com" + } + } + ] + }, + "Policies": [ + { + "PolicyName": "InlineInvokeFunctions", + "PolicyDocument": { + "Version": "2012-10-17", + "Statement": [ + { + "Action": "lambda:InvokeFunction", + "Effect": "Allow", + "Resource": [ + { + "Fn::GetAtt": [ + "SingletonFunction76b3e830a873425f8453eddd85c86925Handler81461ECE", + "Arn" + ] + }, + { + "Fn::GetAtt": [ + "SingletonFunction5c1898e096fb4e3e95d5f6c67f3ce41aHandlerADF3E6EA", + "Arn" + ] + } + ] + } + ] + } + } + ] + } + }, + "AwsApiCallLambdalistTagsc9aff8891471a47d011153d8741b2276WaitFor0F7A5AD8": { + "Type": "AWS::StepFunctions::StateMachine", + "Properties": { + "DefinitionString": { + "Fn::Join": [ + "", + [ + "{\"StartAt\":\"framework-isComplete-task\",\"States\":{\"framework-isComplete-task\":{\"End\":true,\"Retry\":[{\"ErrorEquals\":[\"States.ALL\"],\"IntervalSeconds\":10,\"MaxAttempts\":60,\"BackoffRate\":1}],\"Catch\":[{\"ErrorEquals\":[\"States.ALL\"],\"Next\":\"framework-onTimeout-task\"}],\"Type\":\"Task\",\"Resource\":\"", + { + "Fn::GetAtt": [ + "SingletonFunction76b3e830a873425f8453eddd85c86925Handler81461ECE", + "Arn" + ] + }, + "\"},\"framework-onTimeout-task\":{\"End\":true,\"Type\":\"Task\",\"Resource\":\"", + { + "Fn::GetAtt": [ + "SingletonFunction5c1898e096fb4e3e95d5f6c67f3ce41aHandlerADF3E6EA", + "Arn" + ] + }, + "\"}}}" + ] + ] + }, + "RoleArn": { + "Fn::GetAtt": [ + "AwsApiCallLambdalistTagsc9aff8891471a47d011153d8741b2276WaitForRole0D010B44", + "Arn" + ] + } + }, + "DependsOn": [ + "AwsApiCallLambdalistTagsc9aff8891471a47d011153d8741b2276WaitForRole0D010B44" + ] } }, "Outputs": { - "AssertionResultsAwsApiCallLambdalistTags945cd5006c8a66eb7345b9b56ea54068": { + "AssertionResultsAwsApiCallLambdalistTagsfa577ce284ecabe6c15ac48d4f4b77f5": { "Value": { "Fn::GetAtt": [ - "AwsApiCallLambdalistTags945cd5006c8a66eb7345b9b56ea54068", + "AwsApiCallLambdalistTagsfa577ce284ecabe6c15ac48d4f4b77f5", + "assertion" + ] + } + }, + "AssertionResultsAwsApiCallLambdalistTagsc9aff8891471a47d011153d8741b2276": { + "Value": { + "Fn::GetAtt": [ + "AwsApiCallLambdalistTagsc9aff8891471a47d011153d8741b2276", "assertion" ] } @@ -395,9 +598,18 @@ "ap-southeast-4": { "value": "nodejs20.x" }, + "ap-southeast-5": { + "value": "nodejs20.x" + }, + "ap-southeast-7": { + "value": "nodejs20.x" + }, "ca-central-1": { "value": "nodejs20.x" }, + "ca-west-1": { + "value": "nodejs20.x" + }, "cn-north-1": { "value": "nodejs18.x" }, @@ -410,6 +622,9 @@ "eu-central-2": { "value": "nodejs20.x" }, + "eu-isoe-west-1": { + "value": "nodejs18.x" + }, "eu-north-1": { "value": "nodejs20.x" }, @@ -437,6 +652,9 @@ "me-south-1": { "value": "nodejs20.x" }, + "mx-central-1": { + "value": "nodejs20.x" + }, "sa-east-1": { "value": "nodejs20.x" }, diff --git a/packages/@aws-cdk/aws-scheduler-targets-alpha/test/integ.lambda-invoke.js.snapshot/manifest.json b/packages/@aws-cdk/aws-scheduler-targets-alpha/test/integ.lambda-invoke.js.snapshot/manifest.json index 4f02d619cafcc..befc4b1d88ea9 100644 --- a/packages/@aws-cdk/aws-scheduler-targets-alpha/test/integ.lambda-invoke.js.snapshot/manifest.json +++ b/packages/@aws-cdk/aws-scheduler-targets-alpha/test/integ.lambda-invoke.js.snapshot/manifest.json @@ -1,28 +1,29 @@ { - "version": "36.0.0", + "version": "38.0.1", "artifacts": { - "aws-cdk-schedule.assets": { + "aws-cdk-schedule-lambda.assets": { "type": "cdk:asset-manifest", "properties": { - "file": "aws-cdk-schedule.assets.json", + "file": "aws-cdk-schedule-lambda.assets.json", "requiresBootstrapStackVersion": 6, "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" } }, - "aws-cdk-schedule": { + "aws-cdk-schedule-lambda": { "type": "aws:cloudformation:stack", "environment": "aws://unknown-account/unknown-region", "properties": { - "templateFile": "aws-cdk-schedule.template.json", + "templateFile": "aws-cdk-schedule-lambda.template.json", "terminationProtection": false, "validateOnSynth": false, + "notificationArns": [], "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", - "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/999dc2fc3701af82856f5e22b1837fa360a4730eb16cf047b9cf97b1050c1089.json", + "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/be833ee096af567e7c39c110f906891002888273cb55fdc71d72997bde436ab9.json", "requiresBootstrapStackVersion": 6, "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", "additionalDependencies": [ - "aws-cdk-schedule.assets" + "aws-cdk-schedule-lambda.assets" ], "lookupRole": { "arn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-lookup-role-${AWS::AccountId}-${AWS::Region}", @@ -31,31 +32,81 @@ } }, "dependencies": [ - "aws-cdk-schedule.assets" + "aws-cdk-schedule-lambda.assets" ], "metadata": { - "/aws-cdk-schedule/MyLambda/ServiceRole/Resource": [ + "/aws-cdk-schedule-lambda/MyLambda/ServiceRole/Resource": [ { "type": "aws:cdk:logicalId", "data": "MyLambdaServiceRole4539ECB6" } ], - "/aws-cdk-schedule/MyLambda/ServiceRole/DefaultPolicy/Resource": [ + "/aws-cdk-schedule-lambda/MyLambda/ServiceRole/DefaultPolicy/Resource": [ { "type": "aws:cdk:logicalId", "data": "MyLambdaServiceRoleDefaultPolicy5BBC6F68" } ], - "/aws-cdk-schedule/MyLambda/Resource": [ + "/aws-cdk-schedule-lambda/MyLambda/Resource": [ { "type": "aws:cdk:logicalId", "data": "MyLambdaCCE802FB" } ], - "/aws-cdk-schedule/Schedule/Resource": [ + "/aws-cdk-schedule-lambda/BootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "BootstrapVersion" + } + ], + "/aws-cdk-schedule-lambda/CheckBootstrapVersion": [ { "type": "aws:cdk:logicalId", - "data": "Schedule83A77FD1" + "data": "CheckBootstrapVersion" + } + ] + }, + "displayName": "aws-cdk-schedule-lambda" + }, + "aws-cdk-schedule.assets": { + "type": "cdk:asset-manifest", + "properties": { + "file": "aws-cdk-schedule.assets.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "aws-cdk-schedule": { + "type": "aws:cloudformation:stack", + "environment": "aws://unknown-account/unknown-region", + "properties": { + "templateFile": "aws-cdk-schedule.template.json", + "terminationProtection": false, + "validateOnSynth": false, + "notificationArns": [], + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", + "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", + "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/a659d0e16232815135c40f60ac6045cae13287002f893f68edae8d5e9e5ef4b9.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", + "additionalDependencies": [ + "aws-cdk-schedule.assets" + ], + "lookupRole": { + "arn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-lookup-role-${AWS::AccountId}-${AWS::Region}", + "requiresBootstrapStackVersion": 8, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "dependencies": [ + "aws-cdk-schedule-lambda", + "aws-cdk-schedule.assets" + ], + "metadata": { + "/aws-cdk-schedule/ScheduleWithImportedLambda/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "ScheduleWithImportedLambda1C2110DF" } ], "/aws-cdk-schedule/SchedulerRoleForTarget-1441a7/Resource": [ @@ -70,16 +121,34 @@ "data": "SchedulerRoleForTarget1441a7DefaultPolicy885B6BFD" } ], - "/aws-cdk-schedule/Schedule2/Resource": [ + "/aws-cdk-schedule/MyLambda/ServiceRole/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "MyLambdaServiceRole4539ECB6" + } + ], + "/aws-cdk-schedule/MyLambda/ServiceRole/DefaultPolicy/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "MyLambdaServiceRoleDefaultPolicy5BBC6F68" + } + ], + "/aws-cdk-schedule/MyLambda/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "MyLambdaCCE802FB" + } + ], + "/aws-cdk-schedule/ScheduleWithSameStackLambda/Resource": [ { "type": "aws:cdk:logicalId", - "data": "Schedule2750DFBB1" + "data": "ScheduleWithSameStackLambda41F66AE8" } ], - "/aws-cdk-schedule/Exports/Output{\"Fn::GetAtt\":[\"MyLambdaCCE802FB\",\"Arn\"]}": [ + "/aws-cdk-schedule/ScheduleWithStaticDate/Resource": [ { "type": "aws:cdk:logicalId", - "data": "ExportsOutputFnGetAttMyLambdaCCE802FBArn91287F74" + "data": "ScheduleWithStaticDate9FC69014" } ], "/aws-cdk-schedule/BootstrapVersion": [ @@ -112,9 +181,10 @@ "templateFile": "integtestlambdainvokeDefaultTestDeployAssertEC6565E6.template.json", "terminationProtection": false, "validateOnSynth": false, + "notificationArns": [], "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", - "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/2125a43ef383820f4e6b47f40aef7c18bae12b2dc5cce3d493f9dd1898d5259d.json", + "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/02d1ab525daaf145591856547abf91ecf627687732633fdbcbc496886fa476c8.json", "requiresBootstrapStackVersion": 6, "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", "additionalDependencies": [ @@ -127,44 +197,43 @@ } }, "dependencies": [ - "aws-cdk-schedule", "integtestlambdainvokeDefaultTestDeployAssertEC6565E6.assets" ], "metadata": { - "/integtest-lambda-invoke/DefaultTest/DeployAssert/AwsApiCallLambdalistTags945cd5006c8a66eb7345b9b56ea54068/Default/Default": [ + "/integtest-lambda-invoke/DefaultTest/DeployAssert/AwsApiCallLambdalistTagsfa577ce284ecabe6c15ac48d4f4b77f5/Default/Default": [ { "type": "aws:cdk:logicalId", - "data": "AwsApiCallLambdalistTags945cd5006c8a66eb7345b9b56ea54068" + "data": "AwsApiCallLambdalistTagsfa577ce284ecabe6c15ac48d4f4b77f5" } ], - "/integtest-lambda-invoke/DefaultTest/DeployAssert/AwsApiCallLambdalistTags945cd5006c8a66eb7345b9b56ea54068/WaitFor/IsCompleteProvider/Invoke": [ + "/integtest-lambda-invoke/DefaultTest/DeployAssert/AwsApiCallLambdalistTagsfa577ce284ecabe6c15ac48d4f4b77f5/WaitFor/IsCompleteProvider/Invoke": [ { "type": "aws:cdk:logicalId", - "data": "AwsApiCallLambdalistTags945cd5006c8a66eb7345b9b56ea54068WaitForIsCompleteProviderInvoke3952D0F2" + "data": "AwsApiCallLambdalistTagsfa577ce284ecabe6c15ac48d4f4b77f5WaitForIsCompleteProviderInvoke660A76A6" } ], - "/integtest-lambda-invoke/DefaultTest/DeployAssert/AwsApiCallLambdalistTags945cd5006c8a66eb7345b9b56ea54068/WaitFor/TimeoutProvider/Invoke": [ + "/integtest-lambda-invoke/DefaultTest/DeployAssert/AwsApiCallLambdalistTagsfa577ce284ecabe6c15ac48d4f4b77f5/WaitFor/TimeoutProvider/Invoke": [ { "type": "aws:cdk:logicalId", - "data": "AwsApiCallLambdalistTags945cd5006c8a66eb7345b9b56ea54068WaitForTimeoutProviderInvoke8BE88C64" + "data": "AwsApiCallLambdalistTagsfa577ce284ecabe6c15ac48d4f4b77f5WaitForTimeoutProviderInvoke41B0F0A8" } ], - "/integtest-lambda-invoke/DefaultTest/DeployAssert/AwsApiCallLambdalistTags945cd5006c8a66eb7345b9b56ea54068/WaitFor/Role": [ + "/integtest-lambda-invoke/DefaultTest/DeployAssert/AwsApiCallLambdalistTagsfa577ce284ecabe6c15ac48d4f4b77f5/WaitFor/Role": [ { "type": "aws:cdk:logicalId", - "data": "AwsApiCallLambdalistTags945cd5006c8a66eb7345b9b56ea54068WaitForRole9ECC1C92" + "data": "AwsApiCallLambdalistTagsfa577ce284ecabe6c15ac48d4f4b77f5WaitForRole10BE3E13" } ], - "/integtest-lambda-invoke/DefaultTest/DeployAssert/AwsApiCallLambdalistTags945cd5006c8a66eb7345b9b56ea54068/WaitFor/Resource": [ + "/integtest-lambda-invoke/DefaultTest/DeployAssert/AwsApiCallLambdalistTagsfa577ce284ecabe6c15ac48d4f4b77f5/WaitFor/Resource": [ { "type": "aws:cdk:logicalId", - "data": "AwsApiCallLambdalistTags945cd5006c8a66eb7345b9b56ea54068WaitFor1F6E5BE8" + "data": "AwsApiCallLambdalistTagsfa577ce284ecabe6c15ac48d4f4b77f5WaitForDC36C07E" } ], - "/integtest-lambda-invoke/DefaultTest/DeployAssert/AwsApiCallLambdalistTags945cd5006c8a66eb7345b9b56ea54068/AssertionResults": [ + "/integtest-lambda-invoke/DefaultTest/DeployAssert/AwsApiCallLambdalistTagsfa577ce284ecabe6c15ac48d4f4b77f5/AssertionResults": [ { "type": "aws:cdk:logicalId", - "data": "AssertionResultsAwsApiCallLambdalistTags945cd5006c8a66eb7345b9b56ea54068" + "data": "AssertionResultsAwsApiCallLambdalistTagsfa577ce284ecabe6c15ac48d4f4b77f5" } ], "/integtest-lambda-invoke/DefaultTest/DeployAssert/SingletonFunction1488541a7b23466481b69b4408076b81/Role": [ @@ -209,6 +278,42 @@ "data": "SingletonFunction5c1898e096fb4e3e95d5f6c67f3ce41aHandlerADF3E6EA" } ], + "/integtest-lambda-invoke/DefaultTest/DeployAssert/AwsApiCallLambdalistTagsc9aff8891471a47d011153d8741b2276/Default/Default": [ + { + "type": "aws:cdk:logicalId", + "data": "AwsApiCallLambdalistTagsc9aff8891471a47d011153d8741b2276" + } + ], + "/integtest-lambda-invoke/DefaultTest/DeployAssert/AwsApiCallLambdalistTagsc9aff8891471a47d011153d8741b2276/WaitFor/IsCompleteProvider/Invoke": [ + { + "type": "aws:cdk:logicalId", + "data": "AwsApiCallLambdalistTagsc9aff8891471a47d011153d8741b2276WaitForIsCompleteProviderInvoke3F067184" + } + ], + "/integtest-lambda-invoke/DefaultTest/DeployAssert/AwsApiCallLambdalistTagsc9aff8891471a47d011153d8741b2276/WaitFor/TimeoutProvider/Invoke": [ + { + "type": "aws:cdk:logicalId", + "data": "AwsApiCallLambdalistTagsc9aff8891471a47d011153d8741b2276WaitForTimeoutProviderInvoke11B424C0" + } + ], + "/integtest-lambda-invoke/DefaultTest/DeployAssert/AwsApiCallLambdalistTagsc9aff8891471a47d011153d8741b2276/WaitFor/Role": [ + { + "type": "aws:cdk:logicalId", + "data": "AwsApiCallLambdalistTagsc9aff8891471a47d011153d8741b2276WaitForRole0D010B44" + } + ], + "/integtest-lambda-invoke/DefaultTest/DeployAssert/AwsApiCallLambdalistTagsc9aff8891471a47d011153d8741b2276/WaitFor/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "AwsApiCallLambdalistTagsc9aff8891471a47d011153d8741b2276WaitFor0F7A5AD8" + } + ], + "/integtest-lambda-invoke/DefaultTest/DeployAssert/AwsApiCallLambdalistTagsc9aff8891471a47d011153d8741b2276/AssertionResults": [ + { + "type": "aws:cdk:logicalId", + "data": "AssertionResultsAwsApiCallLambdalistTagsc9aff8891471a47d011153d8741b2276" + } + ], "/integtest-lambda-invoke/DefaultTest/DeployAssert/BootstrapVersion": [ { "type": "aws:cdk:logicalId", diff --git a/packages/@aws-cdk/aws-scheduler-targets-alpha/test/integ.lambda-invoke.js.snapshot/tree.json b/packages/@aws-cdk/aws-scheduler-targets-alpha/test/integ.lambda-invoke.js.snapshot/tree.json index 5032f8774feae..d2ce12f85034e 100644 --- a/packages/@aws-cdk/aws-scheduler-targets-alpha/test/integ.lambda-invoke.js.snapshot/tree.json +++ b/packages/@aws-cdk/aws-scheduler-targets-alpha/test/integ.lambda-invoke.js.snapshot/tree.json @@ -4,21 +4,21 @@ "id": "App", "path": "", "children": { - "aws-cdk-schedule": { - "id": "aws-cdk-schedule", - "path": "aws-cdk-schedule", + "aws-cdk-schedule-lambda": { + "id": "aws-cdk-schedule-lambda", + "path": "aws-cdk-schedule-lambda", "children": { "MyLambda": { "id": "MyLambda", - "path": "aws-cdk-schedule/MyLambda", + "path": "aws-cdk-schedule-lambda/MyLambda", "children": { "ServiceRole": { "id": "ServiceRole", - "path": "aws-cdk-schedule/MyLambda/ServiceRole", + "path": "aws-cdk-schedule-lambda/MyLambda/ServiceRole", "children": { "ImportServiceRole": { "id": "ImportServiceRole", - "path": "aws-cdk-schedule/MyLambda/ServiceRole/ImportServiceRole", + "path": "aws-cdk-schedule-lambda/MyLambda/ServiceRole/ImportServiceRole", "constructInfo": { "fqn": "aws-cdk-lib.Resource", "version": "0.0.0" @@ -26,7 +26,7 @@ }, "Resource": { "id": "Resource", - "path": "aws-cdk-schedule/MyLambda/ServiceRole/Resource", + "path": "aws-cdk-schedule-lambda/MyLambda/ServiceRole/Resource", "attributes": { "aws:cdk:cloudformation:type": "AWS::IAM::Role", "aws:cdk:cloudformation:props": { @@ -65,11 +65,11 @@ }, "DefaultPolicy": { "id": "DefaultPolicy", - "path": "aws-cdk-schedule/MyLambda/ServiceRole/DefaultPolicy", + "path": "aws-cdk-schedule-lambda/MyLambda/ServiceRole/DefaultPolicy", "children": { "Resource": { "id": "Resource", - "path": "aws-cdk-schedule/MyLambda/ServiceRole/DefaultPolicy/Resource", + "path": "aws-cdk-schedule-lambda/MyLambda/ServiceRole/DefaultPolicy/Resource", "attributes": { "aws:cdk:cloudformation:type": "AWS::IAM::Policy", "aws:cdk:cloudformation:props": { @@ -110,11 +110,11 @@ }, "Code": { "id": "Code", - "path": "aws-cdk-schedule/MyLambda/Code", + "path": "aws-cdk-schedule-lambda/MyLambda/Code", "children": { "Stage": { "id": "Stage", - "path": "aws-cdk-schedule/MyLambda/Code/Stage", + "path": "aws-cdk-schedule-lambda/MyLambda/Code/Stage", "constructInfo": { "fqn": "aws-cdk-lib.AssetStaging", "version": "0.0.0" @@ -122,7 +122,7 @@ }, "AssetBucket": { "id": "AssetBucket", - "path": "aws-cdk-schedule/MyLambda/Code/AssetBucket", + "path": "aws-cdk-schedule-lambda/MyLambda/Code/AssetBucket", "constructInfo": { "fqn": "aws-cdk-lib.aws_s3.BucketBase", "version": "0.0.0" @@ -136,7 +136,7 @@ }, "Resource": { "id": "Resource", - "path": "aws-cdk-schedule/MyLambda/Resource", + "path": "aws-cdk-schedule-lambda/MyLambda/Resource", "attributes": { "aws:cdk:cloudformation:type": "AWS::Lambda::Function", "aws:cdk:cloudformation:props": { @@ -164,13 +164,13 @@ { "Ref": "AWS::AccountId" }, - ":function:TestSchedulerLambdaInvokeTarget" + ":function:FirstSelfTaggingLambda" ] ] } } }, - "functionName": "TestSchedulerLambdaInvokeTarget", + "functionName": "FirstSelfTaggingLambda", "handler": "index.handler", "role": { "Fn::GetAtt": [ @@ -193,13 +193,47 @@ "version": "0.0.0" } }, - "Schedule": { - "id": "Schedule", - "path": "aws-cdk-schedule/Schedule", + "BootstrapVersion": { + "id": "BootstrapVersion", + "path": "aws-cdk-schedule-lambda/BootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnParameter", + "version": "0.0.0" + } + }, + "CheckBootstrapVersion": { + "id": "CheckBootstrapVersion", + "path": "aws-cdk-schedule-lambda/CheckBootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnRule", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.Stack", + "version": "0.0.0" + } + }, + "aws-cdk-schedule": { + "id": "aws-cdk-schedule", + "path": "aws-cdk-schedule", + "children": { + "importedFromFirstStack": { + "id": "importedFromFirstStack", + "path": "aws-cdk-schedule/importedFromFirstStack", + "constructInfo": { + "fqn": "aws-cdk-lib.aws_lambda.FunctionBase", + "version": "0.0.0" + } + }, + "ScheduleWithImportedLambda": { + "id": "ScheduleWithImportedLambda", + "path": "aws-cdk-schedule/ScheduleWithImportedLambda", "children": { "Resource": { "id": "Resource", - "path": "aws-cdk-schedule/Schedule/Resource", + "path": "aws-cdk-schedule/ScheduleWithImportedLambda/Resource", "attributes": { "aws:cdk:cloudformation:type": "AWS::Scheduler::Schedule", "aws:cdk:cloudformation:props": { @@ -211,9 +245,23 @@ "state": "ENABLED", "target": { "arn": { - "Fn::GetAtt": [ - "MyLambdaCCE802FB", - "Arn" + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":lambda:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":function:FirstSelfTaggingLambda" + ] ] }, "roleArn": { @@ -222,7 +270,7 @@ "Arn" ] }, - "input": "\"test\"", + "input": "\"importedLambdaTagValue\"", "retryPolicy": { "maximumEventAgeInSeconds": 86400, "maximumRetryAttempts": 185 @@ -307,6 +355,46 @@ "Arn" ] }, + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":lambda:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":function:FirstSelfTaggingLambda" + ] + ] + }, + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":lambda:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":function:FirstSelfTaggingLambda:*" + ] + ] + }, { "Fn::Join": [ "", @@ -351,20 +439,205 @@ "version": "0.0.0" } }, - "Schedule2": { - "id": "Schedule2", - "path": "aws-cdk-schedule/Schedule2", + "MyLambda": { + "id": "MyLambda", + "path": "aws-cdk-schedule/MyLambda", "children": { + "ServiceRole": { + "id": "ServiceRole", + "path": "aws-cdk-schedule/MyLambda/ServiceRole", + "children": { + "ImportServiceRole": { + "id": "ImportServiceRole", + "path": "aws-cdk-schedule/MyLambda/ServiceRole/ImportServiceRole", + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "0.0.0" + } + }, + "Resource": { + "id": "Resource", + "path": "aws-cdk-schedule/MyLambda/ServiceRole/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Role", + "aws:cdk:cloudformation:props": { + "assumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "lambda.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + }, + "managedPolicyArns": [ + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" + ] + ] + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.CfnRole", + "version": "0.0.0" + } + }, + "DefaultPolicy": { + "id": "DefaultPolicy", + "path": "aws-cdk-schedule/MyLambda/ServiceRole/DefaultPolicy", + "children": { + "Resource": { + "id": "Resource", + "path": "aws-cdk-schedule/MyLambda/ServiceRole/DefaultPolicy/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Policy", + "aws:cdk:cloudformation:props": { + "policyDocument": { + "Statement": [ + { + "Action": "lambda:TagResource", + "Effect": "Allow", + "Resource": "*" + } + ], + "Version": "2012-10-17" + }, + "policyName": "MyLambdaServiceRoleDefaultPolicy5BBC6F68", + "roles": [ + { + "Ref": "MyLambdaServiceRole4539ECB6" + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.CfnPolicy", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.Policy", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.Role", + "version": "0.0.0" + } + }, + "Code": { + "id": "Code", + "path": "aws-cdk-schedule/MyLambda/Code", + "children": { + "Stage": { + "id": "Stage", + "path": "aws-cdk-schedule/MyLambda/Code/Stage", + "constructInfo": { + "fqn": "aws-cdk-lib.AssetStaging", + "version": "0.0.0" + } + }, + "AssetBucket": { + "id": "AssetBucket", + "path": "aws-cdk-schedule/MyLambda/Code/AssetBucket", + "constructInfo": { + "fqn": "aws-cdk-lib.aws_s3.BucketBase", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_s3_assets.Asset", + "version": "0.0.0" + } + }, "Resource": { "id": "Resource", - "path": "aws-cdk-schedule/Schedule2/Resource", + "path": "aws-cdk-schedule/MyLambda/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::Lambda::Function", + "aws:cdk:cloudformation:props": { + "code": { + "s3Bucket": { + "Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}" + }, + "s3Key": "7f6fc8a416807b6be0ca2397479cd45d43dfe989a95bc81708f269e993296d34.zip" + }, + "environment": { + "variables": { + "FUNC_ARN": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":lambda:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":function:SecondSelfTaggingLambda" + ] + ] + } + } + }, + "functionName": "SecondSelfTaggingLambda", + "handler": "index.handler", + "role": { + "Fn::GetAtt": [ + "MyLambdaServiceRole4539ECB6", + "Arn" + ] + }, + "runtime": "nodejs18.x", + "timeout": 30 + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_lambda.CfnFunction", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_lambda.Function", + "version": "0.0.0" + } + }, + "ScheduleWithSameStackLambda": { + "id": "ScheduleWithSameStackLambda", + "path": "aws-cdk-schedule/ScheduleWithSameStackLambda", + "children": { + "Resource": { + "id": "Resource", + "path": "aws-cdk-schedule/ScheduleWithSameStackLambda/Resource", "attributes": { "aws:cdk:cloudformation:type": "AWS::Scheduler::Schedule", "aws:cdk:cloudformation:props": { "flexibleTimeWindow": { "mode": "OFF" }, - "scheduleExpression": "at(2000-01-01T00:00:00)", + "scheduleExpression": "rate(1 minute)", "scheduleExpressionTimezone": "Etc/UTC", "state": "ENABLED", "target": { @@ -380,9 +653,10 @@ "Arn" ] }, + "input": "\"sameStackLambdaTagValue\"", "retryPolicy": { "maximumEventAgeInSeconds": 86400, - "maximumRetryAttempts": 0 + "maximumRetryAttempts": 185 } } } @@ -398,22 +672,51 @@ "version": "0.0.0" } }, - "Exports": { - "id": "Exports", - "path": "aws-cdk-schedule/Exports", + "ScheduleWithStaticDate": { + "id": "ScheduleWithStaticDate", + "path": "aws-cdk-schedule/ScheduleWithStaticDate", "children": { - "Output{\"Fn::GetAtt\":[\"MyLambdaCCE802FB\",\"Arn\"]}": { - "id": "Output{\"Fn::GetAtt\":[\"MyLambdaCCE802FB\",\"Arn\"]}", - "path": "aws-cdk-schedule/Exports/Output{\"Fn::GetAtt\":[\"MyLambdaCCE802FB\",\"Arn\"]}", + "Resource": { + "id": "Resource", + "path": "aws-cdk-schedule/ScheduleWithStaticDate/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::Scheduler::Schedule", + "aws:cdk:cloudformation:props": { + "flexibleTimeWindow": { + "mode": "OFF" + }, + "scheduleExpression": "at(2000-01-01T00:00:00)", + "scheduleExpressionTimezone": "Etc/UTC", + "state": "ENABLED", + "target": { + "arn": { + "Fn::GetAtt": [ + "MyLambdaCCE802FB", + "Arn" + ] + }, + "roleArn": { + "Fn::GetAtt": [ + "SchedulerRoleForTarget1441a743A31888", + "Arn" + ] + }, + "retryPolicy": { + "maximumEventAgeInSeconds": 86400, + "maximumRetryAttempts": 0 + } + } + } + }, "constructInfo": { - "fqn": "aws-cdk-lib.CfnOutput", + "fqn": "aws-cdk-lib.aws_scheduler.CfnSchedule", "version": "0.0.0" } } }, "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.3.0" + "fqn": "@aws-cdk/aws-scheduler-alpha.Schedule", + "version": "0.0.0" } }, "BootstrapVersion": { @@ -458,17 +761,17 @@ "id": "DeployAssert", "path": "integtest-lambda-invoke/DefaultTest/DeployAssert", "children": { - "AwsApiCallLambdalistTags945cd5006c8a66eb7345b9b56ea54068": { - "id": "AwsApiCallLambdalistTags945cd5006c8a66eb7345b9b56ea54068", - "path": "integtest-lambda-invoke/DefaultTest/DeployAssert/AwsApiCallLambdalistTags945cd5006c8a66eb7345b9b56ea54068", + "AwsApiCallLambdalistTagsfa577ce284ecabe6c15ac48d4f4b77f5": { + "id": "AwsApiCallLambdalistTagsfa577ce284ecabe6c15ac48d4f4b77f5", + "path": "integtest-lambda-invoke/DefaultTest/DeployAssert/AwsApiCallLambdalistTagsfa577ce284ecabe6c15ac48d4f4b77f5", "children": { "SdkProvider": { "id": "SdkProvider", - "path": "integtest-lambda-invoke/DefaultTest/DeployAssert/AwsApiCallLambdalistTags945cd5006c8a66eb7345b9b56ea54068/SdkProvider", + "path": "integtest-lambda-invoke/DefaultTest/DeployAssert/AwsApiCallLambdalistTagsfa577ce284ecabe6c15ac48d4f4b77f5/SdkProvider", "children": { "AssertionsProvider": { "id": "AssertionsProvider", - "path": "integtest-lambda-invoke/DefaultTest/DeployAssert/AwsApiCallLambdalistTags945cd5006c8a66eb7345b9b56ea54068/SdkProvider/AssertionsProvider", + "path": "integtest-lambda-invoke/DefaultTest/DeployAssert/AwsApiCallLambdalistTagsfa577ce284ecabe6c15ac48d4f4b77f5/SdkProvider/AssertionsProvider", "constructInfo": { "fqn": "constructs.Construct", "version": "10.3.0" @@ -482,11 +785,11 @@ }, "Default": { "id": "Default", - "path": "integtest-lambda-invoke/DefaultTest/DeployAssert/AwsApiCallLambdalistTags945cd5006c8a66eb7345b9b56ea54068/Default", + "path": "integtest-lambda-invoke/DefaultTest/DeployAssert/AwsApiCallLambdalistTagsfa577ce284ecabe6c15ac48d4f4b77f5/Default", "children": { "Default": { "id": "Default", - "path": "integtest-lambda-invoke/DefaultTest/DeployAssert/AwsApiCallLambdalistTags945cd5006c8a66eb7345b9b56ea54068/Default/Default", + "path": "integtest-lambda-invoke/DefaultTest/DeployAssert/AwsApiCallLambdalistTagsfa577ce284ecabe6c15ac48d4f4b77f5/Default/Default", "constructInfo": { "fqn": "aws-cdk-lib.CfnResource", "version": "0.0.0" @@ -500,15 +803,15 @@ }, "WaitFor": { "id": "WaitFor", - "path": "integtest-lambda-invoke/DefaultTest/DeployAssert/AwsApiCallLambdalistTags945cd5006c8a66eb7345b9b56ea54068/WaitFor", + "path": "integtest-lambda-invoke/DefaultTest/DeployAssert/AwsApiCallLambdalistTagsfa577ce284ecabe6c15ac48d4f4b77f5/WaitFor", "children": { "IsCompleteProvider": { "id": "IsCompleteProvider", - "path": "integtest-lambda-invoke/DefaultTest/DeployAssert/AwsApiCallLambdalistTags945cd5006c8a66eb7345b9b56ea54068/WaitFor/IsCompleteProvider", + "path": "integtest-lambda-invoke/DefaultTest/DeployAssert/AwsApiCallLambdalistTagsfa577ce284ecabe6c15ac48d4f4b77f5/WaitFor/IsCompleteProvider", "children": { "AssertionsProvider": { "id": "AssertionsProvider", - "path": "integtest-lambda-invoke/DefaultTest/DeployAssert/AwsApiCallLambdalistTags945cd5006c8a66eb7345b9b56ea54068/WaitFor/IsCompleteProvider/AssertionsProvider", + "path": "integtest-lambda-invoke/DefaultTest/DeployAssert/AwsApiCallLambdalistTagsfa577ce284ecabe6c15ac48d4f4b77f5/WaitFor/IsCompleteProvider/AssertionsProvider", "constructInfo": { "fqn": "constructs.Construct", "version": "10.3.0" @@ -516,7 +819,7 @@ }, "Invoke": { "id": "Invoke", - "path": "integtest-lambda-invoke/DefaultTest/DeployAssert/AwsApiCallLambdalistTags945cd5006c8a66eb7345b9b56ea54068/WaitFor/IsCompleteProvider/Invoke", + "path": "integtest-lambda-invoke/DefaultTest/DeployAssert/AwsApiCallLambdalistTagsfa577ce284ecabe6c15ac48d4f4b77f5/WaitFor/IsCompleteProvider/Invoke", "constructInfo": { "fqn": "aws-cdk-lib.CfnResource", "version": "0.0.0" @@ -530,11 +833,11 @@ }, "TimeoutProvider": { "id": "TimeoutProvider", - "path": "integtest-lambda-invoke/DefaultTest/DeployAssert/AwsApiCallLambdalistTags945cd5006c8a66eb7345b9b56ea54068/WaitFor/TimeoutProvider", + "path": "integtest-lambda-invoke/DefaultTest/DeployAssert/AwsApiCallLambdalistTagsfa577ce284ecabe6c15ac48d4f4b77f5/WaitFor/TimeoutProvider", "children": { "AssertionsProvider": { "id": "AssertionsProvider", - "path": "integtest-lambda-invoke/DefaultTest/DeployAssert/AwsApiCallLambdalistTags945cd5006c8a66eb7345b9b56ea54068/WaitFor/TimeoutProvider/AssertionsProvider", + "path": "integtest-lambda-invoke/DefaultTest/DeployAssert/AwsApiCallLambdalistTagsfa577ce284ecabe6c15ac48d4f4b77f5/WaitFor/TimeoutProvider/AssertionsProvider", "constructInfo": { "fqn": "constructs.Construct", "version": "10.3.0" @@ -542,7 +845,7 @@ }, "Invoke": { "id": "Invoke", - "path": "integtest-lambda-invoke/DefaultTest/DeployAssert/AwsApiCallLambdalistTags945cd5006c8a66eb7345b9b56ea54068/WaitFor/TimeoutProvider/Invoke", + "path": "integtest-lambda-invoke/DefaultTest/DeployAssert/AwsApiCallLambdalistTagsfa577ce284ecabe6c15ac48d4f4b77f5/WaitFor/TimeoutProvider/Invoke", "constructInfo": { "fqn": "aws-cdk-lib.CfnResource", "version": "0.0.0" @@ -556,7 +859,7 @@ }, "Role": { "id": "Role", - "path": "integtest-lambda-invoke/DefaultTest/DeployAssert/AwsApiCallLambdalistTags945cd5006c8a66eb7345b9b56ea54068/WaitFor/Role", + "path": "integtest-lambda-invoke/DefaultTest/DeployAssert/AwsApiCallLambdalistTagsfa577ce284ecabe6c15ac48d4f4b77f5/WaitFor/Role", "constructInfo": { "fqn": "aws-cdk-lib.CfnResource", "version": "0.0.0" @@ -564,7 +867,7 @@ }, "Resource": { "id": "Resource", - "path": "integtest-lambda-invoke/DefaultTest/DeployAssert/AwsApiCallLambdalistTags945cd5006c8a66eb7345b9b56ea54068/WaitFor/Resource", + "path": "integtest-lambda-invoke/DefaultTest/DeployAssert/AwsApiCallLambdalistTagsfa577ce284ecabe6c15ac48d4f4b77f5/WaitFor/Resource", "constructInfo": { "fqn": "aws-cdk-lib.CfnResource", "version": "0.0.0" @@ -578,7 +881,7 @@ }, "AssertionResults": { "id": "AssertionResults", - "path": "integtest-lambda-invoke/DefaultTest/DeployAssert/AwsApiCallLambdalistTags945cd5006c8a66eb7345b9b56ea54068/AssertionResults", + "path": "integtest-lambda-invoke/DefaultTest/DeployAssert/AwsApiCallLambdalistTagsfa577ce284ecabe6c15ac48d4f4b77f5/AssertionResults", "constructInfo": { "fqn": "aws-cdk-lib.CfnOutput", "version": "0.0.0" @@ -700,6 +1003,138 @@ "version": "10.3.0" } }, + "AwsApiCallLambdalistTagsc9aff8891471a47d011153d8741b2276": { + "id": "AwsApiCallLambdalistTagsc9aff8891471a47d011153d8741b2276", + "path": "integtest-lambda-invoke/DefaultTest/DeployAssert/AwsApiCallLambdalistTagsc9aff8891471a47d011153d8741b2276", + "children": { + "SdkProvider": { + "id": "SdkProvider", + "path": "integtest-lambda-invoke/DefaultTest/DeployAssert/AwsApiCallLambdalistTagsc9aff8891471a47d011153d8741b2276/SdkProvider", + "children": { + "AssertionsProvider": { + "id": "AssertionsProvider", + "path": "integtest-lambda-invoke/DefaultTest/DeployAssert/AwsApiCallLambdalistTagsc9aff8891471a47d011153d8741b2276/SdkProvider/AssertionsProvider", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.3.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/integ-tests-alpha.AssertionsProvider", + "version": "0.0.0" + } + }, + "Default": { + "id": "Default", + "path": "integtest-lambda-invoke/DefaultTest/DeployAssert/AwsApiCallLambdalistTagsc9aff8891471a47d011153d8741b2276/Default", + "children": { + "Default": { + "id": "Default", + "path": "integtest-lambda-invoke/DefaultTest/DeployAssert/AwsApiCallLambdalistTagsc9aff8891471a47d011153d8741b2276/Default/Default", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnResource", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.CustomResource", + "version": "0.0.0" + } + }, + "WaitFor": { + "id": "WaitFor", + "path": "integtest-lambda-invoke/DefaultTest/DeployAssert/AwsApiCallLambdalistTagsc9aff8891471a47d011153d8741b2276/WaitFor", + "children": { + "IsCompleteProvider": { + "id": "IsCompleteProvider", + "path": "integtest-lambda-invoke/DefaultTest/DeployAssert/AwsApiCallLambdalistTagsc9aff8891471a47d011153d8741b2276/WaitFor/IsCompleteProvider", + "children": { + "AssertionsProvider": { + "id": "AssertionsProvider", + "path": "integtest-lambda-invoke/DefaultTest/DeployAssert/AwsApiCallLambdalistTagsc9aff8891471a47d011153d8741b2276/WaitFor/IsCompleteProvider/AssertionsProvider", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.3.0" + } + }, + "Invoke": { + "id": "Invoke", + "path": "integtest-lambda-invoke/DefaultTest/DeployAssert/AwsApiCallLambdalistTagsc9aff8891471a47d011153d8741b2276/WaitFor/IsCompleteProvider/Invoke", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnResource", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/integ-tests-alpha.AssertionsProvider", + "version": "0.0.0" + } + }, + "TimeoutProvider": { + "id": "TimeoutProvider", + "path": "integtest-lambda-invoke/DefaultTest/DeployAssert/AwsApiCallLambdalistTagsc9aff8891471a47d011153d8741b2276/WaitFor/TimeoutProvider", + "children": { + "AssertionsProvider": { + "id": "AssertionsProvider", + "path": "integtest-lambda-invoke/DefaultTest/DeployAssert/AwsApiCallLambdalistTagsc9aff8891471a47d011153d8741b2276/WaitFor/TimeoutProvider/AssertionsProvider", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.3.0" + } + }, + "Invoke": { + "id": "Invoke", + "path": "integtest-lambda-invoke/DefaultTest/DeployAssert/AwsApiCallLambdalistTagsc9aff8891471a47d011153d8741b2276/WaitFor/TimeoutProvider/Invoke", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnResource", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/integ-tests-alpha.AssertionsProvider", + "version": "0.0.0" + } + }, + "Role": { + "id": "Role", + "path": "integtest-lambda-invoke/DefaultTest/DeployAssert/AwsApiCallLambdalistTagsc9aff8891471a47d011153d8741b2276/WaitFor/Role", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnResource", + "version": "0.0.0" + } + }, + "Resource": { + "id": "Resource", + "path": "integtest-lambda-invoke/DefaultTest/DeployAssert/AwsApiCallLambdalistTagsc9aff8891471a47d011153d8741b2276/WaitFor/Resource", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnResource", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/integ-tests-alpha.WaiterStateMachine", + "version": "0.0.0" + } + }, + "AssertionResults": { + "id": "AssertionResults", + "path": "integtest-lambda-invoke/DefaultTest/DeployAssert/AwsApiCallLambdalistTagsc9aff8891471a47d011153d8741b2276/AssertionResults", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnOutput", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/integ-tests-alpha.AwsApiCall", + "version": "0.0.0" + } + }, "BootstrapVersion": { "id": "BootstrapVersion", "path": "integtest-lambda-invoke/DefaultTest/DeployAssert/BootstrapVersion", diff --git a/packages/@aws-cdk/aws-scheduler-targets-alpha/test/integ.lambda-invoke.ts b/packages/@aws-cdk/aws-scheduler-targets-alpha/test/integ.lambda-invoke.ts index 1d97a5ebc2179..e2f4a14d2b890 100644 --- a/packages/@aws-cdk/aws-scheduler-targets-alpha/test/integ.lambda-invoke.ts +++ b/packages/@aws-cdk/aws-scheduler-targets-alpha/test/integ.lambda-invoke.ts @@ -6,6 +6,13 @@ import * as iam from 'aws-cdk-lib/aws-iam'; import * as lambda from 'aws-cdk-lib/aws-lambda'; import { LambdaInvoke } from '../lib'; +const LAMBDA_TAGGING_PERMISSION = new iam.PolicyStatement( + new iam.PolicyStatement({ + actions: ['lambda:TagResource'], + resources: ['*'], + }), +); + /* * Stack verification steps: * The lambda function is implemented to add a tag: @@ -15,60 +22,111 @@ import { LambdaInvoke } from '../lib'; * The assertion checks that the expected tag is created by calling listTags on the lambda function */ const app = new cdk.App(); -const stack = new cdk.Stack(app, 'aws-cdk-schedule'); +/** + * 1st stack creates a lambda which will be imported to 2nd stack to test using imported lambda + */ +const lambdaStack = new cdk.Stack(app, 'aws-cdk-schedule-lambda'); + +const funcName = 'FirstSelfTaggingLambda'; +const funcToBeImported = new lambda.Function(lambdaStack, 'MyLambda', { + code: lambda.AssetCode.fromAsset(path.join(__dirname, 'integ.schedule-lambda-target.handler')), + handler: 'index.handler', + timeout: cdk.Duration.seconds(30), + runtime: lambda.Runtime.NODEJS_LATEST, + functionName: funcName, +}); +funcToBeImported.addToRolePolicy(LAMBDA_TAGGING_PERMISSION); -const functionName = 'TestSchedulerLambdaInvokeTarget'; -const functionArn = stack.formatArn({ +const funcToBeImportedStaticArn = lambdaStack.formatArn({ service: 'lambda', resource: 'function', - resourceName: functionName, + resourceName: funcName, arnFormat: cdk.ArnFormat.COLON_RESOURCE_NAME, }); -const payload = 'test'; +funcToBeImported.addEnvironment('FUNC_ARN', lambdaStack.resolve(funcToBeImportedStaticArn)); + +/** + * 2nd stack creates a lambda and a schedule to check they integrate correctly. + * It also creates a schedule to use with an imported lambda from the 1st stack above. + */ + +const scheduleStack = new cdk.Stack(app, 'aws-cdk-schedule'); +scheduleStack.addDependency(lambdaStack); + +// 1st case with imported lambda +const importedFunc = lambda.Function.fromFunctionAttributes(scheduleStack, 'importedFromFirstStack', { + functionArn: funcToBeImportedStaticArn, + skipPermissions: true, +}); +const importedLambdaTagValue = 'importedLambdaTagValue'; +new scheduler.Schedule(scheduleStack, 'ScheduleWithImportedLambda', { + schedule: scheduler.ScheduleExpression.rate(cdk.Duration.minutes(1)), + target: new LambdaInvoke(importedFunc, { + input: scheduler.ScheduleTargetInput.fromText(importedLambdaTagValue), + }), +}); -const func = new lambda.Function(stack, 'MyLambda', { +// 2nd case with lambda and schedule in same stack +const secondFuncName = 'SecondSelfTaggingLambda'; +const sameStackFunc = new lambda.Function(scheduleStack, 'MyLambda', { code: lambda.AssetCode.fromAsset(path.join(__dirname, 'integ.schedule-lambda-target.handler')), handler: 'index.handler', timeout: cdk.Duration.seconds(30), runtime: lambda.Runtime.NODEJS_LATEST, - functionName: functionName, + functionName: secondFuncName, }); -func.addEnvironment('FUNC_ARN', stack.resolve(functionArn)); - -func.addToRolePolicy(new iam.PolicyStatement( - new iam.PolicyStatement({ - actions: ['lambda:TagResource'], - resources: ['*'], - }), -)); +sameStackFunc.addToRolePolicy(LAMBDA_TAGGING_PERMISSION); +const sameStackFuncStaticArn = scheduleStack.formatArn({ + service: 'lambda', + resource: 'function', + resourceName: secondFuncName, + arnFormat: cdk.ArnFormat.COLON_RESOURCE_NAME, +}); +sameStackFunc.addEnvironment('FUNC_ARN', scheduleStack.resolve(sameStackFuncStaticArn)); -new scheduler.Schedule(stack, 'Schedule', { +const sameStackLambdaTagValue = 'sameStackLambdaTagValue'; +new scheduler.Schedule(scheduleStack, 'ScheduleWithSameStackLambda', { schedule: scheduler.ScheduleExpression.rate(cdk.Duration.minutes(1)), - target: new LambdaInvoke(func, { - input: scheduler.ScheduleTargetInput.fromText(payload), + target: new LambdaInvoke(sameStackFunc, { + input: scheduler.ScheduleTargetInput.fromText(sameStackLambdaTagValue), }), }); -// test multiple schedules with same target ARN are created correctly -new scheduler.Schedule(stack, 'Schedule2', { + +// 3rd case testing reusing target lambda and static date +new scheduler.Schedule(scheduleStack, 'ScheduleWithStaticDate', { schedule: scheduler.ScheduleExpression.at(new Date('2000-01-01T00:00:00Z')), - target: new LambdaInvoke(func, { retryAttempts: 0 }), + target: new LambdaInvoke(sameStackFunc, { retryAttempts: 0 }), }); const integ = new IntegTest(app, 'integtest-lambda-invoke', { - testCases: [stack], + testCases: [scheduleStack], stackUpdateWorkflow: false, // this would cause the schedule to trigger with the old code }); -const invokeListTags = integ.assertions.awsApiCall('Lambda', 'listTags', { - Resource: func.functionArn, +const listTagsOnImportedLambda = integ.assertions.awsApiCall('Lambda', 'listTags', { + Resource: funcToBeImportedStaticArn, +}); + +// Verifies that expected tag is created for the lambda function +listTagsOnImportedLambda.expect(ExpectedResult.objectLike({ + Tags: { + OutputValue: Buffer.from(JSON.stringify(importedLambdaTagValue)).toString('base64'), + }, +})).waitForAssertions({ + totalTimeout: cdk.Duration.minutes(10), + interval: cdk.Duration.seconds(10), +}); + +const listTagsOnSameStackLambda = integ.assertions.awsApiCall('Lambda', 'listTags', { + Resource: sameStackFuncStaticArn, }); // Verifies that expected tag is created for the lambda function -invokeListTags.expect(ExpectedResult.objectLike({ +listTagsOnSameStackLambda.expect(ExpectedResult.objectLike({ Tags: { - OutputValue: Buffer.from(JSON.stringify(payload)).toString('base64'), + OutputValue: Buffer.from(JSON.stringify(sameStackLambdaTagValue)).toString('base64'), }, })).waitForAssertions({ totalTimeout: cdk.Duration.minutes(10), - interval: cdk.Duration.seconds(5), + interval: cdk.Duration.seconds(10), }); diff --git a/packages/@aws-cdk/aws-scheduler-targets-alpha/test/lambda-invoke.test.ts b/packages/@aws-cdk/aws-scheduler-targets-alpha/test/lambda-invoke.test.ts index 8439776023afd..2fcb2a8d30629 100644 --- a/packages/@aws-cdk/aws-scheduler-targets-alpha/test/lambda-invoke.test.ts +++ b/packages/@aws-cdk/aws-scheduler-targets-alpha/test/lambda-invoke.test.ts @@ -319,42 +319,38 @@ describe('schedule target', () => { }); }); - test('throws when lambda function is imported from different account', () => { - const importedFunc = lambda.Function.fromFunctionArn(stack, 'ImportedFunction', 'arn:aws:lambda:us-east-1:234567890123:function/somefunc'); - - const lambdaTarget = new LambdaInvoke(importedFunc, {}); - - expect(() => - new Schedule(stack, 'MyScheduleDummy', { - schedule: expr, - target: lambdaTarget, - })).toThrow(/Both the schedule and the function must be in the same account/); - }); - - test('throws when lambda function is imported from different region', () => { - const importedFunc = lambda.Function.fromFunctionArn(stack, 'ImportedFunction', 'arn:aws:lambda:us-west-2:123456789012:function/somefunc'); + test('using imported lambda function should not throw', () => { + const lambdaFuncArn = 'arn:aws:lambda:us-east-1:234567890123:function/somefunc'; + const importedFunc = lambda.Function.fromFunctionAttributes( + stack, + 'ImportedLambdaFunction', + { + functionArn: lambdaFuncArn, + skipPermissions: true, + }, + ); const lambdaTarget = new LambdaInvoke(importedFunc, {}); - - expect(() => - new Schedule(stack, 'MyScheduleDummy', { - schedule: expr, - target: lambdaTarget, - })).toThrow(/Both the schedule and the function must be in the same region/); - }); - - test('throws when IAM role is imported from different account', () => { - const importedRole = Role.fromRoleArn(stack, 'ImportedRole', 'arn:aws:iam::234567890123:role/someRole'); - - const lambdaTarget = new LambdaInvoke(func, { - role: importedRole, + new Schedule(stack, 'MyScheduleDummy', { + schedule: expr, + target: lambdaTarget, }); - expect(() => - new Schedule(stack, 'MyScheduleDummy', { - schedule: expr, - target: lambdaTarget, - })).toThrow(/Both the target and the execution role must be in the same account/); + Template.fromStack(stack).hasResourceProperties('AWS::IAM::Policy', { + PolicyDocument: { + Statement: [ + { + Action: 'lambda:InvokeFunction', + Effect: 'Allow', + Resource: [ + lambdaFuncArn, + `${lambdaFuncArn}:*`, + ], + }, + ], + }, + Roles: [{ Ref: 'SchedulerRoleForTargetfdfcef0FF637F7' }], + }); }); test('adds permissions to DLQ', () => { From 1e73ac5f53809e4b5f1192e3307ba7780bc22a81 Mon Sep 17 00:00:00 2001 From: Kazuho Cryer-Shinozuka Date: Wed, 23 Oct 2024 23:16:08 +0900 Subject: [PATCH 18/33] docs: fix improper JSDoc formatting (#31820) ### Issue # (if applicable) None ### Reason for this change There are some improper JSDoc formatting. ### Description of changes I have corrected multiple instances of improper JSDoc formatting. ```diff /** - * description - * - * @default - xxx - */ + * description + * + * @default - xxx + */ ``` ### Description of how you validated changes None ### Checklist - [x] My code adheres to the [CONTRIBUTING GUIDE](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and [DESIGN GUIDELINES](https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md) ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license* --- .../lib/auto-scaling-configuration.ts | 12 +-- .../aws-apprunner-alpha/lib/service.ts | 4 +- .../aws-apprunner-alpha/lib/vpc-connector.ts | 20 ++--- .../@aws-cdk/aws-gamelift-alpha/lib/alias.ts | 4 +- .../@aws-cdk/aws-gamelift-alpha/lib/build.ts | 8 +- .../aws-gamelift-alpha/lib/fleet-base.ts | 4 +- .../lib/game-server-group.ts | 8 +- .../aws-gamelift-alpha/lib/ingress-rule.ts | 74 +++++++++---------- .../aws-kinesisfirehose-alpha/lib/source.ts | 24 +++--- .../lib/logging-config.ts | 16 ++-- packages/@aws-cdk/aws-pipes-alpha/lib/pipe.ts | 32 ++++---- .../aws-pipes-sources-alpha/lib/sqs.ts | 10 +-- .../lib/streamSource.ts | 18 ++--- .../@aws-cdk/aws-redshift-alpha/lib/table.ts | 8 +- .../lib/firewall-domain-list.ts | 46 ++++++------ .../lib/firewall-rule-group-association.ts | 40 +++++----- .../lib/target-application.ts | 54 +++++++------- .../cdk-cli-wrapper/lib/commands/common.ts | 2 +- .../cli-lib-alpha/lib/commands/common.ts | 2 +- .../lib/runner/integration-tests.ts | 8 +- .../aws-apigatewayv2/lib/websocket/api.ts | 8 +- .../aws-cdk-lib/aws-appsync/lib/schema.ts | 20 ++--- .../aws-batch/lib/linux-parameters.ts | 24 +++--- .../lib/certificate-base.ts | 8 +- .../aws-cloudfront/lib/distribution.ts | 46 ++++++------ .../aws-cloudfront/lib/endpoint.ts | 8 +- .../aws-codebuild/lib/build-spec.ts | 8 +- .../lib/ecs/deployment-group.ts | 22 +++--- .../aws-cognito/lib/user-pool-idps/oidc.ts | 10 +-- packages/aws-cdk-lib/aws-config/lib/rule.ts | 6 +- packages/aws-cdk-lib/aws-docdb/lib/cluster.ts | 42 +++++------ .../aws-cdk-lib/aws-dynamodb/lib/table.ts | 14 ++-- ...ion-multiple-target-groups-service-base.ts | 6 +- .../lib/base/fargate-service-base.ts | 62 ++++++++-------- .../lib/base/scheduled-task-base.ts | 16 ++-- packages/aws-cdk-lib/aws-ecs/lib/cluster.ts | 2 +- .../aws-ecs/lib/linux-parameters.ts | 24 +++--- .../aws-events-targets/lib/ecs-task.ts | 36 ++++----- packages/aws-cdk-lib/aws-iam/lib/role.ts | 2 +- .../aws-cdk-lib/aws-ses/lib/email-identity.ts | 20 ++--- .../test/private/fake-task.ts | 4 +- .../aws-cdk-lib/aws-synthetics/lib/runtime.ts | 6 +- packages/aws-cdk/lib/api/deployments.ts | 34 ++++----- 43 files changed, 411 insertions(+), 411 deletions(-) diff --git a/packages/@aws-cdk/aws-apprunner-alpha/lib/auto-scaling-configuration.ts b/packages/@aws-cdk/aws-apprunner-alpha/lib/auto-scaling-configuration.ts index 1d3c1ce943fca..aae6e0ef9069a 100644 --- a/packages/@aws-cdk/aws-apprunner-alpha/lib/auto-scaling-configuration.ts +++ b/packages/@aws-cdk/aws-apprunner-alpha/lib/auto-scaling-configuration.ts @@ -133,15 +133,15 @@ export class AutoScalingConfiguration extends cdk.Resource implements IAutoScali } /** - * The ARN of the Auto Scaling Configuration. - * @attribute - */ + * The ARN of the Auto Scaling Configuration. + * @attribute + */ readonly autoScalingConfigurationArn: string; /** - * The name of the Auto Scaling Configuration. - * @attribute - */ + * The name of the Auto Scaling Configuration. + * @attribute + */ readonly autoScalingConfigurationName: string; /** diff --git a/packages/@aws-cdk/aws-apprunner-alpha/lib/service.ts b/packages/@aws-cdk/aws-apprunner-alpha/lib/service.ts index 80040c76ad560..9941de291cb1d 100644 --- a/packages/@aws-cdk/aws-apprunner-alpha/lib/service.ts +++ b/packages/@aws-cdk/aws-apprunner-alpha/lib/service.ts @@ -435,8 +435,8 @@ export abstract class Source { } /** - * Called when the Job is initialized to allow this object to bind. - */ + * Called when the Job is initialized to allow this object to bind. + */ public abstract bind(scope: Construct): SourceConfig; } diff --git a/packages/@aws-cdk/aws-apprunner-alpha/lib/vpc-connector.ts b/packages/@aws-cdk/aws-apprunner-alpha/lib/vpc-connector.ts index a6371eacd86f7..f2f3a7f99fd3a 100644 --- a/packages/@aws-cdk/aws-apprunner-alpha/lib/vpc-connector.ts +++ b/packages/@aws-cdk/aws-apprunner-alpha/lib/vpc-connector.ts @@ -28,10 +28,10 @@ export interface VpcConnectorProps { readonly securityGroups?: ec2.ISecurityGroup[]; /** - * The name for the VpcConnector. - * - * @default - a name generated by CloudFormation - */ + * The name for the VpcConnector. + * + * @default - a name generated by CloudFormation + */ readonly vpcConnectorName?: string; } @@ -109,9 +109,9 @@ export class VpcConnector extends cdk.Resource implements IVpcConnector { } /** - * The ARN of the VPC connector. - * @attribute - */ + * The ARN of the VPC connector. + * @attribute + */ readonly vpcConnectorArn: string; /** @@ -121,9 +121,9 @@ export class VpcConnector extends cdk.Resource implements IVpcConnector { readonly vpcConnectorRevision: number; /** - * The name of the VPC connector. - * @attribute - */ + * The name of the VPC connector. + * @attribute + */ readonly vpcConnectorName: string; /** diff --git a/packages/@aws-cdk/aws-gamelift-alpha/lib/alias.ts b/packages/@aws-cdk/aws-gamelift-alpha/lib/alias.ts index ba75175c489e2..1b0e359791f1f 100644 --- a/packages/@aws-cdk/aws-gamelift-alpha/lib/alias.ts +++ b/packages/@aws-cdk/aws-gamelift-alpha/lib/alias.ts @@ -186,8 +186,8 @@ export class Alias extends AliasBase { public readonly aliasId: string; /** - * The ARN of the alias. - */ + * The ARN of the alias. + */ public readonly aliasArn: string; /** diff --git a/packages/@aws-cdk/aws-gamelift-alpha/lib/build.ts b/packages/@aws-cdk/aws-gamelift-alpha/lib/build.ts index 51bf6fd2c78de..edb8ac74ee883 100644 --- a/packages/@aws-cdk/aws-gamelift-alpha/lib/build.ts +++ b/packages/@aws-cdk/aws-gamelift-alpha/lib/build.ts @@ -122,10 +122,10 @@ export interface BuildProps { readonly buildName?: string; /** - * Version of this build - * - * @default No version - */ + * Version of this build + * + * @default No version + */ readonly buildVersion?: string; /** diff --git a/packages/@aws-cdk/aws-gamelift-alpha/lib/fleet-base.ts b/packages/@aws-cdk/aws-gamelift-alpha/lib/fleet-base.ts index 1194243f51943..4446fbf7d3bbc 100644 --- a/packages/@aws-cdk/aws-gamelift-alpha/lib/fleet-base.ts +++ b/packages/@aws-cdk/aws-gamelift-alpha/lib/fleet-base.ts @@ -443,8 +443,8 @@ export abstract class FleetBase extends cdk.Resource implements IFleet { } /** - * The Identifier of the fleet. - */ + * The Identifier of the fleet. + */ public abstract readonly fleetId: string; /** diff --git a/packages/@aws-cdk/aws-gamelift-alpha/lib/game-server-group.ts b/packages/@aws-cdk/aws-gamelift-alpha/lib/game-server-group.ts index 71c607fe8b741..4411552d3a6f1 100644 --- a/packages/@aws-cdk/aws-gamelift-alpha/lib/game-server-group.ts +++ b/packages/@aws-cdk/aws-gamelift-alpha/lib/game-server-group.ts @@ -319,10 +319,10 @@ export interface GameServerGroupProps { readonly deleteOption?: DeleteOption; /** - * Indicates how GameLift FleetIQ balances the use of Spot Instances and On-Demand Instances in the game server group. - * - * @default SPOT_PREFERRED - */ + * Indicates how GameLift FleetIQ balances the use of Spot Instances and On-Demand Instances in the game server group. + * + * @default SPOT_PREFERRED + */ readonly balancingStrategy?: BalancingStrategy; } diff --git a/packages/@aws-cdk/aws-gamelift-alpha/lib/ingress-rule.ts b/packages/@aws-cdk/aws-gamelift-alpha/lib/ingress-rule.ts index 63914e41a876c..b944cfdf76d75 100644 --- a/packages/@aws-cdk/aws-gamelift-alpha/lib/ingress-rule.ts +++ b/packages/@aws-cdk/aws-gamelift-alpha/lib/ingress-rule.ts @@ -15,25 +15,25 @@ export enum Protocol { */ export interface PortProps { /** - * The protocol for the range - */ + * The protocol for the range + */ readonly protocol: Protocol; /** - * A starting value for a range of allowed port numbers. - * - * For fleets using Windows and Linux builds, only ports 1026-60000 are valid. - */ + * A starting value for a range of allowed port numbers. + * + * For fleets using Windows and Linux builds, only ports 1026-60000 are valid. + */ readonly fromPort: number; /** - * An ending value for a range of allowed port numbers. Port numbers are end-inclusive. - * This value must be higher than `fromPort`. - * - * For fleets using Windows and Linux builds, only ports 1026-60000 are valid. - * - * @default the `fromPort` value - */ + * An ending value for a range of allowed port numbers. Port numbers are end-inclusive. + * This value must be higher than `fromPort`. + * + * For fleets using Windows and Linux builds, only ports 1026-60000 are valid. + * + * @default the `fromPort` value + */ readonly toPort?: number; } @@ -42,8 +42,8 @@ export interface PortProps { */ export class Port { /** - * A single TCP port - */ + * A single TCP port + */ public static tcp(port: number): Port { return new Port({ protocol: Protocol.TCP, @@ -53,8 +53,8 @@ export class Port { } /** - * A TCP port range - */ + * A TCP port range + */ public static tcpRange(startPort: number, endPort: number) { return new Port({ protocol: Protocol.TCP, @@ -64,8 +64,8 @@ export class Port { } /** - * Any TCP traffic - */ + * Any TCP traffic + */ public static allTcp() { return new Port({ protocol: Protocol.TCP, @@ -75,8 +75,8 @@ export class Port { } /** - * A single UDP port - */ + * A single UDP port + */ public static udp(port: number): Port { return new Port({ protocol: Protocol.UDP, @@ -86,8 +86,8 @@ export class Port { } /** - * A UDP port range - */ + * A UDP port range + */ public static udpRange(startPort: number, endPort: number) { return new Port({ protocol: Protocol.UDP, @@ -97,8 +97,8 @@ export class Port { } /** - * Any UDP traffic - */ + * Any UDP traffic + */ public static allUdp() { return new Port({ protocol: Protocol.UDP, @@ -127,13 +127,13 @@ export class Port { export interface IPeer { /** - * A unique identifier for this connection peer - */ + * A unique identifier for this connection peer + */ readonly uniqueId: string; /** - * Produce the ingress rule JSON for the given connection - */ + * Produce the ingress rule JSON for the given connection + */ toJson(): any; } @@ -147,15 +147,15 @@ export interface IPeer { */ export class Peer { /** - * Create an IPv4 peer from a CIDR - */ + * Create an IPv4 peer from a CIDR + */ public static ipv4(cidrIp: string): IPeer { return new CidrIPv4(cidrIp); } /** - * Any IPv4 address - */ + * Any IPv4 address + */ public static anyIpv4(): IPeer { return new AnyIPv4(); } @@ -188,8 +188,8 @@ class CidrIPv4 implements IPeer { } /** - * Produce the ingress rule JSON for the given connection - */ + * Produce the ingress rule JSON for the given connection + */ public toJson(): any { return { ipRange: this.cidrIp }; } @@ -213,8 +213,8 @@ class AnyIPv4 extends CidrIPv4 { */ export interface IngressRule { /** - * The port range used for ingress traffic - */ + * The port range used for ingress traffic + */ readonly port: Port; /** diff --git a/packages/@aws-cdk/aws-kinesisfirehose-alpha/lib/source.ts b/packages/@aws-cdk/aws-kinesisfirehose-alpha/lib/source.ts index ad0009a123654..3bba057c6be75 100644 --- a/packages/@aws-cdk/aws-kinesisfirehose-alpha/lib/source.ts +++ b/packages/@aws-cdk/aws-kinesisfirehose-alpha/lib/source.ts @@ -8,21 +8,21 @@ import * as kinesis from 'aws-cdk-lib/aws-kinesis'; */ interface SourceConfig { /** - * Configuration for using a Kinesis Data Stream as a source for the delivery stream. - * - * This will be returned by the _bind method depending on what type of Source class is specified. - * - * @default - Kinesis Data Stream Source configuration property is not provided. - */ + * Configuration for using a Kinesis Data Stream as a source for the delivery stream. + * + * This will be returned by the _bind method depending on what type of Source class is specified. + * + * @default - Kinesis Data Stream Source configuration property is not provided. + */ readonly kinesisStreamSourceConfiguration?: CfnDeliveryStream.KinesisStreamSourceConfigurationProperty; /** - * Configuration for using an MSK (Managed Streaming for Kafka) cluster as a source for the delivery stream. - * - * This will be returned by the _bind method depending on what type of Source class is specified. - * - * @default - MSK Source configuration property is not provided. - */ + * Configuration for using an MSK (Managed Streaming for Kafka) cluster as a source for the delivery stream. + * + * This will be returned by the _bind method depending on what type of Source class is specified. + * + * @default - MSK Source configuration property is not provided. + */ readonly mskSourceConfiguration?: CfnDeliveryStream.MSKSourceConfigurationProperty; } diff --git a/packages/@aws-cdk/aws-kinesisfirehose-destinations-alpha/lib/logging-config.ts b/packages/@aws-cdk/aws-kinesisfirehose-destinations-alpha/lib/logging-config.ts index 69839e17027ae..970c30a68e08e 100644 --- a/packages/@aws-cdk/aws-kinesisfirehose-destinations-alpha/lib/logging-config.ts +++ b/packages/@aws-cdk/aws-kinesisfirehose-destinations-alpha/lib/logging-config.ts @@ -8,17 +8,17 @@ import * as logs from 'aws-cdk-lib/aws-logs'; */ export interface ILoggingConfig { /** - * If true, log errors when data transformation or data delivery fails. - * - * `true` when using `EnableLogging`, `false` when using `DisableLogging`. - */ + * If true, log errors when data transformation or data delivery fails. + * + * `true` when using `EnableLogging`, `false` when using `DisableLogging`. + */ readonly logging: boolean; /** - * The CloudWatch log group where log streams will be created to hold error logs. - * - * @default - if `logging` is set to `true`, a log group will be created for you. - */ + * The CloudWatch log group where log streams will be created to hold error logs. + * + * @default - if `logging` is set to `true`, a log group will be created for you. + */ readonly logGroup?: logs.ILogGroup; } diff --git a/packages/@aws-cdk/aws-pipes-alpha/lib/pipe.ts b/packages/@aws-cdk/aws-pipes-alpha/lib/pipe.ts index f350a38bff3fb..6056bcc3d79ac 100644 --- a/packages/@aws-cdk/aws-pipes-alpha/lib/pipe.ts +++ b/packages/@aws-cdk/aws-pipes-alpha/lib/pipe.ts @@ -115,25 +115,25 @@ export interface PipeProps { readonly logDestinations?: ILogDestination[]; /** - * The level of logging detail to include. - * - * This applies to all log destinations for the pipe. - * - * @see https://docs.aws.amazon.com/eventbridge/latest/userguide/eb-pipes-logs.html - * @default - LogLevel.ERROR - */ + * The level of logging detail to include. + * + * This applies to all log destinations for the pipe. + * + * @see https://docs.aws.amazon.com/eventbridge/latest/userguide/eb-pipes-logs.html + * @default - LogLevel.ERROR + */ readonly logLevel?: LogLevel; /** - * Whether the execution data (specifically, the `payload` , `awsRequest` , and `awsResponse` fields) is included in the log messages for this pipe. - * - * This applies to all log destinations for the pipe. - * - * For more information, see [Including execution data in logs](https://docs.aws.amazon.com/eventbridge/latest/userguide/eb-pipes-logs.html#eb-pipes-logs-execution-data) and the [message schema](https://docs.aws.amazon.com/eventbridge/latest/userguide/eb-pipes-logs-schema.html) in the *Amazon EventBridge User Guide* . - * - * @see http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-pipes-pipe-pipelogconfiguration.html#cfn-pipes-pipe-pipelogconfiguration-includeexecutiondata - * @default - none - */ + * Whether the execution data (specifically, the `payload` , `awsRequest` , and `awsResponse` fields) is included in the log messages for this pipe. + * + * This applies to all log destinations for the pipe. + * + * For more information, see [Including execution data in logs](https://docs.aws.amazon.com/eventbridge/latest/userguide/eb-pipes-logs.html#eb-pipes-logs-execution-data) and the [message schema](https://docs.aws.amazon.com/eventbridge/latest/userguide/eb-pipes-logs-schema.html) in the *Amazon EventBridge User Guide* . + * + * @see http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-pipes-pipe-pipelogconfiguration.html#cfn-pipes-pipe-pipelogconfiguration-includeexecutiondata + * @default - none + */ readonly logIncludeExecutionData?: IncludeExecutionData[]; /** diff --git a/packages/@aws-cdk/aws-pipes-sources-alpha/lib/sqs.ts b/packages/@aws-cdk/aws-pipes-sources-alpha/lib/sqs.ts index 0b43b3a643777..38a4c61f38db0 100644 --- a/packages/@aws-cdk/aws-pipes-sources-alpha/lib/sqs.ts +++ b/packages/@aws-cdk/aws-pipes-sources-alpha/lib/sqs.ts @@ -8,11 +8,11 @@ import { IQueue } from 'aws-cdk-lib/aws-sqs'; */ export interface SqsSourceParameters { /** - * The maximum number of records to include in each batch. - * - * @see http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-pipes-pipe-pipesourcesqsqueueparameters.html#cfn-pipes-pipe-pipesourcesqsqueueparameters-batchsize - * @default 10 - */ + * The maximum number of records to include in each batch. + * + * @see http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-pipes-pipe-pipesourcesqsqueueparameters.html#cfn-pipes-pipe-pipesourcesqsqueueparameters-batchsize + * @default 10 + */ readonly batchSize?: number; /** diff --git a/packages/@aws-cdk/aws-pipes-sources-alpha/lib/streamSource.ts b/packages/@aws-cdk/aws-pipes-sources-alpha/lib/streamSource.ts index c15454aac85a9..6b0842ae26f5a 100644 --- a/packages/@aws-cdk/aws-pipes-sources-alpha/lib/streamSource.ts +++ b/packages/@aws-cdk/aws-pipes-sources-alpha/lib/streamSource.ts @@ -17,15 +17,15 @@ export interface StreamSourceParameters { readonly batchSize?: number; /** - * Define the target to send dead-letter queue events to. - * - * The dead-letter queue stores any events that are not successfully delivered to a Pipes target after all retry attempts are exhausted. - * You can then resolve the issue that caused the failed invocations and replay the events at a later time. - * In some cases, such as when access is denied to a resource, events are sent directly to the dead-letter queue and are not retried. - * - * @see https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-pipes-pipe-pipesourcekinesisstreamparameters.html#cfn-pipes-pipe-pipesourcekinesisstreamparameters-deadletterconfig - * @default - no dead-letter queue or topic - */ + * Define the target to send dead-letter queue events to. + * + * The dead-letter queue stores any events that are not successfully delivered to a Pipes target after all retry attempts are exhausted. + * You can then resolve the issue that caused the failed invocations and replay the events at a later time. + * In some cases, such as when access is denied to a resource, events are sent directly to the dead-letter queue and are not retried. + * + * @see https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-pipes-pipe-pipesourcekinesisstreamparameters.html#cfn-pipes-pipe-pipesourcekinesisstreamparameters-deadletterconfig + * @default - no dead-letter queue or topic + */ readonly deadLetterTarget?: IQueue | ITopic; /** diff --git a/packages/@aws-cdk/aws-redshift-alpha/lib/table.ts b/packages/@aws-cdk/aws-redshift-alpha/lib/table.ts index c8d31d646e801..efa6d2d32e5f0 100644 --- a/packages/@aws-cdk/aws-redshift-alpha/lib/table.ts +++ b/packages/@aws-cdk/aws-redshift-alpha/lib/table.ts @@ -144,10 +144,10 @@ export interface TableProps extends DatabaseOptions { readonly removalPolicy?: cdk.RemovalPolicy; /** - * A comment to attach to the table. - * - * @default - no comment - */ + * A comment to attach to the table. + * + * @default - no comment + */ readonly tableComment?: string; } diff --git a/packages/@aws-cdk/aws-route53resolver-alpha/lib/firewall-domain-list.ts b/packages/@aws-cdk/aws-route53resolver-alpha/lib/firewall-domain-list.ts index cad3a21ffc7ef..162588ea0327a 100644 --- a/packages/@aws-cdk/aws-route53resolver-alpha/lib/firewall-domain-list.ts +++ b/packages/@aws-cdk/aws-route53resolver-alpha/lib/firewall-domain-list.ts @@ -164,47 +164,47 @@ export class FirewallDomainList extends Resource implements IFirewallDomainList public readonly firewallDomainListArn: string; /** - * The date and time that the domain list was created - * @attribute - */ + * The date and time that the domain list was created + * @attribute + */ public readonly firewallDomainListCreationTime: string; /** - * The creator request ID - * @attribute - */ + * The creator request ID + * @attribute + */ public readonly firewallDomainListCreatorRequestId: string; /** - * The number of domains in the list - * @attribute - */ + * The number of domains in the list + * @attribute + */ public readonly firewallDomainListDomainCount: number; /** - * The owner of the list, used only for lists that are not managed by you. - * For example, the managed domain list `AWSManagedDomainsMalwareDomainList` - * has the managed owner name `Route 53 Resolver DNS Firewall`. - * @attribute - */ + * The owner of the list, used only for lists that are not managed by you. + * For example, the managed domain list `AWSManagedDomainsMalwareDomainList` + * has the managed owner name `Route 53 Resolver DNS Firewall`. + * @attribute + */ public readonly firewallDomainListManagedOwnerName: string; /** - * The date and time that the domain list was last modified - * @attribute - */ + * The date and time that the domain list was last modified + * @attribute + */ public readonly firewallDomainListModificationTime: string; /** - * The status of the domain list - * @attribute - */ + * The status of the domain list + * @attribute + */ public readonly firewallDomainListStatus: string; /** - * Additional information about the status of the rule group - * @attribute - */ + * Additional information about the status of the rule group + * @attribute + */ public readonly firewallDomainListStatusMessage: string; constructor(scope: Construct, id: string, props: FirewallDomainListProps) { diff --git a/packages/@aws-cdk/aws-route53resolver-alpha/lib/firewall-rule-group-association.ts b/packages/@aws-cdk/aws-route53resolver-alpha/lib/firewall-rule-group-association.ts index 2197762b32da6..f7091e2eca2ef 100644 --- a/packages/@aws-cdk/aws-route53resolver-alpha/lib/firewall-rule-group-association.ts +++ b/packages/@aws-cdk/aws-route53resolver-alpha/lib/firewall-rule-group-association.ts @@ -60,15 +60,15 @@ export class FirewallRuleGroupAssociation extends Resource { public readonly firewallRuleGroupAssociationArn: string; /** - * The date and time that the association was created - * @attribute - */ + * The date and time that the association was created + * @attribute + */ public readonly firewallRuleGroupAssociationCreationTime: string; /** - * The creator request ID - * @attribute - */ + * The creator request ID + * @attribute + */ public readonly firewallRuleGroupAssociationCreatorRequestId: string; /** @@ -79,29 +79,29 @@ export class FirewallRuleGroupAssociation extends Resource { public readonly firewallRuleGroupAssociationId: string; /** - * The owner of the association, used only for lists that are not managed by you. - * If you use AWS Firewall Manager to manage your firewallls from DNS Firewall, - * then this reports Firewall Manager as the managed owner. - * @attribute - */ + * The owner of the association, used only for lists that are not managed by you. + * If you use AWS Firewall Manager to manage your firewallls from DNS Firewall, + * then this reports Firewall Manager as the managed owner. + * @attribute + */ public readonly firewallRuleGroupAssociationManagedOwnerName: string; /** - * The date and time that the association was last modified - * @attribute - */ + * The date and time that the association was last modified + * @attribute + */ public readonly firewallRuleGroupAssociationModificationTime: string; /** - * The status of the association - * @attribute - */ + * The status of the association + * @attribute + */ public readonly firewallRuleGroupAssociationStatus: string; /** - * Additional information about the status of the association - * @attribute - */ + * Additional information about the status of the association + * @attribute + */ public readonly firewallRuleGroupAssociationStatusMessage: string; constructor(scope: Construct, id: string, props: FirewallRuleGroupAssociationProps) { diff --git a/packages/@aws-cdk/aws-servicecatalogappregistry-alpha/lib/target-application.ts b/packages/@aws-cdk/aws-servicecatalogappregistry-alpha/lib/target-application.ts index 6c1dd508fc16a..2da1b4d8bfdfa 100644 --- a/packages/@aws-cdk/aws-servicecatalogappregistry-alpha/lib/target-application.ts +++ b/packages/@aws-cdk/aws-servicecatalogappregistry-alpha/lib/target-application.ts @@ -8,20 +8,20 @@ import { hashValues } from './common'; */ export interface TargetApplicationCommonOptions extends cdk.StackProps { /** - * Stack ID in which application will be created or imported. The id of a stack is also the identifier that you use to - * refer to it in the [AWS CDK Toolkit](https://docs.aws.amazon.com/cdk/v2/guide/cli.html). - * - * @default - The value of `stackName` will be used as stack id - * @deprecated - Use `stackName` instead to control the name and id of the stack - */ + * Stack ID in which application will be created or imported. The id of a stack is also the identifier that you use to + * refer to it in the [AWS CDK Toolkit](https://docs.aws.amazon.com/cdk/v2/guide/cli.html). + * + * @default - The value of `stackName` will be used as stack id + * @deprecated - Use `stackName` instead to control the name and id of the stack + */ readonly stackId?: string; /** - * Determines whether any cross-account stacks defined in the CDK app definition should be associated with the - * target application. If set to `true`, the application will first be shared with the accounts that own the stacks. - * - * @default - false - */ + * Determines whether any cross-account stacks defined in the CDK app definition should be associated with the + * target application. If set to `true`, the application will first be shared with the accounts that own the stacks. + * + * @default - false + */ readonly associateCrossAccountStacks?: boolean; } @@ -30,15 +30,15 @@ export interface TargetApplicationCommonOptions extends cdk.StackProps { */ export interface CreateTargetApplicationOptions extends TargetApplicationCommonOptions { /** - * Enforces a particular physical application name. - */ + * Enforces a particular physical application name. + */ readonly applicationName: string; /** - * Application description. - * - * @default - Application containing stacks deployed via CDK. - */ + * Application description. + * + * @default - Application containing stacks deployed via CDK. + */ readonly applicationDescription?: string; /** @@ -54,8 +54,8 @@ export interface CreateTargetApplicationOptions extends TargetApplicationCommonO */ export interface ExistingTargetApplicationOptions extends TargetApplicationCommonOptions { /** - * Enforces a particular application arn. - */ + * Enforces a particular application arn. + */ readonly applicationArnValue: string; } @@ -65,24 +65,24 @@ export interface ExistingTargetApplicationOptions extends TargetApplicationCommo */ export abstract class TargetApplication { /** - * Factory method to build the input using the provided - * application ARN. - */ + * Factory method to build the input using the provided + * application ARN. + */ public static existingApplicationFromArn(options: ExistingTargetApplicationOptions) : TargetApplication { return new ExistingTargetApplication(options); } /** - * Factory method to build the input using the provided - * application name and stack props. - */ + * Factory method to build the input using the provided + * application name and stack props. + */ public static createApplicationStack(options: CreateTargetApplicationOptions) : TargetApplication { return new CreateTargetApplication(options); } /** - * Called when the ApplicationAssociator is initialized - */ + * Called when the ApplicationAssociator is initialized + */ public abstract bind(scope: Construct): BindTargetApplicationResult; } diff --git a/packages/@aws-cdk/cdk-cli-wrapper/lib/commands/common.ts b/packages/@aws-cdk/cdk-cli-wrapper/lib/commands/common.ts index 393307c260e5b..4dab7838b1109 100644 --- a/packages/@aws-cdk/cdk-cli-wrapper/lib/commands/common.ts +++ b/packages/@aws-cdk/cdk-cli-wrapper/lib/commands/common.ts @@ -89,7 +89,7 @@ export interface DefaultCdkOptions { readonly lookups?: boolean; /** - * Ignores synthesis errors, which will likely produce an invalid output + * Ignores synthesis errors, which will likely produce an invalid output * * @default false */ diff --git a/packages/@aws-cdk/cli-lib-alpha/lib/commands/common.ts b/packages/@aws-cdk/cli-lib-alpha/lib/commands/common.ts index df6413a2a70a4..3602ab6cadb8b 100644 --- a/packages/@aws-cdk/cli-lib-alpha/lib/commands/common.ts +++ b/packages/@aws-cdk/cli-lib-alpha/lib/commands/common.ts @@ -68,7 +68,7 @@ export interface SharedOptions { readonly lookups?: boolean; /** - * Ignores synthesis errors, which will likely produce an invalid output + * Ignores synthesis errors, which will likely produce an invalid output * * @default false */ diff --git a/packages/@aws-cdk/integ-runner/lib/runner/integration-tests.ts b/packages/@aws-cdk/integ-runner/lib/runner/integration-tests.ts index ecda707117ff8..503b4068cef0c 100644 --- a/packages/@aws-cdk/integ-runner/lib/runner/integration-tests.ts +++ b/packages/@aws-cdk/integ-runner/lib/runner/integration-tests.ts @@ -160,10 +160,10 @@ export interface IntegrationTestsDiscoveryOptions { readonly exclude?: boolean; /** - * List of tests to include (or exclude if `exclude=true`) - * - * @default - all matched files - */ + * List of tests to include (or exclude if `exclude=true`) + * + * @default - all matched files + */ readonly tests?: string[]; /** diff --git a/packages/aws-cdk-lib/aws-apigatewayv2/lib/websocket/api.ts b/packages/aws-cdk-lib/aws-apigatewayv2/lib/websocket/api.ts index 569c05f427c74..195c46812db2a 100644 --- a/packages/aws-cdk-lib/aws-apigatewayv2/lib/websocket/api.ts +++ b/packages/aws-cdk-lib/aws-apigatewayv2/lib/websocket/api.ts @@ -23,10 +23,10 @@ export class WebSocketApiKeySelectionExpression { public static readonly HEADER_X_API_KEY = new WebSocketApiKeySelectionExpression('$request.header.x-api-key'); /** - * The API will extract the key value from the `usageIdentifierKey` attribute in the `context` map, - * returned by the Lambda Authorizer. - * See https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-lambda-authorizer-output.html - */ + * The API will extract the key value from the `usageIdentifierKey` attribute in the `context` map, + * returned by the Lambda Authorizer. + * See https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-lambda-authorizer-output.html + */ public static readonly AUTHORIZER_USAGE_IDENTIFIER_KEY = new WebSocketApiKeySelectionExpression('$context.authorizer.usageIdentifierKey'); /** diff --git a/packages/aws-cdk-lib/aws-appsync/lib/schema.ts b/packages/aws-cdk-lib/aws-appsync/lib/schema.ts index d6ef44b4b4b8a..fb7f82107ead7 100644 --- a/packages/aws-cdk-lib/aws-appsync/lib/schema.ts +++ b/packages/aws-cdk-lib/aws-appsync/lib/schema.ts @@ -8,13 +8,13 @@ import { IGraphqlApi } from './graphqlapi-base'; */ export interface ISchemaConfig { /** - * The ID of the api the schema is bound to - */ + * The ID of the api the schema is bound to + */ apiId: string; /** - * The schema definition string - */ + * The schema definition string + */ definition: string; } @@ -33,12 +33,12 @@ export interface SchemaBindOptions {} */ export interface ISchema { /** - * Binds a schema string to a GraphQlApi - * - * @returns ISchemaConfig with apiId and schema definition string - * @param api the api to bind the schema to - * @param options configuration for bind behavior - */ + * Binds a schema string to a GraphQlApi + * + * @returns ISchemaConfig with apiId and schema definition string + * @param api the api to bind the schema to + * @param options configuration for bind behavior + */ bind(api: IGraphqlApi, options?: SchemaBindOptions): ISchemaConfig; } diff --git a/packages/aws-cdk-lib/aws-batch/lib/linux-parameters.ts b/packages/aws-cdk-lib/aws-batch/lib/linux-parameters.ts index c24cebd6c5781..d525df6b963b2 100644 --- a/packages/aws-cdk-lib/aws-batch/lib/linux-parameters.ts +++ b/packages/aws-cdk-lib/aws-batch/lib/linux-parameters.ts @@ -32,18 +32,18 @@ export interface LinuxParametersProps { readonly maxSwap?: cdk.Size; /** - * This allows you to tune a container's memory swappiness behavior. This parameter - * maps to the --memory-swappiness option to docker run. The swappiness relates - * to the kernel's tendency to swap memory. A value of 0 will cause swapping to - * not happen unless absolutely necessary. A value of 100 will cause pages to - * be swapped very aggressively. - * - * This parameter is only supported when you are using the EC2 launch type. - * Accepted values are whole numbers between 0 and 100. If a value is not - * specified for maxSwap then this parameter is ignored. - * - * @default 60 - */ + * This allows you to tune a container's memory swappiness behavior. This parameter + * maps to the --memory-swappiness option to docker run. The swappiness relates + * to the kernel's tendency to swap memory. A value of 0 will cause swapping to + * not happen unless absolutely necessary. A value of 100 will cause pages to + * be swapped very aggressively. + * + * This parameter is only supported when you are using the EC2 launch type. + * Accepted values are whole numbers between 0 and 100. If a value is not + * specified for maxSwap then this parameter is ignored. + * + * @default 60 + */ readonly swappiness?: number; } diff --git a/packages/aws-cdk-lib/aws-certificatemanager/lib/certificate-base.ts b/packages/aws-cdk-lib/aws-certificatemanager/lib/certificate-base.ts index 6cd1e913fd439..3be3e4049edf8 100644 --- a/packages/aws-cdk-lib/aws-certificatemanager/lib/certificate-base.ts +++ b/packages/aws-cdk-lib/aws-certificatemanager/lib/certificate-base.ts @@ -12,10 +12,10 @@ export abstract class CertificateBase extends Resource implements ICertificate { public abstract readonly certificateArn: string; /** - * If the certificate is provisionned in a different region than the - * containing stack, this should be the region in which the certificate lives - * so we can correctly create `Metric` instances. - */ + * If the certificate is provisionned in a different region than the + * containing stack, this should be the region in which the certificate lives + * so we can correctly create `Metric` instances. + */ protected readonly region?: string; public metricDaysToExpiry(props?: cloudwatch.MetricOptions): cloudwatch.Metric { diff --git a/packages/aws-cdk-lib/aws-cloudfront/lib/distribution.ts b/packages/aws-cdk-lib/aws-cloudfront/lib/distribution.ts index 1dc2fe099ac50..70f3fdfae0265 100644 --- a/packages/aws-cdk-lib/aws-cloudfront/lib/distribution.ts +++ b/packages/aws-cdk-lib/aws-cloudfront/lib/distribution.ts @@ -232,32 +232,32 @@ export interface DistributionProps { readonly errorResponses?: ErrorResponse[]; /** - * The minimum version of the SSL protocol that you want CloudFront to use for HTTPS connections. - * - * CloudFront serves your objects only to browsers or devices that support at - * least the SSL version that you specify. - * - * @default - SecurityPolicyProtocol.TLS_V1_2_2021 if the '@aws-cdk/aws-cloudfront:defaultSecurityPolicyTLSv1.2_2021' feature flag is set; otherwise, SecurityPolicyProtocol.TLS_V1_2_2019. - */ + * The minimum version of the SSL protocol that you want CloudFront to use for HTTPS connections. + * + * CloudFront serves your objects only to browsers or devices that support at + * least the SSL version that you specify. + * + * @default - SecurityPolicyProtocol.TLS_V1_2_2021 if the '@aws-cdk/aws-cloudfront:defaultSecurityPolicyTLSv1.2_2021' feature flag is set; otherwise, SecurityPolicyProtocol.TLS_V1_2_2019. + */ readonly minimumProtocolVersion?: SecurityPolicyProtocol; /** - * The SSL method CloudFront will use for your distribution. - * - * Server Name Indication (SNI) - is an extension to the TLS computer networking protocol by which a client indicates - * which hostname it is attempting to connect to at the start of the handshaking process. This allows a server to present - * multiple certificates on the same IP address and TCP port number and hence allows multiple secure (HTTPS) websites - * (or any other service over TLS) to be served by the same IP address without requiring all those sites to use the same certificate. - * - * CloudFront can use SNI to host multiple distributions on the same IP - which a large majority of clients will support. - * - * If your clients cannot support SNI however - CloudFront can use dedicated IPs for your distribution - but there is a prorated monthly charge for - * using this feature. By default, we use SNI - but you can optionally enable dedicated IPs (VIP). - * - * See the CloudFront SSL for more details about pricing : https://aws.amazon.com/cloudfront/custom-ssl-domains/ - * - * @default SSLMethod.SNI - */ + * The SSL method CloudFront will use for your distribution. + * + * Server Name Indication (SNI) - is an extension to the TLS computer networking protocol by which a client indicates + * which hostname it is attempting to connect to at the start of the handshaking process. This allows a server to present + * multiple certificates on the same IP address and TCP port number and hence allows multiple secure (HTTPS) websites + * (or any other service over TLS) to be served by the same IP address without requiring all those sites to use the same certificate. + * + * CloudFront can use SNI to host multiple distributions on the same IP - which a large majority of clients will support. + * + * If your clients cannot support SNI however - CloudFront can use dedicated IPs for your distribution - but there is a prorated monthly charge for + * using this feature. By default, we use SNI - but you can optionally enable dedicated IPs (VIP). + * + * See the CloudFront SSL for more details about pricing : https://aws.amazon.com/cloudfront/custom-ssl-domains/ + * + * @default SSLMethod.SNI + */ readonly sslSupportMethod?: SSLMethod; /** diff --git a/packages/aws-cdk-lib/aws-cloudfront/lib/endpoint.ts b/packages/aws-cdk-lib/aws-cloudfront/lib/endpoint.ts index d7069944f2560..65d049e17e0ac 100644 --- a/packages/aws-cdk-lib/aws-cloudfront/lib/endpoint.ts +++ b/packages/aws-cdk-lib/aws-cloudfront/lib/endpoint.ts @@ -9,10 +9,10 @@ import { PhysicalName } from '../../core'; export abstract class Endpoint { /** - * Configure a Kinesis Stream Endpoint for Realtime Log Config - * - * @default - a role will be created and used across your endpoints - */ + * Configure a Kinesis Stream Endpoint for Realtime Log Config + * + * @default - a role will be created and used across your endpoints + */ public static fromKinesisStream(stream: kinesis.IStream, role?: iam.IRole): Endpoint { return new (class extends Endpoint { public _renderEndpoint(scope: Construct) { diff --git a/packages/aws-cdk-lib/aws-codebuild/lib/build-spec.ts b/packages/aws-cdk-lib/aws-codebuild/lib/build-spec.ts index 930ade02086f3..f83e33440eaa0 100644 --- a/packages/aws-cdk-lib/aws-codebuild/lib/build-spec.ts +++ b/packages/aws-cdk-lib/aws-codebuild/lib/build-spec.ts @@ -31,10 +31,10 @@ export abstract class BuildSpec { } /** - * Use the contents of a local file as the build spec string - * - * Use this if you have a local .yml or .json file that you want to use as the buildspec - */ + * Use the contents of a local file as the build spec string + * + * Use this if you have a local .yml or .json file that you want to use as the buildspec + */ public static fromAsset(path: string): BuildSpec { return new AssetBuildSpec(path); } diff --git a/packages/aws-cdk-lib/aws-codedeploy/lib/ecs/deployment-group.ts b/packages/aws-cdk-lib/aws-codedeploy/lib/ecs/deployment-group.ts index 9ff4b247952f4..1acee55f5889b 100644 --- a/packages/aws-cdk-lib/aws-codedeploy/lib/ecs/deployment-group.ts +++ b/packages/aws-cdk-lib/aws-codedeploy/lib/ecs/deployment-group.ts @@ -97,17 +97,17 @@ export interface EcsBlueGreenDeploymentConfig { readonly deploymentApprovalWaitTime?: cdk.Duration; /** - * Specify how long CodeDeploy waits before it terminates the original 'blue' ECS task set when a blue-green deployment is complete. - * - * During this wait time, CodeDeploy will continue to monitor any CloudWatch alarms specified for the deployment group, - * and the deployment group can be configured to automatically roll back if those alarms fire. Once CodeDeploy begins to - * terminate the 'blue' ECS task set, the deployment can no longer be rolled back, manually or automatically. - * - * By default, the deployment will immediately terminate the 'blue' ECS task set after production traffic is successfully - * routed to the 'green' ECS task set. - * - * @default 0 - */ + * Specify how long CodeDeploy waits before it terminates the original 'blue' ECS task set when a blue-green deployment is complete. + * + * During this wait time, CodeDeploy will continue to monitor any CloudWatch alarms specified for the deployment group, + * and the deployment group can be configured to automatically roll back if those alarms fire. Once CodeDeploy begins to + * terminate the 'blue' ECS task set, the deployment can no longer be rolled back, manually or automatically. + * + * By default, the deployment will immediately terminate the 'blue' ECS task set after production traffic is successfully + * routed to the 'green' ECS task set. + * + * @default 0 + */ readonly terminationWaitTime?: cdk.Duration; } diff --git a/packages/aws-cdk-lib/aws-cognito/lib/user-pool-idps/oidc.ts b/packages/aws-cdk-lib/aws-cognito/lib/user-pool-idps/oidc.ts index c17b48a799bdc..72e6e92c5ed4e 100644 --- a/packages/aws-cdk-lib/aws-cognito/lib/user-pool-idps/oidc.ts +++ b/packages/aws-cdk-lib/aws-cognito/lib/user-pool-idps/oidc.ts @@ -72,17 +72,17 @@ export interface OidcEndpoints { readonly authorization: string; /** - * Token endpoint - */ + * Token endpoint + */ readonly token: string; /** - * UserInfo endpoint - */ + * UserInfo endpoint + */ readonly userInfo: string; /** - * Jwks_uri endpoint + * Jwks_uri endpoint */ readonly jwksUri: string; } diff --git a/packages/aws-cdk-lib/aws-config/lib/rule.ts b/packages/aws-cdk-lib/aws-config/lib/rule.ts index 81285ebb87d12..9b9dc866b645b 100644 --- a/packages/aws-cdk-lib/aws-config/lib/rule.ts +++ b/packages/aws-cdk-lib/aws-config/lib/rule.ts @@ -1319,9 +1319,9 @@ export class ManagedRuleIdentifiers { */ public static readonly EKS_CLUSTER_OLDEST_SUPPORTED_VERSION = 'EKS_CLUSTER_OLDEST_SUPPORTED_VERSION'; /** - * Checks if an Amazon Elastic Kubernetes Service (EKS) cluster is running a supported Kubernetes version. - * @see https://docs.aws.amazon.com/config/latest/developerguide/eks-cluster-supported-version.html - */ + * Checks if an Amazon Elastic Kubernetes Service (EKS) cluster is running a supported Kubernetes version. + * @see https://docs.aws.amazon.com/config/latest/developerguide/eks-cluster-supported-version.html + */ public static readonly EKS_CLUSTER_SUPPORTED_VERSION = 'EKS_CLUSTER_SUPPORTED_VERSION'; /** * Checks whether Amazon Elastic Kubernetes Service (Amazon EKS) endpoint is not publicly accessible. diff --git a/packages/aws-cdk-lib/aws-docdb/lib/cluster.ts b/packages/aws-cdk-lib/aws-docdb/lib/cluster.ts index 6701038ac2d6d..91e99ec8eeef5 100644 --- a/packages/aws-cdk-lib/aws-docdb/lib/cluster.ts +++ b/packages/aws-cdk-lib/aws-docdb/lib/cluster.ts @@ -118,31 +118,31 @@ export interface DatabaseClusterProps { readonly caCertificate?: CaCertificate; /** - * What subnets to run the DocumentDB instances in. - * - * Must be at least 2 subnets in two different AZs. - */ + * What subnets to run the DocumentDB instances in. + * + * Must be at least 2 subnets in two different AZs. + */ readonly vpc: ec2.IVpc; /** - * Where to place the instances within the VPC - * - * @default private subnets - */ + * Where to place the instances within the VPC + * + * @default private subnets + */ readonly vpcSubnets?: ec2.SubnetSelection; /** - * Security group. - * - * @default a new security group is created. - */ + * Security group. + * + * @default a new security group is created. + */ readonly securityGroup?: ec2.ISecurityGroup; /** - * The DB parameter group to associate with the instance. - * - * @default no parameter group - */ + * The DB parameter group to associate with the instance. + * + * @default no parameter group + */ readonly parameterGroup?: IClusterParameterGroup; /** @@ -211,11 +211,11 @@ export interface DatabaseClusterProps { readonly cloudWatchLogsRetention?: logs.RetentionDays; /** - * The IAM role for the Lambda function associated with the custom resource - * that sets the retention policy. - * - * @default - a new role is created. - */ + * The IAM role for the Lambda function associated with the custom resource + * that sets the retention policy. + * + * @default - a new role is created. + */ readonly cloudWatchLogsRetentionRole?: IRole; /** diff --git a/packages/aws-cdk-lib/aws-dynamodb/lib/table.ts b/packages/aws-cdk-lib/aws-dynamodb/lib/table.ts index 03d2681382544..0b381a5f90dcb 100644 --- a/packages/aws-cdk-lib/aws-dynamodb/lib/table.ts +++ b/packages/aws-cdk-lib/aws-dynamodb/lib/table.ts @@ -243,13 +243,13 @@ export interface TableOptions extends SchemaOptions { */ readonly maxReadRequestUnits?: number; /** - * The write request units for the table. Careful if you add Global Secondary Indexes, as - * those will share the table's maximum on-demand throughput. - * - * Can only be provided if billingMode is PAY_PER_REQUEST. - * - * @default - on-demand throughput is disabled - */ + * The write request units for the table. Careful if you add Global Secondary Indexes, as + * those will share the table's maximum on-demand throughput. + * + * Can only be provided if billingMode is PAY_PER_REQUEST. + * + * @default - on-demand throughput is disabled + */ readonly maxWriteRequestUnits?: number; /** diff --git a/packages/aws-cdk-lib/aws-ecs-patterns/lib/base/application-multiple-target-groups-service-base.ts b/packages/aws-cdk-lib/aws-ecs-patterns/lib/base/application-multiple-target-groups-service-base.ts index 11898cbfb511c..15032a4957839 100644 --- a/packages/aws-cdk-lib/aws-ecs-patterns/lib/base/application-multiple-target-groups-service-base.ts +++ b/packages/aws-cdk-lib/aws-ecs-patterns/lib/base/application-multiple-target-groups-service-base.ts @@ -382,7 +382,7 @@ export abstract class ApplicationMultipleTargetGroupsServiceBase extends Constru public readonly loadBalancer: ApplicationLoadBalancer; /** - * The default listener for the service (first added listener). + * The default listener for the service (first added listener). * @deprecated - Use `listeners` instead. */ public readonly listener: ApplicationListener; @@ -394,8 +394,8 @@ export abstract class ApplicationMultipleTargetGroupsServiceBase extends Constru protected logDriver?: LogDriver; /** - * The listeners of the service. - */ + * The listeners of the service. + */ public readonly listeners = new Array(); /** * The target groups of the service. diff --git a/packages/aws-cdk-lib/aws-ecs-patterns/lib/base/fargate-service-base.ts b/packages/aws-cdk-lib/aws-ecs-patterns/lib/base/fargate-service-base.ts index d8df18c5501db..838bacd046d45 100644 --- a/packages/aws-cdk-lib/aws-ecs-patterns/lib/base/fargate-service-base.ts +++ b/packages/aws-cdk-lib/aws-ecs-patterns/lib/base/fargate-service-base.ts @@ -36,40 +36,40 @@ export interface FargateServiceBaseProps { readonly cpu?: number; /** - * The amount (in MiB) of memory used by the task. - * - * This field is required and you must use one of the following values, which determines your range of valid values - * for the cpu parameter: - * - * 512 (0.5 GB), 1024 (1 GB), 2048 (2 GB) - Available cpu values: 256 (.25 vCPU) - * - * 1024 (1 GB), 2048 (2 GB), 3072 (3 GB), 4096 (4 GB) - Available cpu values: 512 (.5 vCPU) - * - * 2048 (2 GB), 3072 (3 GB), 4096 (4 GB), 5120 (5 GB), 6144 (6 GB), 7168 (7 GB), 8192 (8 GB) - Available cpu values: 1024 (1 vCPU) - * - * Between 4096 (4 GB) and 16384 (16 GB) in increments of 1024 (1 GB) - Available cpu values: 2048 (2 vCPU) - * - * Between 8192 (8 GB) and 30720 (30 GB) in increments of 1024 (1 GB) - Available cpu values: 4096 (4 vCPU) - * - * Between 16384 (16 GB) and 61440 (60 GB) in increments of 4096 (4 GB) - Available cpu values: 8192 (8 vCPU) - * - * Between 32768 (32 GB) and 122880 (120 GB) in increments of 8192 (8 GB) - Available cpu values: 16384 (16 vCPU) - * - * This default is set in the underlying FargateTaskDefinition construct. - * - * @default 512 - */ + * The amount (in MiB) of memory used by the task. + * + * This field is required and you must use one of the following values, which determines your range of valid values + * for the cpu parameter: + * + * 512 (0.5 GB), 1024 (1 GB), 2048 (2 GB) - Available cpu values: 256 (.25 vCPU) + * + * 1024 (1 GB), 2048 (2 GB), 3072 (3 GB), 4096 (4 GB) - Available cpu values: 512 (.5 vCPU) + * + * 2048 (2 GB), 3072 (3 GB), 4096 (4 GB), 5120 (5 GB), 6144 (6 GB), 7168 (7 GB), 8192 (8 GB) - Available cpu values: 1024 (1 vCPU) + * + * Between 4096 (4 GB) and 16384 (16 GB) in increments of 1024 (1 GB) - Available cpu values: 2048 (2 vCPU) + * + * Between 8192 (8 GB) and 30720 (30 GB) in increments of 1024 (1 GB) - Available cpu values: 4096 (4 vCPU) + * + * Between 16384 (16 GB) and 61440 (60 GB) in increments of 4096 (4 GB) - Available cpu values: 8192 (8 vCPU) + * + * Between 32768 (32 GB) and 122880 (120 GB) in increments of 8192 (8 GB) - Available cpu values: 16384 (16 vCPU) + * + * This default is set in the underlying FargateTaskDefinition construct. + * + * @default 512 + */ readonly memoryLimitMiB?: number; /** - * The amount (in GiB) of ephemeral storage to be allocated to the task. - * - * The minimum supported value is `21` GiB and the maximum supported value is `200` GiB. - * - * Only supported in Fargate platform version 1.4.0 or later. - * - * @default Undefined, in which case, the task will receive 20GiB ephemeral storage. - */ + * The amount (in GiB) of ephemeral storage to be allocated to the task. + * + * The minimum supported value is `21` GiB and the maximum supported value is `200` GiB. + * + * Only supported in Fargate platform version 1.4.0 or later. + * + * @default Undefined, in which case, the task will receive 20GiB ephemeral storage. + */ readonly ephemeralStorageGiB?: number; /** diff --git a/packages/aws-cdk-lib/aws-ecs-patterns/lib/base/scheduled-task-base.ts b/packages/aws-cdk-lib/aws-ecs-patterns/lib/base/scheduled-task-base.ts index 887e41b7ecea2..509c77b5cdf3d 100644 --- a/packages/aws-cdk-lib/aws-ecs-patterns/lib/base/scheduled-task-base.ts +++ b/packages/aws-cdk-lib/aws-ecs-patterns/lib/base/scheduled-task-base.ts @@ -73,10 +73,10 @@ export interface ScheduledTaskBaseProps { readonly securityGroups?: ISecurityGroup[]; /** - * Specifies whether to propagate the tags from the task definition to the task. If no value is specified, the tags are not propagated. - * - * @default - Tags will not be propagated - */ + * Specifies whether to propagate the tags from the task definition to the task. If no value is specified, the tags are not propagated. + * + * @default - Tags will not be propagated + */ readonly propagateTags?: PropagatedTagSource; /** @@ -168,10 +168,10 @@ export abstract class ScheduledTaskBase extends Construct { private readonly _securityGroups?: ISecurityGroup[]; /** - * Specifies whether to propagate the tags from the task definition to the task. If no value is specified, the tags are not propagated. - * - * @default - Tags will not be propagated - */ + * Specifies whether to propagate the tags from the task definition to the task. If no value is specified, the tags are not propagated. + * + * @default - Tags will not be propagated + */ public readonly propagateTags?: PropagatedTagSource; /** diff --git a/packages/aws-cdk-lib/aws-ecs/lib/cluster.ts b/packages/aws-cdk-lib/aws-ecs/lib/cluster.ts index de9ee678f04e4..fb504110aa77a 100644 --- a/packages/aws-cdk-lib/aws-ecs/lib/cluster.ts +++ b/packages/aws-cdk-lib/aws-ecs/lib/cluster.ts @@ -107,7 +107,7 @@ export enum MachineImageType { export class Cluster extends Resource implements ICluster { /** - * Return whether the given object is a Cluster + * Return whether the given object is a Cluster */ public static isCluster(x: any) : x is Cluster { return x !== null && typeof(x) === 'object' && CLUSTER_SYMBOL in x; diff --git a/packages/aws-cdk-lib/aws-ecs/lib/linux-parameters.ts b/packages/aws-cdk-lib/aws-ecs/lib/linux-parameters.ts index 282fd1f221599..78030d180f20d 100644 --- a/packages/aws-cdk-lib/aws-ecs/lib/linux-parameters.ts +++ b/packages/aws-cdk-lib/aws-ecs/lib/linux-parameters.ts @@ -32,18 +32,18 @@ export interface LinuxParametersProps { readonly maxSwap?: cdk.Size; /** - * This allows you to tune a container's memory swappiness behavior. This parameter - * maps to the --memory-swappiness option to docker run. The swappiness relates - * to the kernel's tendency to swap memory. A value of 0 will cause swapping to - * not happen unless absolutely necessary. A value of 100 will cause pages to - * be swapped very aggressively. - * - * This parameter is only supported when you are using the EC2 launch type. - * Accepted values are whole numbers between 0 and 100. If a value is not - * specified for maxSwap then this parameter is ignored. - * - * @default 60 - */ + * This allows you to tune a container's memory swappiness behavior. This parameter + * maps to the --memory-swappiness option to docker run. The swappiness relates + * to the kernel's tendency to swap memory. A value of 0 will cause swapping to + * not happen unless absolutely necessary. A value of 100 will cause pages to + * be swapped very aggressively. + * + * This parameter is only supported when you are using the EC2 launch type. + * Accepted values are whole numbers between 0 and 100. If a value is not + * specified for maxSwap then this parameter is ignored. + * + * @default 60 + */ readonly swappiness?: number; } diff --git a/packages/aws-cdk-lib/aws-events-targets/lib/ecs-task.ts b/packages/aws-cdk-lib/aws-events-targets/lib/ecs-task.ts index 87e5c3dd8a06c..886622d0215a0 100644 --- a/packages/aws-cdk-lib/aws-events-targets/lib/ecs-task.ts +++ b/packages/aws-cdk-lib/aws-events-targets/lib/ecs-task.ts @@ -105,33 +105,33 @@ export interface EcsTaskProps extends TargetBaseProps { readonly assignPublicIp?: boolean; /** - * Specifies whether to propagate the tags from the task definition to the task. If no value is specified, the tags are not propagated. - * - * @default - Tags will not be propagated - */ + * Specifies whether to propagate the tags from the task definition to the task. If no value is specified, the tags are not propagated. + * + * @default - Tags will not be propagated + */ readonly propagateTags?: ecs.PropagatedTagSource; /** - * The metadata that you apply to the task to help you categorize and organize them. Each tag consists of a key and an optional value, both of which you define. - * - * @default - No additional tags are applied to the task - */ + * The metadata that you apply to the task to help you categorize and organize them. Each tag consists of a key and an optional value, both of which you define. + * + * @default - No additional tags are applied to the task + */ readonly tags?: Tag[]; /** - * Whether or not to enable the execute command functionality for the containers in this task. - * If true, this enables execute command functionality on all containers in the task. - * - * @default - false - */ + * Whether or not to enable the execute command functionality for the containers in this task. + * If true, this enables execute command functionality on all containers in the task. + * + * @default - false + */ readonly enableExecuteCommand?: boolean; /** - * Specifies the launch type on which your task is running. The launch type that you specify here - * must match one of the launch type (compatibilities) of the target task. - * - * @default - 'EC2' if `isEc2Compatible` for the `taskDefinition` is true, otherwise 'FARGATE' - */ + * Specifies the launch type on which your task is running. The launch type that you specify here + * must match one of the launch type (compatibilities) of the target task. + * + * @default - 'EC2' if `isEc2Compatible` for the `taskDefinition` is true, otherwise 'FARGATE' + */ readonly launchType?: ecs.LaunchType; } diff --git a/packages/aws-cdk-lib/aws-iam/lib/role.ts b/packages/aws-cdk-lib/aws-iam/lib/role.ts index 37484fdf0f2ff..8705f132f6173 100644 --- a/packages/aws-cdk-lib/aws-iam/lib/role.ts +++ b/packages/aws-cdk-lib/aws-iam/lib/role.ts @@ -300,7 +300,7 @@ export class Role extends Resource implements IRole { } /** - * Return whether the given object is a Role + * Return whether the given object is a Role */ public static isRole(x: any) : x is Role { return x !== null && typeof(x) === 'object' && IAM_ROLE_SYMBOL in x; diff --git a/packages/aws-cdk-lib/aws-ses/lib/email-identity.ts b/packages/aws-cdk-lib/aws-ses/lib/email-identity.ts index 49ec4298d17c1..82d8e5d6b0ff5 100644 --- a/packages/aws-cdk-lib/aws-ses/lib/email-identity.ts +++ b/packages/aws-cdk-lib/aws-ses/lib/email-identity.ts @@ -187,19 +187,19 @@ export interface DkimIdentityConfig { readonly domainSigningPrivateKey?: string; /** - * A string that's used to identify a public key in the DNS configuration for - * a domain - * - * @default - use Easy DKIM - */ + * A string that's used to identify a public key in the DNS configuration for + * a domain + * + * @default - use Easy DKIM + */ readonly domainSigningSelector?: string; /** - * The key length of the future DKIM key pair to be generated. This can be changed - * at most once per day. - * - * @default EasyDkimSigningKeyLength.RSA_2048_BIT - */ + * The key length of the future DKIM key pair to be generated. This can be changed + * at most once per day. + * + * @default EasyDkimSigningKeyLength.RSA_2048_BIT + */ readonly nextSigningKeyLength?: EasyDkimSigningKeyLength; } diff --git a/packages/aws-cdk-lib/aws-stepfunctions/test/private/fake-task.ts b/packages/aws-cdk-lib/aws-stepfunctions/test/private/fake-task.ts index 20b4a38e391fc..fe5c69b880230 100644 --- a/packages/aws-cdk-lib/aws-stepfunctions/test/private/fake-task.ts +++ b/packages/aws-cdk-lib/aws-stepfunctions/test/private/fake-task.ts @@ -16,8 +16,8 @@ export class FakeTask extends sfn.TaskStateBase { } /** - * @internal - */ + * @internal + */ protected _renderTask(): any { return { Resource: 'my-resource', diff --git a/packages/aws-cdk-lib/aws-synthetics/lib/runtime.ts b/packages/aws-cdk-lib/aws-synthetics/lib/runtime.ts index a44f914678a52..e41cfae47fa11 100644 --- a/packages/aws-cdk-lib/aws-synthetics/lib/runtime.ts +++ b/packages/aws-cdk-lib/aws-synthetics/lib/runtime.ts @@ -349,9 +349,9 @@ export class Runtime { public static readonly SYNTHETICS_PYTHON_SELENIUM_4_0 = new Runtime('syn-python-selenium-4.0', RuntimeFamily.PYTHON); /** - * @param name The name of the runtime version - * @param family The Lambda runtime family - */ + * @param name The name of the runtime version + * @param family The Lambda runtime family + */ public constructor(public readonly name: string, public readonly family: RuntimeFamily) { } } diff --git a/packages/aws-cdk/lib/api/deployments.ts b/packages/aws-cdk/lib/api/deployments.ts index a2e729ce30689..16c87b07adc42 100644 --- a/packages/aws-cdk/lib/api/deployments.ts +++ b/packages/aws-cdk/lib/api/deployments.ts @@ -711,23 +711,23 @@ export class Deployments { } /** - * Try to use the bootstrap lookupRole. There are two scenarios that are handled here - * 1. The lookup role may not exist (it was added in bootstrap stack version 7) - * 2. The lookup role may not have the correct permissions (ReadOnlyAccess was added in - * bootstrap stack version 8) - * - * In the case of 1 (lookup role doesn't exist) `forEnvironment` will either: - * 1. Return the default credentials if the default credentials are for the stack account - * 2. Throw an error if the default credentials are not for the stack account. - * - * If we successfully assume the lookup role we then proceed to 2 and check whether the bootstrap - * stack version is valid. If it is not we throw an error which should be handled in the calling - * function (and fallback to use a different role, etc) - * - * If we do not successfully assume the lookup role, but do get back the default credentials - * then return those and note that we are returning the default credentials. The calling - * function can then decide to use them or fallback to another role. - */ + * Try to use the bootstrap lookupRole. There are two scenarios that are handled here + * 1. The lookup role may not exist (it was added in bootstrap stack version 7) + * 2. The lookup role may not have the correct permissions (ReadOnlyAccess was added in + * bootstrap stack version 8) + * + * In the case of 1 (lookup role doesn't exist) `forEnvironment` will either: + * 1. Return the default credentials if the default credentials are for the stack account + * 2. Throw an error if the default credentials are not for the stack account. + * + * If we successfully assume the lookup role we then proceed to 2 and check whether the bootstrap + * stack version is valid. If it is not we throw an error which should be handled in the calling + * function (and fallback to use a different role, etc) + * + * If we do not successfully assume the lookup role, but do get back the default credentials + * then return those and note that we are returning the default credentials. The calling + * function can then decide to use them or fallback to another role. + */ public async prepareSdkWithLookupRoleFor( stack: cxapi.CloudFormationStackArtifact, ): Promise { From fee2cf88c58c6c1f25b9e6fad87c8042de464fd9 Mon Sep 17 00:00:00 2001 From: Atanas Pamukchiev Date: Wed, 23 Oct 2024 18:53:01 +0200 Subject: [PATCH 19/33] feat(cli): add ability to configure hotswap properties for ECS (#30511) ### Issue #29618 ### Reason for this change We aim to speed up deployment times in our development environment by using the hotswap feature. However, our services have dependencies on each other, and the current hotswap behavior is too disruptive. ### Description of changes We modified the hotswap implementation for ECS services to pass the `minimumHealthyPercent` and `maximumHealthyPercent` configurable parameters. These parameters are exposed to the cli and can be passed as `--hotswap-ecs-minimum-healthy-percent ` and `--hotswap-ecs-maximum-healthy-percent ` The implementation is careful to maintain the existing behaviour. That is, if none of the new flags is used, the current `minimumHealthyPercent = 0` and `maximumHealthyPercent = undefined` values are used. ### Description of how you validated changes We added a unit test validating that the correct values are passed to the task definition. We also executed using the locally built version of cdk validating that the behavior is as expected: the parameters are respected during hotswap deployments, and the existing API is maintained. ### Checklist - [x] My code adheres to the [CONTRIBUTING GUIDE](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and [DESIGN GUIDELINES](https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md) ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license* --- .../tests/cli-integ-tests/cli.integtest.ts | 52 +++++++++++ packages/aws-cdk/README.md | 13 +++ packages/aws-cdk/lib/api/deploy-stack.ts | 10 +- packages/aws-cdk/lib/api/deployments.ts | 8 +- .../aws-cdk/lib/api/hotswap-deployments.ts | 31 +++++-- packages/aws-cdk/lib/api/hotswap/common.ts | 46 ++++++++++ .../aws-cdk/lib/api/hotswap/ecs-services.ts | 14 ++- packages/aws-cdk/lib/cdk-toolkit.ts | 11 ++- packages/aws-cdk/lib/settings.ts | 6 ++ .../aws-cdk/test/api/deploy-stack.test.ts | 4 +- .../ecs-services-hotswap-deployments.test.ts | 91 ++++++++++++++++++- .../test/api/hotswap/hotswap-test-setup.ts | 6 +- 12 files changed, 272 insertions(+), 20 deletions(-) diff --git a/packages/@aws-cdk-testing/cli-integ/tests/cli-integ-tests/cli.integtest.ts b/packages/@aws-cdk-testing/cli-integ/tests/cli-integ-tests/cli.integtest.ts index a7365c8a1b993..b1c0d4f62bbad 100644 --- a/packages/@aws-cdk-testing/cli-integ/tests/cli-integ-tests/cli.integtest.ts +++ b/packages/@aws-cdk-testing/cli-integ/tests/cli-integ-tests/cli.integtest.ts @@ -2301,6 +2301,58 @@ integTest('hotswap deployment supports AppSync APIs with many functions', }), ); +integTest('hotswap ECS deployment respects properties override', withDefaultFixture(async (fixture) => { + // Update the CDK context with the new ECS properties + let ecsMinimumHealthyPercent = 100; + let ecsMaximumHealthyPercent = 200; + let cdkJson = JSON.parse(await fs.readFile(path.join(fixture.integTestDir, 'cdk.json'), 'utf8')); + cdkJson = { + ...cdkJson, + hotswap: { + ecs: { + minimumHealthyPercent: ecsMinimumHealthyPercent, + maximumHealthyPercent: ecsMaximumHealthyPercent, + }, + }, + }; + + await fs.writeFile(path.join(fixture.integTestDir, 'cdk.json'), JSON.stringify(cdkJson)); + + // GIVEN + const stackArn = await fixture.cdkDeploy('ecs-hotswap', { + captureStderr: false, + }); + + // WHEN + await fixture.cdkDeploy('ecs-hotswap', { + options: [ + '--hotswap', + ], + modEnv: { + DYNAMIC_ECS_PROPERTY_VALUE: 'new value', + }, + }); + + const describeStacksResponse = await fixture.aws.cloudFormation.send( + new DescribeStacksCommand({ + StackName: stackArn, + }), + ); + + const clusterName = describeStacksResponse.Stacks?.[0].Outputs?.find(output => output.OutputKey == 'ClusterName')?.OutputValue!; + const serviceName = describeStacksResponse.Stacks?.[0].Outputs?.find(output => output.OutputKey == 'ServiceName')?.OutputValue!; + + // THEN + const describeServicesResponse = await fixture.aws.ecs.send( + new DescribeServicesCommand({ + cluster: clusterName, + services: [serviceName], + }), + ); + expect(describeServicesResponse.services?.[0].deploymentConfiguration?.minimumHealthyPercent).toEqual(ecsMinimumHealthyPercent); + expect(describeServicesResponse.services?.[0].deploymentConfiguration?.maximumPercent).toEqual(ecsMaximumHealthyPercent); +})); + async function listChildren(parent: string, pred: (x: string) => Promise) { const ret = new Array(); for (const child of await fs.readdir(parent, { encoding: 'utf-8' })) { diff --git a/packages/aws-cdk/README.md b/packages/aws-cdk/README.md index deec121451f77..30818c8cb1402 100644 --- a/packages/aws-cdk/README.md +++ b/packages/aws-cdk/README.md @@ -451,6 +451,19 @@ Hotswapping is currently supported for the following changes - VTL mapping template changes for AppSync Resolvers and Functions. - Schema changes for AppSync GraphQL Apis. +You can optionally configure the behavior of your hotswap deployments in `cdk.json`. Currently you can only configure ECS hotswap behavior: + +```json +{ +"hotswap": { + "ecs": { + "minimumHealthyPercent": 100, + "maximumHealthyPercent": 250 + } + } +} +``` + **⚠ Note #1**: This command deliberately introduces drift in CloudFormation stacks in order to speed up deployments. For this reason, only use it for development purposes. **Never use this flag for your production deployments**! diff --git a/packages/aws-cdk/lib/api/deploy-stack.ts b/packages/aws-cdk/lib/api/deploy-stack.ts index 4a142d82e4309..16da0447b81f5 100644 --- a/packages/aws-cdk/lib/api/deploy-stack.ts +++ b/packages/aws-cdk/lib/api/deploy-stack.ts @@ -5,7 +5,7 @@ import * as uuid from 'uuid'; import { ISDK, SdkProvider } from './aws-auth'; import { EnvironmentResources } from './environment-resources'; import { CfnEvaluationException } from './evaluate-cloudformation-template'; -import { HotswapMode, ICON } from './hotswap/common'; +import { HotswapMode, HotswapPropertyOverrides, ICON } from './hotswap/common'; import { tryHotswapDeployment } from './hotswap-deployments'; import { addMetadataAssetsToManifest } from '../assets'; import { Tag } from '../cdk-toolkit'; @@ -173,6 +173,11 @@ export interface DeployStackOptions { */ readonly hotswap?: HotswapMode; + /** + * Extra properties that configure hotswap behavior + */ + readonly hotswapPropertyOverrides?: HotswapPropertyOverrides; + /** * The extra string to append to the User-Agent header when performing AWS SDK calls. * @@ -264,6 +269,7 @@ export async function deployStack(options: DeployStackOptions): Promise Promise; const RESOURCE_DETECTORS: { [key: string]: HotswapDetector } = { @@ -62,7 +65,7 @@ const RESOURCE_DETECTORS: { [key: string]: HotswapDetector } = { export async function tryHotswapDeployment( sdkProvider: SdkProvider, assetParams: { [key: string]: string }, cloudFormationStack: CloudFormationStack, stackArtifact: cxapi.CloudFormationStackArtifact, - hotswapMode: HotswapMode, + hotswapMode: HotswapMode, hotswapPropertyOverrides: HotswapPropertyOverrides, ): Promise { // resolve the environment, so we can substitute things like AWS::Region in CFN expressions const resolvedEnv = await sdkProvider.resolveEnvironment(stackArtifact.environment); @@ -86,7 +89,7 @@ export async function tryHotswapDeployment( const stackChanges = cfn_diff.fullDiff(currentTemplate.deployedRootTemplate, stackArtifact.template); const { hotswappableChanges, nonHotswappableChanges } = await classifyResourceChanges( - stackChanges, evaluateCfnTemplate, sdk, currentTemplate.nestedStacks, + stackChanges, evaluateCfnTemplate, sdk, currentTemplate.nestedStacks, hotswapPropertyOverrides, ); logNonHotswappableChanges(nonHotswappableChanges, hotswapMode); @@ -113,6 +116,7 @@ async function classifyResourceChanges( evaluateCfnTemplate: EvaluateCloudFormationTemplate, sdk: ISDK, nestedStackNames: { [nestedStackName: string]: NestedStackTemplates }, + hotswapPropertyOverrides: HotswapPropertyOverrides, ): Promise { const resourceDifferences = getStackResourceDifferences(stackChanges); @@ -131,7 +135,14 @@ async function classifyResourceChanges( // gather the results of the detector functions for (const [logicalId, change] of Object.entries(resourceDifferences)) { if (change.newValue?.Type === 'AWS::CloudFormation::Stack' && change.oldValue?.Type === 'AWS::CloudFormation::Stack') { - const nestedHotswappableResources = await findNestedHotswappableChanges(logicalId, change, nestedStackNames, evaluateCfnTemplate, sdk); + const nestedHotswappableResources = await findNestedHotswappableChanges( + logicalId, + change, + nestedStackNames, + evaluateCfnTemplate, + sdk, + hotswapPropertyOverrides, + ); hotswappableResources.push(...nestedHotswappableResources.hotswappableChanges); nonHotswappableResources.push(...nestedHotswappableResources.nonHotswappableChanges); @@ -151,7 +162,7 @@ async function classifyResourceChanges( const resourceType: string = hotswappableChangeCandidate.newValue.Type; if (resourceType in RESOURCE_DETECTORS) { // run detector functions lazily to prevent unhandled promise rejections - promises.push(() => RESOURCE_DETECTORS[resourceType](logicalId, hotswappableChangeCandidate, evaluateCfnTemplate)); + promises.push(() => RESOURCE_DETECTORS[resourceType](logicalId, hotswappableChangeCandidate, evaluateCfnTemplate, hotswapPropertyOverrides)); } else { reportNonHotswappableChange(nonHotswappableResources, hotswappableChangeCandidate, undefined, 'This resource type is not supported for hotswap deployments'); } @@ -233,6 +244,7 @@ async function findNestedHotswappableChanges( nestedStackTemplates: { [nestedStackName: string]: NestedStackTemplates }, evaluateCfnTemplate: EvaluateCloudFormationTemplate, sdk: ISDK, + hotswapPropertyOverrides: HotswapPropertyOverrides, ): Promise { const nestedStack = nestedStackTemplates[logicalId]; if (!nestedStack.physicalName) { @@ -256,7 +268,12 @@ async function findNestedHotswappableChanges( nestedStackTemplates[logicalId].deployedTemplate, nestedStackTemplates[logicalId].generatedTemplate, ); - return classifyResourceChanges(nestedDiff, evaluateNestedCfnTemplate, sdk, nestedStackTemplates[logicalId].nestedStackTemplates); + return classifyResourceChanges( + nestedDiff, + evaluateNestedCfnTemplate, + sdk, + nestedStackTemplates[logicalId].nestedStackTemplates, + hotswapPropertyOverrides); } /** Returns 'true' if a pair of changes is for the same resource. */ diff --git a/packages/aws-cdk/lib/api/hotswap/common.ts b/packages/aws-cdk/lib/api/hotswap/common.ts index eb4b787d04e92..a066e7b0e4d5d 100644 --- a/packages/aws-cdk/lib/api/hotswap/common.ts +++ b/packages/aws-cdk/lib/api/hotswap/common.ts @@ -98,6 +98,52 @@ export class HotswappableChangeCandidate { type Exclude = { [key: string]: Exclude | true } +/** + * Represents configuration property overrides for hotswap deployments + */ +export class HotswapPropertyOverrides { + // Each supported resource type will have its own properties. Currently this is ECS + ecsHotswapProperties?: EcsHotswapProperties; + + public constructor (ecsHotswapProperties?: EcsHotswapProperties) { + this.ecsHotswapProperties = ecsHotswapProperties; + } +} + +/** + * Represents configuration properties for ECS hotswap deployments + */ +export class EcsHotswapProperties { + // The lower limit on the number of your service's tasks that must remain in the RUNNING state during a deployment, as a percentage of the desiredCount + readonly minimumHealthyPercent?: number; + // The upper limit on the number of your service's tasks that are allowed in the RUNNING or PENDING state during a deployment, as a percentage of the desiredCount + readonly maximumHealthyPercent?: number; + + public constructor (minimumHealthyPercent?: number, maximumHealthyPercent?: number) { + if (minimumHealthyPercent !== undefined && minimumHealthyPercent < 0 ) { + throw new Error('hotswap-ecs-minimum-healthy-percent can\'t be a negative number'); + } + if (maximumHealthyPercent !== undefined && maximumHealthyPercent < 0 ) { + throw new Error('hotswap-ecs-maximum-healthy-percent can\'t be a negative number'); + } + // In order to preserve the current behaviour, when minimumHealthyPercent is not defined, it will be set to the currently default value of 0 + if (minimumHealthyPercent == undefined) { + this.minimumHealthyPercent = 0; + } else { + this.minimumHealthyPercent = minimumHealthyPercent; + } + this.maximumHealthyPercent = maximumHealthyPercent; + } + + /** + * Check if any hotswap properties are defined + * @returns true if all properties are undefined, false otherwise + */ + public isEmpty(): boolean { + return this.minimumHealthyPercent === 0 && this.maximumHealthyPercent === undefined; + } +} + /** * This function transforms all keys (recursively) in the provided `val` object. * diff --git a/packages/aws-cdk/lib/api/hotswap/ecs-services.ts b/packages/aws-cdk/lib/api/hotswap/ecs-services.ts index c79032eec6e88..f6f626d32f2c9 100644 --- a/packages/aws-cdk/lib/api/hotswap/ecs-services.ts +++ b/packages/aws-cdk/lib/api/hotswap/ecs-services.ts @@ -1,10 +1,13 @@ import * as AWS from 'aws-sdk'; -import { ChangeHotswapResult, classifyChanges, HotswappableChangeCandidate, lowerCaseFirstCharacter, reportNonHotswappableChange, transformObjectKeys } from './common'; +import { ChangeHotswapResult, classifyChanges, HotswappableChangeCandidate, HotswapPropertyOverrides, lowerCaseFirstCharacter, reportNonHotswappableChange, transformObjectKeys } from './common'; import { ISDK } from '../aws-auth'; import { EvaluateCloudFormationTemplate } from '../evaluate-cloudformation-template'; export async function isHotswappableEcsServiceChange( - logicalId: string, change: HotswappableChangeCandidate, evaluateCfnTemplate: EvaluateCloudFormationTemplate, + logicalId: string, + change: HotswappableChangeCandidate, + evaluateCfnTemplate: EvaluateCloudFormationTemplate, + hotswapPropertyOverrides: HotswapPropertyOverrides, ): Promise { // the only resource change we can evaluate here is an ECS TaskDefinition if (change.newValue.Type !== 'AWS::ECS::TaskDefinition') { @@ -83,6 +86,10 @@ export async function isHotswappableEcsServiceChange( const registerTaskDefResponse = await sdk.ecs().registerTaskDefinition(lowercasedTaskDef).promise(); const taskDefRevArn = registerTaskDefResponse.taskDefinition?.taskDefinitionArn; + let ecsHotswapProperties = hotswapPropertyOverrides.ecsHotswapProperties; + let minimumHealthyPercent = ecsHotswapProperties?.minimumHealthyPercent; + let maximumHealthyPercent = ecsHotswapProperties?.maximumHealthyPercent; + // Step 2 - update the services using that TaskDefinition to point to the new TaskDefinition Revision const servicePerClusterUpdates: { [cluster: string]: Array<{ promise: Promise; ecsService: EcsService }> } = {}; for (const ecsService of ecsServicesReferencingTaskDef) { @@ -105,7 +112,8 @@ export async function isHotswappableEcsServiceChange( cluster: clusterName, forceNewDeployment: true, deploymentConfiguration: { - minimumHealthyPercent: 0, + minimumHealthyPercent: minimumHealthyPercent !== undefined ? minimumHealthyPercent : 0, + maximumPercent: maximumHealthyPercent !== undefined ? maximumHealthyPercent : undefined, }, }).promise(), ecsService: ecsService, diff --git a/packages/aws-cdk/lib/cdk-toolkit.ts b/packages/aws-cdk/lib/cdk-toolkit.ts index 64a9a0b4dd20c..57dabce74a5dd 100644 --- a/packages/aws-cdk/lib/cdk-toolkit.ts +++ b/packages/aws-cdk/lib/cdk-toolkit.ts @@ -13,7 +13,7 @@ import { CloudAssembly, DefaultSelection, ExtendedStackSelection, StackCollectio import { CloudExecutable } from './api/cxapp/cloud-executable'; import { Deployments } from './api/deployments'; import { GarbageCollector } from './api/garbage-collection/garbage-collector'; -import { HotswapMode } from './api/hotswap/common'; +import { HotswapMode, HotswapPropertyOverrides, EcsHotswapProperties } from './api/hotswap/common'; import { findCloudWatchLogGroups } from './api/logs/find-cloudwatch-logs'; import { CloudWatchLogEventMonitor } from './api/logs/logs-monitor'; import { createDiffChangeSet, ResourcesToImport } from './api/util/cloudformation'; @@ -237,6 +237,14 @@ export class CdkToolkit { warning('⚠️ They should only be used for development - never use them for your production Stacks!\n'); } + let hotswapPropertiesFromSettings = this.props.configuration.settings.get(['hotswap']) || {}; + + let hotswapPropertyOverrides = new HotswapPropertyOverrides(); + hotswapPropertyOverrides.ecsHotswapProperties = new EcsHotswapProperties( + hotswapPropertiesFromSettings.ecs?.minimumHealthyPercent, + hotswapPropertiesFromSettings.ecs?.maximumHealthyPercent, + ); + const stacks = stackCollection.stackArtifacts; const stackOutputs: { [key: string]: any } = { }; @@ -347,6 +355,7 @@ export class CdkToolkit { ci: options.ci, rollback: options.rollback, hotswap: options.hotswap, + hotswapPropertyOverrides: hotswapPropertyOverrides, extraUserAgent: options.extraUserAgent, assetParallelism: options.assetParallelism, ignoreNoStacks: options.ignoreNoStacks, diff --git a/packages/aws-cdk/lib/settings.ts b/packages/aws-cdk/lib/settings.ts index 74684dc3501d3..37e607f34c4dd 100644 --- a/packages/aws-cdk/lib/settings.ts +++ b/packages/aws-cdk/lib/settings.ts @@ -292,6 +292,12 @@ export class Settings { assetParallelism: argv['asset-parallelism'], assetPrebuild: argv['asset-prebuild'], ignoreNoStacks: argv['ignore-no-stacks'], + hotswap: { + ecs: { + minimumEcsHealthyPercent: argv.minimumEcsHealthyPercent, + maximumEcsHealthyPercent: argv.maximumEcsHealthyPercent, + }, + }, unstable: argv.unstable, }); } diff --git a/packages/aws-cdk/test/api/deploy-stack.test.ts b/packages/aws-cdk/test/api/deploy-stack.test.ts index bdb58f8aad99d..7afcea68f4c60 100644 --- a/packages/aws-cdk/test/api/deploy-stack.test.ts +++ b/packages/aws-cdk/test/api/deploy-stack.test.ts @@ -151,7 +151,7 @@ test('correctly passes CFN parameters when hotswapping', async () => { }); // THEN - expect(tryHotswapDeployment).toHaveBeenCalledWith(expect.anything(), { A: 'A-value', B: 'B=value' }, expect.anything(), expect.anything(), HotswapMode.FALL_BACK); + expect(tryHotswapDeployment).toHaveBeenCalledWith(expect.anything(), { A: 'A-value', B: 'B=value' }, expect.anything(), expect.anything(), HotswapMode.FALL_BACK, expect.anything()); }); test('correctly passes SSM parameters when hotswapping', async () => { @@ -181,7 +181,7 @@ test('correctly passes SSM parameters when hotswapping', async () => { }); // THEN - expect(tryHotswapDeployment).toHaveBeenCalledWith(expect.anything(), { SomeParameter: 'SomeValue' }, expect.anything(), expect.anything(), HotswapMode.FALL_BACK); + expect(tryHotswapDeployment).toHaveBeenCalledWith(expect.anything(), { SomeParameter: 'SomeValue' }, expect.anything(), expect.anything(), HotswapMode.FALL_BACK, expect.anything()); }); test('call CreateStack when method=direct and the stack doesnt exist yet', async () => { diff --git a/packages/aws-cdk/test/api/hotswap/ecs-services-hotswap-deployments.test.ts b/packages/aws-cdk/test/api/hotswap/ecs-services-hotswap-deployments.test.ts index d1ef496819328..182749aaa89d0 100644 --- a/packages/aws-cdk/test/api/hotswap/ecs-services-hotswap-deployments.test.ts +++ b/packages/aws-cdk/test/api/hotswap/ecs-services-hotswap-deployments.test.ts @@ -1,6 +1,7 @@ import * as AWS from 'aws-sdk'; import * as setup from './hotswap-test-setup'; -import { HotswapMode } from '../../../lib/api/hotswap/common'; +import { EcsHotswapProperties, HotswapMode, HotswapPropertyOverrides } from '../../../lib/api/hotswap/common'; +import { Configuration } from '../../../lib/settings'; import { silentTest } from '../../util/silent'; let hotswapMockSdkProvider: setup.HotswapMockSdkProvider; @@ -9,7 +10,6 @@ let mockUpdateService: (params: AWS.ECS.UpdateServiceRequest) => AWS.ECS.UpdateS beforeEach(() => { hotswapMockSdkProvider = setup.setupHotswapTests(); - mockRegisterTaskDef = jest.fn(); mockUpdateService = jest.fn(); hotswapMockSdkProvider.stubEcs({ @@ -637,3 +637,90 @@ describe.each([HotswapMode.FALL_BACK, HotswapMode.HOTSWAP_ONLY])('%p mode', (hot }); }); }); + +describe.each([ + new Configuration().settings.set(['hotswap'], { ecs: { minimumHealthyPercent: 10 } }), + new Configuration().settings.set(['hotswap'], { ecs: { minimumHealthyPercent: 10, maximumHealthyPercent: 100 } }), +])('hotswap properties', (settings) => { + test('should handle all possible hotswap properties', async () => { + // GIVEN + setup.setCurrentCfnStackTemplate({ + Resources: { + TaskDef: { + Type: 'AWS::ECS::TaskDefinition', + Properties: { + Family: 'my-task-def', + ContainerDefinitions: [ + { Image: 'image1' }, + ], + }, + }, + Service: { + Type: 'AWS::ECS::Service', + Properties: { + TaskDefinition: { Ref: 'TaskDef' }, + }, + }, + }, + }); + setup.pushStackResourceSummaries( + setup.stackSummaryOf('Service', 'AWS::ECS::Service', + 'arn:aws:ecs:region:account:service/my-cluster/my-service'), + ); + mockRegisterTaskDef.mockReturnValue({ + taskDefinition: { + taskDefinitionArn: 'arn:aws:ecs:region:account:task-definition/my-task-def:3', + }, + }); + const cdkStackArtifact = setup.cdkStackArtifactOf({ + template: { + Resources: { + TaskDef: { + Type: 'AWS::ECS::TaskDefinition', + Properties: { + Family: 'my-task-def', + ContainerDefinitions: [ + { Image: 'image2' }, + ], + }, + }, + Service: { + Type: 'AWS::ECS::Service', + Properties: { + TaskDefinition: { Ref: 'TaskDef' }, + }, + }, + }, + }, + }); + + // WHEN + let ecsHotswapProperties = new EcsHotswapProperties(settings.get(['hotswap']).ecs.minimumHealthyPercent, settings.get(['hotswap']).ecs.maximumHealthyPercent); + const deployStackResult = await hotswapMockSdkProvider.tryHotswapDeployment( + HotswapMode.HOTSWAP_ONLY, + cdkStackArtifact, + {}, + new HotswapPropertyOverrides(ecsHotswapProperties), + ); + + // THEN + expect(deployStackResult).not.toBeUndefined(); + expect(mockRegisterTaskDef).toBeCalledWith({ + family: 'my-task-def', + containerDefinitions: [ + { image: 'image2' }, + ], + }); + expect(mockUpdateService).toBeCalledWith({ + service: 'arn:aws:ecs:region:account:service/my-cluster/my-service', + cluster: 'my-cluster', + taskDefinition: 'arn:aws:ecs:region:account:task-definition/my-task-def:3', + deploymentConfiguration: { + minimumHealthyPercent: settings.get(['hotswap']).ecs?.minimumHealthyPercent == undefined ? + 0 : settings.get(['hotswap']).ecs?.minimumHealthyPercent, + maximumPercent: settings.get(['hotswap']).ecs?.maximumHealthyPercent, + }, + forceNewDeployment: true, + }); + }); +}); diff --git a/packages/aws-cdk/test/api/hotswap/hotswap-test-setup.ts b/packages/aws-cdk/test/api/hotswap/hotswap-test-setup.ts index 505f128a0dee2..1288c827f2300 100644 --- a/packages/aws-cdk/test/api/hotswap/hotswap-test-setup.ts +++ b/packages/aws-cdk/test/api/hotswap/hotswap-test-setup.ts @@ -4,7 +4,7 @@ import * as codebuild from 'aws-sdk/clients/codebuild'; import * as lambda from 'aws-sdk/clients/lambda'; import * as stepfunctions from 'aws-sdk/clients/stepfunctions'; import { DeployStackResult } from '../../../lib/api'; -import { HotswapMode } from '../../../lib/api/hotswap/common'; +import { HotswapMode, HotswapPropertyOverrides } from '../../../lib/api/hotswap/common'; import * as deployments from '../../../lib/api/hotswap-deployments'; import { CloudFormationStack, Template } from '../../../lib/api/util/cloudformation'; import { testStack, TestStackArtifact } from '../../util'; @@ -179,7 +179,9 @@ export class HotswapMockSdkProvider { hotswapMode: HotswapMode, stackArtifact: cxapi.CloudFormationStackArtifact, assetParams: { [key: string]: string } = {}, + hotswapPropertyOverrides?: HotswapPropertyOverrides, ): Promise { - return deployments.tryHotswapDeployment(this.mockSdkProvider, assetParams, currentCfnStack, stackArtifact, hotswapMode); + let hotswapProps = hotswapPropertyOverrides || new HotswapPropertyOverrides(); + return deployments.tryHotswapDeployment(this.mockSdkProvider, assetParams, currentCfnStack, stackArtifact, hotswapMode, hotswapProps); } } From 2e691b64668c6d19f80f73479cbd9658e159a901 Mon Sep 17 00:00:00 2001 From: paulhcsun <47882901+paulhcsun@users.noreply.github.com> Date: Wed, 23 Oct 2024 10:30:39 -0700 Subject: [PATCH 20/33] chore(kinesisfirehose-alpha): update README with Logging resource clarification (#31861) ### Description of changes Clarify in README that a LogGroup and LogStream with **default settings** will be created. ### Checklist - [x] My code adheres to the [CONTRIBUTING GUIDE](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and [DESIGN GUIDELINES](https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md) ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license* --- packages/@aws-cdk/aws-kinesisfirehose-alpha/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/@aws-cdk/aws-kinesisfirehose-alpha/README.md b/packages/@aws-cdk/aws-kinesisfirehose-alpha/README.md index ad33ea30db7f5..3b216e66b1355 100644 --- a/packages/@aws-cdk/aws-kinesisfirehose-alpha/README.md +++ b/packages/@aws-cdk/aws-kinesisfirehose-alpha/README.md @@ -181,7 +181,7 @@ your delivery streams via logs and metrics. Amazon Data Firehose will send logs to CloudWatch when data transformation or data delivery fails. The CDK will enable logging by default and create a CloudWatch LogGroup -and LogStream for your Delivery Stream. +and LogStream with default settings for your Delivery Stream. When creating a destination, you can provide an `ILoggingConfig`, which can either be an `EnableLogging` or `DisableLogging` instance. If you use `EnableLogging`, the CDK will create a CloudWatch LogGroup and LogStream with all CloudFormation default settings for you, or you can optionally From 58dfda087a8aabde2683cd99df005d6e5e73a7ce Mon Sep 17 00:00:00 2001 From: Xia Zhao <78883180+xazhao@users.noreply.github.com> Date: Wed, 23 Oct 2024 11:02:46 -0700 Subject: [PATCH 21/33] fix(events-targets): kinesis Stream target with Customer-Managed KMS key causes EventBridge FailedInvocations (#31836) ### Issue # (if applicable) Closes #10996. ### Reason for this change When a Kinesis Stream is encrypted with a custom managed KMS key, CDK will generate a KMS key for the Kinesis Stream. ``` stream = new kinesis.Stream(stack, 'MyStream', { encryption: kinesis.StreamEncryption.KMS, }); ``` If it is used as a events target, CDK will provide permissions to the role of target so it can write to the kinesis stream: ``` { Action: ['kinesis:PutRecord', 'kinesis:PutRecords'], Effect: 'Allow', Resource: streamArn, } ``` If the kinesis is not encrypted with the customer managed kms key, these permissions will be sufficient. However, since the kinesis is encrypted with the the customer managed kms key, the invocation will fail because events doesn't have the permissions to the KMS key. Actually there's already `grantWrite()` method to grant sufficient permissions in this case. When a customer managed KMS key is used, it will generate extra policies for the key. We should use it. https://github.com/aws/aws-cdk/blob/366b4927c50168113dd4057f6255ab6c76278135/packages/aws-cdk-lib/aws-kinesis/lib/stream.ts#L355 Difference: these permissions will be added to the event ``` { Action: ['kinesis:ListShards(new permission)', 'kinesis:PutRecord', 'kinesis:PutRecords'], Effect: 'Allow', Resource: streamArn, } ``` these permissions will be added to the event if the target kinesis stream is using a customer managed KMS key ``` { Action: ['kms:Encrypt', 'kms:ReEncrypt*', 'kms:GenerateDataKey*'], Effect: 'Allow', Resource: streamKeyArn, }, ``` ### Description of changes Use the existing `grantWrite()` method instead of manipulating IAM policies directly. ### Description of how you validated changes unit tests/integration tests ### Checklist - [ ] My code adheres to the [CONTRIBUTING GUIDE](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and [DESIGN GUIDELINES](https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md) ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license* --- ...efaultTestDeployAssertF9D5974E.assets.json | 19 + ...aultTestDeployAssertF9D5974E.template.json | 36 ++ .../aws-cdk-kinesis-event-target.assets.json | 19 + ...aws-cdk-kinesis-event-target.template.json | 180 ++++++++++ .../cdk.out | 1 + .../integ.json | 12 + .../manifest.json | 139 ++++++++ .../tree.json | 337 ++++++++++++++++++ .../integ.kinesis-stream-customer-key.ts | 27 ++ ...efaultTestDeployAssertE4CFAC29.assets.json | 2 +- ...s-cdk-kinesis-event-target-dlq.assets.json | 6 +- ...cdk-kinesis-event-target-dlq.template.json | 1 + .../cdk.out | 2 +- .../integ.json | 2 +- .../manifest.json | 6 +- .../tree.json | 1 + .../aws-cdk-kinesis-event-target.assets.json | 6 +- ...aws-cdk-kinesis-event-target.template.json | 1 + .../integ.kinesis-stream.js.snapshot/cdk.out | 2 +- .../integ.json | 2 +- .../manifest.json | 5 +- .../tree.json | 1 + .../aws-events-targets/lib/kinesis-stream.ts | 6 +- .../test/kinesis/kinesis-stream.test.ts | 55 ++- 24 files changed, 846 insertions(+), 22 deletions(-) create mode 100644 packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/kinesis/integ.kinesis-stream-customer-key.js.snapshot/KinesisKmsDefaultTestDeployAssertF9D5974E.assets.json create mode 100644 packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/kinesis/integ.kinesis-stream-customer-key.js.snapshot/KinesisKmsDefaultTestDeployAssertF9D5974E.template.json create mode 100644 packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/kinesis/integ.kinesis-stream-customer-key.js.snapshot/aws-cdk-kinesis-event-target.assets.json create mode 100644 packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/kinesis/integ.kinesis-stream-customer-key.js.snapshot/aws-cdk-kinesis-event-target.template.json create mode 100644 packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/kinesis/integ.kinesis-stream-customer-key.js.snapshot/cdk.out create mode 100644 packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/kinesis/integ.kinesis-stream-customer-key.js.snapshot/integ.json create mode 100644 packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/kinesis/integ.kinesis-stream-customer-key.js.snapshot/manifest.json create mode 100644 packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/kinesis/integ.kinesis-stream-customer-key.js.snapshot/tree.json create mode 100644 packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/kinesis/integ.kinesis-stream-customer-key.ts diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/kinesis/integ.kinesis-stream-customer-key.js.snapshot/KinesisKmsDefaultTestDeployAssertF9D5974E.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/kinesis/integ.kinesis-stream-customer-key.js.snapshot/KinesisKmsDefaultTestDeployAssertF9D5974E.assets.json new file mode 100644 index 0000000000000..c2007b5c09632 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/kinesis/integ.kinesis-stream-customer-key.js.snapshot/KinesisKmsDefaultTestDeployAssertF9D5974E.assets.json @@ -0,0 +1,19 @@ +{ + "version": "38.0.1", + "files": { + "21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22": { + "source": { + "path": "KinesisKmsDefaultTestDeployAssertF9D5974E.template.json", + "packaging": "file" + }, + "destinations": { + "current_account-current_region": { + "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", + "objectKey": "21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22.json", + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" + } + } + } + }, + "dockerImages": {} +} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/kinesis/integ.kinesis-stream-customer-key.js.snapshot/KinesisKmsDefaultTestDeployAssertF9D5974E.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/kinesis/integ.kinesis-stream-customer-key.js.snapshot/KinesisKmsDefaultTestDeployAssertF9D5974E.template.json new file mode 100644 index 0000000000000..ad9d0fb73d1dd --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/kinesis/integ.kinesis-stream-customer-key.js.snapshot/KinesisKmsDefaultTestDeployAssertF9D5974E.template.json @@ -0,0 +1,36 @@ +{ + "Parameters": { + "BootstrapVersion": { + "Type": "AWS::SSM::Parameter::Value", + "Default": "/cdk-bootstrap/hnb659fds/version", + "Description": "Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]" + } + }, + "Rules": { + "CheckBootstrapVersion": { + "Assertions": [ + { + "Assert": { + "Fn::Not": [ + { + "Fn::Contains": [ + [ + "1", + "2", + "3", + "4", + "5" + ], + { + "Ref": "BootstrapVersion" + } + ] + } + ] + }, + "AssertDescription": "CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI." + } + ] + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/kinesis/integ.kinesis-stream-customer-key.js.snapshot/aws-cdk-kinesis-event-target.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/kinesis/integ.kinesis-stream-customer-key.js.snapshot/aws-cdk-kinesis-event-target.assets.json new file mode 100644 index 0000000000000..fa4cd04a8a23e --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/kinesis/integ.kinesis-stream-customer-key.js.snapshot/aws-cdk-kinesis-event-target.assets.json @@ -0,0 +1,19 @@ +{ + "version": "38.0.1", + "files": { + "21dc15bc2eacafdd9b16fd80172b8974e3c6a524d55f408eb8f9ab807afa5e63": { + "source": { + "path": "aws-cdk-kinesis-event-target.template.json", + "packaging": "file" + }, + "destinations": { + "current_account-current_region": { + "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", + "objectKey": "21dc15bc2eacafdd9b16fd80172b8974e3c6a524d55f408eb8f9ab807afa5e63.json", + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" + } + } + } + }, + "dockerImages": {} +} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/kinesis/integ.kinesis-stream-customer-key.js.snapshot/aws-cdk-kinesis-event-target.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/kinesis/integ.kinesis-stream-customer-key.js.snapshot/aws-cdk-kinesis-event-target.template.json new file mode 100644 index 0000000000000..8bffab542ba70 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/kinesis/integ.kinesis-stream-customer-key.js.snapshot/aws-cdk-kinesis-event-target.template.json @@ -0,0 +1,180 @@ +{ + "Resources": { + "MyStreamKey76F3300E": { + "Type": "AWS::KMS::Key", + "Properties": { + "Description": "Created by aws-cdk-kinesis-event-target/MyStream", + "KeyPolicy": { + "Statement": [ + { + "Action": "kms:*", + "Effect": "Allow", + "Principal": { + "AWS": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":root" + ] + ] + } + }, + "Resource": "*" + } + ], + "Version": "2012-10-17" + } + }, + "UpdateReplacePolicy": "Retain", + "DeletionPolicy": "Retain" + }, + "MyStream5C050E93": { + "Type": "AWS::Kinesis::Stream", + "Properties": { + "RetentionPeriodHours": 24, + "ShardCount": 1, + "StreamEncryption": { + "EncryptionType": "KMS", + "KeyId": { + "Fn::GetAtt": [ + "MyStreamKey76F3300E", + "Arn" + ] + } + } + }, + "UpdateReplacePolicy": "Retain", + "DeletionPolicy": "Retain" + }, + "MyStreamEventsRole5B6CC6AF": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "events.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + } + } + }, + "MyStreamEventsRoleDefaultPolicy2089B49E": { + "Type": "AWS::IAM::Policy", + "Properties": { + "PolicyDocument": { + "Statement": [ + { + "Action": [ + "kinesis:ListShards", + "kinesis:PutRecord", + "kinesis:PutRecords" + ], + "Effect": "Allow", + "Resource": { + "Fn::GetAtt": [ + "MyStream5C050E93", + "Arn" + ] + } + }, + { + "Action": [ + "kms:Encrypt", + "kms:GenerateDataKey*", + "kms:ReEncrypt*" + ], + "Effect": "Allow", + "Resource": { + "Fn::GetAtt": [ + "MyStreamKey76F3300E", + "Arn" + ] + } + } + ], + "Version": "2012-10-17" + }, + "PolicyName": "MyStreamEventsRoleDefaultPolicy2089B49E", + "Roles": [ + { + "Ref": "MyStreamEventsRole5B6CC6AF" + } + ] + } + }, + "EveryMinute2BBCEA8F": { + "Type": "AWS::Events::Rule", + "Properties": { + "ScheduleExpression": "rate(1 minute)", + "State": "ENABLED", + "Targets": [ + { + "Arn": { + "Fn::GetAtt": [ + "MyStream5C050E93", + "Arn" + ] + }, + "Id": "Target0", + "KinesisParameters": { + "PartitionKeyPath": "$.id" + }, + "RoleArn": { + "Fn::GetAtt": [ + "MyStreamEventsRole5B6CC6AF", + "Arn" + ] + } + } + ] + } + } + }, + "Parameters": { + "BootstrapVersion": { + "Type": "AWS::SSM::Parameter::Value", + "Default": "/cdk-bootstrap/hnb659fds/version", + "Description": "Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]" + } + }, + "Rules": { + "CheckBootstrapVersion": { + "Assertions": [ + { + "Assert": { + "Fn::Not": [ + { + "Fn::Contains": [ + [ + "1", + "2", + "3", + "4", + "5" + ], + { + "Ref": "BootstrapVersion" + } + ] + } + ] + }, + "AssertDescription": "CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI." + } + ] + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/kinesis/integ.kinesis-stream-customer-key.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/kinesis/integ.kinesis-stream-customer-key.js.snapshot/cdk.out new file mode 100644 index 0000000000000..c6e612584e352 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/kinesis/integ.kinesis-stream-customer-key.js.snapshot/cdk.out @@ -0,0 +1 @@ +{"version":"38.0.1"} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/kinesis/integ.kinesis-stream-customer-key.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/kinesis/integ.kinesis-stream-customer-key.js.snapshot/integ.json new file mode 100644 index 0000000000000..5f7c6f30454e0 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/kinesis/integ.kinesis-stream-customer-key.js.snapshot/integ.json @@ -0,0 +1,12 @@ +{ + "version": "38.0.1", + "testCases": { + "KinesisKms/DefaultTest": { + "stacks": [ + "aws-cdk-kinesis-event-target" + ], + "assertionStack": "KinesisKms/DefaultTest/DeployAssert", + "assertionStackName": "KinesisKmsDefaultTestDeployAssertF9D5974E" + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/kinesis/integ.kinesis-stream-customer-key.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/kinesis/integ.kinesis-stream-customer-key.js.snapshot/manifest.json new file mode 100644 index 0000000000000..bd01961af6a22 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/kinesis/integ.kinesis-stream-customer-key.js.snapshot/manifest.json @@ -0,0 +1,139 @@ +{ + "version": "38.0.1", + "artifacts": { + "aws-cdk-kinesis-event-target.assets": { + "type": "cdk:asset-manifest", + "properties": { + "file": "aws-cdk-kinesis-event-target.assets.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "aws-cdk-kinesis-event-target": { + "type": "aws:cloudformation:stack", + "environment": "aws://unknown-account/unknown-region", + "properties": { + "templateFile": "aws-cdk-kinesis-event-target.template.json", + "terminationProtection": false, + "validateOnSynth": false, + "notificationArns": [], + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", + "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", + "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/21dc15bc2eacafdd9b16fd80172b8974e3c6a524d55f408eb8f9ab807afa5e63.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", + "additionalDependencies": [ + "aws-cdk-kinesis-event-target.assets" + ], + "lookupRole": { + "arn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-lookup-role-${AWS::AccountId}-${AWS::Region}", + "requiresBootstrapStackVersion": 8, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "dependencies": [ + "aws-cdk-kinesis-event-target.assets" + ], + "metadata": { + "/aws-cdk-kinesis-event-target/MyStream/Key/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "MyStreamKey76F3300E" + } + ], + "/aws-cdk-kinesis-event-target/MyStream/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "MyStream5C050E93" + } + ], + "/aws-cdk-kinesis-event-target/MyStream/EventsRole/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "MyStreamEventsRole5B6CC6AF" + } + ], + "/aws-cdk-kinesis-event-target/MyStream/EventsRole/DefaultPolicy/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "MyStreamEventsRoleDefaultPolicy2089B49E" + } + ], + "/aws-cdk-kinesis-event-target/EveryMinute/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "EveryMinute2BBCEA8F" + } + ], + "/aws-cdk-kinesis-event-target/BootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "BootstrapVersion" + } + ], + "/aws-cdk-kinesis-event-target/CheckBootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "CheckBootstrapVersion" + } + ] + }, + "displayName": "aws-cdk-kinesis-event-target" + }, + "KinesisKmsDefaultTestDeployAssertF9D5974E.assets": { + "type": "cdk:asset-manifest", + "properties": { + "file": "KinesisKmsDefaultTestDeployAssertF9D5974E.assets.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "KinesisKmsDefaultTestDeployAssertF9D5974E": { + "type": "aws:cloudformation:stack", + "environment": "aws://unknown-account/unknown-region", + "properties": { + "templateFile": "KinesisKmsDefaultTestDeployAssertF9D5974E.template.json", + "terminationProtection": false, + "validateOnSynth": false, + "notificationArns": [], + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", + "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", + "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", + "additionalDependencies": [ + "KinesisKmsDefaultTestDeployAssertF9D5974E.assets" + ], + "lookupRole": { + "arn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-lookup-role-${AWS::AccountId}-${AWS::Region}", + "requiresBootstrapStackVersion": 8, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "dependencies": [ + "KinesisKmsDefaultTestDeployAssertF9D5974E.assets" + ], + "metadata": { + "/KinesisKms/DefaultTest/DeployAssert/BootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "BootstrapVersion" + } + ], + "/KinesisKms/DefaultTest/DeployAssert/CheckBootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "CheckBootstrapVersion" + } + ] + }, + "displayName": "KinesisKms/DefaultTest/DeployAssert" + }, + "Tree": { + "type": "cdk:tree", + "properties": { + "file": "tree.json" + } + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/kinesis/integ.kinesis-stream-customer-key.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/kinesis/integ.kinesis-stream-customer-key.js.snapshot/tree.json new file mode 100644 index 0000000000000..4eb0cc2568865 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/kinesis/integ.kinesis-stream-customer-key.js.snapshot/tree.json @@ -0,0 +1,337 @@ +{ + "version": "tree-0.1", + "tree": { + "id": "App", + "path": "", + "children": { + "aws-cdk-kinesis-event-target": { + "id": "aws-cdk-kinesis-event-target", + "path": "aws-cdk-kinesis-event-target", + "children": { + "MyStream": { + "id": "MyStream", + "path": "aws-cdk-kinesis-event-target/MyStream", + "children": { + "Key": { + "id": "Key", + "path": "aws-cdk-kinesis-event-target/MyStream/Key", + "children": { + "Resource": { + "id": "Resource", + "path": "aws-cdk-kinesis-event-target/MyStream/Key/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::KMS::Key", + "aws:cdk:cloudformation:props": { + "description": "Created by aws-cdk-kinesis-event-target/MyStream", + "keyPolicy": { + "Statement": [ + { + "Action": "kms:*", + "Effect": "Allow", + "Principal": { + "AWS": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":root" + ] + ] + } + }, + "Resource": "*" + } + ], + "Version": "2012-10-17" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_kms.CfnKey", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_kms.Key", + "version": "0.0.0" + } + }, + "Resource": { + "id": "Resource", + "path": "aws-cdk-kinesis-event-target/MyStream/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::Kinesis::Stream", + "aws:cdk:cloudformation:props": { + "retentionPeriodHours": 24, + "shardCount": 1, + "streamEncryption": { + "encryptionType": "KMS", + "keyId": { + "Fn::GetAtt": [ + "MyStreamKey76F3300E", + "Arn" + ] + } + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_kinesis.CfnStream", + "version": "0.0.0" + } + }, + "EventsRole": { + "id": "EventsRole", + "path": "aws-cdk-kinesis-event-target/MyStream/EventsRole", + "children": { + "ImportEventsRole": { + "id": "ImportEventsRole", + "path": "aws-cdk-kinesis-event-target/MyStream/EventsRole/ImportEventsRole", + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "0.0.0" + } + }, + "Resource": { + "id": "Resource", + "path": "aws-cdk-kinesis-event-target/MyStream/EventsRole/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Role", + "aws:cdk:cloudformation:props": { + "assumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "events.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.CfnRole", + "version": "0.0.0" + } + }, + "DefaultPolicy": { + "id": "DefaultPolicy", + "path": "aws-cdk-kinesis-event-target/MyStream/EventsRole/DefaultPolicy", + "children": { + "Resource": { + "id": "Resource", + "path": "aws-cdk-kinesis-event-target/MyStream/EventsRole/DefaultPolicy/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Policy", + "aws:cdk:cloudformation:props": { + "policyDocument": { + "Statement": [ + { + "Action": [ + "kinesis:ListShards", + "kinesis:PutRecord", + "kinesis:PutRecords" + ], + "Effect": "Allow", + "Resource": { + "Fn::GetAtt": [ + "MyStream5C050E93", + "Arn" + ] + } + }, + { + "Action": [ + "kms:Encrypt", + "kms:GenerateDataKey*", + "kms:ReEncrypt*" + ], + "Effect": "Allow", + "Resource": { + "Fn::GetAtt": [ + "MyStreamKey76F3300E", + "Arn" + ] + } + } + ], + "Version": "2012-10-17" + }, + "policyName": "MyStreamEventsRoleDefaultPolicy2089B49E", + "roles": [ + { + "Ref": "MyStreamEventsRole5B6CC6AF" + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.CfnPolicy", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.Policy", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.Role", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_kinesis.Stream", + "version": "0.0.0" + } + }, + "EveryMinute": { + "id": "EveryMinute", + "path": "aws-cdk-kinesis-event-target/EveryMinute", + "children": { + "Resource": { + "id": "Resource", + "path": "aws-cdk-kinesis-event-target/EveryMinute/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::Events::Rule", + "aws:cdk:cloudformation:props": { + "scheduleExpression": "rate(1 minute)", + "state": "ENABLED", + "targets": [ + { + "id": "Target0", + "arn": { + "Fn::GetAtt": [ + "MyStream5C050E93", + "Arn" + ] + }, + "roleArn": { + "Fn::GetAtt": [ + "MyStreamEventsRole5B6CC6AF", + "Arn" + ] + }, + "kinesisParameters": { + "partitionKeyPath": "$.id" + } + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_events.CfnRule", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_events.Rule", + "version": "0.0.0" + } + }, + "BootstrapVersion": { + "id": "BootstrapVersion", + "path": "aws-cdk-kinesis-event-target/BootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnParameter", + "version": "0.0.0" + } + }, + "CheckBootstrapVersion": { + "id": "CheckBootstrapVersion", + "path": "aws-cdk-kinesis-event-target/CheckBootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnRule", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.Stack", + "version": "0.0.0" + } + }, + "KinesisKms": { + "id": "KinesisKms", + "path": "KinesisKms", + "children": { + "DefaultTest": { + "id": "DefaultTest", + "path": "KinesisKms/DefaultTest", + "children": { + "Default": { + "id": "Default", + "path": "KinesisKms/DefaultTest/Default", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.3.0" + } + }, + "DeployAssert": { + "id": "DeployAssert", + "path": "KinesisKms/DefaultTest/DeployAssert", + "children": { + "BootstrapVersion": { + "id": "BootstrapVersion", + "path": "KinesisKms/DefaultTest/DeployAssert/BootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnParameter", + "version": "0.0.0" + } + }, + "CheckBootstrapVersion": { + "id": "CheckBootstrapVersion", + "path": "KinesisKms/DefaultTest/DeployAssert/CheckBootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnRule", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.Stack", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/integ-tests-alpha.IntegTestCase", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/integ-tests-alpha.IntegTest", + "version": "0.0.0" + } + }, + "Tree": { + "id": "Tree", + "path": "Tree", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.3.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.App", + "version": "0.0.0" + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/kinesis/integ.kinesis-stream-customer-key.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/kinesis/integ.kinesis-stream-customer-key.ts new file mode 100644 index 0000000000000..4b4bd9c688415 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/kinesis/integ.kinesis-stream-customer-key.ts @@ -0,0 +1,27 @@ +import * as events from 'aws-cdk-lib/aws-events'; +import * as kinesis from 'aws-cdk-lib/aws-kinesis'; +import * as cdk from 'aws-cdk-lib'; +import * as targets from 'aws-cdk-lib/aws-events-targets'; +import { IntegTest } from '@aws-cdk/integ-tests-alpha'; + +// --------------------------------- +// Define a rule that triggers a put to a Kinesis stream encrypted by a customer-managed KMS key every 1min. + +const app = new cdk.App(); + +const stack = new cdk.Stack(app, 'aws-cdk-kinesis-event-target'); + +const stream = new kinesis.Stream(stack, 'MyStream', { + encryption: kinesis.StreamEncryption.KMS, +}); +const event = new events.Rule(stack, 'EveryMinute', { + schedule: events.Schedule.rate(cdk.Duration.minutes(1)), +}); + +event.addTarget(new targets.KinesisStream(stream, { + partitionKeyPath: events.EventField.eventId, +})); + +new IntegTest(app, 'KinesisKms', { + testCases: [stack], +}); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/kinesis/integ.kinesis-stream-dead-letter-queue.js.snapshot/KinesisDlqDefaultTestDeployAssertE4CFAC29.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/kinesis/integ.kinesis-stream-dead-letter-queue.js.snapshot/KinesisDlqDefaultTestDeployAssertE4CFAC29.assets.json index 3be133b269609..0e6f5a6ddbc24 100644 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/kinesis/integ.kinesis-stream-dead-letter-queue.js.snapshot/KinesisDlqDefaultTestDeployAssertE4CFAC29.assets.json +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/kinesis/integ.kinesis-stream-dead-letter-queue.js.snapshot/KinesisDlqDefaultTestDeployAssertE4CFAC29.assets.json @@ -1,5 +1,5 @@ { - "version": "36.0.24", + "version": "38.0.1", "files": { "21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22": { "source": { diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/kinesis/integ.kinesis-stream-dead-letter-queue.js.snapshot/aws-cdk-kinesis-event-target-dlq.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/kinesis/integ.kinesis-stream-dead-letter-queue.js.snapshot/aws-cdk-kinesis-event-target-dlq.assets.json index 7e452036ed237..6bf674349e819 100644 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/kinesis/integ.kinesis-stream-dead-letter-queue.js.snapshot/aws-cdk-kinesis-event-target-dlq.assets.json +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/kinesis/integ.kinesis-stream-dead-letter-queue.js.snapshot/aws-cdk-kinesis-event-target-dlq.assets.json @@ -1,7 +1,7 @@ { - "version": "36.0.24", + "version": "38.0.1", "files": { - "b92166c0aa5448c8df40d6ed216b585ca5a8c8f600b343c74efb8983a16eb5a1": { + "4aade69c48604b052f7b859d3429c09e78b3f44bf5da100091f2b8164a2d80e5": { "source": { "path": "aws-cdk-kinesis-event-target-dlq.template.json", "packaging": "file" @@ -9,7 +9,7 @@ "destinations": { "current_account-current_region": { "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", - "objectKey": "b92166c0aa5448c8df40d6ed216b585ca5a8c8f600b343c74efb8983a16eb5a1.json", + "objectKey": "4aade69c48604b052f7b859d3429c09e78b3f44bf5da100091f2b8164a2d80e5.json", "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" } } diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/kinesis/integ.kinesis-stream-dead-letter-queue.js.snapshot/aws-cdk-kinesis-event-target-dlq.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/kinesis/integ.kinesis-stream-dead-letter-queue.js.snapshot/aws-cdk-kinesis-event-target-dlq.template.json index f86d9fd999442..3dbb9c1887aa2 100644 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/kinesis/integ.kinesis-stream-dead-letter-queue.js.snapshot/aws-cdk-kinesis-event-target-dlq.template.json +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/kinesis/integ.kinesis-stream-dead-letter-queue.js.snapshot/aws-cdk-kinesis-event-target-dlq.template.json @@ -45,6 +45,7 @@ "Statement": [ { "Action": [ + "kinesis:ListShards", "kinesis:PutRecord", "kinesis:PutRecords" ], diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/kinesis/integ.kinesis-stream-dead-letter-queue.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/kinesis/integ.kinesis-stream-dead-letter-queue.js.snapshot/cdk.out index 4efaa16f29af9..c6e612584e352 100644 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/kinesis/integ.kinesis-stream-dead-letter-queue.js.snapshot/cdk.out +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/kinesis/integ.kinesis-stream-dead-letter-queue.js.snapshot/cdk.out @@ -1 +1 @@ -{"version":"36.0.24"} \ No newline at end of file +{"version":"38.0.1"} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/kinesis/integ.kinesis-stream-dead-letter-queue.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/kinesis/integ.kinesis-stream-dead-letter-queue.js.snapshot/integ.json index a34d4ef7c0934..389153af3c926 100644 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/kinesis/integ.kinesis-stream-dead-letter-queue.js.snapshot/integ.json +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/kinesis/integ.kinesis-stream-dead-letter-queue.js.snapshot/integ.json @@ -1,5 +1,5 @@ { - "version": "36.0.24", + "version": "38.0.1", "testCases": { "KinesisDlq/DefaultTest": { "stacks": [ diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/kinesis/integ.kinesis-stream-dead-letter-queue.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/kinesis/integ.kinesis-stream-dead-letter-queue.js.snapshot/manifest.json index dcc9d0018043f..2eb5e8f396f26 100644 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/kinesis/integ.kinesis-stream-dead-letter-queue.js.snapshot/manifest.json +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/kinesis/integ.kinesis-stream-dead-letter-queue.js.snapshot/manifest.json @@ -1,5 +1,5 @@ { - "version": "36.0.24", + "version": "38.0.1", "artifacts": { "aws-cdk-kinesis-event-target-dlq.assets": { "type": "cdk:asset-manifest", @@ -16,9 +16,10 @@ "templateFile": "aws-cdk-kinesis-event-target-dlq.template.json", "terminationProtection": false, "validateOnSynth": false, + "notificationArns": [], "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", - "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/b92166c0aa5448c8df40d6ed216b585ca5a8c8f600b343c74efb8983a16eb5a1.json", + "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/4aade69c48604b052f7b859d3429c09e78b3f44bf5da100091f2b8164a2d80e5.json", "requiresBootstrapStackVersion": 6, "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", "additionalDependencies": [ @@ -100,6 +101,7 @@ "templateFile": "KinesisDlqDefaultTestDeployAssertE4CFAC29.template.json", "terminationProtection": false, "validateOnSynth": false, + "notificationArns": [], "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22.json", diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/kinesis/integ.kinesis-stream-dead-letter-queue.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/kinesis/integ.kinesis-stream-dead-letter-queue.js.snapshot/tree.json index 6af467fa6c2b9..c989583ab6d8e 100644 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/kinesis/integ.kinesis-stream-dead-letter-queue.js.snapshot/tree.json +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/kinesis/integ.kinesis-stream-dead-letter-queue.js.snapshot/tree.json @@ -90,6 +90,7 @@ "Statement": [ { "Action": [ + "kinesis:ListShards", "kinesis:PutRecord", "kinesis:PutRecords" ], diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/kinesis/integ.kinesis-stream.js.snapshot/aws-cdk-kinesis-event-target.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/kinesis/integ.kinesis-stream.js.snapshot/aws-cdk-kinesis-event-target.assets.json index 4d6eef75fa685..636bd608d1af9 100644 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/kinesis/integ.kinesis-stream.js.snapshot/aws-cdk-kinesis-event-target.assets.json +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/kinesis/integ.kinesis-stream.js.snapshot/aws-cdk-kinesis-event-target.assets.json @@ -1,7 +1,7 @@ { - "version": "36.0.0", + "version": "38.0.1", "files": { - "74908ecc1f1b06754e5120fe2f8ca8bdf8740a59e6424e70a70791aa23922900": { + "cc7c8dc15f12d6e9793c1db711131a00d663645ea38c73e4905c4fd8c8f8b323": { "source": { "path": "aws-cdk-kinesis-event-target.template.json", "packaging": "file" @@ -9,7 +9,7 @@ "destinations": { "current_account-current_region": { "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", - "objectKey": "74908ecc1f1b06754e5120fe2f8ca8bdf8740a59e6424e70a70791aa23922900.json", + "objectKey": "cc7c8dc15f12d6e9793c1db711131a00d663645ea38c73e4905c4fd8c8f8b323.json", "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" } } diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/kinesis/integ.kinesis-stream.js.snapshot/aws-cdk-kinesis-event-target.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/kinesis/integ.kinesis-stream.js.snapshot/aws-cdk-kinesis-event-target.template.json index b8bf461749c68..8f1b3135fc16a 100644 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/kinesis/integ.kinesis-stream.js.snapshot/aws-cdk-kinesis-event-target.template.json +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/kinesis/integ.kinesis-stream.js.snapshot/aws-cdk-kinesis-event-target.template.json @@ -45,6 +45,7 @@ "Statement": [ { "Action": [ + "kinesis:ListShards", "kinesis:PutRecord", "kinesis:PutRecords" ], diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/kinesis/integ.kinesis-stream.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/kinesis/integ.kinesis-stream.js.snapshot/cdk.out index 1f0068d32659a..c6e612584e352 100644 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/kinesis/integ.kinesis-stream.js.snapshot/cdk.out +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/kinesis/integ.kinesis-stream.js.snapshot/cdk.out @@ -1 +1 @@ -{"version":"36.0.0"} \ No newline at end of file +{"version":"38.0.1"} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/kinesis/integ.kinesis-stream.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/kinesis/integ.kinesis-stream.js.snapshot/integ.json index e7829f9338715..7b37522ce4243 100644 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/kinesis/integ.kinesis-stream.js.snapshot/integ.json +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/kinesis/integ.kinesis-stream.js.snapshot/integ.json @@ -1,5 +1,5 @@ { - "version": "36.0.0", + "version": "38.0.1", "testCases": { "integ.kinesis-stream": { "stacks": [ diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/kinesis/integ.kinesis-stream.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/kinesis/integ.kinesis-stream.js.snapshot/manifest.json index 4f318c66777a3..d64cef03aeaf9 100644 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/kinesis/integ.kinesis-stream.js.snapshot/manifest.json +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/kinesis/integ.kinesis-stream.js.snapshot/manifest.json @@ -1,5 +1,5 @@ { - "version": "36.0.0", + "version": "38.0.1", "artifacts": { "aws-cdk-kinesis-event-target.assets": { "type": "cdk:asset-manifest", @@ -16,9 +16,10 @@ "templateFile": "aws-cdk-kinesis-event-target.template.json", "terminationProtection": false, "validateOnSynth": false, + "notificationArns": [], "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", - "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/74908ecc1f1b06754e5120fe2f8ca8bdf8740a59e6424e70a70791aa23922900.json", + "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/cc7c8dc15f12d6e9793c1db711131a00d663645ea38c73e4905c4fd8c8f8b323.json", "requiresBootstrapStackVersion": 6, "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", "additionalDependencies": [ diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/kinesis/integ.kinesis-stream.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/kinesis/integ.kinesis-stream.js.snapshot/tree.json index ca5873b706721..74c4c2d0dbd38 100644 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/kinesis/integ.kinesis-stream.js.snapshot/tree.json +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/kinesis/integ.kinesis-stream.js.snapshot/tree.json @@ -90,6 +90,7 @@ "Statement": [ { "Action": [ + "kinesis:ListShards", "kinesis:PutRecord", "kinesis:PutRecords" ], diff --git a/packages/aws-cdk-lib/aws-events-targets/lib/kinesis-stream.ts b/packages/aws-cdk-lib/aws-events-targets/lib/kinesis-stream.ts index 119992f6430e7..ffdf794a3dc2e 100644 --- a/packages/aws-cdk-lib/aws-events-targets/lib/kinesis-stream.ts +++ b/packages/aws-cdk-lib/aws-events-targets/lib/kinesis-stream.ts @@ -1,6 +1,5 @@ import { bindBaseTargetConfig, singletonEventRole, TargetBaseProps } from './util'; import * as events from '../../aws-events'; -import * as iam from '../../aws-iam'; import * as kinesis from '../../aws-kinesis'; /** @@ -46,10 +45,7 @@ export class KinesisStream implements events.IRuleTarget { */ public bind(_rule: events.IRule, _id?: string): events.RuleTargetConfig { const role = singletonEventRole(this.stream); - role.addToPrincipalPolicy(new iam.PolicyStatement({ - actions: ['kinesis:PutRecord', 'kinesis:PutRecords'], - resources: [this.stream.streamArn], - })); + this.stream.grantWrite(role); return { ...bindBaseTargetConfig(this.props), diff --git a/packages/aws-cdk-lib/aws-events-targets/test/kinesis/kinesis-stream.test.ts b/packages/aws-cdk-lib/aws-events-targets/test/kinesis/kinesis-stream.test.ts index 705007b0c4421..b817120984753 100644 --- a/packages/aws-cdk-lib/aws-events-targets/test/kinesis/kinesis-stream.test.ts +++ b/packages/aws-cdk-lib/aws-events-targets/test/kinesis/kinesis-stream.test.ts @@ -5,6 +5,57 @@ import * as sqs from '../../../aws-sqs'; import { Duration, Stack } from '../../../core'; import * as targets from '../../lib'; +describe('KinesisStream event target with customer managed key', () => { + let stack: Stack; + let stream: kinesis.Stream; + let streamArn: any; + let streamKeyArn: any; + + beforeEach(() => { + stack = new Stack(); + stream = new kinesis.Stream(stack, 'MyStream', { + encryption: kinesis.StreamEncryption.KMS, + }); + streamArn = { 'Fn::GetAtt': ['MyStream5C050E93', 'Arn'] }; + streamKeyArn = { 'Fn::GetAtt': ['MyStreamKey76F3300E', 'Arn'] }; + }); + describe('when added to an event rule as a target', () => { + let rule: events.Rule; + + beforeEach(() => { + rule = new events.Rule(stack, 'rule', { + schedule: events.Schedule.expression('rate(1 minute)'), + }); + }); + + describe('with default settings', () => { + beforeEach(() => { + rule.addTarget(new targets.KinesisStream(stream)); + }); + + test("creates a policy that has PutRecord, PutRecords and ListShards permissions on the stream's ARN", () => { + Template.fromStack(stack).hasResourceProperties('AWS::IAM::Policy', { + PolicyDocument: { + Statement: [ + { + Action: ['kinesis:ListShards', 'kinesis:PutRecord', 'kinesis:PutRecords'], + Effect: 'Allow', + Resource: streamArn, + }, + { + Action: ['kms:Encrypt', 'kms:ReEncrypt*', 'kms:GenerateDataKey*'], + Effect: 'Allow', + Resource: streamKeyArn, + }, + ], + Version: '2012-10-17', + }, + }); + }); + }); + }); +}); + describe('KinesisStream event target', () => { let stack: Stack; let stream: kinesis.Stream; @@ -42,12 +93,12 @@ describe('KinesisStream event target', () => { }); }); - test("creates a policy that has PutRecord and PutRecords permissions on the stream's ARN", () => { + test("creates a policy that has PutRecord, PutRecords and ListShards permissions on the stream's ARN", () => { Template.fromStack(stack).hasResourceProperties('AWS::IAM::Policy', { PolicyDocument: { Statement: [ { - Action: ['kinesis:PutRecord', 'kinesis:PutRecords'], + Action: ['kinesis:ListShards', 'kinesis:PutRecord', 'kinesis:PutRecords'], Effect: 'Allow', Resource: streamArn, }, From 0b03eb0f62c132c1bd586a8ec31818398d07707f Mon Sep 17 00:00:00 2001 From: Lee Date: Wed, 23 Oct 2024 19:36:06 +0100 Subject: [PATCH 22/33] fix(dynamodb): replication regions are incompatible with resource policies in TableV2 and feature flag (#31513) ### Issue # (if applicable) Closes #30705 ### Reason for this change Resource policies were shared across all replicas in a region. ### Description of changes Changed the logic to only apply resource policy to the local replica region, or to specific replicas only when defined. ### Description of how you validated changes yes ### Checklist - [X] My code adheres to the [CONTRIBUTING GUIDE](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and [DESIGN GUIDELINES](https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md) ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license* --- .../ResourcePolicyTest-v2-FF.assets.json | 20 ++ .../ResourcePolicyTest-v2-FF.template.json | 95 ++++++++++ .../cdk.out | 1 + .../integ.json | 12 ++ .../manifest.json | 115 ++++++++++++ ...efaultTestDeployAssertBE3353C7.assets.json | 19 ++ ...aultTestDeployAssertBE3353C7.template.json | 36 ++++ .../tree.json | 174 ++++++++++++++++++ .../test/integ.dynamodb-v2.policy-ff.ts | 47 +++++ .../test/integ.dynamodb-v2.policy.ts | 9 +- .../aws-cdk-lib/aws-dynamodb/lib/table-v2.ts | 12 +- packages/aws-cdk-lib/cx-api/README.md | 19 ++ packages/aws-cdk-lib/cx-api/lib/features.ts | 16 ++ 13 files changed, 570 insertions(+), 5 deletions(-) create mode 100644 packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb-v2.policy-ff.js.snapshot/ResourcePolicyTest-v2-FF.assets.json create mode 100644 packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb-v2.policy-ff.js.snapshot/ResourcePolicyTest-v2-FF.template.json create mode 100644 packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb-v2.policy-ff.js.snapshot/cdk.out create mode 100644 packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb-v2.policy-ff.js.snapshot/integ.json create mode 100644 packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb-v2.policy-ff.js.snapshot/manifest.json create mode 100644 packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb-v2.policy-ff.js.snapshot/tablev2resourcepolicyintegtestDefaultTestDeployAssertBE3353C7.assets.json create mode 100644 packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb-v2.policy-ff.js.snapshot/tablev2resourcepolicyintegtestDefaultTestDeployAssertBE3353C7.template.json create mode 100644 packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb-v2.policy-ff.js.snapshot/tree.json create mode 100644 packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb-v2.policy-ff.ts diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb-v2.policy-ff.js.snapshot/ResourcePolicyTest-v2-FF.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb-v2.policy-ff.js.snapshot/ResourcePolicyTest-v2-FF.assets.json new file mode 100644 index 0000000000000..31c84ba046a09 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb-v2.policy-ff.js.snapshot/ResourcePolicyTest-v2-FF.assets.json @@ -0,0 +1,20 @@ +{ + "version": "38.0.1", + "files": { + "0aaa25e74c3bd8b4c72922081490518294b93ff15f40df38ae16908cbe6d69c5": { + "source": { + "path": "ResourcePolicyTest-v2-FF.template.json", + "packaging": "file" + }, + "destinations": { + "current_account-eu-west-1": { + "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-eu-west-1", + "objectKey": "0aaa25e74c3bd8b4c72922081490518294b93ff15f40df38ae16908cbe6d69c5.json", + "region": "eu-west-1", + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-eu-west-1" + } + } + } + }, + "dockerImages": {} +} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb-v2.policy-ff.js.snapshot/ResourcePolicyTest-v2-FF.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb-v2.policy-ff.js.snapshot/ResourcePolicyTest-v2-FF.template.json new file mode 100644 index 0000000000000..28240d04c34e3 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb-v2.policy-ff.js.snapshot/ResourcePolicyTest-v2-FF.template.json @@ -0,0 +1,95 @@ +{ + "Resources": { + "TableTestV215EEA02B7": { + "Type": "AWS::DynamoDB::GlobalTable", + "Properties": { + "AttributeDefinitions": [ + { + "AttributeName": "id", + "AttributeType": "S" + } + ], + "BillingMode": "PAY_PER_REQUEST", + "KeySchema": [ + { + "AttributeName": "id", + "KeyType": "HASH" + } + ], + "Replicas": [ + { + "Region": "eu-west-2" + }, + { + "Region": "eu-west-1", + "ResourcePolicy": { + "PolicyDocument": { + "Statement": [ + { + "Action": "dynamodb:*", + "Effect": "Allow", + "Principal": { + "AWS": { + "Fn::Join": [ + "", + [ + "arn:aws:iam::", + { + "Ref": "AWS::AccountId" + }, + ":root" + ] + ] + } + }, + "Resource": "*" + } + ], + "Version": "2012-10-17" + } + } + } + ], + "StreamSpecification": { + "StreamViewType": "NEW_AND_OLD_IMAGES" + } + }, + "UpdateReplacePolicy": "Delete", + "DeletionPolicy": "Delete" + } + }, + "Parameters": { + "BootstrapVersion": { + "Type": "AWS::SSM::Parameter::Value", + "Default": "/cdk-bootstrap/hnb659fds/version", + "Description": "Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]" + } + }, + "Rules": { + "CheckBootstrapVersion": { + "Assertions": [ + { + "Assert": { + "Fn::Not": [ + { + "Fn::Contains": [ + [ + "1", + "2", + "3", + "4", + "5" + ], + { + "Ref": "BootstrapVersion" + } + ] + } + ] + }, + "AssertDescription": "CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI." + } + ] + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb-v2.policy-ff.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb-v2.policy-ff.js.snapshot/cdk.out new file mode 100644 index 0000000000000..c6e612584e352 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb-v2.policy-ff.js.snapshot/cdk.out @@ -0,0 +1 @@ +{"version":"38.0.1"} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb-v2.policy-ff.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb-v2.policy-ff.js.snapshot/integ.json new file mode 100644 index 0000000000000..0be4870b3749d --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb-v2.policy-ff.js.snapshot/integ.json @@ -0,0 +1,12 @@ +{ + "version": "38.0.1", + "testCases": { + "table-v2-resource-policy-integ-test/DefaultTest": { + "stacks": [ + "ResourcePolicyTest-v2-FF" + ], + "assertionStack": "table-v2-resource-policy-integ-test/DefaultTest/DeployAssert", + "assertionStackName": "tablev2resourcepolicyintegtestDefaultTestDeployAssertBE3353C7" + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb-v2.policy-ff.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb-v2.policy-ff.js.snapshot/manifest.json new file mode 100644 index 0000000000000..a84913e0473df --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb-v2.policy-ff.js.snapshot/manifest.json @@ -0,0 +1,115 @@ +{ + "version": "38.0.1", + "artifacts": { + "ResourcePolicyTest-v2-FF.assets": { + "type": "cdk:asset-manifest", + "properties": { + "file": "ResourcePolicyTest-v2-FF.assets.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "ResourcePolicyTest-v2-FF": { + "type": "aws:cloudformation:stack", + "environment": "aws://unknown-account/eu-west-1", + "properties": { + "templateFile": "ResourcePolicyTest-v2-FF.template.json", + "terminationProtection": false, + "validateOnSynth": false, + "notificationArns": [], + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-eu-west-1", + "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-eu-west-1", + "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-eu-west-1/0aaa25e74c3bd8b4c72922081490518294b93ff15f40df38ae16908cbe6d69c5.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", + "additionalDependencies": [ + "ResourcePolicyTest-v2-FF.assets" + ], + "lookupRole": { + "arn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-lookup-role-${AWS::AccountId}-eu-west-1", + "requiresBootstrapStackVersion": 8, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "dependencies": [ + "ResourcePolicyTest-v2-FF.assets" + ], + "metadata": { + "/ResourcePolicyTest-v2-FF/TableTestV2-1/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "TableTestV215EEA02B7" + } + ], + "/ResourcePolicyTest-v2-FF/BootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "BootstrapVersion" + } + ], + "/ResourcePolicyTest-v2-FF/CheckBootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "CheckBootstrapVersion" + } + ] + }, + "displayName": "ResourcePolicyTest-v2-FF" + }, + "tablev2resourcepolicyintegtestDefaultTestDeployAssertBE3353C7.assets": { + "type": "cdk:asset-manifest", + "properties": { + "file": "tablev2resourcepolicyintegtestDefaultTestDeployAssertBE3353C7.assets.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "tablev2resourcepolicyintegtestDefaultTestDeployAssertBE3353C7": { + "type": "aws:cloudformation:stack", + "environment": "aws://unknown-account/unknown-region", + "properties": { + "templateFile": "tablev2resourcepolicyintegtestDefaultTestDeployAssertBE3353C7.template.json", + "terminationProtection": false, + "validateOnSynth": false, + "notificationArns": [], + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", + "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", + "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", + "additionalDependencies": [ + "tablev2resourcepolicyintegtestDefaultTestDeployAssertBE3353C7.assets" + ], + "lookupRole": { + "arn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-lookup-role-${AWS::AccountId}-${AWS::Region}", + "requiresBootstrapStackVersion": 8, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "dependencies": [ + "tablev2resourcepolicyintegtestDefaultTestDeployAssertBE3353C7.assets" + ], + "metadata": { + "/table-v2-resource-policy-integ-test/DefaultTest/DeployAssert/BootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "BootstrapVersion" + } + ], + "/table-v2-resource-policy-integ-test/DefaultTest/DeployAssert/CheckBootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "CheckBootstrapVersion" + } + ] + }, + "displayName": "table-v2-resource-policy-integ-test/DefaultTest/DeployAssert" + }, + "Tree": { + "type": "cdk:tree", + "properties": { + "file": "tree.json" + } + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb-v2.policy-ff.js.snapshot/tablev2resourcepolicyintegtestDefaultTestDeployAssertBE3353C7.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb-v2.policy-ff.js.snapshot/tablev2resourcepolicyintegtestDefaultTestDeployAssertBE3353C7.assets.json new file mode 100644 index 0000000000000..d49a26b8c2ab8 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb-v2.policy-ff.js.snapshot/tablev2resourcepolicyintegtestDefaultTestDeployAssertBE3353C7.assets.json @@ -0,0 +1,19 @@ +{ + "version": "38.0.1", + "files": { + "21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22": { + "source": { + "path": "tablev2resourcepolicyintegtestDefaultTestDeployAssertBE3353C7.template.json", + "packaging": "file" + }, + "destinations": { + "current_account-current_region": { + "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", + "objectKey": "21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22.json", + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" + } + } + } + }, + "dockerImages": {} +} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb-v2.policy-ff.js.snapshot/tablev2resourcepolicyintegtestDefaultTestDeployAssertBE3353C7.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb-v2.policy-ff.js.snapshot/tablev2resourcepolicyintegtestDefaultTestDeployAssertBE3353C7.template.json new file mode 100644 index 0000000000000..ad9d0fb73d1dd --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb-v2.policy-ff.js.snapshot/tablev2resourcepolicyintegtestDefaultTestDeployAssertBE3353C7.template.json @@ -0,0 +1,36 @@ +{ + "Parameters": { + "BootstrapVersion": { + "Type": "AWS::SSM::Parameter::Value", + "Default": "/cdk-bootstrap/hnb659fds/version", + "Description": "Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]" + } + }, + "Rules": { + "CheckBootstrapVersion": { + "Assertions": [ + { + "Assert": { + "Fn::Not": [ + { + "Fn::Contains": [ + [ + "1", + "2", + "3", + "4", + "5" + ], + { + "Ref": "BootstrapVersion" + } + ] + } + ] + }, + "AssertDescription": "CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI." + } + ] + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb-v2.policy-ff.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb-v2.policy-ff.js.snapshot/tree.json new file mode 100644 index 0000000000000..b3a565db2d3c0 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb-v2.policy-ff.js.snapshot/tree.json @@ -0,0 +1,174 @@ +{ + "version": "tree-0.1", + "tree": { + "id": "App", + "path": "", + "children": { + "ResourcePolicyTest-v2-FF": { + "id": "ResourcePolicyTest-v2-FF", + "path": "ResourcePolicyTest-v2-FF", + "children": { + "TableTestV2-1": { + "id": "TableTestV2-1", + "path": "ResourcePolicyTest-v2-FF/TableTestV2-1", + "children": { + "Resource": { + "id": "Resource", + "path": "ResourcePolicyTest-v2-FF/TableTestV2-1/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::DynamoDB::GlobalTable", + "aws:cdk:cloudformation:props": { + "attributeDefinitions": [ + { + "attributeName": "id", + "attributeType": "S" + } + ], + "billingMode": "PAY_PER_REQUEST", + "keySchema": [ + { + "attributeName": "id", + "keyType": "HASH" + } + ], + "replicas": [ + { + "region": "eu-west-2" + }, + { + "region": "eu-west-1", + "resourcePolicy": { + "policyDocument": { + "Statement": [ + { + "Action": "dynamodb:*", + "Effect": "Allow", + "Principal": { + "AWS": { + "Fn::Join": [ + "", + [ + "arn:aws:iam::", + { + "Ref": "AWS::AccountId" + }, + ":root" + ] + ] + } + }, + "Resource": "*" + } + ], + "Version": "2012-10-17" + } + } + } + ], + "streamSpecification": { + "streamViewType": "NEW_AND_OLD_IMAGES" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_dynamodb.CfnGlobalTable", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_dynamodb.TableBaseV2", + "version": "0.0.0" + } + }, + "BootstrapVersion": { + "id": "BootstrapVersion", + "path": "ResourcePolicyTest-v2-FF/BootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnParameter", + "version": "0.0.0" + } + }, + "CheckBootstrapVersion": { + "id": "CheckBootstrapVersion", + "path": "ResourcePolicyTest-v2-FF/CheckBootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnRule", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.Stack", + "version": "0.0.0" + } + }, + "table-v2-resource-policy-integ-test": { + "id": "table-v2-resource-policy-integ-test", + "path": "table-v2-resource-policy-integ-test", + "children": { + "DefaultTest": { + "id": "DefaultTest", + "path": "table-v2-resource-policy-integ-test/DefaultTest", + "children": { + "Default": { + "id": "Default", + "path": "table-v2-resource-policy-integ-test/DefaultTest/Default", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.3.0" + } + }, + "DeployAssert": { + "id": "DeployAssert", + "path": "table-v2-resource-policy-integ-test/DefaultTest/DeployAssert", + "children": { + "BootstrapVersion": { + "id": "BootstrapVersion", + "path": "table-v2-resource-policy-integ-test/DefaultTest/DeployAssert/BootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnParameter", + "version": "0.0.0" + } + }, + "CheckBootstrapVersion": { + "id": "CheckBootstrapVersion", + "path": "table-v2-resource-policy-integ-test/DefaultTest/DeployAssert/CheckBootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnRule", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.Stack", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/integ-tests-alpha.IntegTestCase", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/integ-tests-alpha.IntegTest", + "version": "0.0.0" + } + }, + "Tree": { + "id": "Tree", + "path": "Tree", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.3.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.App", + "version": "0.0.0" + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb-v2.policy-ff.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb-v2.policy-ff.ts new file mode 100644 index 0000000000000..819561ce50d08 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb-v2.policy-ff.ts @@ -0,0 +1,47 @@ +import { App, RemovalPolicy, Stack, StackProps } from 'aws-cdk-lib'; +import { Construct } from 'constructs'; +import * as dynamodb from 'aws-cdk-lib/aws-dynamodb'; +import * as iam from 'aws-cdk-lib/aws-iam'; +import { IntegTest } from '@aws-cdk/integ-tests-alpha'; + +const app = new App({ + postCliContext: { + '@aws-cdk/aws-dynamodb:resourcePolicyPerReplica': true, + }, +}); + +class TestStack extends Stack { + constructor(scope: Construct, id: string, props?: StackProps) { + super(scope, id, props); + + const docu = new iam.PolicyDocument({ + statements: [ + new iam.PolicyStatement({ + actions: ['dynamodb:*'], + principals: [new iam.AccountRootPrincipal()], + resources: ['*'], + }), + ], + }); + + // table with resource policy + new dynamodb.TableV2(this, 'TableTestV2-1', { + partitionKey: { + name: 'id', + type: dynamodb.AttributeType.STRING, + }, + removalPolicy: RemovalPolicy.DESTROY, + resourcePolicy: docu, + replicas: [{ + region: 'eu-west-2', + }], + }); + + } +} + +const stack = new TestStack(app, 'ResourcePolicyTest-v2-FF', { env: { region: 'eu-west-1' } }); + +new IntegTest(app, 'table-v2-resource-policy-integ-test', { + testCases: [stack], +}); \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb-v2.policy.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb-v2.policy.ts index 5a30de692de21..50ca86a684b2d 100644 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb-v2.policy.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb-v2.policy.ts @@ -4,7 +4,11 @@ import * as dynamodb from 'aws-cdk-lib/aws-dynamodb'; import * as iam from 'aws-cdk-lib/aws-iam'; import { IntegTest } from '@aws-cdk/integ-tests-alpha'; -const app = new App(); +const app = new App({ + postCliContext: { + '@aws-cdk/aws-dynamodb:resourcePolicyPerReplica': false, + }, +}); class TestStack extends Stack { constructor(scope: Construct, id: string, props?: StackProps) { @@ -21,7 +25,7 @@ class TestStack extends Stack { }); // table with resource policy - const table = new dynamodb.TableV2(this, 'TableTestV2-1', { + new dynamodb.TableV2(this, 'TableTestV2-1', { partitionKey: { name: 'id', type: dynamodb.AttributeType.STRING, @@ -30,7 +34,6 @@ class TestStack extends Stack { resourcePolicy: docu, }); - table.grantReadData(new iam.AccountPrincipal('123456789012')); } } diff --git a/packages/aws-cdk-lib/aws-dynamodb/lib/table-v2.ts b/packages/aws-cdk-lib/aws-dynamodb/lib/table-v2.ts index 65e3c588968e5..b6507d3f7deb1 100644 --- a/packages/aws-cdk-lib/aws-dynamodb/lib/table-v2.ts +++ b/packages/aws-cdk-lib/aws-dynamodb/lib/table-v2.ts @@ -12,7 +12,8 @@ import { TableBaseV2, ITableV2 } from './table-v2-base'; import { PolicyDocument } from '../../aws-iam'; import { IStream } from '../../aws-kinesis'; import { IKey, Key } from '../../aws-kms'; -import { ArnFormat, CfnTag, Lazy, PhysicalName, RemovalPolicy, Stack, Token } from '../../core'; +import { ArnFormat, CfnTag, FeatureFlags, Lazy, PhysicalName, RemovalPolicy, Stack, Token } from '../../core'; +import * as cxapi from '../../cx-api'; const HASH_KEY_TYPE = 'HASH'; const RANGE_KEY_TYPE = 'RANGE'; @@ -664,7 +665,14 @@ export class TableV2 extends TableBaseV2 { private configureReplicaTable(props: ReplicaTableProps): CfnGlobalTable.ReplicaSpecificationProperty { const pointInTimeRecovery = props.pointInTimeRecovery ?? this.tableOptions.pointInTimeRecovery; const contributorInsights = props.contributorInsights ?? this.tableOptions.contributorInsights; - const resourcePolicy = props.resourcePolicy ?? this.tableOptions.resourcePolicy; + /* + * Feature flag set as the following may be a breaking change. + * @see https://github.com/aws/aws-cdk/pull/31097 + * @see https://github.com/aws/aws-cdk/blob/main/packages/%40aws-cdk/cx-api/FEATURE_FLAGS.md + */ + const resourcePolicy = FeatureFlags.of(this).isEnabled(cxapi.DYNAMODB_TABLEV2_RESOURCE_POLICY_PER_REPLICA) + ? (props.region === this.region ? this.tableOptions.resourcePolicy : props.resourcePolicy) || undefined + : props.resourcePolicy ?? this.tableOptions.resourcePolicy; return { region: props.region, diff --git a/packages/aws-cdk-lib/cx-api/README.md b/packages/aws-cdk-lib/cx-api/README.md index 68a16be402040..f90bcac9b4f13 100644 --- a/packages/aws-cdk-lib/cx-api/README.md +++ b/packages/aws-cdk-lib/cx-api/README.md @@ -475,3 +475,22 @@ _cdk.json_ } } ``` + +* `@aws-cdk/aws-dynamodb:resourcePolicyPerReplica` + +If this flag is not set, the default behavior for \`TableV2\` is to use a different \`resourcePolicy\` for each replica. + +If this flag is set to false, the behavior is that each replica shares the same \`resourcePolicy\` as the source table. +This will prevent you from creating a new table which has an additional replica and a resource policy. + +This is a feature flag as the old behavior was technically incorrect but users may have come to depend on it. + +_cdk.json_ + +```json +{ + "context": { + "@aws-cdk/aws-dynamodb:resourcePolicyPerReplica": false, + }, +} +``` \ No newline at end of file diff --git a/packages/aws-cdk-lib/cx-api/lib/features.ts b/packages/aws-cdk-lib/cx-api/lib/features.ts index 7cd1ee4b5e7e0..182d14a5f738f 100644 --- a/packages/aws-cdk-lib/cx-api/lib/features.ts +++ b/packages/aws-cdk-lib/cx-api/lib/features.ts @@ -108,6 +108,7 @@ export const LOG_API_RESPONSE_DATA_PROPERTY_TRUE_DEFAULT = '@aws-cdk/custom-reso export const S3_KEEP_NOTIFICATION_IN_IMPORTED_BUCKET = '@aws-cdk/aws-s3:keepNotificationInImportedBucket'; export const USE_NEW_S3URI_PARAMETERS_FOR_BEDROCK_INVOKE_MODEL_TASK = '@aws-cdk/aws-stepfunctions-tasks:useNewS3UriParametersForBedrockInvokeModelTask'; export const REDUCE_EC2_FARGATE_CLOUDWATCH_PERMISSIONS = '@aws-cdk/aws-ecs:reduceEc2FargateCloudWatchPermissions'; +export const DYNAMODB_TABLEV2_RESOURCE_POLICY_PER_REPLICA = '@aws-cdk/aws-dynamodb:resourcePolicyPerReplica'; export const EC2_SUM_TIMEOUT_ENABLED = '@aws-cdk/aws-ec2:ec2SumTImeoutEnabled'; export const APPSYNC_GRAPHQLAPI_SCOPE_LAMBDA_FUNCTION_PERMISSION = '@aws-cdk/aws-appsync:appSyncGraphQLAPIScopeLambdaPermission'; export const USE_CORRECT_VALUE_FOR_INSTANCE_RESOURCE_ID_PROPERTY = '@aws-cdk/aws-rds:setCorrectValueForDatabaseInstanceReadReplicaInstanceResourceId'; @@ -1149,6 +1150,21 @@ export const FLAGS: Record = { compatibilityWithOldBehaviorMd: 'Disable the feature flag to continue grant permissions to log group when no log group is specified', }, + ////////////////////////////////////////////////////////////////////// + [DYNAMODB_TABLEV2_RESOURCE_POLICY_PER_REPLICA]: { + type: FlagType.BugFix, + summary: 'When enabled will allow you to specify a resource policy per replica, and not copy the source table policy to all replicas', + detailsMd: ` + If this flag is not set, the default behavior for \`TableV2\` is to use a different \`resourcePolicy\` for each replica. + + If this flag is set to false, the behavior is that each replica shares the same \`resourcePolicy\` as the source table. + This will prevent you from creating a new table which has an additional replica and a resource policy. + + This is a feature flag as the old behavior was technically incorrect but users may have come to depend on it.`, + introducedIn: { v2: 'V2NEXT' }, + recommendedValue: true, + }, + ////////////////////////////////////////////////////////////////////// [EC2_SUM_TIMEOUT_ENABLED]: { type: FlagType.BugFix, From dc3ac4eee8f2e5f7b2d363232d494ac1aa187ee5 Mon Sep 17 00:00:00 2001 From: paulhcsun <47882901+paulhcsun@users.noreply.github.com> Date: Wed, 23 Oct 2024 16:51:27 -0700 Subject: [PATCH 23/33] chore(kinesisfirehose): update README to explicitly clarify which sources/destinations are supported in the CDK (#31868) ### Description of changes update README to explicitly clarify which sources/destinations are supported in the CDK ### Checklist - [x] My code adheres to the [CONTRIBUTING GUIDE](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and [DESIGN GUIDELINES](https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md) ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license* --- packages/@aws-cdk/aws-kinesisfirehose-alpha/README.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/@aws-cdk/aws-kinesisfirehose-alpha/README.md b/packages/@aws-cdk/aws-kinesisfirehose-alpha/README.md index 3b216e66b1355..dd348a267e943 100644 --- a/packages/@aws-cdk/aws-kinesisfirehose-alpha/README.md +++ b/packages/@aws-cdk/aws-kinesisfirehose-alpha/README.md @@ -54,7 +54,7 @@ The above example defines the following resources: ## Sources -An Amazon Data Firehose delivery stream can accept data from three main sources: Kinesis Data Streams, Managed Streaming for Apache Kafka (MSK), or via a "direct put" (API calls). +An Amazon Data Firehose delivery stream can accept data from three main sources: Kinesis Data Streams, Managed Streaming for Apache Kafka (MSK), or via a "direct put" (API calls). Currently only Kinesis Data Streams and direct put are supported in the CDK. See: [Sending Data to a Delivery Stream](https://docs.aws.amazon.com/firehose/latest/dev/basic-write.html) in the *Amazon Data Firehose Developer Guide*. @@ -96,7 +96,9 @@ Data must be provided via "direct put", ie., by using a `PutRecord` or ## Destinations -The following destinations are supported. See [kinesisfirehose-destinations](https://docs.aws.amazon.com/cdk/api/latest/docs/aws-kinesisfirehose-destinations-readme.html) +Amazon Data Firehose supports multiple AWS and third-party services as destinations, including Amazon S3, Amazon Redshift, and more. You can find the full list of supported destination [here](https://docs.aws.amazon.com/firehose/latest/dev/create-destination.html). + +Currently in the AWS CDK, only S3 is implemented as an L2 construct destination. Other destinations can still be configured using L1 constructs. See [kinesisfirehose-destinations](https://docs.aws.amazon.com/cdk/api/latest/docs/aws-kinesisfirehose-destinations-readme.html) for the implementations of these destinations. ### S3 From d884c7cfdcffad8e599ac098c645a280e3b6fdb7 Mon Sep 17 00:00:00 2001 From: Leo Herran <25494661+leoherran-aws@users.noreply.github.com> Date: Wed, 23 Oct 2024 19:53:53 -0700 Subject: [PATCH 24/33] chore(codebuild): update default curated Docker image used in CodeBuild projects (#31859) ### Issue # (if applicable) Closes #31614 ### Reason for this change Updates the default curated Docker image used for CodeBuild projects to the latest version. The existing default image version is deprecated. ### Description of changes Updated image constants in the CodeBuild project logic. ### Description of how you validated changes Updated and ran CodeBuild unit tests. ### Checklist - [x] My code adheres to the [CONTRIBUTING GUIDE](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and [DESIGN GUIDELINES](https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md) ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license* --- .../CodeBuildAssetBuildSpecStack.template.json | 4 ++-- .../aws-cdk-codebuild.template.json | 4 ++-- .../codebuild-default-project.template.json | 4 ++-- .../test-codebuild-github-webhook-batch.template.json | 4 ++-- .../test-codebuild-github.template.json | 4 ++-- .../aws-cdk-codebuild.template.json | 4 ++-- ...ws-cdk-codebuild-buildspec-artifact-name.template.json | 4 ++-- .../aws-cdk-codebuild-file-system-locations.template.json | 4 ++-- .../aws-cdk-codebuild-logging.template.json | 4 ++-- .../aws-cdk-codebuild-project-vpc.template.json | 4 ++-- ...dk-codebuild-secondary-sources-artifacts.template.json | 4 ++-- .../codebuild-visibility.template.json | 4 ++-- .../aws-cdk-codebuild-project-vpc.template.json | 4 ++-- .../aws-cdk-report-group-delete-reports.template.json | 4 ++-- .../aws-cdk-report-group.template.json | 4 ++-- .../aws-cdk-codepipeline-codebuild-batch.template.json | 4 ++-- ...peline-codebuild-multiple-inputs-outputs.template.json | 4 ++-- ...ws-cdk-codepipeline-codecommit-codebuild.template.json | 4 ++-- .../aws-cdk-pipeline-event-target.template.json | 4 ++-- ...-cdk-codepipeline-with-pipeline-triggers.template.json | 6 +++--- .../integ-pipeline-consumer-stack.template.json | 4 ++-- .../PipelineStack.template.json | 4 ++-- .../aws-cdk-codebuild-events.template.json | 4 ++-- ...ctions-tasks-codebuild-start-build-integ.template.json | 2 +- packages/aws-cdk-lib/aws-codebuild/lib/project.ts | 6 +++--- packages/aws-cdk-lib/aws-codebuild/test/codebuild.test.ts | 8 ++++---- .../aws-codepipeline-actions/test/pipeline.test.ts | 2 +- 27 files changed, 56 insertions(+), 56 deletions(-) diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.asset-build-spec.js.snapshot/CodeBuildAssetBuildSpecStack.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.asset-build-spec.js.snapshot/CodeBuildAssetBuildSpecStack.template.json index c4231385ef554..64d6060026013 100644 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.asset-build-spec.js.snapshot/CodeBuildAssetBuildSpecStack.template.json +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.asset-build-spec.js.snapshot/CodeBuildAssetBuildSpecStack.template.json @@ -173,7 +173,7 @@ }, "Environment": { "ComputeType": "BUILD_GENERAL1_SMALL", - "Image": "aws/codebuild/standard:1.0", + "Image": "aws/codebuild/standard:7.0", "ImagePullCredentialsType": "CODEBUILD", "PrivilegedMode": false, "Type": "LINUX_CONTAINER" @@ -254,4 +254,4 @@ ] } } -} \ No newline at end of file +} diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.caching.js.snapshot/aws-cdk-codebuild.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.caching.js.snapshot/aws-cdk-codebuild.template.json index bb229d9f143c6..11f09584f8b22 100644 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.caching.js.snapshot/aws-cdk-codebuild.template.json +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.caching.js.snapshot/aws-cdk-codebuild.template.json @@ -140,7 +140,7 @@ }, "Environment": { "ComputeType": "BUILD_GENERAL1_SMALL", - "Image": "aws/codebuild/standard:1.0", + "Image": "aws/codebuild/standard:7.0", "ImagePullCredentialsType": "CODEBUILD", "PrivilegedMode": false, "Type": "LINUX_CONTAINER" @@ -209,4 +209,4 @@ ] } } -} \ No newline at end of file +} diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.defaults.lit.js.snapshot/codebuild-default-project.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.defaults.lit.js.snapshot/codebuild-default-project.template.json index 14e4f78ae05b1..226ad024c0b0b 100644 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.defaults.lit.js.snapshot/codebuild-default-project.template.json +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.defaults.lit.js.snapshot/codebuild-default-project.template.json @@ -132,7 +132,7 @@ }, "Environment": { "ComputeType": "BUILD_GENERAL1_SMALL", - "Image": "aws/codebuild/standard:1.0", + "Image": "aws/codebuild/standard:7.0", "ImagePullCredentialsType": "CODEBUILD", "PrivilegedMode": false, "Type": "LINUX_CONTAINER" @@ -188,4 +188,4 @@ ] } } -} \ No newline at end of file +} diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.github-webhook-batch.js.snapshot/test-codebuild-github-webhook-batch.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.github-webhook-batch.js.snapshot/test-codebuild-github-webhook-batch.template.json index bc46e43fb1f95..4a64ef1155033 100644 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.github-webhook-batch.js.snapshot/test-codebuild-github-webhook-batch.template.json +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.github-webhook-batch.js.snapshot/test-codebuild-github-webhook-batch.template.json @@ -145,7 +145,7 @@ }, "Environment": { "ComputeType": "BUILD_GENERAL1_SMALL", - "Image": "aws/codebuild/standard:1.0", + "Image": "aws/codebuild/standard:7.0", "ImagePullCredentialsType": "CODEBUILD", "PrivilegedMode": false, "Type": "LINUX_CONTAINER" @@ -222,4 +222,4 @@ ] } } -} \ No newline at end of file +} diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.github.js.snapshot/test-codebuild-github.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.github.js.snapshot/test-codebuild-github.template.json index f86a893132c8e..24f6d96bf066a 100644 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.github.js.snapshot/test-codebuild-github.template.json +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.github.js.snapshot/test-codebuild-github.template.json @@ -98,7 +98,7 @@ }, "Environment": { "ComputeType": "BUILD_GENERAL1_SMALL", - "Image": "aws/codebuild/standard:1.0", + "Image": "aws/codebuild/standard:7.0", "ImagePullCredentialsType": "CODEBUILD", "PrivilegedMode": false, "Type": "LINUX_CONTAINER" @@ -155,4 +155,4 @@ ] } } -} \ No newline at end of file +} diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-bucket.js.snapshot/aws-cdk-codebuild.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-bucket.js.snapshot/aws-cdk-codebuild.template.json index 2e7587aa97929..4008c2af0f554 100644 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-bucket.js.snapshot/aws-cdk-codebuild.template.json +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-bucket.js.snapshot/aws-cdk-codebuild.template.json @@ -133,7 +133,7 @@ }, "Environment": { "ComputeType": "BUILD_GENERAL1_LARGE", - "Image": "aws/codebuild/standard:1.0", + "Image": "aws/codebuild/standard:7.0", "ImagePullCredentialsType": "CODEBUILD", "PrivilegedMode": false, "Type": "LINUX_CONTAINER" @@ -199,4 +199,4 @@ ] } } -} \ No newline at end of file +} diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-buildspec-artifacts.js.snapshot/aws-cdk-codebuild-buildspec-artifact-name.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-buildspec-artifacts.js.snapshot/aws-cdk-codebuild-buildspec-artifact-name.template.json index 5267ba939c5d5..72d66ec27a492 100644 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-buildspec-artifacts.js.snapshot/aws-cdk-codebuild-buildspec-artifact-name.template.json +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-buildspec-artifacts.js.snapshot/aws-cdk-codebuild-buildspec-artifact-name.template.json @@ -148,7 +148,7 @@ }, "Environment": { "ComputeType": "BUILD_GENERAL1_SMALL", - "Image": "aws/codebuild/standard:1.0", + "Image": "aws/codebuild/standard:7.0", "ImagePullCredentialsType": "CODEBUILD", "PrivilegedMode": false, "Type": "LINUX_CONTAINER" @@ -204,4 +204,4 @@ ] } } -} \ No newline at end of file +} diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-file-system-location.js.snapshot/aws-cdk-codebuild-file-system-locations.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-file-system-location.js.snapshot/aws-cdk-codebuild-file-system-locations.template.json index 32b4a351f097d..b552e67966a31 100644 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-file-system-location.js.snapshot/aws-cdk-codebuild-file-system-locations.template.json +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-file-system-location.js.snapshot/aws-cdk-codebuild-file-system-locations.template.json @@ -383,7 +383,7 @@ }, "Environment": { "ComputeType": "BUILD_GENERAL1_SMALL", - "Image": "aws/codebuild/standard:1.0", + "Image": "aws/codebuild/standard:7.0", "ImagePullCredentialsType": "CODEBUILD", "PrivilegedMode": true, "Type": "LINUX_CONTAINER" @@ -509,4 +509,4 @@ ] } } -} \ No newline at end of file +} diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-logging.js.snapshot/aws-cdk-codebuild-logging.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-logging.js.snapshot/aws-cdk-codebuild-logging.template.json index 72dd78a0d0545..357baccc21c40 100644 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-logging.js.snapshot/aws-cdk-codebuild-logging.template.json +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-logging.js.snapshot/aws-cdk-codebuild-logging.template.json @@ -192,7 +192,7 @@ }, "Environment": { "ComputeType": "BUILD_GENERAL1_SMALL", - "Image": "aws/codebuild/standard:1.0", + "Image": "aws/codebuild/standard:7.0", "ImagePullCredentialsType": "CODEBUILD", "PrivilegedMode": false, "Type": "LINUX_CONTAINER" @@ -261,4 +261,4 @@ ] } } -} \ No newline at end of file +} diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-notification.js.snapshot/aws-cdk-codebuild-project-vpc.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-notification.js.snapshot/aws-cdk-codebuild-project-vpc.template.json index 203f21a5fe640..4c194911d30db 100644 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-notification.js.snapshot/aws-cdk-codebuild-project-vpc.template.json +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-notification.js.snapshot/aws-cdk-codebuild-project-vpc.template.json @@ -132,7 +132,7 @@ }, "Environment": { "ComputeType": "BUILD_GENERAL1_SMALL", - "Image": "aws/codebuild/standard:1.0", + "Image": "aws/codebuild/standard:7.0", "ImagePullCredentialsType": "CODEBUILD", "PrivilegedMode": false, "Type": "LINUX_CONTAINER" @@ -241,4 +241,4 @@ ] } } -} \ No newline at end of file +} diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-secondary-sources-artifacts.js.snapshot/aws-cdk-codebuild-secondary-sources-artifacts.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-secondary-sources-artifacts.js.snapshot/aws-cdk-codebuild-secondary-sources-artifacts.template.json index 05e907f202018..ae152536d24be 100644 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-secondary-sources-artifacts.js.snapshot/aws-cdk-codebuild-secondary-sources-artifacts.template.json +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-secondary-sources-artifacts.js.snapshot/aws-cdk-codebuild-secondary-sources-artifacts.template.json @@ -170,7 +170,7 @@ }, "Environment": { "ComputeType": "BUILD_GENERAL1_SMALL", - "Image": "aws/codebuild/standard:1.0", + "Image": "aws/codebuild/standard:7.0", "ImagePullCredentialsType": "CODEBUILD", "PrivilegedMode": false, "Type": "LINUX_CONTAINER" @@ -256,4 +256,4 @@ ] } } -} \ No newline at end of file +} diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-visibility.js.snapshot/codebuild-visibility.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-visibility.js.snapshot/codebuild-visibility.template.json index ad99d88e5c723..ba9c06e90ba83 100644 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-visibility.js.snapshot/codebuild-visibility.template.json +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-visibility.js.snapshot/codebuild-visibility.template.json @@ -171,7 +171,7 @@ "EncryptionKey": "alias/aws/s3", "Environment": { "ComputeType": "BUILD_GENERAL1_SMALL", - "Image": "aws/codebuild/standard:1.0", + "Image": "aws/codebuild/standard:7.0", "ImagePullCredentialsType": "CODEBUILD", "PrivilegedMode": false, "Type": "LINUX_CONTAINER" @@ -234,4 +234,4 @@ ] } } -} \ No newline at end of file +} diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-vpc.js.snapshot/aws-cdk-codebuild-project-vpc.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-vpc.js.snapshot/aws-cdk-codebuild-project-vpc.template.json index 029b4608ae5ed..9a42045c22043 100644 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-vpc.js.snapshot/aws-cdk-codebuild-project-vpc.template.json +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-vpc.js.snapshot/aws-cdk-codebuild-project-vpc.template.json @@ -383,7 +383,7 @@ }, "Environment": { "ComputeType": "BUILD_GENERAL1_SMALL", - "Image": "aws/codebuild/standard:1.0", + "Image": "aws/codebuild/standard:7.0", "ImagePullCredentialsType": "CODEBUILD", "PrivilegedMode": false, "Type": "LINUX_CONTAINER" @@ -489,4 +489,4 @@ ] } } -} \ No newline at end of file +} diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.report-group-delete-reports.js.snapshot/aws-cdk-report-group-delete-reports.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.report-group-delete-reports.js.snapshot/aws-cdk-report-group-delete-reports.template.json index f23ea7df4e3bf..7e3e531ec8257 100644 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.report-group-delete-reports.js.snapshot/aws-cdk-report-group-delete-reports.template.json +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.report-group-delete-reports.js.snapshot/aws-cdk-report-group-delete-reports.template.json @@ -128,7 +128,7 @@ "EncryptionKey": "alias/aws/s3", "Environment": { "ComputeType": "BUILD_GENERAL1_SMALL", - "Image": "aws/codebuild/standard:1.0", + "Image": "aws/codebuild/standard:7.0", "ImagePullCredentialsType": "CODEBUILD", "PrivilegedMode": false, "Type": "LINUX_CONTAINER" @@ -194,4 +194,4 @@ ] } } -} \ No newline at end of file +} diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.report-group.js.snapshot/aws-cdk-report-group.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.report-group.js.snapshot/aws-cdk-report-group.template.json index 468660b702b17..2a03ac4db02b8 100644 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.report-group.js.snapshot/aws-cdk-report-group.template.json +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.report-group.js.snapshot/aws-cdk-report-group.template.json @@ -148,7 +148,7 @@ }, "Environment": { "ComputeType": "BUILD_GENERAL1_SMALL", - "Image": "aws/codebuild/standard:1.0", + "Image": "aws/codebuild/standard:7.0", "ImagePullCredentialsType": "CODEBUILD", "PrivilegedMode": false, "Type": "LINUX_CONTAINER" @@ -225,4 +225,4 @@ ] } } -} \ No newline at end of file +} diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-code-build-batch.js.snapshot/aws-cdk-codepipeline-codebuild-batch.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-code-build-batch.js.snapshot/aws-cdk-codepipeline-codebuild-batch.template.json index 65f8f49e881bb..4b0a9aeba2acd 100644 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-code-build-batch.js.snapshot/aws-cdk-codepipeline-codebuild-batch.template.json +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-code-build-batch.js.snapshot/aws-cdk-codepipeline-codebuild-batch.template.json @@ -482,7 +482,7 @@ "EncryptionKey": "alias/aws/s3", "Environment": { "ComputeType": "BUILD_GENERAL1_SMALL", - "Image": "aws/codebuild/standard:1.0", + "Image": "aws/codebuild/standard:7.0", "ImagePullCredentialsType": "CODEBUILD", "PrivilegedMode": false, "Type": "LINUX_CONTAINER" @@ -580,4 +580,4 @@ ] } } -} \ No newline at end of file +} diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-code-build-multiple-inputs-outputs.js.snapshot/aws-cdk-codepipeline-codebuild-multiple-inputs-outputs.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-code-build-multiple-inputs-outputs.js.snapshot/aws-cdk-codepipeline-codebuild-multiple-inputs-outputs.template.json index 4c2e43447e268..0ec139706eee1 100644 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-code-build-multiple-inputs-outputs.js.snapshot/aws-cdk-codepipeline-codebuild-multiple-inputs-outputs.template.json +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-code-build-multiple-inputs-outputs.js.snapshot/aws-cdk-codepipeline-codebuild-multiple-inputs-outputs.template.json @@ -584,7 +584,7 @@ "EncryptionKey": "alias/aws/s3", "Environment": { "ComputeType": "BUILD_GENERAL1_SMALL", - "Image": "aws/codebuild/standard:1.0", + "Image": "aws/codebuild/standard:7.0", "ImagePullCredentialsType": "CODEBUILD", "PrivilegedMode": false, "Type": "LINUX_CONTAINER" @@ -635,4 +635,4 @@ ] } } -} \ No newline at end of file +} diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-code-commit-build.js.snapshot/aws-cdk-codepipeline-codecommit-codebuild.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-code-commit-build.js.snapshot/aws-cdk-codepipeline-codecommit-codebuild.template.json index 4c6a4f4daa0f3..13d604fcb8b8a 100644 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-code-commit-build.js.snapshot/aws-cdk-codepipeline-codecommit-codebuild.template.json +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-code-commit-build.js.snapshot/aws-cdk-codepipeline-codecommit-codebuild.template.json @@ -190,7 +190,7 @@ }, "Environment": { "ComputeType": "BUILD_GENERAL1_SMALL", - "Image": "aws/codebuild/standard:1.0", + "Image": "aws/codebuild/standard:7.0", "ImagePullCredentialsType": "CODEBUILD", "PrivilegedMode": false, "Type": "LINUX_CONTAINER" @@ -847,4 +847,4 @@ ] } } -} \ No newline at end of file +} diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-events.js.snapshot/aws-cdk-pipeline-event-target.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-events.js.snapshot/aws-cdk-pipeline-event-target.template.json index 8c0a96dacfa2c..61ef73b460c6b 100644 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-events.js.snapshot/aws-cdk-pipeline-event-target.template.json +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-events.js.snapshot/aws-cdk-pipeline-event-target.template.json @@ -841,7 +841,7 @@ }, "Environment": { "ComputeType": "BUILD_GENERAL1_SMALL", - "Image": "aws/codebuild/standard:1.0", + "Image": "aws/codebuild/standard:7.0", "ImagePullCredentialsType": "CODEBUILD", "PrivilegedMode": false, "Type": "LINUX_CONTAINER" @@ -921,4 +921,4 @@ ] } } -} \ No newline at end of file +} diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-with-pipeline-triggers.js.snapshot/aws-cdk-codepipeline-with-pipeline-triggers.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-with-pipeline-triggers.js.snapshot/aws-cdk-codepipeline-with-pipeline-triggers.template.json index 577f1d2a091d7..71cfa19ffb1d2 100644 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-with-pipeline-triggers.js.snapshot/aws-cdk-codepipeline-with-pipeline-triggers.template.json +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-with-pipeline-triggers.js.snapshot/aws-cdk-codepipeline-with-pipeline-triggers.template.json @@ -194,7 +194,7 @@ }, "Environment": { "ComputeType": "BUILD_GENERAL1_SMALL", - "Image": "aws/codebuild/standard:1.0", + "Image": "aws/codebuild/standard:7.0", "ImagePullCredentialsType": "CODEBUILD", "PrivilegedMode": false, "Type": "LINUX_CONTAINER" @@ -946,7 +946,7 @@ }, "Environment": { "ComputeType": "BUILD_GENERAL1_SMALL", - "Image": "aws/codebuild/standard:1.0", + "Image": "aws/codebuild/standard:7.0", "ImagePullCredentialsType": "CODEBUILD", "PrivilegedMode": false, "Type": "LINUX_CONTAINER" @@ -1553,4 +1553,4 @@ ] } } -} \ No newline at end of file +} diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-with-replication.js.snapshot/integ-pipeline-consumer-stack.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-with-replication.js.snapshot/integ-pipeline-consumer-stack.template.json index 15f69eb441260..e67aa1735dee6 100644 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-with-replication.js.snapshot/integ-pipeline-consumer-stack.template.json +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-with-replication.js.snapshot/integ-pipeline-consumer-stack.template.json @@ -831,7 +831,7 @@ }, "Environment": { "ComputeType": "BUILD_GENERAL1_SMALL", - "Image": "aws/codebuild/standard:1.0", + "Image": "aws/codebuild/standard:7.0", "ImagePullCredentialsType": "CODEBUILD", "PrivilegedMode": false, "Type": "LINUX_CONTAINER" @@ -979,4 +979,4 @@ ] } } -} \ No newline at end of file +} diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/s3/integ.source-bucket-events-cross-stack-same-env.js.snapshot/PipelineStack.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/s3/integ.source-bucket-events-cross-stack-same-env.js.snapshot/PipelineStack.template.json index 5c9baff630942..9fc88833bae1d 100644 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/s3/integ.source-bucket-events-cross-stack-same-env.js.snapshot/PipelineStack.template.json +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/s3/integ.source-bucket-events-cross-stack-same-env.js.snapshot/PipelineStack.template.json @@ -178,7 +178,7 @@ }, "Environment": { "ComputeType": "BUILD_GENERAL1_SMALL", - "Image": "aws/codebuild/standard:1.0", + "Image": "aws/codebuild/standard:7.0", "ImagePullCredentialsType": "CODEBUILD", "PrivilegedMode": false, "Type": "LINUX_CONTAINER" @@ -885,4 +885,4 @@ ] } } -} \ No newline at end of file +} diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/codebuild/integ.project-events.js.snapshot/aws-cdk-codebuild-events.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/codebuild/integ.project-events.js.snapshot/aws-cdk-codebuild-events.template.json index 4d8c799d34fb8..a9c97e9a1bf41 100644 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/codebuild/integ.project-events.js.snapshot/aws-cdk-codebuild-events.template.json +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/codebuild/integ.project-events.js.snapshot/aws-cdk-codebuild-events.template.json @@ -221,7 +221,7 @@ }, "Environment": { "ComputeType": "BUILD_GENERAL1_SMALL", - "Image": "aws/codebuild/standard:1.0", + "Image": "aws/codebuild/standard:7.0", "ImagePullCredentialsType": "CODEBUILD", "PrivilegedMode": false, "Type": "LINUX_CONTAINER" @@ -518,4 +518,4 @@ ] } } -} \ No newline at end of file +} diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/codebuild/integ.start-build.js.snapshot/aws-stepfunctions-tasks-codebuild-start-build-integ.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/codebuild/integ.start-build.js.snapshot/aws-stepfunctions-tasks-codebuild-start-build-integ.template.json index 7e556e0d9bf21..d618f4d51c48e 100644 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/codebuild/integ.start-build.js.snapshot/aws-stepfunctions-tasks-codebuild-start-build-integ.template.json +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/codebuild/integ.start-build.js.snapshot/aws-stepfunctions-tasks-codebuild-start-build-integ.template.json @@ -139,7 +139,7 @@ "Value": "defaultZone" } ], - "Image": "aws/codebuild/standard:1.0", + "Image": "aws/codebuild/standard:7.0", "ImagePullCredentialsType": "CODEBUILD", "PrivilegedMode": false, "Type": "LINUX_CONTAINER" diff --git a/packages/aws-cdk-lib/aws-codebuild/lib/project.ts b/packages/aws-cdk-lib/aws-codebuild/lib/project.ts index 089757a96bc31..42bdca951ba99 100644 --- a/packages/aws-cdk-lib/aws-codebuild/lib/project.ts +++ b/packages/aws-cdk-lib/aws-codebuild/lib/project.ts @@ -563,7 +563,7 @@ export interface CommonProjectProps { /** * Build environment to use for the build. * - * @default BuildEnvironment.LinuxBuildImage.STANDARD_1_0 + * @default BuildEnvironment.LinuxBuildImage.STANDARD_7_0 */ readonly environment?: BuildEnvironment; @@ -1060,7 +1060,7 @@ export class Project extends ProjectBase { }); this.grantPrincipal = this.role; - this.buildImage = (props.environment && props.environment.buildImage) || LinuxBuildImage.STANDARD_1_0; + this.buildImage = (props.environment && props.environment.buildImage) || LinuxBuildImage.STANDARD_7_0; // let source "bind" to the project. this usually involves granting permissions // for the code build role to interact with the source. @@ -1624,7 +1624,7 @@ export interface BuildEnvironment { /** * The image used for the builds. * - * @default LinuxBuildImage.STANDARD_1_0 + * @default LinuxBuildImage.STANDARD_7_0 */ readonly buildImage?: IBuildImage; diff --git a/packages/aws-cdk-lib/aws-codebuild/test/codebuild.test.ts b/packages/aws-cdk-lib/aws-codebuild/test/codebuild.test.ts index e0923a70b1b3b..8337c1d17a0cd 100644 --- a/packages/aws-cdk-lib/aws-codebuild/test/codebuild.test.ts +++ b/packages/aws-cdk-lib/aws-codebuild/test/codebuild.test.ts @@ -149,7 +149,7 @@ describe('default properties', () => { 'Environment': { 'Type': 'LINUX_CONTAINER', 'PrivilegedMode': false, - 'Image': 'aws/codebuild/standard:1.0', + 'Image': 'aws/codebuild/standard:7.0', 'ImagePullCredentialsType': 'CODEBUILD', 'ComputeType': 'BUILD_GENERAL1_SMALL', }, @@ -315,7 +315,7 @@ describe('default properties', () => { }, 'Environment': { 'ComputeType': 'BUILD_GENERAL1_SMALL', - 'Image': 'aws/codebuild/standard:1.0', + 'Image': 'aws/codebuild/standard:7.0', 'ImagePullCredentialsType': 'CODEBUILD', 'PrivilegedMode': false, 'Type': 'LINUX_CONTAINER', @@ -1351,7 +1351,7 @@ describe('artifacts', () => { 'Environment': { 'Type': 'LINUX_CONTAINER', 'PrivilegedMode': false, - 'Image': 'aws/codebuild/standard:1.0', + 'Image': 'aws/codebuild/standard:7.0', 'ImagePullCredentialsType': 'CODEBUILD', 'ComputeType': 'BUILD_GENERAL1_SMALL', }, @@ -1588,7 +1588,7 @@ test('environment variables can be overridden at the project level', () => { }, ], 'PrivilegedMode': false, - 'Image': 'aws/codebuild/standard:1.0', + 'Image': 'aws/codebuild/standard:7.0', 'ImagePullCredentialsType': 'CODEBUILD', 'ComputeType': 'BUILD_GENERAL1_SMALL', }, diff --git a/packages/aws-cdk-lib/aws-codepipeline-actions/test/pipeline.test.ts b/packages/aws-cdk-lib/aws-codepipeline-actions/test/pipeline.test.ts index fac873b4ba4fd..21b561a36d5ba 100644 --- a/packages/aws-cdk-lib/aws-codepipeline-actions/test/pipeline.test.ts +++ b/packages/aws-cdk-lib/aws-codepipeline-actions/test/pipeline.test.ts @@ -412,7 +412,7 @@ describe('pipeline', () => { 'Environment': { 'Type': 'LINUX_CONTAINER', 'PrivilegedMode': false, - 'Image': 'aws/codebuild/standard:1.0', + 'Image': 'aws/codebuild/standard:7.0', 'ComputeType': 'BUILD_GENERAL1_SMALL', }, }); From 427bf630cb2e28ec98477b313eef32d5b9b91525 Mon Sep 17 00:00:00 2001 From: Rico Hermans Date: Thu, 24 Oct 2024 11:44:21 +0200 Subject: [PATCH 25/33] fix(cli): cross-account asset publishing doesn't work without bootstrap stack (#31876) If the bootstrap stack can't be found, it can't be validated. We used to fail closed, but that just means that cross-account publishing is broken. Instead, we have to fail open. This is not the only protection mechanism we have, so the local check is more of a bonus. Fixes #31866. ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license* --- packages/aws-cdk/lib/api/util/checks.ts | 14 ++++++++++---- packages/aws-cdk/test/api/util/checks.test.ts | 9 +++++++++ 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/packages/aws-cdk/lib/api/util/checks.ts b/packages/aws-cdk/lib/api/util/checks.ts index 11c1c856eb384..a094156ba74fb 100644 --- a/packages/aws-cdk/lib/api/util/checks.ts +++ b/packages/aws-cdk/lib/api/util/checks.ts @@ -18,13 +18,19 @@ export async function determineAllowCrossAccountAssetPublishing(sdk: ISDK, custo return true; } - // other scenarios are highly irregular and potentially dangerous so we prevent it by - // instructing cdk-assets to detect foreign bucket ownership and reject. + // If there is a staging bucket AND the bootstrap version is old, then we want to protect + // against accidental cross-account publishing. return false; } catch (e) { + // You would think we would need to fail closed here, but the reality is + // that we get here if we couldn't find the bootstrap stack: that is + // completely valid, and many large organizations may have their own method + // of creating bootstrap resources. If they do, there's nothing for us to validate, + // but we can't use that as a reason to disallow cross-account publishing. We'll just + // have to trust they did their due diligence. So we fail open. debug(`Error determining cross account asset publishing: ${e}`); - debug('Defaulting to disallowing cross account asset publishing'); - return false; + debug('Defaulting to allowing cross account asset publishing'); + return true; } } diff --git a/packages/aws-cdk/test/api/util/checks.test.ts b/packages/aws-cdk/test/api/util/checks.test.ts index 2db7e3d1603ea..660577a8f6aec 100644 --- a/packages/aws-cdk/test/api/util/checks.test.ts +++ b/packages/aws-cdk/test/api/util/checks.test.ts @@ -50,6 +50,15 @@ describe('determineAllowCrossAccountAssetPublishing', () => { expect(result).toBe(true); }); + it('should return true if looking up the bootstrap stack fails', async () => { + AWSMock.mock('CloudFormation', 'describeStacks', (_params: any, callback: Function) => { + callback(new Error('Could not read bootstrap stack')); + }); + + const result = await determineAllowCrossAccountAssetPublishing(mockSDK); + expect(result).toBe(true); + }); + it('should return false for other scenarios', async () => { AWSMock.mock('CloudFormation', 'describeStacks', (_params: any, callback: Function) => { callback(null, { From 8d06824298d80b18c6b0143a9ac38b79ea5d6253 Mon Sep 17 00:00:00 2001 From: Rico Hermans Date: Thu, 24 Oct 2024 13:20:50 +0200 Subject: [PATCH 26/33] fix(cli): deploy-role is not authorized to perform DescribeStackResources (#31878) The cross-account asset uploading detection check required that the `deploy-role` could call `DescribeStackResources` -- which it can't. Instead, rely on parsing the `Outputs` of `DescribeStacks`. This is equivalent for the built-in stack, and relies on stack customizers to have removed the Output or put a dummy value there that does not look like a stack name (like `''`, `'-'` or `'*'`). It's not *as* good, but probably good enough. ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license* --- packages/aws-cdk/lib/api/util/checks.ts | 19 ++++---- packages/aws-cdk/test/api/util/checks.test.ts | 48 +++++++++++++------ 2 files changed, 43 insertions(+), 24 deletions(-) diff --git a/packages/aws-cdk/lib/api/util/checks.ts b/packages/aws-cdk/lib/api/util/checks.ts index a094156ba74fb..96fe2a3bc549f 100644 --- a/packages/aws-cdk/lib/api/util/checks.ts +++ b/packages/aws-cdk/lib/api/util/checks.ts @@ -60,15 +60,16 @@ export async function getBootstrapStackInfo(sdk: ISDK, stackName: string): Promi throw new Error(`Invalid BootstrapVersion value: ${versionOutput.OutputValue}`); } - // try to get bucketname from the logical resource id - let bucketName: string | undefined; - const resourcesResponse = await cfn.describeStackResources({ StackName: stackName }).promise(); - const bucketResource = resourcesResponse.StackResources?.find(resource => - resource.ResourceType === 'AWS::S3::Bucket', - ); - bucketName = bucketResource?.PhysicalResourceId; - - let hasStagingBucket = !!bucketName; + // try to get bucketname from the logical resource id. If there is no + // bucketname, or the value doesn't look like an S3 bucket name, we assume + // the bucket doesn't exist (this is for the case where a template customizer did + // not dare to remove the Output, but put a dummy value there like '' or '-' or '***'). + // + // We would have preferred to look at the stack resources here, but + // unfortunately the deploy role doesn't have permissions call DescribeStackResources. + const bucketName = stack.Outputs?.find(output => output.OutputKey === 'BucketName')?.OutputValue; + // Must begin and end with letter or number. + const hasStagingBucket = !!(bucketName && bucketName.match(/^[a-z0-9]/) && bucketName.match(/[a-z0-9]$/)); return { hasStagingBucket, diff --git a/packages/aws-cdk/test/api/util/checks.test.ts b/packages/aws-cdk/test/api/util/checks.test.ts index 660577a8f6aec..697cbced9254b 100644 --- a/packages/aws-cdk/test/api/util/checks.test.ts +++ b/packages/aws-cdk/test/api/util/checks.test.ts @@ -25,8 +25,20 @@ describe('determineAllowCrossAccountAssetPublishing', () => { }); }); - AWSMock.mock('CloudFormation', 'describeStackResources', (_params: any, callback: Function) => { - callback(null, { StackResources: [] }); + const result = await determineAllowCrossAccountAssetPublishing(mockSDK); + expect(result).toBe(true); + }); + + it.each(['', '-', '*', '---'])('should return true when the bucket output does not look like a real bucket', async (notABucketName) => { + AWSMock.mock('CloudFormation', 'describeStacks', (_params: any, callback: Function) => { + callback(null, { + Stacks: [{ + Outputs: [ + { OutputKey: 'BootstrapVersion', OutputValue: '1' }, + { OutputKey: 'BucketName', OutputValue: notABucketName }, + ], + }], + }); }); const result = await determineAllowCrossAccountAssetPublishing(mockSDK); @@ -37,13 +49,21 @@ describe('determineAllowCrossAccountAssetPublishing', () => { AWSMock.mock('CloudFormation', 'describeStacks', (_params: any, callback: Function) => { callback(null, { Stacks: [{ - Outputs: [{ OutputKey: 'BootstrapVersion', OutputValue: '21' }], + Outputs: [ + { OutputKey: 'BootstrapVersion', OutputValue: '21' }, + { OutputKey: 'BucketName', OutputValue: 'some-bucket' }, + ], }], }); }); - AWSMock.mock('CloudFormation', 'describeStackResources', (_params: any, callback: Function) => { - callback(null, { StackResources: [{ ResourceType: 'AWS::S3::Bucket', PhysicalResourceId: 'some-bucket' }] }); + const result = await determineAllowCrossAccountAssetPublishing(mockSDK); + expect(result).toBe(true); + }); + + it('should return true if looking up the bootstrap stack fails', async () => { + AWSMock.mock('CloudFormation', 'describeStacks', (_params: any, callback: Function) => { + callback(new Error('Could not read bootstrap stack')); }); const result = await determineAllowCrossAccountAssetPublishing(mockSDK); @@ -63,15 +83,14 @@ describe('determineAllowCrossAccountAssetPublishing', () => { AWSMock.mock('CloudFormation', 'describeStacks', (_params: any, callback: Function) => { callback(null, { Stacks: [{ - Outputs: [{ OutputKey: 'BootstrapVersion', OutputValue: '20' }], + Outputs: [ + { OutputKey: 'BootstrapVersion', OutputValue: '20' }, + { OutputKey: 'BucketName', OutputValue: 'some-bucket' }, + ], }], }); }); - AWSMock.mock('CloudFormation', 'describeStackResources', (_params: any, callback: Function) => { - callback(null, { StackResources: [{ ResourceType: 'AWS::S3::Bucket', PhysicalResourceId: 'some-bucket' }] }); - }); - const result = await determineAllowCrossAccountAssetPublishing(mockSDK); expect(result).toBe(false); }); @@ -94,15 +113,14 @@ describe('getBootstrapStackInfo', () => { AWSMock.mock('CloudFormation', 'describeStacks', (_params: any, callback: Function) => { callback(null, { Stacks: [{ - Outputs: [{ OutputKey: 'BootstrapVersion', OutputValue: '21' }], + Outputs: [ + { OutputKey: 'BootstrapVersion', OutputValue: '21' }, + { OutputKey: 'BucketName', OutputValue: 'some-bucket' }, + ], }], }); }); - AWSMock.mock('CloudFormation', 'describeStackResources', (_params: any, callback: Function) => { - callback(null, { StackResources: [{ ResourceType: 'AWS::S3::Bucket', PhysicalResourceId: 'some-bucket' }] }); - }); - const result = await getBootstrapStackInfo(mockSDK, 'CDKToolkit'); expect(result).toEqual({ hasStagingBucket: true, From f4f359d3e5b4e866098be7759e68d53a2621a9ad Mon Sep 17 00:00:00 2001 From: AWS CDK Team Date: Thu, 24 Oct 2024 13:01:02 +0000 Subject: [PATCH 27/33] chore(release): 2.164.0 --- CHANGELOG.v2.alpha.md | 13 +++++++++++++ CHANGELOG.v2.md | 19 +++++++++++++++++++ packages/aws-cdk-lib/cx-api/FEATURE_FLAGS.md | 20 ++++++++++++++++++++ packages/aws-cdk-lib/cx-api/lib/features.ts | 2 +- version.v2.json | 4 ++-- 5 files changed, 55 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.v2.alpha.md b/CHANGELOG.v2.alpha.md index ae5784f8a9df1..4801dda8486bd 100644 --- a/CHANGELOG.v2.alpha.md +++ b/CHANGELOG.v2.alpha.md @@ -2,6 +2,19 @@ All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. +## [2.164.0-alpha.0](https://github.com/aws/aws-cdk/compare/v2.163.1-alpha.0...v2.164.0-alpha.0) (2024-10-24) + + +### Features + +* **iot:** scheduled audit ([#31776](https://github.com/aws/aws-cdk/issues/31776)) ([366b492](https://github.com/aws/aws-cdk/commit/366b4927c50168113dd4057f6255ab6c76278135)), closes [#31779](https://github.com/aws/aws-cdk/issues/31779) + + +### Bug Fixes + +* **ec2:** allow NAT instance to associate public IP ([#31812](https://github.com/aws/aws-cdk/issues/31812)) ([e96b4ce](https://github.com/aws/aws-cdk/commit/e96b4ce4ae64076e4c2e688c649c69fb15a624d6)), closes [#31711](https://github.com/aws/aws-cdk/issues/31711) +* **scheduler-targets-alpha:** imported lambda function as schedule target throws synth error ([#31837](https://github.com/aws/aws-cdk/issues/31837)) ([d1d179f](https://github.com/aws/aws-cdk/commit/d1d179f617f83bbb3bf44d3cc629be8eed0d4e2b)), closes [#29284](https://github.com/aws/aws-cdk/issues/29284) + ## [2.163.1-alpha.0](https://github.com/aws/aws-cdk/compare/v2.163.0-alpha.0...v2.163.1-alpha.0) (2024-10-22) ## [2.163.0-alpha.0](https://github.com/aws/aws-cdk/compare/v2.162.1-alpha.0...v2.163.0-alpha.0) (2024-10-21) diff --git a/CHANGELOG.v2.md b/CHANGELOG.v2.md index 0bc7d0feea9bb..b8a269e2c5602 100644 --- a/CHANGELOG.v2.md +++ b/CHANGELOG.v2.md @@ -2,6 +2,25 @@ All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. +## [2.164.0](https://github.com/aws/aws-cdk/compare/v2.163.1...v2.164.0) (2024-10-24) + + +### Features + +* **cli:** add ability to configure hotswap properties for ECS ([#30511](https://github.com/aws/aws-cdk/issues/30511)) ([fee2cf8](https://github.com/aws/aws-cdk/commit/fee2cf88c58c6c1f25b9e6fad87c8042de464fd9)), closes [#29618](https://github.com/aws/aws-cdk/issues/29618) +* **cognito:** support email based MFA ([#31816](https://github.com/aws/aws-cdk/issues/31816)) ([f9d6eef](https://github.com/aws/aws-cdk/commit/f9d6eefd52d5bdc63ff2be844f567e8f1d0b4258)), closes [#31815](https://github.com/aws/aws-cdk/issues/31815) +* **cognito:** the Cognito Identity Pools module is now in Developer Preview ([#31854](https://github.com/aws/aws-cdk/issues/31854)) ([b22899f](https://github.com/aws/aws-cdk/commit/b22899f9dee04d5c446ebcdfff810a954ac08dc6)) + + +### Bug Fixes + +* **cli:** cross-account asset publishing doesn't work without bootstrap stack ([#31876](https://github.com/aws/aws-cdk/issues/31876)) ([427bf63](https://github.com/aws/aws-cdk/commit/427bf630cb2e28ec98477b313eef32d5b9b91525)), closes [#31866](https://github.com/aws/aws-cdk/issues/31866) +* **cli:** deploy-role is not authorized to perform DescribeStackResources ([#31878](https://github.com/aws/aws-cdk/issues/31878)) ([8d06824](https://github.com/aws/aws-cdk/commit/8d06824298d80b18c6b0143a9ac38b79ea5d6253)) +* **core:** fix policy synthesizer logic for precreated roles ([#31710](https://github.com/aws/aws-cdk/issues/31710)) ([aae03c9](https://github.com/aws/aws-cdk/commit/aae03c9f899ec2a77b841207ef0b4eb3a7e0ae00)) +* **dynamodb:** replication regions are incompatible with resource policies in TableV2 and feature flag ([#31513](https://github.com/aws/aws-cdk/issues/31513)) ([0b03eb0](https://github.com/aws/aws-cdk/commit/0b03eb0f62c132c1bd586a8ec31818398d07707f)), closes [#30705](https://github.com/aws/aws-cdk/issues/30705) +* **events-targets:** kinesis Stream target with Customer-Managed KMS key causes EventBridge FailedInvocations ([#31836](https://github.com/aws/aws-cdk/issues/31836)) ([58dfda0](https://github.com/aws/aws-cdk/commit/58dfda087a8aabde2683cd99df005d6e5e73a7ce)), closes [#10996](https://github.com/aws/aws-cdk/issues/10996) [/github.com/aws/aws-cdk/blob/366b4927c50168113dd4057f6255ab6c76278135/packages/aws-cdk-lib/aws-kinesis/lib/stream.ts#L355](https://github.com/aws//github.com/aws/aws-cdk/blob/366b4927c50168113dd4057f6255ab6c76278135/packages/aws-cdk-lib/aws-kinesis/lib/stream.ts/issues/L355) +* 'Need to perform AWS calls for account' when doing cross-account deployments ([#31846](https://github.com/aws/aws-cdk/issues/31846)) ([595a422](https://github.com/aws/aws-cdk/commit/595a422a614daecf386bde96f4cefeb4f7473815)), closes [#31845](https://github.com/aws/aws-cdk/issues/31845) + ## [2.163.1](https://github.com/aws/aws-cdk/compare/v2.163.0...v2.163.1) (2024-10-22) diff --git a/packages/aws-cdk-lib/cx-api/FEATURE_FLAGS.md b/packages/aws-cdk-lib/cx-api/FEATURE_FLAGS.md index 0e959c0a2a5ee..ff008f4ea1225 100644 --- a/packages/aws-cdk-lib/cx-api/FEATURE_FLAGS.md +++ b/packages/aws-cdk-lib/cx-api/FEATURE_FLAGS.md @@ -80,6 +80,7 @@ Flags come in three types: | [@aws-cdk/aws-rds:setCorrectValueForDatabaseInstanceReadReplicaInstanceResourceId](#aws-cdkaws-rdssetcorrectvaluefordatabaseinstancereadreplicainstanceresourceid) | When enabled, the value of property `instanceResourceId` in construct `DatabaseInstanceReadReplica` will be set to the correct value which is `DbiResourceId` instead of currently `DbInstanceArn` | 2.161.0 | (fix) | | [@aws-cdk/core:cfnIncludeRejectComplexResourceUpdateCreatePolicyIntrinsics](#aws-cdkcorecfnincluderejectcomplexresourceupdatecreatepolicyintrinsics) | When enabled, CFN templates added with `cfn-include` will error if the template contains Resource Update or Create policies with CFN Intrinsics that include non-primitive values. | 2.161.0 | (fix) | | [@aws-cdk/aws-stepfunctions-tasks:fixRunEcsTaskPolicy](#aws-cdkaws-stepfunctions-tasksfixrunecstaskpolicy) | When enabled, the resource of IAM Run Ecs policy generated by SFN EcsRunTask will reference the definition, instead of constructing ARN. | 2.163.0 | (fix) | +| [@aws-cdk/aws-dynamodb:resourcePolicyPerReplica](#aws-cdkaws-dynamodbresourcepolicyperreplica) | When enabled will allow you to specify a resource policy per replica, and not copy the source table policy to all replicas | 2.164.0 | (fix) | @@ -143,6 +144,7 @@ The following json shows the current recommended set of flags, as `cdk init` wou "@aws-cdk/custom-resources:logApiResponseDataPropertyTrueDefault": false, "@aws-cdk/aws-s3:keepNotificationInImportedBucket": false, "@aws-cdk/aws-ecs:reduceEc2FargateCloudWatchPermissions": true, + "@aws-cdk/aws-dynamodb:resourcePolicyPerReplica": true, "@aws-cdk/aws-ec2:ec2SumTImeoutEnabled": true, "@aws-cdk/aws-appsync:appSyncGraphQLAPIScopeLambdaPermission": true, "@aws-cdk/aws-rds:setCorrectValueForDatabaseInstanceReadReplicaInstanceResourceId": true, @@ -1509,4 +1511,22 @@ When this feature flag is enabled, if the task definition is created in the stac | 2.163.0 | `false` | `true` | +### @aws-cdk/aws-dynamodb:resourcePolicyPerReplica + +*When enabled will allow you to specify a resource policy per replica, and not copy the source table policy to all replicas* (fix) + +If this flag is not set, the default behavior for `TableV2` is to use a different `resourcePolicy` for each replica. + +If this flag is set to false, the behavior is that each replica shares the same `resourcePolicy` as the source table. +This will prevent you from creating a new table which has an additional replica and a resource policy. + +This is a feature flag as the old behavior was technically incorrect but users may have come to depend on it. + + +| Since | Default | Recommended | +| ----- | ----- | ----- | +| (not in v1) | | | +| 2.164.0 | `false` | `true` | + + diff --git a/packages/aws-cdk-lib/cx-api/lib/features.ts b/packages/aws-cdk-lib/cx-api/lib/features.ts index 182d14a5f738f..9bc3d0d5a8977 100644 --- a/packages/aws-cdk-lib/cx-api/lib/features.ts +++ b/packages/aws-cdk-lib/cx-api/lib/features.ts @@ -1161,7 +1161,7 @@ export const FLAGS: Record = { This will prevent you from creating a new table which has an additional replica and a resource policy. This is a feature flag as the old behavior was technically incorrect but users may have come to depend on it.`, - introducedIn: { v2: 'V2NEXT' }, + introducedIn: { v2: '2.164.0' }, recommendedValue: true, }, diff --git a/version.v2.json b/version.v2.json index a3c8b17a2f5e2..c70824e010f3c 100644 --- a/version.v2.json +++ b/version.v2.json @@ -1,4 +1,4 @@ { - "version": "2.163.1", - "alphaVersion": "2.163.1-alpha.0" + "version": "2.164.0", + "alphaVersion": "2.164.0-alpha.0" } \ No newline at end of file From 3a64371c74233845896a75b35866e49173335c16 Mon Sep 17 00:00:00 2001 From: Momo Kornher Date: Thu, 24 Oct 2024 14:08:38 +0100 Subject: [PATCH 28/33] chore: fix incorrect formatting of changelog entries --- CHANGELOG.v2.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/CHANGELOG.v2.md b/CHANGELOG.v2.md index b8a269e2c5602..7c9b0e7c01450 100644 --- a/CHANGELOG.v2.md +++ b/CHANGELOG.v2.md @@ -18,8 +18,7 @@ All notable changes to this project will be documented in this file. See [standa * **cli:** deploy-role is not authorized to perform DescribeStackResources ([#31878](https://github.com/aws/aws-cdk/issues/31878)) ([8d06824](https://github.com/aws/aws-cdk/commit/8d06824298d80b18c6b0143a9ac38b79ea5d6253)) * **core:** fix policy synthesizer logic for precreated roles ([#31710](https://github.com/aws/aws-cdk/issues/31710)) ([aae03c9](https://github.com/aws/aws-cdk/commit/aae03c9f899ec2a77b841207ef0b4eb3a7e0ae00)) * **dynamodb:** replication regions are incompatible with resource policies in TableV2 and feature flag ([#31513](https://github.com/aws/aws-cdk/issues/31513)) ([0b03eb0](https://github.com/aws/aws-cdk/commit/0b03eb0f62c132c1bd586a8ec31818398d07707f)), closes [#30705](https://github.com/aws/aws-cdk/issues/30705) -* **events-targets:** kinesis Stream target with Customer-Managed KMS key causes EventBridge FailedInvocations ([#31836](https://github.com/aws/aws-cdk/issues/31836)) ([58dfda0](https://github.com/aws/aws-cdk/commit/58dfda087a8aabde2683cd99df005d6e5e73a7ce)), closes [#10996](https://github.com/aws/aws-cdk/issues/10996) [/github.com/aws/aws-cdk/blob/366b4927c50168113dd4057f6255ab6c76278135/packages/aws-cdk-lib/aws-kinesis/lib/stream.ts#L355](https://github.com/aws//github.com/aws/aws-cdk/blob/366b4927c50168113dd4057f6255ab6c76278135/packages/aws-cdk-lib/aws-kinesis/lib/stream.ts/issues/L355) -* 'Need to perform AWS calls for account' when doing cross-account deployments ([#31846](https://github.com/aws/aws-cdk/issues/31846)) ([595a422](https://github.com/aws/aws-cdk/commit/595a422a614daecf386bde96f4cefeb4f7473815)), closes [#31845](https://github.com/aws/aws-cdk/issues/31845) +* **events-targets:** kinesis Stream target with Customer-Managed KMS key causes EventBridge FailedInvocations ([#31836](https://github.com/aws/aws-cdk/issues/31836)) ([58dfda0](https://github.com/aws/aws-cdk/commit/58dfda087a8aabde2683cd99df005d6e5e73a7ce)), closes [#10996](https://github.com/aws/aws-cdk/issues/10996) ## [2.163.1](https://github.com/aws/aws-cdk/compare/v2.163.0...v2.163.1) (2024-10-22) From 6136d9e79d8f47faf7258f381143b3b313e26490 Mon Sep 17 00:00:00 2001 From: Samson Keung Date: Thu, 24 Oct 2024 10:10:44 -0700 Subject: [PATCH 29/33] chore(scheduler-alpha): unit test schedule with Lambda version as target (#31872) ### Issue # (if applicable) None. ### Reason for this change Missing this test case. ### Description of changes Adding a unit test to verify `Schedule` works with Lambda Version and correct permissions are added. ### Description of how you validated changes Unit test. ### Checklist - [x] My code adheres to the [CONTRIBUTING GUIDE](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and [DESIGN GUIDELINES](https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md) ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license* --- .../test/lambda-invoke.test.ts | 57 +++++++++++++++++++ 1 file changed, 57 insertions(+) diff --git a/packages/@aws-cdk/aws-scheduler-targets-alpha/test/lambda-invoke.test.ts b/packages/@aws-cdk/aws-scheduler-targets-alpha/test/lambda-invoke.test.ts index 2fcb2a8d30629..1a61970f411d5 100644 --- a/packages/@aws-cdk/aws-scheduler-targets-alpha/test/lambda-invoke.test.ts +++ b/packages/@aws-cdk/aws-scheduler-targets-alpha/test/lambda-invoke.test.ts @@ -85,6 +85,63 @@ describe('schedule target', () => { }); }); + test('creates IAM role and IAM policy for lambda version', () => { + const lambdaVersion = new lambda.Version(stack, 'MyLambdaVersion', { + lambda: func, + }); + const lambdaTarget = new LambdaInvoke(lambdaVersion, {}); + + new Schedule(stack, 'MyScheduleDummy', { + schedule: expr, + target: lambdaTarget, + }); + + Template.fromStack(stack).resourceCountIs('AWS::Lambda::Permission', 0); + + Template.fromStack(stack).hasResource('AWS::Scheduler::Schedule', { + Properties: { + Target: { + Arn: { + Ref: 'MyLambdaVersion2EF97E33', + }, + RoleArn: { 'Fn::GetAtt': ['SchedulerRoleForTarget1441a743A31888', 'Arn'] }, + RetryPolicy: {}, + }, + }, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::IAM::Policy', { + PolicyDocument: { + Statement: [ + { + Action: 'lambda:InvokeFunction', + Effect: 'Allow', + Resource: { + Ref: 'MyLambdaVersion2EF97E33', + }, + }, + ], + }, + Roles: [{ Ref: 'SchedulerRoleForTarget1441a743A31888' }], + }); + + Template.fromStack(stack).hasResourceProperties('AWS::IAM::Role', { + AssumeRolePolicyDocument: { + Version: '2012-10-17', + Statement: [ + { + Effect: 'Allow', + Condition: { StringEquals: { 'aws:SourceAccount': '123456789012' } }, + Principal: { + Service: 'scheduler.amazonaws.com', + }, + Action: 'sts:AssumeRole', + }, + ], + }, + }); + }); + test('creates IAM policy for provided IAM role', () => { const targetExecutionRole = new Role(stack, 'ProvidedTargetRole', { assumedBy: new AccountRootPrincipal(), From 886283e25e9ad2b4af766048d613e5a1ebe9deac Mon Sep 17 00:00:00 2001 From: Samson Keung Date: Thu, 24 Oct 2024 10:44:27 -0700 Subject: [PATCH 30/33] chore(scheduler-alpha): unit test schedule with Lambda alias as target (#31873) ### Issue # (if applicable) None ### Reason for this change Missing this test case. ### Description of changes Adding a unit test to verify `Schedule` works with Lambda Alias and correct permissions are added. ### Description of how you validated changes Unit test. ### Checklist - [x] My code adheres to the [CONTRIBUTING GUIDE](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and [DESIGN GUIDELINES](https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md) ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license* --- .../test/lambda-invoke.test.ts | 62 +++++++++++++++++++ 1 file changed, 62 insertions(+) diff --git a/packages/@aws-cdk/aws-scheduler-targets-alpha/test/lambda-invoke.test.ts b/packages/@aws-cdk/aws-scheduler-targets-alpha/test/lambda-invoke.test.ts index 1a61970f411d5..24de4674aa16e 100644 --- a/packages/@aws-cdk/aws-scheduler-targets-alpha/test/lambda-invoke.test.ts +++ b/packages/@aws-cdk/aws-scheduler-targets-alpha/test/lambda-invoke.test.ts @@ -286,6 +286,68 @@ describe('schedule target', () => { }); }); + test('creates IAM role and IAM policy for lambda alias', () => { + const lambdaVersion = new lambda.Version(stack, 'MyLambdaVersion', { + lambda: func, + }); + const lambdaAlias = new lambda.Alias(stack, 'MyLambdaAlias', { + version: lambdaVersion, + aliasName: 'SomeAliasName', + }); + + const lambdaTarget = new LambdaInvoke(lambdaAlias, {}); + + new Schedule(stack, 'MyScheduleDummy', { + schedule: expr, + target: lambdaTarget, + }); + + Template.fromStack(stack).resourceCountIs('AWS::Lambda::Permission', 0); + + Template.fromStack(stack).hasResource('AWS::Scheduler::Schedule', { + Properties: { + Target: { + Arn: { + Ref: 'MyLambdaAliasD26C43B4', + }, + RoleArn: { 'Fn::GetAtt': ['SchedulerRoleForTarget1441a743A31888', 'Arn'] }, + RetryPolicy: {}, + }, + }, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::IAM::Policy', { + PolicyDocument: { + Statement: [ + { + Action: 'lambda:InvokeFunction', + Effect: 'Allow', + Resource: { + Ref: 'MyLambdaAliasD26C43B4', + }, + }, + ], + }, + Roles: [{ Ref: 'SchedulerRoleForTarget1441a743A31888' }], + }); + + Template.fromStack(stack).hasResourceProperties('AWS::IAM::Role', { + AssumeRolePolicyDocument: { + Version: '2012-10-17', + Statement: [ + { + Effect: 'Allow', + Condition: { StringEquals: { 'aws:SourceAccount': '123456789012' } }, + Principal: { + Service: 'scheduler.amazonaws.com', + }, + Action: 'sts:AssumeRole', + }, + ], + }, + }); + }); + test('creates IAM policy for imported role for lambda function in the same account', () => { const importedRole = Role.fromRoleArn(stack, 'ImportedRole', 'arn:aws:iam::123456789012:role/someRole'); From 4f29c1d04533b68535c1a5706855066d1d1ea577 Mon Sep 17 00:00:00 2001 From: Momo Kornher Date: Thu, 24 Oct 2024 19:44:15 +0100 Subject: [PATCH 31/33] fix: enable node-fips compatible body checksums for S3 (#31883) ### Issue # (if applicable) Internal reference: D166315367 ### Reason for this change In FIPS enabled environments, the MD5 algorithm is not available for use in crypto module. However by default the S3 client is using an MD5 checksum for content integrity checking. This causes any S3 upload operation to fail with a cryptography error. ### Description of changes We are disabling the S3 content checksums, and are re-enabling the regular SigV4 body signing. SigV4 uses SHA256 for their content checksum. This configuration matches the default behavior of the AWS SDKv3 and is a safe choice for all users. ### Description of how you validated changes For non-FIPS users, we have verified functionality via cli-integ-tests. For FIPS users, we have manually verified `cdk deploy` is now working in a FIPS enabled environment. We have also verified the configuration with the affected customer. ### Checklist - [x] My code adheres to the [CONTRIBUTING GUIDE](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and [DESIGN GUIDELINES](https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md) ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license* --- packages/@aws-cdk/integ-runner/package.json | 3 +- packages/aws-cdk-lib/cx-api/FEATURE_FLAGS.md | 20 +++++++++++ packages/aws-cdk/lib/api/aws-auth/sdk.ts | 13 ++++++- packages/aws-cdk/package.json | 2 +- yarn.lock | 38 +++++--------------- 5 files changed, 43 insertions(+), 33 deletions(-) diff --git a/packages/@aws-cdk/integ-runner/package.json b/packages/@aws-cdk/integ-runner/package.json index fef13773ed7aa..5ab742258adbd 100644 --- a/packages/@aws-cdk/integ-runner/package.json +++ b/packages/@aws-cdk/integ-runner/package.json @@ -74,9 +74,8 @@ "@aws-cdk/cloud-assembly-schema": "^38.0.0", "@aws-cdk/cloudformation-diff": "0.0.0", "@aws-cdk/cx-api": "0.0.0", - "cdk-assets": "^2.154.0", + "cdk-assets": "^2.155.17", "@aws-cdk/aws-service-spec": "^0.1.29", - "@aws-cdk/cdk-cli-wrapper": "0.0.0", "aws-cdk": "0.0.0", "chalk": "^4", diff --git a/packages/aws-cdk-lib/cx-api/FEATURE_FLAGS.md b/packages/aws-cdk-lib/cx-api/FEATURE_FLAGS.md index 0e959c0a2a5ee..34f5825b5ff4e 100644 --- a/packages/aws-cdk-lib/cx-api/FEATURE_FLAGS.md +++ b/packages/aws-cdk-lib/cx-api/FEATURE_FLAGS.md @@ -80,6 +80,7 @@ Flags come in three types: | [@aws-cdk/aws-rds:setCorrectValueForDatabaseInstanceReadReplicaInstanceResourceId](#aws-cdkaws-rdssetcorrectvaluefordatabaseinstancereadreplicainstanceresourceid) | When enabled, the value of property `instanceResourceId` in construct `DatabaseInstanceReadReplica` will be set to the correct value which is `DbiResourceId` instead of currently `DbInstanceArn` | 2.161.0 | (fix) | | [@aws-cdk/core:cfnIncludeRejectComplexResourceUpdateCreatePolicyIntrinsics](#aws-cdkcorecfnincluderejectcomplexresourceupdatecreatepolicyintrinsics) | When enabled, CFN templates added with `cfn-include` will error if the template contains Resource Update or Create policies with CFN Intrinsics that include non-primitive values. | 2.161.0 | (fix) | | [@aws-cdk/aws-stepfunctions-tasks:fixRunEcsTaskPolicy](#aws-cdkaws-stepfunctions-tasksfixrunecstaskpolicy) | When enabled, the resource of IAM Run Ecs policy generated by SFN EcsRunTask will reference the definition, instead of constructing ARN. | 2.163.0 | (fix) | +| [@aws-cdk/aws-dynamodb:resourcePolicyPerReplica](#aws-cdkaws-dynamodbresourcepolicyperreplica) | When enabled will allow you to specify a resource policy per replica, and not copy the source table policy to all replicas | V2NEXT | (fix) | @@ -143,6 +144,7 @@ The following json shows the current recommended set of flags, as `cdk init` wou "@aws-cdk/custom-resources:logApiResponseDataPropertyTrueDefault": false, "@aws-cdk/aws-s3:keepNotificationInImportedBucket": false, "@aws-cdk/aws-ecs:reduceEc2FargateCloudWatchPermissions": true, + "@aws-cdk/aws-dynamodb:resourcePolicyPerReplica": true, "@aws-cdk/aws-ec2:ec2SumTImeoutEnabled": true, "@aws-cdk/aws-appsync:appSyncGraphQLAPIScopeLambdaPermission": true, "@aws-cdk/aws-rds:setCorrectValueForDatabaseInstanceReadReplicaInstanceResourceId": true, @@ -1509,4 +1511,22 @@ When this feature flag is enabled, if the task definition is created in the stac | 2.163.0 | `false` | `true` | +### @aws-cdk/aws-dynamodb:resourcePolicyPerReplica + +*When enabled will allow you to specify a resource policy per replica, and not copy the source table policy to all replicas* (fix) + +If this flag is not set, the default behavior for `TableV2` is to use a different `resourcePolicy` for each replica. + +If this flag is set to false, the behavior is that each replica shares the same `resourcePolicy` as the source table. +This will prevent you from creating a new table which has an additional replica and a resource policy. + +This is a feature flag as the old behavior was technically incorrect but users may have come to depend on it. + + +| Since | Default | Recommended | +| ----- | ----- | ----- | +| (not in v1) | | | +| V2NEXT | `false` | `true` | + + diff --git a/packages/aws-cdk/lib/api/aws-auth/sdk.ts b/packages/aws-cdk/lib/api/aws-auth/sdk.ts index 6a78965620c01..fab6d1d3ce4b0 100644 --- a/packages/aws-cdk/lib/api/aws-auth/sdk.ts +++ b/packages/aws-cdk/lib/api/aws-auth/sdk.ts @@ -174,7 +174,18 @@ export class SDK implements ISDK { } public s3(): AWS.S3 { - return this.wrapServiceErrorHandling(new AWS.S3(this.config)); + return this.wrapServiceErrorHandling(new AWS.S3({ + // In FIPS enabled environments, the MD5 algorithm is not available for use in crypto module. + // However by default the S3 client is using an MD5 checksum for content integrity checking. + // While this usage is technically allowed in FIPS (MD5 is only prohibited for cryptographic use), + // in practice it is just easier to use an allowed checksum mechanism. + // We are disabling the S3 content checksums, and are re-enabling the regular SigV4 body signing. + // SigV4 uses SHA256 for their content checksum. This configuration matches the default behavior + // of the AWS SDKv3 and is a safe choice for all users. + s3DisableBodySigning: false, + computeChecksums: false, + ...this.config, + })); } public route53(): AWS.Route53 { diff --git a/packages/aws-cdk/package.json b/packages/aws-cdk/package.json index 506da385ff312..202ac715eb2bb 100644 --- a/packages/aws-cdk/package.json +++ b/packages/aws-cdk/package.json @@ -104,7 +104,7 @@ "archiver": "^5.3.2", "aws-sdk": "^2.1691.0", "camelcase": "^6.3.0", - "cdk-assets": "^2.155.0", + "cdk-assets": "^2.155.17", "cdk-from-cfn": "^0.162.0", "chalk": "^4", "chokidar": "^3.6.0", diff --git a/yarn.lock b/yarn.lock index a14ce1ed93150..f5c2805c1038d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -67,17 +67,10 @@ jsonschema "^1.4.1" semver "^7.6.3" -"@aws-cdk/cx-api@^2.158.0": - version "2.159.0" - resolved "https://registry.npmjs.org/@aws-cdk/cx-api/-/cx-api-2.159.0.tgz#567c0ae0d7a6fc2f7cb9bda7e6cb23fac8d99094" - integrity sha512-HVkHCKQjVi3PCSOF22zLztZMEL+cJcyVvFctS3vXPetgl77L+e/onaGt1AUwRcNY44tvbqJm3oIVQt2HqM3q7w== - dependencies: - semver "^7.6.3" - -"@aws-cdk/cx-api@^2.160.0": - version "2.160.0" - resolved "https://registry.npmjs.org/@aws-cdk/cx-api/-/cx-api-2.160.0.tgz#08d4599690a39768bb944c411f1141166e313b59" - integrity sha512-ujXT/UoUDquCwxJ14jkRzIFeMabMyLATWP32Jv0WJjWpxrGJCa+Lua+CByOyikC1QeSVxq8pZcrx0jjYyG0qzw== +"@aws-cdk/cx-api@^2.163.1": + version "2.163.1" + resolved "https://registry.npmjs.org/@aws-cdk/cx-api/-/cx-api-2.163.1.tgz#ef55da9f471c963d877b23d3201ca4560d656b2e" + integrity sha512-0bVL/pX0UcliCdXVcgtLVL3W5EHAp4RgW7JN3prz1dIOmLZzZ30DW0qWSc0D0EVE3rVG6RVgfIiuFBFK6WFZ+w== dependencies: semver "^7.6.3" @@ -6794,26 +6787,13 @@ case@1.6.3, case@^1.6.3: resolved "https://registry.npmjs.org/case/-/case-1.6.3.tgz#0a4386e3e9825351ca2e6216c60467ff5f1ea1c9" integrity sha512-mzDSXIPaFwVDvZAHqZ9VlbyF4yyXRuX6IvB06WvPYkqJVO24kX1PPhv9bfpKNFZyxYFmmgo03HUiD8iklmJYRQ== -cdk-assets@^2.154.0: - version "2.154.0" - resolved "https://registry.npmjs.org/cdk-assets/-/cdk-assets-2.154.0.tgz#675d239c0156ca05c4a2809b30858c843f984ead" - integrity sha512-8M3zLHCx8nj5Fv5ubEps53jh22NN9G7ZLuq1AJwPdXZP7+nb4q5tdl2Ah2ZPMM/dob9u3KTwNeN34oLKHfDzbw== - dependencies: - "@aws-cdk/cloud-assembly-schema" "^38.0.0" - "@aws-cdk/cx-api" "^2.158.0" - archiver "^5.3.2" - aws-sdk "^2.1691.0" - glob "^7.2.3" - mime "^2.6.0" - yargs "^16.2.0" - -cdk-assets@^2.155.0: - version "2.155.0" - resolved "https://registry.npmjs.org/cdk-assets/-/cdk-assets-2.155.0.tgz#2e4f347f850c8850bcb2834807b457f41e62f1cf" - integrity sha512-wEztkIxJnQrIh93x6Qxu4MbRLROhl7NeWgasNZdCoOd6ykXsDSuL8JMi0wettbwGArnhhXMcll1m4+X4VQgzcA== +cdk-assets@^2.155.17: + version "2.155.17" + resolved "https://registry.npmjs.org/cdk-assets/-/cdk-assets-2.155.17.tgz#d6c285d0279aec8226b45577a151e6dd32a12fa5" + integrity sha512-+hJlYYlsPHhPCeMC/V3pMyrjz5K8p9SQdC50qMg6a8/w/3w0WY1ZixyKGtpJfFB11C3Ubb04l2miieaAH00CIA== dependencies: "@aws-cdk/cloud-assembly-schema" "^38.0.1" - "@aws-cdk/cx-api" "^2.160.0" + "@aws-cdk/cx-api" "^2.163.1" archiver "^5.3.2" aws-sdk "^2.1691.0" glob "^7.2.3" From 732f4587e74da9dbcb5f80ff188d0cb3c65105ea Mon Sep 17 00:00:00 2001 From: Samson Keung Date: Thu, 24 Oct 2024 12:28:15 -0700 Subject: [PATCH 32/33] chore(scheduler-alpha): make LambdaInvoke prop optional (#31887) ### Issue # (if applicable) None. ### Reason for this change Improve ergonomics of the `LambdaInvoke` constructor signature. The second argument is not required so we should not force customers to pass in an empty object. ### Description of changes Make the `LambdaInvoke` `prop` argument default to empty object. ### Description of how you validated changes Unit test updated to omit the `prop` argument if no props are being passed. ### Checklist - [x] My code adheres to the [CONTRIBUTING GUIDE](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and [DESIGN GUIDELINES](https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md) ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license* --- .../aws-scheduler-targets-alpha/lib/lambda-invoke.ts | 2 +- .../test/lambda-invoke.test.ts | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/@aws-cdk/aws-scheduler-targets-alpha/lib/lambda-invoke.ts b/packages/@aws-cdk/aws-scheduler-targets-alpha/lib/lambda-invoke.ts index bbd986780b6bd..3de6a3dd7f0a2 100644 --- a/packages/@aws-cdk/aws-scheduler-targets-alpha/lib/lambda-invoke.ts +++ b/packages/@aws-cdk/aws-scheduler-targets-alpha/lib/lambda-invoke.ts @@ -11,7 +11,7 @@ export class LambdaInvoke extends ScheduleTargetBase implements IScheduleTarget constructor( func: lambda.IFunction, - props: ScheduleTargetBaseProps, + props: ScheduleTargetBaseProps = {}, ) { super(props, func.functionArn); this.func = func; diff --git a/packages/@aws-cdk/aws-scheduler-targets-alpha/test/lambda-invoke.test.ts b/packages/@aws-cdk/aws-scheduler-targets-alpha/test/lambda-invoke.test.ts index 24de4674aa16e..c0586ccedf106 100644 --- a/packages/@aws-cdk/aws-scheduler-targets-alpha/test/lambda-invoke.test.ts +++ b/packages/@aws-cdk/aws-scheduler-targets-alpha/test/lambda-invoke.test.ts @@ -24,7 +24,7 @@ describe('schedule target', () => { }); test('creates IAM role and IAM policy for lambda target in the same account', () => { - const lambdaTarget = new LambdaInvoke(func, {}); + const lambdaTarget = new LambdaInvoke(func); new Schedule(stack, 'MyScheduleDummy', { schedule: expr, @@ -89,7 +89,7 @@ describe('schedule target', () => { const lambdaVersion = new lambda.Version(stack, 'MyLambdaVersion', { lambda: func, }); - const lambdaTarget = new LambdaInvoke(lambdaVersion, {}); + const lambdaTarget = new LambdaInvoke(lambdaVersion); new Schedule(stack, 'MyScheduleDummy', { schedule: expr, @@ -250,7 +250,7 @@ describe('schedule target', () => { test('creates IAM policy for imported lambda function in the same account', () => { const importedFunc = lambda.Function.fromFunctionArn(stack, 'ImportedFunction', 'arn:aws:lambda:us-east-1:123456789012:function/somefunc'); - const lambdaTarget = new LambdaInvoke(importedFunc, {}); + const lambdaTarget = new LambdaInvoke(importedFunc); new Schedule(stack, 'MyScheduleDummy', { schedule: expr, @@ -295,7 +295,7 @@ describe('schedule target', () => { aliasName: 'SomeAliasName', }); - const lambdaTarget = new LambdaInvoke(lambdaAlias, {}); + const lambdaTarget = new LambdaInvoke(lambdaAlias); new Schedule(stack, 'MyScheduleDummy', { schedule: expr, @@ -449,7 +449,7 @@ describe('schedule target', () => { }, ); - const lambdaTarget = new LambdaInvoke(importedFunc, {}); + const lambdaTarget = new LambdaInvoke(importedFunc); new Schedule(stack, 'MyScheduleDummy', { schedule: expr, target: lambdaTarget, From d7ad66d58e6a6bdc6a3a36dadc9db510c6cc56aa Mon Sep 17 00:00:00 2001 From: Kaizen Conroy <36202692+kaizencc@users.noreply.github.com> Date: Thu, 24 Oct 2024 16:51:43 -0400 Subject: [PATCH 33/33] chore(mergify): clean up core aliases (#31891) Clean up our core aliases to reflect who is working on aws-cdk. ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license* --- .github/workflows/github-merit-badger.yml | 2 +- .mergify.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/github-merit-badger.yml b/.github/workflows/github-merit-badger.yml index 65492d037bc91..1261b45103e44 100644 --- a/.github/workflows/github-merit-badger.yml +++ b/.github/workflows/github-merit-badger.yml @@ -17,4 +17,4 @@ jobs: badges: '[beginning-contributor,repeat-contributor,valued-contributor,admired-contributor,star-contributor,distinguished-contributor]' thresholds: '[0,3,6,13,25,50]' badge-type: 'achievement' - ignore-usernames: '[rix0rrr,iliapolo,otaviomacedo,kaizencc,comcalvi,TheRealAmazonKendra,vinayak-kukreja,mrgrain,pahud,cgarvis,kellertk,ashishdhingra,HBobertz,sumupitchayan,SankyRed,udaypant,colifran,khushail,scanlonp,mikewrighton,moelasmar,paulhcsun,awsmjs,evgenyka,GavinZZ,aaythapa,xazhao,ConnorRobertson,ssenchenko,gracelu0,jfuss,SimonCMoore,shikha372,kirtishrinkhala,godwingrs22,bergjaak,IanKonlog,Leo10Gama,samson-keung,scorbiere,michelle-wangg,jiayiwang7,1kaileychen,aws-cdk-automation,dependabot[bot],mergify[bot]]' + ignore-usernames: '[rix0rrr,iliapolo,otaviomacedo,kaizencc,comcalvi,TheRealAmazonKendra,mrgrain,pahud,kellertk,ashishdhingra,HBobertz,sumupitchayan,colifran,khushail,moelasmar,paulhcsun,GavinZZ,aaythapa,xazhao,gracelu0,jfuss,shikha372,kirtishrinkhala,godwingrs22,bergjaak,IanKonlog,Leo10Gama,samson-keung,scorbiere,michelle-wangg,jiayiwang7,1kaileychen,aws-cdk-automation,dependabot[bot],mergify[bot]]' diff --git a/.mergify.yml b/.mergify.yml index fb466ebacfdea..24f5698c49f27 100644 --- a/.mergify.yml +++ b/.mergify.yml @@ -24,7 +24,7 @@ pull_request_rules: label: add: [ contribution/core ] conditions: - - author~=^(rix0rrr|iliapolo|otaviomacedo|kaizencc|comcalvi|TheRealAmazonKendra|vinayak-kukreja|mrgrain|pahud|ashishdhingra|cgarvis|kellertk|HBobertz|sumupitchayan|SankyRed|udaypant|colifran|scanlonp|mikewrighton|moelasmar|paulhcsun|awsmjs|evgenyka|GavinZZ|aaythapa|xazhao|ConnorRobertson|ssenchenko|gracelu0|jfuss|SimonCMoore|shikha372|kirtishrinkhala|godwingrs22|bergjaak|samson-keung|IanKonlog|Leo10Gama|scorbiere|michelle-wangg|jiayiwang7|1kaileychen)$ + - author~=^(rix0rrr|iliapolo|otaviomacedo|kaizencc|comcalvi|TheRealAmazonKendra|mrgrain|pahud|ashishdhingra|kellertk|HBobertz|sumupitchayan|colifran|moelasmar|paulhcsun|GavinZZ|aaythapa|xazhao|gracelu0|jfuss|shikha372|kirtishrinkhala|godwingrs22|bergjaak|samson-keung|IanKonlog|Leo10Gama|scorbiere|michelle-wangg|jiayiwang7|1kaileychen)$ - -label~="contribution/core" - name: automatic merge actions: