Skip to content

Commit

Permalink
Merge branch 'master' into fix-17508
Browse files Browse the repository at this point in the history
  • Loading branch information
mergify[bot] committed Nov 18, 2021
2 parents 1a8aea6 + 7b2d31e commit 12c8d81
Show file tree
Hide file tree
Showing 352 changed files with 7,218 additions and 4,667 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/issue-label-assign.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
pull-requests: write
runs-on: ubuntu-latest
steps:
- uses: peterwoodworth/issue-action@main
- uses: aws-github-ops/aws-issue-triage-manager@main
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"
excluded-expressions: "[CDK CLI Version|TypeScript|Java|Python]"
Expand Down
4 changes: 4 additions & 0 deletions allowed-breaking-changes.txt
Original file line number Diff line number Diff line change
Expand Up @@ -82,3 +82,7 @@ removed:@aws-cdk/aws-autoscaling.EbsDeviceVolumeType.IO2
# Remove autoTerminationPolicy from stepfunctions-tasks EmrCreateClusterProps. This value is not supported by stepfunctions at the moment and was not supported in the past.
removed:@aws-cdk/aws-stepfunctions-tasks.EmrCreateCluster.AutoTerminationPolicyProperty
removed:@aws-cdk/aws-stepfunctions-tasks.EmrCreateClusterProps.autoTerminationPolicy

# Changed property securityGroupId to optional because either securityGroupId or
# securityGroupName is required. Therefore securityGroupId is no longer mandatory.
weakened:@aws-cdk/cloud-assembly-schema.SecurityGroupContextQuery
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@
"fs-extra": "^9.1.0",
"graceful-fs": "^4.2.8",
"jest-junit": "^13.0.0",
"jsii-diff": "^1.43.0",
"jsii-pacmak": "^1.43.0",
"jsii-reflect": "^1.43.0",
"jsii-rosetta": "^1.43.0",
"jsii-diff": "^1.44.1",
"jsii-pacmak": "^1.44.1",
"jsii-reflect": "^1.44.1",
"jsii-rosetta": "^1.44.1",
"lerna": "^4.0.0",
"patch-package": "^6.4.7",
"standard-version": "^9.3.2",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as ecs from '@aws-cdk/aws-ecs';
import * as cdk from '@aws-cdk/core';
import { Service, connectToProps } from '../service';
import { Service, ConnectToProps } from '../service';

// keep this import separate from other imports to reduce chance for merge conflicts with v2-main
// eslint-disable-next-line no-duplicate-imports, import/order
Expand Down Expand Up @@ -225,9 +225,9 @@ export abstract class ServiceExtension {
*
* @param service - The other service to connect to.
*/
public connectToService(service: Service, connectToProp: connectToProps) {
public connectToService(service: Service, connectToProps: ConnectToProps) {
service = service;
connectToProp = connectToProp;
connectToProps = connectToProps;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { Construct } from '@aws-cdk/core';
/**
* connectToProps will have all the extra parameters which are required for connecting services.
*/
export interface connectToProps {
export interface ConnectToProps {
/**
* local_bind_port is the local port that this application should
* use when calling the upstream service in ECS Consul Mesh Extension
Expand Down Expand Up @@ -326,7 +326,7 @@ export class Service extends Construct {
*
* @param service
*/
public connectTo(service: Service, connectToProps: connectToProps = {}) {
public connectTo(service: Service, connectToProps: ConnectToProps = {}) {
for (const extensions in this.serviceDescription.extensions) {
if (this.serviceDescription.extensions[extensions]) {
this.serviceDescription.extensions[extensions].connectToService(service, connectToProps);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
"@types/jest": "^27.0.2",
"@aws-cdk/cdk-build-tools": "0.0.0",
"@aws-cdk/cdk-integ-tools": "0.0.0",
"@aws-cdk/aws-autoscaling": "0.0.0",
"@aws-cdk/cfn2ts": "0.0.0",
"jest": "^27.3.1",
"@aws-cdk/pkglint": "0.0.0",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import '@aws-cdk/assert-internal/jest';
import * as autoscaling from '@aws-cdk/aws-autoscaling';
import * as ec2 from '@aws-cdk/aws-ec2';
import * as ecs from '@aws-cdk/aws-ecs';
import * as route53 from '@aws-cdk/aws-route53';
Expand Down Expand Up @@ -45,9 +46,13 @@ describe('assign public ip', () => {

const vpc = new ec2.Vpc(stack, 'VPC');
const cluster = new ecs.Cluster(stack, 'Cluster', { vpc });
cluster.addCapacity('DefaultAutoScalingGroup', {
instanceType: new ec2.InstanceType('t2.micro'),
});
cluster.addAsgCapacityProvider(new ecs.AsgCapacityProvider(stack, 'Provider', {
autoScalingGroup: new autoscaling.AutoScalingGroup(stack, 'DefaultAutoScalingGroup', {
vpc,
machineImage: ec2.MachineImage.latestAmazonLinux(),
instanceType: new ec2.InstanceType('t2.micro'),
}),
}));

const environment = new Environment(stack, 'production', {
vpc,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import '@aws-cdk/assert-internal/jest';
import * as autoscaling from '@aws-cdk/aws-autoscaling';
import * as ec2 from '@aws-cdk/aws-ec2';
import * as ecs from '@aws-cdk/aws-ecs';
import * as cdk from '@aws-cdk/core';
Expand Down Expand Up @@ -148,9 +149,13 @@ describe('environment', () => {
// WHEN
const vpc = new ec2.Vpc(stack, 'VPC');
const cluster = new ecs.Cluster(stack, 'Cluster', { vpc });
cluster.addCapacity('DefaultAutoScalingGroup', {
instanceType: new ec2.InstanceType('t2.micro'),
});
cluster.addAsgCapacityProvider(new ecs.AsgCapacityProvider(stack, 'Provider', {
autoScalingGroup: new autoscaling.AutoScalingGroup(stack, 'DefaultAutoScalingGroup', {
vpc,
machineImage: ec2.MachineImage.latestAmazonLinux(),
instanceType: new ec2.InstanceType('t2.micro'),
}),
}));

const environment = new Environment(stack, 'production', {
vpc,
Expand Down Expand Up @@ -222,9 +227,13 @@ describe('environment', () => {

const vpc = new ec2.Vpc(stack, 'VPC');
const cluster = new ecs.Cluster(stack, 'Cluster', { vpc });
cluster.addCapacity('DefaultAutoScalingGroup', {
instanceType: new ec2.InstanceType('t2.micro'),
});
cluster.addAsgCapacityProvider(new ecs.AsgCapacityProvider(stack, 'Provider', {
autoScalingGroup: new autoscaling.AutoScalingGroup(stack, 'DefaultAutoScalingGroup', {
vpc,
machineImage: ec2.MachineImage.latestAmazonLinux(),
instanceType: new ec2.InstanceType('t2.micro'),
}),
}));

// WHEN
const environment = Environment.fromEnvironmentAttributes(stack, 'Environment', {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { ABSENT } from '@aws-cdk/assert-internal';
import '@aws-cdk/assert-internal/jest';
import * as autoscaling from '@aws-cdk/aws-autoscaling';
import * as ec2 from '@aws-cdk/aws-ec2';
import * as ecs from '@aws-cdk/aws-ecs';
import * as iam from '@aws-cdk/aws-iam';
Expand Down Expand Up @@ -31,9 +32,13 @@ describe('service', () => {
const stack = new cdk.Stack();
const vpc = new ec2.Vpc(stack, 'VPC');
const cluster = new ecs.Cluster(stack, 'Cluster', { vpc });
cluster.addCapacity('DefaultAutoScalingGroup', {
instanceType: new ec2.InstanceType('t2.micro'),
});
cluster.addAsgCapacityProvider(new ecs.AsgCapacityProvider(stack, 'Provider', {
autoScalingGroup: new autoscaling.AutoScalingGroup(stack, 'DefaultAutoScalingGroup', {
vpc,
machineImage: ec2.MachineImage.latestAmazonLinux(),
instanceType: new ec2.InstanceType('t2.micro'),
}),
}));

const environment = new Environment(stack, 'production', {
vpc,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import * as cpactions from '@aws-cdk/aws-codepipeline-actions';
import * as events from '@aws-cdk/aws-events';
import * as iam from '@aws-cdk/aws-iam';
import * as s3 from '@aws-cdk/aws-s3';
import { describeDeprecated } from '@aws-cdk/cdk-build-tools';
import * as cxschema from '@aws-cdk/cloud-assembly-schema';
import * as cdk from '@aws-cdk/core';
import * as constructs from 'constructs';
Expand All @@ -19,7 +20,7 @@ interface SelfUpdatingPipeline {
}
const accountId = fc.array(fc.integer(0, 9), 12, 12).map(arr => arr.join());

describe('pipeline deploy stack action', () => {
describeDeprecated('pipeline deploy stack action', () => {
test('rejects cross-environment deployment', () => {
fc.assert(
fc.property(
Expand Down
3 changes: 2 additions & 1 deletion packages/@aws-cdk/assets/test/staging.test.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import * as fs from 'fs';
import * as path from 'path';
import { describeDeprecated } from '@aws-cdk/cdk-build-tools';
import { App, Stack } from '@aws-cdk/core';
import * as cxapi from '@aws-cdk/cx-api';
import '@aws-cdk/assert-internal/jest';
import { Staging } from '../lib';

describe('staging', () => {
describeDeprecated('staging', () => {
test('base case', () => {
// GIVEN
const stack = new Stack();
Expand Down
10 changes: 5 additions & 5 deletions packages/@aws-cdk/aws-apigateway/lib/api-key.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as iam from '@aws-cdk/aws-iam';
import { IResource as IResourceBase, Resource, Stack } from '@aws-cdk/core';
import { ArnFormat, IResource as IResourceBase, Resource, Stack } from '@aws-cdk/core';
import { Construct } from 'constructs';
import { CfnApiKey } from './apigateway.generated';
import { ResourceOptions } from './resource';
Expand Down Expand Up @@ -146,7 +146,7 @@ export class ApiKey extends ApiKeyBase {
service: 'apigateway',
account: '',
resource: '/apikeys',
sep: '/',
arnFormat: ArnFormat.SLASH_RESOURCE_NAME,
resourceName: apiKeyId,
});
}
Expand Down Expand Up @@ -177,7 +177,7 @@ export class ApiKey extends ApiKeyBase {
service: 'apigateway',
account: '',
resource: '/apikeys',
sep: '/',
arnFormat: ArnFormat.SLASH_RESOURCE_NAME,
resourceName: this.keyId,
});
}
Expand Down Expand Up @@ -236,12 +236,12 @@ export class RateLimitedApiKey extends ApiKeyBase {
const resource = new ApiKey(this, 'Resource', props);

if (props.apiStages || props.quota || props.throttle) {
new UsagePlan(this, 'UsagePlanResource', {
apiKey: resource,
const usageplan = new UsagePlan(this, 'UsagePlanResource', {
apiStages: props.apiStages,
quota: props.quota,
throttle: props.throttle,
});
usageplan.addApiKey(resource);
}

this.keyId = resource.keyId;
Expand Down
3 changes: 2 additions & 1 deletion packages/@aws-cdk/aws-apigateway/lib/integrations/aws.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import * as cdk from '@aws-cdk/core';
import { ArnFormat } from '@aws-cdk/core';
import { Integration, IntegrationConfig, IntegrationOptions, IntegrationType } from '../integration';
import { Method } from '../method';
import { parseAwsApiCall } from '../util';
Expand Down Expand Up @@ -92,7 +93,7 @@ export class AwsIntegration extends Integration {
service: 'apigateway',
account: backend,
resource: apiType,
sep: '/',
arnFormat: ArnFormat.SLASH_RESOURCE_NAME,
resourceName: apiValue,
region: props.region,
});
Expand Down
6 changes: 3 additions & 3 deletions packages/@aws-cdk/aws-apigateway/lib/method.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Resource, Stack } from '@aws-cdk/core';
import { ArnFormat, Resource, Stack } from '@aws-cdk/core';
import { Construct } from 'constructs';
import { CfnMethod, CfnMethodProps } from './apigateway.generated';
import { Authorizer, IAuthorizer } from './authorizer';
Expand Down Expand Up @@ -275,7 +275,7 @@ export class Method extends Resource {
} else if (options.credentialsPassthrough) {
// arn:aws:iam::*:user/*
// eslint-disable-next-line max-len
credentials = Stack.of(this).formatArn({ service: 'iam', region: '', account: '*', resource: 'user', sep: '/', resourceName: '*' });
credentials = Stack.of(this).formatArn({ service: 'iam', region: '', account: '*', resource: 'user', arnFormat: ArnFormat.SLASH_RESOURCE_NAME, resourceName: '*' });
}

return {
Expand Down Expand Up @@ -346,7 +346,7 @@ export class Method extends Resource {
}

if (options.requestValidatorOptions) {
const validator = this.restApi.addRequestValidator('validator', options.requestValidatorOptions);
const validator = (this.api as RestApi).addRequestValidator('validator', options.requestValidatorOptions);
return validator.requestValidatorId;
}

Expand Down
6 changes: 3 additions & 3 deletions packages/@aws-cdk/aws-apigateway/lib/restapi.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as cloudwatch from '@aws-cdk/aws-cloudwatch';
import { IVpcEndpoint } from '@aws-cdk/aws-ec2';
import * as iam from '@aws-cdk/aws-iam';
import { CfnOutput, IResource as IResourceBase, Resource, Stack } from '@aws-cdk/core';
import { ArnFormat, CfnOutput, IResource as IResourceBase, Resource, Stack } from '@aws-cdk/core';
import { Construct } from 'constructs';
import { ApiDefinition } from './api-definition';
import { ApiKey, ApiKeyOptions, IApiKey } from './api-key';
Expand Down Expand Up @@ -373,7 +373,7 @@ export abstract class RestApiBase extends Resource implements IRestApi {
return Stack.of(this).formatArn({
service: 'execute-api',
resource: this.restApiId,
sep: '/',
arnFormat: ArnFormat.SLASH_RESOURCE_NAME,
resourceName: `${stage}/${method}${path}`,
});
}
Expand Down Expand Up @@ -405,7 +405,7 @@ export abstract class RestApiBase extends Resource implements IRestApi {
return new cloudwatch.Metric({
namespace: 'AWS/ApiGateway',
metricName,
dimensions: { ApiName: this.restApiName },
dimensionsMap: { ApiName: this.restApiName },
...props,
}).attachTo(this);
}
Expand Down
5 changes: 2 additions & 3 deletions packages/@aws-cdk/aws-apigateway/test/api-key.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,8 @@ describe('api key', () => {

// WHEN
const importedKey = apigateway.ApiKey.fromApiKeyId(stack, 'imported', 'KeyIdabc');
api.addUsagePlan('plan', {
apiKey: importedKey,
});
const usagePlan = api.addUsagePlan('plan');
usagePlan.addApiKey(importedKey);

// THEN
expect(stack).toHaveResourceLike('AWS::ApiGateway::UsagePlanKey', {
Expand Down
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-apigateway/test/lambda-api.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ describe('lambda api', () => {

expect(() => new apigw.LambdaRestApi(stack, 'lambda-rest-api', {
handler,
options: { defaultIntegration: new apigw.HttpIntegration('https://foo/bar') },
defaultIntegration: new apigw.HttpIntegration('https://foo/bar'),
})).toThrow(/Cannot specify \"defaultIntegration\" since Lambda integration is automatically defined/);

expect(() => new apigw.LambdaRestApi(stack, 'lambda-rest-api', {
Expand Down
5 changes: 3 additions & 2 deletions packages/@aws-cdk/aws-apigateway/test/method.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import '@aws-cdk/assert-internal/jest';
import { ABSENT } from '@aws-cdk/assert-internal';
import * as iam from '@aws-cdk/aws-iam';
import * as lambda from '@aws-cdk/aws-lambda';
import { testDeprecated } from '@aws-cdk/cdk-build-tools';
import * as cdk from '@aws-cdk/core';
import * as apigw from '../lib';

Expand Down Expand Up @@ -902,7 +903,7 @@ describe('method', () => {

});

test('"restApi" and "api" properties return the RestApi correctly', () => {
testDeprecated('"restApi" and "api" properties return the RestApi correctly', () => {
// GIVEN
const stack = new cdk.Stack();

Expand All @@ -918,7 +919,7 @@ describe('method', () => {

});

test('"restApi" throws an error on imported while "api" returns correctly', () => {
testDeprecated('"restApi" throws an error on imported while "api" returns correctly', () => {
// GIVEN
const stack = new cdk.Stack();

Expand Down
4 changes: 2 additions & 2 deletions packages/@aws-cdk/aws-apigateway/test/resource.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ describe('resource', () => {
const cResource = aResource.addResource('b').addResource('c');

// THEN
expect(stack.resolve(aResource.url)).toEqual({
expect(stack.resolve(api.urlForPath(aResource.path))).toEqual({
'Fn::Join': [
'',
[
Expand All @@ -217,7 +217,7 @@ describe('resource', () => {
],
],
});
expect(stack.resolve(cResource.url)).toEqual({
expect(stack.resolve(api.urlForPath(cResource.path))).toEqual({
'Fn::Join': [
'',
[
Expand Down
5 changes: 3 additions & 2 deletions packages/@aws-cdk/aws-apigateway/test/restapi.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import '@aws-cdk/assert-internal/jest';
import { ResourcePart, SynthUtils } from '@aws-cdk/assert-internal';
import { GatewayVpcEndpoint } from '@aws-cdk/aws-ec2';
import { testDeprecated } from '@aws-cdk/cdk-build-tools';
import { App, CfnElement, CfnResource, Stack } from '@aws-cdk/core';
import * as apigw from '../lib';

Expand Down Expand Up @@ -807,7 +808,7 @@ describe('restapi', () => {
});
});

test('"restApi" and "api" properties return the RestApi correctly', () => {
testDeprecated('"restApi" and "api" properties return the RestApi correctly', () => {
// GIVEN
const stack = new Stack();

Expand All @@ -821,7 +822,7 @@ describe('restapi', () => {
expect(stack.resolve(method.api.restApiId)).toEqual(stack.resolve(method.restApi.restApiId));
});

test('"restApi" throws an error on imported while "api" returns correctly', () => {
testDeprecated('"restApi" throws an error on imported while "api" returns correctly', () => {
// GIVEN
const stack = new Stack();

Expand Down
Loading

0 comments on commit 12c8d81

Please sign in to comment.