diff --git a/generator/.DevConfigs/7f23582e-3225-487b-83e7-167cf17cb238.json b/generator/.DevConfigs/7f23582e-3225-487b-83e7-167cf17cb238.json new file mode 100644 index 000000000000..04d1122899c8 --- /dev/null +++ b/generator/.DevConfigs/7f23582e-3225-487b-83e7-167cf17cb238.json @@ -0,0 +1,11 @@ +{ + "services": [ + { + "serviceName": "S3", + "type": "patch", + "changeLogMessages": [ + "Update Response mapping logic for PutObjectResponse and CompleteMultipartResponse" + ] + } + ] +} diff --git a/sdk/src/Services/S3/Custom/Transfer/Internal/ResponseMapper.cs b/sdk/src/Services/S3/Custom/Transfer/Internal/ResponseMapper.cs index 1e337635db81..302ffd5e2fce 100644 --- a/sdk/src/Services/S3/Custom/Transfer/Internal/ResponseMapper.cs +++ b/sdk/src/Services/S3/Custom/Transfer/Internal/ResponseMapper.cs @@ -61,6 +61,7 @@ internal static TransferUtilityUploadResponse MapPutObjectResponse(PutObjectResp response.ServerSideEncryptionKeyManagementServiceKeyId = source.ServerSideEncryptionKeyManagementServiceKeyId; response.ServerSideEncryptionMethod = source.ServerSideEncryptionMethod; response.VersionId = source.VersionId; + response.Size = source.Size; // Copy response metadata response.ResponseMetadata = source.ResponseMetadata; @@ -97,6 +98,9 @@ internal static TransferUtilityUploadResponse MapCompleteMultipartUploadResponse response.ServerSideEncryptionMethod = source.ServerSideEncryptionMethod; response.ServerSideEncryptionKeyManagementServiceKeyId = source.ServerSideEncryptionKeyManagementServiceKeyId; response.VersionId = source.VersionId; + response.BucketName = source.BucketName; + response.Key = source.Key; + response.Location = source.Location; // Copy response metadata response.ResponseMetadata = source.ResponseMetadata; diff --git a/sdk/src/Services/S3/Custom/Transfer/TransferUtilityUploadResponse.cs b/sdk/src/Services/S3/Custom/Transfer/TransferUtilityUploadResponse.cs index 3fcc20294a0a..fc3218f0411e 100644 --- a/sdk/src/Services/S3/Custom/Transfer/TransferUtilityUploadResponse.cs +++ b/sdk/src/Services/S3/Custom/Transfer/TransferUtilityUploadResponse.cs @@ -35,6 +35,7 @@ namespace Amazon.S3.Transfer public class TransferUtilityUploadResponse : AmazonWebServiceResponse { private bool? _bucketKeyEnabled; + private string _bucketName; private string _checksumCRC32; private string _checksumCRC32C; private string _checksumCRC64NVME; @@ -43,8 +44,11 @@ public class TransferUtilityUploadResponse : AmazonWebServiceResponse private ChecksumType _checksumType; private string _etag; private Expiration _expiration; + private string _key; + private string _location; private RequestCharged _requestCharged; private ServerSideEncryptionCustomerMethod _serverSideEncryptionCustomerMethod; + private long? _size; private string _sseCustomerKeyMD5; private string _sseKmsEncryptionContext; private string _sseKmsKeyId; @@ -73,6 +77,110 @@ internal bool IsSetBucketKeyEnabled() return this._bucketKeyEnabled.HasValue; } + /// + /// Gets and sets the property BucketName. + /// + /// The name of the bucket that contains the newly created object. Does not return the + /// access point ARN or access point alias if used. + /// + /// + /// + /// When using this action with an access point, you must direct requests to the access + /// point hostname. The access point hostname takes the form AccessPointName-AccountId.s3-accesspoint.Region.amazonaws.com. + /// When using this action with an access point through the Amazon Web Services SDKs, + /// you provide the access point ARN in place of the bucket name. For more information + /// about access point ARNs, see Using + /// access points in the Amazon S3 User Guide. + /// + /// + /// + /// When you use this action with Amazon S3 on Outposts, you must direct requests to the + /// S3 on Outposts hostname. The S3 on Outposts hostname takes the form AccessPointName-AccountId.outpostID.s3-outposts.Region.amazonaws.com. + /// When you use this action with S3 on Outposts through the Amazon Web Services SDKs, + /// you provide the Outposts access point ARN in place of the bucket name. For more information + /// about S3 on Outposts ARNs, see What + /// is S3 on Outposts? in the Amazon S3 User Guide. + /// + /// + public string BucketName + { + get { return this._bucketName; } + set { this._bucketName = value; } + } + + /// + /// Checks if BucketName property is set. + /// + /// true if BucketName property is set. + internal bool IsSetBucketName() + { + return !string.IsNullOrEmpty(this._bucketName); + } + + /// + /// Gets and sets the property Key. + /// + /// The object key of the newly created object. + /// + /// + public string Key + { + get { return this._key; } + set { this._key = value; } + } + + /// + /// Checks if Key property is set. + /// + /// true if Key property is set. + internal bool IsSetKey() + { + return !string.IsNullOrEmpty(this._key); + } + + /// + /// Gets and sets the property Location. + /// + /// The URI that identifies the newly created object. + /// + /// + public string Location + { + get { return this._location; } + set { this._location = value; } + } + + /// + /// Checks if Location property is set. + /// + /// true if Location property is set. + internal bool IsSetLocation() + { + return !string.IsNullOrEmpty(this._location); + } + + /// + /// Gets and sets the property Size. + /// + /// The size of the object in bytes. This will only be present if you append to an object. + /// + /// This functionality is only supported for objects in the S3 Express One Zone storage class in directory buckets. + /// + public long? Size + { + get { return this._size; } + set { this._size = value; } + } + + /// + /// Checks if Size property is set. + /// + /// true if Size property is set. + internal bool IsSetSize() + { + return this._size.HasValue; + } + /// /// Gets and sets the property ChecksumCRC32. /// diff --git a/sdk/test/Services/S3/UnitTests/Custom/EmbeddedResource/mapping.json b/sdk/test/Services/S3/UnitTests/Custom/EmbeddedResource/mapping.json index 224a0a35dfdb..6e34b8b1c2de 100644 --- a/sdk/test/Services/S3/UnitTests/Custom/EmbeddedResource/mapping.json +++ b/sdk/test/Services/S3/UnitTests/Custom/EmbeddedResource/mapping.json @@ -43,6 +43,7 @@ }, "UploadResponse": { "PutObjectResponse": [ + "Bucket", "BucketKeyEnabled", "ChecksumCRC32", "ChecksumCRC32C", @@ -52,12 +53,15 @@ "ChecksumType", "ETag", "Expiration", + "Key", + "Location", "RequestCharged", "SSECustomerAlgorithm", "SSECustomerKeyMD5", "SSEKMSEncryptionContext", "SSEKMSKeyId", "ServerSideEncryption", + "Size", "VersionId" ] }, @@ -129,19 +133,43 @@ "Conversion": { "UploadRequest": { "PutObjectRequest": [ + "ACL", "Bucket", + "BucketKeyEnabled", + "CacheControl", "ChecksumAlgorithm", "ChecksumCRC32", "ChecksumCRC32C", "ChecksumCRC64NVME", "ChecksumSHA1", "ChecksumSHA256", + "ContentDisposition", + "ContentEncoding", + "ContentLanguage", + "ContentType", "ExpectedBucketOwner", + "Expires", + "GrantFullControl", + "GrantRead", + "GrantReadACP", + "GrantWriteACP", + "IfMatch", + "IfNoneMatch", "Key", + "Metadata", + "ObjectLockLegalHoldStatus", + "ObjectLockMode", + "ObjectLockRetainUntilDate", "RequestPayer", "SSECustomerAlgorithm", "SSECustomerKey", - "SSECustomerKeyMD5" + "SSECustomerKeyMD5", + "SSEKMSEncryptionContext", + "SSEKMSKeyId", + "ServerSideEncryption", + "StorageClass", + "Tagging", + "WebsiteRedirectLocation" ], "CreateMultipartRequest": [ "ACL", @@ -210,6 +238,7 @@ }, "CompleteMultipartResponse": { "UploadResponse": [ + "Bucket", "BucketKeyEnabled", "ChecksumCRC32", "ChecksumCRC32C", @@ -219,6 +248,8 @@ "ChecksumType", "ETag", "Expiration", + "Key", + "Location", "RequestCharged", "SSEKMSKeyId", "ServerSideEncryption", @@ -242,6 +273,7 @@ "SSEKMSEncryptionContext", "SSEKMSKeyId", "ServerSideEncryption", + "Size", "VersionId" ] }, diff --git a/sdk/test/Services/S3/UnitTests/Custom/EmbeddedResource/property-aliases.json b/sdk/test/Services/S3/UnitTests/Custom/EmbeddedResource/property-aliases.json index dd4e8c3ce2d7..63216442578e 100644 --- a/sdk/test/Services/S3/UnitTests/Custom/EmbeddedResource/property-aliases.json +++ b/sdk/test/Services/S3/UnitTests/Custom/EmbeddedResource/property-aliases.json @@ -8,6 +8,7 @@ "SSEKMSKeyId": "ServerSideEncryptionKeyManagementServiceKeyId" }, "TransferUtilityUploadResponse": { + "Bucket" : "BucketName", "ServerSideEncryption": "ServerSideEncryptionMethod", "SSECustomerAlgorithm": "ServerSideEncryptionCustomerMethod", "SSECustomerKeyMD5": "ServerSideEncryptionCustomerProvidedKeyMD5", @@ -114,6 +115,7 @@ "Bucket": "BucketName" }, "CompleteMultipartUploadResponse": { + "Bucket" : "BucketName", "ServerSideEncryption": "ServerSideEncryptionMethod", "SSEKMSKeyId": "ServerSideEncryptionKeyManagementServiceKeyId" }, diff --git a/sdk/test/Services/S3/UnitTests/Custom/ResponseMapperTests.cs b/sdk/test/Services/S3/UnitTests/Custom/ResponseMapperTests.cs index ab14986d917f..5f332443d0a5 100644 --- a/sdk/test/Services/S3/UnitTests/Custom/ResponseMapperTests.cs +++ b/sdk/test/Services/S3/UnitTests/Custom/ResponseMapperTests.cs @@ -165,7 +165,7 @@ public void MapUploadRequest_PutObjectRequest_AllMappedProperties_WorkCorrectly( var simpleUploadCommand = new SimpleUploadCommand(null, null, sourceRequest); return simpleUploadCommand.ConstructRequest(); }, - usesHeadersCollection: false, + usesHeadersCollection: true, (sourceRequest) => { sourceRequest.InputStream = new MemoryStream(1024); @@ -742,10 +742,14 @@ private static object GenerateTestValue(Type propertyType, string propertyName) }; } - // Integer types - if (propertyType == typeof(int) || propertyType == typeof(long)) + if (propertyType == typeof(int)) + { + return 1024; + } + + if (propertyType == typeof(long)) { - return 1024; + return 1024L; // Return long literal } if (propertyType == typeof(List))