Copyright | (c) 2013-2023 Brendan Hay |
---|---|
License | Mozilla Public License, v. 2.0. |
Maintainer | Brendan Hay |
Stability | auto-generated |
Portability | non-portable (GHC extensions) |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
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_checksumAlgorithm :: Lens' PutBucketPolicy (Maybe ChecksumAlgorithm)
- 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
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:
PutBucketPolicy
, putBucketPolicy_checksumAlgorithm
- Indicates the algorithm used to create the checksum for the object when
using the SDK. This header will not provide any additional functionality
if not using the SDK. When sending this header, there must be a
corresponding x-amz-checksum
or x-amz-trailer
header sent.
Otherwise, Amazon S3 fails the request with the HTTP status code
400 Bad Request
. For more information, see
Checking object integrity
in the Amazon S3 User Guide.
If you provide an individual checksum, Amazon S3 ignores any provided
ChecksumAlgorithm
parameter.
$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 fails with the HTTP status code
403 Forbidden
(access denied).
PutBucketPolicy
, putBucketPolicy_bucket
- The name of the bucket.
$sel:policy:PutBucketPolicy'
, putBucketPolicy_policy
- The bucket policy as a JSON document.
Request Lenses
putBucketPolicy_checksumAlgorithm :: Lens' PutBucketPolicy (Maybe ChecksumAlgorithm) Source #
Indicates the algorithm used to create the checksum for the object when
using the SDK. This header will not provide any additional functionality
if not using the SDK. When sending this header, there must be a
corresponding x-amz-checksum
or x-amz-trailer
header sent.
Otherwise, Amazon S3 fails the request with the HTTP status code
400 Bad Request
. For more information, see
Checking object integrity
in the Amazon S3 User Guide.
If you provide an individual checksum, Amazon S3 ignores any provided
ChecksumAlgorithm
parameter.
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 fails with the HTTP status code
403 Forbidden
(access denied).
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
Generic PutBucketPolicyResponse Source # | |
Defined in Amazonka.S3.PutBucketPolicy type Rep PutBucketPolicyResponse :: Type -> Type # | |
Read PutBucketPolicyResponse Source # | |
Show PutBucketPolicyResponse Source # | |
Defined in Amazonka.S3.PutBucketPolicy showsPrec :: Int -> PutBucketPolicyResponse -> ShowS # show :: PutBucketPolicyResponse -> String # showList :: [PutBucketPolicyResponse] -> ShowS # | |
NFData PutBucketPolicyResponse Source # | |
Defined in Amazonka.S3.PutBucketPolicy rnf :: PutBucketPolicyResponse -> () # | |
Eq PutBucketPolicyResponse Source # | |
Defined in Amazonka.S3.PutBucketPolicy | |
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.