Skip to content

Commit 11bd069

Browse files
committed
Add DownloadResponse mapping
stack-info: PR: #4075, branch: GarrettBeatty/stacked/8
1 parent 5afd0e6 commit 11bd069

File tree

5 files changed

+470
-15
lines changed

5 files changed

+470
-15
lines changed
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"services": [
3+
{
4+
"serviceName": "S3",
5+
"type": "patch",
6+
"changeLogMessages": [
7+
"Add GetObjectResponse to TransferUtilityDownloadResponse mapping."
8+
]
9+
}
10+
]
11+
}

sdk/src/Services/S3/Custom/Transfer/Internal/ResponseMapper.cs

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
*
2121
*/
2222

23+
using System.Collections.Generic;
2324
using Amazon.S3.Model;
2425

2526
namespace Amazon.S3.Transfer.Internal
@@ -104,6 +105,62 @@ internal static TransferUtilityUploadResponse MapCompleteMultipartUploadResponse
104105

105106
return response;
106107
}
108+
109+
/// <summary>
110+
/// Maps a GetObjectResponse to TransferUtilityDownloadResponse.
111+
/// Uses the field mappings defined in mapping.json "Conversion" -> "GetObjectResponse" -> "DownloadResponse".
112+
/// </summary>
113+
/// <param name="source">The GetObjectResponse to map from</param>
114+
/// <returns>A new TransferUtilityDownloadResponse with mapped fields</returns>
115+
internal static TransferUtilityDownloadResponse MapGetObjectResponse(GetObjectResponse source)
116+
{
117+
if (source == null)
118+
return null;
119+
120+
var response = new TransferUtilityDownloadResponse();
121+
122+
// Map all fields as defined in mapping.json "Conversion" -> "GetObjectResponse" -> "DownloadResponse"
123+
response.AcceptRanges = source.AcceptRanges;
124+
response.BucketKeyEnabled = source.BucketKeyEnabled.GetValueOrDefault();
125+
response.ChecksumCRC32 = source.ChecksumCRC32;
126+
response.ChecksumCRC32C = source.ChecksumCRC32C;
127+
response.ChecksumCRC64NVME = source.ChecksumCRC64NVME;
128+
response.ChecksumSHA1 = source.ChecksumSHA1;
129+
response.ChecksumSHA256 = source.ChecksumSHA256;
130+
response.ChecksumType = source.ChecksumType;
131+
response.ContentRange = source.ContentRange;
132+
response.Headers = source.Headers;
133+
response.DeleteMarker = source.DeleteMarker;
134+
response.ETag = source.ETag;
135+
response.Expiration = source.Expiration;
136+
response.ExpiresString = source.ExpiresString;
137+
response.LastModified = source.LastModified;
138+
response.Metadata = source.Metadata;
139+
response.MissingMeta = source.MissingMeta;
140+
response.ObjectLockLegalHoldStatus = source.ObjectLockLegalHoldStatus;
141+
response.ObjectLockMode = source.ObjectLockMode;
142+
response.ObjectLockRetainUntilDate = source.ObjectLockRetainUntilDate;
143+
response.PartsCount = source.PartsCount;
144+
response.ReplicationStatus = source.ReplicationStatus;
145+
response.RequestCharged = source.RequestCharged;
146+
response.RestoreExpiration = source.RestoreExpiration;
147+
response.RestoreInProgress = source.RestoreInProgress;
148+
response.ServerSideEncryptionCustomerMethod = source.ServerSideEncryptionCustomerMethod;
149+
response.ServerSideEncryptionCustomerProvidedKeyMD5 = source.ServerSideEncryptionCustomerProvidedKeyMD5;
150+
response.ServerSideEncryptionKeyManagementServiceKeyId = source.ServerSideEncryptionKeyManagementServiceKeyId;
151+
response.ServerSideEncryptionMethod = source.ServerSideEncryptionMethod;
152+
response.StorageClass = source.StorageClass;
153+
response.TagCount = source.TagCount;
154+
response.VersionId = source.VersionId;
155+
response.WebsiteRedirectLocation = source.WebsiteRedirectLocation;
156+
157+
// Copy response metadata
158+
response.ResponseMetadata = source.ResponseMetadata;
159+
response.ContentLength = source.ContentLength;
160+
response.HttpStatusCode = source.HttpStatusCode;
161+
162+
return response;
163+
}
107164

108165
}
109166
}
Lines changed: 300 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,300 @@
1+
/*******************************************************************************
2+
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3+
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use
4+
* this file except in compliance with the License. A copy of the License is located at
5+
*
6+
* http://aws.amazon.com/apache2.0
7+
*
8+
* or in the "license" file accompanying this file.
9+
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
10+
* CONDITIONS OF ANY KIND, either express or implied. See the License for the
11+
* specific language governing permissions and limitations under the License.
12+
* *****************************************************************************
13+
* __ _ _ ___
14+
* ( )( \/\/ )/ __)
15+
* /__\ \ / \__ \
16+
* (_)(_) \/\/ (___/
17+
*
18+
* AWS SDK for .NET
19+
* API Version: 2006-03-01
20+
*
21+
*/
22+
23+
using System;
24+
using System.Collections.Generic;
25+
using Amazon.Runtime;
26+
using Amazon.S3.Model;
27+
28+
namespace Amazon.S3.Transfer
29+
{
30+
/// <summary>
31+
/// Response object for Transfer Utility download operations.
32+
/// Contains response metadata from download operations.
33+
/// </summary>
34+
public class TransferUtilityDownloadResponse : AmazonWebServiceResponse
35+
{
36+
/// <summary>
37+
/// Gets and sets the AcceptRanges property.
38+
/// </summary>
39+
public string AcceptRanges { get; set; }
40+
41+
/// <summary>
42+
/// Gets and sets the property BucketKeyEnabled.
43+
/// <para>
44+
/// Indicates whether the object uses an S3 Bucket Key for server-side encryption with
45+
/// Amazon Web Services KMS (SSE-KMS).
46+
/// </para>
47+
/// </summary>
48+
public bool? BucketKeyEnabled { get; set; }
49+
50+
/// <summary>
51+
/// The collection of headers for the response.
52+
/// </summary>
53+
public HeadersCollection Headers { get; set; }
54+
55+
/// <summary>
56+
/// Gets and sets the property ChecksumCRC32.
57+
/// <para>
58+
/// The Base64 encoded, 32-bit CRC-32 checksum of the object.
59+
/// </para>
60+
/// </summary>
61+
public string ChecksumCRC32 { get; set; }
62+
63+
/// <summary>
64+
/// Gets and sets the property ChecksumCRC32C.
65+
/// <para>
66+
/// The Base64 encoded, 32-bit CRC-32C checksum of the object.
67+
/// </para>
68+
/// </summary>
69+
public string ChecksumCRC32C { get; set; }
70+
71+
/// <summary>
72+
/// Gets and sets the property ChecksumCRC64NVME.
73+
/// <para>
74+
/// The Base64 encoded, 64-bit CRC-64NVME checksum of the object.
75+
/// </para>
76+
/// </summary>
77+
public string ChecksumCRC64NVME { get; set; }
78+
79+
/// <summary>
80+
/// Gets and sets the property ChecksumSHA1.
81+
/// <para>
82+
/// The Base64 encoded, 160-bit SHA-1 digest of the object.
83+
/// </para>
84+
/// </summary>
85+
public string ChecksumSHA1 { get; set; }
86+
87+
/// <summary>
88+
/// Gets and sets the property ChecksumSHA256.
89+
/// <para>
90+
/// The Base64 encoded, 256-bit SHA-256 checksum of the object.
91+
/// </para>
92+
/// </summary>
93+
public string ChecksumSHA256 { get; set; }
94+
95+
/// <summary>
96+
/// Gets and sets the property ChecksumType.
97+
/// <para>
98+
/// The checksum type used to calculate the object-level checksum.
99+
/// </para>
100+
/// </summary>
101+
public ChecksumType ChecksumType { get; set; }
102+
103+
/// <summary>
104+
/// Gets and sets the ContentRange property.
105+
/// </summary>
106+
public string ContentRange { get; set; }
107+
108+
/// <summary>
109+
/// Gets and sets the DeleteMarker property.
110+
/// <para>
111+
/// Specifies whether the object retrieved was (true) or was not (false) a Delete Marker.
112+
/// </para>
113+
/// </summary>
114+
public string DeleteMarker { get; set; }
115+
116+
/// <summary>
117+
/// Gets and sets the ETag property.
118+
/// <para>
119+
/// An ETag is an opaque identifier assigned by a web server to a specific version of a resource found at a URL.
120+
/// </para>
121+
/// </summary>
122+
public string ETag { get; set; }
123+
124+
/// <summary>
125+
/// Gets and sets the property Expiration.
126+
/// <para>
127+
/// If the object expiration is configured, this will contain the expiration date and rule ID.
128+
/// </para>
129+
/// </summary>
130+
public Expiration Expiration { get; set; }
131+
132+
/// <summary>
133+
/// Gets and sets the ExpiresString property.
134+
/// <para>
135+
/// The date and time at which the object is no longer cacheable (string format).
136+
/// </para>
137+
/// </summary>
138+
public string ExpiresString { get; set; }
139+
140+
/// <summary>
141+
/// Gets and sets the property LastModified.
142+
/// <para>
143+
/// Date and time when the object was last modified.
144+
/// </para>
145+
/// </summary>
146+
public DateTime? LastModified { get; set; }
147+
148+
/// <summary>
149+
/// Gets and sets the Metadata property.
150+
/// <para>
151+
/// The collection of metadata for the object.
152+
/// </para>
153+
/// </summary>
154+
public MetadataCollection Metadata { get; set; }
155+
156+
/// <summary>
157+
/// Gets and sets the property MissingMeta.
158+
/// <para>
159+
/// This is set to the number of metadata entries not returned in the headers that are
160+
/// prefixed with x-amz-meta-.
161+
/// </para>
162+
/// </summary>
163+
public int? MissingMeta { get; set; }
164+
165+
/// <summary>
166+
/// Gets and sets the property ObjectLockLegalHoldStatus.
167+
/// <para>
168+
/// Indicates whether this object has an active legal hold.
169+
/// </para>
170+
/// </summary>
171+
public ObjectLockLegalHoldStatus ObjectLockLegalHoldStatus { get; set; }
172+
173+
/// <summary>
174+
/// Gets and sets the property ObjectLockMode.
175+
/// <para>
176+
/// The Object Lock mode that's currently in place for this object.
177+
/// </para>
178+
/// </summary>
179+
public ObjectLockMode ObjectLockMode { get; set; }
180+
181+
/// <summary>
182+
/// Gets and sets the property ObjectLockRetainUntilDate.
183+
/// <para>
184+
/// The date and time when this object's Object Lock will expire.
185+
/// </para>
186+
/// </summary>
187+
public DateTime? ObjectLockRetainUntilDate { get; set; }
188+
189+
/// <summary>
190+
/// Gets and sets the PartsCount property.
191+
/// <para>
192+
/// The number of parts this object has.
193+
/// </para>
194+
/// </summary>
195+
public int? PartsCount { get; set; }
196+
197+
/// <summary>
198+
/// Gets and sets the property ReplicationStatus.
199+
/// <para>
200+
/// Amazon S3 can return this if your request involves a bucket that is either a source
201+
/// or destination in a replication rule.
202+
/// </para>
203+
/// </summary>
204+
public ReplicationStatus ReplicationStatus { get; set; }
205+
206+
/// <summary>
207+
/// Gets and sets the RequestCharged property.
208+
/// <para>
209+
/// If present, indicates that the requester was successfully charged for the request.
210+
/// </para>
211+
/// </summary>
212+
public RequestCharged RequestCharged { get; set; }
213+
214+
/// <summary>
215+
/// Gets and sets the RestoreExpiration property.
216+
/// <para>
217+
/// RestoreExpiration will be set for objects that have been restored from Amazon Glacier.
218+
/// It indicates for those objects how long the restored object will exist.
219+
/// </para>
220+
/// </summary>
221+
public DateTime? RestoreExpiration { get; set; }
222+
223+
/// <summary>
224+
/// Gets and sets the RestoreInProgress
225+
/// <para>
226+
/// Will be <c>true</c> when the object is in the process of being restored from Amazon Glacier.
227+
/// </para>
228+
/// <para>
229+
/// This functionality is not supported for directory buckets.
230+
/// Only the S3 Express One Zone storage class is supported by directory buckets to store objects.
231+
/// </para>
232+
/// </summary>
233+
public bool? RestoreInProgress { get; set; }
234+
235+
/// <summary>
236+
/// Gets and sets the ServerSideEncryptionCustomerMethod property.
237+
/// <para>
238+
/// The server-side encryption algorithm to be used with the customer provided key.
239+
/// </para>
240+
/// </summary>
241+
public ServerSideEncryptionCustomerMethod ServerSideEncryptionCustomerMethod { get; set; }
242+
243+
/// <summary>
244+
/// Gets and sets the ServerSideEncryptionCustomerProvidedKeyMD5 property.
245+
/// <para>
246+
/// The MD5 server-side encryption of the customer-provided encryption key.
247+
/// </para>
248+
/// </summary>
249+
public string ServerSideEncryptionCustomerProvidedKeyMD5 { get; set; }
250+
251+
/// <summary>
252+
/// Gets and sets the ServerSideEncryptionKeyManagementServiceKeyId property.
253+
/// <para>
254+
/// If present, indicates the ID of the KMS key that was used for object encryption.
255+
/// </para>
256+
/// </summary>
257+
public string ServerSideEncryptionKeyManagementServiceKeyId { get; set; }
258+
259+
/// <summary>
260+
/// Gets and sets the ServerSideEncryptionMethod property.
261+
/// <para>
262+
/// The server-side encryption algorithm used when you store this object in Amazon S3.
263+
/// </para>
264+
/// </summary>
265+
public ServerSideEncryptionMethod ServerSideEncryptionMethod { get; set; }
266+
267+
/// <summary>
268+
/// Gets and sets the property StorageClass.
269+
/// <para>
270+
/// Provides storage class information of the object.
271+
/// </para>
272+
/// </summary>
273+
public S3StorageClass StorageClass { get; set; }
274+
275+
/// <summary>
276+
/// Gets and sets the property TagCount.
277+
/// <para>
278+
/// The number of tags, if any, on the object.
279+
/// </para>
280+
/// </summary>
281+
public int TagCount { get; set; }
282+
283+
/// <summary>
284+
/// Gets and sets the property VersionId.
285+
/// <para>
286+
/// Version ID of the object.
287+
/// </para>
288+
/// </summary>
289+
public string VersionId { get; set; }
290+
291+
/// <summary>
292+
/// Gets and sets the property WebsiteRedirectLocation.
293+
/// <para>
294+
/// If the bucket is configured as a website, redirects requests for this object to another
295+
/// object in the same bucket or to an external URL.
296+
/// </para>
297+
/// </summary>
298+
public string WebsiteRedirectLocation { get; set; }
299+
}
300+
}

0 commit comments

Comments
 (0)