Skip to content
Closed
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/d31339e8-845c-4988-8657-8840683fe4b2.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"services": [
{
"serviceName": "S3",
"type": "patch",
"changeLogMessages": [
"Update TransferDownloadDirectoryRequest to extend BaseDownloadRequest."
]
}
]
}
147 changes: 3 additions & 144 deletions sdk/src/Services/S3/Custom/Transfer/BaseDownloadRequest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,47 +28,12 @@
namespace Amazon.S3.Transfer
{
/// <summary>
/// The base class for requests that return Amazon S3 objects.
/// The base class for requests that return single Amazon S3 objects.
/// </summary>
public abstract class BaseDownloadRequest
public abstract class BaseDownloadRequest : BaseTransferRequest
{
private string bucketName;
private string key;
private string versionId;
private DateTime? modifiedSinceDate;
private DateTime? unmodifiedSinceDate;
private ChecksumMode checksumMode;

private ServerSideEncryptionCustomerMethod serverSideCustomerEncryption;
private string serverSideEncryptionCustomerProvidedKey;
private string serverSideEncryptionCustomerProvidedKeyMD5;

private RequestPayer requestPayer;

/// <summary>
/// Gets or sets the name of the bucket.
/// </summary>
/// <value>
/// The name of the bucket.
/// </value>
public string BucketName
{
get { return this.bucketName; }
set { this.bucketName = value; }
}

/// <summary>
/// Gets whether or not the bucket name is set.
/// </summary>
/// <returns>
/// A value of <c>true</c> if the bucket name is set.
/// Returns <c>false</c> if otherwise.
/// </returns>
internal bool IsSetBucketName()
{
return !System.String.IsNullOrEmpty(this.bucketName);
}


/// <summary>
/// Gets or sets the key under which the Amazon S3 object is stored.
Expand Down Expand Up @@ -114,111 +79,5 @@ internal bool IsSetVersionId()
{
return !System.String.IsNullOrEmpty(this.versionId);
}

/// <summary>
/// Gets or sets the <c>ModifiedSinceDate</c> property.
/// </summary>
/// <value>
/// The <c>ModifiedSinceDate</c> property.
/// </value>
public DateTime ModifiedSinceDate
{
get { return this.modifiedSinceDate ?? DateTime.SpecifyKind(default, DateTimeKind.Utc); }
set
{
this.modifiedSinceDate = value;
}
}

// Check to see if ModifiedSinceDate property is set
internal bool IsSetModifiedSinceDate()
{
return this.modifiedSinceDate.HasValue;
}

/// <summary>
/// Gets or sets the <c>UnmodifiedSinceDate</c> property.
/// </summary>
/// <value>
/// The <c>UnmodifiedSinceDate</c> property.
/// </value>
public DateTime UnmodifiedSinceDate
{
get { return this.unmodifiedSinceDate ?? DateTime.SpecifyKind(default, DateTimeKind.Utc); }
set
{
this.unmodifiedSinceDate = value;
}
}

// Check to see if UnmodifiedSinceDate property is set
internal bool IsSetUnmodifiedSinceDate()
{
return this.unmodifiedSinceDate.HasValue;
}

/// <summary>
/// The Server-side encryption algorithm to be used with the customer provided key.
///
/// </summary>
public ServerSideEncryptionCustomerMethod ServerSideEncryptionCustomerMethod
{
get { return this.serverSideCustomerEncryption; }
set { this.serverSideCustomerEncryption = value; }
}

/// <summary>
/// The base64-encoded encryption key for Amazon S3 to use to decrypt the object
/// <para>
/// Using the encryption key you provide as part of your request Amazon S3 manages both the encryption, as it writes
/// to disks, and decryption, when you access your objects. Therefore, you don't need to maintain any data encryption code. The only
/// thing you do is manage the encryption keys you provide.
/// </para>
/// <para>
/// When you retrieve an object, you must provide the same encryption key as part of your request. Amazon S3 first verifies
/// the encryption key you provided matches, and then decrypts the object before returning the object data to you.
/// </para>
/// <para>
/// Important: Amazon S3 does not store the encryption key you provide.
/// </para>
/// </summary>
[AWSProperty(Sensitive=true)]
public string ServerSideEncryptionCustomerProvidedKey
{
get { return this.serverSideEncryptionCustomerProvidedKey; }
set { this.serverSideEncryptionCustomerProvidedKey = value; }
}

/// <summary>
/// The MD5 of the customer encryption key specified in the ServerSideEncryptionCustomerProvidedKey property. The MD5 is
/// base 64 encoded. This field is optional, the SDK will calculate the MD5 if this is not set.
/// </summary>
public string ServerSideEncryptionCustomerProvidedKeyMD5
{
get { return this.serverSideEncryptionCustomerProvidedKeyMD5; }
set { this.serverSideEncryptionCustomerProvidedKeyMD5 = value; }
}

/// <summary>
/// Gets and sets the property ChecksumMode.
/// <para>
/// This must be enabled to retrieve the checksum.
/// </para>
/// </summary>
public ChecksumMode ChecksumMode
{
get { return this.checksumMode; }
set { this.checksumMode = value; }
}

/// <summary>
/// Confirms that the requester knows that they will be charged for the request.
/// Bucket owners need not specify this parameter in their requests.
/// </summary>
public RequestPayer RequestPayer
{
get { return this.requestPayer; }
set { this.requestPayer = value; }
}
}
}
}
174 changes: 174 additions & 0 deletions sdk/src/Services/S3/Custom/Transfer/BaseTransferRequest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,174 @@
/*******************************************************************************
* Copyright Amazon.com Inc. or its affiliates. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use
* this file except in compliance with the License. A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file.
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
* CONDITIONS OF ANY KIND, either express or implied. See the License for the
* specific language governing permissions and limitations under the License.
* *****************************************************************************
* __ _ _ ___
* ( )( \/\/ )/ __)
* /__\ \ / \__ \
* (_)(_) \/\/ (___/
*
* AWS SDK for .NET
* API Version: 2006-03-01
*
*/
using System;
using Amazon.Runtime;
using Amazon.Runtime.Internal;

namespace Amazon.S3.Transfer
{
/// <summary>
/// The base class for all TransferUtility request classes that contains shared properties.
/// </summary>
public abstract class BaseTransferRequest
{
private string bucketName;
private DateTime? modifiedSinceDate;
private DateTime? unmodifiedSinceDate;
private ChecksumMode checksumMode;

private ServerSideEncryptionCustomerMethod serverSideCustomerEncryption;
private string serverSideEncryptionCustomerProvidedKey;
private string serverSideEncryptionCustomerProvidedKeyMD5;

private RequestPayer requestPayer;

/// <summary>
/// Gets or sets the name of the bucket.
/// </summary>
/// <value>
/// The name of the bucket.
/// </value>
public string BucketName
{
get { return this.bucketName; }
set { this.bucketName = value; }
}

/// <summary>
/// Gets whether or not the bucket name is set.
/// </summary>
/// <returns>
/// A value of <c>true</c> if the bucket name is set.
/// Returns <c>false</c> if otherwise.
/// </returns>
internal bool IsSetBucketName()
{
return !System.String.IsNullOrEmpty(this.bucketName);
}

/// <summary>
/// Gets or sets the <c>ModifiedSinceDate</c> property.
/// </summary>
/// <value>
/// The <c>ModifiedSinceDate</c> property.
/// </value>
public DateTime ModifiedSinceDate
{
get { return this.modifiedSinceDate ?? DateTime.SpecifyKind(default, DateTimeKind.Utc); }
set
{
this.modifiedSinceDate = value;
}
}

// Check to see if ModifiedSinceDate property is set
internal bool IsSetModifiedSinceDate()
{
return this.modifiedSinceDate.HasValue;
}

/// <summary>
/// Gets or sets the <c>UnmodifiedSinceDate</c> property.
/// </summary>
/// <value>
/// The <c>UnmodifiedSinceDate</c> property.
/// </value>
public DateTime UnmodifiedSinceDate
{
get { return this.unmodifiedSinceDate ?? DateTime.SpecifyKind(default, DateTimeKind.Utc); }
set
{
this.unmodifiedSinceDate = value;
}
}

// Check to see if UnmodifiedSinceDate property is set
internal bool IsSetUnmodifiedSinceDate()
{
return this.unmodifiedSinceDate.HasValue;
}

/// <summary>
/// The Server-side encryption algorithm to be used with the customer provided key.
///
/// </summary>
public ServerSideEncryptionCustomerMethod ServerSideEncryptionCustomerMethod
{
get { return this.serverSideCustomerEncryption; }
set { this.serverSideCustomerEncryption = value; }
}

/// <summary>
/// The base64-encoded encryption key for Amazon S3 to use to decrypt the object
/// <para>
/// Using the encryption key you provide as part of your request Amazon S3 manages both the encryption, as it writes
/// to disks, and decryption, when you access your objects. Therefore, you don't need to maintain any data encryption code. The only
/// thing you do is manage the encryption keys you provide.
/// </para>
/// <para>
/// When you retrieve an object, you must provide the same encryption key as part of your request. Amazon S3 first verifies
/// the encryption key you provided matches, and then decrypts the object before returning the object data to you.
/// </para>
/// <para>
/// Important: Amazon S3 does not store the encryption key you provide.
/// </para>
/// </summary>
[AWSProperty(Sensitive=true)]
public string ServerSideEncryptionCustomerProvidedKey
{
get { return this.serverSideEncryptionCustomerProvidedKey; }
set { this.serverSideEncryptionCustomerProvidedKey = value; }
}

/// <summary>
/// The MD5 of the customer encryption key specified in the ServerSideEncryptionCustomerProvidedKey property. The MD5 is
/// base 64 encoded. This field is optional, the SDK will calculate the MD5 if this is not set.
/// </summary>
public string ServerSideEncryptionCustomerProvidedKeyMD5
{
get { return this.serverSideEncryptionCustomerProvidedKeyMD5; }
set { this.serverSideEncryptionCustomerProvidedKeyMD5 = value; }
}

/// <summary>
/// Gets and sets the property ChecksumMode.
/// <para>
/// This must be enabled to retrieve the checksum.
/// </para>
/// </summary>
public ChecksumMode ChecksumMode
{
get { return this.checksumMode; }
set { this.checksumMode = value; }
}

/// <summary>
/// Confirms that the requester knows that they will be charged for the request.
/// Bucket owners need not specify this parameter in their requests.
/// </summary>
public RequestPayer RequestPayer
{
get { return this.requestPayer; }
set { this.requestPayer = value; }
}
}
}
27 changes: 0 additions & 27 deletions sdk/src/Services/S3/Custom/Transfer/Internal/BaseCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,33 +37,6 @@ public virtual object Return
get { return null; }
}

protected GetObjectRequest ConvertToGetObjectRequest(BaseDownloadRequest request)
{
GetObjectRequest getRequest = new GetObjectRequest()
{
BucketName = request.BucketName,
Key = request.Key,
VersionId = request.VersionId
};
((Amazon.Runtime.Internal.IAmazonWebServiceRequest)getRequest).AddBeforeRequestHandler(this.RequestEventHandler);

if (request.IsSetModifiedSinceDate())
{
getRequest.ModifiedSinceDate = request.ModifiedSinceDate;
}
if (request.IsSetUnmodifiedSinceDate())
{
getRequest.UnmodifiedSinceDate = request.UnmodifiedSinceDate;
}

getRequest.ServerSideEncryptionCustomerMethod = request.ServerSideEncryptionCustomerMethod;
getRequest.ServerSideEncryptionCustomerProvidedKey = request.ServerSideEncryptionCustomerProvidedKey;
getRequest.ServerSideEncryptionCustomerProvidedKeyMD5 = request.ServerSideEncryptionCustomerProvidedKeyMD5;
getRequest.ChecksumMode = request.ChecksumMode;
getRequest.RequestPayer = request.RequestPayer;

return getRequest;
}

protected void RequestEventHandler(object sender, RequestEventArgs args)
{
Expand Down
Loading