libZSservicesZSamazonka-s3ZSamazonka-s3
Copyright(c) 2013-2021 Brendan Hay
LicenseMozilla Public License, v. 2.0.
MaintainerBrendan Hay <brendan.g.hay+amazonka@gmail.com>
Stabilityauto-generated
Portabilitynon-portable (GHC extensions)
Safe HaskellNone

Amazonka.S3.PutBucketPolicy

Description

Applies an Amazon S3 bucket policy to an Amazon S3 bucket. If you are using an identity other than the root user of the Amazon Web Services account that owns the bucket, the calling identity must have the PutBucketPolicy permissions on the specified bucket and belong to the bucket owner's account in order to use this operation.

If you don't have PutBucketPolicy permissions, Amazon S3 returns a 403 Access Denied error. If you have the correct permissions, but you're not using an identity that belongs to the bucket owner's account, Amazon S3 returns a 405 Method Not Allowed error.

As a security precaution, the root user of the Amazon Web Services account that owns a bucket can always use this operation, even if the policy explicitly denies the root user the ability to perform this action.

For more information, see Bucket policy examples.

The following operations are related to PutBucketPolicy:

Synopsis

Creating a Request

data PutBucketPolicy Source #

See: newPutBucketPolicy smart constructor.

Constructors

PutBucketPolicy' 

Fields

  • confirmRemoveSelfBucketAccess :: Maybe Bool

    Set this parameter to true to confirm that you want to remove your permissions to change this bucket policy in the future.

  • contentMD5 :: Maybe Text

    The MD5 hash of the request body.

    For requests made using the Amazon Web Services Command Line Interface (CLI) or Amazon Web Services SDKs, this field is calculated automatically.

  • expectedBucketOwner :: Maybe Text

    The account ID of the expected bucket owner. If the bucket is owned by a different account, the request will fail with an HTTP 403 (Access Denied) error.

  • bucket :: BucketName

    The name of the bucket.

  • policy :: ByteString

    The bucket policy as a JSON document.

Instances

Instances details
Eq PutBucketPolicy Source # 
Instance details

Defined in Amazonka.S3.PutBucketPolicy

Show PutBucketPolicy Source # 
Instance details

Defined in Amazonka.S3.PutBucketPolicy

Generic PutBucketPolicy Source # 
Instance details

Defined in Amazonka.S3.PutBucketPolicy

Associated Types

type Rep PutBucketPolicy :: Type -> Type #

NFData PutBucketPolicy Source # 
Instance details

Defined in Amazonka.S3.PutBucketPolicy

Methods

rnf :: PutBucketPolicy -> () #

Hashable PutBucketPolicy Source # 
Instance details

Defined in Amazonka.S3.PutBucketPolicy

AWSRequest PutBucketPolicy Source # 
Instance details

Defined in Amazonka.S3.PutBucketPolicy

Associated Types

type AWSResponse PutBucketPolicy #

ToBody PutBucketPolicy Source # 
Instance details

Defined in Amazonka.S3.PutBucketPolicy

ToHeaders PutBucketPolicy Source # 
Instance details

Defined in Amazonka.S3.PutBucketPolicy

ToPath PutBucketPolicy Source # 
Instance details

Defined in Amazonka.S3.PutBucketPolicy

ToQuery PutBucketPolicy Source # 
Instance details

Defined in Amazonka.S3.PutBucketPolicy

type Rep PutBucketPolicy Source # 
Instance details

Defined in Amazonka.S3.PutBucketPolicy

type Rep PutBucketPolicy = D1 ('MetaData "PutBucketPolicy" "Amazonka.S3.PutBucketPolicy" "libZSservicesZSamazonka-s3ZSamazonka-s3" 'False) (C1 ('MetaCons "PutBucketPolicy'" 'PrefixI 'True) ((S1 ('MetaSel ('Just "confirmRemoveSelfBucketAccess") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe Bool)) :*: S1 ('MetaSel ('Just "contentMD5") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe Text))) :*: (S1 ('MetaSel ('Just "expectedBucketOwner") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe Text)) :*: (S1 ('MetaSel ('Just "bucket") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 BucketName) :*: S1 ('MetaSel ('Just "policy") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 ByteString)))))
type AWSResponse PutBucketPolicy Source # 
Instance details

Defined in Amazonka.S3.PutBucketPolicy

newPutBucketPolicy Source #

Create a value of PutBucketPolicy with all optional fields omitted.

Use generic-lens or optics to modify other optional fields.

The following record fields are available, with the corresponding lenses provided for backwards compatibility:

$sel:confirmRemoveSelfBucketAccess:PutBucketPolicy', putBucketPolicy_confirmRemoveSelfBucketAccess - Set this parameter to true to confirm that you want to remove your permissions to change this bucket policy in the future.

$sel:contentMD5:PutBucketPolicy', putBucketPolicy_contentMD5 - The MD5 hash of the request body.

For requests made using the Amazon Web Services Command Line Interface (CLI) or Amazon Web Services SDKs, this field is calculated automatically.

$sel:expectedBucketOwner:PutBucketPolicy', putBucketPolicy_expectedBucketOwner - The account ID of the expected bucket owner. If the bucket is owned by a different account, the request will fail with an HTTP 403 (Access Denied) error.

$sel:bucket:PutBucketPolicy', putBucketPolicy_bucket - The name of the bucket.

$sel:policy:PutBucketPolicy', putBucketPolicy_policy - The bucket policy as a JSON document.

Request Lenses

putBucketPolicy_confirmRemoveSelfBucketAccess :: Lens' PutBucketPolicy (Maybe Bool) Source #

Set this parameter to true to confirm that you want to remove your permissions to change this bucket policy in the future.

putBucketPolicy_contentMD5 :: Lens' PutBucketPolicy (Maybe Text) Source #

The MD5 hash of the request body.

For requests made using the Amazon Web Services Command Line Interface (CLI) or Amazon Web Services SDKs, this field is calculated automatically.

putBucketPolicy_expectedBucketOwner :: Lens' PutBucketPolicy (Maybe Text) Source #

The account ID of the expected bucket owner. If the bucket is owned by a different account, the request will fail with an HTTP 403 (Access Denied) error.

putBucketPolicy_policy :: Lens' PutBucketPolicy ByteString Source #

The bucket policy as a JSON document.

Destructuring the Response

data PutBucketPolicyResponse Source #

See: newPutBucketPolicyResponse smart constructor.

Instances

Instances details
Eq PutBucketPolicyResponse Source # 
Instance details

Defined in Amazonka.S3.PutBucketPolicy

Read PutBucketPolicyResponse Source # 
Instance details

Defined in Amazonka.S3.PutBucketPolicy

Show PutBucketPolicyResponse Source # 
Instance details

Defined in Amazonka.S3.PutBucketPolicy

Generic PutBucketPolicyResponse Source # 
Instance details

Defined in Amazonka.S3.PutBucketPolicy

Associated Types

type Rep PutBucketPolicyResponse :: Type -> Type #

NFData PutBucketPolicyResponse Source # 
Instance details

Defined in Amazonka.S3.PutBucketPolicy

Methods

rnf :: PutBucketPolicyResponse -> () #

type Rep PutBucketPolicyResponse Source # 
Instance details

Defined in Amazonka.S3.PutBucketPolicy

type Rep PutBucketPolicyResponse = D1 ('MetaData "PutBucketPolicyResponse" "Amazonka.S3.PutBucketPolicy" "libZSservicesZSamazonka-s3ZSamazonka-s3" 'False) (C1 ('MetaCons "PutBucketPolicyResponse'" 'PrefixI 'False) (U1 :: Type -> Type))

newPutBucketPolicyResponse :: PutBucketPolicyResponse Source #

Create a value of PutBucketPolicyResponse with all optional fields omitted.

Use generic-lens or optics to modify other optional fields.