@Generated(value="jsii-pacmak/1.74.0 (build 6d08790)", date="2023-03-22T19:35:41.527Z") public class Bucket extends BucketBase
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();
Modifier and Type | Class and Description |
---|---|
static class |
Bucket.Builder
A fluent builder for
Bucket . |
IBucket.Jsii$Default
Modifier | Constructor and Description |
---|---|
protected |
Bucket(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) |
protected |
Bucket(software.amazon.jsii.JsiiObjectRef objRef) |
|
Bucket(software.constructs.Construct scope,
java.lang.String id) |
|
Bucket(software.constructs.Construct scope,
java.lang.String id,
BucketProps props) |
Modifier and Type | Method and Description |
---|---|
void |
addCorsRule(CorsRule rule)
Adds a cross-origin access configuration for objects in an Amazon S3 bucket.
|
void |
addInventory(Inventory inventory)
Add an inventory configuration.
|
void |
addLifecycleRule(LifecycleRule rule)
Add a lifecycle rule to the bucket.
|
void |
addMetric(BucketMetrics metric)
Adds a metrics configuration for the CloudWatch request metrics from the bucket.
|
static IBucket |
fromBucketArn(software.constructs.Construct scope,
java.lang.String id,
java.lang.String bucketArn) |
static IBucket |
fromBucketAttributes(software.constructs.Construct scope,
java.lang.String id,
BucketAttributes attrs)
Creates a Bucket construct that represents an external bucket.
|
static IBucket |
fromBucketName(software.constructs.Construct scope,
java.lang.String id,
java.lang.String bucketName) |
protected java.lang.Boolean |
getAutoCreatePolicy()
Indicates if a bucket resource policy should automatically created upon the first call to `addToResourcePolicy`.
|
java.lang.String |
getBucketArn()
The ARN of the bucket.
|
java.lang.String |
getBucketDomainName()
The IPv4 DNS name of the specified bucket.
|
java.lang.String |
getBucketDualStackDomainName()
The IPv6 DNS name of the specified bucket.
|
java.lang.String |
getBucketName()
The name of the bucket.
|
java.lang.String |
getBucketRegionalDomainName()
The regional domain name of the specified bucket.
|
java.lang.String |
getBucketWebsiteDomainName()
The Domain name of the static website.
|
java.lang.String |
getBucketWebsiteUrl()
The URL of the static website.
|
protected java.lang.Boolean |
getDisallowPublicAccess()
Whether to disallow public access.
|
IKey |
getEncryptionKey()
Optional KMS encryption key associated with this bucket.
|
java.lang.Boolean |
getIsWebsite()
If this bucket has been configured for static website hosting.
|
BucketPolicy |
getPolicy()
The resource policy associated with this bucket.
|
protected void |
setAutoCreatePolicy(java.lang.Boolean value)
Indicates if a bucket resource policy should automatically created upon the first call to `addToResourcePolicy`.
|
protected void |
setDisallowPublicAccess(java.lang.Boolean value)
Whether to disallow public access.
|
void |
setPolicy(BucketPolicy value)
The resource policy associated with this bucket.
|
static void |
validateBucketName(java.lang.String physicalName)
Thrown an exception if the given bucket name is not valid.
|
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, virtualHostedUrlForObject
applyRemovalPolicy, generatePhysicalName, getEnv, getPhysicalName, getResourceArnAttribute, getResourceNameAttribute, getStack, isResource
getNode, isConstruct, onPrepare, onSynthesize, onValidate, prepare, synthesize
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
applyRemovalPolicy, getEnv, getStack
getNode
protected Bucket(software.amazon.jsii.JsiiObjectRef objRef)
protected Bucket(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
public Bucket(software.constructs.Construct scope, java.lang.String id, BucketProps props)
scope
- This parameter is required.id
- This parameter is required.props
- public Bucket(software.constructs.Construct scope, java.lang.String id)
scope
- This parameter is required.id
- This parameter is required.public static IBucket fromBucketArn(software.constructs.Construct scope, java.lang.String id, java.lang.String bucketArn)
scope
- This parameter is required.id
- This parameter is required.bucketArn
- This parameter is required.public static IBucket fromBucketAttributes(software.constructs.Construct scope, java.lang.String id, BucketAttributes attrs)
scope
- The parent creating construct (usually `this`). This parameter is required.id
- The construct's name. This parameter is required.attrs
- A `BucketAttributes` object. This parameter is required.public static IBucket fromBucketName(software.constructs.Construct scope, java.lang.String id, java.lang.String bucketName)
scope
- This parameter is required.id
- This parameter is required.bucketName
- This parameter is required.public static void validateBucketName(java.lang.String physicalName)
physicalName
- name of the bucket. This parameter is required.public void addCorsRule(CorsRule rule)
rule
- The CORS configuration rule to add. This parameter is required.public void addInventory(Inventory inventory)
inventory
- configuration to add. This parameter is required.public void addLifecycleRule(LifecycleRule rule)
rule
- The rule to add. This parameter is required.public void addMetric(BucketMetrics metric)
metric
- The metric configuration to add. This parameter is required.public java.lang.String getBucketArn()
getBucketArn
in interface IBucket
getBucketArn
in class BucketBase
public java.lang.String getBucketDomainName()
getBucketDomainName
in interface IBucket
getBucketDomainName
in class BucketBase
public java.lang.String getBucketDualStackDomainName()
getBucketDualStackDomainName
in interface IBucket
getBucketDualStackDomainName
in class BucketBase
public java.lang.String getBucketName()
getBucketName
in interface IBucket
getBucketName
in class BucketBase
public java.lang.String getBucketRegionalDomainName()
getBucketRegionalDomainName
in interface IBucket
getBucketRegionalDomainName
in class BucketBase
public java.lang.String getBucketWebsiteDomainName()
getBucketWebsiteDomainName
in interface IBucket
getBucketWebsiteDomainName
in class BucketBase
public java.lang.String getBucketWebsiteUrl()
getBucketWebsiteUrl
in interface IBucket
getBucketWebsiteUrl
in class BucketBase
public IKey getEncryptionKey()
getEncryptionKey
in interface IBucket
getEncryptionKey
in class BucketBase
public java.lang.Boolean getIsWebsite()
getIsWebsite
in interface IBucket
getIsWebsite
in class BucketBase
protected java.lang.Boolean getAutoCreatePolicy()
getAutoCreatePolicy
in class BucketBase
protected void setAutoCreatePolicy(java.lang.Boolean value)
setAutoCreatePolicy
in class BucketBase
protected java.lang.Boolean getDisallowPublicAccess()
getDisallowPublicAccess
in class BucketBase
protected void setDisallowPublicAccess(java.lang.Boolean value)
setDisallowPublicAccess
in class BucketBase
public BucketPolicy getPolicy()
If autoCreatePolicy
is true, a BucketPolicy
will be created upon the
first call to addToResourcePolicy(s).
getPolicy
in interface IBucket
getPolicy
in class BucketBase
public void setPolicy(BucketPolicy value)
If autoCreatePolicy
is true, a BucketPolicy
will be created upon the
first call to addToResourcePolicy(s).
setPolicy
in interface IBucket
setPolicy
in class BucketBase