|  | 
| 20 | 20 |  * | 
| 21 | 21 |  */ | 
| 22 | 22 | 
 | 
|  | 23 | +using System.Collections.Generic; | 
| 23 | 24 | using Amazon.S3.Model; | 
| 24 | 25 | 
 | 
| 25 | 26 | namespace Amazon.S3.Transfer.Internal | 
| @@ -160,6 +161,125 @@ internal static TransferUtilityUploadResponse MapCompleteMultipartUploadResponse | 
| 160 | 161 | 
 | 
| 161 | 162 |             return response; | 
| 162 | 163 |         } | 
|  | 164 | + | 
|  | 165 | +        /// <summary> | 
|  | 166 | +        /// Maps a GetObjectResponse to TransferUtilityDownloadResponse. | 
|  | 167 | +        /// Uses the field mappings defined in mapping.json "Conversion" -> "GetObjectResponse" -> "DownloadResponse". | 
|  | 168 | +        /// </summary> | 
|  | 169 | +        /// <param name="source">The GetObjectResponse to map from</param> | 
|  | 170 | +        /// <returns>A new TransferUtilityDownloadResponse with mapped fields</returns> | 
|  | 171 | +        internal static TransferUtilityDownloadResponse MapGetObjectResponse(GetObjectResponse source) | 
|  | 172 | +        { | 
|  | 173 | +            if (source == null) | 
|  | 174 | +                return null; | 
|  | 175 | + | 
|  | 176 | +            var response = new TransferUtilityDownloadResponse(); | 
|  | 177 | + | 
|  | 178 | +            // Map all fields as defined in mapping.json "Conversion" -> "GetObjectResponse" -> "DownloadResponse" | 
|  | 179 | +            if (source.IsSetAcceptRanges()) | 
|  | 180 | +                response.AcceptRanges = source.AcceptRanges; | 
|  | 181 | + | 
|  | 182 | +            if (source.IsSetBucketKeyEnabled()) | 
|  | 183 | +                response.BucketKeyEnabled = source.BucketKeyEnabled.GetValueOrDefault(); | 
|  | 184 | + | 
|  | 185 | +            if (source.IsSetChecksumCRC32()) | 
|  | 186 | +                response.ChecksumCRC32 = source.ChecksumCRC32; | 
|  | 187 | + | 
|  | 188 | +            if (source.IsSetChecksumCRC32C()) | 
|  | 189 | +                response.ChecksumCRC32C = source.ChecksumCRC32C; | 
|  | 190 | + | 
|  | 191 | +            if (source.IsSetChecksumCRC64NVME()) | 
|  | 192 | +                response.ChecksumCRC64NVME = source.ChecksumCRC64NVME; | 
|  | 193 | + | 
|  | 194 | +            if (source.IsSetChecksumSHA1()) | 
|  | 195 | +                response.ChecksumSHA1 = source.ChecksumSHA1; | 
|  | 196 | + | 
|  | 197 | +            if (source.IsSetChecksumSHA256()) | 
|  | 198 | +                response.ChecksumSHA256 = source.ChecksumSHA256; | 
|  | 199 | + | 
|  | 200 | +            if (source.IsSetChecksumType()) | 
|  | 201 | +                response.ChecksumType = source.ChecksumType; | 
|  | 202 | + | 
|  | 203 | +            if (source.IsSetContentRange()) | 
|  | 204 | +                response.ContentRange = source.ContentRange; | 
|  | 205 | + | 
|  | 206 | +            response.Headers = source.Headers; | 
|  | 207 | + | 
|  | 208 | +            if (source.IsSetDeleteMarker()) | 
|  | 209 | +                response.DeleteMarker = source.DeleteMarker; | 
|  | 210 | + | 
|  | 211 | +            if (source.IsSetETag()) | 
|  | 212 | +                response.ETag = source.ETag; | 
|  | 213 | + | 
|  | 214 | +            if (source.Expiration != null) | 
|  | 215 | +                response.Expiration = source.Expiration; | 
|  | 216 | + | 
|  | 217 | +            if (source.ExpiresString != null) | 
|  | 218 | +                response.ExpiresString = source.ExpiresString; | 
|  | 219 | + | 
|  | 220 | +            if (source.IsSetLastModified()) | 
|  | 221 | +                response.LastModified = source.LastModified; | 
|  | 222 | + | 
|  | 223 | +            if (source.Metadata != null) | 
|  | 224 | +                response.Metadata = source.Metadata; | 
|  | 225 | + | 
|  | 226 | +            if (source.IsSetMissingMeta()) | 
|  | 227 | +                response.MissingMeta = source.MissingMeta; | 
|  | 228 | + | 
|  | 229 | +            if (source.IsSetObjectLockLegalHoldStatus()) | 
|  | 230 | +                response.ObjectLockLegalHoldStatus = source.ObjectLockLegalHoldStatus; | 
|  | 231 | + | 
|  | 232 | +            if (source.IsSetObjectLockMode()) | 
|  | 233 | +                response.ObjectLockMode = source.ObjectLockMode; | 
|  | 234 | + | 
|  | 235 | +            if (source.IsSetObjectLockRetainUntilDate()) | 
|  | 236 | +                response.ObjectLockRetainUntilDate = source.ObjectLockRetainUntilDate; | 
|  | 237 | + | 
|  | 238 | +            if (source.IsSetPartsCount()) | 
|  | 239 | +                response.PartsCount = source.PartsCount; | 
|  | 240 | + | 
|  | 241 | +            if (source.IsSetReplicationStatus()) | 
|  | 242 | +                response.ReplicationStatus = source.ReplicationStatus; | 
|  | 243 | + | 
|  | 244 | +            if (source.IsSetRequestCharged()) | 
|  | 245 | +                response.RequestCharged = source.RequestCharged; | 
|  | 246 | + | 
|  | 247 | +            if (source.RestoreExpiration.HasValue) | 
|  | 248 | +                response.RestoreExpiration = source.RestoreExpiration; | 
|  | 249 | + | 
|  | 250 | +            if (source.RestoreInProgress.HasValue) | 
|  | 251 | +                response.RestoreInProgress = source.RestoreInProgress; | 
|  | 252 | + | 
|  | 253 | +            if (source.ServerSideEncryptionCustomerMethod != null) | 
|  | 254 | +                response.ServerSideEncryptionCustomerMethod = source.ServerSideEncryptionCustomerMethod; | 
|  | 255 | + | 
|  | 256 | +            if (source.ServerSideEncryptionCustomerProvidedKeyMD5 != null) | 
|  | 257 | +                response.ServerSideEncryptionCustomerProvidedKeyMD5 = source.ServerSideEncryptionCustomerProvidedKeyMD5; | 
|  | 258 | + | 
|  | 259 | +            if (source.IsSetServerSideEncryptionKeyManagementServiceKeyId()) | 
|  | 260 | +                response.ServerSideEncryptionKeyManagementServiceKeyId = source.ServerSideEncryptionKeyManagementServiceKeyId; | 
|  | 261 | + | 
|  | 262 | +            if (source.IsSetServerSideEncryptionMethod()) | 
|  | 263 | +                response.ServerSideEncryptionMethod = source.ServerSideEncryptionMethod; | 
|  | 264 | + | 
|  | 265 | +            if (source.IsSetStorageClass()) | 
|  | 266 | +                response.StorageClass = source.StorageClass; | 
|  | 267 | + | 
|  | 268 | +            response.TagCount = source.TagCount; | 
|  | 269 | + | 
|  | 270 | +            if (source.IsSetVersionId()) | 
|  | 271 | +                response.VersionId = source.VersionId; | 
|  | 272 | + | 
|  | 273 | +            if (source.IsSetWebsiteRedirectLocation()) | 
|  | 274 | +                response.WebsiteRedirectLocation = source.WebsiteRedirectLocation; | 
|  | 275 | + | 
|  | 276 | +            // Copy response metadata | 
|  | 277 | +            response.ResponseMetadata = source.ResponseMetadata; | 
|  | 278 | +            response.ContentLength = source.ContentLength; | 
|  | 279 | +            response.HttpStatusCode = source.HttpStatusCode; | 
|  | 280 | + | 
|  | 281 | +            return response; | 
|  | 282 | +        } | 
| 163 | 283 | 
 | 
| 164 | 284 |     } | 
| 165 | 285 | } | 
0 commit comments