Skip to content

Commit

Permalink
Merge branch 'master' into add-build-opt
Browse files Browse the repository at this point in the history
  • Loading branch information
mergify[bot] authored Apr 1, 2022
2 parents ce4e611 + 75a6fa7 commit ab8d7cf
Show file tree
Hide file tree
Showing 100 changed files with 882 additions and 5,495 deletions.
14 changes: 8 additions & 6 deletions .github/workflows/issue-label-assign.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ on:
issues:
types: [opened, edited]
pull_request:
types: [opened, edited]
types: [opened]
pull_request_target:
types: [opened, edited]
types: [opened]

jobs:
issue-triage-manager:
Expand Down Expand Up @@ -39,7 +39,7 @@ jobs:
included-labels: "[guidance]"
default-area: ${{ env.OSDS_DEVS }}
parameters: >
[{"area":"guidance","keywords":["guidance"]}]
[{"area":"guidance","keywords":["guidancekeyword"]}]
pr-triage-manager:
permissions:
issues: write
Expand All @@ -51,9 +51,11 @@ jobs:
github-token: "${{ secrets.GITHUB_TOKEN }}"
target: "pull-requests"
area-is-keyword: true
excluded-labels: "[contribution/core]"
parameters: ${{ env.AREA_PARAMS }}
affixes: ${{ env.AREA_AFFIXES }}
default-area: >
{"reviewers":{"teamReviewers":["aws-cdk-owners"]}}
parameters: >
[{"area":"pullrequests","keywords":["pullrequestkeyword"]}]
env:
OSDS_DEVS: >
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,12 +184,31 @@ function renderCustomMetric(metric?: cloudwatch.IMetric): CfnScalingPolicy.Custo
*/
export enum PredefinedMetric {
/**
* DYNAMODB_READ_CAPACITY_UTILIZATIO
* @see https://docs.aws.amazon.com/autoscaling/application/APIReference/API_PredefinedMetricSpecification.html
* Average percentage of instances in an AppStream fleet that are being used.
*/
APPSTREAM_AVERAGE_CAPACITY_UTILIZATION = 'AppStreamAverageCapacityUtilization',
/**
* Percentage of provisioned read capacity units utilized by a Keyspaces table.
*/
CASSANDRA_READ_CAPACITY_UTILIZATION = 'CassandraReadCapacityUtilization',
/**
* Percentage of provisioned write capacity units utilized by a Keyspaces table.
*/
CASSANDRA_WRITE_CAPACITY_UTILIZATION = 'CassandraWriteCapacityUtilization',
/**
* Percentage of provisioned inference units utilized by a Comprehend endpoint.
*/
COMPREHEND_INFERENCE_UTILIZATION = 'ComprehendInferenceUtilization',
/**
* Average CPU Utilization of read replica instances in a Neptune DB cluster.
*/
NEPTURE_READER_AVERAGE_CPU_UTILIZATION = 'NeptuneReaderAverageCPUUtilization',
/**
* Percentage of provisioned read capacity units consumed by a DynamoDB table.
*/
DYNAMODB_READ_CAPACITY_UTILIZATION = 'DynamoDBReadCapacityUtilization',
/**
* DYNAMODB_WRITE_CAPACITY_UTILIZATION
* Percentage of provisioned write capacity units consumed by a DynamoDB table.
*
* Suffix `dummy` is necessary due to jsii bug (https://github.com/aws/jsii/issues/2782).
* Duplicate values will be dropped, so this suffix is added as a workaround.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,177 @@
"Resources": {
"Bucket83908E77": {
"Type": "AWS::S3::Bucket",
"Properties": {
"Tags": [
{
"Key": "aws-cdk:auto-delete-objects",
"Value": "true"
}
]
},
"UpdateReplacePolicy": "Delete",
"DeletionPolicy": "Delete"
},
"BucketPolicyE9A3008A": {
"Type": "AWS::S3::BucketPolicy",
"Properties": {
"Bucket": {
"Ref": "Bucket83908E77"
},
"PolicyDocument": {
"Statement": [
{
"Action": [
"s3:DeleteObject*",
"s3:GetBucket*",
"s3:List*"
],
"Effect": "Allow",
"Principal": {
"AWS": {
"Fn::GetAtt": [
"CustomS3AutoDeleteObjectsCustomResourceProviderRole3B1BD092",
"Arn"
]
}
},
"Resource": [
{
"Fn::GetAtt": [
"Bucket83908E77",
"Arn"
]
},
{
"Fn::Join": [
"",
[
{
"Fn::GetAtt": [
"Bucket83908E77",
"Arn"
]
},
"/*"
]
]
}
]
}
],
"Version": "2012-10-17"
}
}
},
"BucketAutoDeleteObjectsCustomResourceBAFD23C2": {
"Type": "Custom::S3AutoDeleteObjects",
"Properties": {
"ServiceToken": {
"Fn::GetAtt": [
"CustomS3AutoDeleteObjectsCustomResourceProviderHandler9D90184F",
"Arn"
]
},
"BucketName": {
"Ref": "Bucket83908E77"
}
},
"DependsOn": [
"BucketPolicyE9A3008A"
],
"UpdateReplacePolicy": "Delete",
"DeletionPolicy": "Delete"
},
"CustomS3AutoDeleteObjectsCustomResourceProviderRole3B1BD092": {
"Type": "AWS::IAM::Role",
"Properties": {
"AssumeRolePolicyDocument": {
"Version": "2012-10-17",
"Statement": [
{
"Action": "sts:AssumeRole",
"Effect": "Allow",
"Principal": {
"Service": "lambda.amazonaws.com"
}
}
]
},
"ManagedPolicyArns": [
{
"Fn::Sub": "arn:${AWS::Partition}:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole"
}
]
}
},
"CustomS3AutoDeleteObjectsCustomResourceProviderHandler9D90184F": {
"Type": "AWS::Lambda::Function",
"Properties": {
"Code": {
"S3Bucket": {
"Ref": "AssetParametersbe270bbdebe0851c887569796e3997437cca54ce86893ed94788500448e92824S3Bucket09A62232"
},
"S3Key": {
"Fn::Join": [
"",
[
{
"Fn::Select": [
0,
{
"Fn::Split": [
"||",
{
"Ref": "AssetParametersbe270bbdebe0851c887569796e3997437cca54ce86893ed94788500448e92824S3VersionKeyA28118BE"
}
]
}
]
},
{
"Fn::Select": [
1,
{
"Fn::Split": [
"||",
{
"Ref": "AssetParametersbe270bbdebe0851c887569796e3997437cca54ce86893ed94788500448e92824S3VersionKeyA28118BE"
}
]
}
]
}
]
]
}
},
"Timeout": 900,
"MemorySize": 128,
"Handler": "__entrypoint__.handler",
"Role": {
"Fn::GetAtt": [
"CustomS3AutoDeleteObjectsCustomResourceProviderRole3B1BD092",
"Arn"
]
},
"Runtime": "nodejs12.x",
"Description": {
"Fn::Join": [
"",
[
"Lambda function for auto-deleting objects in ",
{
"Ref": "Bucket83908E77"
},
" S3 bucket."
]
]
}
},
"DependsOn": [
"CustomS3AutoDeleteObjectsCustomResourceProviderRole3B1BD092"
]
},
"LambdaFunctionServiceRoleC555A460": {
"Type": "AWS::IAM::Role",
"Properties": {
Expand Down Expand Up @@ -49,16 +217,24 @@
]
},
"Handler": "hello.handler",
"Runtime": "nodejs10.x"
"Runtime": "nodejs14.x"
},
"DependsOn": [
"LambdaFunctionServiceRoleC555A460"
]
},
"S3486F821D": {
"Type": "AWS::S3::Bucket",
"UpdateReplacePolicy": "Retain",
"DeletionPolicy": "Retain"
"Properties": {
"Tags": [
{
"Key": "aws-cdk:auto-delete-objects",
"Value": "true"
}
]
},
"UpdateReplacePolicy": "Delete",
"DeletionPolicy": "Delete"
},
"S3Policy2E4AA1D6": {
"Type": "AWS::S3::BucketPolicy",
Expand All @@ -68,6 +244,44 @@
},
"PolicyDocument": {
"Statement": [
{
"Action": [
"s3:DeleteObject*",
"s3:GetBucket*",
"s3:List*"
],
"Effect": "Allow",
"Principal": {
"AWS": {
"Fn::GetAtt": [
"CustomS3AutoDeleteObjectsCustomResourceProviderRole3B1BD092",
"Arn"
]
}
},
"Resource": [
{
"Fn::GetAtt": [
"S3486F821D",
"Arn"
]
},
{
"Fn::Join": [
"",
[
{
"Fn::GetAtt": [
"S3486F821D",
"Arn"
]
},
"/*"
]
]
}
]
},
{
"Action": "s3:GetBucketAcl",
"Effect": "Allow",
Expand Down Expand Up @@ -116,6 +330,25 @@
}
}
},
"S3AutoDeleteObjectsCustomResource5A4102C9": {
"Type": "Custom::S3AutoDeleteObjects",
"Properties": {
"ServiceToken": {
"Fn::GetAtt": [
"CustomS3AutoDeleteObjectsCustomResourceProviderHandler9D90184F",
"Arn"
]
},
"BucketName": {
"Ref": "S3486F821D"
}
},
"DependsOn": [
"S3Policy2E4AA1D6"
],
"UpdateReplacePolicy": "Delete",
"DeletionPolicy": "Delete"
},
"Trail022F0CF2": {
"Type": "AWS::CloudTrail::Trail",
"Properties": {
Expand Down Expand Up @@ -171,5 +404,19 @@
"S3Policy2E4AA1D6"
]
}
},
"Parameters": {
"AssetParametersbe270bbdebe0851c887569796e3997437cca54ce86893ed94788500448e92824S3Bucket09A62232": {
"Type": "String",
"Description": "S3 bucket for asset \"be270bbdebe0851c887569796e3997437cca54ce86893ed94788500448e92824\""
},
"AssetParametersbe270bbdebe0851c887569796e3997437cca54ce86893ed94788500448e92824S3VersionKeyA28118BE": {
"Type": "String",
"Description": "S3 key for asset version \"be270bbdebe0851c887569796e3997437cca54ce86893ed94788500448e92824\""
},
"AssetParametersbe270bbdebe0851c887569796e3997437cca54ce86893ed94788500448e92824ArtifactHash76F8FCF2": {
"Type": "String",
"Description": "Artifact hash for asset \"be270bbdebe0851c887569796e3997437cca54ce86893ed94788500448e92824\""
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,24 @@ import * as cloudtrail from '../lib';
const app = new cdk.App();
const stack = new cdk.Stack(app, 'integ-cloudtrail');

const bucket = new s3.Bucket(stack, 'Bucket', { removalPolicy: cdk.RemovalPolicy.DESTROY });
const bucket = new s3.Bucket(stack, 'Bucket', {
removalPolicy: cdk.RemovalPolicy.DESTROY,
autoDeleteObjects: true,
});
const lambdaFunction = new lambda.Function(stack, 'LambdaFunction', {
runtime: lambda.Runtime.NODEJS_10_X,
runtime: lambda.Runtime.NODEJS_14_X,
handler: 'hello.handler',
code: lambda.Code.fromInline('exports.handler = {}'),
});

// using exctecy the same code as inside the cloudtrail class to produce the supplied bucket and policy
const cloudTrailPrincipal = new iam.ServicePrincipal('cloudtrail.amazonaws.com');

const Trailbucket = new s3.Bucket(stack, 'S3', { encryption: s3.BucketEncryption.UNENCRYPTED });
const Trailbucket = new s3.Bucket(stack, 'S3', {
encryption: s3.BucketEncryption.UNENCRYPTED,
removalPolicy: cdk.RemovalPolicy.DESTROY,
autoDeleteObjects: true,
});

Trailbucket.addToResourcePolicy(new iam.PolicyStatement({
resources: [Trailbucket.bucketArn],
Expand Down
Loading

0 comments on commit ab8d7cf

Please sign in to comment.