@@ -5,7 +5,7 @@ import * as iam from '@aws-cdk/aws-iam';
5
5
import * as kms from '@aws-cdk/aws-kms' ;
6
6
import {
7
7
Fn , IResource , Lazy , RemovalPolicy , Resource , ResourceProps , Stack , Token ,
8
- CustomResource , CustomResourceProvider , CustomResourceProviderRuntime , FeatureFlags , Tags ,
8
+ CustomResource , CustomResourceProvider , CustomResourceProviderRuntime , FeatureFlags , Tags , Duration ,
9
9
} from '@aws-cdk/core' ;
10
10
import * as cxapi from '@aws-cdk/cx-api' ;
11
11
import { Construct } from 'constructs' ;
@@ -1222,6 +1222,48 @@ export enum ObjectOwnership {
1222
1222
*/
1223
1223
OBJECT_WRITER = 'ObjectWriter' ,
1224
1224
}
1225
+ /**
1226
+ * The intelligent tiering configuration.
1227
+ */
1228
+ export interface IntelligentTieringConfiguration {
1229
+ /**
1230
+ * Configuration name
1231
+ */
1232
+ readonly name : string ;
1233
+
1234
+
1235
+ /**
1236
+ * Add a filter to limit the scope of this configuration to a single prefix.
1237
+ *
1238
+ * @default this configuration will apply to **all** objects in the bucket.
1239
+ */
1240
+ readonly prefix ?: string ;
1241
+
1242
+ /**
1243
+ * You can limit the scope of this rule to the key value pairs added below.
1244
+ *
1245
+ * @default No filtering will be performed on tags
1246
+ */
1247
+ readonly tags ?: Tag [ ] ;
1248
+
1249
+ /**
1250
+ * When enabled, Intelligent-Tiering will automatically move objects that
1251
+ * haven’t been accessed for a minimum of 90 days to the Archive Access tier.
1252
+ *
1253
+ * @default Objects will not move to Glacier
1254
+ */
1255
+ readonly archiveAccessTierTime ?: Duration ;
1256
+
1257
+ /**
1258
+ * When enabled, Intelligent-Tiering will automatically move objects that
1259
+ * haven’t been accessed for a minimum of 180 days to the Deep Archive Access
1260
+ * tier.
1261
+ *
1262
+ * @default Objects will not move to Glacier Deep Access
1263
+ */
1264
+ readonly deepArchiveAccessTierTime ?: Duration ;
1265
+ }
1266
+
1225
1267
export interface BucketProps {
1226
1268
/**
1227
1269
* The kind of server-side encryption to apply to this bucket.
@@ -1418,6 +1460,31 @@ export interface BucketProps {
1418
1460
* @default false
1419
1461
*/
1420
1462
readonly transferAcceleration ?: boolean ;
1463
+
1464
+ /**
1465
+ * Inteligent Tiering Configurations
1466
+ *
1467
+ * @see https://docs.aws.amazon.com/AmazonS3/latest/userguide/intelligent-tiering.html
1468
+ *
1469
+ * @default No Intelligent Tiiering Configurations.
1470
+ */
1471
+ readonly intelligentTieringConfigurations ?: IntelligentTieringConfiguration [ ] ;
1472
+ }
1473
+
1474
+
1475
+ /**
1476
+ * Tag
1477
+ */
1478
+ export interface Tag {
1479
+
1480
+ /**
1481
+ * key to e tagged
1482
+ */
1483
+ readonly key : string ;
1484
+ /**
1485
+ * additional value
1486
+ */
1487
+ readonly value : string ;
1421
1488
}
1422
1489
1423
1490
/**
@@ -1585,6 +1652,7 @@ export class Bucket extends BucketBase {
1585
1652
inventoryConfigurations : Lazy . any ( { produce : ( ) => this . parseInventoryConfiguration ( ) } ) ,
1586
1653
ownershipControls : this . parseOwnershipControls ( props ) ,
1587
1654
accelerateConfiguration : props . transferAcceleration ? { accelerationStatus : 'Enabled' } : undefined ,
1655
+ intelligentTieringConfigurations : this . parseTieringConfig ( props ) ,
1588
1656
} ) ;
1589
1657
this . _resource = resource ;
1590
1658
@@ -1887,6 +1955,35 @@ export class Bucket extends BucketBase {
1887
1955
} ;
1888
1956
}
1889
1957
1958
+ private parseTieringConfig ( { intelligentTieringConfigurations } : BucketProps ) : CfnBucket . IntelligentTieringConfigurationProperty [ ] | undefined {
1959
+ if ( ! intelligentTieringConfigurations ) {
1960
+ return undefined ;
1961
+ }
1962
+
1963
+ return intelligentTieringConfigurations . map ( config => {
1964
+ const tierings = [ ] ;
1965
+ if ( config . archiveAccessTierTime ) {
1966
+ tierings . push ( {
1967
+ accessTier : 'ARCHIVE_ACCESS' ,
1968
+ days : config . archiveAccessTierTime . toDays ( { integral : true } ) ,
1969
+ } ) ;
1970
+ }
1971
+ if ( config . deepArchiveAccessTierTime ) {
1972
+ tierings . push ( {
1973
+ accessTier : 'DEEP_ARCHIVE_ACCESS' ,
1974
+ days : config . deepArchiveAccessTierTime . toDays ( { integral : true } ) ,
1975
+ } ) ;
1976
+ }
1977
+ return {
1978
+ id : config . name ,
1979
+ prefix : config . prefix ,
1980
+ status : 'Enabled' ,
1981
+ tagFilters : config . tags ,
1982
+ tierings : tierings ,
1983
+ } ;
1984
+ } ) ;
1985
+ }
1986
+
1890
1987
private renderWebsiteConfiguration ( props : BucketProps ) : CfnBucket . WebsiteConfigurationProperty | undefined {
1891
1988
if ( ! props . websiteErrorDocument && ! props . websiteIndexDocument && ! props . websiteRedirect && ! props . websiteRoutingRules ) {
1892
1989
return undefined ;
@@ -2057,6 +2154,7 @@ export enum BucketEncryption {
2057
2154
2058
2155
/**
2059
2156
* Notification event types.
2157
+ * @link https://docs.aws.amazon.com/AmazonS3/latest/userguide/notification-how-to-event-types-and-destinations.html#supported-notification-event-types
2060
2158
*/
2061
2159
export enum EventType {
2062
2160
/**
@@ -2208,6 +2306,67 @@ export enum EventType {
2208
2306
* by replication metrics.
2209
2307
*/
2210
2308
REPLICATION_OPERATION_NOT_TRACKED = 's3:Replication:OperationNotTracked' ,
2309
+
2310
+ /**
2311
+ * By using the LifecycleExpiration event types, you can receive a notification
2312
+ * when Amazon S3 deletes an object based on your S3 Lifecycle configuration.
2313
+ */
2314
+ LIFECYCLE_EXPIRATION = 's3:LifecycleExpiration:*' ,
2315
+
2316
+ /**
2317
+ * The s3:LifecycleExpiration:Delete event type notifies you when an object
2318
+ * in an unversioned bucket is deleted.
2319
+ * It also notifies you when an object version is permanently deleted by an
2320
+ * S3 Lifecycle configuration.
2321
+ */
2322
+ LIFECYCLE_EXPIRATION_DELETE = 's3:LifecycleExpiration:Delete' ,
2323
+
2324
+ /**
2325
+ * The s3:LifecycleExpiration:DeleteMarkerCreated event type notifies you
2326
+ * when S3 Lifecycle creates a delete marker when a current version of an
2327
+ * object in versioned bucket is deleted.
2328
+ */
2329
+ LIFECYCLE_EXPIRATION_DELETE_MARKER_CREATED = 's3:LifecycleExpiration:DeleteMarkerCreated' ,
2330
+
2331
+ /**
2332
+ * You receive this notification event when an object is transitioned to
2333
+ * another Amazon S3 storage class by an S3 Lifecycle configuration.
2334
+ */
2335
+ LIFECYCLE_TRANSITION = 's3:LifecycleTransition' ,
2336
+
2337
+ /**
2338
+ * You receive this notification event when an object within the
2339
+ * S3 Intelligent-Tiering storage class moved to the Archive Access tier or
2340
+ * Deep Archive Access tier.
2341
+ */
2342
+ INTELLIGENT_TIERING = 's3:IntelligentTiering' ,
2343
+
2344
+ /**
2345
+ * By using the ObjectTagging event types, you can enable notification when
2346
+ * an object tag is added or deleted from an object.
2347
+ */
2348
+ OBJECT_TAGGING = 's3:ObjectTagging:*' ,
2349
+
2350
+ /**
2351
+ * The s3:ObjectTagging:Put event type notifies you when a tag is PUT on an
2352
+ * object or an existing tag is updated.
2353
+
2354
+ */
2355
+ OBJECT_TAGGING_PUT = 's3:ObjectTagging:Put' ,
2356
+
2357
+ /**
2358
+ * The s3:ObjectTagging:Delete event type notifies you when a tag is removed
2359
+ * from an object.
2360
+ */
2361
+ OBJECT_TAGGING_DELETE = 's3:ObjectTagging:Delete' ,
2362
+
2363
+ /**
2364
+ * You receive this notification event when an ACL is PUT on an object or when
2365
+ * an existing ACL is changed.
2366
+ * An event is not generated when a request results in no change to an
2367
+ * object’s ACL.
2368
+ */
2369
+ OBJECT_ACL_PUT = 's3:ObjectAcl:Put' ,
2211
2370
}
2212
2371
2213
2372
export interface NotificationKeyFilter {
0 commit comments