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

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

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

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 (for example, AES256, aws:kms).

Directory buckets - For directory buckets, there are only two supported options for server-side encryption: server-side encryption with Amazon S3 managed keys (SSE-S3) (AES256) and server-side encryption with KMS keys (SSE-KMS) (aws:kms). We recommend that the bucket's default encryption uses the desired encryption configuration and you don't override the bucket default encryption in your CreateSession requests or PUT object requests. Then, new objects are automatically encrypted with the desired encryption settings. For more information, see Protecting data with server-side encryption in the Amazon S3 User Guide. For more information about the encryption overriding behaviors in directory buckets, see Specifying server-side encryption with KMS for new object uploads.

In the Zonal endpoint API calls (except CopyObject and UploadPartCopy) using the REST API, the encryption request headers must match the encryption settings that are specified in the CreateSession request. You can't override the values of the encryption settings (x-amz-server-side-encryption, x-amz-server-side-encryption-aws-kms-key-id, x-amz-server-side-encryption-context, and x-amz-server-side-encryption-bucket-key-enabled) that are specified in the CreateSession request. You don't need to explicitly specify these encryption settings values in Zonal endpoint API calls, and Amazon S3 will use the encryption settings values from the CreateSession request to protect new objects in the directory bucket.

When you use the CLI or the Amazon Web Services SDKs, for CreateSession, the session token refreshes automatically to avoid service interruptions when a session expires. The CLI or the Amazon Web Services SDKs use the bucket's default encryption configuration for the CreateSession request. It's not supported to override the encryption settings values in the CreateSession request. So in the Zonal endpoint API calls (except CopyObject and UploadPartCopy), the encryption request headers must match the default encryption configuration of the directory bucket.

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:
Supported in: 8.0 and newer, Core 3.1

.NET Standard:
Supported in: 2.0

.NET Framework:
Supported in: 4.5 and newer, 3.5