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 |
Returns the policy of a specified 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 GetBucketPolicy
permissions on the specified bucket and belong to the bucket owner's
account in order to use this operation.
If you don't have GetBucketPolicy
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 about bucket policies, see Using Bucket Policies and User Policies.
The following action is related to GetBucketPolicy
:
Synopsis
- data GetBucketPolicy = GetBucketPolicy' {}
- newGetBucketPolicy :: BucketName -> GetBucketPolicy
- getBucketPolicy_expectedBucketOwner :: Lens' GetBucketPolicy (Maybe Text)
- getBucketPolicy_bucket :: Lens' GetBucketPolicy BucketName
- data GetBucketPolicyResponse = GetBucketPolicyResponse' {
- httpStatus :: Int
- policy :: ByteString
- newGetBucketPolicyResponse :: Int -> ByteString -> GetBucketPolicyResponse
- getBucketPolicyResponse_httpStatus :: Lens' GetBucketPolicyResponse Int
- getBucketPolicyResponse_policy :: Lens' GetBucketPolicyResponse ByteString
Creating a Request
data GetBucketPolicy Source #
See: newGetBucketPolicy
smart constructor.
GetBucketPolicy' | |
|
Instances
Create a value of GetBucketPolicy
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:expectedBucketOwner:GetBucketPolicy'
, getBucketPolicy_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:GetBucketPolicy'
, getBucketPolicy_bucket
- The bucket name for which to get the bucket policy.
Request Lenses
getBucketPolicy_expectedBucketOwner :: Lens' GetBucketPolicy (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.
getBucketPolicy_bucket :: Lens' GetBucketPolicy BucketName Source #
The bucket name for which to get the bucket policy.
Destructuring the Response
data GetBucketPolicyResponse Source #
See: newGetBucketPolicyResponse
smart constructor.
GetBucketPolicyResponse' | |
|
Instances
newGetBucketPolicyResponse Source #
:: Int | |
-> ByteString | |
-> GetBucketPolicyResponse |
Create a value of GetBucketPolicyResponse
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:httpStatus:GetBucketPolicyResponse'
, getBucketPolicyResponse_httpStatus
- The response's http status code.
$sel:policy:GetBucketPolicyResponse'
, getBucketPolicyResponse_policy
- The bucket policy as a JSON document.
Response Lenses
getBucketPolicyResponse_httpStatus :: Lens' GetBucketPolicyResponse Int Source #
The response's http status code.
getBucketPolicyResponse_policy :: Lens' GetBucketPolicyResponse ByteString Source #
The bucket policy as a JSON document.