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.GetBucketPolicy

Description

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

Creating a Request

data GetBucketPolicy Source #

See: newGetBucketPolicy smart constructor.

Constructors

GetBucketPolicy' 

Fields

  • 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 bucket name for which to get the bucket policy.

Instances

Instances details
Eq GetBucketPolicy Source # 
Instance details

Defined in Amazonka.S3.GetBucketPolicy

Read GetBucketPolicy Source # 
Instance details

Defined in Amazonka.S3.GetBucketPolicy

Show GetBucketPolicy Source # 
Instance details

Defined in Amazonka.S3.GetBucketPolicy

Generic GetBucketPolicy Source # 
Instance details

Defined in Amazonka.S3.GetBucketPolicy

Associated Types

type Rep GetBucketPolicy :: Type -> Type #

NFData GetBucketPolicy Source # 
Instance details

Defined in Amazonka.S3.GetBucketPolicy

Methods

rnf :: GetBucketPolicy -> () #

Hashable GetBucketPolicy Source # 
Instance details

Defined in Amazonka.S3.GetBucketPolicy

AWSRequest GetBucketPolicy Source # 
Instance details

Defined in Amazonka.S3.GetBucketPolicy

Associated Types

type AWSResponse GetBucketPolicy #

ToHeaders GetBucketPolicy Source # 
Instance details

Defined in Amazonka.S3.GetBucketPolicy

ToPath GetBucketPolicy Source # 
Instance details

Defined in Amazonka.S3.GetBucketPolicy

ToQuery GetBucketPolicy Source # 
Instance details

Defined in Amazonka.S3.GetBucketPolicy

type Rep GetBucketPolicy Source # 
Instance details

Defined in Amazonka.S3.GetBucketPolicy

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

Defined in Amazonka.S3.GetBucketPolicy

newGetBucketPolicy Source #

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.

Constructors

GetBucketPolicyResponse' 

Fields

newGetBucketPolicyResponse Source #

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