com.amazonaws.auth.policy.resources.S3BucketResource Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of aws-java-sdk-s3 Show documentation
Show all versions of aws-java-sdk-s3 Show documentation
The AWS Java SDK for Amazon S3 module holds the client classes that are used for communicating with Amazon Simple Storage Service
/*
* Copyright 2010-2024 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
package com.amazonaws.auth.policy.resources;
import com.amazonaws.auth.policy.Resource;
import com.amazonaws.auth.policy.actions.S3Actions;
/**
* Represents a bucket resource involved in an Amazon Web Services access control policy. This
* resource does not include any of the objects stored in the bucket. It
* represents only the bucket itself. This is the resource you want if
* you're writing a policy that restricts access to listing the contents of a
* bucket, deleting a bucket, setting bucket configuration options, or any other
* action that operates directly against a bucket (as opposed to an object).
*
* If you want to write a policy that controls access to objects stored in your
* bucket, see {@link S3ObjectResource}.
*
* Amazon S3 bucket resources can be used in policies with the following
* actions:
*
* - {@link S3Actions#CreateBucket}
*
- {@link S3Actions#DeleteBucket}
*
- {@link S3Actions#ListObjects}
*
- {@link S3Actions#ListObjectVersions}
*
- {@link S3Actions#ListBuckets}
*
- {@link S3Actions#GetBucketAcl}
*
- {@link S3Actions#SetBucketAcl}
*
- {@link S3Actions#GetBucketVersioningConfiguration}
*
- {@link S3Actions#SetBucketVersioningConfiguration}
*
- {@link S3Actions#GetBucketRequesterPays}
*
- {@link S3Actions#SetBucketRequesterPays}
*
- {@link S3Actions#GetBucketLocation}
*
- {@link S3Actions#GetBucketPolicy}
*
- {@link S3Actions#SetBucketPolicy}
*
- {@link S3Actions#SetBucketNotificationConfiguration}
*
- {@link S3Actions#GetBucketNotificationConfiguration}
*
*/
public class S3BucketResource extends Resource {
/**
* Constructs a new bucket resource that represents the the specified bucket
* but not any of the contained objects.
*
* @param bucketName
* The name of the bucket represented by this Amazon Web Services access control
* policy resource.
*/
public S3BucketResource(String bucketName) {
this("aws", bucketName);
}
/**
* Constructs a new bucket resource that represents the the specified bucket
* but not any of the contained objects.
*
* @param partitionName
* The name of the partition in which the specified bucket is located.
* @param bucketName
* The name of the bucket represented by this Amazon Web Services access control
* policy resource.
*/
public S3BucketResource(String partitionName, String bucketName) {
super(String.format("arn:%s:s3:::%s", partitionName, bucketName));
}
}