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 S3 code that was obsolete in V3 for V4. #3686

Merged
merged 2 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
Next Next commit
Remove S3 code that was obsolete in V3 for V4.
The GetACL and PutACL obsoletes were left since they were only obsolete in V4.
  • Loading branch information
normj committed Mar 4, 2025
commit e215f6d4e22adaf48318ae6e13603c70b8cf57a3
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
@@ -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);
}
}
24 changes: 0 additions & 24 deletions sdk/src/Services/S3/Custom/AWSConfigs.S3.cs
Original file line number Diff line number Diff line change
@@ -38,29 +38,6 @@ namespace Amazon
/// </summary>
public static class AWSConfigsS3
{
/// <summary>
/// <para><b>WARNING: Setting DisableMD5Stream to true disables the MD5 data integrity check
/// on upload requests.This property has been deprecated in favor of <see cref="DisableDefaultChecksumValidation"/>
/// Setting the value of DisableMD5Stream will set DisableDefaultChecksumValidation to the same value
/// and vice versa. This property was left here for backwards compatibility.</b></para>
/// <para>
/// When true, MD5Stream will not be used in upload requests. This may increase upload
/// performance under high CPU loads. The default value is false. Set this value to true to
/// disable MD5Stream use in all S3 upload requests or override this value per request by
/// setting the DisableMD5Stream property on PutObjectRequest, UploadPartRequest, or
/// TransferUtilityUploadRequest.</para>
/// <para>MD5Stream, SigV4 payload signing, and HTTPS each provide some data integrity
/// verification. If DisableMD5Stream is true and DisablePayloadSigning is true, then the
/// possibility of data corruption is completely dependant on HTTPS being the only remaining
/// source of data integrity verification.</para>
/// </summary>
[Obsolete("This property is deprecated in favor of DisableDefaultChecksumValidation.")]
public static bool DisableMD5Stream
{
get { return DisableDefaultChecksumValidation; }
set { DisableDefaultChecksumValidation = value; }
}

/// <summary>
/// <para><b>WARNING: Setting DisableDefaultChecksumValidation to true disables the default data
/// integrity check on upload requests.</b></para>
@@ -74,7 +51,6 @@ public static bool DisableMD5Stream
/// verification. If DisableDefaultChecksumValidation is true and DisablePayloadSigning is true, then the
/// possibility of data corruption is completely dependent on HTTPS being the only remaining
/// source of data integrity verification.</para>
/// <para>This flag is a rename of the <see cref="DisableMD5Stream"/> property</para>
/// </summary>
public static bool DisableDefaultChecksumValidation { get; set; }

5 changes: 1 addition & 4 deletions sdk/src/Services/S3/Custom/IAmazonS3.Extensions.cs
Original file line number Diff line number Diff line change
@@ -13,9 +13,7 @@
* permissions and limitations under the License.
*/
using System;
#if AWS_ASYNC_API
using System.Threading.Tasks;
#endif
using Amazon.S3;
using Amazon.S3.Model;

@@ -49,7 +47,7 @@ public partial interface IAmazonS3 : IDisposable, Amazon.Runtime.SharedInterface
string GetPreSignedURL(GetPreSignedUrlRequest request);

#endregion
#if AWS_ASYNC_API

#region GetPresignedURLAsync

/// <summary>
@@ -76,6 +74,5 @@ public partial interface IAmazonS3 : IDisposable, Amazon.Runtime.SharedInterface
Task<string> GetPreSignedURLAsync(GetPreSignedUrlRequest request);

#endregion
#endif
}
}
42 changes: 2 additions & 40 deletions sdk/src/Services/S3/Custom/Internal/AmazonS3PostMarshallHandler.cs
Original file line number Diff line number Diff line change
@@ -130,26 +130,7 @@ private static void SetStreamChecksum(UploadPartRequest uploadPartRequest, IRequ
request.Headers.Add(HeaderKeys.ContentLengthHeader, partialStream.Length.ToString(CultureInfo.InvariantCulture));

request.DisablePayloadSigning = uploadPartRequest.DisablePayloadSigning;

#pragma warning disable CS0618 // Type or member is obsolete
if (!uploadPartRequest.IsSetMD5Digest() && uploadPartRequest.CalculateContentMD5Header && !request.IsDirectoryBucket())
#pragma warning restore CS0618 // Type or member is obsolete
{
// Calculate Content-MD5 if not already set and customer opted in
string md5 = AmazonS3Util.GenerateMD5ChecksumForStream(partialStream);
if (!string.IsNullOrEmpty(md5))
{
request.Headers[HeaderKeys.ContentMD5Header] = md5;
}

// Wrap input stream in MD5Stream; after this we can no longer seek or position the stream
var hashStream = new MD5Stream(partialStream, null, partialStream.Length);
uploadPartRequest.InputStream = hashStream;
}
else
{
uploadPartRequest.InputStream = partialStream;
}
uploadPartRequest.InputStream = partialStream;
}

var defaultChecksumValidationDisabled = uploadPartRequest.DisableDefaultChecksumValidation ?? AWSConfigsS3.DisableDefaultChecksumValidation;
@@ -184,26 +165,7 @@ private static void SetStreamChecksum(PutObjectRequest putObjectRequest, IReques
request.Headers.Add(HeaderKeys.ContentLengthHeader, length.ToString(CultureInfo.InvariantCulture));

request.DisablePayloadSigning = putObjectRequest.DisablePayloadSigning;

#pragma warning disable CS0618 // Type or member is obsolete
if (!putObjectRequest.IsSetMD5Digest() && putObjectRequest.CalculateContentMD5Header && !request.IsDirectoryBucket())
#pragma warning restore CS0618 // Type or member is obsolete
{
// Calculate Content-MD5 if not already set and customer opted in
string md5 = AmazonS3Util.GenerateMD5ChecksumForStream(putObjectRequest.InputStream);
if (!string.IsNullOrEmpty(md5))
{
request.Headers[HeaderKeys.ContentMD5Header] = md5;
}

// Wrap input stream in MD5Stream
var hashStream = new MD5Stream(streamWithLength, null, length);
putObjectRequest.InputStream = hashStream;
}
else
{
putObjectRequest.InputStream = streamWithLength;
}
putObjectRequest.InputStream = streamWithLength;
}

var defaultChecksumValidationDisabled = putObjectRequest.DisableDefaultChecksumValidation ?? AWSConfigsS3.DisableDefaultChecksumValidation;
50 changes: 0 additions & 50 deletions sdk/src/Services/S3/Custom/Model/CopyPartRequest.cs
Original file line number Diff line number Diff line change
@@ -234,13 +234,9 @@ public partial class CopyPartRequest : AmazonWebServiceRequest
private string expectedSourceBucketOwner;
private RequestPayer requestPayer;

[Obsolete("Use ServerSideEncryptionMethod in InitiateMultipartUploadRequest instead.")]
private ServerSideEncryptionMethod serverSideEncryption;
private ServerSideEncryptionCustomerMethod serverSideCustomerEncryption;
private string serverSideEncryptionCustomerProvidedKey;
private string serverSideEncryptionCustomerProvidedKeyMD5;
[Obsolete("Use ServerSideEncryptionKeyManagementServiceKeyId in InitiateMultipartUploadRequest instead.")]
private string serverSideEncryptionKeyManagementServiceKeyId;

private ServerSideEncryptionCustomerMethod copySourceServerSideCustomerEncryption;
private string copySourceServerSideEncryptionCustomerProvidedKey;
@@ -599,31 +595,6 @@ internal bool IsSetLastByte()
return this.lastByte.HasValue;
}

/// <summary>
/// <para>
/// This property is obsolete. Use ServerSideEncryptionMethod in InitiateMultipartUploadRequest instead.
/// </para>
/// <para>
/// Default: None
/// </para>
/// </summary>
[Obsolete("Use ServerSideEncryptionMethod in InitiateMultipartUploadRequest instead.")]
public ServerSideEncryptionMethod ServerSideEncryptionMethod
{
get { return this.serverSideEncryption; }
set { this.serverSideEncryption = value; }
}

/// <summary>
/// Checks if ServerSideEncryptionMethod property is set.
/// </summary>
/// <returns>true if ServerSideEncryptionMethod property is set.</returns>
[Obsolete("Use ServerSideEncryptionMethod in InitiateMultipartUploadRequest instead.")]
internal bool IsSetServerSideEncryptionMethod()
{
return this.serverSideEncryption != null && this.serverSideEncryption != ServerSideEncryptionMethod.None;
}

/// <summary>
/// The Server-side encryption algorithm to be used with the customer provided key.
///
@@ -690,27 +661,6 @@ internal bool IsSetServerSideEncryptionCustomerProvidedKeyMD5()
return !System.String.IsNullOrEmpty(this.serverSideEncryptionCustomerProvidedKeyMD5);
}

/// <summary>
/// This property is obsolete. Use ServerSideEncryptionKeyManagementServiceKeyId in InitiateMultipartUploadRequest instead.
/// </summary>
[Obsolete("Use ServerSideEncryptionKeyManagementServiceKeyId in InitiateMultipartUploadRequest instead.")]
[AWSProperty(Sensitive=true)]
public string ServerSideEncryptionKeyManagementServiceKeyId
{
get { return this.serverSideEncryptionKeyManagementServiceKeyId; }
set { this.serverSideEncryptionKeyManagementServiceKeyId = value; }
}

/// <summary>
/// Checks if ServerSideEncryptionKeyManagementServiceKeyId property is set.
/// </summary>
/// <returns>true if ServerSideEncryptionKeyManagementServiceKeyId property is set.</returns>
[Obsolete("Use ServerSideEncryptionKeyManagementServiceKeyId in InitiateMultipartUploadRequest instead.")]
internal bool IsSetServerSideEncryptionKeyManagementServiceKeyId()
{
return !System.String.IsNullOrEmpty(this.serverSideEncryptionKeyManagementServiceKeyId);
}

/// <summary>
/// The Server-side encryption algorithm to be used with the customer provided key.
///
43 changes: 0 additions & 43 deletions sdk/src/Services/S3/Custom/Model/GetObjectResponse.cs
Original file line number Diff line number Diff line change
@@ -43,7 +43,6 @@ public partial class GetObjectResponse : StreamResponse
private string eTag;
private int? missingMeta;
private string versionId;
private DateTime? expires;
private ObjectLockLegalHoldStatus objectLockLegalHoldStatus;
private ObjectLockMode objectLockMode;
private DateTime? objectLockRetainUntilDate;
@@ -69,12 +68,6 @@ public partial class GetObjectResponse : StreamResponse
private string _checksumSHA256;
private ChecksumType _checksumType;

/// <summary>
/// Flag which returns true if the Expires property has been unmarshalled
/// from the raw value or set by user code.
/// </summary>
private bool isExpiresUnmarshalled;

/// <summary>
/// The date and time at which the object is no longer cacheable.
/// </summary>
@@ -309,42 +302,6 @@ internal bool IsSetVersionId()
return this.versionId != null;
}

/// <summary>
/// The date and time at which the object is no longer cacheable.
///
/// </summary>
[Obsolete("This property is deprecated for handling cases where Expires cannot be parsed as a DateTime. Instead, use ExpiresString, which returns the unparsed value from S3.")]
public DateTime? Expires
{
get
{
if (this.isExpiresUnmarshalled)
{
return this.expires;
}
else
{
if (!string.IsNullOrEmpty(this.ExpiresString))
{
this.expires = AmazonS3Util.ParseExpiresHeader(this.ExpiresString, this.ResponseMetadata.RequestId);
}
else
{
this.expires = null;
}
this.isExpiresUnmarshalled = true;
return this.expires.GetValueOrDefault();
}
}
set { this.expires = value; this.isExpiresUnmarshalled = true; }
}

// Check to see if Expires property is set
internal bool IsSetExpires()
{
return this.expires.HasValue;
}

/// <summary>
/// Gets and sets the property ObjectLockLegalHoldStatus.
/// <para>
Original file line number Diff line number Diff line change
@@ -47,22 +47,21 @@ public IRequest Marshall(DeleteBucketRequest deleteBucketRequest)

if (deleteBucketRequest.BucketRegion != null)
{
// Disable error preventing using explicit RegionEndpoints in the SDK since the code is mapping S3Regions to RegionEndpoints with a fallback default.
#pragma warning disable CR1004,CS0612,CS0618
RegionEndpoint regionEndpoint;
if(deleteBucketRequest.BucketRegion == S3Region.US)
#pragma warning disable CR1004
if (deleteBucketRequest.BucketRegion == S3Region.USEast1)
{
regionEndpoint = RegionEndpoint.USEast1;
}
else if (deleteBucketRequest.BucketRegion == S3Region.EU)
else if (deleteBucketRequest.BucketRegion == S3Region.EUWest1)
{
regionEndpoint = RegionEndpoint.EUWest1;
}
else
{
regionEndpoint = RegionEndpoint.GetBySystemName(deleteBucketRequest.BucketRegion.Value);
}
#pragma warning restore CR1004,CS0612,CS0618
#pragma warning restore CR1004
request.AlternateEndpoint = regionEndpoint;
}

Original file line number Diff line number Diff line change
@@ -85,10 +85,6 @@ public IRequest Marshall(PutBucketReplicationRequest putBucketreplicationRequest
{
xmlWriter.WriteElementString("Priority", S3Transforms.ToXmlStringValue(rule.Priority));
}
if (rule.IsSetPrefix())
{
xmlWriter.WriteElementString("Prefix", S3Transforms.ToXmlStringValue(rule.Prefix));
}

if (rule.IsSetFilter())
{
Original file line number Diff line number Diff line change
@@ -174,17 +174,6 @@ public IRequest Marshall(PutLifecycleConfigurationRequest putLifecycleConfigurat
xmlWriter.WriteElementString("ID", S3Transforms.ToXmlStringValue(lifecycleConfigurationLifecycleConfigurationrulesListValue.Id));
}

if (lifecycleConfigurationLifecycleConfigurationrulesListValue.IsSetPrefix() &&
lifecycleConfigurationLifecycleConfigurationrulesListValue.IsSetFilter())
{
throw new AmazonClientException("LifecycleRule.Prefix is deprecated. Please only use LifecycleRule.Filter.");
}

if (lifecycleConfigurationLifecycleConfigurationrulesListValue.IsSetPrefix())
{
xmlWriter.WriteElementString("Prefix", S3Transforms.ToXmlStringValue(lifecycleConfigurationLifecycleConfigurationrulesListValue.Prefix));
}

if (lifecycleConfigurationLifecycleConfigurationrulesListValue.IsSetFilter())
{
xmlWriter.WriteStartElement("Filter");
Original file line number Diff line number Diff line change
@@ -55,12 +55,6 @@ public ReplicationRule Unmarshall(XmlUnmarshallerContext context)

continue;
}
if (context.TestExpression("Prefix", targetDepth))
{
rule.Prefix = StringUnmarshaller.GetInstance().Unmarshall(context);

continue;
}
if (context.TestExpression("Filter", targetDepth))
{
rule.Filter = ReplicationRuleFilterUnmarshaller.Instance.Unmarshall(context);
Original file line number Diff line number Diff line change
@@ -57,11 +57,6 @@ public LifecycleRule Unmarshall(XmlUnmarshallerContext context)

continue;
}
if (context.TestExpression("Prefix", targetDepth))
{
rulesItem.Prefix = StringUnmarshaller.GetInstance().Unmarshall(context);
continue;
}
if (context.TestExpression("Filter", targetDepth))
{
var predicateList = LifecycleFilterPredicateListUnmarshaller.Instance.Unmarshall(context);
Loading
Oops, something went wrong.