DeleteBucketPolicyResponse Class

.NET Framework 4.5
 
 
 
Did this page help you?  Yes  No   Tell us about it...
Returns information about the DeleteBucketPolicy response metadata. The DeleteBucketPolicy operation has a void result type.

Inheritance Hierarchy

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

Namespace: Amazon.S3.Model
Assembly: AWSSDK.dll
Version: 2.0.0.3

Syntax

C#
public class DeleteBucketPolicyResponse : AmazonWebServiceResponse

The DeleteBucketPolicyResponse type exposes the following members

Constructors

  Name Description
Public Method DeleteBucketPolicyResponse()

Properties

  Name Description
Public Property ContentLength Returns the content length of the HTTP response.
Public Property HttpStatusCode Returns the status code of the HTTP response.
Public Property ResponseMetadata Contains additional information about the request, such as the Request Id.

Examples

This example shows how to Get, Put and Delete bucket policies.

BucketPolicy samples


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

                // Put sample bucket policy (overwrite an existing policy)
                string newPolicy = @"{ 
    ""Statement"":[{ 
    ""Sid"":""BasicPerms"", 
    ""Effect"":""Allow"", 
    ""Principal"": { ""AWS"": ""*"" }, 
    ""Action"":[""s3:PutObject"",""s3:GetObject""], 
    ""Resource"":[""arn:aws:s3:::samplebucketname/*""] 
}]}";
                PutBucketPolicyRequest putRequest = new PutBucketPolicyRequest
                {
                    BucketName = "SampleBucket",
                    Policy = newPolicy
                };
                client.PutBucketPolicy(putRequest);


                // Retrieve current policy
                GetBucketPolicyRequest getRequest = new GetBucketPolicyRequest
                {
                    BucketName = "SampleBucket"
                };
                string policy = client.GetBucketPolicy(getRequest).Policy;

                Console.WriteLine(policy);
                Debug.Assert(policy.Contains("BasicPerms"));


                // Delete current policy
                DeleteBucketPolicyRequest deleteRequest = new DeleteBucketPolicyRequest
                {
                    BucketName = "SampleBucket"
                };
                client.DeleteBucketPolicy(deleteRequest);


                // Retrieve current policy and verify that it is null
                policy = client.GetBucketPolicy(getRequest).Policy;
                Debug.Assert(policy == null);

                

Version Information

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

.NET for Windows Store apps:
Supported in: Windows 8

.NET for Windows Phone:
Supported in: Window Phone 8