Copyright | (c) 2013-2021 Brendan Hay |
---|---|
License | Mozilla Public License, v. 2.0. |
Maintainer | Brendan Hay <brendan.g.hay+amazonka@gmail.com> |
Stability | auto-generated |
Portability | non-portable (GHC extensions) |
Safe Haskell | None |
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
- data PutBucketPolicy = PutBucketPolicy' {}
- newPutBucketPolicy :: BucketName -> ByteString -> PutBucketPolicy
- putBucketPolicy_confirmRemoveSelfBucketAccess :: Lens' PutBucketPolicy (Maybe Bool)
- putBucketPolicy_contentMD5 :: Lens' PutBucketPolicy (Maybe Text)
- putBucketPolicy_expectedBucketOwner :: Lens' PutBucketPolicy (Maybe Text)
- putBucketPolicy_bucket :: Lens' PutBucketPolicy BucketName
- putBucketPolicy_policy :: Lens' PutBucketPolicy ByteString
- data PutBucketPolicyResponse = PutBucketPolicyResponse' {
- newPutBucketPolicyResponse :: PutBucketPolicyResponse
Creating a Request
data PutBucketPolicy Source #
See: newPutBucketPolicy
smart constructor.
PutBucketPolicy' | |
|
Instances
:: BucketName | |
-> ByteString | |
-> PutBucketPolicy |
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_bucket :: Lens' PutBucketPolicy BucketName Source #
The name of the bucket.
putBucketPolicy_policy :: Lens' PutBucketPolicy ByteString Source #
The bucket policy as a JSON document.
Destructuring the Response
data PutBucketPolicyResponse Source #
See: newPutBucketPolicyResponse
smart constructor.
Instances
Eq PutBucketPolicyResponse Source # | |
Defined in Amazonka.S3.PutBucketPolicy | |
Read PutBucketPolicyResponse Source # | |
Show PutBucketPolicyResponse Source # | |
Defined in Amazonka.S3.PutBucketPolicy showsPrec :: Int -> PutBucketPolicyResponse -> ShowS # show :: PutBucketPolicyResponse -> String # showList :: [PutBucketPolicyResponse] -> ShowS # | |
Generic PutBucketPolicyResponse Source # | |
Defined in Amazonka.S3.PutBucketPolicy type Rep PutBucketPolicyResponse :: Type -> Type # | |
NFData PutBucketPolicyResponse Source # | |
Defined in Amazonka.S3.PutBucketPolicy rnf :: PutBucketPolicyResponse -> () # | |
type Rep PutBucketPolicyResponse Source # | |
newPutBucketPolicyResponse :: PutBucketPolicyResponse Source #
Create a value of PutBucketPolicyResponse
with all optional fields omitted.
Use generic-lens or optics to modify other optional fields.