AWS SDK Version 3 for .NET
API Reference

AWS services or capabilities described in AWS Documentation may vary by region/location. Click Getting Started with Amazon AWS to see specific differences applicable to the China (Beijing) Region.

Returns information about the InitiateMultipartUpload response and response metadata.

Inheritance Hierarchy

System.Object
  Amazon.Runtime.AmazonWebServiceResponse
    Amazon.S3.Model.InitiateMultipartUploadResponse

Namespace: Amazon.S3.Model
Assembly: AWSSDK.S3.dll
Version: 3.x.y.z

Syntax

C#
public class InitiateMultipartUploadResponse : AmazonWebServiceResponse

The InitiateMultipartUploadResponse type exposes the following members

Constructors

Properties

NameTypeDescription
Public Property AbortDate System.DateTime

Gets and sets the property AbortDate.

If the bucket has a lifecycle rule configured with an action to abort incomplete multipart uploads and the prefix in the lifecycle rule matches the object name in the request, the response includes this header. The header indicates when the initiated multipart upload becomes eligible for an abort operation. For more information, see Aborting Incomplete Multipart Uploads Using a Bucket Lifecycle Configuration in the Amazon S3 User Guide.

The response also includes the x-amz-abort-rule-id header that provides the ID of the lifecycle configuration rule that defines the abort action.

This functionality is not supported for directory buckets.

Public Property AbortRuleId System.String

Gets and sets the property AbortRuleId.

This header is returned along with the x-amz-abort-date header. It identifies the applicable lifecycle configuration rule that defines the action to abort incomplete multipart uploads.

This functionality is not supported for directory buckets.

Public Property BucketKeyEnabled System.Boolean

Gets and sets the property BucketKeyEnabled.

Indicates whether the multipart upload uses an S3 Bucket Key for server-side encryption with Key Management Service (KMS) keys (SSE-KMS).

This functionality is not supported for directory buckets.

Public Property BucketName System.String

Gets and sets the property BucketName.

The name of the bucket to which the multipart upload was initiated. Does not return the access point ARN or access point alias if used.

Access points are not supported by directory buckets.

Public Property ChecksumAlgorithm Amazon.S3.ChecksumAlgorithm

Gets and sets the property ChecksumAlgorithm.

The algorithm that was used to create a checksum of the object.

Public Property ContentLength System.Int64 Inherited from Amazon.Runtime.AmazonWebServiceResponse.
Public Property HttpStatusCode System.Net.HttpStatusCode Inherited from Amazon.Runtime.AmazonWebServiceResponse.
Public Property Key System.String

Gets and sets the property Key.

Object key for which the multipart upload was initiated.

Public Property RequestCharged Amazon.S3.RequestCharged

If present, indicates that the requester was successfully charged for the request.

Public Property ResponseMetadata Amazon.Runtime.ResponseMetadata Inherited from Amazon.Runtime.AmazonWebServiceResponse.
Public Property ServerSideEncryptionCustomerMethod Amazon.S3.ServerSideEncryptionCustomerMethod

The Server-side encryption algorithm to be used with the customer provided key.

If server-side encryption with a customer-provided encryption key was requested, the response will include this header to confirm the encryption algorithm that's used.

This functionality is not supported for directory buckets.

Public Property ServerSideEncryptionCustomerProvidedKeyMD5 System.String

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.

If server-side encryption with a customer-provided encryption key was requested, the response will include this header to provide the round-trip message integrity verification of the customer-provided encryption key.

This functionality is not supported for directory buckets.

Public Property ServerSideEncryptionKeyManagementServiceEncryptionContext System.String

Specifies the AWS KMS Encryption Context to use for object encryption. The value of this header is a base64-encoded UTF-8 string holding JSON with the encryption context key-value pairs.

If present, specifies the Amazon Web Services KMS Encryption Context to use for object encryption. The value of this header is a base64-encoded UTF-8 string holding JSON with the encryption context key-value pairs.

This functionality is not supported for directory buckets.

Public Property ServerSideEncryptionKeyManagementServiceKeyId System.String

The id of the AWS Key Management Service key that Amazon S3 uses to encrypt and decrypt the object.

If present, specifies the ID of the Amazon Web Services Key Management Service (Amazon Web Services KMS) symmetric encryption customer managed key that was used for the object.

This functionality is not supported for directory buckets.

Public Property ServerSideEncryptionMethod Amazon.S3.ServerSideEncryptionMethod

Gets and sets the property ServerSideEncryptionMethod.

The server-side encryption algorithm used when you store this object in Amazon S3 (for example, AES256, aws:kms).

For directory buckets, only server-side encryption with Amazon S3 managed keys (SSE-S3) (AES256) is supported.

Public Property UploadId System.String

Gets and sets the property UploadId.

ID for the initiated multipart upload.

Examples

This example shows how to upload 13MB of data using mutlipart upload.
The data is contained in a stream and the upload is done in 3 parts: 5MB, 5MB, then the remainder.

Multipart Upload Sample


int MB = (int)Math.Pow(2, 20);

// Create a client
AmazonS3Client client = new AmazonS3Client();

// Define input stream
Stream inputStream = Create13MBDataStream();

// Initiate multipart upload
InitiateMultipartUploadRequest initRequest = new InitiateMultipartUploadRequest
{
    BucketName = "SampleBucket",
    Key = "Item1"
};
InitiateMultipartUploadResponse initResponse = client.InitiateMultipartUpload(initRequest);

// Upload part 1
UploadPartRequest uploadRequest = new UploadPartRequest
{
    BucketName = "SampleBucket",
    Key = "Item1",
    UploadId = initResponse.UploadId,
    PartNumber = 1,
    PartSize = 5 * MB,
    InputStream = inputStream
};
UploadPartResponse up1Response = client.UploadPart(uploadRequest);

// Upload part 2
uploadRequest = new UploadPartRequest
{
    BucketName = "SampleBucket",
    Key = "Item1",
    UploadId = initResponse.UploadId,
    PartNumber = 2,
    PartSize = 5 * MB,
    InputStream = inputStream
};
UploadPartResponse up2Response = client.UploadPart(uploadRequest);

// Upload part 3
uploadRequest = new UploadPartRequest
{
    BucketName = "SampleBucket",
    Key = "Item1",
    UploadId = initResponse.UploadId,
    PartNumber = 3,
    InputStream = inputStream
};
UploadPartResponse up3Response = client.UploadPart(uploadRequest);

// List parts for current upload
ListPartsRequest listPartRequest = new ListPartsRequest
{
    BucketName = "SampleBucket",
    Key = "Item1",
    UploadId = initResponse.UploadId
};
ListPartsResponse listPartResponse = client.ListParts(listPartRequest);
Debug.Assert(listPartResponse.Parts.Count == 3);

// Complete the multipart upload
CompleteMultipartUploadRequest compRequest = new CompleteMultipartUploadRequest
{
    BucketName = "SampleBucket",
    Key = "Item1",
    UploadId = initResponse.UploadId,
    PartETags = new List<PartETag>
    {
        new PartETag { ETag = up1Response.ETag, PartNumber = 1 },
        new PartETag { ETag = up2Response.ETag, PartNumber = 2 },
        new PartETag { ETag = up3Response.ETag, PartNumber = 3 }
    }
};
CompleteMultipartUploadResponse compResponse = client.CompleteMultipartUpload(compRequest);

                

Version Information

.NET Core App:
Supported in: 3.1

.NET Standard:
Supported in: 2.0

.NET Framework:
Supported in: 4.5, 4.0, 3.5