Skip to content

Commit

Permalink
Merge branch 'master' into huijbers/stacksynthesizer-error
Browse files Browse the repository at this point in the history
  • Loading branch information
mergify[bot] committed Nov 24, 2020
2 parents 49aed95 + 4a640e5 commit 3983696
Show file tree
Hide file tree
Showing 172 changed files with 2,614 additions and 437 deletions.
2 changes: 1 addition & 1 deletion packages/@aws-cdk/assets/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
"devDependencies": {
"@aws-cdk/assert": "0.0.0",
"@types/nodeunit": "^0.0.31",
"@types/sinon": "^9.0.8",
"@types/sinon": "^9.0.9",
"aws-cdk": "0.0.0",
"cdk-build-tools": "0.0.0",
"cdk-integ-tools": "0.0.0",
Expand Down
6 changes: 3 additions & 3 deletions packages/@aws-cdk/aws-amplify/lib/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -219,17 +219,17 @@ export class App extends Resource implements IApp, iam.IGrantable {
buildSpec: props.autoBranchCreation.buildSpec && props.autoBranchCreation.buildSpec.toBuildSpec(),
enableAutoBranchCreation: true,
enableAutoBuild: props.autoBranchCreation.autoBuild === undefined ? true : props.autoBranchCreation.autoBuild,
environmentVariables: Lazy.anyValue({ produce: () => renderEnvironmentVariables(this.autoBranchEnvironmentVariables ) }, { omitEmptyArray: true }), // eslint-disable-line max-len
environmentVariables: Lazy.any({ produce: () => renderEnvironmentVariables(this.autoBranchEnvironmentVariables ) }, { omitEmptyArray: true }), // eslint-disable-line max-len
enablePullRequestPreview: props.autoBranchCreation.pullRequestPreview === undefined ? true : props.autoBranchCreation.pullRequestPreview,
pullRequestEnvironmentName: props.autoBranchCreation.pullRequestEnvironmentName,
stage: props.autoBranchCreation.stage,
},
enableBranchAutoDeletion: props.autoBranchDeletion,
basicAuthConfig: props.basicAuth && props.basicAuth.bind(this, 'AppBasicAuth'),
buildSpec: props.buildSpec && props.buildSpec.toBuildSpec(),
customRules: Lazy.anyValue({ produce: () => this.customRules }, { omitEmptyArray: true }),
customRules: Lazy.any({ produce: () => this.customRules }, { omitEmptyArray: true }),
description: props.description,
environmentVariables: Lazy.anyValue({ produce: () => renderEnvironmentVariables(this.environmentVariables) }, { omitEmptyArray: true }),
environmentVariables: Lazy.any({ produce: () => renderEnvironmentVariables(this.environmentVariables) }, { omitEmptyArray: true }),
iamServiceRole: role.roleArn,
name: props.appName || this.node.id,
oauthToken: sourceCodeProviderOptions?.oauthToken?.toString(),
Expand Down
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-amplify/lib/branch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ export class Branch extends Resource implements IBranch {
description: props.description,
enableAutoBuild: props.autoBuild === undefined ? true : props.autoBuild,
enablePullRequestPreview: props.pullRequestPreview === undefined ? true : props.pullRequestPreview,
environmentVariables: Lazy.anyValue({ produce: () => renderEnvironmentVariables(this.environmentVariables) }, { omitEmptyArray: true }),
environmentVariables: Lazy.any({ produce: () => renderEnvironmentVariables(this.environmentVariables) }, { omitEmptyArray: true }),
pullRequestEnvironmentName: props.pullRequestEnvironmentName,
stage: props.stage,
});
Expand Down
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-amplify/lib/domain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ export class Domain extends Resource {
const domain = new CfnDomain(this, 'Resource', {
appId: props.app.appId,
domainName,
subDomainSettings: Lazy.anyValue({ produce: () => this.renderSubDomainSettings() }, { omitEmptyArray: true }),
subDomainSettings: Lazy.any({ produce: () => this.renderSubDomainSettings() }, { omitEmptyArray: true }),
});

this.arn = domain.attrArn;
Expand Down
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-apigateway/lib/authorizers/lambda.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ abstract class LambdaAuthorizer extends Authorizer implements IAuthorizer {
* Throws an error, during token resolution, if no RestApi is attached to this authorizer.
*/
protected lazyRestApiId() {
return Lazy.stringValue({
return Lazy.string({
produce: () => {
if (!this.restApiId) {
throw new Error(`Authorizer (${this.node.path}) must be attached to a RestApi`);
Expand Down
4 changes: 2 additions & 2 deletions packages/@aws-cdk/aws-apigateway/lib/deployment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ export class Deployment extends Resource {
}

this.api = props.api;
this.deploymentId = Lazy.stringValue({ produce: () => this.resource.ref });
this.deploymentId = Lazy.string({ produce: () => this.resource.ref });

if (props.api instanceof RestApiBase) {
props.api._attachDeployment(this);
Expand Down Expand Up @@ -141,7 +141,7 @@ class LatestDeploymentResource extends CfnDeployment {

this.api = props.restApi;
this.originalLogicalId = this.stack.getLogicalId(this);
this.overrideLogicalId(Lazy.stringValue({ produce: () => this.calculateLogicalId() }));
this.overrideLogicalId(Lazy.uncachedString({ produce: () => this.calculateLogicalId() }));
}

/**
Expand Down
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-apigateway/lib/integration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ export class Integration {
const options = this.props.options;

if (options?.connectionType === ConnectionType.VPC_LINK && uri === undefined) {
uri = Lazy.stringValue({
uri = Lazy.string({
// needs to be a lazy since the targets can be added to the VpcLink construct after initialization.
produce: () => {
const vpcLink = options.vpcLink;
Expand Down
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-apigateway/lib/integrations/aws.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ export class AwsIntegration extends Integration {
super({
type,
integrationHttpMethod: props.integrationHttpMethod || 'POST',
uri: cdk.Lazy.stringValue({
uri: cdk.Lazy.string({
produce: () => {
if (!this.scope) { throw new Error('AwsIntegration must be used in API'); }
return cdk.Stack.of(this.scope).formatArn({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export class LambdaIntegration extends AwsIntegration {
this.handler.addPermission(`ApiPermission.${desc}`, {
principal,
scope: method,
sourceArn: Lazy.stringValue({ produce: () => method.methodArn }),
sourceArn: Lazy.string({ produce: () => method.methodArn }),
});

// add permission to invoke from the console
Expand Down
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-apigateway/lib/usage-plan.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ export class UsagePlan extends Resource {
let resource: CfnUsagePlan;

resource = new CfnUsagePlan(this, 'Resource', {
apiStages: Lazy.anyValue({ produce: () => this.renderApiStages(this.apiStages) }),
apiStages: Lazy.any({ produce: () => this.renderApiStages(this.apiStages) }),
description: props.description,
quota: this.renderQuota(props),
throttle: this.renderThrottle(props.throttle),
Expand Down
4 changes: 2 additions & 2 deletions packages/@aws-cdk/aws-apigateway/lib/vpc-link.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,13 @@ export class VpcLink extends Resource implements IVpcLink {
constructor(scope: Construct, id: string, props: VpcLinkProps = {}) {
super(scope, id, {
physicalName: props.vpcLinkName ||
Lazy.stringValue({ produce: () => Names.nodeUniqueId(this.node) }),
Lazy.string({ produce: () => Names.nodeUniqueId(this.node) }),
});

const cfnResource = new CfnVpcLink(this, 'Resource', {
name: this.physicalName,
description: props.description,
targetArns: Lazy.listValue({ produce: () => this.renderTargets() }),
targetArns: Lazy.list({ produce: () => this.renderTargets() }),
});

this.vpcLinkId = cfnResource.ref;
Expand Down
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-apigateway/test/deployment.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ describe('deployment', () => {

// tokens supported, and are resolved upon synthesis
const value = 'hello hello';
deployment.addToLogicalId({ foo: Lazy.stringValue({ produce: () => value }) });
deployment.addToLogicalId({ foo: Lazy.string({ produce: () => value }) });

const template2 = synthesize();
expect(template2.Resources.deployment333819758d91bed959c6bd6268ba84f6d33e888e).toBeDefined();
Expand Down
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-apigateway/test/stage.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ describe('stage', () => {

// WHEN
const testLogGroup = new logs.LogGroup(stack, 'LogGroup');
const testFormat = apigateway.AccessLogFormat.custom(cdk.Lazy.stringValue({ produce: () => 'test' }));
const testFormat = apigateway.AccessLogFormat.custom(cdk.Lazy.string({ produce: () => 'test' }));

// THEN
expect(() => new apigateway.Stage(stack, 'my-stage', {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ export class ScalableTarget extends Resource implements IScalableTarget {
resourceId: props.resourceId,
roleArn: this.role.roleArn,
scalableDimension: props.scalableDimension,
scheduledActions: Lazy.anyValue({ produce: () => this.actions }, { omitEmptyArray: true }),
scheduledActions: Lazy.any({ produce: () => this.actions }, { omitEmptyArray: true }),
serviceNamespace: props.serviceNamespace,
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ export class StepScalingAction extends cdk.Construct {
cooldown: props.cooldown && props.cooldown.toSeconds(),
minAdjustmentMagnitude: props.minAdjustmentMagnitude,
metricAggregationType: props.metricAggregationType,
stepAdjustments: cdk.Lazy.anyValue({ produce: () => this.adjustments }),
stepAdjustments: cdk.Lazy.any({ produce: () => this.adjustments }),
} as CfnScalingPolicy.StepScalingPolicyConfigurationProperty,
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ export = {
serviceNamespace: appscaling.ServiceNamespace.DYNAMODB,
scalableDimension: 'test:TestCount',
resourceId: 'test:this/test',
minCapacity: cdk.Lazy.numberValue({ produce: () => 10 }),
maxCapacity: cdk.Lazy.numberValue({ produce: () => 1 }),
minCapacity: cdk.Lazy.number({ produce: () => 10 }),
maxCapacity: cdk.Lazy.number({ produce: () => 1 }),
});

// THEN: no exception
Expand Down
8 changes: 4 additions & 4 deletions packages/@aws-cdk/aws-appmesh/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ Create a virtual gateway with the constructor:
```typescript
const gateway = new appmesh.VirtualGateway(stack, 'gateway', {
mesh: mesh,
listeners: [appmesh.VirtualGatewayListener.httpGatewayListener({
listeners: [appmesh.VirtualGatewayListener.http({
port: 443,
healthCheck: {
interval: cdk.Duration.seconds(10),
Expand All @@ -280,7 +280,7 @@ Add a virtual gateway directly to the mesh:
const gateway = mesh.addVirtualGateway('gateway', {
accessLog: appmesh.AccessLog.fromFilePath('/dev/stdout'),
virtualGatewayName: 'virtualGateway',
listeners: [appmesh.VirtualGatewayListener.httpGatewayListener({
listeners: [appmesh.VirtualGatewayListener.http({
port: 443,
healthCheck: {
interval: cdk.Duration.seconds(10),
Expand All @@ -302,7 +302,7 @@ By default, an HTTP based route will match on `/`. All matches must start with a

```typescript
gateway.addGatewayRoute('gateway-route-http', {
routeSpec: appmesh.GatewayRouteSpec.httpRouteSpec({
routeSpec: appmesh.GatewayRouteSpec.http({
routeTarget: virtualService,
match: {
prefixMatch: '/',
Expand All @@ -316,7 +316,7 @@ You cannot omit the field, and must specify a match for these routes.

```typescript
gateway.addGatewayRoute('gateway-route-grpc', {
routeSpec: appmesh.GatewayRouteSpec.grpcRouteSpec({
routeSpec: appmesh.GatewayRouteSpec.grpc({
routeTarget: virtualService,
match: {
serviceName: 'my-service.default.svc.cluster.local',
Expand Down
34 changes: 17 additions & 17 deletions packages/@aws-cdk/aws-appmesh/lib/gateway-route-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export interface GrpcGatewayRouteMatch {
/**
* Properties specific for HTTP Based GatewayRoutes
*/
export interface HttpRouteSpecProps {
export interface HttpGatewayRouteSpecOptions {
/**
* The criterion for determining a request match for this GatewayRoute
*
Expand All @@ -46,7 +46,7 @@ export interface HttpRouteSpecProps {
/**
* Properties specific for a GRPC GatewayRoute
*/
export interface GrpcRouteSpecProps {
export interface GrpcGatewayRouteSpecOptions {
/**
* The criterion for determining a request match for this GatewayRoute
*/
Expand Down Expand Up @@ -91,28 +91,28 @@ export abstract class GatewayRouteSpec {
/**
* Creates an HTTP Based GatewayRoute
*
* @param props - no http gateway route
* @param options - no http gateway route
*/
public static httpRouteSpec(props: HttpRouteSpecProps): GatewayRouteSpec {
return new HttpGatewayRouteSpec(props, Protocol.HTTP);
public static http(options: HttpGatewayRouteSpecOptions): GatewayRouteSpec {
return new HttpGatewayRouteSpec(options, Protocol.HTTP);
}

/**
* Creates an HTTP2 Based GatewayRoute
*
* @param props - no http2 gateway route
* @param options - no http2 gateway route
*/
public static http2RouteSpec(props: HttpRouteSpecProps): GatewayRouteSpec {
return new HttpGatewayRouteSpec(props, Protocol.HTTP2);
public static http2(options: HttpGatewayRouteSpecOptions): GatewayRouteSpec {
return new HttpGatewayRouteSpec(options, Protocol.HTTP2);
}

/**
* Creates an GRPC Based GatewayRoute
*
* @param props - no grpc gateway route
* @param options - no grpc gateway route
*/
public static grpcRouteSpec(props: GrpcRouteSpecProps): GatewayRouteSpec {
return new GrpcGatewayRouteSpec(props);
public static grpc(options: GrpcGatewayRouteSpecOptions): GatewayRouteSpec {
return new GrpcGatewayRouteSpec(options);
}

/**
Expand Down Expand Up @@ -140,11 +140,11 @@ class HttpGatewayRouteSpec extends GatewayRouteSpec {
*/
readonly routeType: Protocol;

constructor(props: HttpRouteSpecProps, protocol: Protocol.HTTP | Protocol.HTTP2) {
constructor(options: HttpGatewayRouteSpecOptions, protocol: Protocol.HTTP | Protocol.HTTP2) {
super();
this.routeTarget = props.routeTarget;
this.routeTarget = options.routeTarget;
this.routeType = protocol;
this.match = props.match;
this.match = options.match;
}

public bind(_scope: cdk.Construct): GatewayRouteSpecConfig {
Expand Down Expand Up @@ -184,10 +184,10 @@ class GrpcGatewayRouteSpec extends GatewayRouteSpec {
*/
readonly routeTarget: IVirtualService;

constructor(props: GrpcRouteSpecProps) {
constructor(options: GrpcGatewayRouteSpecOptions) {
super();
this.match = props.match;
this.routeTarget = props.routeTarget;
this.match = options.match;
this.routeTarget = options.routeTarget;
}

public bind(_scope: cdk.Construct): GatewayRouteSpecConfig {
Expand Down
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-appmesh/lib/mesh.ts
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ export class Mesh extends MeshBase {

constructor(scope: Construct, id: string, props: MeshProps = {}) {
super(scope, id, {
physicalName: props.meshName || cdk.Lazy.stringValue({ produce: () => cdk.Names.uniqueId(this) }),
physicalName: props.meshName || cdk.Lazy.string({ produce: () => cdk.Names.uniqueId(this) }),
});

const mesh = new CfnMesh(this, 'Resource', {
Expand Down
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-appmesh/lib/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ export class Route extends cdk.Resource implements IRoute {

constructor(scope: Construct, id: string, props: RouteProps) {
super(scope, id, {
physicalName: props.routeName || cdk.Lazy.stringValue({ produce: () => cdk.Names.uniqueId(this) }),
physicalName: props.routeName || cdk.Lazy.string({ produce: () => cdk.Names.uniqueId(this) }),
});

this.virtualRouter = props.virtualRouter;
Expand Down
Loading

0 comments on commit 3983696

Please sign in to comment.