Skip to content
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 obsolete custom service package code #3684

Merged
merged 7 commits into from
Mar 6, 2025
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Merge branch 'v4-development' into normj/remove-obsolete-custom-servi…
…ce-code
  • Loading branch information
normj committed Mar 6, 2025
commit 414002ba89e6a40bd2e3cdd16cdd3bb61558e0a9
11 changes: 11 additions & 0 deletions generator/.DevConfigs/3C7AB270-F926-4FBE-ABA6-B849BF35C377.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"services": [
{
"serviceName": "DynamoDBv2",
"type": "patch",
"changeLogMessages": [
"Add Support for DateOnly and TimeOnly in DynamoDB high level libraries. This support is available in .NET 8 and above."
]
}
]
}
21 changes: 21 additions & 0 deletions generator/.DevConfigs/48136445-7021-4BDB-96AB-3F0C7B00368E.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"services": [
{
"serviceName": "S3",
"type": "patch",
"changeLogMessages": [
"Remove obsolete DisableMD5Stream property. Code should be updated to use DisableDefaultChecksumValidation property.",
"Remove obsolete ServerSideEncryptionMethod and ServerSideEncryptionKeyManagementServiceKeyId from CopyPart. This should be set in the InitiateMultipartUpload method.",
"Remove obsolete Expires property from GetObjectResponse. Code should be updated to use ExpiresString. Since the string may not be in a valid timestamp format code shoud use TryParse when converting to DateTime.",
"Remove obsolete region identifiers from S3Region enumeration",
"Remove obsolete Prefix property from LifecycleConfiguration. Code should be updated to use Filter property.",
"Remove obsolete Transition and NoncurrentVersionTransition from LifecycleRule. Could should be updated to use the collection versions Transitions and NoncurrentVersionTransitions.",
"Remove obsolete Event property from TopicConfiguration. Code should be updated to use the collection property Events.",
"Remove obsolete CalculateContentMD5Header property. This property no longer needed to be set because the SDK will compute a checksum by default.",
"Remove obsolete Bucket property from SelectObjectContentRequest. Code should be updated to use BucketName.",
"Remove obsolete NumberOfUploadThreads property from TransferUtilityConfig. Code should be updated to use ConcurrentServiceRequests.",
"Remove obsolete DoesS3BucketExist method. Code should be updated to use DoesS3BucketExistV2"
]
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"core": {
"changeLogMessages": [
"Update SDK signers to handle scenarios where anonymous credentials are provided."
],
"type": "patch",
"updateMinimum": true
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"core": {
"changeLogMessages": [
"Remove the obsolete ReadWriteTimeout property from ClientConfig all targets except .NET Framework 4.7.2."
],
"type": "patch",
"updateMinimum": true
}
}
11 changes: 11 additions & 0 deletions generator/.DevConfigs/a769f591-c10f-45e6-94ec-f49295484df3.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"services": [
{
"serviceName": "EC2",
"type": "patch",
"changeLogMessages": [
"[Breaking Change] Remove obsolete IPRanges behavior from EC2. IPV4Ranges or IPV6Ranges should be used instead."
]
}
]
}
8 changes: 4 additions & 4 deletions sdk/src/Core/Amazon.Runtime/ClientConfig.cs
Original file line number Diff line number Diff line change
@@ -82,7 +82,6 @@ public abstract partial class ClientConfig : IClientConfig
private bool? useFIPSEndpoint;
private bool? disableRequestCompression;
private long? requestMinCompressionSizeBytes;
private TimeSpan? readWriteTimeout = null;
private bool disableHostPrefixInjection = false;
private bool? endpointDiscoveryEnabled = null;
private bool? ignoreConfiguredEndpointUrls;
@@ -1133,6 +1132,9 @@ public int HttpClientCacheSize
}
#endif

#if NETFRAMEWORK
private TimeSpan? readWriteTimeout = null;

/// <summary>
/// Overrides the default read-write timeout value.
/// </summary>
@@ -1145,9 +1147,6 @@ public int HttpClientCacheSize
/// <exception cref="System.ArgumentOutOfRangeException">The timeout specified is less than or equal to zero and is not Infinite.</exception>
/// </remarks>
/// <seealso cref="P:System.Net.HttpWebRequest.ReadWriteTimeout"/>
#if NETSTANDARD
[Obsolete("ReadWriteTimeout is not consumed in asynchronous HTTP requests. Please use a cancellation token to handle stream read/write timeouts.")]
#endif
public TimeSpan? ReadWriteTimeout
{
get { return this.readWriteTimeout; }
@@ -1157,6 +1156,7 @@ public TimeSpan? ReadWriteTimeout
this.readWriteTimeout = value;
}
}
#endif

/// <summary>
/// Gets and sets of the EndpointProvider property.
7 changes: 5 additions & 2 deletions sdk/src/Core/Amazon.Runtime/Internal/Auth/AWS4Signer.cs
Original file line number Diff line number Diff line change
@@ -118,13 +118,16 @@ public override void Sign(IRequest request,
RequestMetrics metrics,
BaseIdentity identity)
{
var credentials = identity as AWSCredentials;
if (credentials is null)
if (identity is not AWSCredentials credentials)
{
throw new AmazonClientException($"The identity parameter must be of type AWSCredentials for the signer {nameof(AWS4Signer)}.");
}

var immutableCredentials = credentials.GetCredentials();
if (immutableCredentials is null)
{
return;
}

var signingResult = SignRequest(request, clientConfig, metrics, immutableCredentials.AccessKey, immutableCredentials.SecretKey);
request.Headers[HeaderKeys.AuthorizationHeader] = signingResult.ForAuthorizationHeader;
Original file line number Diff line number Diff line change
@@ -127,6 +127,11 @@ public override void Sign(IRequest request, IClientConfig clientConfig, RequestM
{
var credentials = identity as AWSCredentials;
var immutableCredentials = credentials.GetCredentials();
if (immutableCredentials is null)
{
return;
}

_awsSigV4AProvider.Sign(request, clientConfig, metrics, immutableCredentials);
}

Original file line number Diff line number Diff line change
@@ -38,13 +38,17 @@ public override void Sign(IRequest request, IClientConfig clientConfig, RequestM
var aws4Signer = signer as AWS4Signer;
var useV4a = aws4aSigner != null;
var useV4 = aws4Signer != null;
var credentials = identity as AWSCredentials;
if (credentials is null)

if (identity is not AWSCredentials credentials)
{
throw new AmazonClientException($"The identity parameter must be of type AWSCredentials for the signer {nameof(AWSEndpointAuthSchemeSigner)}.");
}

var immutableCredentials = credentials.GetCredentials();
if (immutableCredentials is null)
{
return;
}

AWSSigningResultBase signingResult;

Original file line number Diff line number Diff line change
@@ -42,7 +42,7 @@ public override void Sign(IRequest request, IClientConfig clientConfig, RequestM
}

var immutableCredentials = credentials.GetCredentials();
if (String.IsNullOrEmpty(immutableCredentials.AccessKey))
if (string.IsNullOrEmpty(immutableCredentials?.AccessKey))
{
throw new ArgumentOutOfRangeException("awsAccessKeyId", "The AWS Access Key ID cannot be NULL or a Zero length string");
}
Original file line number Diff line number Diff line change
@@ -50,7 +50,7 @@ public override void Sign(IRequest request, IClientConfig clientConfig, RequestM
var credentials = identity as AWSCredentials;
var immutableCredentials = credentials.GetCredentials();

if (String.IsNullOrEmpty(immutableCredentials.AccessKey))
if (string.IsNullOrEmpty(immutableCredentials?.AccessKey))
{
throw new ArgumentOutOfRangeException("awsAccessKeyId", "The AWS Access Key ID cannot be NULL or a Zero length string");
}
8 changes: 6 additions & 2 deletions sdk/src/Core/Amazon.Runtime/Internal/Auth/S3Signer.cs
Original file line number Diff line number Diff line change
@@ -58,13 +58,17 @@ public override void Sign(IRequest request, IClientConfig clientConfig, RequestM
var aws4aSigner = signer as AWS4aSignerCRTWrapper;
var useV4 = aws4Signer != null;
var useV4a = aws4aSigner != null;
var credentials = identity as AWSCredentials;
if (credentials is null)

if (identity is not AWSCredentials credentials)
{
throw new AmazonClientException($"The identity parameter must be of type AWSCredentials for the signer {nameof(S3Signer)}.");
}

var immutableCredentials = credentials.GetCredentials();
if (immutableCredentials is null)
{
return;
}

if (useV4a)
{
Original file line number Diff line number Diff line change
@@ -69,7 +69,10 @@ public override async System.Threading.Tasks.Task<T> InvokeAsync<T>(IExecutionCo
{
var requestContext = executionContext.RequestContext;
var regionalEndpoint = requestContext.Request.Endpoint;
PreInvoke(executionContext);

var immutableCredentials = (requestContext.Identity as AWSCredentials)?.GetCredentialsAsync();

PreInvoke(executionContext, immutableCredentials);

try
{
@@ -107,7 +110,7 @@ public static void EvictCacheKeyForRequest(IRequestContext requestContext, Uri r
requestContext.Request.Endpoint = regionalEndpoint;
}

public static void DiscoverEndpoints(IRequestContext requestContext, bool evictCacheKey)
public static void DiscoverEndpoints(IRequestContext requestContext, bool evictCacheKey, ImmutableCredentials credentials)
{
var discoveryEndpoints = ProcessEndpointDiscovery(requestContext, evictCacheKey, requestContext.Request.Endpoint);
if (discoveryEndpoints != null)
@@ -130,10 +133,9 @@ public static void DiscoverEndpoints(IRequestContext requestContext, bool evictC
}
}

private static IEnumerable<DiscoveryEndpointBase> ProcessEndpointDiscovery(IRequestContext requestContext, bool evictCacheKey, Uri evictUri)
private static IEnumerable<DiscoveryEndpointBase> ProcessEndpointDiscovery(IRequestContext requestContext, bool evictCacheKey, Uri evictUri, ImmutableCredentials immutableCredentials)
{
var options = requestContext.Options;
var immutableCredentials = (requestContext.Identity as AWSCredentials)?.GetCredentials();

if (options.EndpointDiscoveryMarshaller != null && options.EndpointOperation != null && immutableCredentials != null)
{
Original file line number Diff line number Diff line change
@@ -89,12 +89,5 @@ public partial interface ICoreAmazonS3
/// </summary>
/// <param name="bucketName"></param>
void EnsureBucketExists(string bucketName);

/// <summary>
/// Check to see if the bucket exists.
/// </summary>
/// <param name="bucketName"></param>
/// <returns></returns>
bool DoesS3BucketExist(string bucketName);
}
}
Original file line number Diff line number Diff line change
@@ -322,7 +322,7 @@ public bool TryConvertFromEntry([DynamicallyAccessedMembers(DynamicallyAccessedM
return converter.TryFromEntry(entry, outputType, out value);
}

#endregion
#endregion

#region Internal members

@@ -378,7 +378,7 @@ internal PrimitiveList ItemsToPrimitiveList(IEnumerable items)
return pl;
}

#endregion
#endregion

#region Private members

@@ -413,6 +413,10 @@ private void SetV1Converters()
AddConverter(new BoolConverterV1());
AddConverter(new PrimitiveCollectionConverterV1());
AddConverter(new DictionaryConverterV1());
#if NET8_0_OR_GREATER
AddConverter(new DateOnlyConverterV1());
AddConverter(new TimeOnlyConverterV1());
#endif
}

private void SetV2Converters()
@@ -438,6 +442,10 @@ private void SetV2Converters()
AddConverter(new EnumConverterV2());
AddConverter(new BoolConverterV2());
AddConverter(new CollectionConverterV2());
#if NET8_0_OR_GREATER
AddConverter(new DateOnlyConverterV2());
AddConverter(new TimeOnlyConverterV2());
#endif
}

// Converts items to Primitives.
52 changes: 49 additions & 3 deletions sdk/src/Services/DynamoDBv2/Custom/Conversion/SchemaV1.cs
Original file line number Diff line number Diff line change
@@ -36,7 +36,7 @@ internal class ByteConverterV1 : Converter<byte>
{
public override IEnumerable<Type> GetTargetTypes()
{
return new[] { typeof(byte), typeof(Nullable<byte>) };
return new[] { typeof(byte), typeof(Nullable<byte>) };
}

protected override bool TryTo(byte value, out Primitive p)
@@ -444,7 +444,53 @@ private static Enum ConvertEnum(string s, Type targetType)
}
}

#endregion
#if NET8_0_OR_GREATER
internal class DateOnlyConverterV1 : Converter<DateOnly>
{
private const string DateOnlyFormat = "yyyy-MM-dd";

public override IEnumerable<Type> GetTargetTypes()
{
return new[] { typeof(DateOnly), typeof(DateOnly?) };
}

protected override bool TryTo(DateOnly value, out Primitive p)
{
p = new Primitive(value.ToString(DateOnlyFormat, CultureInfo.InvariantCulture), DynamoDBEntryType.String);
return true;
}

protected override bool TryFrom(Primitive p, [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicMethods | DynamicallyAccessedMemberTypes.PublicConstructors)] Type targetType, out DateOnly result)
{
return DateOnly.TryParseExact(p.StringValue, DateOnlyFormat, CultureInfo.InvariantCulture, DateTimeStyles.None, out result)
|| DateOnly.TryParse(p.StringValue, CultureInfo.InvariantCulture, out result);
}
}

internal class TimeOnlyConverterV1 : Converter<TimeOnly>
{
private const string TimeOnlyFormat = "HH:mm:ss.fff";

public override IEnumerable<Type> GetTargetTypes()
{
return new[] { typeof(TimeOnly), typeof(TimeOnly?) };
}

protected override bool TryTo(TimeOnly value, out Primitive p)
{
p = new Primitive(value.ToString(TimeOnlyFormat, CultureInfo.InvariantCulture), DynamoDBEntryType.String);
return true;
}

protected override bool TryFrom(Primitive p, [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicMethods | DynamicallyAccessedMemberTypes.PublicConstructors)] Type targetType, out TimeOnly result)
{
return TimeOnly.TryParseExact(p.StringValue, TimeOnlyFormat, CultureInfo.InvariantCulture, DateTimeStyles.None, out result)
|| TimeOnly.TryParse(p.StringValue, CultureInfo.InvariantCulture, out result);
}
}
#endif

#endregion

#region Converters supporting reading V2 DDB items, but writing V1 items

@@ -569,5 +615,5 @@ public override bool TryTo(object value, out Document d)
}
}

#endregion
#endregion
}
8 changes: 8 additions & 0 deletions sdk/src/Services/DynamoDBv2/Custom/Conversion/SchemaV2.cs
Original file line number Diff line number Diff line change
@@ -86,6 +86,14 @@ internal class DictionaryConverterV2 : DictionaryConverterV1
internal class EnumConverterV2 : EnumConverterV1
{ }

#if NET8_0_OR_GREATER
internal class DateOnlyConverterV2 : DateOnlyConverterV1
{ }

internal class TimeOnlyConverterV2 : TimeOnlyConverterV1
{ }
#endif

#endregion

/// <summary>
Loading
Oops, something went wrong.
You are viewing a condensed version of this merge commit. You can view the full changes here.