| 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 |
Amazonka.S3.HeadBucket
Description
This action is useful to determine if a bucket exists and you have permission to access it. The action returns a 200 OK if the bucket exists and you have permission to access it.
If the bucket does not exist or you do not have permission to access it, the HEAD request returns a generic 404 Not Found or 403 Forbidden code. A message body is not included, so you cannot determine the exception beyond these error codes.
To use this operation, you must have permissions to perform the s3:ListBucket action. The bucket owner has this permission by default and can grant this permission to others. For more information about permissions, see Permissions Related to Bucket Subresource Operations and Managing Access Permissions to Your Amazon S3 Resources.
To use this API against an access point, you must provide the alias of the access point in place of the bucket name or specify the access point ARN. When using the access point ARN, you must direct requests to the access point hostname. The access point hostname takes the form AccessPointName-AccountId.s3-accesspoint.Region.amazonaws.com. When using the Amazon Web Services SDKs, you provide the ARN in place of the bucket name. For more information see, Using access points.
Synopsis
Creating a Request
data HeadBucket Source #
See: newHeadBucket smart constructor.
Constructors
| HeadBucket' | |
Fields
| |
Instances
Arguments
| :: BucketName | |
| -> HeadBucket |
Create a value of HeadBucket 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:HeadBucket', headBucket_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).
HeadBucket, headBucket_bucket - The bucket name.
When using this action with an access point, you must direct requests to the access point hostname. The access point hostname takes the form AccessPointName-AccountId.s3-accesspoint.Region.amazonaws.com. When using this action with an access point through the Amazon Web Services SDKs, you provide the access point ARN in place of the bucket name. For more information about access point ARNs, see Using access points in the Amazon S3 User Guide.
When using this action with Amazon S3 on Outposts, you must direct requests to the S3 on Outposts hostname. The S3 on Outposts hostname takes the form AccessPointName-AccountId.outpostID.s3-outposts.Region.amazonaws.com. When using this action with S3 on Outposts through the Amazon Web Services SDKs, you provide the Outposts bucket ARN in place of the bucket name. For more information about S3 on Outposts ARNs, see Using Amazon S3 on Outposts in the Amazon S3 User Guide.
Request Lenses
headBucket_expectedBucketOwner :: Lens' HeadBucket (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).
headBucket_bucket :: Lens' HeadBucket BucketName Source #
The bucket name.
When using this action with an access point, you must direct requests to the access point hostname. The access point hostname takes the form AccessPointName-AccountId.s3-accesspoint.Region.amazonaws.com. When using this action with an access point through the Amazon Web Services SDKs, you provide the access point ARN in place of the bucket name. For more information about access point ARNs, see Using access points in the Amazon S3 User Guide.
When using this action with Amazon S3 on Outposts, you must direct requests to the S3 on Outposts hostname. The S3 on Outposts hostname takes the form AccessPointName-AccountId.outpostID.s3-outposts.Region.amazonaws.com. When using this action with S3 on Outposts through the Amazon Web Services SDKs, you provide the Outposts bucket ARN in place of the bucket name. For more information about S3 on Outposts ARNs, see Using Amazon S3 on Outposts in the Amazon S3 User Guide.
Destructuring the Response
data HeadBucketResponse Source #
See: newHeadBucketResponse smart constructor.
Constructors
| HeadBucketResponse' | |
Instances
| Generic HeadBucketResponse Source # | |
Defined in Amazonka.S3.HeadBucket Associated Types type Rep HeadBucketResponse :: Type -> Type # Methods from :: HeadBucketResponse -> Rep HeadBucketResponse x # to :: Rep HeadBucketResponse x -> HeadBucketResponse # | |
| Read HeadBucketResponse Source # | |
Defined in Amazonka.S3.HeadBucket Methods readsPrec :: Int -> ReadS HeadBucketResponse # readList :: ReadS [HeadBucketResponse] # | |
| Show HeadBucketResponse Source # | |
Defined in Amazonka.S3.HeadBucket Methods showsPrec :: Int -> HeadBucketResponse -> ShowS # show :: HeadBucketResponse -> String # showList :: [HeadBucketResponse] -> ShowS # | |
| NFData HeadBucketResponse Source # | |
Defined in Amazonka.S3.HeadBucket Methods rnf :: HeadBucketResponse -> () # | |
| Eq HeadBucketResponse Source # | |
Defined in Amazonka.S3.HeadBucket Methods (==) :: HeadBucketResponse -> HeadBucketResponse -> Bool # (/=) :: HeadBucketResponse -> HeadBucketResponse -> Bool # | |
| type Rep HeadBucketResponse Source # | |
newHeadBucketResponse :: HeadBucketResponse Source #
Create a value of HeadBucketResponse with all optional fields omitted.
Use generic-lens or optics to modify other optional fields.