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 PutObject operation.
Namespace: Amazon.S3.Model
Assembly: AWSSDK.S3.dll
Version: 3.x.y.z
public class PutObjectResponse : AmazonWebServiceResponse
The PutObjectResponse type exposes the following members
| Name | Description | |
|---|---|---|
|
PutObjectResponse() |
| Name | Type | Description | |
|---|---|---|---|
|
BucketKeyEnabled | System.Nullable<System.Boolean> |
Gets and sets the property BucketKeyEnabled. Indicates whether the uploaded object uses an S3 Bucket Key for server-side encryption with Key Management Service (KMS) keys (SSE-KMS). |
|
ChecksumCRC32 | System.String |
Gets and sets the property ChecksumCRC32.
The Base64 encoded, 32-bit |
|
ChecksumCRC32C | System.String |
Gets and sets the property ChecksumCRC32C.
The Base64 encoded, 32-bit |
|
ChecksumCRC64NVME | System.String |
Gets and sets the property ChecksumCRC64NVME.
The Base64 encoded, 64-bit |
|
ChecksumSHA1 | System.String |
Gets and sets the property ChecksumSHA1.
The Base64 encoded, 160-bit |
|
ChecksumSHA256 | System.String |
Gets and sets the property ChecksumSHA256.
The Base64 encoded, 256-bit |
|
ChecksumType | Amazon.S3.ChecksumType |
Gets and sets the property ChecksumType.
This header specifies the checksum type of the object, which determines how part-level
checksums are combined to create an object-level checksum for multipart objects. For
|
|
ContentLength | System.Int64 | Inherited from Amazon.Runtime.AmazonWebServiceResponse. |
|
ETag | System.String |
Gets and sets the property ETag. Entity tag for the uploaded object. General purpose buckets - To ensure that data is not corrupted traversing the network, for objects where the ETag is the MD5 digest of the object, you can calculate the MD5 while putting an object to Amazon S3 and compare the returned ETag to the calculated MD5 value. Directory buckets - The ETag for the object in a directory bucket isn't the MD5 digest of the object. |
|
Expiration | Amazon.S3.Model.Expiration |
Gets and sets the property Expiration.
If the expiration is configured for the object (see PutBucketLifecycleConfiguration)
in the Amazon S3 User Guide, the response includes this header. It includes
the
Object expiration information is not returned in directory buckets and this header
returns the value " |
|
HttpStatusCode | System.Net.HttpStatusCode | Inherited from Amazon.Runtime.AmazonWebServiceResponse. |
|
RequestCharged | Amazon.S3.RequestCharged |
Gets and sets the property RequestCharged. |
|
ResponseMetadata | Amazon.Runtime.ResponseMetadata | Inherited from Amazon.Runtime.AmazonWebServiceResponse. |
|
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. |
|
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. |
|
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. This value is stored
as object metadata and automatically gets passed on to Amazon Web Services KMS for
future |
|
ServerSideEncryptionKeyManagementServiceKeyId | System.String |
Gets and sets the property ServerSideEncryptionKeyManagementServiceKeyId. If present, indicates the ID of the KMS key that was used for object encryption. |
|
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 |
|
Size | System.Nullable<System.Int64> |
Gets and sets the property Size. The size of the object in bytes. This value is only be present if you append to an object. This functionality is only supported for objects in the Amazon S3 Express One Zone storage class in directory buckets. |
|
VersionId | System.String |
Gets and sets the property VersionId. Version ID of the object. If you enable versioning for a bucket, Amazon S3 automatically generates a unique version ID for the object being stored. Amazon S3 returns this ID in the response. When you enable versioning for a bucket, if Amazon S3 receives multiple write requests for the same object simultaneously, it stores all of the objects. For more information about versioning, see Adding Objects to Versioning-Enabled Buckets in the Amazon S3 User Guide. For information about returning the versioning state of a bucket, see GetBucketVersioning. This functionality is not supported for directory buckets. |
This following examples show multiple ways of creating an object.
This example shows how to put an object, with its content being passed along as a string.
// Create a client
AmazonS3Client client = new AmazonS3Client();
// Create a PutObject request
PutObjectRequest request = new PutObjectRequest
{
BucketName = "amzn-s3-demo-bucket",
Key = "Item1",
ContentBody = "This is sample content..."
};
// Put object
PutObjectResponse response = await client.PutObjectAsync(request);
This example shows how to put an object, setting its content to be a file.
// Create a client
AmazonS3Client client = new AmazonS3Client();
// Create a PutObject request
PutObjectRequest request = new PutObjectRequest
{
BucketName = "amzn-s3-demo-bucket",
Key = "Item1",
FilePath = "contents.txt"
};
// Put object
PutObjectResponse response = await client.PutObjectAsync(request);
This example shows how to put an object using a stream.
// Create a client
AmazonS3Client client = new AmazonS3Client();
// Create a PutObject request
PutObjectRequest request = new PutObjectRequest
{
BucketName = "amzn-s3-demo-bucket",
Key = "Item1",
};
using (FileStream stream = new FileStream("contents.txt", FileMode.Open))
{
request.InputStream = stream;
// Put object
PutObjectResponse response = await client.PutObjectAsync(request);
}
.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