AWS SDK for .NET Documentation
SetACLResponse Class
AmazonAmazon.S3.ModelSetACLResponse Did this page help you?   Yes   No    Tell us about it...
The SetACLResponse contains any headers returned by S3.
Declaration Syntax
C#
public class SetACLResponse : S3Response
Members
All MembersConstructorsMethodsProperties



IconMemberDescription
SetACLResponse()()()()
Initializes a new instance of the SetACLResponse class

AmazonId2
Gets and sets the AmazonId2 property. This property corresponds to the x-amz-id-2 header in the HTTP response from the Amazon S3 service. The value of this header is used for internal troubleshooting purposes.
(Inherited from S3Response.)
Dispose()()()()
Disposes of all managed and unmanaged resources.
(Inherited from S3Response.)
Equals(Object)
Determines whether the specified Object is equal to the current Object.
(Inherited from Object.)
GetHashCode()()()()
Serves as a hash function for a particular type.
(Inherited from Object.)
GetType()()()()
Gets the type of the current instance.
(Inherited from Object.)
Headers
Gets and sets the Headers property.
(Overrides S3Response.Headers.)
Metadata
Gets and sets the Metadata property.
(Inherited from S3Response.)
RequestId
Gets and sets the RequestId property.
(Inherited from S3Response.)
ResponseStream
Gets and sets the ResponseStream property. This property only has a valid value for GetObjectResponses. In order to use this stream without leaking the underlying resource, please wrap access to the stream within a using block.
CopyC#
(Inherited from S3Response.)
ResponseXml
Gets and sets the ResponseXml property. This is the original xml response received from S3
(Inherited from S3Response.)
StatusCode
Gets the HTTP Status code from the service response.
(Inherited from S3Response.)
ToString()()()()
String Representation of this object. Overrides Object.ToString()
(Inherited from S3Response.)
VersionId
Gets and sets the VersionId property. This is the version-id of the S3 object

Examples

This example shows how to set a canned ACL on an object, first to PublicRead, then back to Private.

CopySetACL sample 1
// Create a client
AmazonS3Client client = new AmazonS3Client();

// Set Canned ACL (PublicRead) for an existing item
client.SetACL(new SetACLRequest
{
    BucketName = "SampleBucket",
    Key = "Item1",
    CannedACL = S3CannedACL.PublicRead
});

// Set Canned ACL (PublicRead) for an existing item
// (This reverts ACL back to default for object)
client.SetACL(new SetACLRequest
{
    BucketName = "SampleBucket",
    Key = "Item1",
    CannedACL = S3CannedACL.Private
});

This example shows how to get and set ACLs on an object.

CopyGetACL\SetACL samples
// Create a client
AmazonS3Client client = new AmazonS3Client();

// Retrieve ACL for object
S3AccessControlList acl = client.GetACL(new GetACLRequest
{
    BucketName = "SampleBucket",
    Key = "Item1",
}).AccessControlList;

// Retrieve owner
Owner owner = acl.Owner;


// Describe grant
S3Grant grant = new S3Grant
{
    Grantee = new S3Grantee { EmailAddress = "sample@example.com" },
    Permission = S3Permission.WRITE_ACP
};

// Create new ACL
S3AccessControlList newAcl = new S3AccessControlList
{
    Grants = new List<S3Grant> { grant },
    Owner = owner
};

// Set new ACL
SetACLResponse response = client.SetACL(new SetACLRequest
{
    BucketName = "SampleBucket",
    Key = "Item1",
    ACL = acl
});
Inheritance Hierarchy
Object
S3Response
 SetACLResponse

Assembly: AWSSDK (Module: AWSSDK) Version: 1.5.60.0 (1.5.60.0)