AWS SDK Version 4 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.

This is the response object from the InitiateMultipartUpload operation.

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.Nullable<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.Nullable<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).

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 ChecksumType Amazon.S3.ChecksumType

Gets and sets the property ChecksumType.

Indicates the checksum type that you want Amazon S3 to use to calculate the object’s checksum value. For more information, see Checking object integrity in the Amazon S3 User Guide.

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

Gets and sets the property RequestCharged.

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

Gets and sets the property ServerSideEncryptionCustomerMethod.

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

Gets and sets the property ServerSideEncryptionCustomerProvidedKeyMD5.

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

Gets and sets the property ServerSideEncryptionKeyManagementServiceEncryptionContext.

If present, indicates the Amazon Web Services KMS Encryption Context to use for object encryption. The value of this header is a Base64 encoded string of a UTF-8 encoded JSON, which contains the encryption context as key-value pairs.

Public Property ServerSideEncryptionKeyManagementServiceKeyId System.String

Gets and sets the property ServerSideEncryptionKeyManagementServiceKeyId.

If present, indicates the ID of the KMS key that was used for object encryption.

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 or Amazon FSx.

When accessing data stored in Amazon FSx file systems using S3 access points, the only valid server side encryption option is aws:fsx.

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 = "amzn-s3-demo-bucket",
    Key = "Item1"
};
InitiateMultipartUploadResponse initResponse = await client.InitiateMultipartUploadAsync(initRequest);

// Upload part 1
UploadPartRequest uploadRequest = new UploadPartRequest
{
    BucketName = "amzn-s3-demo-bucket",
    Key = "Item1",
    UploadId = initResponse.UploadId,
    PartNumber = 1,
    PartSize = 5 * MB,
    InputStream = inputStream
};
UploadPartResponse up1Response = await client.UploadPartAsync(uploadRequest);

// Upload part 2
uploadRequest = new UploadPartRequest
{
    BucketName = "amzn-s3-demo-bucket",
    Key = "Item1",
    UploadId = initResponse.UploadId,
    PartNumber = 2,
    PartSize = 5 * MB,
    InputStream = inputStream
};
UploadPartResponse up2Response = await client.UploadPartAsync(uploadRequest);

// Upload part 3
uploadRequest = new UploadPartRequest
{
    BucketName = "amzn-s3-demo-bucket",
    Key = "Item1",
    UploadId = initResponse.UploadId,
    PartNumber = 3,
    InputStream = inputStream
};
UploadPartResponse up3Response = await client.UploadPartAsync(uploadRequest);

// List parts for current upload
ListPartsRequest listPartRequest = new ListPartsRequest
{
    BucketName = "amzn-s3-demo-bucket",
    Key = "Item1",
    UploadId = initResponse.UploadId
};
ListPartsResponse listPartResponse = await client.ListPartsAsync(listPartRequest);
Debug.Assert(listPartResponse.Parts.Count == 3);

// Complete the multipart upload
CompleteMultipartUploadRequest compRequest = new CompleteMultipartUploadRequest
{
    BucketName = "amzn-s3-demo-bucket",
    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 = await client.CompleteMultipartUploadAsync(compRequest);

                

Version Information

.NET:
Supported in: 8.0 and newer, Core 3.1

.NET Standard:
Supported in: 2.0

.NET Framework:
Supported in: 4.7.2 and newer