• 沒有找到結果。

Sample GetBucketOwnershipControls Response

在文檔中 Amazon Simple Storage Service (頁 145-154)

Sample GetBucketOwnershipControls Response

This example illustrates one usage of GetBucketOwnershipControls.

HTTP/1.1 200 OK

x-amz-id-2: Adphn7MaAHDEg9mh5JmcTN8mzyVX0JhIztSiQNaqTxnXXcYi4uiZbYdwWC3JXmh/

XXVUUQwO4Vs=

x-amz-request-id: 252631E05F84A415 Date: Mon, 29 Nov 2021 00:17:22 GMT Server: AmazonS3

Content-Length: 194

<OwnershipControls xmlns="http://s3.amazonaws.com/doc/2006-03-01/">

<Rule>

<ObjectOwnership>BucketOwnerEnforced</ObjectOwnership>

</Rule>

</OwnershipControls>

Sample GetBucketOwnershipControls Request for BucketOwnerPreferred

This example illustrates one usage of GetBucketOwnershipControls.

GET /DOC-EXAMPLE-BUCKET?/ownershipControls HTTP/1.1 Host: DOC-EXAMPLE-BUCKET.s3.<Region>.amazonaws.com Date: Thu, 18 Jun 2017 00:17:22 GMT

Authorization: signatureValue;

Sample GetBucketOwnershipControls Response

This example illustrates one usage of GetBucketOwnershipControls.

HTTP/1.1 200 OK

x-amz-id-2: Adphn7MaAHDEg9mh5JmcTN8mzyVX0JhIztSiQNaqTxnXXcYi4uiZbYdwWC3JXmh/

XXVUUQwO4Vs=

x-amz-request-id: 252631E05F84A415 Date: Thu, 18 Jun 2020 00:17:22 GMT Server: AmazonS3

Content-Length: 194

<OwnershipControls xmlns="http://s3.amazonaws.com/doc/2006-03-01/">

<Rule>

<ObjectOwnership>BucketOwnerPreferred</ObjectOwnership>

</Rule>

</OwnershipControls>

See Also

For more information about using this API in one of the language-specific AWS SDKs, see the following:

• AWS Command Line Interface

• AWS SDK for .NET

• AWS SDK for C++

• AWS SDK for Go

• AWS SDK for Java V2

• AWS SDK for JavaScript

• AWS SDK for PHP V3

• AWS SDK for Python

• AWS SDK for Ruby V3

GetBucketPolicy

Service: Amazon S3

Returns the policy of a specified bucket. If you are using an identity other than the root user of the AWS 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.

Important

As a security precaution, the root user of the AWS 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:

• GetObject

Request Syntax

GET /?policy HTTP/1.1

Host: Bucket.s3.amazonaws.com

x-amz-expected-bucket-owner: ExpectedBucketOwner

URI Request Parameters

The request uses the following URI parameters.

Bucket (p. 143)

The bucket name for which to get the bucket policy.

Required: Yes

x-amz-expected-bucket-owner (p. 143)

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

Request Body

The request does not have a request body.

Response Syntax

HTTP/1.1 200

{ Policy in JSON format }

Response Elements

If the action is successful, the service sends back an HTTP 200 response.

The following data is returned in JSON format by the service.

<varlistentry> Policy (p. 143) </varlistentry>

Examples

Sample Request

The following request returns the policy of the specified bucket.

GET ?policy HTTP/1.1

This example illustrates one usage of GetBucketPolicy.

HTTP/1.1 200 OK

For more information about using this API in one of the language-specific AWS SDKs, see the following:

• AWS Command Line Interface

• AWS SDK for .NET

• AWS SDK for C++

• AWS SDK for Go

• AWS SDK for Java V2

• AWS SDK for JavaScript

• AWS SDK for PHP V3

• AWS SDK for Python

• AWS SDK for Ruby V3

GetBucketPolicyStatus

Service: Amazon S3

Retrieves the policy status for an Amazon S3 bucket, indicating whether the bucket is public. In order to use this operation, you must have the s3:GetBucketPolicyStatus permission. For more information about Amazon S3 permissions, see Specifying Permissions in a Policy.

For more information about when Amazon S3 considers a bucket public, see The Meaning of "Public".

The following operations are related to GetBucketPolicyStatus:

• Using Amazon S3 Block Public Access

• GetPublicAccessBlock

• PutPublicAccessBlock

• DeletePublicAccessBlock

Request Syntax

GET /?policyStatus HTTP/1.1 Host: Bucket.s3.amazonaws.com

x-amz-expected-bucket-owner: ExpectedBucketOwner

URI Request Parameters

The request uses the following URI parameters.

Bucket (p. 146)

The name of the Amazon S3 bucket whose policy status you want to retrieve.

Required: Yes

x-amz-expected-bucket-owner (p. 146)

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

Request Body

The request does not have a request body.

Response Syntax

HTTP/1.1 200

<?xml version="1.0" encoding="UTF-8"?>

<PolicyStatus>

<IsPublic>boolean</IsPublic>

</PolicyStatus>

Response Elements

If the action is successful, the service sends back an HTTP 200 response.

The following data is returned in XML format by the service.

PolicyStatus (p. 146)

Root level tag for the PolicyStatus parameters.

Required: Yes IsPublic (p. 146)

The policy status for this bucket. TRUE indicates that this bucket is public. FALSE indicates that the bucket is not public.

Type: Boolean

Examples

Sample Request

The following request gets a bucket policy status.

GET /<bucket-name>?policyStatus HTTP/1.1 Host: <bucket-name>.s3.<Region>.amazonaws.com x-amz-date: <Thu, 15 Nov 2016 00:17:21 GMT>

Authorization: <signatureValue>

Sample Response

This example illustrates one usage of GetBucketPolicyStatus.

HTTP/1.1 200 OK

x-amz-id-2: ITnGT1y4REXAMPLEPi4hklTXouTf0hccUjo0iCPEXAMPLEutBj3M7fPGlWO2SEWp x-amz-request-id: 51991EXAMPLE5321

Date: Thu, 15 Nov 2016 00:17:22 GMT Server: AmazonS3

Content-Length: 0 <PolicyStatus>

<IsPublic>TRUE</IsPublic>

</PolicyStatus>

See Also

For more information about using this API in one of the language-specific AWS SDKs, see the following:

• AWS Command Line Interface

• AWS SDK for .NET

• AWS SDK for C++

• AWS SDK for Go

• AWS SDK for Java V2

• AWS SDK for JavaScript

• AWS SDK for PHP V3

• AWS SDK for Python

• AWS SDK for Ruby V3

GetBucketReplication

Service: Amazon S3

Returns the replication configuration of a bucket.

NoteIt can take a while to propagate the put or delete a replication configuration to all Amazon S3 systems. Therefore, a get request soon after put or delete can return a wrong result.

For information about replication configuration, see Replication in the Amazon S3 User Guide.

This action requires permissions for the s3:GetReplicationConfiguration action. For more information about permissions, see Using Bucket Policies and User Policies.

If you include the Filter element in a replication configuration, you must also include the DeleteMarkerReplication and Priority elements. The response also returns those elements.

For information about GetBucketReplication errors, see List of replication-related error codes The following operations are related to GetBucketReplication:

• PutBucketReplication

• DeleteBucketReplication

Request Syntax

GET /?replication HTTP/1.1 Host: Bucket.s3.amazonaws.com

x-amz-expected-bucket-owner: ExpectedBucketOwner

URI Request Parameters

The request uses the following URI parameters.

Bucket (p. 148)

The bucket name for which to get the replication information.

Required: Yes

x-amz-expected-bucket-owner (p. 148)

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

Request Body

The request does not have a request body.

Response Syntax

HTTP/1.1 200

<?xml version="1.0" encoding="UTF-8"?>

<ReplicationConfiguration>

<Role>string</Role>

<Rule>

<DeleteMarkerReplication>

<Status>string</Status>

</DeleteMarkerReplication>

<Destination>

<ReplicaKmsKeyID>string</ReplicaKmsKeyID>

</EncryptionConfiguration>

<StorageClass>string</StorageClass>

</Destination>

<ExistingObjectReplication>

<Status>string</Status>

</ExistingObjectReplication>

<Filter>

<Prefix>string</Prefix>

<Priority>integer</Priority>

<SourceSelectionCriteria>

<ReplicaModifications>

</SourceSelectionCriteria>

<Status>string</Status>

</Rule>

...

</ReplicationConfiguration>

Response Elements

If the action is successful, the service sends back an HTTP 200 response.

The following data is returned in XML format by the service.

ReplicationConfiguration (p. 148)

Root level tag for the ReplicationConfiguration parameters.

Required: Yes Role (p. 148)

The Amazon Resource Name (ARN) of the AWS Identity and Access Management (IAM) role that Amazon S3 assumes when replicating objects. For more information, see How to Set Up Replication in the Amazon S3 User Guide.

Type: String Rule (p. 148)

A container for one or more replication rules. A replication configuration must have at least one rule and can contain a maximum of 1,000 rules.

Type: Array of ReplicationRule (p. 751) data types

Examples

在文檔中 Amazon Simple Storage Service (頁 145-154)