forked from smithy-lang/smithy-typescript
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
dab49f8
commit 1b34092
Showing
6 changed files
with
51 additions
and
4 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
"@smithy/smithy-client": minor | ||
"@smithy/types": minor | ||
--- | ||
|
||
Add retry to runtime extension |
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,27 @@ | ||
import { Provider, RetryStrategy, RetryStrategyConfiguration, RetryStrategyV2 } from "@smithy/types"; | ||
|
||
/** | ||
* @internal | ||
*/ | ||
export const getRetryConfiguration = ( | ||
runtimeConfig: Partial<{ retryStrategy: Provider<RetryStrategyV2 | RetryStrategy> }> | ||
) => { | ||
return { | ||
_retryStrategy: runtimeConfig.retryStrategy!, | ||
setRetryStrategy(retryStrategy: Provider<RetryStrategyV2 | RetryStrategy>): void { | ||
this._retryStrategy = retryStrategy; | ||
}, | ||
retryStrategy(): Provider<RetryStrategyV2 | RetryStrategy> { | ||
return this._retryStrategy; | ||
}, | ||
}; | ||
}; | ||
|
||
/** | ||
* @internal | ||
*/ | ||
export const resolveRetryRuntimeConfig = (retryStrategyConfiguration: RetryStrategyConfiguration) => { | ||
const runtimeConfig: Partial<Record<string, Provider<RetryStrategyV2 | RetryStrategy>>> = {}; | ||
runtimeConfig.retryStrategy = retryStrategyConfiguration.retryStrategy(); | ||
return runtimeConfig; | ||
}; |
5 changes: 2 additions & 3 deletions
5
packages/types/src/extensions/defaultExtensionConfiguration.ts
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 |
---|---|---|
@@ -1,10 +1,9 @@ | ||
import { ChecksumConfiguration } from "./checksum"; | ||
import { RetryStrategyConfiguration } from "./retry"; | ||
|
||
/** | ||
* @internal | ||
* | ||
* Default extension configuration consisting various configurations for modifying a service client | ||
*/ | ||
export interface DefaultExtensionConfiguration extends ChecksumConfiguration {} | ||
|
||
type GetDefaultConfigurationType = (runtimeConfig: any) => DefaultExtensionConfiguration; | ||
export interface DefaultExtensionConfiguration extends ChecksumConfiguration, RetryStrategyConfiguration {} |
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 |
---|---|---|
@@ -1,3 +1,4 @@ | ||
export * from "./defaultClientConfiguration"; | ||
export * from "./defaultExtensionConfiguration"; | ||
export { AlgorithmId, ChecksumAlgorithm, ChecksumConfiguration } from "./checksum"; | ||
export { RetryStrategyConfiguration } from "./retry"; |
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,10 @@ | ||
import { RetryStrategyV2 } from "../retry"; | ||
import { Provider, RetryStrategy } from "../util"; | ||
|
||
/** | ||
* @internal | ||
*/ | ||
export interface RetryStrategyConfiguration { | ||
setRetryStrategy(retryStrategy: Provider<RetryStrategyV2 | RetryStrategy>): void; | ||
retryStrategy(): Provider<RetryStrategyV2 | RetryStrategy>; | ||
} |