-
Notifications
You must be signed in to change notification settings - Fork 4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into TheRealAmazonKendra/bedrock
- Loading branch information
Showing
409 changed files
with
120,581 additions
and
81,431 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/** | ||
* @param maxAttempts the maximum number of attempts | ||
* @param interval interval in milliseconds to observe between attempts | ||
*/ | ||
export type EventuallyOptions = { | ||
maxAttempts?: number; | ||
interval?: number; | ||
}; | ||
|
||
const wait = (ms: number): Promise<void> => new Promise((resolve) => setTimeout(resolve, ms)); | ||
const DEFAULT_INTERVAL = 1000; | ||
const DEFAULT_MAX_ATTEMPTS = 10; | ||
|
||
/** | ||
* Runs a function on an interval until the maximum number of attempts has | ||
* been reached. | ||
* | ||
* Default interval = 1000 milliseconds | ||
* Default maxAttempts = 10 | ||
* | ||
* @param fn function to run | ||
* @param options EventuallyOptions | ||
*/ | ||
const eventually = async <T>(call: () => Promise<T>, options?: EventuallyOptions): Promise<T> => { | ||
const opts = { | ||
interval: options?.interval ? options.interval : DEFAULT_INTERVAL, | ||
maxAttempts: options?.maxAttempts ? options.maxAttempts : DEFAULT_MAX_ATTEMPTS, | ||
}; | ||
|
||
while (opts.maxAttempts-- >= 0) { | ||
try { | ||
return await call(); | ||
} catch (err) { | ||
if (opts.maxAttempts <= 0) throw err; | ||
} | ||
await wait(opts.interval); | ||
} | ||
|
||
throw new Error('An unexpected error has occurred.'); | ||
}; | ||
|
||
export default eventually; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
...config-env.js.snapshot/appconfigmulticonfigenvDefaultTestDeployAssert1621E45D.assets.json
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
36 changes: 36 additions & 0 deletions
36
...nfig-env.js.snapshot/appconfigmulticonfigenvDefaultTestDeployAssert1621E45D.template.json
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
19 changes: 19 additions & 0 deletions
19
...config/test/integ.multi-config-env.js.snapshot/aws-appconfig-multi-config-env.assets.json
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
156 changes: 156 additions & 0 deletions
156
...nfig/test/integ.multi-config-env.js.snapshot/aws-appconfig-multi-config-env.template.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,156 @@ | ||
{ | ||
"Resources": { | ||
"MyApplicationForEnv1F597ED9": { | ||
"Type": "AWS::AppConfig::Application", | ||
"Properties": { | ||
"Name": "awsappconfigmulticonfigenv-MyApplicationForEnv-1EE3EA95" | ||
} | ||
}, | ||
"MultiConfigEnvironment5F41B747": { | ||
"Type": "AWS::AppConfig::Environment", | ||
"Properties": { | ||
"ApplicationId": { | ||
"Ref": "MyApplicationForEnv1F597ED9" | ||
}, | ||
"Name": "awsappconfigmulticonfigenv-MultiConfigEnvironment-59525230" | ||
} | ||
}, | ||
"QuickDeploymentStrategy980252EC": { | ||
"Type": "AWS::AppConfig::DeploymentStrategy", | ||
"Properties": { | ||
"DeploymentDurationInMinutes": 1, | ||
"GrowthFactor": 50, | ||
"GrowthType": "LINEAR", | ||
"Name": "awsappconfigmulticonfigenv-QuickDeploymentStrategy-CAB72574", | ||
"ReplicateTo": "NONE" | ||
} | ||
}, | ||
"MyFirstConfigConfigurationProfileAB11F87A": { | ||
"Type": "AWS::AppConfig::ConfigurationProfile", | ||
"Properties": { | ||
"ApplicationId": { | ||
"Ref": "MyApplicationForEnv1F597ED9" | ||
}, | ||
"LocationUri": "hosted", | ||
"Name": "awsappconfigmulticonfigenv-MyFirstConfig-2FF7CAAB" | ||
} | ||
}, | ||
"MyFirstConfig117AFBAC": { | ||
"Type": "AWS::AppConfig::HostedConfigurationVersion", | ||
"Properties": { | ||
"ApplicationId": { | ||
"Ref": "MyApplicationForEnv1F597ED9" | ||
}, | ||
"ConfigurationProfileId": { | ||
"Ref": "MyFirstConfigConfigurationProfileAB11F87A" | ||
}, | ||
"Content": "first config content", | ||
"ContentType": "application/octet-stream" | ||
}, | ||
"UpdateReplacePolicy": "Retain", | ||
"DeletionPolicy": "Retain" | ||
}, | ||
"MyFirstConfigDeployment5AEBAD52B8EE4": { | ||
"Type": "AWS::AppConfig::Deployment", | ||
"Properties": { | ||
"ApplicationId": { | ||
"Ref": "MyApplicationForEnv1F597ED9" | ||
}, | ||
"ConfigurationProfileId": { | ||
"Ref": "MyFirstConfigConfigurationProfileAB11F87A" | ||
}, | ||
"ConfigurationVersion": { | ||
"Ref": "MyFirstConfig117AFBAC" | ||
}, | ||
"DeploymentStrategyId": { | ||
"Ref": "QuickDeploymentStrategy980252EC" | ||
}, | ||
"EnvironmentId": { | ||
"Ref": "MultiConfigEnvironment5F41B747" | ||
} | ||
} | ||
}, | ||
"MySecondConfigConfigurationProfileD0CC1BAA": { | ||
"Type": "AWS::AppConfig::ConfigurationProfile", | ||
"Properties": { | ||
"ApplicationId": { | ||
"Ref": "MyApplicationForEnv1F597ED9" | ||
}, | ||
"LocationUri": "hosted", | ||
"Name": "awsappconfigmulticonfigenv-MySecondConfig-4F837809" | ||
} | ||
}, | ||
"MySecondConfig28DEBAC4": { | ||
"Type": "AWS::AppConfig::HostedConfigurationVersion", | ||
"Properties": { | ||
"ApplicationId": { | ||
"Ref": "MyApplicationForEnv1F597ED9" | ||
}, | ||
"ConfigurationProfileId": { | ||
"Ref": "MySecondConfigConfigurationProfileD0CC1BAA" | ||
}, | ||
"Content": "second config content", | ||
"ContentType": "application/octet-stream" | ||
}, | ||
"UpdateReplacePolicy": "Retain", | ||
"DeletionPolicy": "Retain" | ||
}, | ||
"MySecondConfigDeployment5AEBAD1470BE4": { | ||
"Type": "AWS::AppConfig::Deployment", | ||
"Properties": { | ||
"ApplicationId": { | ||
"Ref": "MyApplicationForEnv1F597ED9" | ||
}, | ||
"ConfigurationProfileId": { | ||
"Ref": "MySecondConfigConfigurationProfileD0CC1BAA" | ||
}, | ||
"ConfigurationVersion": { | ||
"Ref": "MySecondConfig28DEBAC4" | ||
}, | ||
"DeploymentStrategyId": { | ||
"Ref": "QuickDeploymentStrategy980252EC" | ||
}, | ||
"EnvironmentId": { | ||
"Ref": "MultiConfigEnvironment5F41B747" | ||
} | ||
}, | ||
"DependsOn": [ | ||
"MyFirstConfigDeployment5AEBAD52B8EE4" | ||
] | ||
} | ||
}, | ||
"Parameters": { | ||
"BootstrapVersion": { | ||
"Type": "AWS::SSM::Parameter::Value<String>", | ||
"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." | ||
} | ||
] | ||
} | ||
} | ||
} |
1 change: 1 addition & 0 deletions
1
...esting/framework-integ/test/aws-appconfig/test/integ.multi-config-env.js.snapshot/cdk.out
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
12 changes: 12 additions & 0 deletions
12
...ing/framework-integ/test/aws-appconfig/test/integ.multi-config-env.js.snapshot/integ.json
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.