Skip to content

Commit

Permalink
Merge branch 'main' into 27449_codepipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
kaizencc authored Dec 18, 2023
2 parents 100b4af + 7a721d3 commit 1734baa
Show file tree
Hide file tree
Showing 19 changed files with 145 additions and 39 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/pr-linter-trigger.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
mkdir -p ./pr
echo $PR_NUMBER > ./pr/pr_number
echo $PR_SHA > ./pr/pr_sha
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
name: pr_info
path: pr/
16 changes: 8 additions & 8 deletions .github/workflows/spec-update.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:

# Upload the current db to be used later
- name: Upload base database
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: db.base.json.gz
path: node_modules/@aws-cdk/aws-service-spec/db.json.gz
Expand All @@ -49,7 +49,7 @@ jobs:

# Now that we have updated the database, upload the new candidate db
- name: Upload head database
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: db.head.json.gz
path: node_modules/@aws-cdk/aws-service-spec/db.json.gz
Expand All @@ -69,7 +69,7 @@ jobs:
git add .
git diff --patch --staged > ${{ runner.temp }}/update-spec.patch
- name: Upload Patch
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: update-spec.patch
path: ${{ runner.temp }}/update-spec.patch
Expand All @@ -85,12 +85,12 @@ jobs:
CI: "true"
steps:
- name: Download base database
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: db.base.json.gz
path: base
- name: Download head database
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: db.head.json.gz
path: head
Expand All @@ -110,7 +110,7 @@ jobs:
cat DIFF >> PR.md
echo '```' >> PR.md
- name: Upload PR body file
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: PR.md
path: PR.md
Expand All @@ -128,7 +128,7 @@ jobs:
uses: actions/checkout@v4

- name: Download patch
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: update-spec.patch
path: ${{ runner.temp }}
Expand All @@ -137,7 +137,7 @@ jobs:
run: '[ -s ${{ runner.temp }}/update-spec.patch ] && git apply ${{ runner.temp }}/update-spec.patch || echo "Empty patch. Skipping."'

- name: Download PR body file
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: PR.md
path: ${{ runner.temp }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/update-metadata-regions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
git add .
git diff --patch --staged > ${{ runner.temp }}/update-spec.patch
- name: Upload Patch
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: update-spec.patch
path: ${{ runner.temp }}/update-spec.patch
Expand All @@ -50,7 +50,7 @@ jobs:
uses: actions/checkout@v4

- name: Download patch
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: update-spec.patch
path: ${{ runner.temp }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/yarn-upgrade.yml
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ jobs:
git add .
git diff --patch --staged > ${{ runner.temp }}/upgrade.patch
- name: Upload Patch
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: upgrade.patch
path: ${{ runner.temp }}/upgrade.patch
Expand All @@ -106,7 +106,7 @@ jobs:
uses: actions/checkout@v4

- name: Download patch
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: upgrade.patch
path: ${{ runner.temp }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class SimpleStack extends cdk.Stack {
visibilityTimeout: cdk.Duration.seconds(300),
});
const role = new iam.Role(this, 'role', {
assumedBy: new iam.AnyPrincipal(),
assumedBy: new iam.AccountRootPrincipal(),
});
queue.grantConsumeMessages(role);
}
Expand Down
4 changes: 2 additions & 2 deletions packages/@aws-cdk/cloudformation-diff/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
},
"license": "Apache-2.0",
"dependencies": {
"@aws-cdk/aws-service-spec": "^0.0.35",
"@aws-cdk/service-spec-types": "^0.0.35",
"@aws-cdk/aws-service-spec": "^0.0.36",
"@aws-cdk/service-spec-types": "^0.0.36",
"chalk": "^4",
"diff": "^5.1.0",
"fast-deep-equal": "^3.1.3",
Expand Down
2 changes: 1 addition & 1 deletion packages/@aws-cdk/integ-runner/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
"@aws-cdk/cloud-assembly-schema": "0.0.0",
"@aws-cdk/cloudformation-diff": "0.0.0",
"@aws-cdk/cx-api": "0.0.0",
"@aws-cdk/aws-service-spec": "^0.0.35",
"@aws-cdk/aws-service-spec": "^0.0.36",
"cdk-assets": "0.0.0",
"@aws-cdk/cdk-cli-wrapper": "0.0.0",
"aws-cdk": "0.0.0",
Expand Down
8 changes: 4 additions & 4 deletions packages/aws-cdk-lib/aws-apigateway/lib/authorizers/lambda.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ abstract class LambdaAuthorizer extends Authorizer implements IAuthorizer {
*/
protected setupPermissions() {
if (!this.role) {
this.addDefaultPermisionRole();
this.addDefaultPermissionRole();
} else if (iam.Role.isRole(this.role)) {
this.addLambdaInvokePermission(this.role);
}
Expand All @@ -132,17 +132,17 @@ abstract class LambdaAuthorizer extends Authorizer implements IAuthorizer {
/**
* Add Default Permission Role for handler
*/
private addDefaultPermisionRole() :void {
private addDefaultPermissionRole(): void {
this.handler.addPermission(`${Names.uniqueId(this)}:Permissions`, {
principal: new iam.ServicePrincipal('apigateway.amazonaws.com'),
sourceArn: this.authorizerArn,
});
}

/**
* Add Lambda Invoke Permission for LambdaAurhorizer's role
* Add Lambda Invoke Permission for Lambda Authorizer's role
*/
private addLambdaInvokePermission(role: iam.Role) :void {
private addLambdaInvokePermission(role: iam.Role): void {
role.attachInlinePolicy(new iam.Policy(this, 'authorizerInvokePolicy', {
statements: [
new iam.PolicyStatement({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -429,6 +429,15 @@ export enum OnDemandAllocationStrategy {
* so on.
*/
PRIORITIZED = 'prioritized',

/**
* This strategy uses the lowest-price instance types in each Availability Zone based on the current
* On-Demand instance price.
*
* To meet your desired capacity, you might receive On-Demand Instances of more than one instance type
* in each Availability Zone. This depends on how much capacity you request.
*/
LOWEST_PRICE = 'lowest-price',
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2277,6 +2277,43 @@ test('add price-capacity-optimized', () => {
});
});

test('add on-demand lowest-price allocation strategy', () => {
// GIVEN
const stack = new cdk.Stack();

// WHEN
const lt = LaunchTemplate.fromLaunchTemplateAttributes(stack, 'imported-lt', {
launchTemplateId: 'test-lt-id',
versionNumber: '0',
});

new autoscaling.AutoScalingGroup(stack, 'mip-asg', {
mixedInstancesPolicy: {
launchTemplate: lt,
launchTemplateOverrides: [{
instanceType: new InstanceType('t4g.micro'),
launchTemplate: lt,
weightedCapacity: 9,
}],
instancesDistribution: {
onDemandAllocationStrategy: OnDemandAllocationStrategy.LOWEST_PRICE,
onDemandBaseCapacity: 1,
onDemandPercentageAboveBaseCapacity: 100,
},
},
vpc: mockVpc(stack),
});

// THEN
Template.fromStack(stack).hasResourceProperties('AWS::AutoScaling::AutoScalingGroup', {
MixedInstancesPolicy: {
InstancesDistribution: {
OnDemandAllocationStrategy: 'lowest-price',
},
},
});
});

test('ssm permissions adds right managed policy', () => {
// GIVEN
const stack = new cdk.Stack();
Expand Down
13 changes: 13 additions & 0 deletions packages/aws-cdk-lib/aws-b2bi/.jsiirc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"targets": {
"java": {
"package": "software.amazon.awscdk.services.b2bi"
},
"dotnet": {
"package": "Amazon.CDK.AWS.B2BI"
},
"python": {
"module": "aws_cdk.aws_b2bi"
}
}
}
39 changes: 39 additions & 0 deletions packages/aws-cdk-lib/aws-b2bi/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# AWS::B2BI Construct Library
<!--BEGIN STABILITY BANNER-->

---

![cfn-resources: Stable](https://img.shields.io/badge/cfn--resources-stable-success.svg?style=for-the-badge)

> All classes with the `Cfn` prefix in this module ([CFN Resources]) are always stable and safe to use.
>
> [CFN Resources]: https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib
---

<!--END STABILITY BANNER-->

This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project.

```ts nofixture
import * as b2bi from 'aws-cdk-lib/aws-b2bi';
```

<!--BEGIN CFNONLY DISCLAIMER-->

There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed:

- Search [Construct Hub for B2BI construct libraries](https://constructs.dev/search?q=b2bi)
- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::B2BI resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_B2BI.html) directly.


<!--BEGIN CFNONLY DISCLAIMER-->

There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet.
However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly.

For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::B2BI](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_B2BI.html).

(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.)

<!--END CFNONLY DISCLAIMER-->
1 change: 1 addition & 0 deletions packages/aws-cdk-lib/aws-b2bi/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './lib';
2 changes: 2 additions & 0 deletions packages/aws-cdk-lib/aws-b2bi/lib/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// AWS::B2BI Cloudformation Resources
export * from './b2bi.generated';
1 change: 1 addition & 0 deletions packages/aws-cdk-lib/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export * as aws_autoscaling from './aws-autoscaling';
export * as aws_autoscaling_common from './aws-autoscaling-common';
export * as aws_autoscaling_hooktargets from './aws-autoscaling-hooktargets';
export * as aws_autoscalingplans from './aws-autoscalingplans';
export * as aws_b2bi from './aws-b2bi';
export * as aws_backup from './aws-backup';
export * as aws_backupgateway from './aws-backupgateway';
export * as aws_batch from './aws-batch';
Expand Down
3 changes: 2 additions & 1 deletion packages/aws-cdk-lib/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@
"yaml": "1.10.2"
},
"devDependencies": {
"@aws-cdk/aws-service-spec": "^0.0.35",
"@aws-cdk/aws-service-spec": "^0.0.36",
"@aws-cdk/cdk-build-tools": "0.0.0",
"@aws-cdk/custom-resource-handlers": "0.0.0",
"@aws-cdk/pkglint": "0.0.0",
Expand Down Expand Up @@ -238,6 +238,7 @@
"./aws-autoscaling-common": "./aws-autoscaling-common/index.js",
"./aws-autoscaling-hooktargets": "./aws-autoscaling-hooktargets/index.js",
"./aws-autoscalingplans": "./aws-autoscalingplans/index.js",
"./aws-b2bi": "./aws-b2bi/index.js",
"./aws-backup": "./aws-backup/index.js",
"./aws-backupgateway": "./aws-backupgateway/index.js",
"./aws-batch": "./aws-batch/index.js",
Expand Down
3 changes: 3 additions & 0 deletions packages/aws-cdk-lib/scripts/scope-map.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@
"aws-autoscalingplans": [
"AWS::AutoScalingPlans"
],
"aws-b2bi": [
"AWS::B2BI"
],
"aws-backup": [
"AWS::Backup"
],
Expand Down
6 changes: 3 additions & 3 deletions tools/@aws-cdk/spec2cdk/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@
},
"license": "Apache-2.0",
"dependencies": {
"@aws-cdk/aws-service-spec": "^0.0.35",
"@aws-cdk/service-spec-importers": "^0.0.11",
"@aws-cdk/service-spec-types": "^0.0.35",
"@aws-cdk/aws-service-spec": "^0.0.36",
"@aws-cdk/service-spec-importers": "^0.0.12",
"@aws-cdk/service-spec-types": "^0.0.36",
"@cdklabs/tskb": "^0.0.3",
"@cdklabs/typewriter": "^0.0.3",
"camelcase": "^6",
Expand Down
28 changes: 14 additions & 14 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -56,25 +56,25 @@
resolved "https://registry.npmjs.org/@aws-cdk/asset-node-proxy-agent-v6/-/asset-node-proxy-agent-v6-2.0.1.tgz#6dc9b7cdb22ff622a7176141197962360c33e9ac"
integrity sha512-DDt4SLdLOwWCjGtltH4VCST7hpOI5DzieuhGZsBpZ+AgJdSI2GCjklCXm0GCTwJG/SolkL5dtQXyUKgg9luBDg==

"@aws-cdk/aws-service-spec@^0.0.35":
version "0.0.35"
resolved "https://registry.npmjs.org/@aws-cdk/aws-service-spec/-/aws-service-spec-0.0.35.tgz#d6a225a5a306a595c6d51a920141337dd39a0407"
integrity sha512-75rNt8JBVMIv7iE/OfaYli5uVNXhzO/S5ExfXa8IgcXXykyMiYvTgBm7xPN85/pcqWvPIXP0C7ttsmF0JZYEng==
"@aws-cdk/aws-service-spec@^0.0.36":
version "0.0.36"
resolved "https://registry.npmjs.org/@aws-cdk/aws-service-spec/-/aws-service-spec-0.0.36.tgz#ce62d242c0d7e4bc6527327d9849bae1f7df190c"
integrity sha512-hnhWZntWw/GYAYWdhJJSG+xiPQBcBTl8K9AFZSHzW0NvhJCRJIu/3NfFyPmRqZ1qEkHrLhmagVFbdeXucHnjWw==
dependencies:
"@aws-cdk/service-spec-types" "^0.0.35"
"@aws-cdk/service-spec-types" "^0.0.36"
"@cdklabs/tskb" "^0.0.3"

"@aws-cdk/lambda-layer-kubectl-v24@^2.0.242":
version "2.0.242"
resolved "https://registry.npmjs.org/@aws-cdk/lambda-layer-kubectl-v24/-/lambda-layer-kubectl-v24-2.0.242.tgz#4273a5ad7714f933a7eba155eb9280823086db71"
integrity sha512-7/wIOo685tmrEe4hh6zqDELhBZh5OQGf3Hd2FU2Vnwy2ZubW8qTmEw5gqJCsCrGKeYDoa1BcVhDRZ/nzjkaqyA==

"@aws-cdk/service-spec-importers@^0.0.11":
version "0.0.11"
resolved "https://registry.npmjs.org/@aws-cdk/service-spec-importers/-/service-spec-importers-0.0.11.tgz#f7e60063337934313036d573a96d1e67ed9922d9"
integrity sha512-EjEpNx7rZNVuUwpJcttwAfQOKhCUojbDOZvu5k/0AcMKs6E/y/zGRdyt5xXxW04979ciLKcdWwgcGf4CcX9CSg==
"@aws-cdk/service-spec-importers@^0.0.12":
version "0.0.12"
resolved "https://registry.npmjs.org/@aws-cdk/service-spec-importers/-/service-spec-importers-0.0.12.tgz#0af7f326eb5503ad8c65e195c37713956fc7fff5"
integrity sha512-Vhb7gPzN0vWV38HfI3h+pRIdaTxK7A77dbVOXKZa8z8Ge1PQq+Tn4xaMzOkhbnXxDnbP2EEUrc8whWYsPo7l1A==
dependencies:
"@aws-cdk/service-spec-types" "^0.0.35"
"@aws-cdk/service-spec-types" "^0.0.36"
"@cdklabs/tskb" "^0.0.3"
ajv "^6"
canonicalize "^2.0.0"
Expand All @@ -85,10 +85,10 @@
glob "^8"
sort-json "^2.0.1"

"@aws-cdk/service-spec-types@^0.0.35":
version "0.0.35"
resolved "https://registry.npmjs.org/@aws-cdk/service-spec-types/-/service-spec-types-0.0.35.tgz#0d599074f6f09e741eea8621aa06de29fe4a1653"
integrity sha512-+XqMpPxyH2Hot/ifSF0eWmHUEYBIpUGvjEs4yxCdOrVAxOTYyJv6Ch/MZokOBmNF3Y03gxmaS0lPBhf8isT9EA==
"@aws-cdk/service-spec-types@^0.0.36":
version "0.0.36"
resolved "https://registry.npmjs.org/@aws-cdk/service-spec-types/-/service-spec-types-0.0.36.tgz#d4e7c78b246ba6abdd262668c748f91c31c6075d"
integrity sha512-ILHIT+/7boUOJLe3H0doBxIm9k5+I2wNBg+WzJ6GC2IlPPT1R6qax9yZmvxSDfq87dWEpIuc3DDUZsPkWIA/qg==
dependencies:
"@cdklabs/tskb" "^0.0.3"

Expand Down

0 comments on commit 1734baa

Please sign in to comment.