Class Bucket
java.lang.Object
software.amazon.jsii.JsiiObject
software.constructs.Construct
software.amazon.awscdk.core.Construct
software.amazon.awscdk.core.Resource
software.amazon.awscdk.services.s3.BucketBase
software.amazon.awscdk.services.s3.Bucket
- All Implemented Interfaces:
IConstruct,IDependable,IResource,IBucket,software.amazon.jsii.JsiiSerializable,software.constructs.IConstruct
@Generated(value="jsii-pacmak/1.84.0 (build 5404dcf)",
date="2023-06-19T16:30:37.488Z")
@Stability(Stable)
public class Bucket
extends BucketBase
An S3 bucket with associated policy objects.
This bucket does not yet have all features that exposed by the underlying BucketResource.
Example:
Repository ecrRepository;
Project.Builder.create(this, "Project")
.environment(BuildEnvironment.builder()
.buildImage(WindowsBuildImage.fromEcrRepository(ecrRepository, "v1.0", WindowsImageType.SERVER_2019))
// optional certificate to include in the build image
.certificate(BuildEnvironmentCertificate.builder()
.bucket(Bucket.fromBucketName(this, "Bucket", "my-bucket"))
.objectKey("path/to/cert.pem")
.build())
.build())
.build();
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class software.amazon.jsii.JsiiObject
software.amazon.jsii.JsiiObject.InitializationModeNested classes/interfaces inherited from interface software.amazon.awscdk.services.s3.IBucket
IBucket.Jsii$DefaultNested classes/interfaces inherited from interface software.amazon.awscdk.core.IConstruct
IConstruct.Jsii$DefaultNested classes/interfaces inherited from interface software.constructs.IConstruct
software.constructs.IConstruct.Jsii$DefaultNested classes/interfaces inherited from interface software.amazon.awscdk.core.IResource
IResource.Jsii$Default -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedBucket(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) protectedBucket(software.amazon.jsii.JsiiObjectRef objRef) Bucket(software.constructs.Construct scope, String id, BucketProps props) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddCorsRule(CorsRule rule) Adds a cross-origin access configuration for objects in an Amazon S3 bucket.voidaddInventory(Inventory inventory) Add an inventory configuration.voidAdd a lifecycle rule to the bucket.voidaddMetric(BucketMetrics metric) Adds a metrics configuration for the CloudWatch request metrics from the bucket.static IBucketfromBucketArn(software.constructs.Construct scope, String id, String bucketArn) static IBucketfromBucketAttributes(software.constructs.Construct scope, String id, BucketAttributes attrs) Creates a Bucket construct that represents an external bucket.static IBucketfromBucketName(software.constructs.Construct scope, String id, String bucketName) protected BooleanIndicates if a bucket resource policy should automatically created upon the first call toaddToResourcePolicy.The ARN of the bucket.The IPv4 DNS name of the specified bucket.The IPv6 DNS name of the specified bucket.The name of the bucket.The regional domain name of the specified bucket.The Domain name of the static website.The URL of the static website.protected BooleanWhether to disallow public access.Optional KMS encryption key associated with this bucket.If this bucket has been configured for static website hosting.The resource policy associated with this bucket.protected voidsetAutoCreatePolicy(Boolean value) Indicates if a bucket resource policy should automatically created upon the first call toaddToResourcePolicy.protected voidsetDisallowPublicAccess(Boolean value) Whether to disallow public access.voidsetPolicy(BucketPolicy value) The resource policy associated with this bucket.static voidvalidateBucketName(String physicalName) Thrown an exception if the given bucket name is not valid.Methods inherited from class software.amazon.awscdk.services.s3.BucketBase
addEventNotification, addObjectCreatedNotification, addObjectRemovedNotification, addToResourcePolicy, arnForObjects, enableEventBridgeNotification, getNotificationsHandlerRole, grantDelete, grantDelete, grantPublicAccess, grantPut, grantPut, grantPutAcl, grantPutAcl, grantRead, grantRead, grantReadWrite, grantReadWrite, grantWrite, grantWrite, onCloudTrailEvent, onCloudTrailEvent, onCloudTrailPutObject, onCloudTrailPutObject, onCloudTrailWriteObject, onCloudTrailWriteObject, s3UrlForObject, s3UrlForObject, setNotificationsHandlerRole, transferAccelerationUrlForObject, transferAccelerationUrlForObject, transferAccelerationUrlForObject, urlForObject, urlForObject, validate, virtualHostedUrlForObject, virtualHostedUrlForObject, virtualHostedUrlForObjectMethods inherited from class software.amazon.awscdk.core.Resource
applyRemovalPolicy, generatePhysicalName, getEnv, getPhysicalName, getResourceArnAttribute, getResourceNameAttribute, getStack, isResourceMethods inherited from class software.amazon.awscdk.core.Construct
getNode, isConstruct, onPrepare, onSynthesize, onValidate, prepare, synthesizeMethods inherited from class software.constructs.Construct
toStringMethods inherited from class software.amazon.jsii.JsiiObject
jsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSetMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface software.amazon.awscdk.core.IConstruct
getNodeMethods inherited from interface software.amazon.awscdk.core.IResource
applyRemovalPolicy, getEnv, getStackMethods inherited from interface software.amazon.jsii.JsiiSerializable
$jsii$toJson
-
Constructor Details
-
Bucket
protected Bucket(software.amazon.jsii.JsiiObjectRef objRef) -
Bucket
protected Bucket(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) -
Bucket
@Stability(Stable) public Bucket(@NotNull software.constructs.Construct scope, @NotNull String id, @Nullable BucketProps props) - Parameters:
scope- This parameter is required.id- This parameter is required.props-
-
Bucket
- Parameters:
scope- This parameter is required.id- This parameter is required.
-
-
Method Details
-
fromBucketArn
@Stability(Stable) @NotNull public static IBucket fromBucketArn(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull String bucketArn) - Parameters:
scope- This parameter is required.id- This parameter is required.bucketArn- This parameter is required.
-
fromBucketAttributes
@Stability(Stable) @NotNull public static IBucket fromBucketAttributes(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull BucketAttributes attrs) Creates a Bucket construct that represents an external bucket.- Parameters:
scope- The parent creating construct (usuallythis). This parameter is required.id- The construct's name. This parameter is required.attrs- ABucketAttributesobject. This parameter is required.
-
fromBucketName
@Stability(Stable) @NotNull public static IBucket fromBucketName(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull String bucketName) - Parameters:
scope- This parameter is required.id- This parameter is required.bucketName- This parameter is required.
-
validateBucketName
Thrown an exception if the given bucket name is not valid.- Parameters:
physicalName- name of the bucket. This parameter is required.
-
addCorsRule
Adds a cross-origin access configuration for objects in an Amazon S3 bucket.- Parameters:
rule- The CORS configuration rule to add. This parameter is required.
-
addInventory
Add an inventory configuration.- Parameters:
inventory- configuration to add. This parameter is required.
-
addLifecycleRule
Add a lifecycle rule to the bucket.- Parameters:
rule- The rule to add. This parameter is required.
-
addMetric
Adds a metrics configuration for the CloudWatch request metrics from the bucket.- Parameters:
metric- The metric configuration to add. This parameter is required.
-
getBucketArn
The ARN of the bucket.- Specified by:
getBucketArnin interfaceIBucket- Specified by:
getBucketArnin classBucketBase
-
getBucketDomainName
The IPv4 DNS name of the specified bucket.- Specified by:
getBucketDomainNamein interfaceIBucket- Specified by:
getBucketDomainNamein classBucketBase
-
getBucketDualStackDomainName
The IPv6 DNS name of the specified bucket.- Specified by:
getBucketDualStackDomainNamein interfaceIBucket- Specified by:
getBucketDualStackDomainNamein classBucketBase
-
getBucketName
The name of the bucket.- Specified by:
getBucketNamein interfaceIBucket- Specified by:
getBucketNamein classBucketBase
-
getBucketRegionalDomainName
The regional domain name of the specified bucket.- Specified by:
getBucketRegionalDomainNamein interfaceIBucket- Specified by:
getBucketRegionalDomainNamein classBucketBase
-
getBucketWebsiteDomainName
The Domain name of the static website.- Specified by:
getBucketWebsiteDomainNamein interfaceIBucket- Specified by:
getBucketWebsiteDomainNamein classBucketBase
-
getBucketWebsiteUrl
The URL of the static website.- Specified by:
getBucketWebsiteUrlin interfaceIBucket- Specified by:
getBucketWebsiteUrlin classBucketBase
-
getEncryptionKey
Optional KMS encryption key associated with this bucket.- Specified by:
getEncryptionKeyin interfaceIBucket- Specified by:
getEncryptionKeyin classBucketBase
-
getIsWebsite
If this bucket has been configured for static website hosting.- Specified by:
getIsWebsitein interfaceIBucket- Specified by:
getIsWebsitein classBucketBase
-
getAutoCreatePolicy
Indicates if a bucket resource policy should automatically created upon the first call toaddToResourcePolicy.- Specified by:
getAutoCreatePolicyin classBucketBase
-
setAutoCreatePolicy
Indicates if a bucket resource policy should automatically created upon the first call toaddToResourcePolicy.- Specified by:
setAutoCreatePolicyin classBucketBase
-
getDisallowPublicAccess
Whether to disallow public access.- Specified by:
getDisallowPublicAccessin classBucketBase
-
setDisallowPublicAccess
Whether to disallow public access.- Specified by:
setDisallowPublicAccessin classBucketBase
-
getPolicy
The resource policy associated with this bucket.If
autoCreatePolicyis true, aBucketPolicywill be created upon the first call to addToResourcePolicy(s).- Specified by:
getPolicyin interfaceIBucket- Specified by:
getPolicyin classBucketBase
-
setPolicy
The resource policy associated with this bucket.If
autoCreatePolicyis true, aBucketPolicywill be created upon the first call to addToResourcePolicy(s).- Specified by:
setPolicyin interfaceIBucket- Specified by:
setPolicyin classBucketBase
-