Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
11 changes: 11 additions & 0 deletions generator/.DevConfigs/7f23582e-3225-487b-83e7-167cf17cb238.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"services": [
{
"serviceName": "S3",
"type": "patch",
"changeLogMessages": [
"Update Response mapping logic for PutObjectResponse and CompleteMultipartResponse"
]
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
108 changes: 108 additions & 0 deletions sdk/src/Services/S3/Custom/Transfer/TransferUtilityUploadResponse.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -73,6 +77,110 @@ internal bool IsSetBucketKeyEnabled()
return this._bucketKeyEnabled.HasValue;
}

/// <summary>
/// Gets and sets the property BucketName.
/// <para>
/// The name of the bucket that contains the newly created object. Does not return the
/// access point ARN or access point alias if used.
/// </para>
///
/// <para>
/// When using this action with an access point, you must direct requests to the access
/// point hostname. The access point hostname takes the form <i>AccessPointName</i>-<i>AccountId</i>.s3-accesspoint.<i>Region</i>.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 <a href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/using-access-points.html">Using
/// access points</a> in the <i>Amazon S3 User Guide</i>.
/// </para>
///
/// <para>
/// 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 <code> <i>AccessPointName</i>-<i>AccountId</i>.<i>outpostID</i>.s3-outposts.<i>Region</i>.amazonaws.com</code>.
/// 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 <a href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/S3onOutposts.html">What
/// is S3 on Outposts?</a> in the <i>Amazon S3 User Guide</i>.
/// </para>
/// </summary>
public string BucketName
{
get { return this._bucketName; }
set { this._bucketName = value; }
}

/// <summary>
/// Checks if BucketName property is set.
/// </summary>
/// <returns>true if BucketName property is set.</returns>
internal bool IsSetBucketName()
{
return !string.IsNullOrEmpty(this._bucketName);
}

/// <summary>
/// Gets and sets the property Key.
/// <para>
/// The object key of the newly created object.
/// </para>
/// </summary>
public string Key
{
get { return this._key; }
set { this._key = value; }
}

/// <summary>
/// Checks if Key property is set.
/// </summary>
/// <returns>true if Key property is set.</returns>
internal bool IsSetKey()
{
return !string.IsNullOrEmpty(this._key);
}

/// <summary>
/// Gets and sets the property Location.
/// <para>
/// The URI that identifies the newly created object.
/// </para>
/// </summary>
public string Location
{
get { return this._location; }
set { this._location = value; }
}

/// <summary>
/// Checks if Location property is set.
/// </summary>
/// <returns>true if Location property is set.</returns>
internal bool IsSetLocation()
{
return !string.IsNullOrEmpty(this._location);
}

/// <summary>
/// Gets and sets the property Size.
/// <para>
/// The size of the object in bytes. This will only be present if you append to an object.
/// </para>
/// <note><para>This functionality is only supported for objects in the S3 Express One Zone storage class in directory buckets.</para></note>
/// </summary>
public long? Size
{
get { return this._size; }
set { this._size = value; }
}

/// <summary>
/// Checks if Size property is set.
/// </summary>
/// <returns>true if Size property is set.</returns>
internal bool IsSetSize()
{
return this._size.HasValue;
}

/// <summary>
/// Gets and sets the property ChecksumCRC32.
/// <para>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
},
"UploadResponse": {
"PutObjectResponse": [
"Bucket",
"BucketKeyEnabled",
"ChecksumCRC32",
"ChecksumCRC32C",
Expand All @@ -52,12 +53,15 @@
"ChecksumType",
"ETag",
"Expiration",
"Key",
"Location",
"RequestCharged",
"SSECustomerAlgorithm",
"SSECustomerKeyMD5",
"SSEKMSEncryptionContext",
"SSEKMSKeyId",
"ServerSideEncryption",
"Size",
"VersionId"
]
},
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -210,6 +238,7 @@
},
"CompleteMultipartResponse": {
"UploadResponse": [
"Bucket",
"BucketKeyEnabled",
"ChecksumCRC32",
"ChecksumCRC32C",
Expand All @@ -219,6 +248,8 @@
"ChecksumType",
"ETag",
"Expiration",
"Key",
"Location",
"RequestCharged",
"SSEKMSKeyId",
"ServerSideEncryption",
Expand All @@ -242,6 +273,7 @@
"SSEKMSEncryptionContext",
"SSEKMSKeyId",
"ServerSideEncryption",
"Size",
"VersionId"
]
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"SSEKMSKeyId": "ServerSideEncryptionKeyManagementServiceKeyId"
},
"TransferUtilityUploadResponse": {
"Bucket" : "BucketName",
"ServerSideEncryption": "ServerSideEncryptionMethod",
"SSECustomerAlgorithm": "ServerSideEncryptionCustomerMethod",
"SSECustomerKeyMD5": "ServerSideEncryptionCustomerProvidedKeyMD5",
Expand Down Expand Up @@ -114,6 +115,7 @@
"Bucket": "BucketName"
},
"CompleteMultipartUploadResponse": {
"Bucket" : "BucketName",
"ServerSideEncryption": "ServerSideEncryptionMethod",
"SSEKMSKeyId": "ServerSideEncryptionKeyManagementServiceKeyId"
},
Expand Down
12 changes: 8 additions & 4 deletions sdk/test/Services/S3/UnitTests/Custom/ResponseMapperTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ public void MapUploadRequest_PutObjectRequest_AllMappedProperties_WorkCorrectly(
var simpleUploadCommand = new SimpleUploadCommand(null, null, sourceRequest);
return simpleUploadCommand.ConstructRequest();
},
usesHeadersCollection: false,
usesHeadersCollection: true,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since CacheControl was added to mapping and thats located in headers we have to search there now

(sourceRequest) =>
{
sourceRequest.InputStream = new MemoryStream(1024);
Expand Down Expand Up @@ -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<S3Grant>))
Expand Down
Loading