-
Notifications
You must be signed in to change notification settings - Fork 863
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove Legacy Enums #3235
Merged
Merged
Remove Legacy Enums #3235
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
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
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
23 changes: 6 additions & 17 deletions
23
generator/ServiceModels/dynamodbstreams/dynamodbstreams.customizations.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 |
---|---|---|
@@ -1,18 +1,7 @@ | ||
{ | ||
"runtimePipelineOverride":{ | ||
"overrides":[ | ||
{ | ||
"condition":"this.Config.RetryMode == RequestRetryMode.Legacy", | ||
"operation":"replace", | ||
"newType":"Amazon.Runtime.Internal.RetryHandler", | ||
"targetType":"Amazon.Runtime.Internal.RetryHandler", | ||
"constructorInput":"new Amazon.DynamoDBv2.Internal.DynamoDBRetryPolicy(this.Config)" | ||
} | ||
] | ||
}, | ||
"shapeSubstitutions": { | ||
"Stream": { | ||
"renameShape": "StreamSummary" | ||
} | ||
} | ||
{ | ||
"shapeSubstitutions": { | ||
"Stream": { | ||
"renameShape": "StreamSummary" | ||
} | ||
} | ||
} |
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
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 |
---|---|---|
|
@@ -89,7 +89,6 @@ public abstract partial class ClientConfig : IClientConfig | |
private RequestRetryMode? retryMode = null; | ||
private int? maxRetries = null; | ||
private const int MaxRetriesDefault = 2; | ||
private const int MaxRetriesLegacyDefault = 4; | ||
private const long DefaultMinCompressionSizeBytes = 10240; | ||
private bool didProcessServiceURL = false; | ||
private IAWSTokenProvider _awsTokenProvider = new DefaultAWSTokenProviderChain(); | ||
|
@@ -462,8 +461,7 @@ public string ServiceId | |
} | ||
/// <summary> | ||
/// Returns the flag indicating how many retry HTTP requests an SDK should | ||
/// make for a single SDK operation invocation before giving up. This flag will | ||
/// return 4 when the RetryMode is set to "Legacy" which is the default. For | ||
/// make for a single SDK operation invocation before giving up. For | ||
/// RetryMode values of "Standard" or "Adaptive" this flag will return 2. In | ||
/// addition to the values returned that are dependent on the RetryMode, the | ||
/// value can be set to a specific value by using the AWS_MAX_ATTEMPTS environment | ||
|
@@ -480,13 +478,6 @@ public int MaxErrorRetry | |
{ | ||
if (!this.maxRetries.HasValue) | ||
{ | ||
//For legacy mode there was no MaxAttempts shared config or | ||
//environment variables so use the legacy default value. | ||
if (RetryMode == RequestRetryMode.Legacy) | ||
{ | ||
return MaxRetriesLegacyDefault; | ||
} | ||
|
||
//For standard and adaptive modes first check the environment variables | ||
//and shared config for a value. Otherwise default to the new default value. | ||
//In the shared config or environment variable MaxAttempts is the total number | ||
|
@@ -720,33 +711,6 @@ protected ClientConfig(IDefaultConfigurationProvider defaultConfigurationProvide | |
Initialize(); | ||
} | ||
|
||
public ClientConfig() : this(new LegacyOnlyDefaultConfigurationProvider()) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This constructor was not used by the service clients; I did have to modify one test to pass in a mocked provider. |
||
{ | ||
this.defaultConfigurationBackingField = _defaultConfigurationProvider.GetDefaultConfiguration(null, null); | ||
this.defaultConfigurationMode = this.defaultConfigurationBackingField.Name; | ||
} | ||
|
||
/// <summary> | ||
/// Specialized <see cref="IDefaultConfigurationProvider"/> that is only meant to provide backwards | ||
/// compatibility for the obsolete <see cref="ClientConfig"/> constructor. | ||
/// </summary> | ||
private class LegacyOnlyDefaultConfigurationProvider : IDefaultConfigurationProvider | ||
{ | ||
public IDefaultConfiguration GetDefaultConfiguration(RegionEndpoint clientRegion, DefaultConfigurationMode? requestedConfigurationMode = null) | ||
{ | ||
if (requestedConfigurationMode.HasValue && | ||
requestedConfigurationMode.Value != Runtime.DefaultConfigurationMode.Legacy) | ||
throw new AmazonClientException($"This ClientConfig only supports {Runtime.DefaultConfigurationMode.Legacy}"); | ||
|
||
return new DefaultConfiguration | ||
{ | ||
Name = Runtime.DefaultConfigurationMode.Legacy, | ||
RetryMode = RequestRetryMode.Legacy, | ||
S3UsEast1RegionalEndpoint = S3UsEast1RegionalEndpointValue.Legacy, | ||
StsRegionalEndpoints = StsRegionalEndpointsValue.Legacy | ||
}; | ||
} | ||
} | ||
#endregion | ||
|
||
protected virtual void Initialize() | ||
|
@@ -801,10 +765,6 @@ public TimeSpan? Timeout | |
/// </summary> | ||
internal CancellationToken BuildDefaultCancellationToken() | ||
{ | ||
// legacy mode never had a working cancellation token, so keep it to default() | ||
if (DefaultConfiguration.Name == Runtime.DefaultConfigurationMode.Legacy) | ||
return default(CancellationToken); | ||
|
||
// TimeToFirstByteTimeout is not a perfect match with HttpWebRequest/HttpClient.Timeout. However, given | ||
// that both are configured to only use Timeout until the Response Headers are downloaded, this value | ||
// provides a reasonable default value. | ||
|
@@ -816,7 +776,6 @@ internal CancellationToken BuildDefaultCancellationToken() | |
} | ||
#endif | ||
|
||
|
||
/// <summary> | ||
/// Configures the endpoint calculation for a service to go to a dual stack (ipv6 enabled) endpoint | ||
/// for the configured region. | ||
|
@@ -1080,7 +1039,7 @@ public int EndpointDiscoveryCacheLimit | |
/// <summary> | ||
/// Returns the flag indicating the current mode in use for request | ||
/// retries and influences the value returned from <see cref="MaxErrorRetry"/>. | ||
/// The default value is RequestRetryMode.Legacy. This flag can be configured | ||
/// The default value is <see cref="RequestRetryMode.Standard"/>. This flag can be configured | ||
/// by using the AWS_RETRY_MODE environment variable, retry_mode in the | ||
/// shared configuration file, or by setting this value directly. | ||
/// </summary> | ||
|
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
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if we should add this part, maybe we will need to add a new mode named
Legacy
in the future for any reason.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that's unlikely,
Legacy
is already one of the modes (https://docs.aws.amazon.com/sdkref/latest/guide/feature-smart-config-defaults.html), if a new one is added in the future we'd have to pick a new name.Either way, it'd require us to update
generator/ServiceClientGeneratorLib/DefaultConfiguration/DefaultConfigurationModel.cs
as well.