From 66dd2282bb6879aff803f80531fb4a1d324e97e7 Mon Sep 17 00:00:00 2001 From: Elad Ben-Israel Date: Thu, 28 Mar 2019 03:03:34 +0200 Subject: [PATCH] refactor: readonly struct properties and hide internals (#2106) This change upgrades the repo to jsii 0.8.0 which requires that all struct types (data interfaces like our "Props" interfaces) will be marked readonly in order to ensure they can be passed by-value. The new jsii version also hides all members marked as @internal which means that those APIs will not be available from outside the framework. Fixes awslabs/cdk-ops#321 BREAKING CHANGE: stack._toCloudFormation method is now unavailable and is replaced by @aws-cdk/assert.SynthUtils.toCloudFormation(stack). --- .../alexa-ask/lib/pipeline-actions.ts | 12 +- .../lib/pipeline-deploy-stack-action.ts | 18 +- .../@aws-cdk/app-delivery/package-lock.json | 2 +- packages/@aws-cdk/applet-js/package-lock.json | 2 +- packages/@aws-cdk/assert/lib/expect.ts | 26 +- packages/@aws-cdk/assert/lib/index.ts | 1 + packages/@aws-cdk/assert/lib/synth-utils.ts | 17 + packages/@aws-cdk/assert/package-lock.json | 2 +- .../@aws-cdk/assets-docker/lib/image-asset.ts | 4 +- .../@aws-cdk/assets-docker/package-lock.json | 2 +- .../assets-docker/test/test.image-asset.ts | 4 +- packages/@aws-cdk/assets/lib/asset.ts | 14 +- packages/@aws-cdk/assets/test/test.asset.ts | 6 +- .../@aws-cdk/aws-apigateway/lib/deployment.ts | 6 +- .../aws-apigateway/lib/integration.ts | 40 +-- .../aws-apigateway/lib/integrations/aws.ts | 14 +- .../aws-apigateway/lib/integrations/http.ts | 6 +- .../aws-apigateway/lib/integrations/lambda.ts | 4 +- .../@aws-cdk/aws-apigateway/lib/lambda-api.ts | 6 +- .../@aws-cdk/aws-apigateway/lib/method.ts | 20 +- .../aws-apigateway/lib/methodresponse.ts | 6 +- .../@aws-cdk/aws-apigateway/lib/resource.ts | 8 +- .../@aws-cdk/aws-apigateway/lib/restapi.ts | 32 +- packages/@aws-cdk/aws-apigateway/lib/stage.ts | 58 ++-- .../@aws-cdk/aws-apigateway/lib/vpc-link.ts | 6 +- .../aws-apigateway/test/test.deployment.ts | 4 +- .../aws-apigateway/test/test.restapi.ts | 4 +- .../lib/base-scalable-attribute.ts | 12 +- .../lib/scalable-target.ts | 22 +- .../lib/step-scaling-action.ts | 18 +- .../lib/step-scaling-policy.ts | 18 +- .../lib/target-tracking-scaling-policy.ts | 18 +- .../package-lock.json | 2 +- .../test/test.step-scaling-policy.ts | 3 +- .../lib/lifecycle-hook-target.ts | 2 +- .../lib/interval-utils.ts | 27 +- .../aws-autoscaling-common/lib/test-utils.ts | 16 +- .../aws-autoscaling-common/lib/types.ts | 6 +- .../aws-autoscaling-common/package-lock.json | 2 +- .../aws-autoscaling/lib/auto-scaling-group.ts | 142 ++++---- .../aws-autoscaling/lib/lifecycle-hook.ts | 16 +- .../aws-autoscaling/lib/scheduled-action.ts | 14 +- .../lib/step-scaling-action.ts | 18 +- .../lib/step-scaling-policy.ts | 20 +- .../lib/target-tracking-scaling-policy.ts | 16 +- .../package-lock.json | 2 +- .../aws-certificatemanager/lib/certificate.ts | 8 +- .../lib/dns-validated-certificate.ts | 2 +- .../aws-cloudformation/lib/custom-resource.ts | 8 +- .../lib/pipeline-actions.ts | 32 +- .../aws-cloudformation/package-lock.json | 2 +- .../test/test.pipeline-actions.ts | 3 +- .../aws-cloudfront/lib/web_distribution.ts | 148 +++++---- .../@aws-cdk/aws-cloudfront/package-lock.json | 2 +- .../aws-cloudfront/test/test.basic.ts | 302 +++++++++--------- packages/@aws-cdk/aws-cloudtrail/lib/index.ts | 24 +- .../@aws-cdk/aws-cloudtrail/package-lock.json | 2 +- .../aws-cloudtrail/test/test.cloudtrail.ts | 14 +- packages/@aws-cdk/aws-cloudwatch/lib/alarm.ts | 16 +- .../@aws-cdk/aws-cloudwatch/lib/dashboard.ts | 2 +- packages/@aws-cdk/aws-cloudwatch/lib/graph.ts | 42 +-- .../@aws-cdk/aws-cloudwatch/lib/layout.ts | 4 +- .../@aws-cdk/aws-cloudwatch/lib/metric.ts | 54 ++-- packages/@aws-cdk/aws-cloudwatch/lib/text.ts | 6 +- .../@aws-cdk/aws-codebuild/lib/artifacts.ts | 18 +- .../aws-codebuild/lib/pipeline-actions.ts | 30 +- .../@aws-cdk/aws-codebuild/lib/project.ts | 81 +++-- packages/@aws-cdk/aws-codebuild/lib/source.ts | 45 +-- .../@aws-cdk/aws-codebuild/package-lock.json | 2 +- .../aws-codecommit/lib/pipeline-action.ts | 8 +- .../@aws-cdk/aws-codecommit/lib/repository.ts | 14 +- .../@aws-cdk/aws-codecommit/package-lock.json | 2 +- .../aws-codedeploy/lib/lambda/application.ts | 4 +- .../lib/lambda/deployment-config.ts | 2 +- .../lib/lambda/deployment-group.ts | 24 +- .../aws-codedeploy/lib/pipeline-action.ts | 4 +- .../aws-codedeploy/lib/rollback-config.ts | 6 +- .../aws-codedeploy/lib/server/application.ts | 4 +- .../lib/server/deployment-config.ts | 8 +- .../lib/server/deployment-group.ts | 30 +- .../test/server/test.deployment-group.ts | 7 +- .../aws-codepipeline-api/lib/action.ts | 26 +- .../aws-codepipeline-api/lib/build-action.ts | 14 +- .../aws-codepipeline-api/lib/deploy-action.ts | 10 +- .../aws-codepipeline-api/lib/source-action.ts | 10 +- .../aws-codepipeline-api/lib/test-action.ts | 14 +- .../lib/cross-region-scaffold-stack.ts | 4 +- .../lib/github-source-action.ts | 12 +- .../aws-codepipeline/lib/jenkins-actions.ts | 12 +- .../aws-codepipeline/lib/jenkins-provider.ts | 33 +- .../lib/manual-approval-action.ts | 6 +- .../@aws-cdk/aws-codepipeline/lib/pipeline.ts | 16 +- .../@aws-cdk/aws-codepipeline/lib/stage.ts | 6 +- .../aws-codepipeline/test/test.action.ts | 8 +- .../aws-codepipeline/test/test.pipeline.ts | 4 +- .../aws-cognito/lib/user-pool-client.ts | 8 +- .../@aws-cdk/aws-cognito/lib/user-pool.ts | 50 +-- .../lib/scalable-attribute-api.ts | 6 +- packages/@aws-cdk/aws-dynamodb/lib/table.ts | 40 +-- packages/@aws-cdk/aws-ec2/lib/connections.ts | 6 +- .../@aws-cdk/aws-ec2/lib/machine-image.ts | 8 +- .../@aws-cdk/aws-ec2/lib/security-group.ts | 18 +- .../aws-ec2/lib/vpc-network-provider.ts | 8 +- packages/@aws-cdk/aws-ec2/lib/vpc-ref.ts | 26 +- packages/@aws-cdk/aws-ec2/lib/vpc.ts | 38 +-- packages/@aws-cdk/aws-ec2/lib/vpn.ts | 14 +- packages/@aws-cdk/aws-ecr/lib/lifecycle.ts | 12 +- .../@aws-cdk/aws-ecr/lib/pipeline-action.ts | 6 +- .../@aws-cdk/aws-ecr/lib/repository-ref.ts | 4 +- packages/@aws-cdk/aws-ecr/lib/repository.ts | 10 +- .../@aws-cdk/aws-ecs/lib/base/base-service.ts | 10 +- .../aws-ecs/lib/base/scalable-task-count.ts | 12 +- .../aws-ecs/lib/base/task-definition.ts | 43 +-- packages/@aws-cdk/aws-ecs/lib/cluster.ts | 22 +- .../aws-ecs/lib/container-definition.ts | 97 +++--- .../aws-ecs/lib/ec2/ec2-event-rule-target.ts | 6 +- .../@aws-cdk/aws-ecs/lib/ec2/ec2-service.ts | 12 +- .../aws-ecs/lib/ec2/ec2-task-definition.ts | 4 +- .../aws-ecs/lib/fargate/fargate-service.ts | 12 +- .../lib/fargate/fargate-task-definition.ts | 4 +- .../aws-ecs/lib/images/asset-image.ts | 2 +- .../@aws-cdk/aws-ecs/lib/images/repository.ts | 2 +- .../@aws-cdk/aws-ecs/lib/linux-parameters.ts | 12 +- .../aws-ecs/lib/load-balanced-ecs-service.ts | 4 +- .../load-balanced-fargate-service-applet.ts | 22 +- .../lib/load-balanced-fargate-service.ts | 12 +- .../aws-ecs/lib/load-balanced-service-base.ts | 16 +- .../aws-ecs/lib/log-drivers/aws-log-driver.ts | 8 +- packages/@aws-cdk/aws-ecs/package-lock.json | 2 +- packages/@aws-cdk/aws-eks/lib/ami.ts | 4 +- packages/@aws-cdk/aws-eks/lib/cluster.ts | 16 +- .../lib/load-balancer.ts | 38 +-- .../alb/application-listener-certificate.ts | 4 +- .../lib/alb/application-listener-rule.ts | 10 +- .../lib/alb/application-listener.ts | 44 +-- .../lib/alb/application-load-balancer.ts | 12 +- .../lib/alb/application-target-group.ts | 10 +- .../lib/nlb/network-listener.ts | 22 +- .../lib/nlb/network-load-balancer.ts | 4 +- .../lib/nlb/network-target-group.ts | 6 +- .../lib/shared/base-listener.ts | 1 + .../lib/shared/base-load-balancer.ts | 10 +- .../lib/shared/base-target-group.ts | 36 +-- .../@aws-cdk/aws-events/lib/event-pattern.ts | 18 +- .../@aws-cdk/aws-events/lib/input-options.ts | 6 +- packages/@aws-cdk/aws-events/lib/rule-ref.ts | 2 +- packages/@aws-cdk/aws-events/lib/rule.ts | 12 +- packages/@aws-cdk/aws-events/lib/target.ts | 12 +- packages/@aws-cdk/aws-glue/lib/data-format.ts | 6 +- packages/@aws-cdk/aws-glue/lib/database.ts | 14 +- packages/@aws-cdk/aws-glue/lib/schema.ts | 10 +- packages/@aws-cdk/aws-glue/lib/table.ts | 28 +- packages/@aws-cdk/aws-iam/lib/group.ts | 6 +- .../@aws-cdk/aws-iam/lib/policy-document.ts | 2 +- packages/@aws-cdk/aws-iam/lib/policy.ts | 10 +- packages/@aws-cdk/aws-iam/lib/role.ts | 18 +- packages/@aws-cdk/aws-iam/lib/user.ts | 12 +- packages/@aws-cdk/aws-iam/test/test.role.ts | 6 +- packages/@aws-cdk/aws-kinesis/lib/stream.ts | 14 +- packages/@aws-cdk/aws-kms/lib/alias.ts | 4 +- packages/@aws-cdk/aws-kms/lib/key.ts | 12 +- .../aws-lambda-event-sources/lib/dynamodb.ts | 4 +- .../aws-lambda-event-sources/lib/kinesis.ts | 4 +- .../aws-lambda-event-sources/lib/s3.ts | 4 +- .../aws-lambda-event-sources/lib/sqs.ts | 2 +- packages/@aws-cdk/aws-lambda/lib/alias.ts | 8 +- packages/@aws-cdk/aws-lambda/lib/code.ts | 11 + .../aws-lambda/lib/event-source-mapping.ts | 10 +- .../@aws-cdk/aws-lambda/lib/function-base.ts | 7 +- packages/@aws-cdk/aws-lambda/lib/function.ts | 40 +-- .../@aws-cdk/aws-lambda/lib/lambda-version.ts | 6 +- packages/@aws-cdk/aws-lambda/lib/layers.ts | 20 +- .../@aws-cdk/aws-lambda/lib/permission.ts | 10 +- .../aws-lambda/lib/pipeline-action.ts | 16 +- packages/@aws-cdk/aws-lambda/lib/runtime.ts | 2 +- .../aws-lambda/lib/singleton-lambda.ts | 4 +- .../aws-logs/lib/cross-account-destination.ts | 6 +- packages/@aws-cdk/aws-logs/lib/log-group.ts | 24 +- packages/@aws-cdk/aws-logs/lib/log-stream.ts | 8 +- .../@aws-cdk/aws-logs/lib/metric-filter.ts | 12 +- packages/@aws-cdk/aws-logs/lib/pattern.ts | 6 +- .../aws-logs/lib/subscription-filter.ts | 6 +- .../@aws-cdk/aws-quickstarts/lib/database.ts | 16 +- packages/@aws-cdk/aws-quickstarts/lib/rdgw.ts | 24 +- .../aws-rds/lib/cluster-parameter-group.ts | 8 +- packages/@aws-cdk/aws-rds/lib/cluster-ref.ts | 14 +- packages/@aws-cdk/aws-rds/lib/cluster.ts | 28 +- .../@aws-cdk/aws-rds/lib/database-secret.ts | 4 +- packages/@aws-cdk/aws-rds/lib/props.ts | 18 +- .../aws-rds/lib/rotation-single-user.ts | 14 +- .../aws-route53/lib/hosted-zone-provider.ts | 6 +- .../aws-route53/lib/hosted-zone-ref.ts | 4 +- .../@aws-cdk/aws-route53/lib/hosted-zone.ts | 14 +- .../@aws-cdk/aws-route53/lib/records/alias.ts | 10 +- .../@aws-cdk/aws-route53/lib/records/cname.ts | 8 +- .../@aws-cdk/aws-route53/lib/records/txt.ts | 8 +- .../lib/records/zone-delegation.ts | 6 +- .../@aws-cdk/aws-route53/package-lock.json | 2 +- .../lib/bucket-deployment.ts | 8 +- .../@aws-cdk/aws-s3-deployment/lib/source.ts | 4 +- .../aws-s3-notifications/lib/destination.ts | 6 +- packages/@aws-cdk/aws-s3/lib/bucket-policy.ts | 2 +- packages/@aws-cdk/aws-s3/lib/bucket.ts | 42 +-- .../@aws-cdk/aws-s3/lib/pipeline-actions.ts | 16 +- packages/@aws-cdk/aws-s3/lib/rule.ts | 30 +- packages/@aws-cdk/aws-s3/test/test.bucket.ts | 6 +- .../aws-s3/test/test.notifications.ts | 4 +- .../lib/rotation-schedule.ts | 6 +- .../aws-secretsmanager/lib/secret-string.ts | 6 +- .../@aws-cdk/aws-secretsmanager/lib/secret.ts | 40 +-- .../lib/alias-target-instance.ts | 4 +- .../lib/cname-instance.ts | 4 +- .../aws-servicediscovery/lib/instance.ts | 4 +- .../aws-servicediscovery/lib/ip-instance.ts | 8 +- .../aws-servicediscovery/lib/namespace.ts | 4 +- .../lib/non-ip-instance.ts | 2 +- .../lib/private-dns-namespace.ts | 2 +- .../aws-servicediscovery/lib/service.ts | 26 +- .../@aws-cdk/aws-ses/lib/receipt-filter.ts | 8 +- .../aws-ses/lib/receipt-rule-action.ts | 50 +-- .../@aws-cdk/aws-ses/lib/receipt-rule-set.ts | 8 +- packages/@aws-cdk/aws-ses/lib/receipt-rule.ts | 18 +- packages/@aws-cdk/aws-sns/lib/policy.ts | 2 +- packages/@aws-cdk/aws-sns/lib/subscription.ts | 8 +- packages/@aws-cdk/aws-sns/lib/topic-base.ts | 6 +- packages/@aws-cdk/aws-sns/lib/topic.ts | 4 +- packages/@aws-cdk/aws-sqs/lib/policy.ts | 2 +- packages/@aws-cdk/aws-sqs/lib/queue-base.ts | 8 +- packages/@aws-cdk/aws-sqs/lib/queue.ts | 28 +- packages/@aws-cdk/aws-sqs/package-lock.json | 2 +- packages/@aws-cdk/aws-sqs/test/test.sqs.ts | 10 +- .../aws-ssm/lib/parameter-store-string.ts | 8 +- packages/@aws-cdk/aws-ssm/lib/parameter.ts | 10 +- .../aws-stepfunctions/lib/activity.ts | 2 +- .../lib/state-machine-fragment.ts | 4 +- .../aws-stepfunctions/lib/state-machine.ts | 10 +- .../aws-stepfunctions/lib/states/choice.ts | 10 +- .../aws-stepfunctions/lib/states/fail.ts | 6 +- .../aws-stepfunctions/lib/states/parallel.ts | 8 +- .../aws-stepfunctions/lib/states/pass.ts | 10 +- .../aws-stepfunctions/lib/states/state.ts | 18 +- .../aws-stepfunctions/lib/states/succeed.ts | 6 +- .../aws-stepfunctions/lib/states/task.ts | 26 +- .../aws-stepfunctions/lib/states/wait.ts | 10 +- .../@aws-cdk/aws-stepfunctions/lib/types.ts | 12 +- packages/@aws-cdk/cdk/lib/app.ts | 36 +-- packages/@aws-cdk/cdk/lib/arn.ts | 47 ++- packages/@aws-cdk/cdk/lib/cfn-condition.ts | 5 +- packages/@aws-cdk/cdk/lib/cfn-mapping.ts | 5 +- packages/@aws-cdk/cdk/lib/cfn-output.ts | 13 +- packages/@aws-cdk/cdk/lib/cfn-parameter.ts | 25 +- packages/@aws-cdk/cdk/lib/cfn-resource.ts | 9 +- packages/@aws-cdk/cdk/lib/cfn-rule.ts | 11 +- packages/@aws-cdk/cdk/lib/construct.ts | 18 +- packages/@aws-cdk/cdk/lib/context.ts | 2 +- .../@aws-cdk/cdk/lib/dynamic-reference.ts | 4 +- packages/@aws-cdk/cdk/lib/environment.ts | 4 +- packages/@aws-cdk/cdk/lib/include.ts | 5 +- packages/@aws-cdk/cdk/lib/resource-policy.ts | 44 +-- packages/@aws-cdk/cdk/lib/secret.ts | 14 +- packages/@aws-cdk/cdk/lib/stack.ts | 78 ++--- packages/@aws-cdk/cdk/lib/synthesis.ts | 137 +++++--- packages/@aws-cdk/cdk/lib/tag-aspect.ts | 8 +- packages/@aws-cdk/cdk/lib/tag.ts | 4 +- packages/@aws-cdk/cdk/lib/token.ts | 4 +- packages/@aws-cdk/cdk/lib/util.ts | 22 ++ packages/@aws-cdk/cdk/package-lock.json | 2 +- packages/@aws-cdk/cdk/test/test.app.ts | 8 +- packages/@aws-cdk/cdk/test/test.synthesis.ts | 50 ++- packages/@aws-cdk/cfnspec/package-lock.json | 2 +- .../cloudformation-diff/package-lock.json | 2 +- packages/@aws-cdk/cx-api/lib/artifacts.ts | 14 +- packages/@aws-cdk/cx-api/lib/build.ts | 8 +- .../cx-api/lib/context/availability-zones.ts | 5 +- .../cx-api/lib/context/hosted-zone.ts | 10 +- .../cx-api/lib/context/ssm-parameter.ts | 6 +- packages/@aws-cdk/cx-api/lib/context/vpc.ts | 24 +- packages/@aws-cdk/cx-api/lib/cxapi.ts | 34 +- packages/@aws-cdk/cx-api/lib/environment.ts | 6 +- .../@aws-cdk/cx-api/lib/metadata/assets.ts | 20 +- .../@aws-cdk/region-info/package-lock.json | 2 +- packages/@aws-cdk/runtime-values/lib/rtv.ts | 4 +- .../@aws-cdk/runtime-values/test/test.rtv.ts | 1 - packages/decdk/package-lock.json | 61 ++-- packages/decdk/package.json | 2 +- .../simple-resource-bundler/package-lock.json | 2 +- scripts/foreach.sh | 4 +- tools/awslint/package-lock.json | 2 +- tools/cdk-build-tools/package-lock.json | 105 ++---- tools/cdk-build-tools/package.json | 4 +- tools/cdk-integ-tools/package-lock.json | 2 +- tools/cfn2ts/lib/codegen.ts | 2 +- tools/cfn2ts/package-lock.json | 2 +- tools/pkglint/package-lock.json | 2 +- tools/pkgtools/package-lock.json | 2 +- tools/y-npm/package-lock.json | 2 +- 296 files changed, 2372 insertions(+), 2223 deletions(-) create mode 100644 packages/@aws-cdk/assert/lib/synth-utils.ts diff --git a/packages/@aws-cdk/alexa-ask/lib/pipeline-actions.ts b/packages/@aws-cdk/alexa-ask/lib/pipeline-actions.ts index 83d1b5f20738d..fe2705ef3d9b0 100644 --- a/packages/@aws-cdk/alexa-ask/lib/pipeline-actions.ts +++ b/packages/@aws-cdk/alexa-ask/lib/pipeline-actions.ts @@ -8,32 +8,32 @@ export interface AlexaSkillDeployActionProps extends codepipeline.CommonActionPr /** * The client id of the developer console token */ - clientId: cdk.Secret; + readonly clientId: cdk.Secret; /** * The client secret of the developer console token */ - clientSecret: cdk.Secret; + readonly clientSecret: cdk.Secret; /** * The refresh token of the developer console token */ - refreshToken: cdk.Secret; + readonly refreshToken: cdk.Secret; /** * The Alexa skill id */ - skillId: string; + readonly skillId: string; /** * The source artifact containing the voice model and skill manifest */ - inputArtifact: codepipeline.Artifact; + readonly inputArtifact: codepipeline.Artifact; /** * An optional artifact containing overrides for the skill manifest */ - parameterOverridesArtifact?: codepipeline.Artifact; + readonly parameterOverridesArtifact?: codepipeline.Artifact; } /** diff --git a/packages/@aws-cdk/app-delivery/lib/pipeline-deploy-stack-action.ts b/packages/@aws-cdk/app-delivery/lib/pipeline-deploy-stack-action.ts index 9e4632ae4c9c1..dc6ff8ebc2f8a 100644 --- a/packages/@aws-cdk/app-delivery/lib/pipeline-deploy-stack-action.ts +++ b/packages/@aws-cdk/app-delivery/lib/pipeline-deploy-stack-action.ts @@ -8,39 +8,39 @@ export interface PipelineDeployStackActionProps { /** * The CDK stack to be deployed. */ - stack: cdk.Stack; + readonly stack: cdk.Stack; /** * The CodePipeline stage in which to perform the deployment. */ - stage: codepipeline.IStage; + readonly stage: codepipeline.IStage; /** * The CodePipeline artifact that holds the synthesized app, which is the * contents of the ```` when running ``cdk synth -o ``. */ - inputArtifact: codepipeline.Artifact; + readonly inputArtifact: codepipeline.Artifact; /** * The name to use when creating a ChangeSet for the stack. * * @default CDK-CodePipeline-ChangeSet */ - changeSetName?: string; + readonly changeSetName?: string; /** * The runOrder for the CodePipeline action creating the ChangeSet. * * @default 1 */ - createChangeSetRunOrder?: number; + readonly createChangeSetRunOrder?: number; /** * The runOrder for the CodePipeline action executing the ChangeSet. * * @default ``createChangeSetRunOrder + 1`` */ - executeChangeSetRunOrder?: number; + readonly executeChangeSetRunOrder?: number; /** * IAM role to assume when deploying changes. @@ -51,7 +51,7 @@ export interface PipelineDeployStackActionProps { * * @default A fresh role with admin or no permissions (depending on the value of `adminPermissions`). */ - role?: iam.IRole; + readonly role?: iam.IRole; /** * Acknowledge certain changes made as part of deployment @@ -64,7 +64,7 @@ export interface PipelineDeployStackActionProps { * @see https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-iam-template.html#using-iam-capabilities * @default AnonymousIAM, unless `adminPermissions` is true */ - capabilities?: cfn.CloudFormationCapabilities; + readonly capabilities?: cfn.CloudFormationCapabilities; /** * Whether to grant admin permissions to CloudFormation while deploying this template. @@ -81,7 +81,7 @@ export interface PipelineDeployStackActionProps { * use `addToRolePolicy` and `capabilities` to control what the CloudFormation * deployment is allowed to do. */ - adminPermissions: boolean; + readonly adminPermissions: boolean; } /** diff --git a/packages/@aws-cdk/app-delivery/package-lock.json b/packages/@aws-cdk/app-delivery/package-lock.json index 09a0bb9abe6e0..b42160748caf2 100644 --- a/packages/@aws-cdk/app-delivery/package-lock.json +++ b/packages/@aws-cdk/app-delivery/package-lock.json @@ -1,6 +1,6 @@ { "name": "@aws-cdk/app-delivery", - "version": "0.25.3", + "version": "0.26.0", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/packages/@aws-cdk/applet-js/package-lock.json b/packages/@aws-cdk/applet-js/package-lock.json index 1e25d4a689835..d8a818655f886 100644 --- a/packages/@aws-cdk/applet-js/package-lock.json +++ b/packages/@aws-cdk/applet-js/package-lock.json @@ -1,6 +1,6 @@ { "name": "@aws-cdk/applet-js", - "version": "0.25.3", + "version": "0.26.0", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/packages/@aws-cdk/assert/lib/expect.ts b/packages/@aws-cdk/assert/lib/expect.ts index f1c444a425caa..9fca81ff8e2f3 100644 --- a/packages/@aws-cdk/assert/lib/expect.ts +++ b/packages/@aws-cdk/assert/lib/expect.ts @@ -1,26 +1,22 @@ import cdk = require('@aws-cdk/cdk'); +import { ConstructNode, ConstructOrder } from '@aws-cdk/cdk'; import api = require('@aws-cdk/cx-api'); import { StackInspector } from './inspector'; +import { SynthUtils } from './synth-utils'; export function expect(stack: api.SynthesizedStack | cdk.Stack, skipValidation = false): StackInspector { // Can't use 'instanceof' here, that breaks if we have multiple copies // of this library. let sstack: api.SynthesizedStack; - if (isStackClassInstance(stack)) { - if (!skipValidation) { - // Do a prepare-and-validate run over the given stack - stack.node.prepareTree(); - - const errors = stack.node.validateTree(); - if (errors.length > 0) { - throw new Error(`Stack validation failed:\n${errors.map(e => `${e.message} at: ${e.source.node.scope}`).join('\n')}`); - } - } + if (cdk.Stack.isStack(stack)) { + const session = SynthUtils.synthesize(stack, { + skipValidation + }); sstack = { name: stack.name, - template: stack._toCloudFormation(), + template: SynthUtils.templateForStackName(session, stack.name), metadata: collectStackMetadata(stack.node), environment: { name: 'test', @@ -35,13 +31,9 @@ export function expect(stack: api.SynthesizedStack | cdk.Stack, skipValidation = return new StackInspector(sstack); } -function isStackClassInstance(x: api.SynthesizedStack | cdk.Stack): x is cdk.Stack { - return '_toCloudFormation' in x; -} - -function collectStackMetadata(root: cdk.ConstructNode): api.StackMetadata { +function collectStackMetadata(root: ConstructNode): api.StackMetadata { const result: api.StackMetadata = {}; - for (const construct of root.findAll(cdk.ConstructOrder.PreOrder)) { + for (const construct of root.findAll(ConstructOrder.PreOrder)) { const path = `/${root.id}/${construct.node.path}`; for (const entry of construct.node.metadata) { result[path] = result[path] || []; diff --git a/packages/@aws-cdk/assert/lib/index.ts b/packages/@aws-cdk/assert/lib/index.ts index e811cd2e0bb0d..b79d93592affc 100644 --- a/packages/@aws-cdk/assert/lib/index.ts +++ b/packages/@aws-cdk/assert/lib/index.ts @@ -1,6 +1,7 @@ export * from './assertion'; export * from './expect'; export * from './inspector'; +export * from './synth-utils'; export * from './assertions/exist'; export * from './assertions/have-resource'; diff --git a/packages/@aws-cdk/assert/lib/synth-utils.ts b/packages/@aws-cdk/assert/lib/synth-utils.ts new file mode 100644 index 0000000000000..2d3e1d237dfff --- /dev/null +++ b/packages/@aws-cdk/assert/lib/synth-utils.ts @@ -0,0 +1,17 @@ +import { ISynthesisSession, Stack, SynthesisOptions, Synthesizer } from '@aws-cdk/cdk'; + +export class SynthUtils { + public static toCloudFormation(stack: Stack, options: SynthesisOptions = { }): any { + const session = this.synthesize(stack, options); + return this.templateForStackName(session, stack.name); + } + + public static templateForStackName(session: ISynthesisSession, stackName: string): any { + return session.store.readJson(session.getArtifact(stackName).properties!.templateFile); + } + + public static synthesize(stack: Stack, options: SynthesisOptions): ISynthesisSession { + const synth = new Synthesizer(); + return synth.synthesize(stack, options); + } +} diff --git a/packages/@aws-cdk/assert/package-lock.json b/packages/@aws-cdk/assert/package-lock.json index 9de1c314a3aad..1dde198c79e55 100644 --- a/packages/@aws-cdk/assert/package-lock.json +++ b/packages/@aws-cdk/assert/package-lock.json @@ -1,6 +1,6 @@ { "name": "@aws-cdk/assert", - "version": "0.25.3", + "version": "0.26.0", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/packages/@aws-cdk/assets-docker/lib/image-asset.ts b/packages/@aws-cdk/assets-docker/lib/image-asset.ts index 2bc8cc1850876..a968d8794f88f 100644 --- a/packages/@aws-cdk/assets-docker/lib/image-asset.ts +++ b/packages/@aws-cdk/assets-docker/lib/image-asset.ts @@ -9,7 +9,7 @@ export interface DockerImageAssetProps { /** * The directory where the Dockerfile is stored */ - directory: string; + readonly directory: string; /** * ECR repository name @@ -20,7 +20,7 @@ export interface DockerImageAssetProps { * * @default automatically derived from the asset's ID. */ - repositoryName?: string; + readonly repositoryName?: string; } /** diff --git a/packages/@aws-cdk/assets-docker/package-lock.json b/packages/@aws-cdk/assets-docker/package-lock.json index 90f3cd63db2fd..f64c37465ff3c 100644 --- a/packages/@aws-cdk/assets-docker/package-lock.json +++ b/packages/@aws-cdk/assets-docker/package-lock.json @@ -1,6 +1,6 @@ { "name": "@aws-cdk/assets-docker", - "version": "0.25.3", + "version": "0.26.0", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/packages/@aws-cdk/assets-docker/test/test.image-asset.ts b/packages/@aws-cdk/assets-docker/test/test.image-asset.ts index 42aacd7a565fc..de211f535fc39 100644 --- a/packages/@aws-cdk/assets-docker/test/test.image-asset.ts +++ b/packages/@aws-cdk/assets-docker/test/test.image-asset.ts @@ -1,4 +1,4 @@ -import { expect, haveResource } from '@aws-cdk/assert'; +import { expect, haveResource, SynthUtils } from '@aws-cdk/assert'; import iam = require('@aws-cdk/aws-iam'); import cdk = require('@aws-cdk/cdk'); import { Test } from 'nodeunit'; @@ -18,7 +18,7 @@ export = { }); // THEN - const template = stack._toCloudFormation(); + const template = SynthUtils.toCloudFormation(stack); test.deepEqual(template.Parameters.ImageImageName5E684353, { Type: 'String', diff --git a/packages/@aws-cdk/assets/lib/asset.ts b/packages/@aws-cdk/assets/lib/asset.ts index e7d230aa60be4..378c73a2da87d 100644 --- a/packages/@aws-cdk/assets/lib/asset.ts +++ b/packages/@aws-cdk/assets/lib/asset.ts @@ -25,18 +25,18 @@ export interface GenericAssetProps { /** * The disk location of the asset. */ - path: string; + readonly path: string; /** * The packaging type for this asset. */ - packaging: AssetPackaging; + readonly packaging: AssetPackaging; /** * A list of principals that should be able to read this asset from S3. * You can use `asset.grantRead(principal)` to grant read permissions later. */ - readers?: iam.IPrincipal[]; + readonly readers?: iam.IPrincipal[]; } /** @@ -184,13 +184,13 @@ export interface FileAssetProps { /** * File path. */ - path: string; + readonly path: string; /** * A list of principals that should be able to read this file asset from S3. * You can use `asset.grantRead(principal)` to grant read permissions later. */ - readers?: iam.IPrincipal[]; + readonly readers?: iam.IPrincipal[]; } /** @@ -206,13 +206,13 @@ export interface ZipDirectoryAssetProps { /** * Path of the directory. */ - path: string; + readonly path: string; /** * A list of principals that should be able to read this ZIP file from S3. * You can use `asset.grantRead(principal)` to grant read permissions later. */ - readers?: iam.IPrincipal[]; + readonly readers?: iam.IPrincipal[]; } /** diff --git a/packages/@aws-cdk/assets/test/test.asset.ts b/packages/@aws-cdk/assets/test/test.asset.ts index 1c28ec9ef4d04..82147d630f893 100644 --- a/packages/@aws-cdk/assets/test/test.asset.ts +++ b/packages/@aws-cdk/assets/test/test.asset.ts @@ -1,4 +1,4 @@ -import { expect, haveResource, ResourcePart } from '@aws-cdk/assert'; +import { expect, haveResource, ResourcePart, SynthUtils } from '@aws-cdk/assert'; import iam = require('@aws-cdk/aws-iam'); import cdk = require('@aws-cdk/cdk'); import cxapi = require('@aws-cdk/cx-api'); @@ -30,7 +30,7 @@ export = { }); // verify that now the template contains parameters for this asset - const template = stack._toCloudFormation(); + const template = SynthUtils.toCloudFormation(stack); test.equal(template.Parameters.MyAssetS3Bucket68C9B344.Type, 'String'); test.equal(template.Parameters.MyAssetS3VersionKey68E1A45D.Type, 'String'); @@ -74,7 +74,7 @@ export = { }); // verify that now the template contains parameters for this asset - const template = stack._toCloudFormation(); + const template = SynthUtils.toCloudFormation(stack); test.equal(template.Parameters.MyAssetS3Bucket68C9B344.Type, 'String'); test.equal(template.Parameters.MyAssetS3VersionKey68E1A45D.Type, 'String'); diff --git a/packages/@aws-cdk/aws-apigateway/lib/deployment.ts b/packages/@aws-cdk/aws-apigateway/lib/deployment.ts index 49c31a5a0804b..74c0dfda90afb 100644 --- a/packages/@aws-cdk/aws-apigateway/lib/deployment.ts +++ b/packages/@aws-cdk/aws-apigateway/lib/deployment.ts @@ -7,12 +7,12 @@ export interface DeploymentProps { /** * The Rest API to deploy. */ - api: IRestApi; + readonly api: IRestApi; /** * A description of the purpose of the API Gateway deployment. */ - description?: string; + readonly description?: string; /** * When an API Gateway model is updated, a new deployment will automatically be created. @@ -21,7 +21,7 @@ export interface DeploymentProps { * * @default false */ - retainDeployments?: boolean; + readonly retainDeployments?: boolean; } /** diff --git a/packages/@aws-cdk/aws-apigateway/lib/integration.ts b/packages/@aws-cdk/aws-apigateway/lib/integration.ts index 1f47868e186f1..5883555d69698 100644 --- a/packages/@aws-cdk/aws-apigateway/lib/integration.ts +++ b/packages/@aws-cdk/aws-apigateway/lib/integration.ts @@ -7,12 +7,12 @@ export interface IntegrationOptions { * A list of request parameters whose values are to be cached. It determines * request parameters that will make it into the cache key. */ - cacheKeyParameters?: string[]; + readonly cacheKeyParameters?: string[]; /** * An API-specific tag group of related cached parameters. */ - cacheNamespace?: string; + readonly cacheNamespace?: string; /** * Specifies how to handle request payload content type conversions. @@ -22,7 +22,7 @@ export interface IntegrationOptions { * modification, provided that the `passthroughBehaviors` property is * configured to support payload pass-through. */ - contentHandling?: ContentHandling; + readonly contentHandling?: ContentHandling; /** * An IAM role that API Gateway assumes. @@ -31,14 +31,14 @@ export interface IntegrationOptions { * * @default A role is not assumed */ - credentialsRole?: iam.Role; + readonly credentialsRole?: iam.Role; /** * Requires that the caller's identity be passed through from the request. * * @default Caller identity is not passed through */ - credentialsPassthrough?: boolean; + readonly credentialsPassthrough?: boolean; /** * Specifies the pass-through behavior for incoming requests based on the @@ -47,7 +47,7 @@ export interface IntegrationOptions { * There are three valid values: WHEN_NO_MATCH, WHEN_NO_TEMPLATES, and * NEVER. */ - passthroughBehavior?: PassthroughBehavior + readonly passthroughBehavior?: PassthroughBehavior /** * The request parameters that API Gateway sends with the backend request. @@ -62,7 +62,7 @@ export interface IntegrationOptions { * value. You must enclose static values in single quotation marks and * pre-encode these values based on their destination in the request. */ - requestParameters?: { [dest: string]: string }; + readonly requestParameters?: { [dest: string]: string }; /** * A map of Apache Velocity templates that are applied on the request @@ -75,7 +75,7 @@ export interface IntegrationOptions { * * @see http://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-mapping-template-reference.html */ - requestTemplates?: { [contentType: string]: string }; + readonly requestTemplates?: { [contentType: string]: string }; /** * The response that API Gateway provides after a method's backend completes @@ -84,26 +84,26 @@ export interface IntegrationOptions { * responses. For example, you can map the backend status codes to codes * that you define. */ - integrationResponses?: IntegrationResponse[]; + readonly integrationResponses?: IntegrationResponse[]; /** * The type of network connection to the integration endpoint. * @default ConnectionType.Internet */ - connectionType?: ConnectionType; + readonly connectionType?: ConnectionType; /** * The VpcLink used for the integration. * Required if connectionType is VPC_LINK */ - vpcLink?: VpcLink; + readonly vpcLink?: VpcLink; } export interface IntegrationProps { /** * Specifies an API method integration type. */ - type: IntegrationType; + readonly type: IntegrationType; /** * The Uniform Resource Identifier (URI) for the integration. @@ -118,18 +118,18 @@ export interface IntegrationProps { * * @see https://docs.aws.amazon.com/apigateway/api-reference/resource/integration/#uri */ - uri?: any; + readonly uri?: any; /** * The integration's HTTP method type. * Required unless you use a MOCK integration. */ - integrationHttpMethod?: string; + readonly integrationHttpMethod?: string; /** * Integration options. */ - options?: IntegrationOptions; + readonly options?: IntegrationOptions; } /** @@ -243,13 +243,13 @@ export interface IntegrationResponse { * * @see https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-integration-settings-integration-response.html */ - selectionPattern?: string; + readonly selectionPattern?: string; /** * The status code that API Gateway uses to map the integration response to * a MethodResponse status code. */ - statusCode: string; + readonly statusCode: string; /** * Specifies how to handle request payload content type conversions. @@ -257,7 +257,7 @@ export interface IntegrationResponse { * @default none the request payload is passed through from the method * request to the integration request without modification. */ - contentHandling?: ContentHandling; + readonly contentHandling?: ContentHandling; /** * The response parameters from the backend response that API Gateway sends @@ -274,7 +274,7 @@ export interface IntegrationResponse { * * @see http://docs.aws.amazon.com/apigateway/latest/developerguide/request-response-data-mappings.html */ - responseParameters?: { [destination: string]: string }; + readonly responseParameters?: { [destination: string]: string }; /** * The templates that are used to transform the integration response body. @@ -283,5 +283,5 @@ export interface IntegrationResponse { * * @see http://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-mapping-template-reference.html */ - responseTemplates?: { [contentType: string]: string }; + readonly responseTemplates?: { [contentType: string]: string }; } diff --git a/packages/@aws-cdk/aws-apigateway/lib/integrations/aws.ts b/packages/@aws-cdk/aws-apigateway/lib/integrations/aws.ts index a4fe394384033..5dd0c2584e85c 100644 --- a/packages/@aws-cdk/aws-apigateway/lib/integrations/aws.ts +++ b/packages/@aws-cdk/aws-apigateway/lib/integrations/aws.ts @@ -9,18 +9,18 @@ export interface AwsIntegrationProps { * * @default false */ - proxy?: boolean; + readonly proxy?: boolean; /** * The name of the integrated AWS service (e.g. `s3`) */ - service: string; + readonly service: string; /** * A designated subdomain supported by certain AWS service for fast * host-name lookup. */ - subdomain?: string; + readonly subdomain?: string; /** * The path to use for path-base APIs. @@ -30,7 +30,7 @@ export interface AwsIntegrationProps { * * Mutually exclusive with the `action` options. */ - path?: string; + readonly path?: string; /** * The AWS action to perform in the integration. @@ -39,7 +39,7 @@ export interface AwsIntegrationProps { * * Mutually exclusive with `path`. */ - action?: string; + readonly action?: string; /** * Parameters for the action. @@ -47,12 +47,12 @@ export interface AwsIntegrationProps { * `action` must be set, and `path` must be undefined. * The action params will be URL encoded. */ - actionParameters?: { [key: string]: string }; + readonly actionParameters?: { [key: string]: string }; /** * Integration options, such as content handling, request/response mapping, etc. */ - options?: IntegrationOptions + readonly options?: IntegrationOptions } /** diff --git a/packages/@aws-cdk/aws-apigateway/lib/integrations/http.ts b/packages/@aws-cdk/aws-apigateway/lib/integrations/http.ts index faed63c8f6371..d98f0b7853075 100644 --- a/packages/@aws-cdk/aws-apigateway/lib/integrations/http.ts +++ b/packages/@aws-cdk/aws-apigateway/lib/integrations/http.ts @@ -6,13 +6,13 @@ export interface HttpIntegrationProps { * * @default true */ - proxy?: boolean; + readonly proxy?: boolean; /** * HTTP method to use when invoking the backend URL. * @default GET */ - httpMethod?: string; + readonly httpMethod?: string; /** * Integration options, such as request/resopnse mapping, content handling, @@ -20,7 +20,7 @@ export interface HttpIntegrationProps { * * @default defaults based on `IntegrationOptions` defaults */ - options?: IntegrationOptions; + readonly options?: IntegrationOptions; } /** diff --git a/packages/@aws-cdk/aws-apigateway/lib/integrations/lambda.ts b/packages/@aws-cdk/aws-apigateway/lib/integrations/lambda.ts index 10ba40547523d..26c2560c12d1e 100644 --- a/packages/@aws-cdk/aws-apigateway/lib/integrations/lambda.ts +++ b/packages/@aws-cdk/aws-apigateway/lib/integrations/lambda.ts @@ -9,7 +9,7 @@ export interface LambdaIntegrationOptions extends IntegrationOptions { * Use proxy integration or normal (request/response mapping) integration. * @default true */ - proxy?: boolean; + readonly proxy?: boolean; /** * Allow invoking method from AWS Console UI (for testing purposes). @@ -21,7 +21,7 @@ export interface LambdaIntegrationOptions extends IntegrationOptions { * * @default true */ - allowTestInvoke?: boolean; + readonly allowTestInvoke?: boolean; } /** diff --git a/packages/@aws-cdk/aws-apigateway/lib/lambda-api.ts b/packages/@aws-cdk/aws-apigateway/lib/lambda-api.ts index 74a2811eaacf8..553a955fbc57d 100644 --- a/packages/@aws-cdk/aws-apigateway/lib/lambda-api.ts +++ b/packages/@aws-cdk/aws-apigateway/lib/lambda-api.ts @@ -12,7 +12,7 @@ export interface LambdaRestApiProps { * This handler will be used as a the default integration for all methods in * this API, unless specified otherwise in `addMethod`. */ - handler: lambda.IFunction; + readonly handler: lambda.IFunction; /** * If true, route all requests to the Lambda Function @@ -22,14 +22,14 @@ export interface LambdaRestApiProps { * * @default true */ - proxy?: boolean; + readonly proxy?: boolean; /** * Further customization of the REST API. * * @default defaults */ - options?: RestApiProps; + readonly options?: RestApiProps; } /** diff --git a/packages/@aws-cdk/aws-apigateway/lib/method.ts b/packages/@aws-cdk/aws-apigateway/lib/method.ts index 7375c8b51cf08..e492cb573c722 100644 --- a/packages/@aws-cdk/aws-apigateway/lib/method.ts +++ b/packages/@aws-cdk/aws-apigateway/lib/method.ts @@ -12,13 +12,13 @@ export interface MethodOptions { * A friendly operation name for the method. For example, you can assign the * OperationName of ListPets for the GET /pets method. */ - operationName?: string; + readonly operationName?: string; /** * Method authorization. * @default None open access */ - authorizationType?: AuthorizationType; + readonly authorizationType?: AuthorizationType; /** * If `authorizationType` is `Custom`, this specifies the ID of the method @@ -27,13 +27,13 @@ export interface MethodOptions { * NOTE: in the future this will be replaced with an `IAuthorizer` * construct. */ - authorizerId?: string; + readonly authorizerId?: string; /** * Indicates whether the method requires clients to submit a valid API key. * @default false */ - apiKeyRequired?: boolean; + readonly apiKeyRequired?: boolean; /** * The responses that can be sent to the client who calls the method. @@ -44,7 +44,7 @@ export interface MethodOptions { * for the integration response to be correctly mapped to a response to the client. * @see https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-method-settings-method-response.html */ - methodResponses?: MethodResponse[] + readonly methodResponses?: MethodResponse[] /** * The request parameters that API Gateway accepts. Specify request parameters @@ -54,7 +54,7 @@ export interface MethodOptions { * is querystring, path, or header, and name is a valid, unique parameter name. * @default None */ - requestParameters?: { [param: string]: boolean }; + readonly requestParameters?: { [param: string]: boolean }; // TODO: // - RequestValidatorId @@ -66,22 +66,22 @@ export interface MethodProps { * The resource this method is associated with. For root resource methods, * specify the `RestApi` object. */ - resource: IRestApiResource; + readonly resource: IRestApiResource; /** * The HTTP method ("GET", "POST", "PUT", ...) that clients use to call this method. */ - httpMethod: string; + readonly httpMethod: string; /** * The backend system that the method calls when it receives a request. */ - integration?: Integration; + readonly integration?: Integration; /** * Method options. */ - options?: MethodOptions; + readonly options?: MethodOptions; } export class Method extends cdk.Construct { diff --git a/packages/@aws-cdk/aws-apigateway/lib/methodresponse.ts b/packages/@aws-cdk/aws-apigateway/lib/methodresponse.ts index 59032a06d860f..a3b504ae4cbba 100644 --- a/packages/@aws-cdk/aws-apigateway/lib/methodresponse.ts +++ b/packages/@aws-cdk/aws-apigateway/lib/methodresponse.ts @@ -6,7 +6,7 @@ export interface MethodResponse { * The method response's status code, which you map to an IntegrationResponse. * Required. */ - statusCode: string; + readonly statusCode: string; /** * Response parameters that API Gateway sends to the client that called a method. @@ -16,7 +16,7 @@ export interface MethodResponse { * valid, unique header name. The Boolean specifies whether a parameter is required. * @default None */ - responseParameters?: { [destination: string]: boolean }; + readonly responseParameters?: { [destination: string]: boolean }; /** * The resources used for the response's content type. Specify response models as @@ -24,5 +24,5 @@ export interface MethodResponse { * resource name as the value. * @default None */ - responseModels?: { [contentType: string]: IModel }; + readonly responseModels?: { [contentType: string]: IModel }; } \ No newline at end of file diff --git a/packages/@aws-cdk/aws-apigateway/lib/resource.ts b/packages/@aws-cdk/aws-apigateway/lib/resource.ts index 573dceaac83d4..4ba58d7fbbee2 100644 --- a/packages/@aws-cdk/aws-apigateway/lib/resource.ts +++ b/packages/@aws-cdk/aws-apigateway/lib/resource.ts @@ -105,12 +105,12 @@ export interface ResourceProps extends ResourceOptions { * The parent resource of this resource. You can either pass another * `Resource` object or a `RestApi` object here. */ - parent: IRestApiResource; + readonly parent: IRestApiResource; /** * A path name for the resource. */ - pathPart: string; + readonly pathPart: string; } export abstract class ResourceBase extends cdk.Construct implements IRestApiResource { @@ -231,7 +231,7 @@ export interface ProxyResourceProps extends ResourceOptions { * The parent resource of this resource. You can either pass another * `Resource` object or a `RestApi` object here. */ - parent: IRestApiResource; + readonly parent: IRestApiResource; /** * Adds an "ANY" method to this resource. If set to `false`, you will have to explicitly @@ -239,7 +239,7 @@ export interface ProxyResourceProps extends ResourceOptions { * * @default true */ - anyMethod?: boolean; + readonly anyMethod?: boolean; } /** diff --git a/packages/@aws-cdk/aws-apigateway/lib/restapi.ts b/packages/@aws-cdk/aws-apigateway/lib/restapi.ts index 2a979fd50a178..9c2d19be0f204 100644 --- a/packages/@aws-cdk/aws-apigateway/lib/restapi.ts +++ b/packages/@aws-cdk/aws-apigateway/lib/restapi.ts @@ -11,7 +11,7 @@ export interface RestApiImportProps { /** * The REST API ID of an existing REST API resource. */ - restApiId: string; + readonly restApiId: string; } export interface IRestApi extends cdk.IConstruct { @@ -49,7 +49,7 @@ export interface RestApiProps extends ResourceOptions { * * @default true */ - deploy?: boolean; + readonly deploy?: boolean; /** * Options for the API Gateway stage that will always point to the latest @@ -58,7 +58,7 @@ export interface RestApiProps extends ResourceOptions { * * @default defaults based on defaults of `StageOptions` */ - deployOptions?: StageOptions; + readonly deployOptions?: StageOptions; /** * Retains old deployment resources when the API changes. This allows @@ -67,38 +67,38 @@ export interface RestApiProps extends ResourceOptions { * * @default false */ - retainDeployments?: boolean; + readonly retainDeployments?: boolean; /** * A name for the API Gateway RestApi resource. * * @default construct-id defaults to the id of the RestApi construct */ - restApiName?: string; + readonly restApiName?: string; /** * Custom header parameters for the request. * @see https://docs.aws.amazon.com/cli/latest/reference/apigateway/import-rest-api.html */ - parameters?: { [key: string]: string }; + readonly parameters?: { [key: string]: string }; /** * A policy document that contains the permissions for this RestApi */ - policy?: iam.PolicyDocument; + readonly policy?: iam.PolicyDocument; /** * A description of the purpose of this API Gateway RestApi resource. * @default No description */ - description?: string; + readonly description?: string; /** * The source of the API key for metering requests according to a usage * plan. * @default undefined metering is disabled */ - apiKeySourceType?: ApiKeySourceType; + readonly apiKeySourceType?: ApiKeySourceType; /** * The list of binary media mine-types that are supported by the RestApi @@ -106,13 +106,13 @@ export interface RestApiProps extends ResourceOptions { * * @default By default, RestApi supports only UTF-8-encoded text payloads */ - binaryMediaTypes?: string[]; + readonly binaryMediaTypes?: string[]; /** * A list of the endpoint types of the API. Use this property when creating * an API. */ - endpointTypes?: EndpointType[]; + readonly endpointTypes?: EndpointType[]; /** * Indicates whether to roll back the resource if a warning occurs while API @@ -120,7 +120,7 @@ export interface RestApiProps extends ResourceOptions { * * @default false */ - failOnWarnings?: boolean; + readonly failOnWarnings?: boolean; /** * A nullable integer that is used to enable compression (with non-negative @@ -132,18 +132,18 @@ export interface RestApiProps extends ResourceOptions { * * @default undefined compression is disabled */ - minimumCompressionSize?: number; + readonly minimumCompressionSize?: number; /** * The ID of the API Gateway RestApi resource that you want to clone. */ - cloneFrom?: IRestApi; + readonly cloneFrom?: IRestApi; /** * Automatically configure an AWS CloudWatch role for API Gateway. * @default true */ - cloudWatchRole?: boolean; + readonly cloudWatchRole?: boolean; } /** @@ -282,6 +282,8 @@ export class RestApi extends cdk.Construct implements IRestApi { /** * Internal API used by `Method` to keep an inventory of methods at the API * level for validation purposes. + * + * @internal */ public _attachMethod(method: Method) { this.methods.push(method); diff --git a/packages/@aws-cdk/aws-apigateway/lib/stage.ts b/packages/@aws-cdk/aws-apigateway/lib/stage.ts index 26a1cef90447d..f870b40da7511 100644 --- a/packages/@aws-cdk/aws-apigateway/lib/stage.ts +++ b/packages/@aws-cdk/aws-apigateway/lib/stage.ts @@ -11,24 +11,24 @@ export interface StageOptions extends MethodDeploymentOptions { * * @default "prod" */ - stageName?: string; + readonly stageName?: string; /** * Specifies whether Amazon X-Ray tracing is enabled for this method. * @default false */ - tracingEnabled?: boolean; + readonly tracingEnabled?: boolean; /** * Indicates whether cache clustering is enabled for the stage. */ - cacheClusterEnabled?: boolean; + readonly cacheClusterEnabled?: boolean; /** * The stage's cache cluster size. * @default 0.5 */ - cacheClusterSize?: string; + readonly cacheClusterSize?: string; /** * The identifier of the client certificate that API Gateway uses to call @@ -36,24 +36,24 @@ export interface StageOptions extends MethodDeploymentOptions { * * @default None */ - clientCertificateId?: string; + readonly clientCertificateId?: string; /** * A description of the purpose of the stage. */ - description?: string; + readonly description?: string; /** * The version identifier of the API documentation snapshot. */ - documentationVersion?: string; + readonly documentationVersion?: string; /** * A map that defines the stage variables. Variable names must consist of * alphanumeric characters, and the values must match the following regular * expression: [A-Za-z0-9-._~:/?#&=,]+. */ - variables?: { [key: string]: string }; + readonly variables?: { [key: string]: string }; /** * Method deployment options for specific resources/methods. These will @@ -64,14 +64,14 @@ export interface StageOptions extends MethodDeploymentOptions { * to define options for all methods/resources. */ - methodOptions?: { [path: string]: MethodDeploymentOptions }; + readonly methodOptions?: { [path: string]: MethodDeploymentOptions }; } export interface StageProps extends StageOptions { /** * The deployment that this stage points to. */ - deployment: Deployment; + readonly deployment: Deployment; } export enum MethodLoggingLevel { @@ -85,76 +85,79 @@ export interface MethodDeploymentOptions { * Specifies whether Amazon CloudWatch metrics are enabled for this method. * @default false */ - metricsEnabled?: boolean; + readonly metricsEnabled?: boolean; /** * Specifies the logging level for this method, which effects the log * entries pushed to Amazon CloudWatch Logs. * @default Off */ - loggingLevel?: MethodLoggingLevel; + readonly loggingLevel?: MethodLoggingLevel; /** * Specifies whether data trace logging is enabled for this method, which * effects the log entries pushed to Amazon CloudWatch Logs. * @default false */ - dataTraceEnabled?: boolean; + readonly dataTraceEnabled?: boolean; /** * Specifies the throttling burst limit. * @see https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-request-throttling.html */ - throttlingBurstLimit?: number; + readonly throttlingBurstLimit?: number; /** * Specifies the throttling rate limit. * @see https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-request-throttling.html */ - throttlingRateLimit?: number; + readonly throttlingRateLimit?: number; /** * Specifies whether responses should be cached and returned for requests. A * cache cluster must be enabled on the stage for responses to be cached. */ - cachingEnabled?: boolean; + readonly cachingEnabled?: boolean; /** * Specifies the time to live (TTL), in seconds, for cached responses. The * higher the TTL, the longer the response will be cached. */ - cacheTtlSeconds?: number; + readonly cacheTtlSeconds?: number; /** * Indicates whether the cached responses are encrypted. * @default false */ - cacheDataEncrypted?: boolean; + readonly cacheDataEncrypted?: boolean; } export class Stage extends cdk.Construct { public readonly stageName: string; private readonly restApi: IRestApi; + private enableCacheCluster?: boolean; constructor(scope: cdk.Construct, id: string, props: StageProps) { super(scope, id); - const methodSettings = this.renderMethodSettings(props); + this.enableCacheCluster = props.cacheClusterEnabled; + + const methodSettings = this.renderMethodSettings(props); // this can mutate `this.cacheClusterEnabled` // enable cache cluster if cacheClusterSize is set if (props.cacheClusterSize !== undefined) { - if (props.cacheClusterEnabled === undefined) { - props.cacheClusterEnabled = true; - } else if (props.cacheClusterEnabled === false) { + if (this.enableCacheCluster === undefined) { + this.enableCacheCluster = true; + } else if (this.enableCacheCluster === false) { throw new Error(`Cannot set "cacheClusterSize" to ${props.cacheClusterSize} and "cacheClusterEnabled" to "false"`); } } - const cacheClusterSize = props.cacheClusterEnabled ? (props.cacheClusterSize || '0.5') : undefined; + const cacheClusterSize = this.enableCacheCluster ? (props.cacheClusterSize || '0.5') : undefined; const resource = new CfnStage(this, 'Resource', { stageName: props.stageName || 'prod', - cacheClusterEnabled: props.cacheClusterEnabled, + cacheClusterEnabled: this.enableCacheCluster, cacheClusterSize, clientCertificateId: props.clientCertificateId, deploymentId: props.deployment.deploymentId, @@ -183,6 +186,7 @@ export class Stage extends cdk.Construct { private renderMethodSettings(props: StageProps): CfnStage.MethodSettingProperty[] | undefined { const settings = new Array(); + const self = this; // extract common method options from the stage props const commonMethodOptions: MethodDeploymentOptions = { @@ -212,9 +216,9 @@ export class Stage extends cdk.Construct { function renderEntry(path: string, options: MethodDeploymentOptions): CfnStage.MethodSettingProperty { if (options.cachingEnabled) { - if (props.cacheClusterEnabled === undefined) { - props.cacheClusterEnabled = true; - } else if (props.cacheClusterEnabled === false) { + if (self.enableCacheCluster === undefined) { + self.enableCacheCluster = true; + } else if (self.enableCacheCluster === false) { throw new Error(`Cannot enable caching for method ${path} since cache cluster is disabled on stage`); } } diff --git a/packages/@aws-cdk/aws-apigateway/lib/vpc-link.ts b/packages/@aws-cdk/aws-apigateway/lib/vpc-link.ts index 73584be5c5387..8c7c697f03044 100644 --- a/packages/@aws-cdk/aws-apigateway/lib/vpc-link.ts +++ b/packages/@aws-cdk/aws-apigateway/lib/vpc-link.ts @@ -10,19 +10,19 @@ export interface VpcLinkProps { * The name used to label and identify the VPC link. * @default automatically generated name */ - name?: string; + readonly name?: string; /** * The description of the VPC link. * @default no description */ - description?: string; + readonly description?: string; /** * The network load balancers of the VPC targeted by the VPC link. * The network load balancers must be owned by the same AWS account of the API owner. */ - targets: elbv2.INetworkLoadBalancer[]; + readonly targets: elbv2.INetworkLoadBalancer[]; } /** diff --git a/packages/@aws-cdk/aws-apigateway/test/test.deployment.ts b/packages/@aws-cdk/aws-apigateway/test/test.deployment.ts index ac8db66cd4d25..13087303a8ba9 100644 --- a/packages/@aws-cdk/aws-apigateway/test/test.deployment.ts +++ b/packages/@aws-cdk/aws-apigateway/test/test.deployment.ts @@ -1,4 +1,4 @@ -import { expect, haveResource, ResourcePart } from '@aws-cdk/assert'; +import { expect, haveResource, ResourcePart, SynthUtils } from '@aws-cdk/assert'; import cdk = require('@aws-cdk/cdk'); import { Test } from 'nodeunit'; import apigateway = require('../lib'); @@ -153,7 +153,7 @@ export = { function synthesize() { stack.node.prepareTree(); - return stack._toCloudFormation(); + return SynthUtils.toCloudFormation(stack); } }, diff --git a/packages/@aws-cdk/aws-apigateway/test/test.restapi.ts b/packages/@aws-cdk/aws-apigateway/test/test.restapi.ts index 5b7de4b605e30..50d9286cc6c21 100644 --- a/packages/@aws-cdk/aws-apigateway/test/test.restapi.ts +++ b/packages/@aws-cdk/aws-apigateway/test/test.restapi.ts @@ -1,4 +1,4 @@ -import { expect, haveResource, haveResourceLike, ResourcePart } from '@aws-cdk/assert'; +import { expect, haveResource, haveResourceLike, ResourcePart, SynthUtils } from '@aws-cdk/assert'; import cdk = require('@aws-cdk/cdk'); import { App, Stack } from '@aws-cdk/cdk'; import { Test } from 'nodeunit'; @@ -344,7 +344,7 @@ export = { // THEN stack.node.prepareTree(); - test.deepEqual(stack._toCloudFormation().Outputs.MyRestApiRestApiIdB93C5C2D, { + test.deepEqual(SynthUtils.toCloudFormation(stack).Outputs.MyRestApiRestApiIdB93C5C2D, { Value: { Ref: 'MyRestApi2D1F47A9' }, Export: { Name: 'Stack:MyRestApiRestApiIdB93C5C2D' } }); diff --git a/packages/@aws-cdk/aws-applicationautoscaling/lib/base-scalable-attribute.ts b/packages/@aws-cdk/aws-applicationautoscaling/lib/base-scalable-attribute.ts index 446cae58f42b5..205503b235e6d 100644 --- a/packages/@aws-cdk/aws-applicationautoscaling/lib/base-scalable-attribute.ts +++ b/packages/@aws-cdk/aws-applicationautoscaling/lib/base-scalable-attribute.ts @@ -11,22 +11,22 @@ export interface BaseScalableAttributeProps extends EnableScalingProps { /** * Service namespace of the scalable attribute */ - serviceNamespace: ServiceNamespace; + readonly serviceNamespace: ServiceNamespace; /** * Resource ID of the attribute */ - resourceId: string; + readonly resourceId: string; /** * Scalable dimension of the attribute */ - dimension: string; + readonly dimension: string; /** * Role to use for scaling */ - role: iam.IRole; + readonly role: iam.IRole; } /** @@ -90,10 +90,10 @@ export interface EnableScalingProps { * * @default 1 */ - minCapacity?: number; + readonly minCapacity?: number; /** * Maximum capacity to scale to */ - maxCapacity: number; + readonly maxCapacity: number; } diff --git a/packages/@aws-cdk/aws-applicationautoscaling/lib/scalable-target.ts b/packages/@aws-cdk/aws-applicationautoscaling/lib/scalable-target.ts index eaedba2e01fbd..597c7dca15c0f 100644 --- a/packages/@aws-cdk/aws-applicationautoscaling/lib/scalable-target.ts +++ b/packages/@aws-cdk/aws-applicationautoscaling/lib/scalable-target.ts @@ -11,19 +11,19 @@ export interface ScalableTargetProps { /** * The minimum value that Application Auto Scaling can use to scale a target during a scaling activity. */ - minCapacity: number; + readonly minCapacity: number; /** * The maximum value that Application Auto Scaling can use to scale a target during a scaling activity. */ - maxCapacity: number; + readonly maxCapacity: number; /** * Role that allows Application Auto Scaling to modify your scalable target. * * @default A role is automatically created */ - role?: iam.IRole; + readonly role?: iam.IRole; /** * The resource identifier to associate with this scalable target. @@ -33,7 +33,7 @@ export interface ScalableTargetProps { * @example service/ecsStack-MyECSCluster-AB12CDE3F4GH/ecsStack-MyECSService-AB12CDE3F4GH * @see https://docs.aws.amazon.com/autoscaling/application/APIReference/API_RegisterScalableTarget.html */ - resourceId: string; + readonly resourceId: string; /** * The scalable dimension that's associated with the scalable target. @@ -43,7 +43,7 @@ export interface ScalableTargetProps { * @example ecs:service:DesiredCount * @see https://docs.aws.amazon.com/autoscaling/application/APIReference/API_ScalingPolicy.html */ - scalableDimension: string; + readonly scalableDimension: string; /** * The namespace of the AWS service that provides the resource or @@ -55,7 +55,7 @@ export interface ScalableTargetProps { * * @see https://docs.aws.amazon.com/autoscaling/application/APIReference/API_RegisterScalableTarget.html */ - serviceNamespace: ServiceNamespace; + readonly serviceNamespace: ServiceNamespace; } /** @@ -169,21 +169,21 @@ export interface ScalingSchedule { * * @example rate(12 hours) */ - schedule: string; + readonly schedule: string; /** * When this scheduled action becomes active. * * @default The rule is activate immediately */ - startTime?: Date + readonly startTime?: Date /** * When this scheduled action expires. * * @default The rule never expires. */ - endTime?: Date; + readonly endTime?: Date; /** * The new minimum capacity. @@ -195,7 +195,7 @@ export interface ScalingSchedule { * * @default No new minimum capacity */ - minCapacity?: number; + readonly minCapacity?: number; /** * The new maximum capacity. @@ -207,7 +207,7 @@ export interface ScalingSchedule { * * @default No new maximum capacity */ - maxCapacity?: number; + readonly maxCapacity?: number; } /** diff --git a/packages/@aws-cdk/aws-applicationautoscaling/lib/step-scaling-action.ts b/packages/@aws-cdk/aws-applicationautoscaling/lib/step-scaling-action.ts index c825577ab21d3..5499ddcda4b41 100644 --- a/packages/@aws-cdk/aws-applicationautoscaling/lib/step-scaling-action.ts +++ b/packages/@aws-cdk/aws-applicationautoscaling/lib/step-scaling-action.ts @@ -10,21 +10,21 @@ export interface StepScalingActionProps { /** * The scalable target */ - scalingTarget: ScalableTarget; + readonly scalingTarget: ScalableTarget; /** * A name for the scaling policy * * @default Automatically generated name */ - policyName?: string; + readonly policyName?: string; /** * How the adjustment numbers are interpreted * * @default ChangeInCapacity */ - adjustmentType?: AdjustmentType; + readonly adjustmentType?: AdjustmentType; /** * Grace period after scaling activity. @@ -38,7 +38,7 @@ export interface StepScalingActionProps { * @see https://docs.aws.amazon.com/autoscaling/application/APIReference/API_StepScalingPolicyConfiguration.html * @default No cooldown period */ - cooldownSec?: number; + readonly cooldownSec?: number; /** * Minimum absolute number to adjust capacity with as result of percentage scaling. @@ -48,14 +48,14 @@ export interface StepScalingActionProps { * * @default No minimum scaling effect */ - minAdjustmentMagnitude?: number; + readonly minAdjustmentMagnitude?: number; /** * The aggregation type for the CloudWatch metrics. * * @default Average */ - metricAggregationType?: MetricAggregationType; + readonly metricAggregationType?: MetricAggregationType; } /** @@ -172,7 +172,7 @@ export interface AdjustmentTier { * * Can be positive or negative. */ - adjustment: number; + readonly adjustment: number; /** * Lower bound where this scaling tier applies. @@ -182,7 +182,7 @@ export interface AdjustmentTier { * * @default -Infinity if this is the first tier, otherwise the upperBound of the previous tier */ - lowerBound?: number; + readonly lowerBound?: number; /** * Upper bound where this scaling tier applies @@ -192,5 +192,5 @@ export interface AdjustmentTier { * * @default +Infinity */ - upperBound?: number; + readonly upperBound?: number; } \ No newline at end of file diff --git a/packages/@aws-cdk/aws-applicationautoscaling/lib/step-scaling-policy.ts b/packages/@aws-cdk/aws-applicationautoscaling/lib/step-scaling-policy.ts index 1ee9f9324732a..5cbe98b95e0d2 100644 --- a/packages/@aws-cdk/aws-applicationautoscaling/lib/step-scaling-policy.ts +++ b/packages/@aws-cdk/aws-applicationautoscaling/lib/step-scaling-policy.ts @@ -8,21 +8,21 @@ export interface BasicStepScalingPolicyProps { /** * Metric to scale on. */ - metric: cloudwatch.Metric; + readonly metric: cloudwatch.Metric; /** * The intervals for scaling. * * Maps a range of metric values to a particular scaling behavior. */ - scalingSteps: ScalingInterval[]; + readonly scalingSteps: ScalingInterval[]; /** * How the adjustment numbers inside 'intervals' are interpreted. * * @default ChangeInCapacity */ - adjustmentType?: AdjustmentType; + readonly adjustmentType?: AdjustmentType; /** * Grace period after scaling activity. @@ -35,7 +35,7 @@ export interface BasicStepScalingPolicyProps { * @see https://docs.aws.amazon.com/autoscaling/application/APIReference/API_StepScalingPolicyConfiguration.html * @default No cooldown period */ - cooldownSec?: number; + readonly cooldownSec?: number; /** * Minimum absolute number to adjust capacity with as result of percentage scaling. @@ -45,14 +45,14 @@ export interface BasicStepScalingPolicyProps { * * @default No minimum scaling effect */ - minAdjustmentMagnitude?: number; + readonly minAdjustmentMagnitude?: number; } export interface StepScalingPolicyProps extends BasicStepScalingPolicyProps { /** * The scaling target */ - scalingTarget: ScalableTarget; + readonly scalingTarget: ScalableTarget; } /** @@ -154,7 +154,7 @@ export interface ScalingInterval { * * @default Threshold automatically derived from neighbouring intervals */ - lower?: number; + readonly lower?: number; /** * The upper bound of the interval. @@ -163,7 +163,7 @@ export interface ScalingInterval { * * @default Threshold automatically derived from neighbouring intervals */ - upper?: number; + readonly upper?: number; /** * The capacity adjustment to apply in this interval @@ -177,7 +177,7 @@ export interface ScalingInterval { * - ExactCapacity: set the capacity to this number. The number must * be positive. */ - change: number; + readonly change: number; } function aggregationTypeFromMetric(metric: cloudwatch.Metric): MetricAggregationType { diff --git a/packages/@aws-cdk/aws-applicationautoscaling/lib/target-tracking-scaling-policy.ts b/packages/@aws-cdk/aws-applicationautoscaling/lib/target-tracking-scaling-policy.ts index 59d10805f3956..bea6f15f0d7a9 100644 --- a/packages/@aws-cdk/aws-applicationautoscaling/lib/target-tracking-scaling-policy.ts +++ b/packages/@aws-cdk/aws-applicationautoscaling/lib/target-tracking-scaling-policy.ts @@ -18,7 +18,7 @@ export interface BaseTargetTrackingProps { * * @default Automatically generated name */ - policyName?: string; + readonly policyName?: string; /** * Indicates whether scale in by the target tracking policy is disabled. @@ -30,21 +30,21 @@ export interface BaseTargetTrackingProps { * * @default false */ - disableScaleIn?: boolean; + readonly disableScaleIn?: boolean; /** * Period after a scale in activity completes before another scale in activity can start. * * @default No scale in cooldown */ - scaleInCooldownSec?: number; + readonly scaleInCooldownSec?: number; /** * Period after a scale out activity completes before another scale out activity can start. * * @default No scale out cooldown */ - scaleOutCooldownSec?: number; + readonly scaleOutCooldownSec?: number; } /** @@ -54,7 +54,7 @@ export interface BasicTargetTrackingScalingPolicyProps extends BaseTargetTrackin /** * The target value for the metric. */ - targetValue: number; + readonly targetValue: number; /** * A predefined metric for application autoscaling @@ -64,7 +64,7 @@ export interface BasicTargetTrackingScalingPolicyProps extends BaseTargetTrackin * * Exactly one of customMetric or predefinedMetric must be specified. */ - predefinedMetric?: PredefinedMetric; + readonly predefinedMetric?: PredefinedMetric; /** * Identify the resource associated with the metric type. @@ -73,7 +73,7 @@ export interface BasicTargetTrackingScalingPolicyProps extends BaseTargetTrackin * * @example app///targetgroup// */ - resourceLabel?: string; + readonly resourceLabel?: string; /** * A custom metric for application autoscaling @@ -83,7 +83,7 @@ export interface BasicTargetTrackingScalingPolicyProps extends BaseTargetTrackin * * Exactly one of customMetric or predefinedMetric must be specified. */ - customMetric?: cloudwatch.Metric; + readonly customMetric?: cloudwatch.Metric; } /** @@ -95,7 +95,7 @@ export interface TargetTrackingScalingPolicyProps extends BasicTargetTrackingSca /* * The scalable target */ - scalingTarget: ScalableTarget; + readonly scalingTarget: ScalableTarget; } export class TargetTrackingScalingPolicy extends cdk.Construct { diff --git a/packages/@aws-cdk/aws-applicationautoscaling/package-lock.json b/packages/@aws-cdk/aws-applicationautoscaling/package-lock.json index 04b8cb6035dbd..a96643c8f2f4f 100644 --- a/packages/@aws-cdk/aws-applicationautoscaling/package-lock.json +++ b/packages/@aws-cdk/aws-applicationautoscaling/package-lock.json @@ -1,6 +1,6 @@ { "name": "@aws-cdk/aws-applicationautoscaling", - "version": "0.25.3", + "version": "0.26.0", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/packages/@aws-cdk/aws-applicationautoscaling/test/test.step-scaling-policy.ts b/packages/@aws-cdk/aws-applicationautoscaling/test/test.step-scaling-policy.ts index 71772bcf7e639..6e60c3cbd6067 100644 --- a/packages/@aws-cdk/aws-applicationautoscaling/test/test.step-scaling-policy.ts +++ b/packages/@aws-cdk/aws-applicationautoscaling/test/test.step-scaling-policy.ts @@ -1,3 +1,4 @@ +import { SynthUtils } from '@aws-cdk/assert'; import cloudwatch = require('@aws-cdk/aws-cloudwatch'); import cdk = require('@aws-cdk/cdk'); import fc = require('fast-check'); @@ -129,7 +130,7 @@ function setupStepScaling(intervals: appscaling.ScalingInterval[]) { scalingSteps: intervals }); - return new ScalingStackTemplate(stack._toCloudFormation()); + return new ScalingStackTemplate(SynthUtils.toCloudFormation(stack)); } class ScalingStackTemplate { diff --git a/packages/@aws-cdk/aws-autoscaling-api/lib/lifecycle-hook-target.ts b/packages/@aws-cdk/aws-autoscaling-api/lib/lifecycle-hook-target.ts index 72d79007ee6b8..ba6a2f661128f 100644 --- a/packages/@aws-cdk/aws-autoscaling-api/lib/lifecycle-hook-target.ts +++ b/packages/@aws-cdk/aws-autoscaling-api/lib/lifecycle-hook-target.ts @@ -27,5 +27,5 @@ export interface LifecycleHookTargetProps { /** * The ARN to use as the notification target */ - notificationTargetArn: string; + readonly notificationTargetArn: string; } \ No newline at end of file diff --git a/packages/@aws-cdk/aws-autoscaling-common/lib/interval-utils.ts b/packages/@aws-cdk/aws-autoscaling-common/lib/interval-utils.ts index df78370991852..3c60a3d277a8d 100644 --- a/packages/@aws-cdk/aws-autoscaling-common/lib/interval-utils.ts +++ b/packages/@aws-cdk/aws-autoscaling-common/lib/interval-utils.ts @@ -1,9 +1,9 @@ import { ScalingInterval } from "./types"; export interface CompleteScalingInterval { - lower: number; - upper: number; - change?: number; + readonly lower: number; + readonly upper: number; + readonly change?: number; } /** @@ -48,9 +48,11 @@ function orderAndCompleteIntervals(intervals: ScalingInterval[]): CompleteScalin // Propagate boundaries until no more change while (propagateBounds(intervals)) { /* Repeat */ } + const lastIndex = intervals.length - 1; + // Validate that no intervals have undefined bounds now, which must mean they're complete. - if (intervals[0].lower === undefined) { intervals[0].lower = 0; } - if (last(intervals).upper === undefined) { last(intervals).upper = Infinity; } + if (intervals[0].lower === undefined) { intervals[0] = { ...intervals[0], lower: 0 }; } + if (intervals[lastIndex].upper === undefined) { intervals[lastIndex] = { ...intervals[lastIndex], upper: Infinity }; } for (const interval of intervals) { if (interval.lower === undefined || interval.upper === undefined) { throw new Error(`Could not determine the lower and upper bounds for ${JSON.stringify(interval)}`); @@ -120,9 +122,10 @@ function makeGapsUndefined(intervals: CompleteScalingInterval[]) { * Turn zero changes into undefined, in-place */ function makeZerosUndefined(intervals: CompleteScalingInterval[]) { - for (const interval of intervals) { + for (let i = 0; i < intervals.length; ++i) { + const interval = intervals[i]; if (interval.change === 0) { - interval.change = undefined; + intervals[i] = { ...interval, change: undefined }; } } } @@ -134,7 +137,7 @@ function combineUndefineds(intervals: CompleteScalingInterval[]) { let i = 0; while (i < intervals.length - 1) { if (intervals[i].change === undefined && intervals[i + 1].change === undefined) { - intervals[i].upper = intervals[i + 1].upper; + intervals[i] = { ...intervals[i], upper: intervals[i + 1].upper }; intervals.splice(i + 1, 1); } else { i++; @@ -166,7 +169,7 @@ function propagateBounds(intervals: ScalingInterval[]) { // Propagate upper bounds upwards for (let i = 0; i < intervals.length - 1; i++) { if (intervals[i].upper !== undefined && intervals[i + 1].lower === undefined) { - intervals[i + 1].lower = intervals[i].upper; + intervals[i + 1] = { ...intervals[i + 1], lower: intervals[i].upper }; ret = true; } } @@ -174,7 +177,7 @@ function propagateBounds(intervals: ScalingInterval[]) { // Propagate lower bounds downwards for (let i = intervals.length - 1; i >= 1; i--) { if (intervals[i].lower !== undefined && intervals[i - 1].upper === undefined) { - intervals[i - 1].upper = intervals[i].lower; + intervals[i - 1] = { ...intervals[i - 1], upper: intervals[i].lower }; ret = true; } } @@ -194,8 +197,8 @@ function last(xs: T[]) { } export interface Alarms { - lowerAlarmIntervalIndex?: number; - upperAlarmIntervalIndex?: number; + readonly lowerAlarmIntervalIndex?: number; + readonly upperAlarmIntervalIndex?: number; } /** diff --git a/packages/@aws-cdk/aws-autoscaling-common/lib/test-utils.ts b/packages/@aws-cdk/aws-autoscaling-common/lib/test-utils.ts index 915d18bbf2426..a98c109eb5b5d 100644 --- a/packages/@aws-cdk/aws-autoscaling-common/lib/test-utils.ts +++ b/packages/@aws-cdk/aws-autoscaling-common/lib/test-utils.ts @@ -37,14 +37,14 @@ export function generateArbitraryIntervals(mrng: IRandomGenerator): ArbitraryInt if (mrng.nextBoolean()) { ret.splice(ret.indexOf(noChanges[0]), 1); } else { - noChanges[0].change = -1 * factor + bias; + noChanges[0] = { ...noChanges[0], change: -1 * factor + bias }; } } if (mrng.nextBoolean()) { if (mrng.nextBoolean()) { ret.splice(ret.indexOf(noChanges[1]), 1); } else { - noChanges[1].change = 1 * factor + bias; + noChanges[1] = { ...noChanges[1], change: 1 * factor + bias }; } } } else { @@ -54,8 +54,8 @@ export function generateArbitraryIntervals(mrng: IRandomGenerator): ArbitraryInt ret.splice(ret.indexOf(noChanges[0]), 1); ret.splice(ret.indexOf(noChanges[1]), 1); } else { - noChanges[0].change = -1 * factor + bias; - noChanges[1].change = 1 * factor + bias; + noChanges[0] = { ...noChanges[0], change: -1 * factor + bias }; + noChanges[1] = { ...noChanges[1], change: 1 * factor + bias }; } } @@ -77,13 +77,13 @@ export function generateArbitraryIntervals(mrng: IRandomGenerator): ArbitraryInt // scrap lower bound // okay if current interval has an upper bound AND the preceding interval has an upper bound if (ret[i].upper !== undefined && (i === 0 || ret[i - 1].upper !== undefined)) { - ret[i].lower = undefined; + ret[i] = { ...ret[i], lower: undefined }; } } else { // scrap upper bound // okay if current interval has a lower bound AND the succeeding interval has a lower bound if (ret[i].lower !== undefined && (i === ret.length - 1 || ret[i + 1].lower !== undefined)) { - ret[i].upper = undefined; + ret[i] = { ...ret[i], upper: undefined }; } } } @@ -97,6 +97,6 @@ export interface IRandomGenerator { } export interface ArbitraryIntervals { - absolute: boolean; - intervals: appscaling.ScalingInterval[]; + readonly absolute: boolean; + readonly intervals: appscaling.ScalingInterval[]; } \ No newline at end of file diff --git a/packages/@aws-cdk/aws-autoscaling-common/lib/types.ts b/packages/@aws-cdk/aws-autoscaling-common/lib/types.ts index b3bf0e9c9e9d9..efd2826db12c8 100644 --- a/packages/@aws-cdk/aws-autoscaling-common/lib/types.ts +++ b/packages/@aws-cdk/aws-autoscaling-common/lib/types.ts @@ -9,7 +9,7 @@ export interface ScalingInterval { * * @default Threshold automatically derived from neighbouring intervals */ - lower?: number; + readonly lower?: number; /** * The upper bound of the interval. @@ -18,7 +18,7 @@ export interface ScalingInterval { * * @default Threshold automatically derived from neighbouring intervals */ - upper?: number; + readonly upper?: number; /** * The capacity adjustment to apply in this interval @@ -32,5 +32,5 @@ export interface ScalingInterval { * - ExactCapacity: set the capacity to this number. The number must * be positive. */ - change: number; + readonly change: number; } \ No newline at end of file diff --git a/packages/@aws-cdk/aws-autoscaling-common/package-lock.json b/packages/@aws-cdk/aws-autoscaling-common/package-lock.json index ddf7d8ac18165..54917ccc204a9 100644 --- a/packages/@aws-cdk/aws-autoscaling-common/package-lock.json +++ b/packages/@aws-cdk/aws-autoscaling-common/package-lock.json @@ -1,6 +1,6 @@ { "name": "@aws-cdk/aws-autoscaling-common", - "version": "0.25.3", + "version": "0.26.0", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/packages/@aws-cdk/aws-autoscaling/lib/auto-scaling-group.ts b/packages/@aws-cdk/aws-autoscaling/lib/auto-scaling-group.ts index 92161dbfc05ca..c8429013018a7 100644 --- a/packages/@aws-cdk/aws-autoscaling/lib/auto-scaling-group.ts +++ b/packages/@aws-cdk/aws-autoscaling/lib/auto-scaling-group.ts @@ -29,44 +29,44 @@ export interface CommonAutoScalingGroupProps { * * @default 1 */ - minCapacity?: number; + readonly minCapacity?: number; /** * Maximum number of instances in the fleet * * @default desiredCapacity */ - maxCapacity?: number; + readonly maxCapacity?: number; /** * Initial amount of instances in the fleet * @default 1 */ - desiredCapacity?: number; + readonly desiredCapacity?: number; /** * Name of SSH keypair to grant access to instances * @default No SSH access will be possible */ - keyName?: string; + readonly keyName?: string; /** * Where to place instances within the VPC */ - vpcSubnets?: ec2.SubnetSelection; + readonly vpcSubnets?: ec2.SubnetSelection; /** * SNS topic to send notifications about fleet changes * @default No fleet change notifications will be sent. */ - notificationsTopic?: sns.ITopic; + readonly notificationsTopic?: sns.ITopic; /** * Whether the instances can initiate connections to anywhere by default * * @default true */ - allowAllOutbound?: boolean; + readonly allowAllOutbound?: boolean; /** * What to do when an AutoScalingGroup's instance configuration is changed @@ -79,14 +79,14 @@ export interface CommonAutoScalingGroupProps { * * @default UpdateType.None */ - updateType?: UpdateType; + readonly updateType?: UpdateType; /** * Configuration for rolling updates * * Only used if updateType == UpdateType.RollingUpdate. */ - rollingUpdateConfiguration?: RollingUpdateConfiguration; + readonly rollingUpdateConfiguration?: RollingUpdateConfiguration; /** * Configuration for replacing updates. @@ -94,7 +94,7 @@ export interface CommonAutoScalingGroupProps { * Only used if updateType == UpdateType.ReplacingUpdate. Specifies how * many instances must signal success for the update to succeed. */ - replacingUpdateMinSuccessfulInstancesPercent?: number; + readonly replacingUpdateMinSuccessfulInstancesPercent?: number; /** * If the ASG has scheduled actions, don't reset unchanged group sizes @@ -107,14 +107,14 @@ export interface CommonAutoScalingGroupProps { * * @default true */ - ignoreUnmodifiedSizeProperties?: boolean; + readonly ignoreUnmodifiedSizeProperties?: boolean; /** * How many ResourceSignal calls CloudFormation expects before the resource is considered created * * @default 1 */ - resourceSignalCount?: number; + readonly resourceSignalCount?: number; /** * The length of time to wait for the resourceSignalCount @@ -123,14 +123,14 @@ export interface CommonAutoScalingGroupProps { * * @default 300 (5 minutes) */ - resourceSignalTimeoutSec?: number; + readonly resourceSignalTimeoutSec?: number; /** * Default scaling cooldown for this AutoScalingGroup * * @default 300 (5 minutes) */ - cooldownSeconds?: number; + readonly cooldownSeconds?: number; /** * Whether instances in the Auto Scaling Group should have public @@ -138,7 +138,7 @@ export interface CommonAutoScalingGroupProps { * * @default Use subnet setting */ - associatePublicIpAddress?: boolean; + readonly associatePublicIpAddress?: boolean; } /** @@ -148,17 +148,17 @@ export interface AutoScalingGroupProps extends CommonAutoScalingGroupProps { /** * VPC to launch these instances in. */ - vpc: ec2.IVpcNetwork; + readonly vpc: ec2.IVpcNetwork; /** * Type of instance to launch */ - instanceType: ec2.InstanceType; + readonly instanceType: ec2.InstanceType; /** * AMI to launch */ - machineImage: ec2.IMachineImageSource; + readonly machineImage: ec2.IMachineImageSource; /** * An IAM role to associate with the instance profile assigned to this Auto Scaling Group. @@ -173,7 +173,7 @@ export interface AutoScalingGroupProps extends CommonAutoScalingGroupProps { * * @default A role will automatically be created, it can be accessed via the `role` property */ - role?: iam.IRole; + readonly role?: iam.IRole; } /** @@ -268,6 +268,7 @@ export class AutoScalingGroup extends cdk.Construct implements IAutoScalingGroup throw new Error(`Should have minCapacity (${minCapacity}) <= desiredCapacity (${desiredCapacity}) <= maxCapacity (${maxCapacity})`); } + const subnetIds = props.vpc.subnetIds(props.vpcSubnets); const asgProps: CfnAutoScalingGroupProps = { cooldown: props.cooldownSeconds !== undefined ? `${props.cooldownSeconds}` : undefined, minSize: minCapacity.toString(), @@ -276,23 +277,21 @@ export class AutoScalingGroup extends cdk.Construct implements IAutoScalingGroup launchConfigurationName: launchConfig.ref, loadBalancerNames: new cdk.Token(() => this.loadBalancerNames.length > 0 ? this.loadBalancerNames : undefined).toList(), targetGroupArns: new cdk.Token(() => this.targetGroupArns.length > 0 ? this.targetGroupArns : undefined).toList(), + notificationConfigurations: !props.notificationsTopic ? undefined : [ + { + topicArn: props.notificationsTopic.topicArn, + notificationTypes: [ + "autoscaling:EC2_INSTANCE_LAUNCH", + "autoscaling:EC2_INSTANCE_LAUNCH_ERROR", + "autoscaling:EC2_INSTANCE_TERMINATE", + "autoscaling:EC2_INSTANCE_TERMINATE_ERROR" + ], + } + ], + vpcZoneIdentifier: subnetIds }; - if (props.notificationsTopic) { - asgProps.notificationConfigurations = []; - asgProps.notificationConfigurations.push({ - topicArn: props.notificationsTopic.topicArn, - notificationTypes: [ - "autoscaling:EC2_INSTANCE_LAUNCH", - "autoscaling:EC2_INSTANCE_LAUNCH_ERROR", - "autoscaling:EC2_INSTANCE_TERMINATE", - "autoscaling:EC2_INSTANCE_TERMINATE_ERROR" - ], - }); - } - - asgProps.vpcZoneIdentifier = props.vpc.subnetIds(props.vpcSubnets); - if (!props.vpc.isPublicSubnets(asgProps.vpcZoneIdentifier) && props.associatePublicIpAddress) { + if (!props.vpc.isPublicSubnets(subnetIds) && props.associatePublicIpAddress) { throw new Error("To set 'associatePublicIpAddress: true' you must select Public subnets (vpcSubnets: { subnetType: SubnetType.Public })"); } @@ -457,7 +456,12 @@ export class AutoScalingGroup extends cdk.Construct implements IAutoScalingGroup */ private applyUpdatePolicies(props: AutoScalingGroupProps) { if (props.updateType === UpdateType.ReplacingUpdate) { - this.asgUpdatePolicy.autoScalingReplacingUpdate = { willReplace: true }; + this.autoScalingGroup.options.updatePolicy = { + ...this.autoScalingGroup.options.updatePolicy, + autoScalingReplacingUpdate: { + willReplace: true + } + }; if (props.replacingUpdateMinSuccessfulInstancesPercent !== undefined) { // Yes, this goes on CreationPolicy, not as a process parameter to ReplacingUpdate. @@ -465,46 +469,38 @@ export class AutoScalingGroup extends cdk.Construct implements IAutoScalingGroup // during the update? // // https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-creationpolicy.html - this.asgCreationPolicy.autoScalingCreationPolicy = { - minSuccessfulInstancesPercent: validatePercentage(props.replacingUpdateMinSuccessfulInstancesPercent) + this.autoScalingGroup.options.creationPolicy = { + ...this.autoScalingGroup.options.creationPolicy, + autoScalingCreationPolicy: { + minSuccessfulInstancesPercent: validatePercentage(props.replacingUpdateMinSuccessfulInstancesPercent) + } }; } } else if (props.updateType === UpdateType.RollingUpdate) { - this.asgUpdatePolicy.autoScalingRollingUpdate = renderRollingUpdateConfig(props.rollingUpdateConfiguration); + this.autoScalingGroup.options.updatePolicy = { + ...this.autoScalingGroup.options.updatePolicy, + autoScalingRollingUpdate: renderRollingUpdateConfig(props.rollingUpdateConfiguration) + }; } // undefined is treated as 'true' if (props.ignoreUnmodifiedSizeProperties !== false) { - this.asgUpdatePolicy.autoScalingScheduledAction = { ignoreUnmodifiedGroupSizeProperties: true }; + this.autoScalingGroup.options.updatePolicy = { + ...this.autoScalingGroup.options.updatePolicy, + autoScalingScheduledAction: { ignoreUnmodifiedGroupSizeProperties: true } + }; } if (props.resourceSignalCount !== undefined || props.resourceSignalTimeoutSec !== undefined) { - this.asgCreationPolicy.resourceSignal = { - count: props.resourceSignalCount, - timeout: props.resourceSignalTimeoutSec !== undefined ? renderIsoDuration(props.resourceSignalTimeoutSec) : undefined, + this.autoScalingGroup.options.creationPolicy = { + ...this.autoScalingGroup.options.creationPolicy, + resourceSignal: { + count: props.resourceSignalCount, + timeout: props.resourceSignalTimeoutSec !== undefined ? renderIsoDuration(props.resourceSignalTimeoutSec) : undefined, + } }; } } - - /** - * Create and return the ASG update policy - */ - private get asgUpdatePolicy() { - if (this.autoScalingGroup.options.updatePolicy === undefined) { - this.autoScalingGroup.options.updatePolicy = {}; - } - return this.autoScalingGroup.options.updatePolicy; - } - - /** - * Create and return the ASG creation policy - */ - private get asgCreationPolicy() { - if (this.autoScalingGroup.options.creationPolicy === undefined) { - this.autoScalingGroup.options.creationPolicy = {}; - } - return this.autoScalingGroup.options.creationPolicy; - } } /** @@ -538,7 +534,7 @@ export interface RollingUpdateConfiguration { * * @default 1 */ - maxBatchSize?: number; + readonly maxBatchSize?: number; /** * The minimum number of instances that must be in service before more instances are replaced. @@ -547,7 +543,7 @@ export interface RollingUpdateConfiguration { * * @default 0 */ - minInstancesInService?: number; + readonly minInstancesInService?: number; /** * The percentage of instances that must signal success for an update to succeed. @@ -563,7 +559,7 @@ export interface RollingUpdateConfiguration { * * @default 100 */ - minSuccessfulInstancesPercent?: number; + readonly minSuccessfulInstancesPercent?: number; /** * The pause time after making a change to a batch of instances. @@ -576,7 +572,7 @@ export interface RollingUpdateConfiguration { * * @default 300 if the waitOnResourceSignals property is true, otherwise 0 */ - pauseTimeSec?: number; + readonly pauseTimeSec?: number; /** * Specifies whether the Auto Scaling group waits on signals from new instances during an update. @@ -591,7 +587,7 @@ export interface RollingUpdateConfiguration { * * @default true if you specified the minSuccessfulInstancesPercent property, false otherwise */ - waitOnResourceSignals?: boolean; + readonly waitOnResourceSignals?: boolean; /** * Specifies the Auto Scaling processes to suspend during a stack update. @@ -601,7 +597,7 @@ export interface RollingUpdateConfiguration { * * @default HealthCheck, ReplaceUnhealthy, AZRebalance, AlarmNotification, ScheduledActions. */ - suspendProcesses?: ScalingProcess[]; + readonly suspendProcesses?: ScalingProcess[]; } export enum ScalingProcess { @@ -718,7 +714,7 @@ export interface CpuUtilizationScalingProps extends BaseTargetTrackingProps { /** * Target average CPU utilization across the task */ - targetUtilizationPercent: number; + readonly targetUtilizationPercent: number; } /** @@ -728,7 +724,7 @@ export interface NetworkUtilizationScalingProps extends BaseTargetTrackingProps /** * Target average bytes/seconds on each instance */ - targetBytesPerSecond: number; + readonly targetBytesPerSecond: number; } /** @@ -738,7 +734,7 @@ export interface RequestCountScalingProps extends BaseTargetTrackingProps { /** * Target average requests/seconds on each instance */ - targetRequestsPerSecond: number; + readonly targetRequestsPerSecond: number; } /** @@ -752,10 +748,10 @@ export interface MetricTargetTrackingProps extends BaseTargetTrackingProps { * target value, your ASG should scale out, and if it's lower it should * scale in. */ - metric: cloudwatch.Metric; + readonly metric: cloudwatch.Metric; /** * Value to keep the metric around */ - targetValue: number; + readonly targetValue: number; } diff --git a/packages/@aws-cdk/aws-autoscaling/lib/lifecycle-hook.ts b/packages/@aws-cdk/aws-autoscaling/lib/lifecycle-hook.ts index 8db23f124ce66..0c6223552c5d6 100644 --- a/packages/@aws-cdk/aws-autoscaling/lib/lifecycle-hook.ts +++ b/packages/@aws-cdk/aws-autoscaling/lib/lifecycle-hook.ts @@ -13,45 +13,45 @@ export interface BasicLifecycleHookProps { * * @default Automatically generated name */ - lifecycleHookName?: string; + readonly lifecycleHookName?: string; /** * The action the Auto Scaling group takes when the lifecycle hook timeout elapses or if an unexpected failure occurs. * * @default Continue */ - defaultResult?: DefaultResult; + readonly defaultResult?: DefaultResult; /** * Maximum time between calls to RecordLifecycleActionHeartbeat for the hook * * If the lifecycle hook times out, perform the action in DefaultResult. */ - heartbeatTimeoutSec?: number; + readonly heartbeatTimeoutSec?: number; /** * The state of the Amazon EC2 instance to which you want to attach the lifecycle hook. */ - lifecycleTransition: LifecycleTransition; + readonly lifecycleTransition: LifecycleTransition; /** * Additional data to pass to the lifecycle hook target * * @default No metadata */ - notificationMetadata?: string; + readonly notificationMetadata?: string; /** * The target of the lifecycle hook */ - notificationTarget: api.ILifecycleHookTarget; + readonly notificationTarget: api.ILifecycleHookTarget; /** * The role that allows publishing to the notification target * * @default A role is automatically created */ - role?: iam.IRole; + readonly role?: iam.IRole; } /** @@ -61,7 +61,7 @@ export interface LifecycleHookProps extends BasicLifecycleHookProps { /** * The AutoScalingGroup to add the lifecycle hook to */ - autoScalingGroup: IAutoScalingGroup; + readonly autoScalingGroup: IAutoScalingGroup; } export class LifecycleHook extends cdk.Construct implements api.ILifecycleHook { diff --git a/packages/@aws-cdk/aws-autoscaling/lib/scheduled-action.ts b/packages/@aws-cdk/aws-autoscaling/lib/scheduled-action.ts index 4f04b79969055..81d1b3187b6bf 100644 --- a/packages/@aws-cdk/aws-autoscaling/lib/scheduled-action.ts +++ b/packages/@aws-cdk/aws-autoscaling/lib/scheduled-action.ts @@ -16,21 +16,21 @@ export interface BasicScheduledActionProps { * * @example 0 8 * * ? */ - schedule: string; + readonly schedule: string; /** * When this scheduled action becomes active. * * @default The rule is activate immediately */ - startTime?: Date + readonly startTime?: Date /** * When this scheduled action expires. * * @default The rule never expires. */ - endTime?: Date; + readonly endTime?: Date; /** * The new minimum capacity. @@ -41,7 +41,7 @@ export interface BasicScheduledActionProps { * * @default No new minimum capacity */ - minCapacity?: number; + readonly minCapacity?: number; /** * The new maximum capacity. @@ -52,7 +52,7 @@ export interface BasicScheduledActionProps { * * @default No new maximum capacity */ - maxCapacity?: number; + readonly maxCapacity?: number; /** * The new desired capacity. @@ -61,7 +61,7 @@ export interface BasicScheduledActionProps { * * At least one of maxCapacity, minCapacity, or desiredCapacity must be supplied. */ - desiredCapacity?: number; + readonly desiredCapacity?: number; } /** @@ -71,7 +71,7 @@ export interface ScheduledActionProps extends BasicScheduledActionProps { /** * The AutoScalingGroup to apply the scheduled actions to */ - autoScalingGroup: IAutoScalingGroup; + readonly autoScalingGroup: IAutoScalingGroup; } const CRON_PART = '(\\*|\\?|[0-9]+)'; diff --git a/packages/@aws-cdk/aws-autoscaling/lib/step-scaling-action.ts b/packages/@aws-cdk/aws-autoscaling/lib/step-scaling-action.ts index 158a08b0fb1be..2588626593bb9 100644 --- a/packages/@aws-cdk/aws-autoscaling/lib/step-scaling-action.ts +++ b/packages/@aws-cdk/aws-autoscaling/lib/step-scaling-action.ts @@ -10,28 +10,28 @@ export interface StepScalingActionProps { /** * The auto scaling group */ - autoScalingGroup: IAutoScalingGroup; + readonly autoScalingGroup: IAutoScalingGroup; /** * Period after a scaling completes before another scaling activity can start. * * @default The default cooldown configured on the AutoScalingGroup */ - cooldownSeconds?: number; + readonly cooldownSeconds?: number; /** * Estimated time until a newly launched instance can send metrics to CloudWatch. * * @default Same as the cooldown */ - estimatedInstanceWarmupSeconds?: number; + readonly estimatedInstanceWarmupSeconds?: number; /** * How the adjustment numbers are interpreted * * @default ChangeInCapacity */ - adjustmentType?: AdjustmentType; + readonly adjustmentType?: AdjustmentType; /** * Minimum absolute number to adjust capacity with as result of percentage scaling. @@ -41,14 +41,14 @@ export interface StepScalingActionProps { * * @default No minimum scaling effect */ - minAdjustmentMagnitude?: number; + readonly minAdjustmentMagnitude?: number; /** * The aggregation type for the CloudWatch metrics. * * @default Average */ - metricAggregationType?: MetricAggregationType; + readonly metricAggregationType?: MetricAggregationType; } /** @@ -164,7 +164,7 @@ export interface AdjustmentTier { * * Can be positive or negative. */ - adjustment: number; + readonly adjustment: number; /** * Lower bound where this scaling tier applies. @@ -174,7 +174,7 @@ export interface AdjustmentTier { * * @default -Infinity if this is the first tier, otherwise the upperBound of the previous tier */ - lowerBound?: number; + readonly lowerBound?: number; /** * Upper bound where this scaling tier applies @@ -184,5 +184,5 @@ export interface AdjustmentTier { * * @default +Infinity */ - upperBound?: number; + readonly upperBound?: number; } \ No newline at end of file diff --git a/packages/@aws-cdk/aws-autoscaling/lib/step-scaling-policy.ts b/packages/@aws-cdk/aws-autoscaling/lib/step-scaling-policy.ts index 063212910493a..e85e6f3546107 100644 --- a/packages/@aws-cdk/aws-autoscaling/lib/step-scaling-policy.ts +++ b/packages/@aws-cdk/aws-autoscaling/lib/step-scaling-policy.ts @@ -8,35 +8,35 @@ export interface BasicStepScalingPolicyProps { /** * Metric to scale on. */ - metric: cloudwatch.Metric; + readonly metric: cloudwatch.Metric; /** * The intervals for scaling. * * Maps a range of metric values to a particular scaling behavior. */ - scalingSteps: ScalingInterval[]; + readonly scalingSteps: ScalingInterval[]; /** * How the adjustment numbers inside 'intervals' are interpreted. * * @default ChangeInCapacity */ - adjustmentType?: AdjustmentType; + readonly adjustmentType?: AdjustmentType; /** * Grace period after scaling activity. * * @default Default cooldown period on your AutoScalingGroup */ - cooldownSeconds?: number; + readonly cooldownSeconds?: number; /** * Estimated time until a newly launched instance can send metrics to CloudWatch. * * @default Same as the cooldown */ - estimatedInstanceWarmupSeconds?: number; + readonly estimatedInstanceWarmupSeconds?: number; /** * Minimum absolute number to adjust capacity with as result of percentage scaling. @@ -46,14 +46,14 @@ export interface BasicStepScalingPolicyProps { * * @default No minimum scaling effect */ - minAdjustmentMagnitude?: number; + readonly minAdjustmentMagnitude?: number; } export interface StepScalingPolicyProps extends BasicStepScalingPolicyProps { /** * The auto scaling group */ - autoScalingGroup: IAutoScalingGroup; + readonly autoScalingGroup: IAutoScalingGroup; } /** @@ -168,7 +168,7 @@ export interface ScalingInterval { * * @default Threshold automatically derived from neighbouring intervals */ - lower?: number; + readonly lower?: number; /** * The upper bound of the interval. @@ -177,7 +177,7 @@ export interface ScalingInterval { * * @default Threshold automatically derived from neighbouring intervals */ - upper?: number; + readonly upper?: number; /** * The capacity adjustment to apply in this interval @@ -191,5 +191,5 @@ export interface ScalingInterval { * - ExactCapacity: set the capacity to this number. The number must * be positive. */ - change: number; + readonly change: number; } \ No newline at end of file diff --git a/packages/@aws-cdk/aws-autoscaling/lib/target-tracking-scaling-policy.ts b/packages/@aws-cdk/aws-autoscaling/lib/target-tracking-scaling-policy.ts index 7c9be49f4133d..6e8b54a9b059d 100644 --- a/packages/@aws-cdk/aws-autoscaling/lib/target-tracking-scaling-policy.ts +++ b/packages/@aws-cdk/aws-autoscaling/lib/target-tracking-scaling-policy.ts @@ -22,21 +22,21 @@ export interface BaseTargetTrackingProps { * * @default false */ - disableScaleIn?: boolean; + readonly disableScaleIn?: boolean; /** * Period after a scaling completes before another scaling activity can start. * * @default The default cooldown configured on the AutoScalingGroup */ - cooldownSeconds?: number; + readonly cooldownSeconds?: number; /** * Estimated time until a newly launched instance can send metrics to CloudWatch. * * @default Same as the cooldown */ - estimatedInstanceWarmupSeconds?: number; + readonly estimatedInstanceWarmupSeconds?: number; } /** @@ -46,7 +46,7 @@ export interface BasicTargetTrackingScalingPolicyProps extends BaseTargetTrackin /** * The target value for the metric. */ - targetValue: number; + readonly targetValue: number; /** * A predefined metric for application autoscaling @@ -56,7 +56,7 @@ export interface BasicTargetTrackingScalingPolicyProps extends BaseTargetTrackin * * Exactly one of customMetric or predefinedMetric must be specified. */ - predefinedMetric?: PredefinedMetric; + readonly predefinedMetric?: PredefinedMetric; /** * A custom metric for application autoscaling @@ -66,7 +66,7 @@ export interface BasicTargetTrackingScalingPolicyProps extends BaseTargetTrackin * * Exactly one of customMetric or predefinedMetric must be specified. */ - customMetric?: cloudwatch.Metric; + readonly customMetric?: cloudwatch.Metric; /** * The resource label associated with the predefined metric @@ -78,7 +78,7 @@ export interface BasicTargetTrackingScalingPolicyProps extends BaseTargetTrackin * * @default No resource label */ - resourceLabel?: string; + readonly resourceLabel?: string; } /** @@ -90,7 +90,7 @@ export interface TargetTrackingScalingPolicyProps extends BasicTargetTrackingSca /* * The auto scaling group */ - autoScalingGroup: IAutoScalingGroup; + readonly autoScalingGroup: IAutoScalingGroup; } export class TargetTrackingScalingPolicy extends cdk.Construct { diff --git a/packages/@aws-cdk/aws-certificatemanager/lambda-packages/dns_validated_certificate_handler/package-lock.json b/packages/@aws-cdk/aws-certificatemanager/lambda-packages/dns_validated_certificate_handler/package-lock.json index 659ed05dfc00a..775aa0eb5cad8 100644 --- a/packages/@aws-cdk/aws-certificatemanager/lambda-packages/dns_validated_certificate_handler/package-lock.json +++ b/packages/@aws-cdk/aws-certificatemanager/lambda-packages/dns_validated_certificate_handler/package-lock.json @@ -1,6 +1,6 @@ { "name": "dns_validated_certificate_handler", - "version": "0.25.3", + "version": "0.26.0", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/packages/@aws-cdk/aws-certificatemanager/lib/certificate.ts b/packages/@aws-cdk/aws-certificatemanager/lib/certificate.ts index 8812049458687..5cd32e4e096ab 100644 --- a/packages/@aws-cdk/aws-certificatemanager/lib/certificate.ts +++ b/packages/@aws-cdk/aws-certificatemanager/lib/certificate.ts @@ -21,7 +21,7 @@ export interface CertificateImportProps { /** * The certificate's ARN */ - certificateArn: string; + readonly certificateArn: string; } /** @@ -33,14 +33,14 @@ export interface CertificateProps { * * May contain wildcards, such as ``*.domain.com``. */ - domainName: string; + readonly domainName: string; /** * Alternative domain names on your certificate. * * Use this to register alternative domain names that represent the same site. */ - subjectAlternativeNames?: string[]; + readonly subjectAlternativeNames?: string[]; /** * What validation domain to use for every requested domain. @@ -49,7 +49,7 @@ export interface CertificateProps { * * @default Apex domain is used for every domain that's not overridden. */ - validationDomains?: {[domainName: string]: string}; + readonly validationDomains?: {[domainName: string]: string}; } /** diff --git a/packages/@aws-cdk/aws-certificatemanager/lib/dns-validated-certificate.ts b/packages/@aws-cdk/aws-certificatemanager/lib/dns-validated-certificate.ts index f1e0b265aa6a1..d4c776c6c064f 100644 --- a/packages/@aws-cdk/aws-certificatemanager/lib/dns-validated-certificate.ts +++ b/packages/@aws-cdk/aws-certificatemanager/lib/dns-validated-certificate.ts @@ -11,7 +11,7 @@ export interface DnsValidatedCertificateProps extends CertificateProps { * Route 53 Hosted Zone used to perform DNS validation of the request. The zone * must be authoritative for the domain name specified in the Certificate Request. */ - hostedZone: route53.IHostedZone; + readonly hostedZone: route53.IHostedZone; } /** diff --git a/packages/@aws-cdk/aws-cloudformation/lib/custom-resource.ts b/packages/@aws-cdk/aws-cloudformation/lib/custom-resource.ts index d204190d659e4..37a4b325725c1 100644 --- a/packages/@aws-cdk/aws-cloudformation/lib/custom-resource.ts +++ b/packages/@aws-cdk/aws-cloudformation/lib/custom-resource.ts @@ -19,19 +19,19 @@ export interface CustomResourceProps { * * Optional, exactly one of lamdaProvider or topicProvider must be set. */ - lambdaProvider?: lambda.IFunction; + readonly lambdaProvider?: lambda.IFunction; /** * The SNS Topic for the provider that implements this custom resource. * * Optional, exactly one of lamdaProvider or topicProvider must be set. */ - topicProvider?: sns.ITopic; + readonly topicProvider?: sns.ITopic; /** * Properties to pass to the Lambda */ - properties?: Properties; + readonly properties?: Properties; /** * For custom resources, you can specify AWS::CloudFormation::CustomResource @@ -52,7 +52,7 @@ export interface CustomResourceProps { * @see * https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cfn-customresource.html#aws-cfn-resource-type-name */ - resourceType?: string; + readonly resourceType?: string; } /** diff --git a/packages/@aws-cdk/aws-cloudformation/lib/pipeline-actions.ts b/packages/@aws-cdk/aws-cloudformation/lib/pipeline-actions.ts index 77ee1bd25b4b7..d1c2e41683cb1 100644 --- a/packages/@aws-cdk/aws-cloudformation/lib/pipeline-actions.ts +++ b/packages/@aws-cdk/aws-cloudformation/lib/pipeline-actions.ts @@ -9,7 +9,7 @@ export interface PipelineCloudFormationActionProps extends codepipeline.CommonAc /** * The name of the stack to apply this action to */ - stackName: string; + readonly stackName: string; /** * A name for the filename in the output artifact to store the AWS CloudFormation call's result. @@ -22,7 +22,7 @@ export interface PipelineCloudFormationActionProps extends codepipeline.CommonAc * * @default No output artifact generated */ - outputFileName?: string; + readonly outputFileName?: string; /** * The name of the output artifact to generate @@ -31,7 +31,7 @@ export interface PipelineCloudFormationActionProps extends codepipeline.CommonAc * * @default Automatically generated artifact name. */ - outputArtifactName?: string; + readonly outputArtifactName?: string; /** * The AWS region the given Action resides in. @@ -42,7 +42,7 @@ export interface PipelineCloudFormationActionProps extends codepipeline.CommonAc * * @default the Action resides in the same region as the Pipeline */ - region?: string; + readonly region?: string; /** * The service role that is assumed during execution of action. @@ -51,7 +51,7 @@ export interface PipelineCloudFormationActionProps extends codepipeline.CommonAc * * @see https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-codepipeline-pipeline-stages-actions.html */ - role?: iam.IRole; + readonly role?: iam.IRole; } /** @@ -98,7 +98,7 @@ export interface PipelineExecuteChangeSetActionProps extends PipelineCloudFormat /** * Name of the change set to execute. */ - changeSetName: string; + readonly changeSetName: string; } /** @@ -136,7 +136,7 @@ export interface PipelineCloudFormationDeployActionProps extends PipelineCloudFo * * @default A fresh role with full or no permissions (depending on the value of `adminPermissions`). */ - deploymentRole?: iam.IRole; + readonly deploymentRole?: iam.IRole; /** * Acknowledge certain changes made as part of deployment @@ -149,7 +149,7 @@ export interface PipelineCloudFormationDeployActionProps extends PipelineCloudFo * @see https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-iam-template.html#using-iam-capabilities * @default None, unless `adminPermissions` is true */ - capabilities?: CloudFormationCapabilities; + readonly capabilities?: CloudFormationCapabilities; /** * Whether to grant full permissions to CloudFormation while deploying this template. @@ -166,7 +166,7 @@ export interface PipelineCloudFormationDeployActionProps extends PipelineCloudFo * use `addToRolePolicy` and `capabilities` to control what the CloudFormation * deployment is allowed to do. */ - adminPermissions: boolean; + readonly adminPermissions: boolean; /** * Input artifact to use for template parameters values and stack policy. @@ -180,7 +180,7 @@ export interface PipelineCloudFormationDeployActionProps extends PipelineCloudFo * * @default No template configuration based on input artifacts */ - templateConfiguration?: codepipeline.ArtifactPath; + readonly templateConfiguration?: codepipeline.ArtifactPath; /** * Additional template parameters. @@ -199,7 +199,7 @@ export interface PipelineCloudFormationDeployActionProps extends PipelineCloudFo * * @default No overrides */ - parameterOverrides?: { [name: string]: any }; + readonly parameterOverrides?: { [name: string]: any }; /** * The list of additional input Artifacts for this Action. @@ -216,7 +216,7 @@ export interface PipelineCloudFormationDeployActionProps extends PipelineCloudFo * you need to make sure to include them in the `additionalInputArtifacts` - * otherwise, you'll get an "unrecognized Artifact" error during your Pipeline's execution. */ - additionalInputArtifacts?: codepipeline.Artifact[]; + readonly additionalInputArtifacts?: codepipeline.Artifact[]; } // tslint:enable:max-line-length @@ -289,12 +289,12 @@ export interface PipelineCreateReplaceChangeSetActionProps extends PipelineCloud /** * Name of the change set to create or update. */ - changeSetName: string; + readonly changeSetName: string; /** * Input artifact with the ChangeSet's CloudFormation template */ - templatePath: codepipeline.ArtifactPath; + readonly templatePath: codepipeline.ArtifactPath; } /** @@ -335,7 +335,7 @@ export interface PipelineCreateUpdateStackActionProps extends PipelineCloudForma /** * Input artifact with the CloudFormation template to deploy */ - templatePath: codepipeline.ArtifactPath; + readonly templatePath: codepipeline.ArtifactPath; /** * Replace the stack if it's in a failed state. @@ -350,7 +350,7 @@ export interface PipelineCreateUpdateStackActionProps extends PipelineCloudForma * * @default false */ - replaceOnFailure?: boolean; + readonly replaceOnFailure?: boolean; } /** diff --git a/packages/@aws-cdk/aws-cloudformation/package-lock.json b/packages/@aws-cdk/aws-cloudformation/package-lock.json index 8c97d92d18e51..c14452da56f29 100644 --- a/packages/@aws-cdk/aws-cloudformation/package-lock.json +++ b/packages/@aws-cdk/aws-cloudformation/package-lock.json @@ -1,6 +1,6 @@ { "name": "@aws-cdk/aws-cloudformation", - "version": "0.25.3", + "version": "0.26.0", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/packages/@aws-cdk/aws-cloudformation/test/test.pipeline-actions.ts b/packages/@aws-cdk/aws-cloudformation/test/test.pipeline-actions.ts index 9f0512875f118..9f661804bd5cc 100644 --- a/packages/@aws-cdk/aws-cloudformation/test/test.pipeline-actions.ts +++ b/packages/@aws-cdk/aws-cloudformation/test/test.pipeline-actions.ts @@ -33,7 +33,8 @@ export = nodeunit.testCase({ _assertPermissionGranted(test, pipelineRole.statements, 'cloudformation:CreateChangeSet', stackArn, changeSetCondition); _assertPermissionGranted(test, pipelineRole.statements, 'cloudformation:DeleteChangeSet', stackArn, changeSetCondition); - test.deepEqual(action._inputArtifacts, [artifact], + // TODO: revert "as any" once we move all actions into a single package. + test.deepEqual((action as any)._inputArtifacts, [artifact], 'The inputArtifact was correctly registered'); _assertActionMatches(test, stage.actions, 'AWS', 'CloudFormation', 'Deploy', { diff --git a/packages/@aws-cdk/aws-cloudfront/lib/web_distribution.ts b/packages/@aws-cdk/aws-cloudfront/lib/web_distribution.ts index 1071ab4eda817..2a466978e6530 100644 --- a/packages/@aws-cdk/aws-cloudfront/lib/web_distribution.ts +++ b/packages/@aws-cdk/aws-cloudfront/lib/web_distribution.ts @@ -272,7 +272,7 @@ export interface Behavior { * * @default true */ - compress?: boolean; + readonly compress?: boolean; /** * If this behavior is the default behavior for the distribution. @@ -280,7 +280,7 @@ export interface Behavior { * You must specify exactly one default distribution per CloudFront distribution. * The default behavior is allowed to omit the "path" property. */ - isDefaultBehavior?: boolean; + readonly isDefaultBehavior?: boolean; /** * Trusted signers is how CloudFront allows you to serve private content. @@ -288,7 +288,7 @@ export interface Behavior { * * If you pass a non empty value, all requests for this behavior must be signed (no public access will be allowed) */ - trustedSigners?: string[]; + readonly trustedSigners?: string[]; /** * @@ -299,28 +299,28 @@ export interface Behavior { * @default 86400 (1 day) * */ - defaultTtlSeconds?: number; + readonly defaultTtlSeconds?: number; /** * The method this CloudFront distribution responds do. * * @default GET_HEAD */ - allowedMethods?: CloudFrontAllowedMethods; + readonly allowedMethods?: CloudFrontAllowedMethods; /** * The path this behavior responds to. * Required for all non-default behaviors. (The default behavior implicitly has "*" as the path pattern. ) * */ - pathPattern?: string; + readonly pathPattern?: string; /** * Which methods are cached by CloudFront by default. * * @default GET_HEAD */ - cachedMethods?: CloudFrontAllowedCachedMethods; + readonly cachedMethods?: CloudFrontAllowedCachedMethods; /** * The values CloudFront will forward to the origin when making a request. @@ -328,13 +328,13 @@ export interface Behavior { * @default none (no cookies - no headers) * */ - forwardedValues?: CfnDistribution.ForwardedValuesProperty; + readonly forwardedValues?: CfnDistribution.ForwardedValuesProperty; /** * The minimum amount of time that you want objects to stay in the cache * before CloudFront queries your origin. */ - minTtlSeconds?: number; + readonly minTtlSeconds?: number; /** * The max amount of time you want objects to stay in the cache @@ -342,7 +342,7 @@ export interface Behavior { * * @default 31536000 (one year) */ - maxTtlSeconds?: number; + readonly maxTtlSeconds?: number; } @@ -350,19 +350,19 @@ export interface ErrorConfiguration { /** * The error code matched from the origin */ - originErrorCode: number, + readonly originErrorCode: number; /** * The error code that is sent to the caller. */ - respondWithErrorCode: number, + readonly respondWithErrorCode: number; /** * The path to service instead */ - respondWithPage: string, + readonly respondWithPage: string; /** * How long before this error is retried. */ - cacheTtl?: number + readonly cacheTtl?: number; } export interface CloudFrontWebDistributionProps { @@ -372,52 +372,52 @@ export interface CloudFrontWebDistributionProps { * * @default none */ - aliasConfiguration?: AliasConfiguration; + readonly aliasConfiguration?: AliasConfiguration; /** * A comment for this distribution in the cloud front console. */ - comment?: string; + readonly comment?: string; /** * The default object to serve. * * @default "index.html" */ - defaultRootObject?: string; + readonly defaultRootObject?: string; /** * If your distribution should have IPv6 enabled. * * @default true */ - enableIpV6?: boolean; + readonly enableIpV6?: boolean; /** * The max supported HTTP Versions. * * @default HttpVersion.HTTP2 */ - httpVersion?: HttpVersion; + readonly httpVersion?: HttpVersion; /** * The price class for the distribution (this impacts how many locations CloudFront uses for your distribution, and billing) * * @default PriceClass_100: the cheapest option for CloudFront is picked by default. */ - priceClass?: PriceClass; + readonly priceClass?: PriceClass; /** * The default viewer policy for incoming clients. * * @default RedirectToHTTPs */ - viewerProtocolPolicy?: ViewerProtocolPolicy; + readonly viewerProtocolPolicy?: ViewerProtocolPolicy; /** * The origin configurations for this distribution. Behaviors are a part of the origin. */ - originConfigs: SourceConfiguration[]; + readonly originConfigs: SourceConfiguration[]; /** * Optional - if we should enable logging. @@ -426,17 +426,17 @@ export interface CloudFrontWebDistributionProps { * * @default: no logging is enabled by default. */ - loggingConfig?: LoggingConfiguration; + readonly loggingConfig?: LoggingConfiguration; /** * How CloudFront should handle requests that are no successful (eg PageNotFound) */ - errorConfigurations?: CfnDistribution.CustomErrorResponseProperty[]; + readonly errorConfigurations?: CfnDistribution.CustomErrorResponseProperty[]; /** * Optional AWS WAF WebACL to associate with this CloudFront distribution */ - webACLId?: string; + readonly webACLId?: string; } @@ -444,7 +444,7 @@ export interface CloudFrontWebDistributionProps { * Internal only - just adds the originId string to the Behavior */ interface BehaviorWithOrigin extends Behavior { - targetOriginId: string; + readonly targetOriginId: string; } /** @@ -526,7 +526,7 @@ export class CloudFrontWebDistribution extends cdk.Construct implements route53. constructor(scope: cdk.Construct, id: string, props: CloudFrontWebDistributionProps) { super(scope, id); - const distributionConfig: CfnDistribution.DistributionConfigProperty = { + let distributionConfig: CfnDistribution.DistributionConfigProperty = { comment: props.comment, enabled: true, defaultRootObject: props.defaultRootObject !== undefined ? props.defaultRootObject : "index.html", @@ -565,34 +565,32 @@ export class CloudFrontWebDistribution extends cdk.Construct implements route53. const originProperty: CfnDistribution.OriginProperty = { id: originId, - domainName: originConfig.s3OriginSource ? - originConfig.s3OriginSource.s3BucketSource.domainName : - originConfig.customOriginSource!.domainName, + domainName: originConfig.s3OriginSource + ? originConfig.s3OriginSource.s3BucketSource.domainName + : originConfig.customOriginSource!.domainName, originPath: originConfig.originPath, originCustomHeaders: originHeaders.length > 0 ? originHeaders : undefined, + s3OriginConfig: originConfig.s3OriginSource && originConfig.s3OriginSource.originAccessIdentity + ? { originAccessIdentity: `origin-access-identity/cloudfront/${originConfig.s3OriginSource.originAccessIdentity.ref}` } + : originConfig.s3OriginSource + ? { } + : undefined, + customOriginConfig: originConfig.customOriginSource + ? { + httpPort: originConfig.customOriginSource.httpPort || 80, + httpsPort: originConfig.customOriginSource.httpsPort || 443, + originKeepaliveTimeout: originConfig.customOriginSource.originKeepaliveTimeoutSeconds || 5, + originReadTimeout: originConfig.customOriginSource.originReadTimeoutSeconds || 30, + originProtocolPolicy: originConfig.customOriginSource.originProtocolPolicy || OriginProtocolPolicy.HttpsOnly, + originSslProtocols: originConfig.customOriginSource.allowedOriginSSLVersions || [OriginSslPolicy.TLSv1_2] + } + : undefined }; - if (originConfig.s3OriginSource && originConfig.s3OriginSource.originAccessIdentity) { - originProperty.s3OriginConfig = { - originAccessIdentity: `origin-access-identity/cloudfront/${originConfig.s3OriginSource.originAccessIdentity.ref}` - }; - } else if (originConfig.s3OriginSource) { - originProperty.s3OriginConfig = {}; - } - - if (originConfig.customOriginSource) { - originProperty.customOriginConfig = { - httpPort: originConfig.customOriginSource.httpPort || 80, - httpsPort: originConfig.customOriginSource.httpsPort || 443, - originKeepaliveTimeout: originConfig.customOriginSource.originKeepaliveTimeoutSeconds || 5, - originReadTimeout: originConfig.customOriginSource.originReadTimeoutSeconds || 30, - originProtocolPolicy: originConfig.customOriginSource.originProtocolPolicy || OriginProtocolPolicy.HttpsOnly, - originSslProtocols: originConfig.customOriginSource.allowedOriginSSLVersions || [OriginSslPolicy.TLSv1_2] - }; - } for (const behavior of originConfig.behaviors) { behaviors.push({ ...behavior, targetOriginId: originId }); } + origins.push(originProperty); originIndex++; } @@ -602,13 +600,18 @@ export class CloudFrontWebDistribution extends cdk.Construct implements route53. throw new Error(`Origin ${origin.domainName} is missing either S3OriginConfig or CustomOriginConfig. At least 1 must be specified.`); } }); - distributionConfig.origins = origins; + distributionConfig = { + ...distributionConfig, + origins + }; const defaultBehaviors = behaviors.filter(behavior => behavior.isDefaultBehavior); if (defaultBehaviors.length !== 1) { throw new Error("There can only be one default behavior across all sources. [ One default behavior per distribution ]."); } - distributionConfig.defaultCacheBehavior = this.toBehavior(defaultBehaviors[0], props.viewerProtocolPolicy); + + distributionConfig = { ...distributionConfig, defaultCacheBehavior: this.toBehavior(defaultBehaviors[0], props.viewerProtocolPolicy) }; + const otherBehaviors: CfnDistribution.CacheBehaviorProperty[] = []; for (const behavior of behaviors.filter(b => !b.isDefaultBehavior)) { if (!behavior.pathPattern) { @@ -616,40 +619,51 @@ export class CloudFrontWebDistribution extends cdk.Construct implements route53. } otherBehaviors.push(this.toBehavior(behavior, props.viewerProtocolPolicy) as CfnDistribution.CacheBehaviorProperty); } - distributionConfig.cacheBehaviors = otherBehaviors; + + distributionConfig = { ...distributionConfig, cacheBehaviors: otherBehaviors }; if (props.aliasConfiguration) { - distributionConfig.aliases = props.aliasConfiguration.names; - distributionConfig.viewerCertificate = { - acmCertificateArn: props.aliasConfiguration.acmCertRef, - sslSupportMethod: props.aliasConfiguration.sslMethod || SSLMethod.SNI, - minimumProtocolVersion: props.aliasConfiguration.securityPolicy + const minimumProtocolVersion = props.aliasConfiguration.securityPolicy; + const sslSupportMethod = props.aliasConfiguration.sslMethod || SSLMethod.SNI; + const acmCertificateArn = props.aliasConfiguration.acmCertRef; + + distributionConfig = { + ...distributionConfig, + aliases: props.aliasConfiguration.names, + viewerCertificate: { + acmCertificateArn, + sslSupportMethod, + minimumProtocolVersion + } }; - if (distributionConfig.viewerCertificate.minimumProtocolVersion !== undefined) { - const validProtocols = this.VALID_SSL_PROTOCOLS[distributionConfig.viewerCertificate.sslSupportMethod!.toString()]; + if (minimumProtocolVersion !== undefined) { + const validProtocols = this.VALID_SSL_PROTOCOLS[sslSupportMethod.toString()]; if (validProtocols === undefined) { - throw new Error(`Invalid sslMethod. ${distributionConfig.viewerCertificate.sslSupportMethod!.toString()} is not fully implemented yet.`); + throw new Error(`Invalid sslMethod. ${sslSupportMethod.toString()} is not fully implemented yet.`); } - if (validProtocols.indexOf(distributionConfig.viewerCertificate.minimumProtocolVersion.toString()) === -1) { + if (validProtocols.indexOf(minimumProtocolVersion.toString()) === -1) { // tslint:disable-next-line:max-line-length - throw new Error(`${distributionConfig.viewerCertificate.minimumProtocolVersion} is not compabtible with sslMethod ${distributionConfig.viewerCertificate.sslSupportMethod}.\n\tValid Protocols are: ${validProtocols.join(", ")}`); + throw new Error(`${minimumProtocolVersion} is not compabtible with sslMethod ${sslSupportMethod}.\n\tValid Protocols are: ${validProtocols.join(", ")}`); } } } else { - distributionConfig.viewerCertificate = { - cloudFrontDefaultCertificate: true + distributionConfig = { ...distributionConfig, + viewerCertificate: { cloudFrontDefaultCertificate: true } }; } if (props.loggingConfig) { this.loggingBucket = props.loggingConfig.bucket || new s3.Bucket(this, `LoggingBucket`); - distributionConfig.logging = { - bucket: this.loggingBucket.domainName, - includeCookies: props.loggingConfig.includeCookies || false, - prefix: props.loggingConfig.prefix + distributionConfig = { + ...distributionConfig, + logging: { + bucket: this.loggingBucket.domainName, + includeCookies: props.loggingConfig.includeCookies || false, + prefix: props.loggingConfig.prefix + } }; } diff --git a/packages/@aws-cdk/aws-cloudfront/package-lock.json b/packages/@aws-cdk/aws-cloudfront/package-lock.json index dea362a95d46c..6923e7bc7fa55 100644 --- a/packages/@aws-cdk/aws-cloudfront/package-lock.json +++ b/packages/@aws-cdk/aws-cloudfront/package-lock.json @@ -1,6 +1,6 @@ { "name": "@aws-cdk/aws-cloudfront", - "version": "0.25.3", + "version": "0.26.0", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/packages/@aws-cdk/aws-cloudfront/test/test.basic.ts b/packages/@aws-cdk/aws-cloudfront/test/test.basic.ts index 5109ae9284cb6..acb6d39b441b9 100644 --- a/packages/@aws-cdk/aws-cloudfront/test/test.basic.ts +++ b/packages/@aws-cdk/aws-cloudfront/test/test.basic.ts @@ -15,81 +15,81 @@ export = { originConfigs: [ { originHeaders: { - "X-Custom-Header": "somevalue", + "X-Custom-Header": "somevalue", }, customOriginSource: { - domainName: "myorigin.com", + domainName: "myorigin.com", }, behaviors: [ - { - isDefaultBehavior: true, - } + { + isDefaultBehavior: true, + } ], } ] }); expect(stack).toMatch( - { - "Resources": { - "AnAmazingWebsiteProbablyCFDistribution47E3983B": { - "Type": "AWS::CloudFront::Distribution", - "Properties": { - "DistributionConfig": { - "CacheBehaviors": [], - "DefaultCacheBehavior": { - "AllowedMethods": [ - "GET", - "HEAD" - ], - "CachedMethods": [ - "GET", - "HEAD" - ], - "ForwardedValues": { - "Cookies": { - "Forward": "none" - }, - "QueryString": false - }, - "TargetOriginId": "origin1", - "ViewerProtocolPolicy": "redirect-to-https" - }, - "DefaultRootObject": "index.html", - "Enabled": true, - "HttpVersion": "http2", - "IPV6Enabled": true, - "Origins": [ - { - "CustomOriginConfig": { - "HTTPPort": 80, - "HTTPSPort": 443, - "OriginKeepaliveTimeout": 5, - "OriginProtocolPolicy": "https-only", - "OriginReadTimeout": 30, - "OriginSSLProtocols": [ - "TLSv1.2" - ] - }, - "DomainName": "myorigin.com", - "Id": "origin1", - "OriginCustomHeaders": [ - { - "HeaderName": "X-Custom-Header", - "HeaderValue": "somevalue" + { + "Resources": { + "AnAmazingWebsiteProbablyCFDistribution47E3983B": { + "Type": "AWS::CloudFront::Distribution", + "Properties": { + "DistributionConfig": { + "CacheBehaviors": [], + "DefaultCacheBehavior": { + "AllowedMethods": [ + "GET", + "HEAD" + ], + "CachedMethods": [ + "GET", + "HEAD" + ], + "ForwardedValues": { + "Cookies": { + "Forward": "none" + }, + "QueryString": false + }, + "TargetOriginId": "origin1", + "ViewerProtocolPolicy": "redirect-to-https" + }, + "DefaultRootObject": "index.html", + "Enabled": true, + "HttpVersion": "http2", + "IPV6Enabled": true, + "Origins": [ + { + "CustomOriginConfig": { + "HTTPPort": 80, + "HTTPSPort": 443, + "OriginKeepaliveTimeout": 5, + "OriginProtocolPolicy": "https-only", + "OriginReadTimeout": 30, + "OriginSSLProtocols": [ + "TLSv1.2" + ] + }, + "DomainName": "myorigin.com", + "Id": "origin1", + "OriginCustomHeaders": [ + { + "HeaderName": "X-Custom-Header", + "HeaderValue": "somevalue" + } + ] + } + ], + "PriceClass": "PriceClass_100", + "ViewerCertificate": { + "CloudFrontDefaultCertificate": true + } + } } - ] } - ], - "PriceClass": "PriceClass_100", - "ViewerCertificate": { - "CloudFrontDefaultCertificate": true } - } - } } - } - } ); test.done(); @@ -117,55 +117,55 @@ export = { expect(stack).toMatch({ "Resources": { "Bucket83908E77": { - "Type": "AWS::S3::Bucket", - "DeletionPolicy": "Retain", + "Type": "AWS::S3::Bucket", + "DeletionPolicy": "Retain", }, "AnAmazingWebsiteProbablyCFDistribution47E3983B": { - "Type": "AWS::CloudFront::Distribution", - "Properties": { - "DistributionConfig": { - "DefaultRootObject": "index.html", - "Origins": [ - { - "DomainName": { - "Fn::GetAtt": [ - "Bucket83908E77", - "DomainName" - ] - }, - "Id": "origin1", - "S3OriginConfig": {} - } - ], - "ViewerCertificate": { - "CloudFrontDefaultCertificate": true - }, - "PriceClass": "PriceClass_100", - "DefaultCacheBehavior": { - "AllowedMethods": [ - "GET", - "HEAD" - ], - "CachedMethods": [ - "GET", - "HEAD" - ], - "TargetOriginId": "origin1", - "ViewerProtocolPolicy": "redirect-to-https", - "ForwardedValues": { - "QueryString": false, - "Cookies" : { "Forward" : "none"} + "Type": "AWS::CloudFront::Distribution", + "Properties": { + "DistributionConfig": { + "DefaultRootObject": "index.html", + "Origins": [ + { + "DomainName": { + "Fn::GetAtt": [ + "Bucket83908E77", + "DomainName" + ] + }, + "Id": "origin1", + "S3OriginConfig": {} + } + ], + "ViewerCertificate": { + "CloudFrontDefaultCertificate": true + }, + "PriceClass": "PriceClass_100", + "DefaultCacheBehavior": { + "AllowedMethods": [ + "GET", + "HEAD" + ], + "CachedMethods": [ + "GET", + "HEAD" + ], + "TargetOriginId": "origin1", + "ViewerProtocolPolicy": "redirect-to-https", + "ForwardedValues": { + "QueryString": false, + "Cookies": { "Forward": "none" } + } + }, + "Enabled": true, + "IPV6Enabled": true, + "HttpVersion": "http2", + "CacheBehaviors": [] } - }, - "Enabled": true, - "IPV6Enabled": true, - "HttpVersion": "http2", - "CacheBehaviors": [] } } - } } - }); + }); test.done(); }, @@ -182,7 +182,7 @@ export = { behaviors: [ { isDefaultBehavior: true, - trustedSigners: [ "1234" ], + trustedSigners: ["1234"], }, ] } @@ -192,58 +192,58 @@ export = { expect(stack).toMatch({ "Resources": { "Bucket83908E77": { - "Type": "AWS::S3::Bucket", - "DeletionPolicy": "Retain", + "Type": "AWS::S3::Bucket", + "DeletionPolicy": "Retain", }, "AnAmazingWebsiteProbablyCFDistribution47E3983B": { - "Type": "AWS::CloudFront::Distribution", - "Properties": { - "DistributionConfig": { - "DefaultRootObject": "index.html", - "Origins": [ - { - "DomainName": { - "Fn::GetAtt": [ - "Bucket83908E77", - "DomainName" - ] - }, - "Id": "origin1", - "S3OriginConfig": {} + "Type": "AWS::CloudFront::Distribution", + "Properties": { + "DistributionConfig": { + "DefaultRootObject": "index.html", + "Origins": [ + { + "DomainName": { + "Fn::GetAtt": [ + "Bucket83908E77", + "DomainName" + ] + }, + "Id": "origin1", + "S3OriginConfig": {} + } + ], + "ViewerCertificate": { + "CloudFrontDefaultCertificate": true + }, + "PriceClass": "PriceClass_100", + "DefaultCacheBehavior": { + "AllowedMethods": [ + "GET", + "HEAD" + ], + "CachedMethods": [ + "GET", + "HEAD" + ], + "TargetOriginId": "origin1", + "ViewerProtocolPolicy": "redirect-to-https", + "ForwardedValues": { + "QueryString": false, + "Cookies": { "Forward": "none" } + }, + "TrustedSigners": [ + "1234" + ] + }, + "Enabled": true, + "IPV6Enabled": true, + "HttpVersion": "http2", + "CacheBehaviors": [] } - ], - "ViewerCertificate": { - "CloudFrontDefaultCertificate": true - }, - "PriceClass": "PriceClass_100", - "DefaultCacheBehavior": { - "AllowedMethods": [ - "GET", - "HEAD" - ], - "CachedMethods": [ - "GET", - "HEAD" - ], - "TargetOriginId": "origin1", - "ViewerProtocolPolicy": "redirect-to-https", - "ForwardedValues": { - "QueryString": false, - "Cookies" : { "Forward" : "none"} - }, - "TrustedSigners" : [ - "1234" - ] - }, - "Enabled": true, - "IPV6Enabled": true, - "HttpVersion": "http2", - "CacheBehaviors": [] } } - } } - }); + }); test.done(); }, diff --git a/packages/@aws-cdk/aws-cloudtrail/lib/index.ts b/packages/@aws-cdk/aws-cloudtrail/lib/index.ts index e6f0c2cd52744..795d7a67297d0 100644 --- a/packages/@aws-cdk/aws-cloudtrail/lib/index.ts +++ b/packages/@aws-cdk/aws-cloudtrail/lib/index.ts @@ -15,13 +15,13 @@ export interface CloudTrailProps { * events are delivered to any trail that includes global services, and are logged as occurring in US East (N. Virginia) Region. * @default true */ - includeGlobalServiceEvents?: boolean; + readonly includeGlobalServiceEvents?: boolean; /** * Whether or not this trail delivers log files from multiple regions to a single S3 bucket for a single account. * @default true */ - isMultiRegionTrail?: boolean; + readonly isMultiRegionTrail?: boolean; /** * When an event occurs in your account, CloudTrail evaluates whether the event matches the settings for your trails. @@ -37,7 +37,7 @@ export interface CloudTrailProps { * If managementEvents is undefined, we'll not log management events by default. * @param managementEvents the management configuration type to log */ - managementEvents?: ReadWriteType; + readonly managementEvents?: ReadWriteType; /** * To determine whether a log file was modified, deleted, or unchanged after CloudTrail delivered it, @@ -47,41 +47,41 @@ export interface CloudTrailProps { * You can use the AWS CLI to validate the files in the location where CloudTrail delivered them. * @default true */ - enableFileValidation?: boolean; + readonly enableFileValidation?: boolean; /** * If CloudTrail pushes logs to CloudWatch Logs in addition to S3. * Disabled for cost out of the box. * @default false */ - sendToCloudWatchLogs?: boolean; + readonly sendToCloudWatchLogs?: boolean; /** * How long to retain logs in CloudWatchLogs. Ignored if sendToCloudWatchLogs is false * @default LogRetention.OneYear */ - cloudWatchLogsRetentionTimeDays?: LogRetention; + readonly cloudWatchLogsRetentionTimeDays?: LogRetention; /** The AWS Key Management Service (AWS KMS) key ID that you want to use to encrypt CloudTrail logs. * @default none */ - kmsKey?: kms.IEncryptionKey; + readonly kmsKey?: kms.IEncryptionKey; /** The name of an Amazon SNS topic that is notified when new log files are published. * @default none */ - snsTopic?: string; // TODO: fix to use L2 SNS + readonly snsTopic?: string; // TODO: fix to use L2 SNS /** * The name of the trail. We recoomend customers do not set an explicit name. * @default the CloudFormation generated neme */ - trailName?: string; + readonly trailName?: string; /** An Amazon S3 object key prefix that precedes the name of all log files. * @default none */ - s3KeyPrefix?: string; + readonly s3KeyPrefix?: string; } export enum ReadWriteType { @@ -228,14 +228,14 @@ export interface AddS3EventSelectorOptions { * * @default ReadWriteType.All */ - readWriteType?: ReadWriteType; + readonly readWriteType?: ReadWriteType; /** * Specifies whether the event selector includes management events for the trail. * * @default true */ - includeManagementEvents?: boolean; + readonly includeManagementEvents?: boolean; } interface EventSelector { diff --git a/packages/@aws-cdk/aws-cloudtrail/package-lock.json b/packages/@aws-cdk/aws-cloudtrail/package-lock.json index 9c2f0ace6cc3c..6055f554ff583 100644 --- a/packages/@aws-cdk/aws-cloudtrail/package-lock.json +++ b/packages/@aws-cdk/aws-cloudtrail/package-lock.json @@ -1,6 +1,6 @@ { "name": "@aws-cdk/aws-cloudtrail", - "version": "0.25.3", + "version": "0.26.0", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/packages/@aws-cdk/aws-cloudtrail/test/test.cloudtrail.ts b/packages/@aws-cdk/aws-cloudtrail/test/test.cloudtrail.ts index 1197811a5f2bf..c848538c00584 100644 --- a/packages/@aws-cdk/aws-cloudtrail/test/test.cloudtrail.ts +++ b/packages/@aws-cdk/aws-cloudtrail/test/test.cloudtrail.ts @@ -1,4 +1,4 @@ -import { expect, haveResource, not } from '@aws-cdk/assert'; +import { expect, haveResource, not, SynthUtils } from '@aws-cdk/assert'; import { Stack } from '@aws-cdk/cdk'; import { Test } from 'nodeunit'; import { CloudTrail, LogRetention, ReadWriteType } from '../lib'; @@ -66,7 +66,7 @@ export = { expect(stack).to(haveResource("AWS::S3::Bucket")); expect(stack).to(haveResource("AWS::S3::BucketPolicy", ExpectedBucketPolicyProperties)); expect(stack).to(not(haveResource("AWS::Logs::LogGroup"))); - const trail: any = stack._toCloudFormation().Resources.MyAmazingCloudTrail54516E8D; + const trail: any = SynthUtils.toCloudFormation(stack).Resources.MyAmazingCloudTrail54516E8D; test.deepEqual(trail.DependsOn, ['MyAmazingCloudTrailS3Policy39C120B0']); test.done(); }, @@ -97,7 +97,7 @@ export = { PolicyName: logsRolePolicyName, Roles: [{ Ref: 'MyAmazingCloudTrailLogsRoleF2CCF977' }], })); - const trail: any = stack._toCloudFormation().Resources.MyAmazingCloudTrail54516E8D; + const trail: any = SynthUtils.toCloudFormation(stack).Resources.MyAmazingCloudTrail54516E8D; test.deepEqual(trail.DependsOn, [logsRolePolicyName, logsRoleName, 'MyAmazingCloudTrailS3Policy39C120B0']); test.done(); }, @@ -116,7 +116,7 @@ export = { expect(stack).to(haveResource("AWS::Logs::LogGroup", { RetentionInDays: 7 })); - const trail: any = stack._toCloudFormation().Resources.MyAmazingCloudTrail54516E8D; + const trail: any = SynthUtils.toCloudFormation(stack).Resources.MyAmazingCloudTrail54516E8D; test.deepEqual(trail.DependsOn, [logsRolePolicyName, logsRoleName, 'MyAmazingCloudTrailS3Policy39C120B0']); test.done(); }, @@ -134,7 +134,7 @@ export = { expect(stack).to(not(haveResource("AWS::Logs::LogGroup"))); expect(stack).to(not(haveResource("AWS::IAM::Role"))); - const trail: any = stack._toCloudFormation().Resources.MyAmazingCloudTrail54516E8D; + const trail: any = SynthUtils.toCloudFormation(stack).Resources.MyAmazingCloudTrail54516E8D; test.equals(trail.Properties.EventSelectors.length, 1); const selector = trail.Properties.EventSelectors[0]; test.equals(selector.ReadWriteType, null, "Expected selector read write type to be undefined"); @@ -160,7 +160,7 @@ export = { expect(stack).to(not(haveResource("AWS::Logs::LogGroup"))); expect(stack).to(not(haveResource("AWS::IAM::Role"))); - const trail: any = stack._toCloudFormation().Resources.MyAmazingCloudTrail54516E8D; + const trail: any = SynthUtils.toCloudFormation(stack).Resources.MyAmazingCloudTrail54516E8D; test.equals(trail.Properties.EventSelectors.length, 1); const selector = trail.Properties.EventSelectors[0]; test.equals(selector.ReadWriteType, "ReadOnly", "Expected selector read write type to be Read"); @@ -179,7 +179,7 @@ export = { new CloudTrail(stack, 'MyAmazingCloudTrail', { managementEvents: ReadWriteType.WriteOnly }); - const trail: any = stack._toCloudFormation().Resources.MyAmazingCloudTrail54516E8D; + const trail: any = SynthUtils.toCloudFormation(stack).Resources.MyAmazingCloudTrail54516E8D; test.equals(trail.Properties.EventSelectors.length, 1); const selector = trail.Properties.EventSelectors[0]; test.equals(selector.ReadWriteType, "WriteOnly", "Expected selector read write type to be All"); diff --git a/packages/@aws-cdk/aws-cloudwatch/lib/alarm.ts b/packages/@aws-cdk/aws-cloudwatch/lib/alarm.ts index 009834d0682b8..ae35de6547665 100644 --- a/packages/@aws-cdk/aws-cloudwatch/lib/alarm.ts +++ b/packages/@aws-cdk/aws-cloudwatch/lib/alarm.ts @@ -14,7 +14,7 @@ export interface AlarmProps extends MetricAlarmProps { * Metric objects can be obtained from most resources, or you can construct * custom Metric objects by instantiating one. */ - metric: Metric; + readonly metric: Metric; } /** @@ -233,35 +233,35 @@ export interface AlarmMetricJson { /** * The dimensions to apply to the alarm */ - dimensions?: Dimension[]; + readonly dimensions?: Dimension[]; /** * Namespace of the metric */ - namespace: string; + readonly namespace: string; /** * Name of the metric */ - metricName: string; + readonly metricName: string; /** * How many seconds to aggregate over */ - period: number; + readonly period: number; /** * Simple aggregation function to use */ - statistic?: Statistic; + readonly statistic?: Statistic; /** * Percentile aggregation function to use */ - extendedStatistic?: string; + readonly extendedStatistic?: string; /** * The unit of the alarm */ - unit?: Unit; + readonly unit?: Unit; } diff --git a/packages/@aws-cdk/aws-cloudwatch/lib/dashboard.ts b/packages/@aws-cdk/aws-cloudwatch/lib/dashboard.ts index 195d1babf382a..cb35768f65c78 100644 --- a/packages/@aws-cdk/aws-cloudwatch/lib/dashboard.ts +++ b/packages/@aws-cdk/aws-cloudwatch/lib/dashboard.ts @@ -9,7 +9,7 @@ export interface DashboardProps { * * @default Automatically generated name */ - dashboardName?: string; + readonly dashboardName?: string; } /** diff --git a/packages/@aws-cdk/aws-cloudwatch/lib/graph.ts b/packages/@aws-cdk/aws-cloudwatch/lib/graph.ts index a97fe451b1357..fb28630a4bae3 100644 --- a/packages/@aws-cdk/aws-cloudwatch/lib/graph.ts +++ b/packages/@aws-cdk/aws-cloudwatch/lib/graph.ts @@ -11,28 +11,28 @@ export interface MetricWidgetProps { /** * Title for the graph */ - title?: string; + readonly title?: string; /** * The region the metrics of this graph should be taken from * * @default Current region */ - region?: string; + readonly region?: string; /** * Width of the widget, in a grid of 24 units wide * * @default 6 */ - width?: number; + readonly width?: number; /** * Height of the widget * * @default Depends on the type of widget */ - height?: number; + readonly height?: number; } /** @@ -42,14 +42,14 @@ export interface AlarmWidgetProps extends MetricWidgetProps { /** * The alarm to show */ - alarm: Alarm; + readonly alarm: Alarm; /** * Range of left Y axis * * @default 0..automatic */ - leftAxisRange?: YAxisRange; + readonly leftAxisRange?: YAxisRange; } /** @@ -92,41 +92,41 @@ export interface GraphWidgetProps extends MetricWidgetProps { /** * Metrics to display on left Y axis */ - left?: Metric[]; + readonly left?: Metric[]; /** * Metrics to display on right Y axis */ - right?: Metric[]; + readonly right?: Metric[]; /** * Annotations for the left Y axis */ - leftAnnotations?: HorizontalAnnotation[]; + readonly leftAnnotations?: HorizontalAnnotation[]; /** * Annotations for the right Y axis */ - rightAnnotations?: HorizontalAnnotation[]; + readonly rightAnnotations?: HorizontalAnnotation[]; /** * Whether the graph should be shown as stacked lines */ - stacked?: boolean; + readonly stacked?: boolean; /** * Range of left Y axis * * @default 0..automatic */ - leftAxisRange?: YAxisRange; + readonly leftAxisRange?: YAxisRange; /** * Range of right Y axis * * @default 0..automatic */ - rightAxisRange?: YAxisRange; + readonly rightAxisRange?: YAxisRange; } /** @@ -173,7 +173,7 @@ export interface SingleValueWidgetProps extends MetricWidgetProps { /** * Metrics to display */ - metrics: Metric[]; + readonly metrics: Metric[]; } /** @@ -213,14 +213,14 @@ export interface YAxisRange { * * @default Automatic */ - min?: number; + readonly min?: number; /** * The maximum value * * @default Automatic */ - max?: number; + readonly max?: number; } /** @@ -230,35 +230,35 @@ export interface HorizontalAnnotation { /** * The value of the annotation */ - value: number; + readonly value: number; /** * Label for the annotation * * @default No label */ - label?: string; + readonly label?: string; /** * Hex color code to be used for the annotation * * @default Automatic color */ - color?: string; + readonly color?: string; /** * Add shading above or below the annotation * * @default No shading */ - fill?: Shading; + readonly fill?: Shading; /** * Whether the annotation is visible * * @default true */ - visible?: boolean; + readonly visible?: boolean; } export enum Shading { diff --git a/packages/@aws-cdk/aws-cloudwatch/lib/layout.ts b/packages/@aws-cdk/aws-cloudwatch/lib/layout.ts index d52de9a5758c0..f86d813bbddfa 100644 --- a/packages/@aws-cdk/aws-cloudwatch/lib/layout.ts +++ b/packages/@aws-cdk/aws-cloudwatch/lib/layout.ts @@ -106,14 +106,14 @@ export interface SpacerProps { * * @default 1 */ - width?: number; + readonly width?: number; /** * Height of the spacer * * @default: 1 */ - height?: number; + readonly height?: number; } /** diff --git a/packages/@aws-cdk/aws-cloudwatch/lib/metric.ts b/packages/@aws-cdk/aws-cloudwatch/lib/metric.ts index 7d36a33148ce3..3bacddc206d59 100644 --- a/packages/@aws-cdk/aws-cloudwatch/lib/metric.ts +++ b/packages/@aws-cdk/aws-cloudwatch/lib/metric.ts @@ -14,17 +14,17 @@ export interface MetricProps { * * @default No dimensions */ - dimensions?: DimensionHash; + readonly dimensions?: DimensionHash; /** * Namespace of the metric. */ - namespace: string; + readonly namespace: string; /** * Name of the metric. */ - metricName: string; + readonly metricName: string; /** * The period over which the specified statistic is applied. @@ -33,7 +33,7 @@ export interface MetricProps { * * @default 300 */ - periodSec?: number; + readonly periodSec?: number; /** * What function to use for aggregating. @@ -49,22 +49,22 @@ export interface MetricProps { * * @default Average */ - statistic?: string; + readonly statistic?: string; /** * Unit for the metric that is associated with the alarm */ - unit?: Unit; + readonly unit?: Unit; /** * Label for this metric when added to a Graph in a Dashboard */ - label?: string; + readonly label?: string; /** * Color for this metric when added to a Graph in a Dashboard */ - color?: string; + readonly color?: string; } /** @@ -189,12 +189,12 @@ export interface Dimension { /** * Name of the dimension */ - name: string; + readonly name: string; /** * Value of the dimension */ - value: any; + readonly value: any; } /** @@ -250,7 +250,7 @@ export interface MetricCustomization { * * @default No dimensions */ - dimensions?: DimensionHash; + readonly dimensions?: DimensionHash; /** * The period over which the specified statistic is applied. @@ -259,7 +259,7 @@ export interface MetricCustomization { * * @default 300 */ - periodSec?: number; + readonly periodSec?: number; /** * What function to use for aggregating. @@ -275,22 +275,22 @@ export interface MetricCustomization { * * @default Average */ - statistic?: string; + readonly statistic?: string; /** * Unit for the metric that is associated with the alarm */ - unit?: Unit; + readonly unit?: Unit; /** * Label for this metric when added to a Graph in a Dashboard */ - label?: string; + readonly label?: string; /** * Color for this metric when added to a Graph in a Dashboard */ - color?: string; + readonly color?: string; } /** @@ -304,7 +304,7 @@ export interface MetricAlarmProps { * * @default 300 */ - periodSec?: number; + readonly periodSec?: number; /** * What function to use for aggregating. @@ -320,59 +320,59 @@ export interface MetricAlarmProps { * * @default Average */ - statistic?: string; + readonly statistic?: string; /** * Name of the alarm * * @default Automatically generated name */ - alarmName?: string; + readonly alarmName?: string; /** * Description for the alarm * * @default No description */ - alarmDescription?: string; + readonly alarmDescription?: string; /** * Comparison to use to check if metric is breaching * * @default GreaterThanOrEqualToThreshold */ - comparisonOperator?: ComparisonOperator; + readonly comparisonOperator?: ComparisonOperator; /** * The value against which the specified statistic is compared. */ - threshold: number; + readonly threshold: number; /** * The number of periods over which data is compared to the specified threshold. */ - evaluationPeriods: number; + readonly evaluationPeriods: number; /** * Specifies whether to evaluate the data and potentially change the alarm state if there are too few data points to be statistically significant. * * Used only for alarms that are based on percentiles. */ - evaluateLowSampleCountPercentile?: string; + readonly evaluateLowSampleCountPercentile?: string; /** * Sets how this alarm is to handle missing data points. * * @default TreatMissingData.Missing */ - treatMissingData?: TreatMissingData; + readonly treatMissingData?: TreatMissingData; /** * Whether the actions for this alarm are enabled * * @default true */ - actionsEnabled?: boolean; + readonly actionsEnabled?: boolean; /** * The number of datapoints that must be breaching to trigger the alarm. This is used only if you are setting an "M @@ -383,7 +383,7 @@ export interface MetricAlarmProps { * * @see https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/AlarmThatSendsEmail.html#alarm-evaluation */ - datapointsToAlarm?: number; + readonly datapointsToAlarm?: number; } function ifUndefined(x: T | undefined, def: T | undefined): T | undefined { diff --git a/packages/@aws-cdk/aws-cloudwatch/lib/text.ts b/packages/@aws-cdk/aws-cloudwatch/lib/text.ts index 0e3e09c821211..b052ba1fbfe7d 100644 --- a/packages/@aws-cdk/aws-cloudwatch/lib/text.ts +++ b/packages/@aws-cdk/aws-cloudwatch/lib/text.ts @@ -7,21 +7,21 @@ export interface TextWidgetProps { /** * The text to display, in MarkDown format */ - markdown: string; + readonly markdown: string; /** * Width of the widget, in a grid of 24 units wide * * @default 6 */ - width?: number; + readonly width?: number; /** * Height of the widget * * @default 2 */ - height?: number; + readonly height?: number; } /** diff --git a/packages/@aws-cdk/aws-codebuild/lib/artifacts.ts b/packages/@aws-cdk/aws-codebuild/lib/artifacts.ts index e8d44528bf015..c85c79c7b4cc6 100644 --- a/packages/@aws-cdk/aws-codebuild/lib/artifacts.ts +++ b/packages/@aws-cdk/aws-codebuild/lib/artifacts.ts @@ -10,7 +10,7 @@ export interface BuildArtifactsProps { * The artifact identifier. * This property is required on secondary artifacts. */ - identifier?: string; + readonly identifier?: string; } /** @@ -24,6 +24,9 @@ export abstract class BuildArtifacts { this.identifier = props.identifier; } + /** + * @internal + */ public _bind(_project: Project) { return; } @@ -79,14 +82,14 @@ export interface S3BucketBuildArtifactsProps extends BuildArtifactsProps { /** * The name of the output bucket. */ - bucket: s3.IBucket; + readonly bucket: s3.IBucket; /** * The path inside of the bucket for the build output .zip file or folder. * If a value is not specified, then build output will be stored at the root of the * bucket (or under the directory if `includeBuildId` is set to true). */ - path?: string; + readonly path?: string; /** * The name of the build output ZIP file or folder inside the bucket. @@ -94,7 +97,7 @@ export interface S3BucketBuildArtifactsProps extends BuildArtifactsProps { * The full S3 object key will be "//" or * "/" depending on whether `includeBuildId` is set to true. */ - name: string; + readonly name: string; /** * Indicates if the build ID should be included in the path. If this is set to true, @@ -102,7 +105,7 @@ export interface S3BucketBuildArtifactsProps extends BuildArtifactsProps { * * @default true */ - includeBuildId?: boolean; + readonly includeBuildId?: boolean; /** * If this is true, all build output will be packaged into a single .zip file. @@ -110,7 +113,7 @@ export interface S3BucketBuildArtifactsProps extends BuildArtifactsProps { * * @default true - files will be archived */ - packageZip?: boolean; + readonly packageZip?: boolean; } /** @@ -123,6 +126,9 @@ export class S3BucketBuildArtifacts extends BuildArtifacts { super(props); } + /** + * @internal + */ public _bind(project: Project) { this.props.bucket.grantReadWrite(project.role); } diff --git a/packages/@aws-cdk/aws-codebuild/lib/pipeline-actions.ts b/packages/@aws-cdk/aws-codebuild/lib/pipeline-actions.ts index 16589721b5738..ecb3c84e42da9 100644 --- a/packages/@aws-cdk/aws-codebuild/lib/pipeline-actions.ts +++ b/packages/@aws-cdk/aws-codebuild/lib/pipeline-actions.ts @@ -10,14 +10,14 @@ export interface CommonCodeBuildActionProps { /** * The list of additional input Artifacts for this Action. */ - additionalInputArtifacts?: codepipeline.Artifact[]; + readonly additionalInputArtifacts?: codepipeline.Artifact[]; /** * The list of names for additional output Artifacts for this Action. * The resulting output artifacts can be accessed with the `additionalOutputArtifacts` * method of the Action. */ - additionalOutputArtifactNames?: string[]; + readonly additionalOutputArtifactNames?: string[]; } /** @@ -30,14 +30,14 @@ export interface CommonPipelineBuildActionProps extends CommonCodeBuildActionPro /** * The source to use as input for this build. */ - inputArtifact: codepipeline.Artifact; + readonly inputArtifact: codepipeline.Artifact; /** * The name of the build's output artifact. * * @default an auto-generated name will be used */ - outputArtifactName?: string; + readonly outputArtifactName?: string; } /** @@ -47,7 +47,7 @@ export interface PipelineBuildActionProps extends CommonPipelineBuildActionProps /** * The build project */ - project: IProject; + readonly project: IProject; } /** @@ -84,7 +84,8 @@ export class PipelineBuildAction extends codepipeline.BuildAction { * @see #additionalOutputArtifact */ public additionalOutputArtifacts(): codepipeline.Artifact[] { - return this._outputArtifacts.slice(1); + // TODO: remove "as any" when we centralize all actions + return (this as any)._outputArtifacts.slice(1); } /** @@ -117,7 +118,7 @@ export interface CommonPipelineTestActionProps extends CommonCodeBuildActionProp /** * The source to use as input for this test. */ - inputArtifact: codepipeline.Artifact; + readonly inputArtifact: codepipeline.Artifact; /** * The optional name of the primary output artifact. @@ -127,7 +128,7 @@ export interface CommonPipelineTestActionProps extends CommonCodeBuildActionProp * * @default the Action will not have an output artifact */ - outputArtifactName?: string; + readonly outputArtifactName?: string; } /** @@ -137,7 +138,7 @@ export interface PipelineTestActionProps extends CommonPipelineTestActionProps { /** * The build Project. */ - project: IProject; + readonly project: IProject; } export class PipelineTestAction extends codepipeline.TestAction { @@ -170,9 +171,10 @@ export class PipelineTestAction extends codepipeline.TestAction { * @see #additionalOutputArtifact */ public additionalOutputArtifacts(): codepipeline.Artifact[] { + // TODO: revert "as any" when we centralize pipeline actions. return this.outputArtifact === undefined - ? this._outputArtifacts - : this._outputArtifacts.slice(1); + ? (this as any)._outputArtifacts + : (this as any)._outputArtifacts.slice(1); } /** @@ -191,7 +193,8 @@ export class PipelineTestAction extends codepipeline.TestAction { } protected bind(stage: codepipeline.IStage, _scope: cdk.Construct): void { - setCodeBuildNeededPermissions(stage, this.props.project, this._outputArtifacts.length > 0); + // TODO: revert "as any" when we centralize pipeline actions + setCodeBuildNeededPermissions(stage, this.props.project, (this as any)._outputArtifacts.length > 0); } } @@ -219,7 +222,8 @@ function handleAdditionalInputOutputArtifacts(props: CommonCodeBuildActionProps, addOutputArtifact: (_: string) => void) { if ((props.additionalInputArtifacts || []).length > 0) { // we have to set the primary source in the configuration - action.configuration.PrimarySource = action._inputArtifacts[0].artifactName; + // TODO: revert "as any" when we centralize pipeline actions + action.configuration.PrimarySource = (action as any)._inputArtifacts[0].artifactName; // add the additional artifacts for (const additionalInputArtifact of props.additionalInputArtifacts || []) { addInputArtifact(additionalInputArtifact); diff --git a/packages/@aws-cdk/aws-codebuild/lib/project.ts b/packages/@aws-cdk/aws-codebuild/lib/project.ts index f8eb90411569a..83b62e543c32b 100644 --- a/packages/@aws-cdk/aws-codebuild/lib/project.ts +++ b/packages/@aws-cdk/aws-codebuild/lib/project.ts @@ -161,7 +161,7 @@ export interface ProjectImportProps { * The human-readable name of the CodeBuild Project we're referencing. * The Project must be in the same account and region as the root Stack. */ - projectName: string; + readonly projectName: string; } /** @@ -428,13 +428,13 @@ export interface CommonProjectProps { * A description of the project. Use the description to identify the purpose * of the project. */ - description?: string; + readonly description?: string; /** * Filename or contents of buildspec in JSON format. * @see https://docs.aws.amazon.com/codebuild/latest/userguide/build-spec-ref.html#build-spec-ref-example */ - buildSpec?: any; + readonly buildSpec?: any; /** * Run a script from an asset as build script @@ -447,66 +447,66 @@ export interface CommonProjectProps { * * @default No asset build script */ - buildScriptAsset?: assets.Asset; + readonly buildScriptAsset?: assets.Asset; /** * The script in the asset to run. * * @default build.sh */ - buildScriptAssetEntrypoint?: string; + readonly buildScriptAssetEntrypoint?: string; /** * Service Role to assume while running the build. * If not specified, a role will be created. */ - role?: iam.IRole; + readonly role?: iam.IRole; /** * Encryption key to use to read and write artifacts * If not specified, a role will be created. */ - encryptionKey?: kms.IEncryptionKey; + readonly encryptionKey?: kms.IEncryptionKey; /** * Bucket to store cached source artifacts * If not specified, source artifacts will not be cached. */ - cacheBucket?: s3.IBucket; + readonly cacheBucket?: s3.IBucket; /** * Subdirectory to store cached artifacts */ - cacheDir?: string; + readonly cacheDir?: string; /** * Build environment to use for the build. */ - environment?: BuildEnvironment; + readonly environment?: BuildEnvironment; /** * Indicates whether AWS CodeBuild generates a publicly accessible URL for * your project's build badge. For more information, see Build Badges Sample * in the AWS CodeBuild User Guide. */ - badge?: boolean; + readonly badge?: boolean; /** * The number of minutes after which AWS CodeBuild stops the build if it's * not complete. For valid values, see the timeoutInMinutes field in the AWS * CodeBuild User Guide. */ - timeout?: number; + readonly timeout?: number; /** * Additional environment variables to add to the build environment. */ - environmentVariables?: { [name: string]: BuildEnvironmentVariable }; + readonly environmentVariables?: { [name: string]: BuildEnvironmentVariable }; /** * The physical, human-readable name of the CodeBuild Project. */ - projectName?: string; + readonly projectName?: string; } export interface ProjectProps extends CommonProjectProps { @@ -517,7 +517,7 @@ export interface ProjectProps extends CommonProjectProps { * * @default NoSource */ - source?: BuildSource; + readonly source?: BuildSource; /** * Defines where build artifacts will be stored. @@ -525,7 +525,7 @@ export interface ProjectProps extends CommonProjectProps { * * @default NoBuildArtifacts */ - artifacts?: BuildArtifacts; + readonly artifacts?: BuildArtifacts; /** * The secondary sources for the Project. @@ -534,7 +534,7 @@ export interface ProjectProps extends CommonProjectProps { * @default [] * @see https://docs.aws.amazon.com/codebuild/latest/userguide/sample-multi-in-out.html */ - secondarySources?: BuildSource[]; + readonly secondarySources?: BuildSource[]; /** * The secondary artifacts for the Project. @@ -543,7 +543,7 @@ export interface ProjectProps extends CommonProjectProps { * @default [] * @see https://docs.aws.amazon.com/codebuild/latest/userguide/sample-multi-in-out.html */ - secondaryArtifacts?: BuildArtifacts[]; + readonly secondaryArtifacts?: BuildArtifacts[]; } /** @@ -633,16 +633,27 @@ export class Project extends ProjectBase { } // Render the source and add in the buildspec - const sourceJson = this.source.toSourceJSON(); - if (typeof buildSpec === 'string') { - sourceJson.buildSpec = buildSpec; // Filename to buildspec file - } else if (Object.keys(buildSpec).length > 0) { - // We have to pretty-print the buildspec, otherwise - // CodeBuild will not recognize it as an inline buildspec. - sourceJson.buildSpec = JSON.stringify(buildSpec, undefined, 2); // Literal buildspec - } else if (this.source.type === SourceType.None) { - throw new Error("If the Project's source is NoSource, you need to provide a buildSpec"); - } + + const renderSource = () => { + const sourceJson = this.source.toSourceJSON(); + if (typeof buildSpec === 'string') { + return { + ...sourceJson, + buildSpec // Filename to buildspec file + }; + } else if (Object.keys(buildSpec).length > 0) { + // We have to pretty-print the buildspec, otherwise + // CodeBuild will not recognize it as an inline buildspec. + return { + ...sourceJson, + buildSpec: JSON.stringify(buildSpec, undefined, 2) + }; + } else if (this.source.type === SourceType.None) { + throw new Error("If the Project's source is NoSource, you need to provide a buildSpec"); + } else { + return sourceJson; + } + }; this._secondarySources = []; for (const secondarySource of props.secondarySources || []) { @@ -658,7 +669,7 @@ export class Project extends ProjectBase { const resource = new CfnProject(this, 'Resource', { description: props.description, - source: sourceJson, + source: renderSource(), artifacts: artifacts.toArtifactsJSON(), serviceRole: this.role.roleArn, environment: this.renderEnvironment(props.environment, environmentVariables), @@ -849,7 +860,7 @@ export interface BuildEnvironment { * * @default LinuxBuildImage.UBUNTU_14_04_BASE */ - buildImage?: IBuildImage; + readonly buildImage?: IBuildImage; /** * The type of compute to use for this build. @@ -857,7 +868,7 @@ export interface BuildEnvironment { * * @default taken from {@link #buildImage#defaultComputeType} */ - computeType?: ComputeType; + readonly computeType?: ComputeType; /** * Indicates how the project builds Docker images. Specify true to enable @@ -869,12 +880,12 @@ export interface BuildEnvironment { * * @default false */ - privileged?: boolean; + readonly privileged?: boolean; /** * The environment variables that your builds can use. */ - environmentVariables?: { [name: string]: BuildEnvironmentVariable }; + readonly environmentVariables?: { [name: string]: BuildEnvironmentVariable }; } /** @@ -1128,13 +1139,13 @@ export interface BuildEnvironmentVariable { * The type of environment variable. * @default PlainText */ - type?: BuildEnvironmentVariableType; + readonly type?: BuildEnvironmentVariableType; /** * The value of the environment variable (or the name of the parameter in * the SSM parameter store.) */ - value: any; + readonly value: any; } export enum BuildEnvironmentVariableType { diff --git a/packages/@aws-cdk/aws-codebuild/lib/source.ts b/packages/@aws-cdk/aws-codebuild/lib/source.ts index add210773f4d5..a268399bc2e9f 100644 --- a/packages/@aws-cdk/aws-codebuild/lib/source.ts +++ b/packages/@aws-cdk/aws-codebuild/lib/source.ts @@ -13,7 +13,7 @@ export interface BuildSourceProps { * The source identifier. * This property is required on secondary sources. */ - identifier?: string; + readonly identifier?: string; } /** @@ -31,6 +31,8 @@ export abstract class BuildSource { * Called by the project when the source is added so that the source can perform * binding operations on the source. For example, it can grant permissions to the * code build project to read from the S3 bucket. + * + * @internal */ public _bind(_project: Project) { // by default, do nothing @@ -80,7 +82,7 @@ export interface GitBuildSourceProps extends BuildSourceProps { * If this value is 0, greater than 25, or not provided, * then the full history is downloaded with each build of the project. */ - cloneDepth?: number; + readonly cloneDepth?: number; } /** @@ -96,9 +98,10 @@ export abstract class GitBuildSource extends BuildSource { } public toSourceJSON(): CfnProject.SourceProperty { - const ret = super.toSourceJSON(); - ret.gitCloneDepth = this.cloneDepth; - return ret; + return { + ...super.toSourceJSON(), + gitCloneDepth: this.cloneDepth + }; } } @@ -106,7 +109,7 @@ export abstract class GitBuildSource extends BuildSource { * Construction properties for {@link CodeCommitSource}. */ export interface CodeCommitSourceProps extends GitBuildSourceProps { - repository: codecommit.IRepository; + readonly repository: codecommit.IRepository; } /** @@ -121,6 +124,9 @@ export class CodeCommitSource extends GitBuildSource { this.repo = props.repository; } + /** + * @internal + */ public _bind(project: Project) { // https://docs.aws.amazon.com/codebuild/latest/userguide/setting-up.html project.addToRolePolicy(new iam.PolicyStatement() @@ -139,8 +145,8 @@ export class CodeCommitSource extends GitBuildSource { * Construction properties for {@link S3BucketSource}. */ export interface S3BucketSourceProps extends BuildSourceProps { - bucket: s3.IBucket; - path: string; + readonly bucket: s3.IBucket; + readonly path: string; } /** @@ -157,6 +163,9 @@ export class S3BucketSource extends BuildSource { this.path = props.path; } + /** + * @internal + */ public _bind(project: Project) { this.bucket.grantRead(project.role); } @@ -190,35 +199,35 @@ export interface GitHubSourceProps extends GitBuildSourceProps { * * @example 'awslabs' */ - owner: string; + readonly owner: string; /** * The name of the repo (without the username). * * @example 'aws-cdk' */ - repo: string; + readonly repo: string; /** * The oAuthToken used to authenticate when cloning source git repo. * Note that you need to give CodeBuild permissions to your GitHub account in order for the token to work. * That is a one-time operation that can be done through the AWS Console for CodeBuild. */ - oauthToken: cdk.Secret; + readonly oauthToken: cdk.Secret; /** * Whether to create a webhook that will trigger a build every time a commit is pushed to the GitHub repository. * * @default false */ - webhook?: boolean; + readonly webhook?: boolean; /** * Whether to send GitHub notifications on your build's start and end. * * @default true */ - reportBuildStatus?: boolean; + readonly reportBuildStatus?: boolean; } /** @@ -263,19 +272,19 @@ export interface GitHubEnterpriseSourceProps extends GitBuildSourceProps { /** * The HTTPS URL of the repository in your GitHub Enterprise installation. */ - httpsCloneUrl: string; + readonly httpsCloneUrl: string; /** * The OAuth token used to authenticate when cloning the git repository. */ - oauthToken: cdk.Secret; + readonly oauthToken: cdk.Secret; /** * Whether to ignore SSL errors when connecting to the repository. * * @default false */ - ignoreSslErrors?: boolean; + readonly ignoreSslErrors?: boolean; } /** @@ -312,14 +321,14 @@ export interface BitBucketSourceProps extends GitBuildSourceProps { * * @example 'awslabs' */ - owner: string; + readonly owner: string; /** * The name of the repo (without the username). * * @example 'aws-cdk' */ - repo: string; + readonly repo: string; } /** diff --git a/packages/@aws-cdk/aws-codebuild/package-lock.json b/packages/@aws-cdk/aws-codebuild/package-lock.json index 29cad125e8a0e..4ccdc4c0687aa 100644 --- a/packages/@aws-cdk/aws-codebuild/package-lock.json +++ b/packages/@aws-cdk/aws-codebuild/package-lock.json @@ -1,6 +1,6 @@ { "name": "@aws-cdk/aws-codebuild", - "version": "0.25.3", + "version": "0.26.0", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/packages/@aws-cdk/aws-codecommit/lib/pipeline-action.ts b/packages/@aws-cdk/aws-codecommit/lib/pipeline-action.ts index b661e90cf63bd..4f263150c4581 100644 --- a/packages/@aws-cdk/aws-codecommit/lib/pipeline-action.ts +++ b/packages/@aws-cdk/aws-codecommit/lib/pipeline-action.ts @@ -15,12 +15,12 @@ export interface CommonPipelineSourceActionProps extends codepipeline.CommonActi * * @default a name will be auto-generated */ - outputArtifactName?: string; + readonly outputArtifactName?: string; /** * @default 'master' */ - branch?: string; + readonly branch?: string; /** * Whether AWS CodePipeline should poll for source changes. @@ -28,7 +28,7 @@ export interface CommonPipelineSourceActionProps extends codepipeline.CommonActi * * @default false */ - pollForSourceChanges?: boolean; + readonly pollForSourceChanges?: boolean; } /** @@ -38,7 +38,7 @@ export interface PipelineSourceActionProps extends CommonPipelineSourceActionPro /** * The CodeCommit repository. */ - repository: IRepository; + readonly repository: IRepository; } /** diff --git a/packages/@aws-cdk/aws-codecommit/lib/repository.ts b/packages/@aws-cdk/aws-codecommit/lib/repository.ts index 201198a90cec3..a1327ecdffde4 100644 --- a/packages/@aws-cdk/aws-codecommit/lib/repository.ts +++ b/packages/@aws-cdk/aws-codecommit/lib/repository.ts @@ -92,7 +92,7 @@ export interface RepositoryImportProps { * The name of an existing CodeCommit Repository that we are referencing. * Must be in the same account and region as the root Stack. */ - repositoryName: string; + readonly repositoryName: string; } /** @@ -258,13 +258,13 @@ export interface RepositoryProps { /** * Name of the repository. This property is required for all repositories. */ - repositoryName: string; + readonly repositoryName: string; /** * A description of the repository. Use the description to identify the * purpose of the repository. */ - description?: string; + readonly description?: string; } /** @@ -366,27 +366,27 @@ export interface RepositoryTriggerOptions { /** * A name for the trigger.Triggers on a repository must have unique names */ - name?: string; + readonly name?: string; /** * The repository events for which AWS CodeCommit sends information to the * target, which you specified in the DestinationArn property.If you don't * specify events, the trigger runs for all repository events. */ - events?: RepositoryEventTrigger[]; + readonly events?: RepositoryEventTrigger[]; /** * The names of the branches in the AWS CodeCommit repository that contain * events that you want to include in the trigger. If you don't specify at * least one branch, the trigger applies to all branches. */ - branches?: string[]; + readonly branches?: string[]; /** * When an event is triggered, additional information that AWS CodeCommit * includes when it sends information to the target. */ - customData?: string; + readonly customData?: string; } /** diff --git a/packages/@aws-cdk/aws-codecommit/package-lock.json b/packages/@aws-cdk/aws-codecommit/package-lock.json index 986c01651f110..ad54001d3feb4 100644 --- a/packages/@aws-cdk/aws-codecommit/package-lock.json +++ b/packages/@aws-cdk/aws-codecommit/package-lock.json @@ -1,6 +1,6 @@ { "name": "@aws-cdk/aws-codecommit", - "version": "0.25.3", + "version": "0.26.0", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/packages/@aws-cdk/aws-codedeploy/lib/lambda/application.ts b/packages/@aws-cdk/aws-codedeploy/lib/lambda/application.ts index 2238b6ebe2ddc..dd1f2b72e9e56 100644 --- a/packages/@aws-cdk/aws-codedeploy/lib/lambda/application.ts +++ b/packages/@aws-cdk/aws-codedeploy/lib/lambda/application.ts @@ -28,7 +28,7 @@ export interface LambdaApplicationProps { * * @default an auto-generated name will be used */ - applicationName?: string; + readonly applicationName?: string; } /** @@ -81,7 +81,7 @@ export interface LambdaApplicationImportProps { * The physical, human-readable name of the Lambda Application we're referencing. * The Application must be in the same account and region as the root Stack. */ - applicationName: string; + readonly applicationName: string; } class ImportedLambdaApplication extends cdk.Construct implements ILambdaApplication { diff --git a/packages/@aws-cdk/aws-codedeploy/lib/lambda/deployment-config.ts b/packages/@aws-cdk/aws-codedeploy/lib/lambda/deployment-config.ts index e128d29458458..416b1cbf77b82 100644 --- a/packages/@aws-cdk/aws-codedeploy/lib/lambda/deployment-config.ts +++ b/packages/@aws-cdk/aws-codedeploy/lib/lambda/deployment-config.ts @@ -38,7 +38,7 @@ export interface LambdaDeploymentConfigImportProps { * The physical, human-readable name of the custom CodeDeploy Lambda Deployment Configuration * that we are referencing. */ - deploymentConfigName: string; + readonly deploymentConfigName: string; } class ImportedLambdaDeploymentConfig extends cdk.Construct implements ILambdaDeploymentConfig { diff --git a/packages/@aws-cdk/aws-codedeploy/lib/lambda/deployment-group.ts b/packages/@aws-cdk/aws-codedeploy/lib/lambda/deployment-group.ts index 9c259750dc77c..2eeaa41c3ce15 100644 --- a/packages/@aws-cdk/aws-codedeploy/lib/lambda/deployment-group.ts +++ b/packages/@aws-cdk/aws-codedeploy/lib/lambda/deployment-group.ts @@ -43,21 +43,21 @@ export interface LambdaDeploymentGroupProps { * * @default one will be created for you */ - application?: ILambdaApplication; + readonly application?: ILambdaApplication; /** * The physical, human-readable name of the CodeDeploy Deployment Group. * * @default an auto-generated name will be used */ - deploymentGroupName?: string; + readonly deploymentGroupName?: string; /** * The Deployment Configuration this Deployment Group uses. * * @default LambdaDeploymentConfig#AllAtOnce */ - deploymentConfig?: ILambdaDeploymentConfig; + readonly deploymentConfig?: ILambdaDeploymentConfig; /** * The CloudWatch alarms associated with this Deployment Group. @@ -69,42 +69,42 @@ export interface LambdaDeploymentGroupProps { * @default [] * @see https://docs.aws.amazon.com/codedeploy/latest/userguide/monitoring-create-alarms.html */ - alarms?: cloudwatch.Alarm[]; + readonly alarms?: cloudwatch.Alarm[]; /** * The service Role of this Deployment Group. * * @default a new Role will be created. */ - role?: iam.IRole; + readonly role?: iam.IRole; /** * Lambda Alias to shift traffic. Updating the version * of the alias will trigger a CodeDeploy deployment. */ - alias: lambda.Alias; + readonly alias: lambda.Alias; /** * The Lambda function to run before traffic routing starts. */ - preHook?: lambda.IFunction; + readonly preHook?: lambda.IFunction; /** * The Lambda function to run after traffic routing starts. */ - postHook?: lambda.IFunction; + readonly postHook?: lambda.IFunction; /** * Whether to continue a deployment even if fetching the alarm status from CloudWatch failed. * * @default false */ - ignorePollAlarmsFailure?: boolean; + readonly ignorePollAlarmsFailure?: boolean; /** * The auto-rollback configuration for this Deployment Group. */ - autoRollback?: AutoRollbackConfig; + readonly autoRollback?: AutoRollbackConfig; } export class LambdaDeploymentGroup extends cdk.Construct implements ILambdaDeploymentGroup { @@ -246,13 +246,13 @@ export interface LambdaDeploymentGroupImportProps { * The reference to the CodeDeploy Lambda Application * that this Deployment Group belongs to. */ - application: ILambdaApplication; + readonly application: ILambdaApplication; /** * The physical, human-readable name of the CodeDeploy Lambda Deployment Group * that we are referencing. */ - deploymentGroupName: string; + readonly deploymentGroupName: string; } class ImportedLambdaDeploymentGroup extends cdk.Construct implements ILambdaDeploymentGroup { diff --git a/packages/@aws-cdk/aws-codedeploy/lib/pipeline-action.ts b/packages/@aws-cdk/aws-codedeploy/lib/pipeline-action.ts index d2e23fa05b34a..44d8132509ff1 100644 --- a/packages/@aws-cdk/aws-codedeploy/lib/pipeline-action.ts +++ b/packages/@aws-cdk/aws-codedeploy/lib/pipeline-action.ts @@ -12,7 +12,7 @@ export interface CommonPipelineDeployActionProps extends codepipeline.CommonActi /** * The source to use as input for deployment. */ - inputArtifact: codepipeline.Artifact; + readonly inputArtifact: codepipeline.Artifact; } /** @@ -22,7 +22,7 @@ export interface PipelineDeployActionProps extends CommonPipelineDeployActionPro /** * The CodeDeploy Deployment Group to deploy to. */ - deploymentGroup: IServerDeploymentGroup; + readonly deploymentGroup: IServerDeploymentGroup; } export class PipelineDeployAction extends codepipeline.DeployAction { diff --git a/packages/@aws-cdk/aws-codedeploy/lib/rollback-config.ts b/packages/@aws-cdk/aws-codedeploy/lib/rollback-config.ts index eb399ae9fd522..f5865d3157068 100644 --- a/packages/@aws-cdk/aws-codedeploy/lib/rollback-config.ts +++ b/packages/@aws-cdk/aws-codedeploy/lib/rollback-config.ts @@ -7,14 +7,14 @@ export interface AutoRollbackConfig { * * @default true */ - failedDeployment?: boolean; + readonly failedDeployment?: boolean; /** * Whether to automatically roll back a deployment that was manually stopped. * * @default false */ - stoppedDeployment?: boolean; + readonly stoppedDeployment?: boolean; /** * Whether to automatically roll back a deployment during which one of the configured @@ -22,5 +22,5 @@ export interface AutoRollbackConfig { * * @default true if you've provided any Alarms with the `alarms` property, false otherwise */ - deploymentInAlarm?: boolean; + readonly deploymentInAlarm?: boolean; } diff --git a/packages/@aws-cdk/aws-codedeploy/lib/server/application.ts b/packages/@aws-cdk/aws-codedeploy/lib/server/application.ts index c786ccfe005dd..faa78f4bb7f6b 100644 --- a/packages/@aws-cdk/aws-codedeploy/lib/server/application.ts +++ b/packages/@aws-cdk/aws-codedeploy/lib/server/application.ts @@ -30,7 +30,7 @@ export interface ServerApplicationImportProps { * The physical, human-readable name of the CodeDeploy EC2/on-premise Application we're referencing. * The Application must be in the same account and region as the root Stack. */ - applicationName: string; + readonly applicationName: string; } class ImportedServerApplication extends cdk.Construct implements IServerApplication { @@ -58,7 +58,7 @@ export interface ServerApplicationProps { * * @default an auto-generated name will be used */ - applicationName?: string; + readonly applicationName?: string; } /** diff --git a/packages/@aws-cdk/aws-codedeploy/lib/server/deployment-config.ts b/packages/@aws-cdk/aws-codedeploy/lib/server/deployment-config.ts index e2b39b5e676a5..8ce853ef0e5c6 100644 --- a/packages/@aws-cdk/aws-codedeploy/lib/server/deployment-config.ts +++ b/packages/@aws-cdk/aws-codedeploy/lib/server/deployment-config.ts @@ -26,7 +26,7 @@ export interface ServerDeploymentConfigImportProps { * The physical, human-readable name of the custom CodeDeploy EC2/on-premise Deployment Configuration * that we are referencing. */ - deploymentConfigName: string; + readonly deploymentConfigName: string; } class ImportedServerDeploymentConfig extends cdk.Construct implements IServerDeploymentConfig { @@ -74,7 +74,7 @@ export interface ServerDeploymentConfigProps { * * @default a name will be auto-generated */ - deploymentConfigName?: string; + readonly deploymentConfigName?: string; /** * The minimum healhty hosts threshold expressed as an absolute number. @@ -82,7 +82,7 @@ export interface ServerDeploymentConfigProps { * you can't specify {@link #minHealthyHostPercentage}, * however one of this or {@link #minHealthyHostPercentage} is required. */ - minHealthyHostCount?: number; + readonly minHealthyHostCount?: number; /** * The minmum healhty hosts threshold expressed as a percentage of the fleet. @@ -90,7 +90,7 @@ export interface ServerDeploymentConfigProps { * you can't specify {@link #minHealthyHostCount}, * however one of this or {@link #minHealthyHostCount} is required. */ - minHealthyHostPercentage?: number; + readonly minHealthyHostPercentage?: number; } /** diff --git a/packages/@aws-cdk/aws-codedeploy/lib/server/deployment-group.ts b/packages/@aws-cdk/aws-codedeploy/lib/server/deployment-group.ts index f7cf5469c84cc..935aeec1ef99c 100644 --- a/packages/@aws-cdk/aws-codedeploy/lib/server/deployment-group.ts +++ b/packages/@aws-cdk/aws-codedeploy/lib/server/deployment-group.ts @@ -41,20 +41,20 @@ export interface ServerDeploymentGroupImportProps { * The reference to the CodeDeploy EC2/on-premise Application * that this Deployment Group belongs to. */ - application: IServerApplication; + readonly application: IServerApplication; /** * The physical, human-readable name of the CodeDeploy EC2/on-premise Deployment Group * that we are referencing. */ - deploymentGroupName: string; + readonly deploymentGroupName: string; /** * The Deployment Configuration this Deployment Group uses. * * @default ServerDeploymentConfig#OneAtATime */ - deploymentConfig?: IServerDeploymentConfig; + readonly deploymentConfig?: IServerDeploymentConfig; } /** @@ -155,27 +155,27 @@ export interface ServerDeploymentGroupProps { * The CodeDeploy EC2/on-premise Application this Deployment Group belongs to. * If you don't provide one, a new Application will be created. */ - application?: IServerApplication; + readonly application?: IServerApplication; /** * The service Role of this Deployment Group. * If you don't provide one, a new Role will be created. */ - role?: iam.Role; + readonly role?: iam.Role; /** * The physical, human-readable name of the CodeDeploy Deployment Group. * * @default an auto-generated name will be used */ - deploymentGroupName?: string; + readonly deploymentGroupName?: string; /** * The EC2/on-premise Deployment Configuration to use for this Deployment Group. * * @default ServerDeploymentConfig#OneAtATime */ - deploymentConfig?: IServerDeploymentConfig; + readonly deploymentConfig?: IServerDeploymentConfig; /** * The auto-scaling groups belonging to this Deployment Group. @@ -184,7 +184,7 @@ export interface ServerDeploymentGroupProps { * * @default [] */ - autoScalingGroups?: autoscaling.AutoScalingGroup[]; + readonly autoScalingGroups?: autoscaling.AutoScalingGroup[]; /** * If you've provided any auto-scaling groups with the {@link #autoScalingGroups} property, @@ -193,7 +193,7 @@ export interface ServerDeploymentGroupProps { * @default true * @see https://docs.aws.amazon.com/codedeploy/latest/userguide/codedeploy-agent-operations-install.html */ - installAgent?: boolean; + readonly installAgent?: boolean; /** * The load balancer to place in front of this Deployment Group. @@ -202,21 +202,21 @@ export interface ServerDeploymentGroupProps { * * @default the Deployment Group will not have a load balancer defined */ - loadBalancer?: codedeploylb.ILoadBalancer; + readonly loadBalancer?: codedeploylb.ILoadBalancer; /** * All EC2 instances matching the given set of tags when a deployment occurs will be added to this Deployment Group. * * @default no additional EC2 instances will be added to the Deployment Group */ - ec2InstanceTags?: InstanceTagSet; + readonly ec2InstanceTags?: InstanceTagSet; /** * All on-premise instances matching the given set of tags when a deployment occurs will be added to this Deployment Group. * * @default no additional on-premise instances will be added to the Deployment Group */ - onPremiseInstanceTags?: InstanceTagSet; + readonly onPremiseInstanceTags?: InstanceTagSet; /** * The CloudWatch alarms associated with this Deployment Group. @@ -228,19 +228,19 @@ export interface ServerDeploymentGroupProps { * @default [] * @see https://docs.aws.amazon.com/codedeploy/latest/userguide/monitoring-create-alarms.html */ - alarms?: cloudwatch.Alarm[]; + readonly alarms?: cloudwatch.Alarm[]; /** * Whether to continue a deployment even if fetching the alarm status from CloudWatch failed. * * @default false */ - ignorePollAlarmsFailure?: boolean; + readonly ignorePollAlarmsFailure?: boolean; /** * The auto-rollback configuration for this Deployment Group. */ - autoRollback?: AutoRollbackConfig; + readonly autoRollback?: AutoRollbackConfig; } /** diff --git a/packages/@aws-cdk/aws-codedeploy/test/server/test.deployment-group.ts b/packages/@aws-cdk/aws-codedeploy/test/server/test.deployment-group.ts index ac79e4efc9f6d..61aae5044cf74 100644 --- a/packages/@aws-cdk/aws-codedeploy/test/server/test.deployment-group.ts +++ b/packages/@aws-cdk/aws-codedeploy/test/server/test.deployment-group.ts @@ -1,4 +1,4 @@ -import { expect, haveResource } from '@aws-cdk/assert'; +import { expect, haveResource, SynthUtils } from '@aws-cdk/assert'; import autoscaling = require('@aws-cdk/aws-autoscaling'); import cloudwatch = require('@aws-cdk/aws-cloudwatch'); import ec2 = require('@aws-cdk/aws-ec2'); @@ -354,10 +354,7 @@ export = { }, }); - test.throws(() => { - stack._toCloudFormation(); - }, /deploymentInAlarm/); - + test.throws(() => SynthUtils.toCloudFormation(stack), /deploymentInAlarm/); test.done(); }, }, diff --git a/packages/@aws-cdk/aws-codepipeline-api/lib/action.ts b/packages/@aws-cdk/aws-codepipeline-api/lib/action.ts index d98bbc52dd2c6..661cdbfd073a3 100644 --- a/packages/@aws-cdk/aws-codepipeline-api/lib/action.ts +++ b/packages/@aws-cdk/aws-codepipeline-api/lib/action.ts @@ -99,7 +99,7 @@ export interface CommonActionProps { * The physical, human-readable name of the Action. * Not that Action names must be unique within a single Stage. */ - actionName: string; + readonly actionName: string; /** * The runOrder property for this Action. @@ -108,22 +108,22 @@ export interface CommonActionProps { * @default 1 * @see https://docs.aws.amazon.com/codepipeline/latest/userguide/reference-pipeline-structure.html */ - runOrder?: number; + readonly runOrder?: number; } /** * Construction properties of the low-level {@link Action Action class}. */ export interface ActionProps extends CommonActionProps { - category: ActionCategory; - provider: string; + readonly category: ActionCategory; + readonly provider: string; /** * The region this Action resides in. * * @default the Action resides in the same region as the Pipeline */ - region?: string; + readonly region?: string; /** * The service role that is assumed during execution of action. @@ -132,12 +132,12 @@ export interface ActionProps extends CommonActionProps { * * @see https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-codepipeline-pipeline-stages-actions.html */ - role?: iam.IRole; + readonly role?: iam.IRole; - artifactBounds: ActionArtifactBounds; - configuration?: any; - version?: string; - owner?: string; + readonly artifactBounds: ActionArtifactBounds; + readonly configuration?: any; + readonly version?: string; + readonly owner?: string; } /** @@ -235,10 +235,16 @@ export abstract class Action { return rule; } + /** + * @internal + */ public get _inputArtifacts(): Artifact[] { return this._actionInputArtifacts.slice(); } + /** + * @internal + */ public get _outputArtifacts(): Artifact[] { return this._actionOutputArtifacts.slice(); } diff --git a/packages/@aws-cdk/aws-codepipeline-api/lib/build-action.ts b/packages/@aws-cdk/aws-codepipeline-api/lib/build-action.ts index 1fea727ef1b3c..375d91673535f 100644 --- a/packages/@aws-cdk/aws-codepipeline-api/lib/build-action.ts +++ b/packages/@aws-cdk/aws-codepipeline-api/lib/build-action.ts @@ -8,36 +8,36 @@ export interface BuildActionProps extends CommonActionProps { /** * The source to use as input for this build. */ - inputArtifact: Artifact; + readonly inputArtifact: Artifact; /** * The service provider that the action calls. For example, a valid provider for Source actions is CodeBuild. */ - provider: string; + readonly provider: string; /** * The upper and lower bounds on the number of input and output artifacts for this Action. */ - artifactBounds: ActionArtifactBounds; + readonly artifactBounds: ActionArtifactBounds; /** * The build Action owner (could be 'AWS', 'ThirdParty' or 'Custom'). * * @default 'AWS' */ - owner?: string; + readonly owner?: string; /** * The build Action version. * * @default '1' */ - version?: string; + readonly version?: string; /** * The name of the build's output artifact. */ - outputArtifactName: string; + readonly outputArtifactName: string; /** * The action's configuration. These are key-value pairs that specify input values for an action. @@ -45,7 +45,7 @@ export interface BuildActionProps extends CommonActionProps { * * http://docs.aws.amazon.com/codepipeline/latest/userguide/reference-pipeline-structure.html#action-requirements */ - configuration?: any; + readonly configuration?: any; } /** diff --git a/packages/@aws-cdk/aws-codepipeline-api/lib/deploy-action.ts b/packages/@aws-cdk/aws-codepipeline-api/lib/deploy-action.ts index 4a4d0155453a4..a199d66a38a98 100644 --- a/packages/@aws-cdk/aws-codepipeline-api/lib/deploy-action.ts +++ b/packages/@aws-cdk/aws-codepipeline-api/lib/deploy-action.ts @@ -2,15 +2,15 @@ import { Action, ActionArtifactBounds, ActionCategory, CommonActionProps } from import { Artifact } from './artifact'; export interface DeployActionProps extends CommonActionProps { - provider: string; + readonly provider: string; - owner?: string; + readonly owner?: string; - artifactBounds: ActionArtifactBounds; + readonly artifactBounds: ActionArtifactBounds; - inputArtifact: Artifact; + readonly inputArtifact: Artifact; - configuration?: any; + readonly configuration?: any; } export abstract class DeployAction extends Action { diff --git a/packages/@aws-cdk/aws-codepipeline-api/lib/source-action.ts b/packages/@aws-cdk/aws-codepipeline-api/lib/source-action.ts index 100cde6cf333f..9edc9b1af981b 100644 --- a/packages/@aws-cdk/aws-codepipeline-api/lib/source-action.ts +++ b/packages/@aws-cdk/aws-codepipeline-api/lib/source-action.ts @@ -10,26 +10,26 @@ export interface SourceActionProps extends CommonActionProps { * * @default "AWS" */ - owner?: string; + readonly owner?: string; /** * The source Action version. * * @default "1" */ - version?: string; + readonly version?: string; /** * The name of the source's output artifact. * CfnOutput artifacts are used by CodePipeline as inputs into other actions. */ - outputArtifactName: string; + readonly outputArtifactName: string; /** * The service provider that the action calls. * For example, a valid provider for Source actions is "S3". */ - provider: string; + readonly provider: string; /** * The action's configuration. These are key-value pairs that specify input values for an action. @@ -37,7 +37,7 @@ export interface SourceActionProps extends CommonActionProps { * * http://docs.aws.amazon.com/codepipeline/latest/userguide/reference-pipeline-structure.html#action-requirements */ - configuration?: any; + readonly configuration?: any; } /** diff --git a/packages/@aws-cdk/aws-codepipeline-api/lib/test-action.ts b/packages/@aws-cdk/aws-codepipeline-api/lib/test-action.ts index 944580ed6785a..061c8ae623a3d 100644 --- a/packages/@aws-cdk/aws-codepipeline-api/lib/test-action.ts +++ b/packages/@aws-cdk/aws-codepipeline-api/lib/test-action.ts @@ -8,7 +8,7 @@ export interface TestActionProps extends CommonActionProps { /** * The source to use as input for this test. */ - inputArtifact: Artifact; + readonly inputArtifact: Artifact; /** * The optional name of the output artifact. @@ -18,33 +18,33 @@ export interface TestActionProps extends CommonActionProps { * * @default the Action will not have an output artifact */ - outputArtifactName?: string; + readonly outputArtifactName?: string; /** * The service provider that the action calls. * * @example 'CodeBuild' */ - provider: string; + readonly provider: string; /** * The upper and lower bounds on the number of input and output artifacts for this Action. */ - artifactBounds: ActionArtifactBounds; + readonly artifactBounds: ActionArtifactBounds; /** * The test Action owner (could be 'AWS', 'ThirdParty' or 'Custom'). * * @default 'AWS' */ - owner?: string; + readonly owner?: string; /** * The test Action version. * * @default '1' */ - version?: string; + readonly version?: string; /** * The action's configuration. These are key-value pairs that specify input values for an action. @@ -52,7 +52,7 @@ export interface TestActionProps extends CommonActionProps { * * http://docs.aws.amazon.com/codepipeline/latest/userguide/reference-pipeline-structure.html#action-requirements */ - configuration?: any; + readonly configuration?: any; } /** diff --git a/packages/@aws-cdk/aws-codepipeline/lib/cross-region-scaffold-stack.ts b/packages/@aws-cdk/aws-codepipeline/lib/cross-region-scaffold-stack.ts index 43d37c1f388a6..7b7ffdf084d81 100644 --- a/packages/@aws-cdk/aws-codepipeline/lib/cross-region-scaffold-stack.ts +++ b/packages/@aws-cdk/aws-codepipeline/lib/cross-region-scaffold-stack.ts @@ -9,14 +9,14 @@ export interface CrossRegionScaffoldStackProps { /** * The AWS region this Stack resides in. */ - region: string; + readonly region: string; /** * The AWS account ID this Stack belongs to. * * @example '012345678901' */ - account: string; + readonly account: string; } /** diff --git a/packages/@aws-cdk/aws-codepipeline/lib/github-source-action.ts b/packages/@aws-cdk/aws-codepipeline/lib/github-source-action.ts index 30ca355929aeb..71cc2681fe91a 100644 --- a/packages/@aws-cdk/aws-codepipeline/lib/github-source-action.ts +++ b/packages/@aws-cdk/aws-codepipeline/lib/github-source-action.ts @@ -10,24 +10,24 @@ export interface GitHubSourceActionProps extends actions.CommonActionProps { * The name of the source's output artifact. CfnOutput artifacts are used by CodePipeline as * inputs into other actions. */ - outputArtifactName: string; + readonly outputArtifactName: string; /** * The GitHub account/user that owns the repo. */ - owner: string; + readonly owner: string; /** * The name of the repo, without the username. */ - repo: string; + readonly repo: string; /** * The branch to use. * * @default "master" */ - branch?: string; + readonly branch?: string; /** * A GitHub OAuth token to use for authentication. @@ -38,7 +38,7 @@ export interface GitHubSourceActionProps extends actions.CommonActionProps { * const oauth = new cdk.SecretParameter(this, 'GitHubOAuthToken', { ssmParameter: 'my-github-token' }); * new GitHubSource(this, 'GitHubAction', { oauthToken: oauth.value, ... }); */ - oauthToken: cdk.Secret; + readonly oauthToken: cdk.Secret; /** * Whether AWS CodePipeline should poll for source changes. @@ -46,7 +46,7 @@ export interface GitHubSourceActionProps extends actions.CommonActionProps { * * @default false */ - pollForSourceChanges?: boolean; + readonly pollForSourceChanges?: boolean; } /** diff --git a/packages/@aws-cdk/aws-codepipeline/lib/jenkins-actions.ts b/packages/@aws-cdk/aws-codepipeline/lib/jenkins-actions.ts index 0956e8fe147cf..cc81c44a18e84 100644 --- a/packages/@aws-cdk/aws-codepipeline/lib/jenkins-actions.ts +++ b/packages/@aws-cdk/aws-codepipeline/lib/jenkins-actions.ts @@ -12,12 +12,12 @@ export interface BasicJenkinsActionProps extends cpapi.CommonActionProps { * * @example 'MyJob' */ - projectName: string; + readonly projectName: string; /** * The source to use as input for this build. */ - inputArtifact: cpapi.Artifact; + readonly inputArtifact: cpapi.Artifact; } /** @@ -31,7 +31,7 @@ export interface BasicJenkinsBuildActionProps extends BasicJenkinsActionProps { * * @default an auto-generated name will be used */ - outputArtifactName?: string; + readonly outputArtifactName?: string; } /** @@ -41,7 +41,7 @@ export interface JenkinsBuildActionProps extends BasicJenkinsBuildActionProps { /** * The Jenkins Provider for this Action. */ - jenkinsProvider: IJenkinsProvider; + readonly jenkinsProvider: IJenkinsProvider; } /** @@ -87,7 +87,7 @@ export interface BasicJenkinsTestActionProps extends BasicJenkinsActionProps { * * @default the Action will not have an output artifact */ - outputArtifactName?: string; + readonly outputArtifactName?: string; } /** @@ -97,7 +97,7 @@ export interface JenkinsTestActionProps extends BasicJenkinsTestActionProps { /** * The Jenkins Provider for this Action. */ - jenkinsProvider: IJenkinsProvider; + readonly jenkinsProvider: IJenkinsProvider; } /** diff --git a/packages/@aws-cdk/aws-codepipeline/lib/jenkins-provider.ts b/packages/@aws-cdk/aws-codepipeline/lib/jenkins-provider.ts index bd2ce57736f7d..942338f1e6723 100644 --- a/packages/@aws-cdk/aws-codepipeline/lib/jenkins-provider.ts +++ b/packages/@aws-cdk/aws-codepipeline/lib/jenkins-provider.ts @@ -45,6 +45,8 @@ export interface IJenkinsProvider extends cdk.IConstruct { * This method will be automatically called when creating * a {@link JenkinsBuildAction}, * so you should never need to call it explicitly. + * + * @internal */ _registerBuildProvider(): void; @@ -53,6 +55,8 @@ export interface IJenkinsProvider extends cdk.IConstruct { * This method will be automatically called when creating * a {@link JenkinsTestAction}, * so you should never need to call it explicitly. + * + * @internal */ _registerTestProvider(): void; } @@ -66,21 +70,21 @@ export interface JenkinsProviderImportProps { * * @example 'MyJenkinsProvider' */ - providerName: string; + readonly providerName: string; /** * The base URL of your Jenkins server. * * @example 'http://myjenkins.com:8080' */ - serverUrl: string; + readonly serverUrl: string; /** * The version of your provider. * * @default '1' */ - version?: string; + readonly version?: string; } export interface JenkinsProviderProps { @@ -89,33 +93,33 @@ export interface JenkinsProviderProps { * * @example 'MyJenkinsProvider' */ - providerName: string; + readonly providerName: string; /** * The base URL of your Jenkins server. * * @example 'http://myjenkins.com:8080' */ - serverUrl: string; + readonly serverUrl: string; /** * The version of your provider. * * @default '1' */ - version?: string; + readonly version?: string; /** * Whether to immediately register a Jenkins Provider for the build category. * The Provider will always be registered if you create a {@link JenkinsBuildAction}. */ - forBuild?: boolean; + readonly forBuild?: boolean; /** * Whether to immediately register a Jenkins Provider for the test category. * The Provider will always be registered if you create a {@link JenkinsTestAction}. */ - forTest?: boolean; + readonly forTest?: boolean; } export abstract class BaseJenkinsProvider extends cdk.Construct implements IJenkinsProvider { @@ -157,7 +161,14 @@ export abstract class BaseJenkinsProvider extends cdk.Construct implements IJenk }); } + /** + * @internal + */ public abstract _registerBuildProvider(): void; + + /** + * @internal + */ public abstract _registerTestProvider(): void; } @@ -199,6 +210,9 @@ export class JenkinsProvider extends BaseJenkinsProvider { } } + /** + * @internal + */ public _registerBuildProvider(): void { if (this.buildIncluded) { return; @@ -207,6 +221,9 @@ export class JenkinsProvider extends BaseJenkinsProvider { this.registerJenkinsCustomAction('JenkinsBuildProviderResource', cpapi.ActionCategory.Build); } + /** + * @internal + */ public _registerTestProvider(): void { if (this.testIncluded) { return; diff --git a/packages/@aws-cdk/aws-codepipeline/lib/manual-approval-action.ts b/packages/@aws-cdk/aws-codepipeline/lib/manual-approval-action.ts index a15a591acac13..138dbd5bbfe8d 100644 --- a/packages/@aws-cdk/aws-codepipeline/lib/manual-approval-action.ts +++ b/packages/@aws-cdk/aws-codepipeline/lib/manual-approval-action.ts @@ -9,19 +9,19 @@ export interface ManualApprovalActionProps extends actions.CommonActionProps { /** * Optional SNS topic to send notifications to when an approval is pending. */ - notificationTopic?: sns.ITopic; + readonly notificationTopic?: sns.ITopic; /** * A list of email addresses to subscribe to notifications when this Action is pending approval. * If this has been provided, but not `notificationTopic`, * a new Topic will be created. */ - notifyEmails?: string[]; + readonly notifyEmails?: string[]; /** * Any additional information that you want to include in the notification email message. */ - additionalInformation?: string; + readonly additionalInformation?: string; } /** diff --git a/packages/@aws-cdk/aws-codepipeline/lib/pipeline.ts b/packages/@aws-cdk/aws-codepipeline/lib/pipeline.ts index add15cb903ab4..ee25052a68e7a 100644 --- a/packages/@aws-cdk/aws-codepipeline/lib/pipeline.ts +++ b/packages/@aws-cdk/aws-codepipeline/lib/pipeline.ts @@ -47,17 +47,17 @@ export interface StageProps { /** * The physical, human-readable name to assign to this Pipeline Stage. */ - name: string; + readonly name: string; /** * The list of Actions to create this Stage with. * You can always add more Actions later by calling {@link IStage#addAction}. */ - actions?: cpapi.Action[]; + readonly actions?: cpapi.Action[]; } export interface StageAddToPipelineProps extends StageProps { - placement?: StagePlacement; + readonly placement?: StagePlacement; } export interface PipelineProps { @@ -65,18 +65,18 @@ export interface PipelineProps { * The S3 bucket used by this Pipeline to store artifacts. * If not specified, a new S3 bucket will be created. */ - artifactBucket?: s3.IBucket; + readonly artifactBucket?: s3.IBucket; /** * Indicates whether to rerun the AWS CodePipeline pipeline after you update it. */ - restartExecutionOnUpdate?: boolean; + readonly restartExecutionOnUpdate?: boolean; /** * Name of the pipeline. If you don't specify a name, AWS CloudFormation generates an ID * and uses that for the pipeline name. */ - pipelineName?: string; + readonly pipelineName?: string; /** * A map of region to S3 bucket name used for cross-region CodePipeline. @@ -86,14 +86,14 @@ export interface PipelineProps { * Note that you will have to `cdk deploy` that Stack before you can deploy your Pipeline-containing Stack. * You can query the generated Stacks using the {@link Pipeline#crossRegionScaffoldStacks} property. */ - crossRegionReplicationBuckets?: { [region: string]: string }; + readonly crossRegionReplicationBuckets?: { [region: string]: string }; /** * The list of Stages, in order, * to create this Pipeline with. * You can always add more Stages later by calling {@link Pipeline#addStage}. */ - stages?: StageProps[]; + readonly stages?: StageProps[]; } /** diff --git a/packages/@aws-cdk/aws-codepipeline/lib/stage.ts b/packages/@aws-cdk/aws-codepipeline/lib/stage.ts index 25070078db5d0..3d87749a899ac 100644 --- a/packages/@aws-cdk/aws-codepipeline/lib/stage.ts +++ b/packages/@aws-cdk/aws-codepipeline/lib/stage.ts @@ -90,7 +90,8 @@ export class Stage implements cpapi.IStage { private renderAction(action: cpapi.Action): CfnPipeline.ActionDeclarationProperty { return { name: action.actionName, - inputArtifacts: action._inputArtifacts.map(a => ({ name: a.artifactName })), + // TODO: remove "as any" + inputArtifacts: (action as any)._inputArtifacts.map((a: any) => ({ name: a.artifactName })), actionTypeId: { category: action.category.toString(), version: action.version, @@ -98,7 +99,8 @@ export class Stage implements cpapi.IStage { provider: action.provider, }, configuration: action.configuration, - outputArtifacts: action._outputArtifacts.map(a => ({ name: a.artifactName })), + // TODO: remove "as any" + outputArtifacts: (action as any)._outputArtifacts.map((a: any) => ({ name: a.artifactName })), runOrder: action.runOrder, roleArn: action.role ? action.role.roleArn : undefined }; diff --git a/packages/@aws-cdk/aws-codepipeline/test/test.action.ts b/packages/@aws-cdk/aws-codepipeline/test/test.action.ts index b12452eea55c3..6d5b5614e0968 100644 --- a/packages/@aws-cdk/aws-codepipeline/test/test.action.ts +++ b/packages/@aws-cdk/aws-codepipeline/test/test.action.ts @@ -162,8 +162,8 @@ export = { additionalInputArtifacts: [artifact], }); - test.equal(action._inputArtifacts.length, 1); - + // TODO: remove "as any" + test.equal((action as any)._inputArtifacts.length, 1); test.done(); }, @@ -202,8 +202,8 @@ export = { ], }); - test.equal(action._outputArtifacts.length, 1); - + // TODO: remove "as any" + test.equal((action as any)._outputArtifacts.length, 1); test.done(); }, }, diff --git a/packages/@aws-cdk/aws-codepipeline/test/test.pipeline.ts b/packages/@aws-cdk/aws-codepipeline/test/test.pipeline.ts index e2a69af8e5f06..f91fa3bdffbb4 100644 --- a/packages/@aws-cdk/aws-codepipeline/test/test.pipeline.ts +++ b/packages/@aws-cdk/aws-codepipeline/test/test.pipeline.ts @@ -1,4 +1,4 @@ -import { expect, haveResource, haveResourceLike } from '@aws-cdk/assert'; +import { expect, haveResource, haveResourceLike, SynthUtils } from '@aws-cdk/assert'; import cloudformation = require('@aws-cdk/aws-cloudformation'); import codebuild = require('@aws-cdk/aws-codebuild'); import codecommit = require('@aws-cdk/aws-codecommit'); @@ -45,7 +45,7 @@ export = { ], }); - test.notDeepEqual(stack._toCloudFormation(), {}); + test.notDeepEqual(SynthUtils.toCloudFormation(stack), {}); test.deepEqual([], pipeline.node.validateTree()); test.done(); }, diff --git a/packages/@aws-cdk/aws-cognito/lib/user-pool-client.ts b/packages/@aws-cdk/aws-cognito/lib/user-pool-client.ts index b01375ef17405..5b911ae6a2d25 100644 --- a/packages/@aws-cdk/aws-cognito/lib/user-pool-client.ts +++ b/packages/@aws-cdk/aws-cognito/lib/user-pool-client.ts @@ -27,24 +27,24 @@ export interface UserPoolClientProps { * Name of the application client * @default cloudformation generated name */ - clientName?: string; + readonly clientName?: string; /** * The UserPool resource this client will have access to */ - userPool: IUserPool; + readonly userPool: IUserPool; /** * Whether to generate a client secret * @default false */ - generateSecret?: boolean; + readonly generateSecret?: boolean; /** * List of enabled authentication flows * @default no enabled flows */ - enabledAuthFlows?: AuthFlow[] + readonly enabledAuthFlows?: AuthFlow[] } /** diff --git a/packages/@aws-cdk/aws-cognito/lib/user-pool.ts b/packages/@aws-cdk/aws-cognito/lib/user-pool.ts index fff3b0945374c..f64190ef44f8a 100644 --- a/packages/@aws-cdk/aws-cognito/lib/user-pool.ts +++ b/packages/@aws-cdk/aws-cognito/lib/user-pool.ts @@ -150,49 +150,49 @@ export interface UserPoolTriggers { * Creates an authentication challenge. * @see https://docs.aws.amazon.com/cognito/latest/developerguide/user-pool-lambda-create-auth-challenge.html */ - createAuthChallenge?: lambda.IFunction; + readonly createAuthChallenge?: lambda.IFunction; /** * A custom Message AWS Lambda trigger. * @see https://docs.aws.amazon.com/cognito/latest/developerguide/user-pool-lambda-custom-message.html */ - customMessage?: lambda.IFunction; + readonly customMessage?: lambda.IFunction; /** * Defines the authentication challenge. * @see https://docs.aws.amazon.com/cognito/latest/developerguide/user-pool-lambda-define-auth-challenge.html */ - defineAuthChallenge?: lambda.IFunction; + readonly defineAuthChallenge?: lambda.IFunction; /** * A post-authentication AWS Lambda trigger. * @see https://docs.aws.amazon.com/cognito/latest/developerguide/user-pool-lambda-post-authentication.html */ - postAuthentication?: lambda.IFunction; + readonly postAuthentication?: lambda.IFunction; /** * A post-confirmation AWS Lambda trigger. * @see https://docs.aws.amazon.com/cognito/latest/developerguide/user-pool-lambda-post-confirmation.html */ - postConfirmation?: lambda.IFunction; + readonly postConfirmation?: lambda.IFunction; /** * A pre-authentication AWS Lambda trigger. * @see https://docs.aws.amazon.com/cognito/latest/developerguide/user-pool-lambda-pre-authentication.html */ - preAuthentication?: lambda.IFunction; + readonly preAuthentication?: lambda.IFunction; /** * A pre-registration AWS Lambda trigger. * @see https://docs.aws.amazon.com/cognito/latest/developerguide/user-pool-lambda-pre-sign-up.html */ - preSignUp?: lambda.IFunction; + readonly preSignUp?: lambda.IFunction; /** * Verifies the authentication challenge response. * @see https://docs.aws.amazon.com/cognito/latest/developerguide/user-pool-lambda-verify-auth-challenge-response.html */ - verifyAuthChallengeResponse?: lambda.IFunction; + readonly verifyAuthChallengeResponse?: lambda.IFunction; /** * Index signature @@ -205,55 +205,55 @@ export interface UserPoolProps { * Name of the user pool * @default unique ID */ - poolName?: string; + readonly poolName?: string; /** * Method used for user registration & sign in. * Allows either username with aliases OR sign in with email, phone, or both. * @default SignInType.USERNAME */ - signInType?: SignInType; + readonly signInType?: SignInType; /** * Attributes to allow as username alias. * Only valid if signInType is USERNAME * @default no alias */ - usernameAliasAttributes?: UserPoolAttribute[]; + readonly usernameAliasAttributes?: UserPoolAttribute[]; /** * Attributes which Cognito will automatically send a verification message to. * Must be either EMAIL, PHONE, or both. * @default no auto verification */ - autoVerifiedAttributes?: UserPoolAttribute[]; + readonly autoVerifiedAttributes?: UserPoolAttribute[]; /** * Lambda functions to use for supported Cognito triggers. */ - lambdaTriggers?: UserPoolTriggers; + readonly lambdaTriggers?: UserPoolTriggers; } export interface UserPoolImportProps { /** * The ID of an existing user pool */ - userPoolId: string; + readonly userPoolId: string; /** * The ARN of the imported user pool */ - userPoolArn: string; + readonly userPoolArn: string; /** * The provider name of the imported user pool */ - userPoolProviderName: string; + readonly userPoolProviderName: string; /** * The URL of the imported user pool */ - userPoolProviderUrl: string; + readonly userPoolProviderUrl: string; } export interface IUserPool extends cdk.IConstruct { @@ -395,7 +395,7 @@ export class UserPool extends cdk.Construct implements IUserPool { */ public onCreateAuthChallenge(fn: lambda.IFunction): void { this.addLambdaPermission(fn, 'CreateAuthChallenge'); - this.triggers.createAuthChallenge = fn.functionArn; + this.triggers = { ...this.triggers, createAuthChallenge: fn.functionArn }; } /** @@ -406,7 +406,7 @@ export class UserPool extends cdk.Construct implements IUserPool { */ public onCustomMessage(fn: lambda.IFunction): void { this.addLambdaPermission(fn, 'CustomMessage'); - this.triggers.customMessage = fn.functionArn; + this.triggers = { ...this.triggers, customMessage: fn.functionArn }; } /** @@ -417,7 +417,7 @@ export class UserPool extends cdk.Construct implements IUserPool { */ public onDefineAuthChallenge(fn: lambda.IFunction): void { this.addLambdaPermission(fn, 'DefineAuthChallenge'); - this.triggers.defineAuthChallenge = fn.functionArn; + this.triggers = { ...this.triggers, defineAuthChallenge: fn.functionArn }; } /** @@ -428,7 +428,7 @@ export class UserPool extends cdk.Construct implements IUserPool { */ public onPostAuthentication(fn: lambda.IFunction): void { this.addLambdaPermission(fn, 'PostAuthentication'); - this.triggers.postAuthentication = fn.functionArn; + this.triggers = { ...this.triggers, postAuthentication: fn.functionArn }; } /** @@ -439,7 +439,7 @@ export class UserPool extends cdk.Construct implements IUserPool { */ public onPostConfirmation(fn: lambda.IFunction): void { this.addLambdaPermission(fn, 'PostConfirmation'); - this.triggers.postConfirmation = fn.functionArn; + this.triggers = { ...this.triggers, postConfirmation: fn.functionArn }; } /** @@ -450,7 +450,7 @@ export class UserPool extends cdk.Construct implements IUserPool { */ public onPreAuthentication(fn: lambda.IFunction): void { this.addLambdaPermission(fn, 'PreAuthentication'); - this.triggers.preAuthentication = fn.functionArn; + this.triggers = { ...this.triggers, preAuthentication: fn.functionArn }; } /** @@ -461,7 +461,7 @@ export class UserPool extends cdk.Construct implements IUserPool { */ public onPreSignUp(fn: lambda.IFunction): void { this.addLambdaPermission(fn, 'PreSignUp'); - this.triggers.preSignUp = fn.functionArn; + this.triggers = { ...this.triggers, preSignUp: fn.functionArn }; } /** @@ -472,7 +472,7 @@ export class UserPool extends cdk.Construct implements IUserPool { */ public onVerifyAuthChallengeResponse(fn: lambda.IFunction): void { this.addLambdaPermission(fn, 'VerifyAuthChallengeResponse'); - this.triggers.verifyAuthChallengeResponse = fn.functionArn; + this.triggers = { ...this.triggers, verifyAuthChallengeResponse: fn.functionArn }; } public export(): UserPoolImportProps { diff --git a/packages/@aws-cdk/aws-dynamodb/lib/scalable-attribute-api.ts b/packages/@aws-cdk/aws-dynamodb/lib/scalable-attribute-api.ts index ef96b3c417580..c1fc9923edc47 100644 --- a/packages/@aws-cdk/aws-dynamodb/lib/scalable-attribute-api.ts +++ b/packages/@aws-cdk/aws-dynamodb/lib/scalable-attribute-api.ts @@ -22,12 +22,12 @@ export interface EnableScalingProps { /** * Minimum capacity to scale to */ - minCapacity: number; + readonly minCapacity: number; /** * Maximum capacity to scale to */ - maxCapacity: number; + readonly maxCapacity: number; } /** @@ -37,5 +37,5 @@ export interface UtilizationScalingProps extends appscaling.BaseTargetTrackingPr /** * Target utilization percentage for the attribute */ - targetUtilizationPercent: number; + readonly targetUtilizationPercent: number; } diff --git a/packages/@aws-cdk/aws-dynamodb/lib/table.ts b/packages/@aws-cdk/aws-dynamodb/lib/table.ts index 2d6b54030099a..097a0c48d5a14 100644 --- a/packages/@aws-cdk/aws-dynamodb/lib/table.ts +++ b/packages/@aws-cdk/aws-dynamodb/lib/table.ts @@ -35,26 +35,26 @@ export interface Attribute { /** * The name of an attribute. */ - name: string; + readonly name: string; /** * The data type of an attribute. */ - type: AttributeType; + readonly type: AttributeType; } export interface TableProps { /** * Partition key attribute definition. */ - partitionKey: Attribute; + readonly partitionKey: Attribute; /** * Table sort key attribute definition. * * @default no sort key */ - sortKey?: Attribute; + readonly sortKey?: Attribute; /** * The read capacity for the table. Careful if you add Global Secondary Indexes, as @@ -64,7 +64,7 @@ export interface TableProps { * * @default 5 */ - readCapacity?: number; + readonly readCapacity?: number; /** * The write capacity for the table. Careful if you add Global Secondary Indexes, as * those will share the table's provisioned throughput. @@ -73,76 +73,76 @@ export interface TableProps { * * @default 5 */ - writeCapacity?: number; + readonly writeCapacity?: number; /** * Specify how you are charged for read and write throughput and how you manage capacity. * @default Provisioned */ - billingMode?: BillingMode; + readonly billingMode?: BillingMode; /** * Enforces a particular physical table name. * @default */ - tableName?: string; + readonly tableName?: string; /** * Whether point-in-time recovery is enabled. * @default undefined, point-in-time recovery is disabled */ - pitrEnabled?: boolean; + readonly pitrEnabled?: boolean; /** * Whether server-side encryption with an AWS managed customer master key is enabled. * @default undefined, server-side encryption is enabled with an AWS owned customer master key */ - sseEnabled?: boolean; + readonly sseEnabled?: boolean; /** * When an item in the table is modified, StreamViewType determines what information * is written to the stream for this table. Valid values for StreamViewType are: * @default undefined, streams are disabled */ - streamSpecification?: StreamViewType; + readonly streamSpecification?: StreamViewType; /** * The name of TTL attribute. * @default undefined, TTL is disabled */ - ttlAttributeName?: string; + readonly ttlAttributeName?: string; } export interface SecondaryIndexProps { /** * The name of the secondary index. */ - indexName: string; + readonly indexName: string; /** * The set of attributes that are projected into the secondary index. * @default ALL */ - projectionType?: ProjectionType; + readonly projectionType?: ProjectionType; /** * The non-key attributes that are projected into the secondary index. * @default undefined */ - nonKeyAttributes?: string[]; + readonly nonKeyAttributes?: string[]; } export interface GlobalSecondaryIndexProps extends SecondaryIndexProps { /** * The attribute of a partition key for the global secondary index. */ - partitionKey: Attribute; + readonly partitionKey: Attribute; /** * The attribute of a sort key for the global secondary index. * @default undefined */ - sortKey?: Attribute; + readonly sortKey?: Attribute; /** * The read capacity for the global secondary index. @@ -151,7 +151,7 @@ export interface GlobalSecondaryIndexProps extends SecondaryIndexProps { * * @default 5 */ - readCapacity?: number; + readonly readCapacity?: number; /** * The write capacity for the global secondary index. @@ -160,14 +160,14 @@ export interface GlobalSecondaryIndexProps extends SecondaryIndexProps { * * @default 5 */ - writeCapacity?: number; + readonly writeCapacity?: number; } export interface LocalSecondaryIndexProps extends SecondaryIndexProps { /** * The attribute of a sort key for the local secondary index. */ - sortKey: Attribute; + readonly sortKey: Attribute; } /** diff --git a/packages/@aws-cdk/aws-ec2/lib/connections.ts b/packages/@aws-cdk/aws-ec2/lib/connections.ts index 08bec6b065159..72854790af010 100644 --- a/packages/@aws-cdk/aws-ec2/lib/connections.ts +++ b/packages/@aws-cdk/aws-ec2/lib/connections.ts @@ -33,21 +33,21 @@ export interface ConnectionsProps { * * @default Derived from securityGroup if set. */ - securityGroupRule?: ISecurityGroupRule; + readonly securityGroupRule?: ISecurityGroupRule; /** * What securityGroup(s) this object is managing connections for * * @default No security groups */ - securityGroups?: ISecurityGroup[]; + readonly securityGroups?: ISecurityGroup[]; /** * Default port range for initiating connections to and from this object * * @default No default port range */ - defaultPortRange?: IPortRange; + readonly defaultPortRange?: IPortRange; } /** diff --git a/packages/@aws-cdk/aws-ec2/lib/machine-image.ts b/packages/@aws-cdk/aws-ec2/lib/machine-image.ts index 9f318f791428e..ab916b06d4915 100644 --- a/packages/@aws-cdk/aws-ec2/lib/machine-image.ts +++ b/packages/@aws-cdk/aws-ec2/lib/machine-image.ts @@ -50,28 +50,28 @@ export interface AmazonLinuxImageProps { * * @default AmazonLinux */ - generation?: AmazonLinuxGeneration; + readonly generation?: AmazonLinuxGeneration; /** * What edition of Amazon Linux to use * * @default Standard */ - edition?: AmazonLinuxEdition; + readonly edition?: AmazonLinuxEdition; /** * Virtualization type * * @default HVM */ - virtualization?: AmazonLinuxVirt; + readonly virtualization?: AmazonLinuxVirt; /** * What storage backed image to use * * @default GeneralPurpose */ - storage?: AmazonLinuxStorage; + readonly storage?: AmazonLinuxStorage; } /** diff --git a/packages/@aws-cdk/aws-ec2/lib/security-group.ts b/packages/@aws-cdk/aws-ec2/lib/security-group.ts index e15ba76415d3d..7c14cd11ee630 100644 --- a/packages/@aws-cdk/aws-ec2/lib/security-group.ts +++ b/packages/@aws-cdk/aws-ec2/lib/security-group.ts @@ -44,7 +44,7 @@ export interface SecurityGroupImportProps { /** * ID of security group */ - securityGroupId: string; + readonly securityGroupId: string; } /** @@ -207,19 +207,19 @@ export interface SecurityGroupProps { * @default If you don't specify a GroupName, AWS CloudFormation generates a * unique physical ID and uses that ID for the group name. */ - groupName?: string; + readonly groupName?: string; /** * A description of the security group. * * @default The default name will be the construct's CDK path. */ - description?: string; + readonly description?: string; /** * The VPC in which to create the security group. */ - vpc: IVpcNetwork; + readonly vpc: IVpcNetwork; /** * Whether to allow all outbound traffic by default. @@ -230,7 +230,7 @@ export interface SecurityGroupProps { * * @default true */ - allowAllOutbound?: boolean; + readonly allowAllOutbound?: boolean; } /** @@ -460,7 +460,7 @@ export interface ConnectionRule { * * @default tcp */ - protocol?: string; + readonly protocol?: string; /** * Start of port range for the TCP and UDP protocols, or an ICMP type number. @@ -468,7 +468,7 @@ export interface ConnectionRule { * If you specify icmp for the IpProtocol property, you can specify * -1 as a wildcard (i.e., any ICMP type number). */ - fromPort: number; + readonly fromPort: number; /** * End of port range for the TCP and UDP protocols, or an ICMP code. @@ -478,7 +478,7 @@ export interface ConnectionRule { * * @default If toPort is not specified, it will be the same as fromPort. */ - toPort?: number; + readonly toPort?: number; /** * Description of this connection. It is applied to both the ingress rule @@ -486,7 +486,7 @@ export interface ConnectionRule { * * @default No description */ - description?: string; + readonly description?: string; } /** diff --git a/packages/@aws-cdk/aws-ec2/lib/vpc-network-provider.ts b/packages/@aws-cdk/aws-ec2/lib/vpc-network-provider.ts index 29e8b42977f71..2207287fad670 100644 --- a/packages/@aws-cdk/aws-ec2/lib/vpc-network-provider.ts +++ b/packages/@aws-cdk/aws-ec2/lib/vpc-network-provider.ts @@ -16,7 +16,7 @@ export interface VpcNetworkProviderProps { * * @default Don't filter on vpcId */ - vpcId?: string; + readonly vpcId?: string; /** * The name of the VPC @@ -25,7 +25,7 @@ export interface VpcNetworkProviderProps { * * @default Don't filter on vpcName */ - vpcName?: string; + readonly vpcName?: string; /** * Tags on the VPC @@ -34,14 +34,14 @@ export interface VpcNetworkProviderProps { * * @default Don't filter on tags */ - tags?: {[key: string]: string}; + readonly tags?: {[key: string]: string}; /** * Whether to match the default VPC * * @default Don't care whether we return the default VPC */ - isDefault?: boolean; + readonly isDefault?: boolean; } /** diff --git a/packages/@aws-cdk/aws-ec2/lib/vpc-ref.ts b/packages/@aws-cdk/aws-ec2/lib/vpc-ref.ts index 25b1eb46daeab..cd8c7e6dc515f 100644 --- a/packages/@aws-cdk/aws-ec2/lib/vpc-ref.ts +++ b/packages/@aws-cdk/aws-ec2/lib/vpc-ref.ts @@ -147,7 +147,7 @@ export interface SubnetSelection { * * @default SubnetType.Private */ - subnetType?: SubnetType; + readonly subnetType?: SubnetType; /** * Place the instances in the subnets with the given name @@ -158,7 +158,7 @@ export interface SubnetSelection { * * @default name */ - subnetName?: string; + readonly subnetName?: string; } /** @@ -297,71 +297,71 @@ export interface VpcNetworkImportProps { /** * VPC's identifier */ - vpcId: string; + readonly vpcId: string; /** * List of availability zones for the subnets in this VPC. */ - availabilityZones: string[]; + readonly availabilityZones: string[]; /** * List of public subnet IDs * * Must be undefined or match the availability zones in length and order. */ - publicSubnetIds?: string[]; + readonly publicSubnetIds?: string[]; /** * List of names for the public subnets * * Must be undefined or have a name for every public subnet group. */ - publicSubnetNames?: string[]; + readonly publicSubnetNames?: string[]; /** * List of private subnet IDs * * Must be undefined or match the availability zones in length and order. */ - privateSubnetIds?: string[]; + readonly privateSubnetIds?: string[]; /** * List of names for the private subnets * * Must be undefined or have a name for every private subnet group. */ - privateSubnetNames?: string[]; + readonly privateSubnetNames?: string[]; /** * List of isolated subnet IDs * * Must be undefined or match the availability zones in length and order. */ - isolatedSubnetIds?: string[]; + readonly isolatedSubnetIds?: string[]; /** * List of names for the isolated subnets * * Must be undefined or have a name for every isolated subnet group. */ - isolatedSubnetNames?: string[]; + readonly isolatedSubnetNames?: string[]; /** * VPN gateway's identifier */ - vpnGatewayId?: string; + readonly vpnGatewayId?: string; } export interface VpcSubnetImportProps { /** * The Availability Zone the subnet is located in */ - availabilityZone: string; + readonly availabilityZone: string; /** * The subnetId for this particular subnet */ - subnetId: string; + readonly subnetId: string; } /** diff --git a/packages/@aws-cdk/aws-ec2/lib/vpc.ts b/packages/@aws-cdk/aws-ec2/lib/vpc.ts index 241d9b276d80f..f41c512c39752 100644 --- a/packages/@aws-cdk/aws-ec2/lib/vpc.ts +++ b/packages/@aws-cdk/aws-ec2/lib/vpc.ts @@ -22,14 +22,14 @@ export interface VpcNetworkProps { * The CIDR range to use for the VPC (e.g. '10.0.0.0/16'). Should be a minimum of /28 and maximum size of /16. * The range will be split evenly into two subnets per Availability Zone (one public, one private). */ - cidr?: string; + readonly cidr?: string; /** * Indicates whether the instances launched in the VPC get public DNS hostnames. * If this attribute is true, instances in the VPC get public DNS hostnames, * but only if the enableDnsSupport attribute is also set to true. */ - enableDnsHostnames?: boolean; + readonly enableDnsHostnames?: boolean; /** * Indicates whether the DNS resolution is supported for the VPC. If this attribute @@ -38,7 +38,7 @@ export interface VpcNetworkProps { * provided DNS server at the 169.254.169.253 IP address, or the reserved IP address * at the base of the VPC IPv4 network range plus two will succeed. */ - enableDnsSupport?: boolean; + readonly enableDnsSupport?: boolean; /** * The default tenancy of instances launched into the VPC. @@ -47,7 +47,7 @@ export interface VpcNetworkProps { * to a single AWS customer, unless specifically specified at instance launch time. * Please note, not all instance types are usable with Dedicated tenancy. */ - defaultInstanceTenancy?: DefaultInstanceTenancy; + readonly defaultInstanceTenancy?: DefaultInstanceTenancy; /** * Define the maximum number of AZs to use in this region @@ -61,7 +61,7 @@ export interface VpcNetworkProps { * * @default 3 */ - maxAZs?: number; + readonly maxAZs?: number; /** * The number of NAT Gateways to create. @@ -70,7 +70,7 @@ export interface VpcNetworkProps { * one of the Public subnets will have a gateway and all Private subnets will route to this NAT Gateway. * @default maxAZs */ - natGateways?: number; + readonly natGateways?: number; /** * Configures the subnets which will have NAT Gateways @@ -80,7 +80,7 @@ export interface VpcNetworkProps { * * @default All public subnets */ - natGatewaySubnets?: SubnetSelection; + readonly natGatewaySubnets?: SubnetSelection; /** * Configure the subnets to build for each AZ @@ -115,35 +115,35 @@ export interface VpcNetworkProps { * @default the VPC CIDR will be evenly divided between 1 public and 1 * private subnet per AZ */ - subnetConfiguration?: SubnetConfiguration[]; + readonly subnetConfiguration?: SubnetConfiguration[]; /** * Indicates whether a VPN gateway should be created and attached to this VPC. * * @default true when vpnGatewayAsn or vpnConnections is specified. */ - vpnGateway?: boolean; + readonly vpnGateway?: boolean; /** * The private Autonomous System Number (ASN) for the VPN gateway. * * @default Amazon default ASN */ - vpnGatewayAsn?: number; + readonly vpnGatewayAsn?: number; /** * VPN connections to this VPC. * * @default no connections */ - vpnConnections?: { [id: string]: VpnConnectionOptions } + readonly vpnConnections?: { [id: string]: VpnConnectionOptions } /** * Where to propagate VPN routes. * * @default on the route tables associated with private subnets */ - vpnRoutePropagation?: SubnetType[] + readonly vpnRoutePropagation?: SubnetType[] } /** @@ -170,7 +170,7 @@ export interface SubnetConfiguration { * * Valid values are 16 - 28 */ - cidrMask?: number; + readonly cidrMask?: number; /** * The type of Subnet to configure. @@ -178,7 +178,7 @@ export interface SubnetConfiguration { * The Subnet type will control the ability to route and connect to the * Internet. */ - subnetType: SubnetType; + readonly subnetType: SubnetType; /** * The common Logical Name for the `VpcSubnet` @@ -186,7 +186,7 @@ export interface SubnetConfiguration { * Thi name will be suffixed with an integer correlating to a specific * availability zone. */ - name: string; + readonly name: string; } /** @@ -557,24 +557,24 @@ export interface VpcSubnetProps { /** * The availability zone for the subnet */ - availabilityZone: string; + readonly availabilityZone: string; /** * The VPC which this subnet is part of */ - vpcId: string; + readonly vpcId: string; /** * The CIDR notation for this subnet */ - cidrBlock: string; + readonly cidrBlock: string; /** * Controls if a public IP is associated to an instance at launch * * Defaults to true in Subnet.Public, false in Subnet.Private or Subnet.Isolated. */ - mapPublicIpOnLaunch?: boolean; + readonly mapPublicIpOnLaunch?: boolean; } /** diff --git a/packages/@aws-cdk/aws-ec2/lib/vpn.ts b/packages/@aws-cdk/aws-ec2/lib/vpn.ts index bed2b9cdc5d98..22e31897a7ee7 100644 --- a/packages/@aws-cdk/aws-ec2/lib/vpn.ts +++ b/packages/@aws-cdk/aws-ec2/lib/vpn.ts @@ -34,7 +34,7 @@ export interface VpnTunnelOption { * * @default an Amazon generated pre-shared key */ - preSharedKey?: string; + readonly preSharedKey?: string; /** * The range of inside IP addresses for the tunnel. Any specified CIDR blocks must be @@ -43,28 +43,28 @@ export interface VpnTunnelOption { * * @default an Amazon generated inside IP CIDR */ - tunnelInsideCidr?: string; + readonly tunnelInsideCidr?: string; } export interface VpnConnectionOptions { /** * The ip address of the customer gateway. */ - ip: string; + readonly ip: string; /** * The ASN of the customer gateway. * * @default 65000 */ - asn?: number; + readonly asn?: number; /** * The static routes to be routed from the VPN gateway to the customer gateway. * * @default Dynamic routing (BGP) */ - staticRoutes?: string[]; + readonly staticRoutes?: string[]; /** * The tunnel options for the VPN connection. At most two elements (one per tunnel). @@ -72,14 +72,14 @@ export interface VpnConnectionOptions { * * @default Amazon generated tunnel options */ - tunnelOptions?: VpnTunnelOption[]; + readonly tunnelOptions?: VpnTunnelOption[]; } export interface VpnConnectionProps extends VpnConnectionOptions { /** * The VPC to connect to. */ - vpc: IVpcNetwork; + readonly vpc: IVpcNetwork; } /** diff --git a/packages/@aws-cdk/aws-ecr/lib/lifecycle.ts b/packages/@aws-cdk/aws-ecr/lib/lifecycle.ts index ad8af34decbbd..d86bb540c7e7b 100644 --- a/packages/@aws-cdk/aws-ecr/lib/lifecycle.ts +++ b/packages/@aws-cdk/aws-ecr/lib/lifecycle.ts @@ -16,14 +16,14 @@ export interface LifecycleRule { * * @default Automatically assigned */ - rulePriority?: number; + readonly rulePriority?: number; /** * Describes the purpose of the rule * * @default No description */ - description?: string; + readonly description?: string; /** * Select images based on tags @@ -33,28 +33,28 @@ export interface LifecycleRule { * * @default TagStatus.Tagged if tagPrefixList is given, TagStatus.Any otherwise */ - tagStatus?: TagStatus; + readonly tagStatus?: TagStatus; /** * Select images that have ALL the given prefixes in their tag. * * Only if tagStatus == TagStatus.Tagged */ - tagPrefixList?: string[]; + readonly tagPrefixList?: string[]; /** * The maximum number of images to retain * * Specify exactly one of maxImageCount and maxImageAgeDays. */ - maxImageCount?: number; + readonly maxImageCount?: number; /** * The maximum age of images to retain * * Specify exactly one of maxImageCount and maxImageAgeDays. */ - maxImageAgeDays?: number; + readonly maxImageAgeDays?: number; } /** diff --git a/packages/@aws-cdk/aws-ecr/lib/pipeline-action.ts b/packages/@aws-cdk/aws-ecr/lib/pipeline-action.ts index 8570d006adfd0..3d513c235a795 100644 --- a/packages/@aws-cdk/aws-ecr/lib/pipeline-action.ts +++ b/packages/@aws-cdk/aws-ecr/lib/pipeline-action.ts @@ -14,7 +14,7 @@ export interface CommonPipelineSourceActionProps extends codepipeline.CommonActi * * @default 'latest' */ - imageTag?: string; + readonly imageTag?: string; /** * The name of the source's output artifact. @@ -22,7 +22,7 @@ export interface CommonPipelineSourceActionProps extends codepipeline.CommonActi * * @default a name will be auto-generated */ - outputArtifactName?: string; + readonly outputArtifactName?: string; } /** @@ -32,7 +32,7 @@ export interface PipelineSourceActionProps extends CommonPipelineSourceActionPro /** * The repository that will be watched for changes. */ - repository: IRepository; + readonly repository: IRepository; } /** diff --git a/packages/@aws-cdk/aws-ecr/lib/repository-ref.ts b/packages/@aws-cdk/aws-ecr/lib/repository-ref.ts index 064ca083e180a..e7cd21dd3b74e 100644 --- a/packages/@aws-cdk/aws-ecr/lib/repository-ref.ts +++ b/packages/@aws-cdk/aws-ecr/lib/repository-ref.ts @@ -88,7 +88,7 @@ export interface RepositoryImportProps { * account/region as the current stack, you can set `repositoryName` instead * and the ARN will be formatted with the current region and account. */ - repositoryArn?: string; + readonly repositoryArn?: string; /** * The full name of the repository to import. @@ -100,7 +100,7 @@ export interface RepositoryImportProps { * If the repository is in the same region/account as the stack, it is sufficient * to only specify the repository name. */ - repositoryName?: string; + readonly repositoryName?: string; } /** diff --git a/packages/@aws-cdk/aws-ecr/lib/repository.ts b/packages/@aws-cdk/aws-ecr/lib/repository.ts index 79b9b083caa6b..26ee72be5d54f 100644 --- a/packages/@aws-cdk/aws-ecr/lib/repository.ts +++ b/packages/@aws-cdk/aws-ecr/lib/repository.ts @@ -10,14 +10,14 @@ export interface RepositoryProps { * * @default Automatically generated name. */ - repositoryName?: string; + readonly repositoryName?: string; /** * Life cycle rules to apply to this registry * * @default No life cycle rules */ - lifecycleRules?: LifecycleRule[]; + readonly lifecycleRules?: LifecycleRule[]; /** * The AWS account ID associated with the registry that contains the repository. @@ -25,7 +25,7 @@ export interface RepositoryProps { * @see https://docs.aws.amazon.com/AmazonECR/latest/APIReference/API_PutLifecyclePolicy.html * @default The default registry is assumed. */ - lifecycleRegistryId?: string; + readonly lifecycleRegistryId?: string; /** * Retain the repository on stack deletion @@ -35,7 +35,7 @@ export interface RepositoryProps { * * @default false */ - retain?: boolean; + readonly retain?: boolean; } /** @@ -97,7 +97,7 @@ export class Repository extends RepositoryBase { public addLifecycleRule(rule: LifecycleRule) { // Validate rule here so users get errors at the expected location if (rule.tagStatus === undefined) { - rule.tagStatus = rule.tagPrefixList === undefined ? TagStatus.Any : TagStatus.Tagged; + rule = { ...rule, tagStatus: rule.tagPrefixList === undefined ? TagStatus.Any : TagStatus.Tagged }; } if (rule.tagStatus === TagStatus.Tagged && (rule.tagPrefixList === undefined || rule.tagPrefixList.length === 0)) { diff --git a/packages/@aws-cdk/aws-ecs/lib/base/base-service.ts b/packages/@aws-cdk/aws-ecs/lib/base/base-service.ts index 0ce286a03d0e6..062312d6cfb89 100644 --- a/packages/@aws-cdk/aws-ecs/lib/base/base-service.ts +++ b/packages/@aws-cdk/aws-ecs/lib/base/base-service.ts @@ -17,14 +17,14 @@ export interface BaseServiceProps { * * @default 1 */ - desiredCount?: number; + readonly desiredCount?: number; /** * A name for the service. * * @default CloudFormation-generated name */ - serviceName?: string; + readonly serviceName?: string; /** * The maximum number of tasks, specified as a percentage of the Amazon ECS @@ -33,7 +33,7 @@ export interface BaseServiceProps { * * @default 200 */ - maximumPercent?: number; + readonly maximumPercent?: number; /** * The minimum number of tasks, specified as a percentage of @@ -42,14 +42,14 @@ export interface BaseServiceProps { * * @default 50 */ - minimumHealthyPercent?: number; + readonly minimumHealthyPercent?: number; /** * Time after startup to ignore unhealthy load balancer checks. * * @default ??? FIXME */ - healthCheckGracePeriodSeconds?: number; + readonly healthCheckGracePeriodSeconds?: number; } /** diff --git a/packages/@aws-cdk/aws-ecs/lib/base/scalable-task-count.ts b/packages/@aws-cdk/aws-ecs/lib/base/scalable-task-count.ts index 0f0b511053683..6f3b454941cba 100644 --- a/packages/@aws-cdk/aws-ecs/lib/base/scalable-task-count.ts +++ b/packages/@aws-cdk/aws-ecs/lib/base/scalable-task-count.ts @@ -88,7 +88,7 @@ export interface CpuUtilizationScalingProps extends appscaling.BaseTargetTrackin /** * Target average CPU utilization across the task */ - targetUtilizationPercent: number; + readonly targetUtilizationPercent: number; } /** @@ -98,7 +98,7 @@ export interface MemoryUtilizationScalingProps extends appscaling.BaseTargetTrac /** * Target average memory utilization across the task */ - targetUtilizationPercent: number; + readonly targetUtilizationPercent: number; } /** @@ -108,12 +108,12 @@ export interface RequestCountScalingProps extends appscaling.BaseTargetTrackingP /** * ALB requests per target */ - requestsPerTarget: number; + readonly requestsPerTarget: number; /** * ALB Target Group */ - targetGroup: elbv2.ApplicationTargetGroup; + readonly targetGroup: elbv2.ApplicationTargetGroup; } /** @@ -128,10 +128,10 @@ export interface TrackCustomMetricProps extends appscaling.BaseTargetTrackingPro * - metric > targetValue => scale out * - metric < targetValue => scale in */ - metric: cloudwatch.Metric; + readonly metric: cloudwatch.Metric; /** * The target value to achieve for the metric */ - targetValue: number; + readonly targetValue: number; } diff --git a/packages/@aws-cdk/aws-ecs/lib/base/task-definition.ts b/packages/@aws-cdk/aws-ecs/lib/base/task-definition.ts index 541799f0a1b8e..fc0d53bda597d 100644 --- a/packages/@aws-cdk/aws-ecs/lib/base/task-definition.ts +++ b/packages/@aws-cdk/aws-ecs/lib/base/task-definition.ts @@ -13,7 +13,7 @@ export interface CommonTaskDefinitionProps { * * @default Automatically generated name */ - family?: string; + readonly family?: string; /** * The IAM role assumed by the ECS agent. @@ -23,19 +23,19 @@ export interface CommonTaskDefinitionProps { * * @default An execution role will be automatically created if you use ECR images in your task definition */ - executionRole?: iam.IRole; + readonly executionRole?: iam.IRole; /** * The IAM role assumable by your application code running inside the container * * @default A task role is automatically created for you */ - taskRole?: iam.IRole; + readonly taskRole?: iam.IRole; /** * See: https://docs.aws.amazon.com/AmazonECS/latest/developerguide//task_definition_parameters.html#volumes */ - volumes?: Volume[]; + readonly volumes?: Volume[]; } /** @@ -49,7 +49,7 @@ export interface TaskDefinitionProps extends CommonTaskDefinitionProps { * * @default NetworkMode.Bridge for EC2 tasks, AwsVpc for Fargate tasks. */ - networkMode?: NetworkMode; + readonly networkMode?: NetworkMode; /** * An array of placement constraint objects to use for the task. You can @@ -58,12 +58,12 @@ export interface TaskDefinitionProps extends CommonTaskDefinitionProps { * * Not supported in Fargate. */ - placementConstraints?: PlacementConstraint[]; + readonly placementConstraints?: PlacementConstraint[]; /** * What launch types this task definition should be compatible with. */ - compatibility: Compatibility; + readonly compatibility: Compatibility; /** * The number of cpu units used by the task. @@ -74,7 +74,7 @@ export interface TaskDefinitionProps extends CommonTaskDefinitionProps { * 2048 (2 vCPU) - Available memory values: Between 4GB and 16GB in 1GB increments * 4096 (4 vCPU) - Available memory values: Between 8GB and 30GB in 1GB increments */ - cpu?: string; + readonly cpu?: string; /** * The amount (in MiB) of memory used by the task. @@ -92,7 +92,7 @@ export interface TaskDefinitionProps extends CommonTaskDefinitionProps { * * Between 8GB and 30GB in 1GB increments - Available cpu values: 4096 (4 vCPU) */ - memoryMiB?: string; + readonly memoryMiB?: string; } /** @@ -230,7 +230,8 @@ export class TaskDefinition extends cdk.Construct { } /** - * (internal) Links a container to this task definition. + * Links a container to this task definition. + * @internal */ public _linkContainer(container: ContainerDefinition) { this.containers.push(container); @@ -344,17 +345,17 @@ export interface Volume { /** * Path on the host */ - host?: Host; + readonly host?: Host; /** * A name for the volume */ - name: string; + readonly name: string; /** * Specifies this configuration when using Docker volumes */ - dockerVolumeConfiguration?: DockerVolumeConfiguration; + readonly dockerVolumeConfiguration?: DockerVolumeConfiguration; } /** @@ -364,7 +365,7 @@ export interface Host { /** * Source path on the host */ - sourcePath?: string; + readonly sourcePath?: string; } /** @@ -376,27 +377,27 @@ export interface DockerVolumeConfiguration { * * @default false */ - autoprovision?: boolean; + readonly autoprovision?: boolean; /** * The Docker volume driver to use */ - driver: string; + readonly driver: string; /** * A map of Docker driver specific options passed through * * @default No options */ - driverOpts?: string[]; + readonly driverOpts?: string[]; /** * Custom metadata to add to your Docker volume * * @default No labels */ - labels?: string[]; + readonly labels?: string[]; /** * The scope for the Docker volume which determines it's lifecycle */ - scope: Scope; + readonly scope: Scope; } export enum Scope { @@ -418,12 +419,12 @@ export interface PlacementConstraint { /** * The type of constraint */ - type: PlacementConstraintType; + readonly type: PlacementConstraintType; /** * Additional information for the constraint */ - expression?: string; + readonly expression?: string; } /** diff --git a/packages/@aws-cdk/aws-ecs/lib/cluster.ts b/packages/@aws-cdk/aws-ecs/lib/cluster.ts index 591c0da164f96..725ab17ea8bd6 100644 --- a/packages/@aws-cdk/aws-ecs/lib/cluster.ts +++ b/packages/@aws-cdk/aws-ecs/lib/cluster.ts @@ -15,12 +15,12 @@ export interface ClusterProps { * * @default CloudFormation-generated name */ - clusterName?: string; + readonly clusterName?: string; /** * The VPC where your ECS instances will be running or your ENIs will be deployed */ - vpc: ec2.IVpcNetwork; + readonly vpc: ec2.IVpcNetwork; } /** @@ -189,7 +189,7 @@ export interface EcsOptimizedAmiProps { * * @default AmazonLinux */ - generation?: ec2.AmazonLinuxGeneration; + readonly generation?: ec2.AmazonLinuxGeneration; } /** @@ -265,31 +265,31 @@ export interface ClusterImportProps { /** * Name of the cluster */ - clusterName: string; + readonly clusterName: string; /** * ARN of the cluster * * @default Derived from clusterName */ - clusterArn?: string; + readonly clusterArn?: string; /** * VPC that the cluster instances are running in */ - vpc: ec2.VpcNetworkImportProps; + readonly vpc: ec2.VpcNetworkImportProps; /** * Security group of the cluster instances */ - securityGroups: ec2.SecurityGroupImportProps[]; + readonly securityGroups: ec2.SecurityGroupImportProps[]; /** * Whether the given cluster has EC2 capacity * * @default true */ - hasEc2Capacity?: boolean; + readonly hasEc2Capacity?: boolean; } /** @@ -354,7 +354,7 @@ export interface AddAutoScalingGroupCapacityOptions { * * @default false */ - containersAccessInstanceRole?: boolean; + readonly containersAccessInstanceRole?: boolean; /** * Give tasks this many seconds to complete when instances are being scaled in. @@ -367,7 +367,7 @@ export interface AddAutoScalingGroupCapacityOptions { * * @default 300 */ - taskDrainTimeSeconds?: number; + readonly taskDrainTimeSeconds?: number; } /** @@ -377,5 +377,5 @@ export interface AddCapacityOptions extends AddAutoScalingGroupCapacityOptions, /** * The type of EC2 instance to launch into your Autoscaling Group */ - instanceType: ec2.InstanceType; + readonly instanceType: ec2.InstanceType; } diff --git a/packages/@aws-cdk/aws-ecs/lib/container-definition.ts b/packages/@aws-cdk/aws-ecs/lib/container-definition.ts index 9508737da1843..cda7dd406e156 100644 --- a/packages/@aws-cdk/aws-ecs/lib/container-definition.ts +++ b/packages/@aws-cdk/aws-ecs/lib/container-definition.ts @@ -14,7 +14,7 @@ export interface ContainerDefinitionOptions { * repositories (repository-url/image:tag). * TODO: Update these to specify using classes of IContainerImage */ - image: ContainerImage; + readonly image: ContainerImage; /** * The CMD value to pass to the container. @@ -23,47 +23,47 @@ export interface ContainerDefinitionOptions { * * @default CMD value built into container image */ - command?: string[]; + readonly command?: string[]; /** * The minimum number of CPU units to reserve for the container. */ - cpu?: number; + readonly cpu?: number; /** * Indicates whether networking is disabled within the container. * * @default false */ - disableNetworking?: boolean; + readonly disableNetworking?: boolean; /** * A list of DNS search domains that are provided to the container. * * @default No search domains */ - dnsSearchDomains?: string[]; + readonly dnsSearchDomains?: string[]; /** * A list of DNS servers that Amazon ECS provides to the container. * * @default Default DNS servers */ - dnsServers?: string[]; + readonly dnsServers?: string[]; /** * A key-value map of labels for the container. * * @default No labels */ - dockerLabels?: { [key: string]: string }; + readonly dockerLabels?: { [key: string]: string }; /** * A list of custom labels for SELinux and AppArmor multi-level security systems. * * @default No security labels */ - dockerSecurityOptions?: string[]; + readonly dockerSecurityOptions?: string[]; /** * The ENTRYPOINT value to pass to the container. @@ -71,14 +71,14 @@ export interface ContainerDefinitionOptions { * @see https://docs.docker.com/engine/reference/builder/#entrypoint * @default Entry point configured in container */ - entryPoint?: string[]; + readonly entryPoint?: string[]; /** * The environment variables to pass to the container. * * @default No environment variables */ - environment?: { [key: string]: string }; + readonly environment?: { [key: string]: string }; /** * Indicates whether the task stops if this container fails. @@ -91,28 +91,28 @@ export interface ContainerDefinitionOptions { * * @default true */ - essential?: boolean; + readonly essential?: boolean; /** * A list of hostnames and IP address mappings to append to the /etc/hosts file on the container. * * @default No extra hosts */ - extraHosts?: { [name: string]: string }; + readonly extraHosts?: { [name: string]: string }; /** * Container health check. * * @default Health check configuration from container */ - healthCheck?: HealthCheck; + readonly healthCheck?: HealthCheck; /** * The name that Docker uses for the container hostname. * * @default Automatic hostname */ - hostname?: string; + readonly hostname?: string; /** * The hard limit (in MiB) of memory to present to the container. @@ -122,7 +122,7 @@ export interface ContainerDefinitionOptions { * * At least one of memoryLimitMiB and memoryReservationMiB is required for non-Fargate services. */ - memoryLimitMiB?: number; + readonly memoryLimitMiB?: number; /** * The soft limit (in MiB) of memory to reserve for the container. @@ -134,40 +134,40 @@ export interface ContainerDefinitionOptions { * * At least one of memoryLimitMiB and memoryReservationMiB is required for non-Fargate services. */ - memoryReservationMiB?: number; + readonly memoryReservationMiB?: number; /** * Indicates whether the container is given full access to the host container instance. * * @default false */ - privileged?: boolean; + readonly privileged?: boolean; /** * Indicates whether the container's root file system is mounted as read only. * * @default false */ - readonlyRootFilesystem?: boolean; + readonly readonlyRootFilesystem?: boolean; /** * The user name to use inside the container. * * @default root */ - user?: string; + readonly user?: string; /** * The working directory in the container to run commands in. * * @default / */ - workingDirectory?: string; + readonly workingDirectory?: string; /** * Configures a custom log driver for the container. */ - logging?: LogDriver; + readonly logging?: LogDriver; } /** @@ -177,7 +177,7 @@ export interface ContainerDefinitionProps extends ContainerDefinitionOptions { /** * The task this container definition belongs to. */ - taskDefinition: TaskDefinition; + readonly taskDefinition: TaskDefinition; } /** @@ -290,19 +290,24 @@ export class ContainerDefinition extends cdk.Construct { * Add one or more port mappings to this container */ public addPortMappings(...portMappings: PortMapping[]) { - for (const pm of portMappings) { + this.portMappings.push(...portMappings.map(pm => { if (this.taskDefinition.networkMode === NetworkMode.AwsVpc || this.taskDefinition.networkMode === NetworkMode.Host) { if (pm.containerPort !== pm.hostPort && pm.hostPort !== undefined) { throw new Error(`Host port ${pm.hostPort} does not match container port ${pm.containerPort}.`); } } + if (this.taskDefinition.networkMode === NetworkMode.Bridge) { if (pm.hostPort === undefined) { - pm.hostPort = 0; + pm = { + ...pm, + hostPort: 0 + }; } } - } - this.portMappings.push(...portMappings); + + return pm; + })); } /** @@ -403,7 +408,7 @@ export interface HealthCheck { * * If you provide a shell command as a single string, you have to quote command-line arguments. */ - command: string[]; + readonly command: string[]; /** * Time period in seconds between each health check execution. @@ -412,7 +417,7 @@ export interface HealthCheck { * * @default 30 */ - intervalSeconds?: number; + readonly intervalSeconds?: number; /** * Number of times to retry a failed health check before the container is considered unhealthy. @@ -421,7 +426,7 @@ export interface HealthCheck { * * @default 3 */ - retries?: number; + readonly retries?: number; /** * Grace period after startup before failed health checks count. @@ -430,7 +435,7 @@ export interface HealthCheck { * * @default No start period */ - startPeriod?: number; + readonly startPeriod?: number; /** * The time period in seconds to wait for a health check to succeed before it is considered a failure. @@ -439,7 +444,7 @@ export interface HealthCheck { * * @default 5 */ - timeout?: number; + readonly timeout?: number; } function renderKV(env: { [key: string]: string }, keyName: string, valueName: string): any { @@ -491,17 +496,17 @@ export interface Ulimit { /** * What resource to enforce a limit on */ - name: UlimitName, + readonly name: UlimitName, /** * Soft limit of the resource */ - softLimit: number, + readonly softLimit: number, /** * Hard limit of the resource */ - hardLimit: number, + readonly hardLimit: number, } /** @@ -540,7 +545,7 @@ export interface PortMapping { /** * Port inside the container */ - containerPort: number; + readonly containerPort: number; /** * Port on the host @@ -551,14 +556,14 @@ export interface PortMapping { * In Bridge networking mode, leave this out or set it to non-reserved * non-ephemeral port. */ - hostPort?: number; + readonly hostPort?: number; /** * Protocol * * @default Tcp */ - protocol?: Protocol + readonly protocol?: Protocol } /** @@ -585,16 +590,16 @@ function renderPortMapping(pm: PortMapping): CfnTaskDefinition.PortMappingProper } export interface ScratchSpace { - containerPath: string, - readOnly: boolean, - sourcePath: string - name: string, + readonly containerPath: string, + readonly readOnly: boolean, + readonly sourcePath: string + readonly name: string, } export interface MountPoint { - containerPath: string, - readOnly: boolean, - sourceVolume: string, + readonly containerPath: string, + readonly readOnly: boolean, + readonly sourceVolume: string, } function renderMountPoint(mp: MountPoint): CfnTaskDefinition.MountPointProperty { @@ -612,12 +617,12 @@ export interface VolumeFrom { /** * Name of the source container */ - sourceContainer: string, + readonly sourceContainer: string, /** * Whether the volume is read only */ - readOnly: boolean, + readonly readOnly: boolean, } function renderVolumeFrom(vf: VolumeFrom): CfnTaskDefinition.VolumeFromProperty { diff --git a/packages/@aws-cdk/aws-ecs/lib/ec2/ec2-event-rule-target.ts b/packages/@aws-cdk/aws-ecs/lib/ec2/ec2-event-rule-target.ts index 90fdee743248e..3853764cb0828 100644 --- a/packages/@aws-cdk/aws-ecs/lib/ec2/ec2-event-rule-target.ts +++ b/packages/@aws-cdk/aws-ecs/lib/ec2/ec2-event-rule-target.ts @@ -12,19 +12,19 @@ export interface Ec2EventRuleTargetProps { /** * Cluster where service will be deployed */ - cluster: ICluster; + readonly cluster: ICluster; /** * Task Definition of the task that should be started */ - taskDefinition: TaskDefinition; + readonly taskDefinition: TaskDefinition; /** * How many tasks should be started when this event is triggered * * @default 1 */ - taskCount?: number; + readonly taskCount?: number; } /** diff --git a/packages/@aws-cdk/aws-ecs/lib/ec2/ec2-service.ts b/packages/@aws-cdk/aws-ecs/lib/ec2/ec2-service.ts index 1a20739cc4362..8b818ddb09443 100644 --- a/packages/@aws-cdk/aws-ecs/lib/ec2/ec2-service.ts +++ b/packages/@aws-cdk/aws-ecs/lib/ec2/ec2-service.ts @@ -15,12 +15,12 @@ export interface Ec2ServiceProps extends BaseServiceProps { /** * Cluster where service will be deployed */ - cluster: ICluster; + readonly cluster: ICluster; /** * Task Definition used for running tasks in the service */ - taskDefinition: TaskDefinition; + readonly taskDefinition: TaskDefinition; /** * In what subnets to place the task's ENIs @@ -29,7 +29,7 @@ export interface Ec2ServiceProps extends BaseServiceProps { * * @default Private subnets */ - vpcSubnets?: ec2.SubnetSelection; + readonly vpcSubnets?: ec2.SubnetSelection; /** * Existing security group to use for the task's ENIs @@ -38,14 +38,14 @@ export interface Ec2ServiceProps extends BaseServiceProps { * * @default A new security group is created */ - securityGroup?: ec2.ISecurityGroup; + readonly securityGroup?: ec2.ISecurityGroup; /** * Whether to start services on distinct instances * * @default true */ - placeOnDistinctInstances?: boolean; + readonly placeOnDistinctInstances?: boolean; /** * Deploy exactly one task on each instance in your cluster. @@ -55,7 +55,7 @@ export interface Ec2ServiceProps extends BaseServiceProps { * * @default false */ - daemon?: boolean; + readonly daemon?: boolean; } /** diff --git a/packages/@aws-cdk/aws-ecs/lib/ec2/ec2-task-definition.ts b/packages/@aws-cdk/aws-ecs/lib/ec2/ec2-task-definition.ts index a1a130e2a1868..8c1bc5135d4c4 100644 --- a/packages/@aws-cdk/aws-ecs/lib/ec2/ec2-task-definition.ts +++ b/packages/@aws-cdk/aws-ecs/lib/ec2/ec2-task-definition.ts @@ -12,7 +12,7 @@ export interface Ec2TaskDefinitionProps extends CommonTaskDefinitionProps { * * @default NetworkMode.Bridge for EC2 tasks, AwsVpc for Fargate tasks. */ - networkMode?: NetworkMode; + readonly networkMode?: NetworkMode; /** * An array of placement constraint objects to use for the task. You can @@ -21,7 +21,7 @@ export interface Ec2TaskDefinitionProps extends CommonTaskDefinitionProps { * * Not supported in Fargate. */ - placementConstraints?: PlacementConstraint[]; + readonly placementConstraints?: PlacementConstraint[]; } /** diff --git a/packages/@aws-cdk/aws-ecs/lib/fargate/fargate-service.ts b/packages/@aws-cdk/aws-ecs/lib/fargate/fargate-service.ts index 5a146d1fca2b1..48c5041f0e0d7 100644 --- a/packages/@aws-cdk/aws-ecs/lib/fargate/fargate-service.ts +++ b/packages/@aws-cdk/aws-ecs/lib/fargate/fargate-service.ts @@ -12,33 +12,33 @@ export interface FargateServiceProps extends BaseServiceProps { /** * Cluster where service will be deployed */ - cluster: ICluster; // should be required? do we assume 'default' exists? + readonly cluster: ICluster; // should be required? do we assume 'default' exists? /** * Task Definition used for running tasks in the service */ - taskDefinition: TaskDefinition; + readonly taskDefinition: TaskDefinition; /** * Assign public IP addresses to each task * * @default false */ - assignPublicIp?: boolean; + readonly assignPublicIp?: boolean; /** * In what subnets to place the task's ENIs * * @default Private subnet if assignPublicIp, public subnets otherwise */ - vpcSubnets?: ec2.SubnetSelection; + readonly vpcSubnets?: ec2.SubnetSelection; /** * Existing security group to use for the tasks * * @default A new security group is created */ - securityGroup?: ec2.ISecurityGroup; + readonly securityGroup?: ec2.ISecurityGroup; /** * Fargate platform version to run this service on @@ -48,7 +48,7 @@ export interface FargateServiceProps extends BaseServiceProps { * * @default Latest */ - platformVersion?: FargatePlatformVersion; + readonly platformVersion?: FargatePlatformVersion; } /** diff --git a/packages/@aws-cdk/aws-ecs/lib/fargate/fargate-task-definition.ts b/packages/@aws-cdk/aws-ecs/lib/fargate/fargate-task-definition.ts index f98ca512bb8e2..8ff1efd560d0b 100644 --- a/packages/@aws-cdk/aws-ecs/lib/fargate/fargate-task-definition.ts +++ b/packages/@aws-cdk/aws-ecs/lib/fargate/fargate-task-definition.ts @@ -16,7 +16,7 @@ export interface FargateTaskDefinitionProps extends CommonTaskDefinitionProps { * * @default 256 */ - cpu?: string; + readonly cpu?: string; /** * The amount (in MiB) of memory used by the task. @@ -36,7 +36,7 @@ export interface FargateTaskDefinitionProps extends CommonTaskDefinitionProps { * * @default 512 */ - memoryMiB?: string; + readonly memoryMiB?: string; } /** diff --git a/packages/@aws-cdk/aws-ecs/lib/images/asset-image.ts b/packages/@aws-cdk/aws-ecs/lib/images/asset-image.ts index 003fba3222acd..ccaaaa2a4f18d 100644 --- a/packages/@aws-cdk/aws-ecs/lib/images/asset-image.ts +++ b/packages/@aws-cdk/aws-ecs/lib/images/asset-image.ts @@ -8,7 +8,7 @@ export interface AssetImageProps { /** * The directory where the Dockerfile is stored */ - directory: string; + readonly directory: string; } /** diff --git a/packages/@aws-cdk/aws-ecs/lib/images/repository.ts b/packages/@aws-cdk/aws-ecs/lib/images/repository.ts index 4b21cc503d704..67126e466795a 100644 --- a/packages/@aws-cdk/aws-ecs/lib/images/repository.ts +++ b/packages/@aws-cdk/aws-ecs/lib/images/repository.ts @@ -7,7 +7,7 @@ export interface RepositoryImageProps { /** * Optional secret that houses credentials for the image registry */ - credentials?: secretsmanager.ISecret; + readonly credentials?: secretsmanager.ISecret; } /** diff --git a/packages/@aws-cdk/aws-ecs/lib/linux-parameters.ts b/packages/@aws-cdk/aws-ecs/lib/linux-parameters.ts index 04f47572e22e7..a17656298767c 100644 --- a/packages/@aws-cdk/aws-ecs/lib/linux-parameters.ts +++ b/packages/@aws-cdk/aws-ecs/lib/linux-parameters.ts @@ -92,19 +92,19 @@ export interface Device { * * @default Same path as the host */ - containerPath?: string, + readonly containerPath?: string, /** * Path on the host */ - hostPath: string, + readonly hostPath: string, /** * Permissions * * @default Readonly */ - permissions?: DevicePermission[] + readonly permissions?: DevicePermission[] } function renderDevice(device: Device): CfnTaskDefinition.DeviceProperty { @@ -122,17 +122,17 @@ export interface Tmpfs { /** * Path in the container to mount */ - containerPath: string, + readonly containerPath: string, /** * Size of the volume */ - size: number, + readonly size: number, /** * Mount options */ - mountOptions?: TmpfsMountOption[], + readonly mountOptions?: TmpfsMountOption[], } function renderTmpfs(tmpfs: Tmpfs): CfnTaskDefinition.TmpfsProperty { diff --git a/packages/@aws-cdk/aws-ecs/lib/load-balanced-ecs-service.ts b/packages/@aws-cdk/aws-ecs/lib/load-balanced-ecs-service.ts index 4d021fac92f19..31564226042cc 100644 --- a/packages/@aws-cdk/aws-ecs/lib/load-balanced-ecs-service.ts +++ b/packages/@aws-cdk/aws-ecs/lib/load-balanced-ecs-service.ts @@ -15,7 +15,7 @@ export interface LoadBalancedEc2ServiceProps extends LoadBalancedServiceBaseProp * * At least one of memoryLimitMiB and memoryReservationMiB is required. */ - memoryLimitMiB?: number; + readonly memoryLimitMiB?: number; /** * The soft limit (in MiB) of memory to reserve for the container. @@ -27,7 +27,7 @@ export interface LoadBalancedEc2ServiceProps extends LoadBalancedServiceBaseProp * * At least one of memoryLimitMiB and memoryReservationMiB is required. */ - memoryReservationMiB?: number; + readonly memoryReservationMiB?: number; } /** diff --git a/packages/@aws-cdk/aws-ecs/lib/load-balanced-fargate-service-applet.ts b/packages/@aws-cdk/aws-ecs/lib/load-balanced-fargate-service-applet.ts index 374d546a78f68..9d638dab7cc33 100644 --- a/packages/@aws-cdk/aws-ecs/lib/load-balanced-fargate-service-applet.ts +++ b/packages/@aws-cdk/aws-ecs/lib/load-balanced-fargate-service-applet.ts @@ -13,7 +13,7 @@ export interface LoadBalancedFargateServiceAppletProps extends cdk.StackProps { /** * The image to start (from DockerHub) */ - image: string; + readonly image: string; /** * The number of cpu units used by the task. @@ -28,7 +28,7 @@ export interface LoadBalancedFargateServiceAppletProps extends cdk.StackProps { * * @default 256 */ - cpu?: string; + readonly cpu?: string; /** * The amount (in MiB) of memory used by the task. @@ -50,58 +50,58 @@ export interface LoadBalancedFargateServiceAppletProps extends cdk.StackProps { * * @default 512 */ - memoryMiB?: string; + readonly memoryMiB?: string; /** * The container port of the application load balancer attached to your Fargate service. Corresponds to container port mapping. * * @default 80 */ - containerPort?: number; + readonly containerPort?: number; /** * Determines whether the Application Load Balancer will be internet-facing * * @default true */ - publicLoadBalancer?: boolean; + readonly publicLoadBalancer?: boolean; /** * Determines whether your Fargate Service will be assigned a public IP address. * * @default false */ - publicTasks?: boolean; + readonly publicTasks?: boolean; /** * Number of desired copies of running tasks * * @default 1 */ - desiredCount?: number; + readonly desiredCount?: number; /* * Domain name for the service, e.g. api.example.com */ - domainName?: string; + readonly domainName?: string; /** * Route53 hosted zone for the domain, e.g. "example.com." */ - domainZone?: string; + readonly domainZone?: string; /** * Certificate Manager certificate to associate with the load balancer. * Setting this option will set the load balancer port to 443. */ - certificate?: string; + readonly certificate?: string; /** * Environment variables to pass to the container * * @default No environment variables */ - environment?: { [key: string]: string }; + readonly environment?: { [key: string]: string }; } /** diff --git a/packages/@aws-cdk/aws-ecs/lib/load-balanced-fargate-service.ts b/packages/@aws-cdk/aws-ecs/lib/load-balanced-fargate-service.ts index f1eee7befeaf1..afdf4151af5e1 100644 --- a/packages/@aws-cdk/aws-ecs/lib/load-balanced-fargate-service.ts +++ b/packages/@aws-cdk/aws-ecs/lib/load-balanced-fargate-service.ts @@ -22,7 +22,7 @@ export interface LoadBalancedFargateServiceProps extends LoadBalancedServiceBase * * @default 256 */ - cpu?: string; + readonly cpu?: string; /** * The amount (in MiB) of memory used by the task. @@ -44,31 +44,31 @@ export interface LoadBalancedFargateServiceProps extends LoadBalancedServiceBase * * @default 512 */ - memoryMiB?: string; + readonly memoryMiB?: string; /** * Determines whether your Fargate Service will be assigned a public IP address. * * @default false */ - publicTasks?: boolean; + readonly publicTasks?: boolean; /* * Domain name for the service, e.g. api.example.com */ - domainName?: string; + readonly domainName?: string; /** * Route53 hosted zone for the domain, e.g. "example.com." */ - domainZone?: IHostedZone; + readonly domainZone?: IHostedZone; /** * Whether to create an AWS log driver * * @default true */ - createLogs?: boolean; + readonly createLogs?: boolean; } /** diff --git a/packages/@aws-cdk/aws-ecs/lib/load-balanced-service-base.ts b/packages/@aws-cdk/aws-ecs/lib/load-balanced-service-base.ts index 9e9aeed50769c..110f44bf1ab5b 100644 --- a/packages/@aws-cdk/aws-ecs/lib/load-balanced-service-base.ts +++ b/packages/@aws-cdk/aws-ecs/lib/load-balanced-service-base.ts @@ -14,52 +14,52 @@ export interface LoadBalancedServiceBaseProps { /** * The cluster where your service will be deployed */ - cluster: ICluster; + readonly cluster: ICluster; /** * The image to start. */ - image: ContainerImage; + readonly image: ContainerImage; /** * The container port of the application load balancer attached to your Fargate service. Corresponds to container port mapping. * * @default 80 */ - containerPort?: number; + readonly containerPort?: number; /** * Determines whether the Application Load Balancer will be internet-facing * * @default true */ - publicLoadBalancer?: boolean; + readonly publicLoadBalancer?: boolean; /** * Number of desired copies of running tasks * * @default 1 */ - desiredCount?: number; + readonly desiredCount?: number; /** * Whether to create an application load balancer or a network load balancer * @default application */ - loadBalancerType?: LoadBalancerType + readonly loadBalancerType?: LoadBalancerType /** * Certificate Manager certificate to associate with the load balancer. * Setting this option will set the load balancer port to 443. */ - certificate?: ICertificate; + readonly certificate?: ICertificate; /** * Environment variables to pass to the container * * @default No environment variables */ - environment?: { [key: string]: string }; + readonly environment?: { [key: string]: string }; } /** diff --git a/packages/@aws-cdk/aws-ecs/lib/log-drivers/aws-log-driver.ts b/packages/@aws-cdk/aws-ecs/lib/log-drivers/aws-log-driver.ts index fc2a83e4c8d53..fd69399683026 100644 --- a/packages/@aws-cdk/aws-ecs/lib/log-drivers/aws-log-driver.ts +++ b/packages/@aws-cdk/aws-ecs/lib/log-drivers/aws-log-driver.ts @@ -18,14 +18,14 @@ export interface AwsLogDriverProps { * * prefix-name/container-name/ecs-task-id */ - streamPrefix: string; + readonly streamPrefix: string; /** * The log group to log to * * @default A log group is automatically created */ - logGroup?: logs.ILogGroup; + readonly logGroup?: logs.ILogGroup; /** * This option defines a multiline start pattern in Python strftime format. @@ -34,7 +34,7 @@ export interface AwsLogDriverProps { * following lines that don’t match the pattern. Thus the matched line is * the delimiter between log messages. */ - datetimeFormat?: string; + readonly datetimeFormat?: string; /** * This option defines a multiline start pattern using a regular expression. @@ -43,7 +43,7 @@ export interface AwsLogDriverProps { * following lines that don’t match the pattern. Thus the matched line is * the delimiter between log messages. */ - multilinePattern?: string; + readonly multilinePattern?: string; } /** diff --git a/packages/@aws-cdk/aws-ecs/package-lock.json b/packages/@aws-cdk/aws-ecs/package-lock.json index 42b0aab1e99ba..7c814cf29d749 100644 --- a/packages/@aws-cdk/aws-ecs/package-lock.json +++ b/packages/@aws-cdk/aws-ecs/package-lock.json @@ -1,6 +1,6 @@ { "name": "@aws-cdk/aws-ecs", - "version": "0.25.3", + "version": "0.26.0", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/packages/@aws-cdk/aws-eks/lib/ami.ts b/packages/@aws-cdk/aws-eks/lib/ami.ts index e25db075a4de9..c7d4a868b6921 100644 --- a/packages/@aws-cdk/aws-eks/lib/ami.ts +++ b/packages/@aws-cdk/aws-eks/lib/ami.ts @@ -9,14 +9,14 @@ export interface EksOptimizedAmiProps { * * @default Normal */ - nodeType?: NodeType; + readonly nodeType?: NodeType; /** * The Kubernetes version to use * * @default The latest version */ - kubernetesVersion?: string; + readonly kubernetesVersion?: string; } /** diff --git a/packages/@aws-cdk/aws-eks/lib/cluster.ts b/packages/@aws-cdk/aws-eks/lib/cluster.ts index 0992cca1b9e20..174d3eff33509 100644 --- a/packages/@aws-cdk/aws-eks/lib/cluster.ts +++ b/packages/@aws-cdk/aws-eks/lib/cluster.ts @@ -14,7 +14,7 @@ export interface ClusterProps { /** * The VPC in which to create the Cluster */ - vpc: ec2.IVpcNetwork; + readonly vpc: ec2.IVpcNetwork; /** * Where to place EKS Control Plane ENIs @@ -33,35 +33,35 @@ export interface ClusterProps { * * @default All public and private subnets */ - vpcSubnets?: ec2.SubnetSelection[]; + readonly vpcSubnets?: ec2.SubnetSelection[]; /** * Role that provides permissions for the Kubernetes control plane to make calls to AWS API operations on your behalf. * * @default A role is automatically created for you */ - role?: iam.IRole; + readonly role?: iam.IRole; /** * Name for the cluster. * * @default Automatically generated name */ - clusterName?: string; + readonly clusterName?: string; /** * Security Group to use for Control Plane ENIs * * @default A security group is automatically created */ - securityGroup?: ec2.ISecurityGroup; + readonly securityGroup?: ec2.ISecurityGroup; /** * The Kubernetes version to run in the cluster * * @default If not supplied, will use Amazon default version */ - version?: string; + readonly version?: string; } /** @@ -289,7 +289,7 @@ export interface AddWorkerNodesOptions extends autoscaling.CommonAutoScalingGrou /** * Instance type of the instances to start */ - instanceType: ec2.InstanceType; + readonly instanceType: ec2.InstanceType; } /** @@ -302,7 +302,7 @@ export interface AddAutoScalingGroupOptions { * Should be at most equal to the maximum number of IP addresses available to * the instance type less one. */ - maxPods: number; + readonly maxPods: number; } /** diff --git a/packages/@aws-cdk/aws-elasticloadbalancing/lib/load-balancer.ts b/packages/@aws-cdk/aws-elasticloadbalancing/lib/load-balancer.ts index 5ad70f90fd8cb..aff25b0decc7f 100644 --- a/packages/@aws-cdk/aws-elasticloadbalancing/lib/load-balancer.ts +++ b/packages/@aws-cdk/aws-elasticloadbalancing/lib/load-balancer.ts @@ -12,7 +12,7 @@ export interface LoadBalancerProps { /** * VPC network of the fleet instances */ - vpc: IVpcNetwork; + readonly vpc: IVpcNetwork; /** * Whether this is an internet-facing Load Balancer @@ -22,28 +22,28 @@ export interface LoadBalancerProps { * * @default false */ - internetFacing?: boolean; + readonly internetFacing?: boolean; /** * What listeners to set up for the load balancer. * * Can also be added by .addListener() */ - listeners?: LoadBalancerListener[]; + readonly listeners?: LoadBalancerListener[]; /** * What targets to load balance to. * * Can also be added by .addTarget() */ - targets?: ILoadBalancerTarget[]; + readonly targets?: ILoadBalancerTarget[]; /** * Health check settings for the load balancing targets. * * Not required but recommended. */ - healthCheck?: HealthCheck; + readonly healthCheck?: HealthCheck; } /** @@ -53,7 +53,7 @@ export interface HealthCheck { /** * What port number to health check on */ - port: number; + readonly port: number; /** * What protocol to use for health checking @@ -62,7 +62,7 @@ export interface HealthCheck { * * @default Automatic */ - protocol?: LoadBalancingProtocol; + readonly protocol?: LoadBalancingProtocol; /** * What path to use for HTTP or HTTPS health check (must return 200) @@ -72,35 +72,35 @@ export interface HealthCheck { * * @default "/" */ - path?: string; + readonly path?: string; /** * After how many successful checks is an instance considered healthy * * @default 2 */ - healthyThreshold?: number; + readonly healthyThreshold?: number; /** * After how many unsuccessful checks is an instance considered unhealthy * * @default 5 */ - unhealthyThreshold?: number; + readonly unhealthyThreshold?: number; /** * Number of seconds between health checks * * @default 30 */ - interval?: number; + readonly interval?: number; /** * Health check timeout * * @default 5 */ - timeout?: number; + readonly timeout?: number; } /** @@ -120,7 +120,7 @@ export interface LoadBalancerListener { /** * External listening port */ - externalPort: number; + readonly externalPort: number; /** * What public protocol to use for load balancing @@ -129,7 +129,7 @@ export interface LoadBalancerListener { * * May be omitted if the external port is either 80 or 443. */ - externalProtocol?: LoadBalancingProtocol; + readonly externalProtocol?: LoadBalancingProtocol; /** * Instance listening port @@ -138,7 +138,7 @@ export interface LoadBalancerListener { * * @default externalPort */ - internalPort?: number; + readonly internalPort?: number; /** * What public protocol to use for load balancing @@ -151,17 +151,17 @@ export interface LoadBalancerListener { * is 'tcp' or 'ssl', the instance protocol is 'http' if the * front-end protocol is 'https'. */ - internalProtocol?: LoadBalancingProtocol; + readonly internalProtocol?: LoadBalancingProtocol; /** * SSL policy names */ - policyNames?: string[]; + readonly policyNames?: string[]; /** * ID of SSL certificate */ - sslCertificateId?: string; + readonly sslCertificateId?: string; /** * Allow connections to the load balancer from the given set of connection peers @@ -172,7 +172,7 @@ export interface LoadBalancerListener { * * @default Anywhere */ - allowConnectionsFrom?: IConnectable[]; + readonly allowConnectionsFrom?: IConnectable[]; } export enum LoadBalancingProtocol { diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2/lib/alb/application-listener-certificate.ts b/packages/@aws-cdk/aws-elasticloadbalancingv2/lib/alb/application-listener-certificate.ts index 383b32541e9ce..634070f0b979b 100644 --- a/packages/@aws-cdk/aws-elasticloadbalancingv2/lib/alb/application-listener-certificate.ts +++ b/packages/@aws-cdk/aws-elasticloadbalancingv2/lib/alb/application-listener-certificate.ts @@ -9,14 +9,14 @@ export interface ApplicationListenerCertificateProps { /** * The listener to attach the rule to */ - listener: IApplicationListener; + readonly listener: IApplicationListener; /** * ARNs of certificates to attach * * Duplicates are not allowed. */ - certificateArns: string[]; + readonly certificateArns: string[]; } /** diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2/lib/alb/application-listener-rule.ts b/packages/@aws-cdk/aws-elasticloadbalancingv2/lib/alb/application-listener-rule.ts index d0125d276aeec..55b5e3a14d2cf 100644 --- a/packages/@aws-cdk/aws-elasticloadbalancingv2/lib/alb/application-listener-rule.ts +++ b/packages/@aws-cdk/aws-elasticloadbalancingv2/lib/alb/application-listener-rule.ts @@ -14,12 +14,12 @@ export interface BaseApplicationListenerRuleProps { * * Priorities must be unique. */ - priority: number; + readonly priority: number; /** * Target groups to forward requests to */ - targetGroups?: IApplicationTargetGroup[]; + readonly targetGroups?: IApplicationTargetGroup[]; /** * Rule applies if the requested host matches the indicated host @@ -30,7 +30,7 @@ export interface BaseApplicationListenerRuleProps { * * @default No host condition */ - hostHeader?: string; + readonly hostHeader?: string; /** * Rule applies if the requested path matches the given path pattern @@ -41,7 +41,7 @@ export interface BaseApplicationListenerRuleProps { * * @default No path condition */ - pathPattern?: string; + readonly pathPattern?: string; } /** @@ -51,7 +51,7 @@ export interface ApplicationListenerRuleProps extends BaseApplicationListenerRul /** * The listener to attach the rule to */ - listener: IApplicationListener; + readonly listener: IApplicationListener; } /** diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2/lib/alb/application-listener.ts b/packages/@aws-cdk/aws-elasticloadbalancingv2/lib/alb/application-listener.ts index 6774ce8aa21ea..ab6a663d211ef 100644 --- a/packages/@aws-cdk/aws-elasticloadbalancingv2/lib/alb/application-listener.ts +++ b/packages/@aws-cdk/aws-elasticloadbalancingv2/lib/alb/application-listener.ts @@ -18,33 +18,33 @@ export interface BaseApplicationListenerProps { * * @default Determined from port if known */ - protocol?: ApplicationProtocol; + readonly protocol?: ApplicationProtocol; /** * The port on which the listener listens for requests. * * @default Determined from protocol if known */ - port?: number; + readonly port?: number; /** * The certificates to use on this listener */ - certificateArns?: string[]; + readonly certificateArns?: string[]; /** * The security policy that defines which ciphers and protocols are supported. * * @default the current predefined security policy. */ - sslPolicy?: SslPolicy; + readonly sslPolicy?: SslPolicy; /** * Default target groups to load balance to * * @default None */ - defaultTargetGroups?: IApplicationTargetGroup[]; + readonly defaultTargetGroups?: IApplicationTargetGroup[]; /** * Allow anyone to connect to this listener @@ -59,7 +59,7 @@ export interface BaseApplicationListenerProps { * * @default true */ - open?: boolean; + readonly open?: boolean; } /** @@ -69,7 +69,7 @@ export interface ApplicationListenerProps extends BaseApplicationListenerProps { /** * The load balancer to attach this listener to */ - loadBalancer: IApplicationLoadBalancer; + readonly loadBalancer: IApplicationLoadBalancer; } /** @@ -310,17 +310,17 @@ export interface ApplicationListenerImportProps { /** * ARN of the listener */ - listenerArn: string; + readonly listenerArn: string; /** * Security group ID of the load balancer this listener is associated with */ - securityGroupId: string; + readonly securityGroupId: string; /** * The default port on which this listener is listening */ - defaultPort?: string; + readonly defaultPort?: string; } class ImportedApplicationListener extends cdk.Construct implements IApplicationListener { @@ -424,7 +424,7 @@ export interface AddRuleProps { * * @default Target groups are used as defaults */ - priority?: number; + readonly priority?: number; /** * Rule applies if the requested host matches the indicated host @@ -437,7 +437,7 @@ export interface AddRuleProps { * * @default No host condition */ - hostHeader?: string; + readonly hostHeader?: string; /** * Rule applies if the requested path matches the given path pattern @@ -450,7 +450,7 @@ export interface AddRuleProps { * * @default No path condition */ - pathPattern?: string; + readonly pathPattern?: string; } /** @@ -460,7 +460,7 @@ export interface AddApplicationTargetGroupsProps extends AddRuleProps { /** * Target groups to forward requests to */ - targetGroups: IApplicationTargetGroup[]; + readonly targetGroups: IApplicationTargetGroup[]; } /** @@ -472,14 +472,14 @@ export interface AddApplicationTargetsProps extends AddRuleProps { * * @default Determined from port if known */ - protocol?: ApplicationProtocol; + readonly protocol?: ApplicationProtocol; /** * The port on which the listener listens for requests. * * @default Determined from protocol if known */ - port?: number; + readonly port?: number; /** * The time period during which the load balancer sends a newly registered @@ -489,7 +489,7 @@ export interface AddApplicationTargetsProps extends AddRuleProps { * * @default 0 */ - slowStartSec?: number; + readonly slowStartSec?: number; /** * The stickiness cookie expiration period. @@ -501,7 +501,7 @@ export interface AddApplicationTargetsProps extends AddRuleProps { * * @default 86400 (1 day) */ - stickinessCookieDurationSec?: number; + readonly stickinessCookieDurationSec?: number; /** * The targets to add to this target group. @@ -510,7 +510,7 @@ export interface AddApplicationTargetsProps extends AddRuleProps { * target. If you use either `Instance` or `IPAddress` as targets, all * target must be of the same type. */ - targets?: IApplicationLoadBalancerTarget[]; + readonly targets?: IApplicationLoadBalancerTarget[]; /** * The name of the target group. @@ -521,7 +521,7 @@ export interface AddApplicationTargetsProps extends AddRuleProps { * * @default Automatically generated */ - targetGroupName?: string; + readonly targetGroupName?: string; /** * The amount of time for Elastic Load Balancing to wait before deregistering a target. @@ -530,12 +530,12 @@ export interface AddApplicationTargetsProps extends AddRuleProps { * * @default 300 */ - deregistrationDelaySec?: number; + readonly deregistrationDelaySec?: number; /** * Health check configuration * * @default No health check */ - healthCheck?: HealthCheck; + readonly healthCheck?: HealthCheck; } diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2/lib/alb/application-load-balancer.ts b/packages/@aws-cdk/aws-elasticloadbalancingv2/lib/alb/application-load-balancer.ts index 60e2e3f1b465b..f0d00b6109c7f 100644 --- a/packages/@aws-cdk/aws-elasticloadbalancingv2/lib/alb/application-load-balancer.ts +++ b/packages/@aws-cdk/aws-elasticloadbalancingv2/lib/alb/application-load-balancer.ts @@ -16,7 +16,7 @@ export interface ApplicationLoadBalancerProps extends BaseLoadBalancerProps { * * @default A security group is created */ - securityGroup?: ec2.ISecurityGroup; + readonly securityGroup?: ec2.ISecurityGroup; /** * The type of IP addresses to use @@ -25,21 +25,21 @@ export interface ApplicationLoadBalancerProps extends BaseLoadBalancerProps { * * @default IpAddressType.Ipv4 */ - ipAddressType?: IpAddressType; + readonly ipAddressType?: IpAddressType; /** * Indicates whether HTTP/2 is enabled. * * @default true */ - http2Enabled?: boolean; + readonly http2Enabled?: boolean; /** * The load balancer idle timeout, in seconds * * @default 60 */ - idleTimeoutSecs?: number; + readonly idleTimeoutSecs?: number; } /** @@ -503,12 +503,12 @@ export interface ApplicationLoadBalancerImportProps { /** * ARN of the load balancer */ - loadBalancerArn: string; + readonly loadBalancerArn: string; /** * ID of the load balancer's security group */ - securityGroupId: string; + readonly securityGroupId: string; } // https://docs.aws.amazon.com/elasticloadbalancing/latest/application/load-balancer-access-logs.html#access-logging-bucket-permissions diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2/lib/alb/application-target-group.ts b/packages/@aws-cdk/aws-elasticloadbalancingv2/lib/alb/application-target-group.ts index a4b8bbcee1c11..4a3b99ba577ab 100644 --- a/packages/@aws-cdk/aws-elasticloadbalancingv2/lib/alb/application-target-group.ts +++ b/packages/@aws-cdk/aws-elasticloadbalancingv2/lib/alb/application-target-group.ts @@ -18,14 +18,14 @@ export interface ApplicationTargetGroupProps extends BaseTargetGroupProps { * * @default Determined from port if known */ - protocol?: ApplicationProtocol; + readonly protocol?: ApplicationProtocol; /** * The port on which the listener listens for requests. * * @default Determined from protocol if known */ - port?: number; + readonly port?: number; /** * The time period during which the load balancer sends a newly registered @@ -35,7 +35,7 @@ export interface ApplicationTargetGroupProps extends BaseTargetGroupProps { * * @default 0 */ - slowStartSec?: number; + readonly slowStartSec?: number; /** * The stickiness cookie expiration period. @@ -47,7 +47,7 @@ export interface ApplicationTargetGroupProps extends BaseTargetGroupProps { * * @default 86400 (1 day) */ - stickinessCookieDurationSec?: number; + readonly stickinessCookieDurationSec?: number; /** * The targets to add to this target group. @@ -56,7 +56,7 @@ export interface ApplicationTargetGroupProps extends BaseTargetGroupProps { * target. If you use either `Instance` or `IPAddress` as targets, all * target must be of the same type. */ - targets?: IApplicationLoadBalancerTarget[]; + readonly targets?: IApplicationLoadBalancerTarget[]; } /** diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2/lib/nlb/network-listener.ts b/packages/@aws-cdk/aws-elasticloadbalancingv2/lib/nlb/network-listener.ts index f9e96005ae95a..b31c631d6938c 100644 --- a/packages/@aws-cdk/aws-elasticloadbalancingv2/lib/nlb/network-listener.ts +++ b/packages/@aws-cdk/aws-elasticloadbalancingv2/lib/nlb/network-listener.ts @@ -12,14 +12,14 @@ export interface BaseNetworkListenerProps { /** * The port on which the listener listens for requests. */ - port: number; + readonly port: number; /** * Default target groups to load balance to * * @default None */ - defaultTargetGroups?: INetworkTargetGroup[]; + readonly defaultTargetGroups?: INetworkTargetGroup[]; } /** @@ -29,7 +29,7 @@ export interface NetworkListenerProps extends BaseNetworkListenerProps { /** * The load balancer to attach this listener to */ - loadBalancer: INetworkLoadBalancer; + readonly loadBalancer: INetworkLoadBalancer; } /** @@ -133,7 +133,7 @@ export interface NetworkListenerImportProps { /** * ARN of the listener */ - listenerArn: string; + readonly listenerArn: string; } /** @@ -165,7 +165,7 @@ export interface AddNetworkTargetsProps { * * @default Determined from protocol if known */ - port: number; + readonly port: number; /** * The targets to add to this target group. @@ -174,7 +174,7 @@ export interface AddNetworkTargetsProps { * target. If you use either `Instance` or `IPAddress` as targets, all * target must be of the same type. */ - targets?: INetworkLoadBalancerTarget[]; + readonly targets?: INetworkLoadBalancerTarget[]; /** * The name of the target group. @@ -185,28 +185,28 @@ export interface AddNetworkTargetsProps { * * @default Automatically generated */ - targetGroupName?: string; + readonly targetGroupName?: string; /** * The amount of time for Elastic Load Balancing to wait before deregistering a target. * - * The range is 0–3600 seconds. + * The range is 0-3600 seconds. * * @default 300 */ - deregistrationDelaySec?: number; + readonly deregistrationDelaySec?: number; /** * Indicates whether Proxy Protocol version 2 is enabled. * * @default false */ - proxyProtocolV2?: boolean; + readonly proxyProtocolV2?: boolean; /** * Health check configuration * * @default No health check */ - healthCheck?: HealthCheck; + readonly healthCheck?: HealthCheck; } diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2/lib/nlb/network-load-balancer.ts b/packages/@aws-cdk/aws-elasticloadbalancingv2/lib/nlb/network-load-balancer.ts index 96005eec9cf75..dc66da99ff445 100644 --- a/packages/@aws-cdk/aws-elasticloadbalancingv2/lib/nlb/network-load-balancer.ts +++ b/packages/@aws-cdk/aws-elasticloadbalancingv2/lib/nlb/network-load-balancer.ts @@ -13,7 +13,7 @@ export interface NetworkLoadBalancerProps extends BaseLoadBalancerProps { * * @default false */ - crossZoneEnabled?: boolean; + readonly crossZoneEnabled?: boolean; } /** @@ -218,7 +218,7 @@ export interface NetworkLoadBalancerImportProps { /** * ARN of the load balancer */ - loadBalancerArn: string; + readonly loadBalancerArn: string; } /** diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2/lib/nlb/network-target-group.ts b/packages/@aws-cdk/aws-elasticloadbalancingv2/lib/nlb/network-target-group.ts index dc20f21d6ff52..441919078550d 100644 --- a/packages/@aws-cdk/aws-elasticloadbalancingv2/lib/nlb/network-target-group.ts +++ b/packages/@aws-cdk/aws-elasticloadbalancingv2/lib/nlb/network-target-group.ts @@ -12,14 +12,14 @@ export interface NetworkTargetGroupProps extends BaseTargetGroupProps { /** * The port on which the listener listens for requests. */ - port: number; + readonly port: number; /** * Indicates whether Proxy Protocol version 2 is enabled. * * @default false */ - proxyProtocolV2?: boolean; + readonly proxyProtocolV2?: boolean; /** * The targets to add to this target group. @@ -28,7 +28,7 @@ export interface NetworkTargetGroupProps extends BaseTargetGroupProps { * target. If you use either `Instance` or `IPAddress` as targets, all * target must be of the same type. */ - targets?: INetworkLoadBalancerTarget[]; + readonly targets?: INetworkLoadBalancerTarget[]; } /** diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2/lib/shared/base-listener.ts b/packages/@aws-cdk/aws-elasticloadbalancingv2/lib/shared/base-listener.ts index 74680dcd74787..a5772ff7a8304 100644 --- a/packages/@aws-cdk/aws-elasticloadbalancingv2/lib/shared/base-listener.ts +++ b/packages/@aws-cdk/aws-elasticloadbalancingv2/lib/shared/base-listener.ts @@ -32,6 +32,7 @@ export abstract class BaseListener extends cdk.Construct { /** * Add a TargetGroup to the list of default actions of this listener + * @internal */ protected _addDefaultTargetGroup(targetGroup: ITargetGroup) { this.defaultActions.push({ diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2/lib/shared/base-load-balancer.ts b/packages/@aws-cdk/aws-elasticloadbalancingv2/lib/shared/base-load-balancer.ts index 81902d69ad91a..2d2791a1a6f9f 100644 --- a/packages/@aws-cdk/aws-elasticloadbalancingv2/lib/shared/base-load-balancer.ts +++ b/packages/@aws-cdk/aws-elasticloadbalancingv2/lib/shared/base-load-balancer.ts @@ -13,33 +13,33 @@ export interface BaseLoadBalancerProps { * * @default Automatically generated name */ - loadBalancerName?: string; + readonly loadBalancerName?: string; /** * The VPC network to place the load balancer in */ - vpc: ec2.IVpcNetwork; + readonly vpc: ec2.IVpcNetwork; /** * Whether the load balancer has an internet-routable address * * @default false */ - internetFacing?: boolean; + readonly internetFacing?: boolean; /** * Where in the VPC to place the load balancer * * @default Public subnets if internetFacing, otherwise private subnets */ - vpcSubnets?: ec2.SubnetSelection; + readonly vpcSubnets?: ec2.SubnetSelection; /** * Indicates whether deletion protection is enabled. * * @default false */ - deletionProtection?: boolean; + readonly deletionProtection?: boolean; } /** diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2/lib/shared/base-target-group.ts b/packages/@aws-cdk/aws-elasticloadbalancingv2/lib/shared/base-target-group.ts index 8233dc4668331..64f2130f6657b 100644 --- a/packages/@aws-cdk/aws-elasticloadbalancingv2/lib/shared/base-target-group.ts +++ b/packages/@aws-cdk/aws-elasticloadbalancingv2/lib/shared/base-target-group.ts @@ -18,12 +18,12 @@ export interface BaseTargetGroupProps { * * @default Automatically generated */ - targetGroupName?: string; + readonly targetGroupName?: string; /** * The virtual private cloud (VPC). */ - vpc: ec2.IVpcNetwork; + readonly vpc: ec2.IVpcNetwork; /** * The amount of time for Elastic Load Balancing to wait before deregistering a target. @@ -32,14 +32,14 @@ export interface BaseTargetGroupProps { * * @default 300 */ - deregistrationDelaySec?: number; + readonly deregistrationDelaySec?: number; /** * Health check configuration * * @default No health check */ - healthCheck?: HealthCheck; + readonly healthCheck?: HealthCheck; /** * The type of targets registered to this TargetGroup, either IP or Instance. @@ -50,7 +50,7 @@ export interface BaseTargetGroupProps { * * @default Determined automatically */ - targetType?: TargetType; + readonly targetType?: TargetType; } /** @@ -62,21 +62,21 @@ export interface HealthCheck { * * @default 30 */ - intervalSecs?: number; + readonly intervalSecs?: number; /** * The ping path destination where Elastic Load Balancing sends health check requests. * * @default / */ - path?: string; + readonly path?: string; /** * The port that the load balancer uses when performing health checks on the targets. * * @default 'traffic-port' */ - port?: string; + readonly port?: string; /** * The protocol the load balancer uses when performing health checks on targets. @@ -86,7 +86,7 @@ export interface HealthCheck { * * @default HTTP for ALBs, TCP for NLBs */ - protocol?: Protocol; + readonly protocol?: Protocol; /** * The amount of time, in seconds, during which no response from a target means a failed health check. @@ -97,7 +97,7 @@ export interface HealthCheck { * * @default 5 for ALBs, 10 or 6 for NLBs */ - timeoutSeconds?: number; + readonly timeoutSeconds?: number; /** * The number of consecutive health checks successes required before considering an unhealthy target healthy. @@ -106,7 +106,7 @@ export interface HealthCheck { * * @default 5 for ALBs, 3 for NLBs */ - healthyThresholdCount?: number; + readonly healthyThresholdCount?: number; /** * The number of consecutive health check failures required before considering a target unhealthy. @@ -116,7 +116,7 @@ export interface HealthCheck { * * @default 2 */ - unhealthyThresholdCount?: number; + readonly unhealthyThresholdCount?: number; /** * HTTP code to use when checking for a successful response from a target. @@ -125,7 +125,7 @@ export interface HealthCheck { * 499, and the default value is 200. You can specify multiple values (for * example, "200,202") or a range of values (for example, "200-299"). */ - healthyHttpCodes?: string; + readonly healthyHttpCodes?: string; } /** @@ -304,17 +304,17 @@ export interface TargetGroupImportProps { /** * ARN of the target group */ - targetGroupArn: string; + readonly targetGroupArn: string; /** * Port target group is listening on */ - defaultPort: string; + readonly defaultPort: string; /** * A Token representing the list of ARNs for the load balancer routing to this target group */ - loadBalancerArns?: string; + readonly loadBalancerArns?: string; } /** @@ -350,14 +350,14 @@ export interface LoadBalancerTargetProps { /** * What kind of target this is */ - targetType: TargetType; + readonly targetType: TargetType; /** * JSON representing the target's direct addition to the TargetGroup list * * May be omitted if the target is going to register itself later. */ - targetJson?: any; + readonly targetJson?: any; } /** diff --git a/packages/@aws-cdk/aws-events/lib/event-pattern.ts b/packages/@aws-cdk/aws-events/lib/event-pattern.ts index 72b56f923b199..49e2e2ea3f96b 100644 --- a/packages/@aws-cdk/aws-events/lib/event-pattern.ts +++ b/packages/@aws-cdk/aws-events/lib/event-pattern.ts @@ -31,13 +31,13 @@ export interface EventPattern { /** * By default, this is set to 0 (zero) in all events. */ - version?: string[]; + readonly version?: string[]; /** * A unique value is generated for every event. This can be helpful in * tracing events as they move through rules to targets, and are processed. */ - id?: string[]; + readonly id?: string[]; /** * Identifies, in combination with the source field, the fields and values @@ -45,7 +45,7 @@ export interface EventPattern { * * Represents the "detail-type" event field. */ - detailType?: string[]; + readonly detailType?: string[]; /** * Identifies the service that sourced the event. All events sourced from @@ -59,12 +59,12 @@ export interface EventPattern { * * @see http://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html#genref-aws-service-namespaces */ - source?: string[]; + readonly source?: string[]; /** * The 12-digit number identifying an AWS account. */ - account?: string[]; + readonly account?: string[]; /** * The event timestamp, which can be specified by the service originating @@ -72,12 +72,12 @@ export interface EventPattern { * to report the start time, so this value can be noticeably before the time * the event is actually received. */ - time?: string[]; + readonly time?: string[]; /** * Identifies the AWS region where the event originated. */ - region?: string[]; + readonly region?: string[]; /** * This JSON array contains ARNs that identify resources that are involved @@ -89,11 +89,11 @@ export interface EventPattern { * Auto Scaling groups, but API calls with AWS CloudTrail do not include * resource ARNs. */ - resources?: string[]; + readonly resources?: string[]; /** * A JSON object, whose content is at the discretion of the service * originating the event. */ - detail?: any; + readonly detail?: any; } diff --git a/packages/@aws-cdk/aws-events/lib/input-options.ts b/packages/@aws-cdk/aws-events/lib/input-options.ts index 4bf55aa3fe6a8..f45cedc13a94e 100644 --- a/packages/@aws-cdk/aws-events/lib/input-options.ts +++ b/packages/@aws-cdk/aws-events/lib/input-options.ts @@ -22,7 +22,7 @@ export interface TargetInputTemplate { * } * } */ - textTemplate?: string; + readonly textTemplate?: string; /** * Input template where you can use the values of the keys from @@ -41,12 +41,12 @@ export interface TargetInputTemplate { * } * */ - jsonTemplate?: any; + readonly jsonTemplate?: any; /** * Map of JSON paths to be extracted from the event. These are key-value * pairs, where each value is a JSON path. You must use JSON dot notation, * not bracket notation. */ - pathsMap?: { [key: string]: string }; + readonly pathsMap?: { [key: string]: string }; } diff --git a/packages/@aws-cdk/aws-events/lib/rule-ref.ts b/packages/@aws-cdk/aws-events/lib/rule-ref.ts index fc7b9d8ab481b..1472cce90530b 100644 --- a/packages/@aws-cdk/aws-events/lib/rule-ref.ts +++ b/packages/@aws-cdk/aws-events/lib/rule-ref.ts @@ -5,7 +5,7 @@ export interface EventRuleImportProps { * The value of the event rule Amazon Resource Name (ARN), such as * arn:aws:events:us-east-2:123456789012:rule/example. */ - eventRuleArn: string; + readonly eventRuleArn: string; } export interface IEventRule extends IConstruct { diff --git a/packages/@aws-cdk/aws-events/lib/rule.ts b/packages/@aws-cdk/aws-events/lib/rule.ts index 5354dda249ca7..7a8da09647a58 100644 --- a/packages/@aws-cdk/aws-events/lib/rule.ts +++ b/packages/@aws-cdk/aws-events/lib/rule.ts @@ -10,20 +10,20 @@ export interface EventRuleProps { /** * A description of the rule's purpose. */ - description?: string; + readonly description?: string; /** * A name for the rule. If you don't specify a name, AWS CloudFormation * generates a unique physical ID and uses that ID for the rule name. For * more information, see Name Type. */ - ruleName?: string; + readonly ruleName?: string; /** * Indicates whether the rule is enabled. * @default Rule is enabled */ - enabled?: boolean; + readonly enabled?: boolean; /** * The schedule or rate (frequency) that determines when CloudWatch Events @@ -34,7 +34,7 @@ export interface EventRuleProps { * * You must specify this property, the `eventPattern` property, or both. */ - scheduleExpression?: string; + readonly scheduleExpression?: string; /** * Describes which events CloudWatch Events routes to the specified target. @@ -49,7 +49,7 @@ export interface EventRuleProps { * method `addEventPattern` can be used to add filter values to the event * pattern. */ - eventPattern?: EventPattern; + readonly eventPattern?: EventPattern; /** * Targets to invoke when this rule matches an event. @@ -57,7 +57,7 @@ export interface EventRuleProps { * Input will be the full matched event. If you wish to specify custom * target input, use `addTarget(target[, inputOptions])`. */ - targets?: IEventRuleTarget[]; + readonly targets?: IEventRuleTarget[]; } /** diff --git a/packages/@aws-cdk/aws-events/lib/target.ts b/packages/@aws-cdk/aws-events/lib/target.ts index 0e191ea1401f5..f885562103f5c 100644 --- a/packages/@aws-cdk/aws-events/lib/target.ts +++ b/packages/@aws-cdk/aws-events/lib/target.ts @@ -6,12 +6,12 @@ export interface EventRuleTargetProps { * include alphanumeric characters, periods (.), hyphens (-), and * underscores (_). */ - id: string; + readonly id: string; /** * The Amazon Resource Name (ARN) of the target. */ - arn: string; + readonly arn: string; /** * The Amazon Resource Name (ARN) of the AWS Identity and Access Management @@ -19,26 +19,26 @@ export interface EventRuleTargetProps { * triggers multiple targets, you can use a different IAM role for each * target. */ - roleArn?: string; + readonly roleArn?: string; /** * The Amazon ECS task definition and task count to use, if the event target * is an Amazon ECS task. */ - ecsParameters?: CfnRule.EcsParametersProperty; + readonly ecsParameters?: CfnRule.EcsParametersProperty; /** * Settings that control shard assignment, when the target is a Kinesis * stream. If you don't include this parameter, eventId is used as the * partition key. */ - kinesisParameters?: CfnRule.KinesisParametersProperty; + readonly kinesisParameters?: CfnRule.KinesisParametersProperty; /** * Parameters used when the rule invokes Amazon EC2 Systems Manager Run * Command. */ - runCommandParameters?: CfnRule.RunCommandParametersProperty; + readonly runCommandParameters?: CfnRule.RunCommandParametersProperty; } /** diff --git a/packages/@aws-cdk/aws-glue/lib/data-format.ts b/packages/@aws-cdk/aws-glue/lib/data-format.ts index a617db32cee1e..db95b25133ff9 100644 --- a/packages/@aws-cdk/aws-glue/lib/data-format.ts +++ b/packages/@aws-cdk/aws-glue/lib/data-format.ts @@ -54,17 +54,17 @@ export interface DataFormat { /** * `InputFormat` for this data format. */ - inputFormat: InputFormat; + readonly inputFormat: InputFormat; /** * `OutputFormat` for this data format. */ - outputFormat: OutputFormat; + readonly outputFormat: OutputFormat; /** * Serialization library for this data format. */ - serializationLibrary: SerializationLibrary; + readonly serializationLibrary: SerializationLibrary; } export namespace DataFormat { diff --git a/packages/@aws-cdk/aws-glue/lib/database.ts b/packages/@aws-cdk/aws-glue/lib/database.ts index 8d44c65548b9b..6a8339dd0fd70 100644 --- a/packages/@aws-cdk/aws-glue/lib/database.ts +++ b/packages/@aws-cdk/aws-glue/lib/database.ts @@ -32,25 +32,25 @@ export interface IDatabase extends cdk.IConstruct { } export interface DatabaseImportProps { - catalogArn: string; - catalogId: string; - databaseArn: string; - databaseName: string; - locationUri: string; + readonly catalogArn: string; + readonly catalogId: string; + readonly databaseArn: string; + readonly databaseName: string; + readonly locationUri: string; } export interface DatabaseProps { /** * The name of the database. */ - databaseName: string; + readonly databaseName: string; /** * The location of the database (for example, an HDFS path). * * @default a bucket is created and the database is stored under s3:/// */ - locationUri?: string; + readonly locationUri?: string; } /** diff --git a/packages/@aws-cdk/aws-glue/lib/schema.ts b/packages/@aws-cdk/aws-glue/lib/schema.ts index a70313fa22721..3b256db5e7bfe 100644 --- a/packages/@aws-cdk/aws-glue/lib/schema.ts +++ b/packages/@aws-cdk/aws-glue/lib/schema.ts @@ -5,19 +5,19 @@ export interface Column { /** * Name of the column. */ - name: string; + readonly name: string; /** * Type of the column. */ - type: Type; + readonly type: Type; /** * Coment describing the column. * * @default none */ - comment?: string; + readonly comment?: string; } /** @@ -27,12 +27,12 @@ export interface Type { /** * Indicates whether this type is a primitive data type. */ - isPrimitive: boolean; + readonly isPrimitive: boolean; /** * Glue InputString for this type. */ - inputString: string; + readonly inputString: string; } /** diff --git a/packages/@aws-cdk/aws-glue/lib/table.ts b/packages/@aws-cdk/aws-glue/lib/table.ts index 553fcd80d9af8..b12e811b95b4a 100644 --- a/packages/@aws-cdk/aws-glue/lib/table.ts +++ b/packages/@aws-cdk/aws-glue/lib/table.ts @@ -50,65 +50,65 @@ export enum TableEncryption { } export interface TableImportProps { - tableArn: string; - tableName: string; + readonly tableArn: string; + readonly tableName: string; } export interface TableProps { /** * Name of the table. */ - tableName: string; + readonly tableName: string; /** * Description of the table. * * @default generated */ - description?: string; + readonly description?: string; /** * Database in which to store the table. */ - database: IDatabase; + readonly database: IDatabase; /** * S3 bucket in which to store data. * * @default one is created for you */ - bucket?: s3.IBucket; + readonly bucket?: s3.IBucket; /** * S3 prefix under which table objects are stored. * * @default data/ */ - s3Prefix?: string; + readonly s3Prefix?: string; /** * Columns of the table. */ - columns: Column[]; + readonly columns: Column[]; /** * Partition columns of the table. * * @default table is not partitioned */ - partitionKeys?: Column[] + readonly partitionKeys?: Column[] /** * Storage type of the table's data. */ - dataFormat: DataFormat; + readonly dataFormat: DataFormat; /** * Indicates whether the table's data is compressed or not. * * @default false */ - compressed?: boolean; + readonly compressed?: boolean; /** * The kind of encryption to secure the data with. @@ -120,7 +120,7 @@ export interface TableProps { * * @default Unencrypted */ - encryption?: TableEncryption; + readonly encryption?: TableEncryption; /** * External KMS key to use for bucket encryption. @@ -129,14 +129,14 @@ export interface TableProps { * * @default key is managed by KMS. */ - encryptionKey?: kms.IEncryptionKey; + readonly encryptionKey?: kms.IEncryptionKey; /** * Indicates whether the table data is stored in subdirectories. * * @default false */ - storedAsSubDirectories?: boolean; + readonly storedAsSubDirectories?: boolean; } /** diff --git a/packages/@aws-cdk/aws-iam/lib/group.ts b/packages/@aws-cdk/aws-iam/lib/group.ts index a8b82d68fab3f..4946acb61bdc4 100644 --- a/packages/@aws-cdk/aws-iam/lib/group.ts +++ b/packages/@aws-cdk/aws-iam/lib/group.ts @@ -18,20 +18,20 @@ export interface GroupProps { * * @default Generated by CloudFormation (recommended) */ - groupName?: string; + readonly groupName?: string; /** * A list of ARNs for managed policies associated with group. * @default No managed policies. */ - managedPolicyArns?: any[]; + readonly managedPolicyArns?: any[]; /** * The path to the group. For more information about paths, see [IAM * Identifiers](http://docs.aws.amazon.com/IAM/latest/UserGuide/index.html?Using_Identifiers.html) * in the IAM User Guide. */ - path?: string; + readonly path?: string; } export class Group extends Construct implements IPrincipal { diff --git a/packages/@aws-cdk/aws-iam/lib/policy-document.ts b/packages/@aws-cdk/aws-iam/lib/policy-document.ts index d761468b5643a..2072b164f5d32 100644 --- a/packages/@aws-cdk/aws-iam/lib/policy-document.ts +++ b/packages/@aws-cdk/aws-iam/lib/policy-document.ts @@ -496,5 +496,5 @@ export interface ServicePrincipalOpts { * * @default the current Stack's region. */ - region?: string; + readonly region?: string; } diff --git a/packages/@aws-cdk/aws-iam/lib/policy.ts b/packages/@aws-cdk/aws-iam/lib/policy.ts index bafc0c5d3f340..f6c329889cbbc 100644 --- a/packages/@aws-cdk/aws-iam/lib/policy.ts +++ b/packages/@aws-cdk/aws-iam/lib/policy.ts @@ -50,31 +50,31 @@ export interface PolicyProps { * @default Uses the logical ID of the policy resource, which is ensured to * be unique within the stack. */ - policyName?: string; + readonly policyName?: string; /** * Users to attach this policy to. * You can also use `attachToUser(user)` to attach this policy to a user. */ - users?: User[]; + readonly users?: User[]; /** * Roles to attach this policy to. * You can also use `attachToRole(role)` to attach this policy to a role. */ - roles?: IRole[]; + readonly roles?: IRole[]; /** * Groups to attach this policy to. * You can also use `attachToGroup(group)` to attach this policy to a group. */ - groups?: Group[]; + readonly groups?: Group[]; /** * Initial set of permissions to add to this policy document. * You can also use `addPermission(statement)` to add permissions later. */ - statements?: PolicyStatement[]; + readonly statements?: PolicyStatement[]; } /** diff --git a/packages/@aws-cdk/aws-iam/lib/role.ts b/packages/@aws-cdk/aws-iam/lib/role.ts index 4b7479abbc15b..a70f2e7b261e5 100644 --- a/packages/@aws-cdk/aws-iam/lib/role.ts +++ b/packages/@aws-cdk/aws-iam/lib/role.ts @@ -12,7 +12,7 @@ export interface RoleProps { * You can later modify the assume role policy document by accessing it via * the `assumeRolePolicy` property. */ - assumedBy: PolicyPrincipal; + readonly assumedBy: PolicyPrincipal; /** * ID that the role assumer needs to provide when assuming this role @@ -22,14 +22,14 @@ export interface RoleProps { * * @default No external ID required */ - externalId?: string; + readonly externalId?: string; /** * A list of ARNs for managed policies associated with this role. * You can add managed policies later using `attachManagedPolicy(arn)`. * @default No managed policies. */ - managedPolicyArns?: string[]; + readonly managedPolicyArns?: string[]; /** * A list of named policies to inline into this role. These policies will be @@ -38,13 +38,13 @@ export interface RoleProps { * dependencies that could otherwise be introduced). * @default No policy is inlined in the Role resource. */ - inlinePolicies?: { [name: string]: PolicyDocument }; + readonly inlinePolicies?: { [name: string]: PolicyDocument }; /** * The path associated with this role. For information about IAM paths, see * Friendly Names and Paths in IAM User Guide. */ - path?: string; + readonly path?: string; /** * A name for the IAM role. For valid values, see the RoleName parameter for @@ -60,7 +60,7 @@ export interface RoleProps { * acknowledge your template's capabilities. For more information, see * Acknowledging IAM Resources in AWS CloudFormation Templates. */ - roleName?: string; + readonly roleName?: string; /** * The maximum session duration (in seconds) that you want to set for the @@ -81,7 +81,7 @@ export interface RoleProps { * * @link https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_use.html */ - maxSessionDurationSec?: number; + readonly maxSessionDurationSec?: number; } /** @@ -287,7 +287,7 @@ export interface RoleImportProps { /** * The role's ARN */ - roleArn: string; + readonly roleArn: string; /** * The stable and unique string identifying the role. For example, @@ -296,7 +296,7 @@ export interface RoleImportProps { * @default If "roleId" is not specified for an imported role, then * `role.roleId` will throw an exception. In most cases, role ID is not really needed. */ - roleId?: string; + readonly roleId?: string; } /** diff --git a/packages/@aws-cdk/aws-iam/lib/user.ts b/packages/@aws-cdk/aws-iam/lib/user.ts index 9ddca09349783..a2b8850f52e00 100644 --- a/packages/@aws-cdk/aws-iam/lib/user.ts +++ b/packages/@aws-cdk/aws-iam/lib/user.ts @@ -10,20 +10,20 @@ export interface UserProps { * Groups to add this user to. You can also use `addToGroup` to add this * user to a group. */ - groups?: Group[]; + readonly groups?: Group[]; /** * A list of ARNs for managed policies attacherd to this user. * You can use `addManagedPolicy(arn)` to attach a managed policy to this user. * @default No managed policies. */ - managedPolicyArns?: any[]; + readonly managedPolicyArns?: any[]; /** * The path for the user name. For more information about paths, see IAM * Identifiers in the IAM User Guide. */ - path?: string; + readonly path?: string; /** * A name for the IAM user. For valid values, see the UserName parameter for @@ -41,7 +41,7 @@ export interface UserProps { * * @default Generated by CloudFormation (recommended) */ - userName?: string; + readonly userName?: string; /** * The password for the user. This is required so the user can access the @@ -49,7 +49,7 @@ export interface UserProps { * * @default User won't be able to access the management console without a password. */ - password?: string; + readonly password?: string; /** * Specifies whether the user is required to set a new password the next @@ -59,7 +59,7 @@ export interface UserProps { * * @default false */ - passwordResetRequired?: boolean; + readonly passwordResetRequired?: boolean; } export class User extends Construct implements IPrincipal { diff --git a/packages/@aws-cdk/aws-iam/test/test.role.ts b/packages/@aws-cdk/aws-iam/test/test.role.ts index b5c5d0c38c25d..c8a7a7d266976 100644 --- a/packages/@aws-cdk/aws-iam/test/test.role.ts +++ b/packages/@aws-cdk/aws-iam/test/test.role.ts @@ -1,4 +1,4 @@ -import { expect, haveResource, haveResourceLike } from '@aws-cdk/assert'; +import { expect, haveResource, haveResourceLike, SynthUtils } from '@aws-cdk/assert'; import { Stack } from '@aws-cdk/cdk'; import { Test } from 'nodeunit'; import { ArnPrincipal, CompositePrincipal, FederatedPrincipal, PolicyStatement, Role, ServicePrincipal, User } from '../lib'; @@ -87,10 +87,10 @@ export = { assumedBy: new ServicePrincipal('sns.amazonaws.com') }); - test.ok(!('MyRoleDefaultPolicyA36BE1DD' in stack._toCloudFormation().Resources), 'initially created without a policy'); + test.ok(!('MyRoleDefaultPolicyA36BE1DD' in SynthUtils.toCloudFormation(stack).Resources), 'initially created without a policy'); role.addToPolicy(new PolicyStatement().addResource('myresource').addAction('myaction')); - test.ok(stack._toCloudFormation().Resources.MyRoleDefaultPolicyA36BE1DD, 'policy resource created'); + test.ok(SynthUtils.toCloudFormation(stack).Resources.MyRoleDefaultPolicyA36BE1DD, 'policy resource created'); expect(stack).toMatch({ Resources: { MyRoleF48FFE04: diff --git a/packages/@aws-cdk/aws-kinesis/lib/stream.ts b/packages/@aws-cdk/aws-kinesis/lib/stream.ts index 4a79da7e65ca1..c48d0b7cabbd3 100644 --- a/packages/@aws-cdk/aws-kinesis/lib/stream.ts +++ b/packages/@aws-cdk/aws-kinesis/lib/stream.ts @@ -62,12 +62,12 @@ export interface StreamImportProps { /** * The ARN of the stream. */ - streamArn: string; + readonly streamArn: string; /** * The KMS key securing the contents of the stream if encryption is enabled. */ - encryptionKey?: kms.EncryptionKeyImportProps; + readonly encryptionKey?: kms.EncryptionKeyImportProps; } /** @@ -273,19 +273,19 @@ export interface StreamProps { * Enforces a particular physical stream name. * @default */ - streamName?: string; + readonly streamName?: string; /** * The number of hours for the data records that are stored in shards to remain accessible. * @default 24 */ - retentionPeriodHours?: number; + readonly retentionPeriodHours?: number; /** * The number of shards for the stream. * @default 1 */ - shardCount?: number; + readonly shardCount?: number; /** * The kind of server-side encryption to apply to this stream. @@ -295,7 +295,7 @@ export interface StreamProps { * * @default Unencrypted */ - encryption?: StreamEncryption; + readonly encryption?: StreamEncryption; /** * External KMS key to use for stream encryption. @@ -305,7 +305,7 @@ export interface StreamProps { * @default If encryption is set to "Kms" and this property is undefined, a * new KMS key will be created and associated with this stream. */ - encryptionKey?: kms.IEncryptionKey; + readonly encryptionKey?: kms.IEncryptionKey; } /** diff --git a/packages/@aws-cdk/aws-kms/lib/alias.ts b/packages/@aws-cdk/aws-kms/lib/alias.ts index d0a522a0b9748..d0a47a5922734 100644 --- a/packages/@aws-cdk/aws-kms/lib/alias.ts +++ b/packages/@aws-cdk/aws-kms/lib/alias.ts @@ -11,14 +11,14 @@ export interface EncryptionKeyAliasProps { * forward slash, such as alias/. You can't specify aliases that begin with * alias/AWS. These aliases are reserved. */ - alias: string; + readonly alias: string; /** * The ID of the key for which you are creating the alias. Specify the key's * globally unique identifier or Amazon Resource Name (ARN). You can't * specify another alias. */ - key: IEncryptionKey; + readonly key: IEncryptionKey; } /** diff --git a/packages/@aws-cdk/aws-kms/lib/key.ts b/packages/@aws-cdk/aws-kms/lib/key.ts index 6e773948d14f6..dfd8b010f4870 100644 --- a/packages/@aws-cdk/aws-kms/lib/key.ts +++ b/packages/@aws-cdk/aws-kms/lib/key.ts @@ -34,7 +34,7 @@ export interface EncryptionKeyImportProps { /** * The ARN of the external KMS key. */ - keyArn: string; + readonly keyArn: string; } export abstract class EncryptionKeyBase extends Construct implements IEncryptionKey { @@ -85,19 +85,19 @@ export interface EncryptionKeyProps { * A description of the key. Use a description that helps your users decide * whether the key is appropriate for a particular task. */ - description?: string; + readonly description?: string; /** * Indicates whether AWS KMS rotates the key. * @default false */ - enableKeyRotation?: boolean; + readonly enableKeyRotation?: boolean; /** * Indicates whether the key is available for use. * @default Key is enabled */ - enabled?: boolean; + readonly enabled?: boolean; /** * Custom policy document to attach to the KMS key. @@ -105,7 +105,7 @@ export interface EncryptionKeyProps { * @default A policy document with permissions for the account root to * administer the key will be created. */ - policy?: PolicyDocument; + readonly policy?: PolicyDocument; /** * Whether the encryption key should be retained when it is removed from the Stack. This is useful when one wants to @@ -113,7 +113,7 @@ export interface EncryptionKeyProps { * * @default true */ - retain?: boolean; + readonly retain?: boolean; } /** diff --git a/packages/@aws-cdk/aws-lambda-event-sources/lib/dynamodb.ts b/packages/@aws-cdk/aws-lambda-event-sources/lib/dynamodb.ts index e1b8ac388f3c3..46678640f36ce 100644 --- a/packages/@aws-cdk/aws-lambda-event-sources/lib/dynamodb.ts +++ b/packages/@aws-cdk/aws-lambda-event-sources/lib/dynamodb.ts @@ -11,12 +11,12 @@ export interface DynamoEventSourceProps { * * @default 100 */ - batchSize?: number; + readonly batchSize?: number; /** * Where to begin consuming the DynamoDB stream. */ - startingPosition: lambda.StartingPosition; + readonly startingPosition: lambda.StartingPosition; } /** diff --git a/packages/@aws-cdk/aws-lambda-event-sources/lib/kinesis.ts b/packages/@aws-cdk/aws-lambda-event-sources/lib/kinesis.ts index 0c495eab819ea..db015ffcc7cad 100644 --- a/packages/@aws-cdk/aws-lambda-event-sources/lib/kinesis.ts +++ b/packages/@aws-cdk/aws-lambda-event-sources/lib/kinesis.ts @@ -11,12 +11,12 @@ export interface KinesisEventSourceProps { * * @default 100 */ - batchSize?: number; + readonly batchSize?: number; /** * Where to begin consuming the Kinesis stream. */ - startingPosition: lambda.StartingPosition; + readonly startingPosition: lambda.StartingPosition; } /** diff --git a/packages/@aws-cdk/aws-lambda-event-sources/lib/s3.ts b/packages/@aws-cdk/aws-lambda-event-sources/lib/s3.ts index 49e4fe8e9d4a9..be8a2253caf75 100644 --- a/packages/@aws-cdk/aws-lambda-event-sources/lib/s3.ts +++ b/packages/@aws-cdk/aws-lambda-event-sources/lib/s3.ts @@ -5,7 +5,7 @@ export interface S3EventSourceProps { /** * The s3 event types that will trigger the notification. */ - events: s3.EventType[]; + readonly events: s3.EventType[]; /** * S3 object key filter rules to determine which objects trigger this event. @@ -13,7 +13,7 @@ export interface S3EventSourceProps { * against the s3 object key. Refer to the S3 Developer Guide for details * about allowed filter rules. */ - filters?: s3.NotificationKeyFilter[]; + readonly filters?: s3.NotificationKeyFilter[]; } /** diff --git a/packages/@aws-cdk/aws-lambda-event-sources/lib/sqs.ts b/packages/@aws-cdk/aws-lambda-event-sources/lib/sqs.ts index a02dd4fb430fb..5206fce5cae05 100644 --- a/packages/@aws-cdk/aws-lambda-event-sources/lib/sqs.ts +++ b/packages/@aws-cdk/aws-lambda-event-sources/lib/sqs.ts @@ -11,7 +11,7 @@ export interface SqsEventSourceProps { * * @default 10 */ - batchSize?: number; + readonly batchSize?: number; } /** diff --git a/packages/@aws-cdk/aws-lambda/lib/alias.ts b/packages/@aws-cdk/aws-lambda/lib/alias.ts index 15c4818102c05..4fec3458a5f07 100644 --- a/packages/@aws-cdk/aws-lambda/lib/alias.ts +++ b/packages/@aws-cdk/aws-lambda/lib/alias.ts @@ -14,19 +14,19 @@ export interface AliasProps { * * @default No description */ - description?: string; + readonly description?: string; /** * Function version this alias refers to * * Use lambda.addVersion() to obtain a new lambda version to refer to. */ - version: Version; + readonly version: Version; /** * Name of this alias */ - aliasName: string; + readonly aliasName: string; /** * Additional versions with individual weights this alias points to @@ -45,7 +45,7 @@ export interface AliasProps { * * @default No additional versions */ - additionalVersions?: VersionWeight[]; + readonly additionalVersions?: VersionWeight[]; } /** diff --git a/packages/@aws-cdk/aws-lambda/lib/code.ts b/packages/@aws-cdk/aws-lambda/lib/code.ts index 3ebee37f33b62..4eaf5ef069bc6 100644 --- a/packages/@aws-cdk/aws-lambda/lib/code.ts +++ b/packages/@aws-cdk/aws-lambda/lib/code.ts @@ -60,6 +60,8 @@ export abstract class Code { * Lambda function. * * @param resource the resource to which the code will be attached (a CfnFunction, or a CfnLayerVersion). + * + * @internal */ public abstract _toJSON(resource?: cdk.CfnResource): CfnFunction.CodeProperty; @@ -89,6 +91,9 @@ export class S3Code extends Code { this.bucketName = bucket.bucketName; } + /** + * @internal + */ public _toJSON(_?: cdk.CfnResource): CfnFunction.CodeProperty { return { s3Bucket: this.bucketName, @@ -119,6 +124,9 @@ export class InlineCode extends Code { } } + /** + * @internal + */ public _toJSON(_?: cdk.CfnResource): CfnFunction.CodeProperty { return { zipFile: this.code @@ -169,6 +177,9 @@ export class AssetCode extends Code { } } + /** + * @internal + */ public _toJSON(resource?: cdk.CfnResource): CfnFunction.CodeProperty { if (resource) { // https://github.com/awslabs/aws-cdk/issues/1432 diff --git a/packages/@aws-cdk/aws-lambda/lib/event-source-mapping.ts b/packages/@aws-cdk/aws-lambda/lib/event-source-mapping.ts index 5c75e956d3daf..d22c53dbc3efc 100644 --- a/packages/@aws-cdk/aws-lambda/lib/event-source-mapping.ts +++ b/packages/@aws-cdk/aws-lambda/lib/event-source-mapping.ts @@ -7,12 +7,12 @@ export interface EventSourceMappingProps { * The Amazon Resource Name (ARN) of the event source. Any record added to * this stream can invoke the Lambda function. */ - eventSourceArn: string; + readonly eventSourceArn: string; /** * The target AWS Lambda function. */ - target: IFunction; + readonly target: IFunction; /** * The largest number of records that AWS Lambda will retrieve from your event @@ -24,14 +24,14 @@ export interface EventSourceMappingProps { * @default The default for Amazon Kinesis and Amazon DynamoDB is 100 records. * Both the default and maximum for Amazon SQS are 10 messages. */ - batchSize?: number; + readonly batchSize?: number; /** * Set to false to disable the event source upon creation. * * @default true */ - enabled?: boolean; + readonly enabled?: boolean; /** * The position in the DynamoDB or Kinesis stream where AWS Lambda should @@ -39,7 +39,7 @@ export interface EventSourceMappingProps { * * @see https://docs.aws.amazon.com/kinesis/latest/APIReference/API_GetShardIterator.html#Kinesis-GetShardIterator-request-ShardIteratorType */ - startingPosition?: StartingPosition + readonly startingPosition?: StartingPosition } /** diff --git a/packages/@aws-cdk/aws-lambda/lib/function-base.ts b/packages/@aws-cdk/aws-lambda/lib/function-base.ts index 06e42ea0f4599..fecfcd7b49f11 100644 --- a/packages/@aws-cdk/aws-lambda/lib/function-base.ts +++ b/packages/@aws-cdk/aws-lambda/lib/function-base.ts @@ -105,14 +105,14 @@ export interface FunctionImportProps { * * Format: arn::lambda:::function: */ - functionArn: string; + readonly functionArn: string; /** * The IAM execution role associated with this function. * * If the role is not specified, any role-related operations will no-op. */ - role?: iam.IRole; + readonly role?: iam.IRole; /** * Id of the securityGroup for this Lambda, if in a VPC. @@ -120,7 +120,7 @@ export interface FunctionImportProps { * This needs to be given in order to support allowing connections * to this Lambda. */ - securityGroupId?: string; + readonly securityGroupId?: string; } export abstract class FunctionBase extends cdk.Construct implements IFunction { @@ -151,6 +151,7 @@ export abstract class FunctionBase extends cdk.Construct implements IFunction { * Actual connections object for this Lambda * * May be unset, in which case this Lambda is not configured use in a VPC. + * @internal */ protected _connections?: ec2.Connections; diff --git a/packages/@aws-cdk/aws-lambda/lib/function.ts b/packages/@aws-cdk/aws-lambda/lib/function.ts index 1ef51384bc6ca..c266bae6cc922 100644 --- a/packages/@aws-cdk/aws-lambda/lib/function.ts +++ b/packages/@aws-cdk/aws-lambda/lib/function.ts @@ -37,12 +37,12 @@ export interface FunctionProps { * Amazon Simple Storage Service (Amazon S3) bucket or specify your source * code as inline text. */ - code: Code; + readonly code: Code; /** * A description of the function. */ - description?: string; + readonly description?: string; /** * The name of the function (within your source code) that Lambda calls to @@ -53,7 +53,7 @@ export interface FunctionProps { * ZipFile property within the Code property, specify index.function_name as * the handler. */ - handler: string; + readonly handler: string; /** * The function execution time (in seconds) after which Lambda terminates @@ -62,7 +62,7 @@ export interface FunctionProps { * * @default 3 seconds. */ - timeout?: number; + readonly timeout?: number; /** * Key-value pairs that Lambda caches and makes available for your Lambda @@ -70,21 +70,21 @@ export interface FunctionProps { * as test and production environment configurations, without changing your * Lambda function source code. */ - environment?: { [key: string]: any }; + readonly environment?: { [key: string]: any }; /** * The runtime environment for the Lambda function that you are uploading. * For valid values, see the Runtime property in the AWS Lambda Developer * Guide. */ - runtime: Runtime; + readonly runtime: Runtime; /** * A name for the function. If you don't specify a name, AWS CloudFormation * generates a unique physical ID and uses that ID for the function's name. * For more information, see Name Type. */ - functionName?: string; + readonly functionName?: string; /** * The amount of memory, in MB, that is allocated to your Lambda function. @@ -94,14 +94,14 @@ export interface FunctionProps { * * @default The default value is 128 MB */ - memorySize?: number; + readonly memorySize?: number; /** * Initial policy statements to add to the created Lambda Role. * * You can call `addToRolePolicy` to the created lambda to add statements post creation. */ - initialPolicy?: iam.PolicyStatement[]; + readonly initialPolicy?: iam.PolicyStatement[]; /** * Lambda execution role. @@ -113,14 +113,14 @@ export interface FunctionProps { * @default a unique role will be generated for this lambda function. * Both supplied and generated roles can always be changed by calling `addToRolePolicy`. */ - role?: iam.IRole; + readonly role?: iam.IRole; /** * VPC network to place Lambda network interfaces * * Specify this if the Lambda function needs to access resources in a VPC. */ - vpc?: ec2.IVpcNetwork; + readonly vpc?: ec2.IVpcNetwork; /** * Where to place the network interfaces within the VPC. @@ -130,7 +130,7 @@ export interface FunctionProps { * * @default All private subnets */ - vpcSubnets?: ec2.SubnetSelection; + readonly vpcSubnets?: ec2.SubnetSelection; /** * What security group to associate with the Lambda's network interfaces. @@ -141,7 +141,7 @@ export interface FunctionProps { * not specified, a dedicated security group will be created for this * function. */ - securityGroup?: ec2.ISecurityGroup; + readonly securityGroup?: ec2.ISecurityGroup; /** * Whether to allow the Lambda to send all network traffic @@ -151,7 +151,7 @@ export interface FunctionProps { * * @default true */ - allowAllOutbound?: boolean; + readonly allowAllOutbound?: boolean; /** * Enabled DLQ. If `deadLetterQueue` is undefined, @@ -159,21 +159,21 @@ export interface FunctionProps { * * @default false unless `deadLetterQueue` is set, which implies DLQ is enabled */ - deadLetterQueueEnabled?: boolean; + readonly deadLetterQueueEnabled?: boolean; /** * The SQS queue to use if DLQ is enabled. * * @default SQS queue with 14 day retention period if `deadLetterQueueEnabled` is `true` */ - deadLetterQueue?: sqs.IQueue; + readonly deadLetterQueue?: sqs.IQueue; /** * Enable AWS X-Ray Tracing for Lambda Function. * * @default undefined X-Ray tracing disabled */ - tracing?: Tracing; + readonly tracing?: Tracing; /** * A list of layers to add to the function's execution environment. You can configure your Lambda function to pull in @@ -182,7 +182,7 @@ export interface FunctionProps { * * @default no layers */ - layers?: ILayerVersion[]; + readonly layers?: ILayerVersion[]; /** * The maximum of concurrent executions you want to reserve for the function. @@ -190,14 +190,14 @@ export interface FunctionProps { * @default no specific limit - account limit * @see https://docs.aws.amazon.com/lambda/latest/dg/concurrent-executions.html */ - reservedConcurrentExecutions?: number; + readonly reservedConcurrentExecutions?: number; /** * Event sources for this function. * * You can also add event sources using `addEventSource`. */ - events?: IEventSource[]; + readonly events?: IEventSource[]; } /** diff --git a/packages/@aws-cdk/aws-lambda/lib/lambda-version.ts b/packages/@aws-cdk/aws-lambda/lib/lambda-version.ts index 8470d9d0e3451..de1e1924bd569 100644 --- a/packages/@aws-cdk/aws-lambda/lib/lambda-version.ts +++ b/packages/@aws-cdk/aws-lambda/lib/lambda-version.ts @@ -13,19 +13,19 @@ export interface VersionProps { * * @default No validation is performed */ - codeSha256?: string; + readonly codeSha256?: string; /** * Description of the version * * @default Description of the Lambda */ - description?: string; + readonly description?: string; /** * Function to get the value of */ - lambda: IFunction; + readonly lambda: IFunction; } /** diff --git a/packages/@aws-cdk/aws-lambda/lib/layers.ts b/packages/@aws-cdk/aws-lambda/lib/layers.ts index b42cd8930403d..43d9d7979976c 100644 --- a/packages/@aws-cdk/aws-lambda/lib/layers.ts +++ b/packages/@aws-cdk/aws-lambda/lib/layers.ts @@ -9,30 +9,30 @@ export interface LayerVersionProps { * * @default All runtimes are supported */ - compatibleRuntimes?: Runtime[]; + readonly compatibleRuntimes?: Runtime[]; /** * The content of this Layer. Using *inline* (per ``code.isInline``) code is not permitted. */ - code: Code; + readonly code: Code; /** * The description the this Lambda Layer. */ - description?: string; + readonly description?: string; /** * The SPDX licence identifier or URL to the license file for this layer. * * @default no license information will be recorded. */ - license?: string; + readonly license?: string; /** * The name of the layer. * @default a name will be generated. */ - name?: string; + readonly name?: string; } export interface ILayerVersion extends cdk.IConstruct { @@ -101,14 +101,14 @@ export interface LayerVersionUsageGrantee { * The AWS Account id of the account that is authorized to use a Lambda Layer Version. The wild-card ``'*'`` can be * used to grant access to "any" account (or any account in an organization when ``organizationId`` is specified). */ - accountId: string; + readonly accountId: string; /** * The ID of the AWS Organization to hwich the grant is restricted. * * Can only be specified if ``accountId`` is ``'*'`` */ - organizationId?: string; + readonly organizationId?: string; } /** @@ -118,12 +118,12 @@ export interface LayerVersionImportProps { /** * The ARN of the LayerVersion. */ - layerVersionArn: string; + readonly layerVersionArn: string; /** * The list of compatible runtimes with this Layer. */ - compatibleRuntimes?: Runtime[]; + readonly compatibleRuntimes?: Runtime[]; } /** @@ -194,7 +194,7 @@ export interface SingletonLayerVersionProps extends LayerVersionProps { * The identifier should be unique across all layer providers. * We recommend generating a UUID per provider. */ - uuid: string; + readonly uuid: string; } /** diff --git a/packages/@aws-cdk/aws-lambda/lib/permission.ts b/packages/@aws-cdk/aws-lambda/lib/permission.ts index de4ab91c6794d..44c4ac725d582 100644 --- a/packages/@aws-cdk/aws-lambda/lib/permission.ts +++ b/packages/@aws-cdk/aws-lambda/lib/permission.ts @@ -14,7 +14,7 @@ export interface Permission { * * @default 'lambda:InvokeFunction' */ - action?: string; + readonly action?: string; /** * A unique token that must be supplied by the principal invoking the @@ -22,7 +22,7 @@ export interface Permission { * * @default The caller would not need to present a token. */ - eventSourceToken?: string; + readonly eventSourceToken?: string; /** * The entity for which you are granting permission to invoke the Lambda @@ -34,7 +34,7 @@ export interface Permission { * * The principal can be either an AccountPrincipal or a ServicePrincipal. */ - principal: PolicyPrincipal; + readonly principal: PolicyPrincipal; /** * The AWS account ID (without hyphens) of the source owner. For example, if @@ -42,7 +42,7 @@ export interface Permission { * bucket owner's account ID. You can use this property to ensure that all * source principals are owned by a specific account. */ - sourceAccount?: string; + readonly sourceAccount?: string; /** * The ARN of a resource that is invoking your function. When granting @@ -52,5 +52,5 @@ export interface Permission { * any bucket from any AWS account that creates a mapping to your function, * can invoke the function. */ - sourceArn?: string; + readonly sourceArn?: string; } diff --git a/packages/@aws-cdk/aws-lambda/lib/pipeline-action.ts b/packages/@aws-cdk/aws-lambda/lib/pipeline-action.ts index e7dcb4c447a40..017b044360049 100644 --- a/packages/@aws-cdk/aws-lambda/lib/pipeline-action.ts +++ b/packages/@aws-cdk/aws-lambda/lib/pipeline-action.ts @@ -21,7 +21,7 @@ export interface CommonPipelineInvokeActionProps extends codepipeline.CommonActi * @default the Action will not have any inputs * @see https://docs.aws.amazon.com/codepipeline/latest/userguide/actions-invoke-lambda-function.html#actions-invoke-lambda-function-json-event-example */ - inputArtifacts?: codepipeline.Artifact[]; + readonly inputArtifacts?: codepipeline.Artifact[]; // tslint:enable:max-line-length @@ -34,7 +34,7 @@ export interface CommonPipelineInvokeActionProps extends codepipeline.CommonActi * * @default the Action will not have any outputs */ - outputArtifactNames?: string[]; + readonly outputArtifactNames?: string[]; /** * String to be used in the event data parameter passed to the Lambda @@ -44,7 +44,7 @@ export interface CommonPipelineInvokeActionProps extends codepipeline.CommonActi * * https://docs.aws.amazon.com/codepipeline/latest/userguide/actions-invoke-lambda-function.html#actions-invoke-lambda-function-json-event-example */ - userParameters?: any; + readonly userParameters?: any; /** * Adds the "codepipeline:PutJobSuccessResult" and @@ -61,7 +61,7 @@ export interface CommonPipelineInvokeActionProps extends codepipeline.CommonActi * * @default true */ - addPutJobResultPolicy?: boolean; + readonly addPutJobResultPolicy?: boolean; } /** @@ -71,7 +71,7 @@ export interface PipelineInvokeActionProps extends CommonPipelineInvokeActionPro /** * The lambda function to invoke. */ - lambda: IFunction; + readonly lambda: IFunction; } /** @@ -108,11 +108,13 @@ export class PipelineInvokeAction extends codepipeline.Action { } public outputArtifacts(): codepipeline.Artifact[] { - return this._outputArtifacts; + // TODO: revert "as any" once we merge all actions into a single package + return (this as any)._outputArtifacts; } public outputArtifact(artifactName: string): codepipeline.Artifact { - const result = this._outputArtifacts.find(a => (a.artifactName === artifactName)); + // TODO: revert "as any" once we merge all actions into a single package + const result = (this as any)._outputArtifacts.find((a: any) => (a.artifactName === artifactName)); if (result === undefined) { throw new Error(`Could not find the output Artifact with name '${artifactName}'`); } else { diff --git a/packages/@aws-cdk/aws-lambda/lib/runtime.ts b/packages/@aws-cdk/aws-lambda/lib/runtime.ts index 2de0a98e9bcaf..23c4ec38f01e2 100644 --- a/packages/@aws-cdk/aws-lambda/lib/runtime.ts +++ b/packages/@aws-cdk/aws-lambda/lib/runtime.ts @@ -3,7 +3,7 @@ export interface LambdaRuntimeProps { * Whether the ``ZipFile`` (aka inline code) property can be used with this runtime. * @default false */ - supportsInlineCode?: boolean; + readonly supportsInlineCode?: boolean; } export enum RuntimeFamily { diff --git a/packages/@aws-cdk/aws-lambda/lib/singleton-lambda.ts b/packages/@aws-cdk/aws-lambda/lib/singleton-lambda.ts index 9b00fbda319f9..2860c3e2456d5 100644 --- a/packages/@aws-cdk/aws-lambda/lib/singleton-lambda.ts +++ b/packages/@aws-cdk/aws-lambda/lib/singleton-lambda.ts @@ -14,7 +14,7 @@ export interface SingletonFunctionProps extends FunctionProps { * The identifier should be unique across all custom resource providers. * We recommend generating a UUID per provider. */ - uuid: string; + readonly uuid: string; /** * A descriptive name for the purpose of this Lambda. @@ -25,7 +25,7 @@ export interface SingletonFunctionProps extends FunctionProps { * * @default SingletonLambda */ - lambdaPurpose?: string; + readonly lambdaPurpose?: string; } /** diff --git a/packages/@aws-cdk/aws-logs/lib/cross-account-destination.ts b/packages/@aws-cdk/aws-logs/lib/cross-account-destination.ts index c67852c02a381..b14448e2c7afd 100644 --- a/packages/@aws-cdk/aws-logs/lib/cross-account-destination.ts +++ b/packages/@aws-cdk/aws-logs/lib/cross-account-destination.ts @@ -10,19 +10,19 @@ export interface CrossAccountDestinationProps { * * @default Automatically generated */ - destinationName?: string; + readonly destinationName?: string; /** * The role to assume that grants permissions to write to 'target'. * * The role must be assumable by 'logs.{REGION}.amazonaws.com'. */ - role: iam.Role; + readonly role: iam.Role; /** * The log destination target's ARN */ - targetArn: string; + readonly targetArn: string; } /** diff --git a/packages/@aws-cdk/aws-logs/lib/log-group.ts b/packages/@aws-cdk/aws-logs/lib/log-group.ts index c0df6719e0cc6..a5c3a080b64c6 100644 --- a/packages/@aws-cdk/aws-logs/lib/log-group.ts +++ b/packages/@aws-cdk/aws-logs/lib/log-group.ts @@ -81,7 +81,7 @@ export interface ILogGroup extends cdk.IConstruct { * Properties for importing a LogGroup */ export interface LogGroupImportProps { - logGroupArn: string; + readonly logGroupArn: string; } /** @@ -198,7 +198,7 @@ export interface LogGroupProps { * * @default Automatically generated */ - logGroupName?: string; + readonly logGroupName?: string; /** * How long, in days, the log contents will be retained. @@ -207,7 +207,7 @@ export interface LogGroupProps { * * @default 731 days (2 years) */ - retentionDays?: number; + readonly retentionDays?: number; /** * Retain the log group if the stack or containing construct ceases to exist @@ -219,7 +219,7 @@ export interface LogGroupProps { * * @default true */ - retainLogGroup?: boolean; + readonly retainLogGroup?: boolean; } /** @@ -317,7 +317,7 @@ export interface NewLogStreamProps { * * @default Automatically generated */ - logStreamName?: string; + readonly logStreamName?: string; } /** @@ -329,12 +329,12 @@ export interface NewSubscriptionFilterProps { * * For example, a Kinesis stream or a Lambda function. */ - destination: ILogSubscriptionDestination; + readonly destination: ILogSubscriptionDestination; /** * Log events matching this pattern will be sent to the destination. */ - filterPattern: IFilterPattern; + readonly filterPattern: IFilterPattern; } /** @@ -344,17 +344,17 @@ export interface NewMetricFilterProps { /** * Pattern to search for log events. */ - filterPattern: IFilterPattern; + readonly filterPattern: IFilterPattern; /** * The namespace of the metric to emit. */ - metricNamespace: string; + readonly metricNamespace: string; /** * The name of the metric to emit. */ - metricName: string; + readonly metricName: string; /** * The value to emit for the metric. @@ -371,12 +371,12 @@ export interface NewMetricFilterProps { * * @default "1" */ - metricValue?: string; + readonly metricValue?: string; /** * The value to emit if the pattern does not match a particular event. * * @default No metric emitted. */ - defaultValue?: number; + readonly defaultValue?: number; } diff --git a/packages/@aws-cdk/aws-logs/lib/log-stream.ts b/packages/@aws-cdk/aws-logs/lib/log-stream.ts index a40885e430f63..2e4d1772d1526 100644 --- a/packages/@aws-cdk/aws-logs/lib/log-stream.ts +++ b/packages/@aws-cdk/aws-logs/lib/log-stream.ts @@ -18,7 +18,7 @@ export interface ILogStream extends cdk.IConstruct { * Properties for importing a LogStream */ export interface LogStreamImportProps { - logStreamName: string; + readonly logStreamName: string; } /** @@ -28,7 +28,7 @@ export interface LogStreamProps { /** * The log group to create a log stream for. */ - logGroup: ILogGroup; + readonly logGroup: ILogGroup; /** * The name of the log stream to create. @@ -37,7 +37,7 @@ export interface LogStreamProps { * * @default Automatically generated */ - logStreamName?: string; + readonly logStreamName?: string; /** * Retain the log stream if the stack or containing construct ceases to exist @@ -50,7 +50,7 @@ export interface LogStreamProps { * * @default true */ - retainLogStream?: boolean; + readonly retainLogStream?: boolean; } /** diff --git a/packages/@aws-cdk/aws-logs/lib/metric-filter.ts b/packages/@aws-cdk/aws-logs/lib/metric-filter.ts index b8cfb2832d1d7..eb335d5f8fb6d 100644 --- a/packages/@aws-cdk/aws-logs/lib/metric-filter.ts +++ b/packages/@aws-cdk/aws-logs/lib/metric-filter.ts @@ -10,22 +10,22 @@ export interface MetricFilterProps { /** * The log group to create the filter on. */ - logGroup: ILogGroup; + readonly logGroup: ILogGroup; /** * Pattern to search for log events. */ - filterPattern: IFilterPattern; + readonly filterPattern: IFilterPattern; /** * The namespace of the metric to emit. */ - metricNamespace: string; + readonly metricNamespace: string; /** * The name of the metric to emit. */ - metricName: string; + readonly metricName: string; /** * The value to emit for the metric. @@ -42,14 +42,14 @@ export interface MetricFilterProps { * * @default "1" */ - metricValue?: string; + readonly metricValue?: string; /** * The value to emit if the pattern does not match a particular event. * * @default No metric emitted. */ - defaultValue?: number; + readonly defaultValue?: number; } /** diff --git a/packages/@aws-cdk/aws-logs/lib/pattern.ts b/packages/@aws-cdk/aws-logs/lib/pattern.ts index b2f18fe32d2b6..f667bd679787a 100644 --- a/packages/@aws-cdk/aws-logs/lib/pattern.ts +++ b/packages/@aws-cdk/aws-logs/lib/pattern.ts @@ -371,21 +371,21 @@ export interface ColumnRestriction { /** * Comparison operator to use */ - comparison: string; + readonly comparison: string; /** * String value to compare to * * Exactly one of 'stringValue' and 'numberValue' must be set. */ - stringValue?: string; + readonly stringValue?: string; /** * Number value to compare to * * Exactly one of 'stringValue' and 'numberValue' must be set. */ - numberValue?: number; + readonly numberValue?: number; } /** diff --git a/packages/@aws-cdk/aws-logs/lib/subscription-filter.ts b/packages/@aws-cdk/aws-logs/lib/subscription-filter.ts index f6c9528777e3f..a0d6ebae5f117 100644 --- a/packages/@aws-cdk/aws-logs/lib/subscription-filter.ts +++ b/packages/@aws-cdk/aws-logs/lib/subscription-filter.ts @@ -45,19 +45,19 @@ export interface SubscriptionFilterProps { /** * The log group to create the subscription on. */ - logGroup: ILogGroup; + readonly logGroup: ILogGroup; /** * The destination to send the filtered events to. * * For example, a Kinesis stream or a Lambda function. */ - destination: ILogSubscriptionDestination; + readonly destination: ILogSubscriptionDestination; /** * Log events matching this pattern will be sent to the destination. */ - filterPattern: IFilterPattern; + readonly filterPattern: IFilterPattern; } /** diff --git a/packages/@aws-cdk/aws-quickstarts/lib/database.ts b/packages/@aws-cdk/aws-quickstarts/lib/database.ts index 4b142bb413c15..d9fc933f5e1b0 100644 --- a/packages/@aws-cdk/aws-quickstarts/lib/database.ts +++ b/packages/@aws-cdk/aws-quickstarts/lib/database.ts @@ -3,14 +3,14 @@ import rds = require('@aws-cdk/aws-rds'); import cdk = require('@aws-cdk/cdk'); export interface SqlServerProps { - instanceClass?: string; - engine?: string; - engineVersion?: string; - licenseModel?: string; - masterUsername: string; - masterPassword: string; - allocatedStorage?: number; - vpc: ec2.IVpcNetwork; + readonly instanceClass?: string; + readonly engine?: string; + readonly engineVersion?: string; + readonly licenseModel?: string; + readonly masterUsername: string; + readonly masterPassword: string; + readonly allocatedStorage?: number; + readonly vpc: ec2.IVpcNetwork; } /** diff --git a/packages/@aws-cdk/aws-quickstarts/lib/rdgw.ts b/packages/@aws-cdk/aws-quickstarts/lib/rdgw.ts index 4d959b272138a..ae4912f7beb12 100644 --- a/packages/@aws-cdk/aws-quickstarts/lib/rdgw.ts +++ b/packages/@aws-cdk/aws-quickstarts/lib/rdgw.ts @@ -3,18 +3,18 @@ import ec2 = require('@aws-cdk/aws-ec2'); import cdk = require('@aws-cdk/cdk'); export interface RemoteDesktopGatewayProps { - rdgwCIDR: string; - vpc: ec2.IVpcNetwork; - keyPairName: string; - - adminPassword: string; - adminUser?: string; - - domainDNSName?: string; - numberOfRDGWHosts?: number; - qss3BucketName?: string; - qss3KeyPrefix?: string; - rdgwInstanceType?: string; + readonly rdgwCIDR: string; + readonly vpc: ec2.IVpcNetwork; + readonly keyPairName: string; + + readonly adminPassword: string; + readonly adminUser?: string; + + readonly domainDNSName?: string; + readonly numberOfRDGWHosts?: number; + readonly qss3BucketName?: string; + readonly qss3KeyPrefix?: string; + readonly rdgwInstanceType?: string; } /** diff --git a/packages/@aws-cdk/aws-rds/lib/cluster-parameter-group.ts b/packages/@aws-cdk/aws-rds/lib/cluster-parameter-group.ts index 55ccfabf5fb60..3f8338a770409 100644 --- a/packages/@aws-cdk/aws-rds/lib/cluster-parameter-group.ts +++ b/packages/@aws-cdk/aws-rds/lib/cluster-parameter-group.ts @@ -21,7 +21,7 @@ export interface IClusterParameterGroup extends cdk.IConstruct { * Properties to reference a cluster parameter group */ export interface ClusterParameterGroupImportProps { - parameterGroupName: string; + readonly parameterGroupName: string; } /** @@ -31,17 +31,17 @@ export interface ClusterParameterGroupProps { /** * Database family of this parameter group */ - family: string; + readonly family: string; /** * Description for this parameter group */ - description: string; + readonly description: string; /** * The parameters in this parameter group */ - parameters?: Parameters; + readonly parameters?: Parameters; } /** diff --git a/packages/@aws-cdk/aws-rds/lib/cluster-ref.ts b/packages/@aws-cdk/aws-rds/lib/cluster-ref.ts index 6bbb799f1e765..41b32ff24f5e7 100644 --- a/packages/@aws-cdk/aws-rds/lib/cluster-ref.ts +++ b/packages/@aws-cdk/aws-rds/lib/cluster-ref.ts @@ -49,38 +49,38 @@ export interface DatabaseClusterImportProps { /** * The database port */ - port: string; + readonly port: string; /** * The security group for this database cluster */ - securityGroupId: string; + readonly securityGroupId: string; /** * Identifier for the cluster */ - clusterIdentifier: string; + readonly clusterIdentifier: string; /** * Identifier for the instances */ - instanceIdentifiers: string[]; + readonly instanceIdentifiers: string[]; // Actual underlying type: DBInstanceId[], but we have to type it more loosely for Java's benefit. /** * Cluster endpoint address */ - clusterEndpointAddress: string; + readonly clusterEndpointAddress: string; /** * Reader endpoint address */ - readerEndpointAddress: string; + readonly readerEndpointAddress: string; /** * Endpoint addresses of individual instances */ - instanceEndpointAddresses: string[]; + readonly instanceEndpointAddresses: string[]; } /** diff --git a/packages/@aws-cdk/aws-rds/lib/cluster.ts b/packages/@aws-cdk/aws-rds/lib/cluster.ts index e44168872f4fc..24d547b0262c1 100644 --- a/packages/@aws-cdk/aws-rds/lib/cluster.ts +++ b/packages/@aws-cdk/aws-rds/lib/cluster.ts @@ -16,7 +16,7 @@ export interface DatabaseClusterProps { /** * What kind of database to start */ - engine: DatabaseClusterEngine; + readonly engine: DatabaseClusterEngine; /** * How many replicas/instances to create @@ -25,36 +25,36 @@ export interface DatabaseClusterProps { * * @default 2 */ - instances?: number; + readonly instances?: number; /** * Settings for the individual instances that are launched */ - instanceProps: InstanceProps; + readonly instanceProps: InstanceProps; /** * Username and password for the administrative user */ - masterUser: Login; + readonly masterUser: Login; /** * Backup settings */ - backup?: BackupProps; + readonly backup?: BackupProps; /** * What port to listen on * * If not supplied, the default for the engine is used. */ - port?: number; + readonly port?: number; /** * An optional identifier for the cluster * * If not supplied, a name is automatically generated. */ - clusterIdentifier?: string; + readonly clusterIdentifier?: string; /** * Base identifier for instances @@ -65,19 +65,19 @@ export interface DatabaseClusterProps { * * If clusterIdentifier is also not given, the identifier is automatically generated. */ - instanceIdentifierBase?: string; + readonly instanceIdentifierBase?: string; /** * Name of a database which is automatically created inside the cluster */ - defaultDatabaseName?: string; + readonly defaultDatabaseName?: string; /** * Whether to enable storage encryption * * @default false */ - storageEncrypted?: boolean + readonly storageEncrypted?: boolean /** * The KMS key for storage encryption. If specified `storageEncrypted` @@ -85,7 +85,7 @@ export interface DatabaseClusterProps { * * @default default master key */ - kmsKey?: kms.IEncryptionKey; + readonly kmsKey?: kms.IEncryptionKey; /** * A daily time range in 24-hours UTC format in which backups preferably execute. @@ -94,14 +94,14 @@ export interface DatabaseClusterProps { * * Example: '01:00-02:00' */ - preferredMaintenanceWindow?: string; + readonly preferredMaintenanceWindow?: string; /** * Additional parameters to pass to the database engine * * @default No parameter group */ - parameterGroup?: IClusterParameterGroup; + readonly parameterGroup?: IClusterParameterGroup; /** * The CloudFormation policy to apply when the cluster and its instances @@ -109,7 +109,7 @@ export interface DatabaseClusterProps { * * @default Retain */ - deleteReplacePolicy?: cdk.DeletionPolicy + readonly deleteReplacePolicy?: cdk.DeletionPolicy } /** diff --git a/packages/@aws-cdk/aws-rds/lib/database-secret.ts b/packages/@aws-cdk/aws-rds/lib/database-secret.ts index fb2783f4f6edd..875801c6695b5 100644 --- a/packages/@aws-cdk/aws-rds/lib/database-secret.ts +++ b/packages/@aws-cdk/aws-rds/lib/database-secret.ts @@ -9,14 +9,14 @@ export interface DatabaseSecretProps { /** * The username. */ - username: string; + readonly username: string; /** * The KMS key to use to encrypt the secret. * * @default default master key */ - encryptionKey?: kms.IEncryptionKey; + readonly encryptionKey?: kms.IEncryptionKey; } /** diff --git a/packages/@aws-cdk/aws-rds/lib/props.ts b/packages/@aws-cdk/aws-rds/lib/props.ts index 4816f249cc083..002039d05c8bf 100644 --- a/packages/@aws-cdk/aws-rds/lib/props.ts +++ b/packages/@aws-cdk/aws-rds/lib/props.ts @@ -18,24 +18,24 @@ export interface InstanceProps { /** * What type of instance to start for the replicas */ - instanceType: ec2.InstanceType; + readonly instanceType: ec2.InstanceType; /** * What subnets to run the RDS instances in. * * Must be at least 2 subnets in two different AZs. */ - vpc: ec2.IVpcNetwork; + readonly vpc: ec2.IVpcNetwork; /** * Where to place the instances within the VPC */ - vpcSubnets?: ec2.SubnetSelection; + readonly vpcSubnets?: ec2.SubnetSelection; /** * Security group. If not specified a new one will be created. */ - securityGroup?: ec2.ISecurityGroup; + readonly securityGroup?: ec2.ISecurityGroup; } /** @@ -46,7 +46,7 @@ export interface BackupProps { /** * How many days to retain the backup */ - retentionDays: number; + readonly retentionDays: number; /** * A daily time range in 24-hours UTC format in which backups preferably execute. @@ -55,7 +55,7 @@ export interface BackupProps { * * Example: '01:00-02:00' */ - preferredWindow?: string; + readonly preferredWindow?: string; } /** @@ -65,7 +65,7 @@ export interface Login { /** * Username */ - username: string; + readonly username: string; /** * Password @@ -74,14 +74,14 @@ export interface Login { * * @default a Secrets Manager generated password */ - password?: string; + readonly password?: string; /** * KMS encryption key to encrypt the generated secret. * * @default default master key */ - kmsKey?: kms.IEncryptionKey; + readonly kmsKey?: kms.IEncryptionKey; } /** diff --git a/packages/@aws-cdk/aws-rds/lib/rotation-single-user.ts b/packages/@aws-cdk/aws-rds/lib/rotation-single-user.ts index f9bbf8cac761a..a892fcf021d7e 100644 --- a/packages/@aws-cdk/aws-rds/lib/rotation-single-user.ts +++ b/packages/@aws-cdk/aws-rds/lib/rotation-single-user.ts @@ -63,14 +63,14 @@ export interface RotationSingleUserOptions { * * @default 30 days */ - automaticallyAfterDays?: number; + readonly automaticallyAfterDays?: number; /** * The location of the serverless application for the rotation. * * @default derived from the target's engine */ - serverlessApplicationLocation?: ServerlessApplicationLocation + readonly serverlessApplicationLocation?: ServerlessApplicationLocation } /** @@ -91,31 +91,31 @@ export interface RotationSingleUserProps extends RotationSingleUserOptions { * This is typically the case for a secret referenced from an AWS::SecretsManager::SecretTargetAttachment * https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-secretsmanager-secrettargetattachment.html */ - secret: secretsmanager.ISecret; + readonly secret: secretsmanager.ISecret; /** * The database engine. Either `serverlessApplicationLocation` or `engine` must be specified. * * @default no engine specified */ - engine?: DatabaseEngine; + readonly engine?: DatabaseEngine; /** * The VPC where the Lambda rotation function will run. */ - vpc: ec2.IVpcNetwork; + readonly vpc: ec2.IVpcNetwork; /** * The type of subnets in the VPC where the Lambda rotation function will run. * * @default private subnets */ - vpcSubnets?: ec2.SubnetSelection; + readonly vpcSubnets?: ec2.SubnetSelection; /** * The target database cluster or instance */ - target: ec2.IConnectable; + readonly target: ec2.IConnectable; } /** diff --git a/packages/@aws-cdk/aws-route53/lib/hosted-zone-provider.ts b/packages/@aws-cdk/aws-route53/lib/hosted-zone-provider.ts index c2f4d221e9724..53f88d27d8b6a 100644 --- a/packages/@aws-cdk/aws-route53/lib/hosted-zone-provider.ts +++ b/packages/@aws-cdk/aws-route53/lib/hosted-zone-provider.ts @@ -10,17 +10,17 @@ export interface HostedZoneProviderProps { /** * The zone domain e.g. example.com */ - domainName: string; + readonly domainName: string; /** * Is this a private zone */ - privateZone?: boolean; + readonly privateZone?: boolean; /** * If this is a private zone which VPC is assocaitated */ - vpcId?: string; + readonly vpcId?: string; } const DEFAULT_HOSTED_ZONE: HostedZoneContextResponse = { diff --git a/packages/@aws-cdk/aws-route53/lib/hosted-zone-ref.ts b/packages/@aws-cdk/aws-route53/lib/hosted-zone-ref.ts index 33a7b0e295fb9..09818d8176dce 100644 --- a/packages/@aws-cdk/aws-route53/lib/hosted-zone-ref.ts +++ b/packages/@aws-cdk/aws-route53/lib/hosted-zone-ref.ts @@ -35,10 +35,10 @@ export interface HostedZoneImportProps { /** * Identifier of the hosted zone */ - hostedZoneId: string; + readonly hostedZoneId: string; /** * Name of the hosted zone */ - zoneName: string; + readonly zoneName: string; } diff --git a/packages/@aws-cdk/aws-route53/lib/hosted-zone.ts b/packages/@aws-cdk/aws-route53/lib/hosted-zone.ts index ef198625d057b..a297c95b95618 100644 --- a/packages/@aws-cdk/aws-route53/lib/hosted-zone.ts +++ b/packages/@aws-cdk/aws-route53/lib/hosted-zone.ts @@ -10,21 +10,21 @@ export interface CommonHostedZoneProps { * The name of the domain. For resource record types that include a domain * name, specify a fully qualified domain name. */ - zoneName: string; + readonly zoneName: string; /** * Any comments that you want to include about the hosted zone. * * @default none */ - comment?: string; + readonly comment?: string; /** * The Amazon Resource Name (ARN) for the log group that you want Amazon Route 53 to send query logs to. * * @default disabled */ - queryLogsLogGroupArn?: string; + readonly queryLogsLogGroupArn?: string; } /** @@ -39,7 +39,7 @@ export interface HostedZoneProps extends CommonHostedZoneProps { * * @default public (no VPCs associated) */ - vpcs?: ec2.IVpcNetwork[]; + readonly vpcs?: ec2.IVpcNetwork[]; } export class HostedZone extends cdk.Construct implements IHostedZone { @@ -140,14 +140,14 @@ export interface ZoneDelegationOptions { * * @default none */ - comment?: string; + readonly comment?: string; /** * The TTL (Time To Live) of the DNS delegation record in DNS caches. * * @default 172800 */ - ttl?: number; + readonly ttl?: number; } export interface PrivateHostedZoneProps extends CommonHostedZoneProps { @@ -157,7 +157,7 @@ export interface PrivateHostedZoneProps extends CommonHostedZoneProps { * Private hosted zones must be associated with at least one VPC. You can * associated additional VPCs using `addVpc(vpc)`. */ - vpc: ec2.IVpcNetwork; + readonly vpc: ec2.IVpcNetwork; } /** diff --git a/packages/@aws-cdk/aws-route53/lib/records/alias.ts b/packages/@aws-cdk/aws-route53/lib/records/alias.ts index ba892113e1478..1e16e41933a94 100644 --- a/packages/@aws-cdk/aws-route53/lib/records/alias.ts +++ b/packages/@aws-cdk/aws-route53/lib/records/alias.ts @@ -21,28 +21,28 @@ export interface AliasRecordTargetProps { /** * Hosted zone ID of the target */ - hostedZoneId: string; + readonly hostedZoneId: string; /** * DNS name of the target */ - dnsName: string; + readonly dnsName: string; } export interface AliasRecordProps { /** * The zone in which this alias should be defined. */ - zone: IHostedZone; + readonly zone: IHostedZone; /** * Name for the record. This can be the FQDN for the record (foo.example.com) or * a subdomain of the parent hosted zone (foo, with example.com as the hosted zone). */ - recordName: string; + readonly recordName: string; /** * Target for the alias record */ - target: IAliasRecordTarget; + readonly target: IAliasRecordTarget; } /** diff --git a/packages/@aws-cdk/aws-route53/lib/records/cname.ts b/packages/@aws-cdk/aws-route53/lib/records/cname.ts index e41bda2f515d8..55e9a7bd3f32a 100644 --- a/packages/@aws-cdk/aws-route53/lib/records/cname.ts +++ b/packages/@aws-cdk/aws-route53/lib/records/cname.ts @@ -7,24 +7,24 @@ export interface CnameRecordProps { /** * The hosted zone in which to define the new TXT record. */ - zone: IHostedZone; + readonly zone: IHostedZone; /** * The domain name for this record set. */ - recordName: string; + readonly recordName: string; /** * The value for this record set. */ - recordValue: string; + readonly recordValue: string; /** * The resource record cache time to live (TTL) in seconds. * * @default 1800 seconds */ - ttl?: number; + readonly ttl?: number; } /** diff --git a/packages/@aws-cdk/aws-route53/lib/records/txt.ts b/packages/@aws-cdk/aws-route53/lib/records/txt.ts index a4cafcbcea50b..64bd769848640 100644 --- a/packages/@aws-cdk/aws-route53/lib/records/txt.ts +++ b/packages/@aws-cdk/aws-route53/lib/records/txt.ts @@ -7,24 +7,24 @@ export interface TxtRecordProps { /** * The hosted zone in which to define the new TXT record. */ - zone: IHostedZone; + readonly zone: IHostedZone; /** * The domain name for this record set. */ - recordName: string; + readonly recordName: string; /** * The value for this record set. */ - recordValue: string; + readonly recordValue: string; /** * The resource record cache time to live (TTL) in seconds. * * @default 1800 seconds */ - ttl?: number; + readonly ttl?: number; } /** diff --git a/packages/@aws-cdk/aws-route53/lib/records/zone-delegation.ts b/packages/@aws-cdk/aws-route53/lib/records/zone-delegation.ts index 82f3764dc35b2..d67716756f430 100644 --- a/packages/@aws-cdk/aws-route53/lib/records/zone-delegation.ts +++ b/packages/@aws-cdk/aws-route53/lib/records/zone-delegation.ts @@ -8,16 +8,16 @@ export interface ZoneDelegationRecordProps extends ZoneDelegationOptions { /** * The zone in which this delegate is defined. */ - zone: IHostedZone; + readonly zone: IHostedZone; /** * The name of the zone that delegation is made to. */ - delegatedZoneName: string; + readonly delegatedZoneName: string; /** * The name servers to report in the delegation records. */ - nameServers: string[]; + readonly nameServers: string[]; } /** diff --git a/packages/@aws-cdk/aws-route53/package-lock.json b/packages/@aws-cdk/aws-route53/package-lock.json index 91e62829c871b..d9189f3b693a0 100644 --- a/packages/@aws-cdk/aws-route53/package-lock.json +++ b/packages/@aws-cdk/aws-route53/package-lock.json @@ -1,6 +1,6 @@ { "name": "@aws-cdk/aws-route53", - "version": "0.25.3", + "version": "0.26.0", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/packages/@aws-cdk/aws-s3-deployment/lib/bucket-deployment.ts b/packages/@aws-cdk/aws-s3-deployment/lib/bucket-deployment.ts index cb2c3cc4dd61f..e3b7b7b9ef7ef 100644 --- a/packages/@aws-cdk/aws-s3-deployment/lib/bucket-deployment.ts +++ b/packages/@aws-cdk/aws-s3-deployment/lib/bucket-deployment.ts @@ -11,19 +11,19 @@ export interface BucketDeploymentProps { /** * The source from which to deploy the contents of this bucket. */ - source: ISource; + readonly source: ISource; /** * The S3 bucket to sync the contents of the zip file to. */ - destinationBucket: s3.IBucket; + readonly destinationBucket: s3.IBucket; /** * Key prefix in the destination bucket. * * @default "/" (unzip to root of the destination bucket) */ - destinationKeyPrefix?: string; + readonly destinationKeyPrefix?: string; /** * If this is set to "false", the destination files will be deleted when the @@ -36,7 +36,7 @@ export interface BucketDeploymentProps { * * @default true - when resource is deleted/updated, files are retained */ - retainOnDelete?: boolean; + readonly retainOnDelete?: boolean; } export class BucketDeployment extends cdk.Construct { diff --git a/packages/@aws-cdk/aws-s3-deployment/lib/source.ts b/packages/@aws-cdk/aws-s3-deployment/lib/source.ts index 61507865c4840..145c2e8a90388 100644 --- a/packages/@aws-cdk/aws-s3-deployment/lib/source.ts +++ b/packages/@aws-cdk/aws-s3-deployment/lib/source.ts @@ -7,12 +7,12 @@ export interface SourceProps { /** * The source bucket to deploy from. */ - bucket: s3.IBucket; + readonly bucket: s3.IBucket; /** * An S3 object key in the source bucket that points to a zip file. */ - zipObjectKey: string; + readonly zipObjectKey: string; } /** diff --git a/packages/@aws-cdk/aws-s3-notifications/lib/destination.ts b/packages/@aws-cdk/aws-s3-notifications/lib/destination.ts index 7a079878875c9..ac7ef9a967d72 100644 --- a/packages/@aws-cdk/aws-s3-notifications/lib/destination.ts +++ b/packages/@aws-cdk/aws-s3-notifications/lib/destination.ts @@ -22,18 +22,18 @@ export interface BucketNotificationDestinationProps { /** * The notification type. */ - type: BucketNotificationDestinationType; + readonly type: BucketNotificationDestinationType; /** * The ARN of the destination (i.e. Lambda, SNS, SQS). */ - arn: string; + readonly arn: string; /** * Any additional dependencies that should be resolved before the bucket notification * can be configured (for example, the SNS Topic Policy resource). */ - dependencies?: cdk.IDependable[] + readonly dependencies?: cdk.IDependable[] } /** diff --git a/packages/@aws-cdk/aws-s3/lib/bucket-policy.ts b/packages/@aws-cdk/aws-s3/lib/bucket-policy.ts index c56ce1982bd2c..e0b61dc8c5cbd 100644 --- a/packages/@aws-cdk/aws-s3/lib/bucket-policy.ts +++ b/packages/@aws-cdk/aws-s3/lib/bucket-policy.ts @@ -7,7 +7,7 @@ export interface BucketPolicyProps { /** * The Amazon S3 bucket that the policy applies to. */ - bucket: IBucket; + readonly bucket: IBucket; } /** diff --git a/packages/@aws-cdk/aws-s3/lib/bucket.ts b/packages/@aws-cdk/aws-s3/lib/bucket.ts index adfb0a8f0100b..b155b767feb4f 100644 --- a/packages/@aws-cdk/aws-s3/lib/bucket.ts +++ b/packages/@aws-cdk/aws-s3/lib/bucket.ts @@ -201,7 +201,7 @@ export interface BucketImportProps { * The ARN of the bucket. At least one of bucketArn or bucketName must be * defined in order to initialize a bucket ref. */ - bucketArn?: string; + readonly bucketArn?: string; /** * The name of the bucket. If the underlying value of ARN is a string, the @@ -209,21 +209,21 @@ export interface BucketImportProps { * some features that require the bucket name such as auto-creating a bucket * policy, won't work. */ - bucketName?: string; + readonly bucketName?: string; /** * The domain name of the bucket. * * @default Inferred from bucket name */ - bucketDomainName?: string; + readonly bucketDomainName?: string; /** * The website URL of the bucket (if static web hosting is enabled). * * @default Inferred from bucket name */ - bucketWebsiteUrl?: string; + readonly bucketWebsiteUrl?: string; /** * The format of the website URL of the bucket. This should be true for @@ -231,7 +231,7 @@ export interface BucketImportProps { * * @default false */ - bucketWebsiteNewUrlFormat?: boolean; + readonly bucketWebsiteNewUrlFormat?: boolean; } /** @@ -551,28 +551,28 @@ export interface BlockPublicAccessOptions { * * @see https://docs.aws.amazon.com/AmazonS3/latest/dev/access-control-block-public-access.html#access-control-block-public-access-options */ - blockPublicAcls?: boolean; + readonly blockPublicAcls?: boolean; /** * Whether to block public policy * * @see https://docs.aws.amazon.com/AmazonS3/latest/dev/access-control-block-public-access.html#access-control-block-public-access-options */ - blockPublicPolicy?: boolean; + readonly blockPublicPolicy?: boolean; /** * Whether to ignore public ACLs * * @see https://docs.aws.amazon.com/AmazonS3/latest/dev/access-control-block-public-access.html#access-control-block-public-access-options */ - ignorePublicAcls?: boolean; + readonly ignorePublicAcls?: boolean; /** * Whether to restrict public access * * @see https://docs.aws.amazon.com/AmazonS3/latest/dev/access-control-block-public-access.html#access-control-block-public-access-options */ - restrictPublicBuckets?: boolean; + readonly restrictPublicBuckets?: boolean; } export class BlockPublicAccess { @@ -610,7 +610,7 @@ export interface BucketProps { * * @default Unencrypted */ - encryption?: BucketEncryption; + readonly encryption?: BucketEncryption; /** * External KMS key to use for bucket encryption. @@ -622,60 +622,60 @@ export interface BucketProps { * @default If encryption is set to "Kms" and this property is undefined, a * new KMS key will be created and associated with this bucket. */ - encryptionKey?: kms.IEncryptionKey; + readonly encryptionKey?: kms.IEncryptionKey; /** * Physical name of this bucket. * * @default Assigned by CloudFormation (recommended) */ - bucketName?: string; + readonly bucketName?: string; /** * Policy to apply when the bucket is removed from this stack. * * @default The bucket will be orphaned */ - removalPolicy?: cdk.RemovalPolicy; + readonly removalPolicy?: cdk.RemovalPolicy; /** * Whether this bucket should have versioning turned on or not. * * @default false */ - versioned?: boolean; + readonly versioned?: boolean; /** * Rules that define how Amazon S3 manages objects during their lifetime. * * @default No lifecycle rules */ - lifecycleRules?: LifecycleRule[]; + readonly lifecycleRules?: LifecycleRule[]; /** * The name of the index document (e.g. "index.html") for the website. Enables static website * hosting for this bucket. */ - websiteIndexDocument?: string; + readonly websiteIndexDocument?: string; /** * The name of the error document (e.g. "404.html") for the website. * `websiteIndexDocument` must also be set if this is set. */ - websiteErrorDocument?: string; + readonly websiteErrorDocument?: string; /** * Grants public read access to all objects in the bucket. * Similar to calling `bucket.grantPublicAccess()` */ - publicReadAccess?: boolean; + readonly publicReadAccess?: boolean; /** * The block public access configuration of this bucket. * * @see https://docs.aws.amazon.com/AmazonS3/latest/dev/access-control-block-public-access.html */ - blockPublicAccess?: BlockPublicAccess; + readonly blockPublicAccess?: BlockPublicAccess; } /** @@ -1079,12 +1079,12 @@ export interface NotificationKeyFilter { /** * S3 keys must have the specified prefix. */ - prefix?: string; + readonly prefix?: string; /** * S3 keys must have the specified suffix. */ - suffix?: string; + readonly suffix?: string; } class ImportedBucket extends BucketBase { diff --git a/packages/@aws-cdk/aws-s3/lib/pipeline-actions.ts b/packages/@aws-cdk/aws-s3/lib/pipeline-actions.ts index db16f68fe7599..6c05dce21db64 100644 --- a/packages/@aws-cdk/aws-s3/lib/pipeline-actions.ts +++ b/packages/@aws-cdk/aws-s3/lib/pipeline-actions.ts @@ -14,14 +14,14 @@ export interface CommonPipelineSourceActionProps extends codepipeline.CommonActi * * @default a name will be auto-generated */ - outputArtifactName?: string; + readonly outputArtifactName?: string; /** * The key within the S3 bucket that stores the source code. * * @example 'path/to/file.zip' */ - bucketKey: string; + readonly bucketKey: string; /** * Whether AWS CodePipeline should poll for source changes. @@ -32,7 +32,7 @@ export interface CommonPipelineSourceActionProps extends codepipeline.CommonActi * @default true * @see https://docs.aws.amazon.com/AmazonCloudWatch/latest/events/log-s3-data-events.html */ - pollForSourceChanges?: boolean; + readonly pollForSourceChanges?: boolean; } /** @@ -42,7 +42,7 @@ export interface PipelineSourceActionProps extends CommonPipelineSourceActionPro /** * The Amazon S3 bucket that stores the source code */ - bucket: IBucket; + readonly bucket: IBucket; } /** @@ -88,17 +88,17 @@ export interface CommonPipelineDeployActionProps extends codepipeline.CommonActi * * @default true */ - extract?: boolean; + readonly extract?: boolean; /** * The key of the target object. This is required if extract is false. */ - objectKey?: string; + readonly objectKey?: string; /** * The inputArtifact to deploy to Amazon S3. */ - inputArtifact: codepipeline.Artifact; + readonly inputArtifact: codepipeline.Artifact; } /** @@ -108,7 +108,7 @@ export interface PipelineDeployActionProps extends CommonPipelineDeployActionPro /** * The Amazon S3 bucket that is the deploy target. */ - bucket: IBucket; + readonly bucket: IBucket; } /** diff --git a/packages/@aws-cdk/aws-s3/lib/rule.ts b/packages/@aws-cdk/aws-s3/lib/rule.ts index 835d92aaa1991..186469dd0048a 100644 --- a/packages/@aws-cdk/aws-s3/lib/rule.ts +++ b/packages/@aws-cdk/aws-s3/lib/rule.ts @@ -5,14 +5,14 @@ export interface LifecycleRule { /** * A unique identifier for this rule. The value cannot be more than 255 characters. */ - id?: string; + readonly id?: string; /** * Whether this rule is enabled. * * @default true */ - enabled?: boolean; + readonly enabled?: boolean; /** * Specifies a lifecycle rule that aborts incomplete multipart uploads to an Amazon S3 bucket. @@ -24,7 +24,7 @@ export interface LifecycleRule { * * @default Incomplete uploads are never aborted */ - abortIncompleteMultipartUploadAfterDays?: number; + readonly abortIncompleteMultipartUploadAfterDays?: number; /** * Indicates when objects are deleted from Amazon S3 and Amazon Glacier. @@ -37,7 +37,7 @@ export interface LifecycleRule { * * @default No expiration date */ - expirationDate?: Date; + readonly expirationDate?: Date; /** * Indicates the number of days after creation when objects are deleted from Amazon S3 and Amazon Glacier. @@ -48,7 +48,7 @@ export interface LifecycleRule { * * @default No expiration timeout */ - expirationInDays?: number; + readonly expirationInDays?: number; /** * Time between when a new version of the object is uploaded to the bucket and when old versions of the object expire. @@ -62,7 +62,7 @@ export interface LifecycleRule { * * @default No noncurrent version expiration */ - noncurrentVersionExpirationInDays?: number; + readonly noncurrentVersionExpirationInDays?: number; /** * One or more transition rules that specify when non-current objects transition to a specified storage class. @@ -72,7 +72,7 @@ export interface LifecycleRule { * If you specify a transition and expiration time, the expiration time * must be later than the transition time. */ - noncurrentVersionTransitions?: NoncurrentVersionTransition[]; + readonly noncurrentVersionTransitions?: NoncurrentVersionTransition[]; /** * One or more transition rules that specify when an object transitions to a specified storage class. @@ -83,21 +83,21 @@ export interface LifecycleRule { * * @default No transition rules */ - transitions?: Transition[]; + readonly transitions?: Transition[]; /** * Object key prefix that identifies one or more objects to which this rule applies. * * @default Rule applies to all objects */ - prefix?: string; + readonly prefix?: string; /** * The TagFilter property type specifies tags to use to identify a subset of objects for an Amazon S3 bucket. * * @default Rule applies to all objects */ - tagFilters?: {[tag: string]: any}; + readonly tagFilters?: {[tag: string]: any}; } /** @@ -107,7 +107,7 @@ export interface Transition { /** * The storage class to which you want the object to transition. */ - storageClass: StorageClass; + readonly storageClass: StorageClass; /** * Indicates when objects are transitioned to the specified storage class. @@ -116,14 +116,14 @@ export interface Transition { * * @default No transition date. */ - transitionDate?: Date; + readonly transitionDate?: Date; /** * Indicates the number of days after creation when objects are transitioned to the specified storage class. * * @default No transition count. */ - transitionInDays?: number; + readonly transitionInDays?: number; } /** @@ -133,14 +133,14 @@ export interface NoncurrentVersionTransition { /** * The storage class to which you want the object to transition. */ - storageClass: StorageClass; + readonly storageClass: StorageClass; /** * Indicates the number of days after creation when objects are transitioned to the specified storage class. * * @default No transition count. */ - transitionInDays: number; + readonly transitionInDays: number; } /** diff --git a/packages/@aws-cdk/aws-s3/test/test.bucket.ts b/packages/@aws-cdk/aws-s3/test/test.bucket.ts index f23f69336f6db..37949b9c463f7 100644 --- a/packages/@aws-cdk/aws-s3/test/test.bucket.ts +++ b/packages/@aws-cdk/aws-s3/test/test.bucket.ts @@ -1,4 +1,4 @@ -import { expect, haveResource } from '@aws-cdk/assert'; +import { expect, haveResource, SynthUtils } from '@aws-cdk/assert'; import iam = require('@aws-cdk/aws-iam'); import kms = require('@aws-cdk/aws-kms'); import cdk = require('@aws-cdk/cdk'); @@ -444,7 +444,7 @@ export = { test.deepEqual(bucket.bucketArn, bucketArn); test.deepEqual(bucket.node.resolve(bucket.bucketName), 'my-bucket'); - test.deepEqual(stack._toCloudFormation(), {}, 'the ref is not a real resource'); + test.deepEqual(SynthUtils.toCloudFormation(stack), {}, 'the ref is not a real resource'); test.done(); }, @@ -925,7 +925,7 @@ export = { bucket.grantWrite(writer); bucket.grantDelete(deleter); - const resources = stack._toCloudFormation().Resources; + const resources = SynthUtils.toCloudFormation(stack).Resources; const actions = (id: string) => resources[id].Properties.PolicyDocument.Statement[0].Action; test.deepEqual(actions('WriterDefaultPolicyDC585BCE'), [ 's3:DeleteObject*', 's3:PutObject*', 's3:Abort*' ]); diff --git a/packages/@aws-cdk/aws-s3/test/test.notifications.ts b/packages/@aws-cdk/aws-s3/test/test.notifications.ts index 8009213fbf00e..5f44d8777b79e 100644 --- a/packages/@aws-cdk/aws-s3/test/test.notifications.ts +++ b/packages/@aws-cdk/aws-s3/test/test.notifications.ts @@ -1,4 +1,4 @@ -import { expect, haveResource, haveResourceLike } from '@aws-cdk/assert'; +import { expect, haveResource, haveResourceLike, SynthUtils } from '@aws-cdk/assert'; import s3n = require('@aws-cdk/aws-s3-notifications'); import cdk = require('@aws-cdk/cdk'); import { Stack } from '@aws-cdk/cdk'; @@ -307,7 +307,7 @@ export = { bucket.onObjectCreated(dest); stack.node.prepareTree(); - test.deepEqual(stack._toCloudFormation().Resources.BucketNotifications8F2E257D, { + test.deepEqual(SynthUtils.toCloudFormation(stack).Resources.BucketNotifications8F2E257D, { Type: 'Custom::S3BucketNotifications', Properties: { ServiceToken: { 'Fn::GetAtt': [ 'BucketNotificationsHandler050a0587b7544547bf325f094a3db8347ECC3691', 'Arn' ] }, diff --git a/packages/@aws-cdk/aws-secretsmanager/lib/rotation-schedule.ts b/packages/@aws-cdk/aws-secretsmanager/lib/rotation-schedule.ts index 5f3e77d63e634..99389ce7233fa 100644 --- a/packages/@aws-cdk/aws-secretsmanager/lib/rotation-schedule.ts +++ b/packages/@aws-cdk/aws-secretsmanager/lib/rotation-schedule.ts @@ -10,7 +10,7 @@ export interface RotationScheduleOptions { /** * THe Lambda function that can rotate the secret. */ - rotationLambda: lambda.IFunction; + readonly rotationLambda: lambda.IFunction; /** * Specifies the number of days after the previous rotation before @@ -18,7 +18,7 @@ export interface RotationScheduleOptions { * * @default 30 */ - automaticallyAfterDays?: number; + readonly automaticallyAfterDays?: number; } /** @@ -28,7 +28,7 @@ export interface RotationScheduleProps extends RotationScheduleOptions { /** * The secret to rotate. */ - secret: ISecret; + readonly secret: ISecret; } /** diff --git a/packages/@aws-cdk/aws-secretsmanager/lib/secret-string.ts b/packages/@aws-cdk/aws-secretsmanager/lib/secret-string.ts index 06ce2097e28ef..f87633887117c 100644 --- a/packages/@aws-cdk/aws-secretsmanager/lib/secret-string.ts +++ b/packages/@aws-cdk/aws-secretsmanager/lib/secret-string.ts @@ -7,7 +7,7 @@ export interface SecretStringProps { /** * Unique identifier or ARN of the secret */ - secretId: string; + readonly secretId: string; /** * Specifies the secret version that you want to retrieve by the staging label attached to the version. @@ -16,7 +16,7 @@ export interface SecretStringProps { * * @default AWSCURRENT */ - versionStage?: string; + readonly versionStage?: string; /** * Specifies the unique identifier of the version of the secret that you want to use in stack operations. @@ -25,7 +25,7 @@ export interface SecretStringProps { * * @default AWSCURRENT */ - versionId?: string; + readonly versionId?: string; } /** diff --git a/packages/@aws-cdk/aws-secretsmanager/lib/secret.ts b/packages/@aws-cdk/aws-secretsmanager/lib/secret.ts index bd79a0b7eadad..422d47736b244 100644 --- a/packages/@aws-cdk/aws-secretsmanager/lib/secret.ts +++ b/packages/@aws-cdk/aws-secretsmanager/lib/secret.ts @@ -66,14 +66,14 @@ export interface SecretProps { /** * An optional, human-friendly description of the secret. */ - description?: string; + readonly description?: string; /** * The customer-managed encryption key to use for encrypting the secret value. * * @default a default KMS key for the account and region is used. */ - encryptionKey?: kms.IEncryptionKey; + readonly encryptionKey?: kms.IEncryptionKey; /** * Configuration for how to generate a secret value. @@ -81,7 +81,7 @@ export interface SecretProps { * @default 32 characters with upper-case letters, lower-case letters, punctuation and numbers (at least one from each * category), per the default values of ``SecretStringGenerator``. */ - generateSecretString?: SecretStringGenerator; + readonly generateSecretString?: SecretStringGenerator; /** * A name for the secret. Note that deleting secrets from SecretsManager does not happen immediately, but after a 7 to @@ -89,7 +89,7 @@ export interface SecretProps { * * @default a name is generated by CloudFormation. */ - name?: string; + readonly name?: string; } /** @@ -99,12 +99,12 @@ export interface SecretImportProps { /** * The encryption key that is used to encrypt the secret, unless the default SecretsManager key is used. */ - encryptionKey?: kms.IEncryptionKey; + readonly encryptionKey?: kms.IEncryptionKey; /** * The ARN of the secret in SecretsManager. */ - secretArn: string; + readonly secretArn: string; } /** @@ -255,12 +255,12 @@ export interface SecretAttachmentTargetProps { /** * The id of the target to attach the secret to. */ - targetId: string; + readonly targetId: string; /** * The type of the target to attach the secret to. */ - targetType: AttachmentTargetType; + readonly targetType: AttachmentTargetType; } /** @@ -270,7 +270,7 @@ export interface AttachedSecretOptions { /** * The target to attach the secret to. */ - target: ISecretAttachmentTarget; + readonly target: ISecretAttachmentTarget; } /** @@ -280,7 +280,7 @@ export interface AttachedSecretProps extends AttachedSecretOptions { /** * The secret to attach to the target. */ - secret: ISecret; + readonly secret: ISecret; } /** @@ -322,21 +322,21 @@ export interface SecretStringGenerator { * * @default false */ - excludeUppercase?: boolean; + readonly excludeUppercase?: boolean; /** * Specifies whether the generated password must include at least one of every allowed character type. * * @default true */ - requireEachIncludedType?: boolean; + readonly requireEachIncludedType?: boolean; /** * Specifies that the generated password can include the space character. * * @default false */ - includeSpace?: boolean; + readonly includeSpace?: boolean; /** * A string that includes characters that shouldn't be included in the generated password. The string can be a minimum @@ -344,35 +344,35 @@ export interface SecretStringGenerator { * * @default no exclusions */ - excludeCharacters?: string; + readonly excludeCharacters?: string; /** * The desired length of the generated password. * * @default 32 */ - passwordLength?: number; + readonly passwordLength?: number; /** * Specifies that the generated password shouldn't include punctuation characters. * * @default false */ - excludePunctuation?: boolean; + readonly excludePunctuation?: boolean; /** * Specifies that the generated password shouldn't include lowercase letters. * * @default false */ - excludeLowercase?: boolean; + readonly excludeLowercase?: boolean; /** * Specifies that the generated password shouldn't include digits. * * @default false */ - excludeNumbers?: boolean; + readonly excludeNumbers?: boolean; /** * A properly structured JSON string that the generated password can be added to. The ``generateStringKey`` is @@ -380,14 +380,14 @@ export interface SecretStringGenerator { * The merged JSON string is returned as the completed SecretString of the secret. If you specify ``secretStringTemplate`` * then ``generateStringKey`` must be also be specified. */ - secretStringTemplate?: string; + readonly secretStringTemplate?: string; /** * The JSON key name that's used to add the generated password to the JSON structure specified by the * ``secretStringTemplate`` parameter. If you specify ``generateStringKey`` then ``secretStringTemplate`` * must be also be specified. */ - generateStringKey?: string; + readonly generateStringKey?: string; } class ImportedSecret extends SecretBase { diff --git a/packages/@aws-cdk/aws-servicediscovery/lib/alias-target-instance.ts b/packages/@aws-cdk/aws-servicediscovery/lib/alias-target-instance.ts index 2d5cafd623fe0..e2eaf06efb0c8 100644 --- a/packages/@aws-cdk/aws-servicediscovery/lib/alias-target-instance.ts +++ b/packages/@aws-cdk/aws-servicediscovery/lib/alias-target-instance.ts @@ -11,12 +11,12 @@ export interface AliasTargetInstanceProps extends BaseInstanceProps { /** * DNS name of the target */ - dnsName: string; + readonly dnsName: string; /** * The Cloudmap service this resource is registered to. */ - service: IService; + readonly service: IService; } /* diff --git a/packages/@aws-cdk/aws-servicediscovery/lib/cname-instance.ts b/packages/@aws-cdk/aws-servicediscovery/lib/cname-instance.ts index c2df134d045fe..b465a59f7c22d 100644 --- a/packages/@aws-cdk/aws-servicediscovery/lib/cname-instance.ts +++ b/packages/@aws-cdk/aws-servicediscovery/lib/cname-instance.ts @@ -13,7 +13,7 @@ export interface CnameInstanceBaseProps extends BaseInstanceProps { * return in response to DNS queries, for example, example.com. This value is required if the * service specified by ServiceId includes settings for an CNAME record. */ - instanceCname: string; + readonly instanceCname: string; } /* @@ -23,7 +23,7 @@ export interface CnameInstanceProps extends CnameInstanceBaseProps { /** * The Cloudmap service this resource is registered to. */ - service: IService; + readonly service: IService; } /* diff --git a/packages/@aws-cdk/aws-servicediscovery/lib/instance.ts b/packages/@aws-cdk/aws-servicediscovery/lib/instance.ts index 0d064ed48760c..8e8f7e05ba406 100644 --- a/packages/@aws-cdk/aws-servicediscovery/lib/instance.ts +++ b/packages/@aws-cdk/aws-servicediscovery/lib/instance.ts @@ -23,14 +23,14 @@ export interface BaseInstanceProps { * * @default Automatically generated name */ - instanceId?: string; + readonly instanceId?: string; /** * Custom attributes of the instance. * * @default none */ - customAttributes?: { [key: string]: string }; + readonly customAttributes?: { [key: string]: string }; } export abstract class InstanceBase extends cdk.Construct implements IInstance { diff --git a/packages/@aws-cdk/aws-servicediscovery/lib/ip-instance.ts b/packages/@aws-cdk/aws-servicediscovery/lib/ip-instance.ts index 64600d73608d2..799875309cc93 100644 --- a/packages/@aws-cdk/aws-servicediscovery/lib/ip-instance.ts +++ b/packages/@aws-cdk/aws-servicediscovery/lib/ip-instance.ts @@ -14,7 +14,7 @@ export interface IpInstanceBaseProps extends BaseInstanceProps { * * @default 80 */ - port?: number; + readonly port?: number; /** * If the service that you specify contains a template for an A record, the IPv4 address that you want AWS Cloud @@ -22,7 +22,7 @@ export interface IpInstanceBaseProps extends BaseInstanceProps { * * @default none */ - ipv4?: string; + readonly ipv4?: string; /** * If the service that you specify contains a template for an AAAA record, the IPv6 address that you want AWS Cloud @@ -30,7 +30,7 @@ export interface IpInstanceBaseProps extends BaseInstanceProps { * * @default none */ - ipv6?: string; + readonly ipv6?: string; } /* @@ -40,7 +40,7 @@ export interface IpInstanceProps extends IpInstanceBaseProps { /** * The Cloudmap service this resource is registered to. */ - service: IService; + readonly service: IService; } /* diff --git a/packages/@aws-cdk/aws-servicediscovery/lib/namespace.ts b/packages/@aws-cdk/aws-servicediscovery/lib/namespace.ts index cdbeecc03ecf6..d586a33fed291 100644 --- a/packages/@aws-cdk/aws-servicediscovery/lib/namespace.ts +++ b/packages/@aws-cdk/aws-servicediscovery/lib/namespace.ts @@ -26,14 +26,14 @@ export interface BaseNamespaceProps { /** * A name for the Namespace. */ - name: string; + readonly name: string; /** * A description of the Namespace. * * @default none */ - description?: string; + readonly description?: string; } export interface NamespaceImportProps { diff --git a/packages/@aws-cdk/aws-servicediscovery/lib/non-ip-instance.ts b/packages/@aws-cdk/aws-servicediscovery/lib/non-ip-instance.ts index 94c3c774daa6f..1f75457df6d6e 100644 --- a/packages/@aws-cdk/aws-servicediscovery/lib/non-ip-instance.ts +++ b/packages/@aws-cdk/aws-servicediscovery/lib/non-ip-instance.ts @@ -15,7 +15,7 @@ export interface NonIpInstanceProps extends NonIpInstanceBaseProps { /** * The Cloudmap service this resource is registered to. */ - service: IService; + readonly service: IService; } /* diff --git a/packages/@aws-cdk/aws-servicediscovery/lib/private-dns-namespace.ts b/packages/@aws-cdk/aws-servicediscovery/lib/private-dns-namespace.ts index 7fa2a662b3bf1..538afea3e67d2 100644 --- a/packages/@aws-cdk/aws-servicediscovery/lib/private-dns-namespace.ts +++ b/packages/@aws-cdk/aws-servicediscovery/lib/private-dns-namespace.ts @@ -8,7 +8,7 @@ export interface PrivateDnsNamespaceProps extends BaseNamespaceProps { /** * The Amazon VPC that you want to associate the namespace with. */ - vpc: ec2.IVpcNetwork; + readonly vpc: ec2.IVpcNetwork; } /** diff --git a/packages/@aws-cdk/aws-servicediscovery/lib/service.ts b/packages/@aws-cdk/aws-servicediscovery/lib/service.ts index 6a640d71c7e4b..d317eef444016 100644 --- a/packages/@aws-cdk/aws-servicediscovery/lib/service.ts +++ b/packages/@aws-cdk/aws-servicediscovery/lib/service.ts @@ -49,14 +49,14 @@ export interface BaseServiceProps { * * @default CloudFormation-generated name */ - name?: string; + readonly name?: string; /** * A description of the service. * * @default none */ - description?: string; + readonly description?: string; /** * Settings for an optional health check. If you specify health check settings, AWS Cloud Map associates the health @@ -66,7 +66,7 @@ export interface BaseServiceProps { * * @default none */ - healthCheck?: HealthCheckConfig; + readonly healthCheck?: HealthCheckConfig; /** * Structure containing failure threshold for a custom health checker. @@ -75,7 +75,7 @@ export interface BaseServiceProps { * * @default none */ - customHealthCheck?: HealthCheckCustomConfig; + readonly customHealthCheck?: HealthCheckCustomConfig; } /** @@ -89,7 +89,7 @@ export interface DnsServiceProps extends BaseServiceProps { * * @default A */ - dnsRecordType?: DnsRecordType; + readonly dnsRecordType?: DnsRecordType; /** * The amount of time, in seconds, that you want DNS resolvers to cache the settings for this @@ -97,7 +97,7 @@ export interface DnsServiceProps extends BaseServiceProps { * * @default 60 */ - dnsTtlSec?: number; + readonly dnsTtlSec?: number; /** * The routing policy that you want to apply to all DNS records that AWS Cloud Map creates when you @@ -105,7 +105,7 @@ export interface DnsServiceProps extends BaseServiceProps { * * @default WEIGHTED for CNAME records and when loadBalancer is true, MULTIVALUE otherwise */ - routingPolicy?: RoutingPolicy; + readonly routingPolicy?: RoutingPolicy; /** * Whether or not this service will have an Elastic LoadBalancer registered to it as an AliasTargetInstance. @@ -115,14 +115,14 @@ export interface DnsServiceProps extends BaseServiceProps { * * @default false */ - loadBalancer?: boolean; + readonly loadBalancer?: boolean; } export interface ServiceProps extends DnsServiceProps { /** * The ID of the namespace that you want to use for DNS configuration. */ - namespace: INamespace; + readonly namespace: INamespace; } /** @@ -324,14 +324,14 @@ export interface HealthCheckConfig { * * @default HTTP */ - type?: HealthCheckType; + readonly type?: HealthCheckType; /** * The path that you want Route 53 to request when performing health checks. Do not use when health check type is TCP. * * @default '/' */ - resourcePath?: string; + readonly resourcePath?: string; /** * The number of consecutive health checks that an endpoint must pass or fail for Route 53 to change the current @@ -339,7 +339,7 @@ export interface HealthCheckConfig { * * @default 1 */ - failureThreshold?: number; + readonly failureThreshold?: number; } /** @@ -352,7 +352,7 @@ export interface HealthCheckCustomConfig { * * @default 1 */ - failureThreshold?: number; + readonly failureThreshold?: number; } export enum DnsRecordType { diff --git a/packages/@aws-cdk/aws-ses/lib/receipt-filter.ts b/packages/@aws-cdk/aws-ses/lib/receipt-filter.ts index f715454906ae1..d5b8067656c75 100644 --- a/packages/@aws-cdk/aws-ses/lib/receipt-filter.ts +++ b/packages/@aws-cdk/aws-ses/lib/receipt-filter.ts @@ -25,21 +25,21 @@ export interface ReceiptFilterProps { * * @default a CloudFormation generated name */ - name?: string; + readonly name?: string; /** * The ip address or range to filter. * * @default 0.0.0.0/0 */ - ip?: string; + readonly ip?: string; /** * The policy for the filter. * * @default Block */ - policy?: ReceiptFilterPolicy; + readonly policy?: ReceiptFilterPolicy; } /** @@ -69,7 +69,7 @@ export interface WhiteListReceiptFilterProps { /** * A list of ip addresses or ranges to white list. */ - ips: string[]; + readonly ips: string[]; } /** diff --git a/packages/@aws-cdk/aws-ses/lib/receipt-rule-action.ts b/packages/@aws-cdk/aws-ses/lib/receipt-rule-action.ts index 8c8b966d97b5e..dc6058262c35c 100644 --- a/packages/@aws-cdk/aws-ses/lib/receipt-rule-action.ts +++ b/packages/@aws-cdk/aws-ses/lib/receipt-rule-action.ts @@ -13,41 +13,41 @@ export interface ReceiptRuleActionProps { /** * Adds a header to the received email. */ - addHeaderAction?: CfnReceiptRule.AddHeaderActionProperty + readonly addHeaderAction?: CfnReceiptRule.AddHeaderActionProperty /** * Rejects the received email by returning a bounce response to the sender and, * optionally, publishes a notification to Amazon SNS. */ - bounceAction?: CfnReceiptRule.BounceActionProperty; + readonly bounceAction?: CfnReceiptRule.BounceActionProperty; /** * Calls an AWS Lambda function, and optionally, publishes a notification to * Amazon SNS. */ - lambdaAction?: CfnReceiptRule.LambdaActionProperty; + readonly lambdaAction?: CfnReceiptRule.LambdaActionProperty; /** * Saves the received message to an Amazon S3 bucket and, optionally, publishes * a notification to Amazon SNS. */ - s3Action?: CfnReceiptRule.S3ActionProperty; + readonly s3Action?: CfnReceiptRule.S3ActionProperty; /** * Publishes the email content within a notification to Amazon SNS. */ - snsAction?: CfnReceiptRule.SNSActionProperty; + readonly snsAction?: CfnReceiptRule.SNSActionProperty; /** * Terminates the evaluation of the receipt rule set and optionally publishes a * notification to Amazon SNS. */ - stopAction?: CfnReceiptRule.StopActionProperty; + readonly stopAction?: CfnReceiptRule.StopActionProperty; /** * Calls Amazon WorkMail and, optionally, publishes a notification to Amazon SNS. */ - workmailAction?: CfnReceiptRule.WorkmailActionProperty; + readonly workmailAction?: CfnReceiptRule.WorkmailActionProperty; } /** @@ -69,13 +69,13 @@ export interface ReceiptRuleAddHeaderActionProps { * inclusive, and consist of alphanumeric (a-z, A-Z, 0-9) characters * and dashes only. */ - name: string; + readonly name: string; /** * The value of the header to add. Must be less than 2048 characters, * and must not contain newline characters ("\r" or "\n"). */ - value: string; + readonly value: string; } /** @@ -117,21 +117,21 @@ export interface ReceiptRuleBounceActionTemplateProps { /** * Human-readable text to include in the bounce message. */ - message: string; + readonly message: string; /** * The SMTP reply code, as defined by RFC 5321. * * @see https://tools.ietf.org/html/rfc5321 */ - smtpReplyCode: string; + readonly smtpReplyCode: string; /** * The SMTP enhanced status code, as defined by RFC 3463. * * @see https://tools.ietf.org/html/rfc3463 */ - statusCode?: string; + readonly statusCode?: string; } /** @@ -186,20 +186,20 @@ export interface ReceiptRuleBounceActionProps { /** * The template containing the message, reply code and status code. */ - template: ReceiptRuleBounceActionTemplate; + readonly template: ReceiptRuleBounceActionTemplate; /** * The email address of the sender of the bounced email. This is the address * from which the bounce message will be sent. */ - sender: string; + readonly sender: string; /** * The SNS topic to notify when the bounce action is taken. * * @default no notification */ - topic?: sns.ITopic; + readonly topic?: sns.ITopic; } /** @@ -247,21 +247,21 @@ export interface ReceiptRuleLambdaActionProps { /** * The Lambda function to invoke. */ - function: lambda.IFunction + readonly function: lambda.IFunction /** * The invocation type of the Lambda function. * * @default Event */ - invocationType?: LambdaInvocationType; + readonly invocationType?: LambdaInvocationType; /** * The SNS topic to notify when the Lambda action is taken. * * @default no notification */ - topic?: sns.ITopic; + readonly topic?: sns.ITopic; } /** @@ -301,7 +301,7 @@ export interface ReceiptRuleS3ActionProps { /** * The S3 bucket that incoming email will be saved to. */ - bucket: s3.IBucket; + readonly bucket: s3.IBucket; /** * The master key that SES should use to encrypt your emails before saving @@ -309,21 +309,21 @@ export interface ReceiptRuleS3ActionProps { * * @default no encryption */ - kmsKey?: kms.IEncryptionKey; + readonly kmsKey?: kms.IEncryptionKey; /** * The key prefix of the S3 bucket. * * @default no prefix */ - objectKeyPrefix?: string; + readonly objectKeyPrefix?: string; /** * The SNS topic to notify when the S3 action is taken. * * @default no notification */ - topic?: sns.ITopic; + readonly topic?: sns.ITopic; } /** @@ -404,12 +404,12 @@ export interface ReceiptRuleSnsActionProps { * * @default UTF-8 */ - encoding?: EmailEncoding; + readonly encoding?: EmailEncoding; /** * The SNS topic to notify. */ - topic: sns.ITopic; + readonly topic: sns.ITopic; } /** @@ -436,7 +436,7 @@ export interface ReceiptRuleStopActionProps { /** * The SNS topic to notify when the stop action is taken. */ - topic?: sns.ITopic; + readonly topic?: sns.ITopic; } /** diff --git a/packages/@aws-cdk/aws-ses/lib/receipt-rule-set.ts b/packages/@aws-cdk/aws-ses/lib/receipt-rule-set.ts index 54122a7a2ed62..268ae3a955e4b 100644 --- a/packages/@aws-cdk/aws-ses/lib/receipt-rule-set.ts +++ b/packages/@aws-cdk/aws-ses/lib/receipt-rule-set.ts @@ -32,13 +32,13 @@ export interface ReceiptRuleSetProps { * * @default a CloudFormation generated name */ - name?: string; + readonly name?: string; /** * The list of rules to add to this rule set. Rules are added in the same * order as they appear in the list. */ - rules?: ReceiptRuleOptions[] + readonly rules?: ReceiptRuleOptions[] /** * Whether to add a first rule to stop processing messages @@ -46,7 +46,7 @@ export interface ReceiptRuleSetProps { * * @default false */ - dropSpam?: boolean; + readonly dropSpam?: boolean; } /** @@ -133,7 +133,7 @@ export interface ReceiptRuleSetImportProps { /** * The receipt rule set name. */ - name: string; + readonly name: string; } /** diff --git a/packages/@aws-cdk/aws-ses/lib/receipt-rule.ts b/packages/@aws-cdk/aws-ses/lib/receipt-rule.ts index 05956125bcc56..482d03e1faa5e 100644 --- a/packages/@aws-cdk/aws-ses/lib/receipt-rule.ts +++ b/packages/@aws-cdk/aws-ses/lib/receipt-rule.ts @@ -43,49 +43,49 @@ export interface ReceiptRuleOptions { * one of the recipient email addresses or domains specified in the * receipt rule. */ - actions?: IReceiptRuleAction[]; + readonly actions?: IReceiptRuleAction[]; /** * An existing rule after which the new rule will be placed. * * @default the new rule is inserted at the beginning of the rule list */ - after?: IReceiptRule; + readonly after?: IReceiptRule; /** * Whether the rule is active. * * @default true */ - enabled?: boolean; + readonly enabled?: boolean; /** * The name for the rule * * @default a CloudFormation generated name */ - name?: string; + readonly name?: string; /** * The recipient domains and email addresses that the receipt rule applies to. * * @default match all recipients under all verified domains. */ - recipients?: string[]; + readonly recipients?: string[]; /** * Wheter to scan for spam and viruses. * * @default false */ - scanEnabled?: boolean; + readonly scanEnabled?: boolean; /** * The TLS policy * * @default Optional */ - tlsPolicy?: TlsPolicy; + readonly tlsPolicy?: TlsPolicy; } /** @@ -95,7 +95,7 @@ export interface ReceiptRuleProps extends ReceiptRuleOptions { /** * The name of the rule set that the receipt rule will be added to. */ - ruleSet: IReceiptRuleSet; + readonly ruleSet: IReceiptRuleSet; } /** @@ -166,7 +166,7 @@ export interface ReceiptRuleImportProps { /** * The name of the receipt rule. */ - name: string; + readonly name: string; } /** diff --git a/packages/@aws-cdk/aws-sns/lib/policy.ts b/packages/@aws-cdk/aws-sns/lib/policy.ts index 81587863d40bb..e39ad6f4d75e1 100644 --- a/packages/@aws-cdk/aws-sns/lib/policy.ts +++ b/packages/@aws-cdk/aws-sns/lib/policy.ts @@ -7,7 +7,7 @@ export interface TopicPolicyProps { /** * The set of topics this policy applies to. */ - topics: ITopic[]; + readonly topics: ITopic[]; } /** diff --git a/packages/@aws-cdk/aws-sns/lib/subscription.ts b/packages/@aws-cdk/aws-sns/lib/subscription.ts index f823d4d711347..a6b545cfd6758 100644 --- a/packages/@aws-cdk/aws-sns/lib/subscription.ts +++ b/packages/@aws-cdk/aws-sns/lib/subscription.ts @@ -9,19 +9,19 @@ export interface SubscriptionProps { /** * What type of subscription to add. */ - protocol: SubscriptionProtocol; + readonly protocol: SubscriptionProtocol; /** * The subscription endpoint. * * The meaning of this value depends on the value for 'protocol'. */ - endpoint: any; + readonly endpoint: any; /** * The topic to subscribe to. */ - topic: ITopic; + readonly topic: ITopic; /** * true if raw message delivery is enabled for the subscription. Raw messages are free of JSON formatting and can be @@ -30,7 +30,7 @@ export interface SubscriptionProps { * * @default false */ - rawMessageDelivery?: boolean; + readonly rawMessageDelivery?: boolean; } /** diff --git a/packages/@aws-cdk/aws-sns/lib/topic-base.ts b/packages/@aws-cdk/aws-sns/lib/topic-base.ts index 4e3560d87c76a..2a68246e6e841 100644 --- a/packages/@aws-cdk/aws-sns/lib/topic-base.ts +++ b/packages/@aws-cdk/aws-sns/lib/topic-base.ts @@ -346,8 +346,8 @@ export abstract class TopicBase extends cdk.Construct implements ITopic { * Reference to an external topic. */ export interface TopicImportProps { - topicArn: string; - topicName: string; + readonly topicArn: string; + readonly topicName: string; } /** @@ -360,5 +360,5 @@ export interface EmailSubscriptionOptions { * * @default Message text (false) */ - json?: boolean; + readonly json?: boolean; } diff --git a/packages/@aws-cdk/aws-sns/lib/topic.ts b/packages/@aws-cdk/aws-sns/lib/topic.ts index de21f2e4ba433..04d5b7744215e 100644 --- a/packages/@aws-cdk/aws-sns/lib/topic.ts +++ b/packages/@aws-cdk/aws-sns/lib/topic.ts @@ -11,7 +11,7 @@ export interface TopicProps { * * @default None */ - displayName?: string; + readonly displayName?: string; /** * A name for the topic. @@ -22,7 +22,7 @@ export interface TopicProps { * * @default Generated name */ - topicName?: string; + readonly topicName?: string; } /** diff --git a/packages/@aws-cdk/aws-sqs/lib/policy.ts b/packages/@aws-cdk/aws-sqs/lib/policy.ts index 26526764d8b86..a6419b9cfb961 100644 --- a/packages/@aws-cdk/aws-sqs/lib/policy.ts +++ b/packages/@aws-cdk/aws-sqs/lib/policy.ts @@ -7,7 +7,7 @@ export interface QueuePolicyProps { /** * The set of queues this policy applies to. */ - queues: IQueue[]; + readonly queues: IQueue[]; } /** diff --git a/packages/@aws-cdk/aws-sqs/lib/queue-base.ts b/packages/@aws-cdk/aws-sqs/lib/queue-base.ts index 1c35629933694..1c207b622884b 100644 --- a/packages/@aws-cdk/aws-sqs/lib/queue-base.ts +++ b/packages/@aws-cdk/aws-sqs/lib/queue-base.ts @@ -291,21 +291,21 @@ export interface QueueImportProps { /** * The ARN of the queue. */ - queueArn: string; + readonly queueArn: string; /** * The URL of the queue. */ - queueUrl: string; + readonly queueUrl: string; /** * The name of the queue. * @default if queue name is not specified, the name will be derived from the queue ARN */ - queueName?: string; + readonly queueName?: string; /** * KMS encryption key, if this queue is server-side encrypted by a KMS key. */ - keyArn?: string; + readonly keyArn?: string; } diff --git a/packages/@aws-cdk/aws-sqs/lib/queue.ts b/packages/@aws-cdk/aws-sqs/lib/queue.ts index f7d0fb76946bc..b9e45d1b11071 100644 --- a/packages/@aws-cdk/aws-sqs/lib/queue.ts +++ b/packages/@aws-cdk/aws-sqs/lib/queue.ts @@ -15,7 +15,7 @@ export interface QueueProps { * * @default CloudFormation-generated name */ - queueName?: string; + readonly queueName?: string; /** * The number of seconds that Amazon SQS retains a message. @@ -25,7 +25,7 @@ export interface QueueProps { * * @default 345600 seconds (4 days) */ - retentionPeriodSec?: number; + readonly retentionPeriodSec?: number; /** * The time in seconds that the delivery of all messages in the queue is delayed. @@ -35,7 +35,7 @@ export interface QueueProps { * * @default 0 */ - deliveryDelaySec?: number; + readonly deliveryDelaySec?: number; /** * The limit of how many bytes that a message can contain before Amazon SQS rejects it. @@ -45,7 +45,7 @@ export interface QueueProps { * * @default 256KiB */ - maxMessageSizeBytes?: number; + readonly maxMessageSizeBytes?: number; /** * Default wait time for ReceiveMessage calls. @@ -57,7 +57,7 @@ export interface QueueProps { * * @default 0 */ - receiveMessageWaitTimeSec?: number; + readonly receiveMessageWaitTimeSec?: number; /** * Timeout of processing a single message. @@ -71,14 +71,14 @@ export interface QueueProps { * * @default 30 */ - visibilityTimeoutSec?: number; + readonly visibilityTimeoutSec?: number; /** * Send messages to this queue if they were unsuccessfully dequeued a number of times. * * @default no dead-letter queue */ - deadLetterQueue?: DeadLetterQueue; + readonly deadLetterQueue?: DeadLetterQueue; /** * Whether the contents of the queue are encrypted, and by what type of key. @@ -88,7 +88,7 @@ export interface QueueProps { * * @default Unencrypted */ - encryption?: QueueEncryption; + readonly encryption?: QueueEncryption; /** * External KMS master key to use for queue encryption. @@ -103,7 +103,7 @@ export interface QueueProps { * * @default If encryption is set to KMS and not specified, a key will be created. */ - encryptionMasterKey?: kms.IEncryptionKey; + readonly encryptionMasterKey?: kms.IEncryptionKey; /** * The length of time that Amazon SQS reuses a data key before calling KMS again. @@ -113,14 +113,14 @@ export interface QueueProps { * * @default 300 (5 minutes) */ - dataKeyReuseSec?: number; + readonly dataKeyReuseSec?: number; /** * Whether this a first-in-first-out (FIFO) queue. * * @default false, unless queueName ends in '.fifo' or 'contentBasedDeduplication' is true. */ - fifo?: boolean; + readonly fifo?: boolean; /** * Specifies whether to enable content-based deduplication. @@ -136,7 +136,7 @@ export interface QueueProps { * * @default false */ - contentBasedDeduplication?: boolean; + readonly contentBasedDeduplication?: boolean; } /** @@ -146,12 +146,12 @@ export interface DeadLetterQueue { /** * The dead-letter queue to which Amazon SQS moves messages after the value of maxReceiveCount is exceeded. */ - queue: IQueue; + readonly queue: IQueue; /** * The number of times a message can be unsuccesfully dequeued before being moved to the dead-letter queue. */ - maxReceiveCount: number; + readonly maxReceiveCount: number; } /** diff --git a/packages/@aws-cdk/aws-sqs/package-lock.json b/packages/@aws-cdk/aws-sqs/package-lock.json index d706a9e70d18e..3e518f04ac96f 100644 --- a/packages/@aws-cdk/aws-sqs/package-lock.json +++ b/packages/@aws-cdk/aws-sqs/package-lock.json @@ -1,6 +1,6 @@ { "name": "@aws-cdk/aws-sqs", - "version": "0.25.3", + "version": "0.26.0", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/packages/@aws-cdk/aws-sqs/test/test.sqs.ts b/packages/@aws-cdk/aws-sqs/test/test.sqs.ts index 6566aa0903997..2c574c712f3c7 100644 --- a/packages/@aws-cdk/aws-sqs/test/test.sqs.ts +++ b/packages/@aws-cdk/aws-sqs/test/test.sqs.ts @@ -1,4 +1,4 @@ -import { expect, haveResource } from '@aws-cdk/assert'; +import { expect, haveResource, SynthUtils } from '@aws-cdk/assert'; import iam = require('@aws-cdk/aws-iam'); import kms = require('@aws-cdk/aws-kms'); import s3 = require('@aws-cdk/aws-s3'); @@ -107,7 +107,7 @@ export = { test.deepEqual(stack.node.resolve(imports.queueUrl), { 'Fn::ImportValue': 'Stack:QueueQueueUrlC30FF916' }); // the exporting stack has Outputs for QueueARN and QueueURL - const outputs = stack._toCloudFormation().Outputs; + const outputs = SynthUtils.toCloudFormation(stack).Outputs; // tslint:disable-next-line:max-line-length test.deepEqual(outputs.QueueQueueArn8CF496D5, { Value: { 'Fn::GetAtt': [ 'Queue4A7E3555', 'Arn' ] }, Export: { Name: 'Stack:QueueQueueArn8CF496D5' } }); test.deepEqual(outputs.QueueQueueUrlC30FF916, { Value: { Ref: 'Queue4A7E3555' }, Export: { Name: 'Stack:QueueQueueUrlC30FF916' } }); @@ -253,7 +253,7 @@ export = { keyArn: { 'Fn::ImportValue': 'Stack:QueueWithCustomKeyKeyArn537F6E42' } }); - test.deepEqual(stack._toCloudFormation().Outputs, { + test.deepEqual(SynthUtils.toCloudFormation(stack).Outputs, { "QueueWithCustomKeyQueueArnD326BB9B": { "Value": { "Fn::GetAtt": [ @@ -301,7 +301,7 @@ export = { keyArn: { 'Fn::ImportValue': 'Stack:QueueWithManagedKeyKeyArn9C42A85D' } }); - test.deepEqual(stack._toCloudFormation().Outputs, { + test.deepEqual(SynthUtils.toCloudFormation(stack).Outputs, { "QueueWithManagedKeyQueueArn8798A14E": { "Value": { "Fn::GetAtt": [ @@ -407,7 +407,7 @@ export = { // make sure the queue policy is added as a dependency to the bucket // notifications resource so it will be created first. - test.deepEqual(stack._toCloudFormation().Resources.BucketNotifications8F2E257D.DependsOn, [ 'QueuePolicy25439813' ]); + test.deepEqual(SynthUtils.toCloudFormation(stack).Resources.BucketNotifications8F2E257D.DependsOn, [ 'QueuePolicy25439813' ]); test.done(); }, diff --git a/packages/@aws-cdk/aws-ssm/lib/parameter-store-string.ts b/packages/@aws-cdk/aws-ssm/lib/parameter-store-string.ts index c3115dcf0a0c9..3cce5e00254e6 100644 --- a/packages/@aws-cdk/aws-ssm/lib/parameter-store-string.ts +++ b/packages/@aws-cdk/aws-ssm/lib/parameter-store-string.ts @@ -7,14 +7,14 @@ export interface ParameterStoreStringProps { /** * The name of the parameter store value */ - parameterName: string; + readonly parameterName: string; /** * The version number of the value you wish to retrieve. * * @default The latest version will be retrieved. */ - version?: number; + readonly version?: number; } /** @@ -64,12 +64,12 @@ export interface ParameterStoreSecureStringProps { /** * The name of the parameter store secure string value */ - parameterName: string; + readonly parameterName: string; /** * The version number of the value you wish to retrieve. */ - version: number; + readonly version: number; } /** diff --git a/packages/@aws-cdk/aws-ssm/lib/parameter.ts b/packages/@aws-cdk/aws-ssm/lib/parameter.ts index 2ef28b329928e..de096ba82fb40 100644 --- a/packages/@aws-cdk/aws-ssm/lib/parameter.ts +++ b/packages/@aws-cdk/aws-ssm/lib/parameter.ts @@ -67,21 +67,21 @@ export interface ParameterProps { * * @default no validation is performed */ - allowedPattern?: string; + readonly allowedPattern?: string; /** * Information about the parameter that you want to add to the system. * * @default none */ - description?: string; + readonly description?: string; /** * The name of the parameter. * * @default a name will be generated by CloudFormation */ - name?: string; + readonly name?: string; } /** @@ -91,7 +91,7 @@ export interface StringParameterProps extends ParameterProps { /** * The value of the parameter. It may not reference another parameter and ``{{}}`` cannot be used in the value. */ - stringValue: string; + readonly stringValue: string; } /** @@ -101,7 +101,7 @@ export interface StringListParameterProps extends ParameterProps { /** * The values of the parameter. It may not reference another parameter and ``{{}}`` cannot be used in the value. */ - stringListValue: string[]; + readonly stringListValue: string[]; } /** diff --git a/packages/@aws-cdk/aws-stepfunctions/lib/activity.ts b/packages/@aws-cdk/aws-stepfunctions/lib/activity.ts index ef0fe1b9db326..8a8c0bac3913d 100644 --- a/packages/@aws-cdk/aws-stepfunctions/lib/activity.ts +++ b/packages/@aws-cdk/aws-stepfunctions/lib/activity.ts @@ -9,7 +9,7 @@ export interface ActivityProps { * * @default If not supplied, a name is generated */ - activityName?: string; + readonly activityName?: string; } /** diff --git a/packages/@aws-cdk/aws-stepfunctions/lib/state-machine-fragment.ts b/packages/@aws-cdk/aws-stepfunctions/lib/state-machine-fragment.ts index 72586781c3028..5998a53597c9e 100644 --- a/packages/@aws-cdk/aws-stepfunctions/lib/state-machine-fragment.ts +++ b/packages/@aws-cdk/aws-stepfunctions/lib/state-machine-fragment.ts @@ -70,12 +70,12 @@ export interface SingleStateOptions extends ParallelProps { * * @default Construct ID of the StateMachineFragment */ - stateId?: string; + readonly stateId?: string; /** * String to prefix all stateIds in the state machine with * * @default stateId */ - prefixStates?: string; + readonly prefixStates?: string; } \ No newline at end of file diff --git a/packages/@aws-cdk/aws-stepfunctions/lib/state-machine.ts b/packages/@aws-cdk/aws-stepfunctions/lib/state-machine.ts index eec511e368d39..8cf98f1471181 100644 --- a/packages/@aws-cdk/aws-stepfunctions/lib/state-machine.ts +++ b/packages/@aws-cdk/aws-stepfunctions/lib/state-machine.ts @@ -15,26 +15,26 @@ export interface StateMachineProps { * * @default A name is automatically generated */ - stateMachineName?: string; + readonly stateMachineName?: string; /** * Definition for this state machine */ - definition: IChainable; + readonly definition: IChainable; /** * The execution role for the state machine service * * @default A role is automatically created */ - role?: iam.Role; + readonly role?: iam.Role; /** * Maximum run time for this state machine * * @default No timeout */ - timeoutSec?: number; + readonly timeoutSec?: number; } /** @@ -221,7 +221,7 @@ export interface StateMachineImportProps { /** * The ARN of the state machine */ - stateMachineArn: string; + readonly stateMachineArn: string; } class ImportedStateMachine extends cdk.Construct implements IStateMachine { diff --git a/packages/@aws-cdk/aws-stepfunctions/lib/states/choice.ts b/packages/@aws-cdk/aws-stepfunctions/lib/states/choice.ts index 2352dfc4e5e6c..d62e29ca74277 100644 --- a/packages/@aws-cdk/aws-stepfunctions/lib/states/choice.ts +++ b/packages/@aws-cdk/aws-stepfunctions/lib/states/choice.ts @@ -13,7 +13,7 @@ export interface ChoiceProps { * * @default No comment */ - comment?: string; + readonly comment?: string; /** * JSONPath expression to select part of the state to be the input to this state. @@ -23,7 +23,7 @@ export interface ChoiceProps { * * @default $ */ - inputPath?: string; + readonly inputPath?: string; /** * JSONPath expression to select part of the state to be the output to this state. @@ -33,7 +33,7 @@ export interface ChoiceProps { * * @default $ */ - outputPath?: string; + readonly outputPath?: string; } /** @@ -109,7 +109,7 @@ export interface AfterwardsOptions { * * @default false */ - includeErrorHandlers?: boolean; + readonly includeErrorHandlers?: boolean; /** * Whether to include the default/otherwise transition for the current Choice state @@ -119,7 +119,7 @@ export interface AfterwardsOptions { * * @default false */ - includeOtherwise?: boolean; + readonly includeOtherwise?: boolean; } /** diff --git a/packages/@aws-cdk/aws-stepfunctions/lib/states/fail.ts b/packages/@aws-cdk/aws-stepfunctions/lib/states/fail.ts index 0fad0bf89cd8c..5a7ce49557e46 100644 --- a/packages/@aws-cdk/aws-stepfunctions/lib/states/fail.ts +++ b/packages/@aws-cdk/aws-stepfunctions/lib/states/fail.ts @@ -11,21 +11,21 @@ export interface FailProps { * * @default No comment */ - comment?: string; + readonly comment?: string; /** * Error code used to represent this failure * * @default No error code */ - error?: string; + readonly error?: string; /** * A description for the cause of the failure * * @default No description */ - cause?: string; + readonly cause?: string; } /** diff --git a/packages/@aws-cdk/aws-stepfunctions/lib/states/parallel.ts b/packages/@aws-cdk/aws-stepfunctions/lib/states/parallel.ts index 22bd2fe03eca4..dbf54f6f6048f 100644 --- a/packages/@aws-cdk/aws-stepfunctions/lib/states/parallel.ts +++ b/packages/@aws-cdk/aws-stepfunctions/lib/states/parallel.ts @@ -13,7 +13,7 @@ export interface ParallelProps { * * @default No comment */ - comment?: string; + readonly comment?: string; /** * JSONPath expression to select part of the state to be the input to this state. @@ -23,7 +23,7 @@ export interface ParallelProps { * * @default $ */ - inputPath?: string; + readonly inputPath?: string; /** * JSONPath expression to select part of the state to be the output to this state. @@ -33,7 +33,7 @@ export interface ParallelProps { * * @default $ */ - outputPath?: string; + readonly outputPath?: string; /** * JSONPath expression to indicate where to inject the state's output @@ -43,7 +43,7 @@ export interface ParallelProps { * * @default $ */ - resultPath?: string; + readonly resultPath?: string; } /** diff --git a/packages/@aws-cdk/aws-stepfunctions/lib/states/pass.ts b/packages/@aws-cdk/aws-stepfunctions/lib/states/pass.ts index 04954b3a2ca9b..70e4eee290f0d 100644 --- a/packages/@aws-cdk/aws-stepfunctions/lib/states/pass.ts +++ b/packages/@aws-cdk/aws-stepfunctions/lib/states/pass.ts @@ -12,7 +12,7 @@ export interface PassProps { * * @default No comment */ - comment?: string; + readonly comment?: string; /** * JSONPath expression to select part of the state to be the input to this state. @@ -22,7 +22,7 @@ export interface PassProps { * * @default $ */ - inputPath?: string; + readonly inputPath?: string; /** * JSONPath expression to select part of the state to be the output to this state. @@ -32,7 +32,7 @@ export interface PassProps { * * @default $ */ - outputPath?: string; + readonly outputPath?: string; /** * JSONPath expression to indicate where to inject the state's output @@ -42,7 +42,7 @@ export interface PassProps { * * @default $ */ - resultPath?: string; + readonly resultPath?: string; /** * If given, treat as the result of this operation @@ -51,7 +51,7 @@ export interface PassProps { * * @default No injected result */ - result?: any; + readonly result?: any; } /** diff --git a/packages/@aws-cdk/aws-stepfunctions/lib/states/state.ts b/packages/@aws-cdk/aws-stepfunctions/lib/states/state.ts index e99559edaab43..02158a9c443a0 100644 --- a/packages/@aws-cdk/aws-stepfunctions/lib/states/state.ts +++ b/packages/@aws-cdk/aws-stepfunctions/lib/states/state.ts @@ -12,7 +12,7 @@ export interface StateProps { * * @default No comment */ - comment?: string; + readonly comment?: string; /** * JSONPath expression to select part of the state to be the input to this state. @@ -22,7 +22,7 @@ export interface StateProps { * * @default $ */ - inputPath?: string; + readonly inputPath?: string; /** * Parameters pass a collection of key-value pairs, either static values or JSONPath expressions that select from the input. @@ -32,7 +32,7 @@ export interface StateProps { * * @default No parameters */ - parameters?: { [name: string]: any }; + readonly parameters?: { [name: string]: any }; /** * JSONPath expression to select part of the state to be the output to this state. @@ -42,7 +42,7 @@ export interface StateProps { * * @default $ */ - outputPath?: string; + readonly outputPath?: string; /** * JSONPath expression to indicate where to inject the state's output @@ -52,7 +52,7 @@ export interface StateProps { * * @default $ */ - resultPath?: string; + readonly resultPath?: string; } /** @@ -127,6 +127,10 @@ export abstract class State extends cdk.Construct implements IChainable { protected readonly resultPath?: string; protected readonly branches: StateGraph[] = []; protected defaultChoice?: State; + + /** + * @internal + */ protected _next?: State; private readonly retries: RetryProps[] = []; @@ -215,6 +219,7 @@ export abstract class State extends cdk.Construct implements IChainable { /** * Add a retrier to the retry list of this state + * @internal */ protected _addRetry(props: RetryProps = {}) { this.retries.push({ @@ -225,6 +230,7 @@ export abstract class State extends cdk.Construct implements IChainable { /** * Add an error handler to the catch list of this state + * @internal */ protected _addCatch(handler: State, props: CatchProps = {}) { this.catches.push({ @@ -382,7 +388,7 @@ export interface FindStateOptions { * * @default false */ - includeErrorHandlers?: boolean; + readonly includeErrorHandlers?: boolean; } /** diff --git a/packages/@aws-cdk/aws-stepfunctions/lib/states/succeed.ts b/packages/@aws-cdk/aws-stepfunctions/lib/states/succeed.ts index f884a07d426a9..4278e281f911c 100644 --- a/packages/@aws-cdk/aws-stepfunctions/lib/states/succeed.ts +++ b/packages/@aws-cdk/aws-stepfunctions/lib/states/succeed.ts @@ -11,7 +11,7 @@ export interface SucceedProps { * * @default No comment */ - comment?: string; + readonly comment?: string; /** * JSONPath expression to select part of the state to be the input to this state. @@ -21,7 +21,7 @@ export interface SucceedProps { * * @default $ */ - inputPath?: string; + readonly inputPath?: string; /** * JSONPath expression to select part of the state to be the output to this state. @@ -31,7 +31,7 @@ export interface SucceedProps { * * @default $ */ - outputPath?: string; + readonly outputPath?: string; } diff --git a/packages/@aws-cdk/aws-stepfunctions/lib/states/task.ts b/packages/@aws-cdk/aws-stepfunctions/lib/states/task.ts index a6ed6025de560..3aa11676d6675 100644 --- a/packages/@aws-cdk/aws-stepfunctions/lib/states/task.ts +++ b/packages/@aws-cdk/aws-stepfunctions/lib/states/task.ts @@ -15,14 +15,14 @@ export interface TaskProps { * * Can be either a Lambda Function or an Activity. */ - resource: IStepFunctionsTaskResource; + readonly resource: IStepFunctionsTaskResource; /** * An optional description for this state * * @default No comment */ - comment?: string; + readonly comment?: string; /** * JSONPath expression to select part of the state to be the input to this state. @@ -32,7 +32,7 @@ export interface TaskProps { * * @default $ */ - inputPath?: string; + readonly inputPath?: string; /** * Parameters pass a collection of key-value pairs, either static values or JSONPath expressions that select from the input. @@ -42,7 +42,7 @@ export interface TaskProps { * * @default No parameters */ - parameters?: { [name: string]: any }; + readonly parameters?: { [name: string]: any }; /** * JSONPath expression to select part of the state to be the output to this state. @@ -52,7 +52,7 @@ export interface TaskProps { * * @default $ */ - outputPath?: string; + readonly outputPath?: string; /** * JSONPath expression to indicate where to inject the state's output @@ -62,7 +62,7 @@ export interface TaskProps { * * @default $ */ - resultPath?: string; + readonly resultPath?: string; /** * Maximum run time of this state @@ -71,7 +71,7 @@ export interface TaskProps { * * @default 60 */ - timeoutSeconds?: number; + readonly timeoutSeconds?: number; /** * Maximum time between heart beats @@ -82,7 +82,7 @@ export interface TaskProps { * * @default No heart beat timeout */ - heartbeatSeconds?: number; + readonly heartbeatSeconds?: number; } /** @@ -281,33 +281,33 @@ export interface StepFunctionsTaskResourceProps { /** * The ARN of the resource */ - resourceArn: string; + readonly resourceArn: string; /** * Additional policy statements to add to the execution role * * @default No policy roles */ - policyStatements?: iam.PolicyStatement[]; + readonly policyStatements?: iam.PolicyStatement[]; /** * Prefix for singular metric names of activity actions * * @default No such metrics */ - metricPrefixSingular?: string; + readonly metricPrefixSingular?: string; /** * Prefix for plural metric names of activity actions * * @default No such metrics */ - metricPrefixPlural?: string; + readonly metricPrefixPlural?: string; /** * The dimensions to attach to metrics * * @default No metrics */ - metricDimensions?: cloudwatch.DimensionHash; + readonly metricDimensions?: cloudwatch.DimensionHash; } \ No newline at end of file diff --git a/packages/@aws-cdk/aws-stepfunctions/lib/states/wait.ts b/packages/@aws-cdk/aws-stepfunctions/lib/states/wait.ts index cc0f8ce507fdd..869763a2d2c50 100644 --- a/packages/@aws-cdk/aws-stepfunctions/lib/states/wait.ts +++ b/packages/@aws-cdk/aws-stepfunctions/lib/states/wait.ts @@ -12,14 +12,14 @@ export interface WaitProps { * * @default No comment */ - comment?: string; + readonly comment?: string; /** * Wait a fixed number of seconds * * Exactly one of seconds, secondsPath, timestamp, timestampPath must be supplied. */ - seconds?: number; + readonly seconds?: number; /** * Wait until the given ISO8601 timestamp @@ -28,7 +28,7 @@ export interface WaitProps { * * @example 2016-03-14T01:59:00Z */ - timestamp?: string; + readonly timestamp?: string; /** * Wait for a number of seconds stored in the state object. @@ -37,7 +37,7 @@ export interface WaitProps { * * @example $.waitSeconds */ - secondsPath?: string; + readonly secondsPath?: string; /** * Wait until a timestamp found in the state object. @@ -46,7 +46,7 @@ export interface WaitProps { * * @example $.waitTimestamp */ - timestampPath?: string; + readonly timestampPath?: string; } /** diff --git a/packages/@aws-cdk/aws-stepfunctions/lib/types.ts b/packages/@aws-cdk/aws-stepfunctions/lib/types.ts index 8af16b439bbff..1efd71f983144 100644 --- a/packages/@aws-cdk/aws-stepfunctions/lib/types.ts +++ b/packages/@aws-cdk/aws-stepfunctions/lib/types.ts @@ -83,14 +83,14 @@ export interface RetryProps { * * @default All errors */ - errors?: string[]; + readonly errors?: string[]; /** * How many seconds to wait initially before retrying * * @default 1 */ - intervalSeconds?: number; + readonly intervalSeconds?: number; /** * How many times to retry this particular error. @@ -100,14 +100,14 @@ export interface RetryProps { * * @default 3 */ - maxAttempts?: number; + readonly maxAttempts?: number; /** * Multiplication for how much longer the wait interval gets on every retry * * @default 2 */ - backoffRate?: number; + readonly backoffRate?: number; } /** @@ -122,7 +122,7 @@ export interface CatchProps { * * @default All errors */ - errors?: string[]; + readonly errors?: string[]; /** * JSONPath expression to indicate where to inject the error data @@ -132,7 +132,7 @@ export interface CatchProps { * * @default $ */ - resultPath?: string; + readonly resultPath?: string; } /** diff --git a/packages/@aws-cdk/cdk/lib/app.ts b/packages/@aws-cdk/cdk/lib/app.ts index fb408123df743..46c8f6493489c 100644 --- a/packages/@aws-cdk/cdk/lib/app.ts +++ b/packages/@aws-cdk/cdk/lib/app.ts @@ -1,6 +1,6 @@ import cxapi = require('@aws-cdk/cx-api'); -import { ConstructOrder, Root } from './construct'; -import { FileSystemStore, InMemoryStore, ISynthesisSession, SynthesisSession } from './synthesis'; +import { Root } from './construct'; +import { FileSystemStore, InMemoryStore, ISynthesisSession, Synthesizer } from './synthesis'; /** * Custom construction properties for a CDK program @@ -13,14 +13,14 @@ export interface AppProps { * * @default true if running via CDK toolkit (CDK_OUTDIR is set), false otherwise */ - autoRun?: boolean; + readonly autoRun?: boolean; /** * Additional context values for the application * * @default No additional context */ - context?: { [key: string]: string }; + readonly context?: { [key: string]: string }; } /** @@ -69,35 +69,15 @@ export class App extends Root { store = new InMemoryStore(); } - const session = this._session = new SynthesisSession({ + const synth = new Synthesizer(); + + this._session = synth.synthesize(this, { store, legacyManifest: this.legacyManifest, runtimeInformation: this.runtimeInformation }); - // the three holy phases of synthesis: prepare, validate and synthesize - - // prepare - this.node.prepareTree(); - - // validate - const errors = this.node.validateTree(); - if (errors.length > 0) { - const errorList = errors.map(e => `[${e.source.node.path}] ${e.message}`).join('\n '); - throw new Error(`Validation failed with the following errors:\n ${errorList}`); - } - - // synthesize (leaves first) - for (const c of this.node.findAll(ConstructOrder.PostOrder)) { - if (SynthesisSession.isSynthesizable(c)) { - c.synthesize(session); - } - } - - // write session manifest and lock store - session.close(); - - return session; + return this._session; } /** diff --git a/packages/@aws-cdk/cdk/lib/arn.ts b/packages/@aws-cdk/cdk/lib/arn.ts index 6386155371753..8cbdbbe822f77 100644 --- a/packages/@aws-cdk/cdk/lib/arn.ts +++ b/packages/@aws-cdk/cdk/lib/arn.ts @@ -1,6 +1,7 @@ import { Fn } from './fn'; import { Stack } from './stack'; import { unresolved } from './unresolved'; +import { filterUndefined } from './util'; /** * Creates an ARN from components. @@ -130,28 +131,16 @@ export function parseArn(arn: string, sepIfToken: string = '/', hasName: boolean resourceName += rest.join(':'); } - const result: ArnComponents = { service, resource }; - if (partition) { - result.partition = partition; - } - - if (region) { - result.region = region; - } - - if (account) { - result.account = account; - } - - if (resourceName) { - result.resourceName = resourceName; - } - - if (sep) { - result.sep = sep; - } - - return result; + // "|| undefined" will cause empty strings to be treated as "undefined" + return filterUndefined({ + service: service || undefined, + resource: resource || undefined , + partition: partition || undefined, + region: region || undefined, + account: account || undefined, + resourceName, + sep + }); } /** @@ -223,13 +212,13 @@ export interface ArnComponents { * * @default The AWS partition the stack is deployed to. */ - partition?: string; + readonly partition?: string; /** * The service namespace that identifies the AWS product (for example, * 's3', 'iam', 'codepipline'). */ - service: string; + readonly service: string; /** * The region the resource resides in. Note that the ARNs for some resources @@ -237,7 +226,7 @@ export interface ArnComponents { * * @default The region the stack is deployed to. */ - region?: string; + readonly region?: string; /** * The ID of the AWS account that owns the resource, without the hyphens. @@ -246,13 +235,13 @@ export interface ArnComponents { * * @default The account the stack is deployed to. */ - account?: string; + readonly account?: string; /** * Resource type (e.g. "table", "autoScalingGroup", "certificate"). * For some resource types, e.g. S3 buckets, this field defines the bucket name. */ - resource: string; + readonly resource: string; /** * Separator between resource type and the resource. @@ -260,11 +249,11 @@ export interface ArnComponents { * Can be either '/', ':' or an empty string. Will only be used if resourceName is defined. * @default '/' */ - sep?: string; + readonly sep?: string; /** * Resource name or path within the resource (i.e. S3 bucket object key) or * a wildcard such as ``"*"``. This is service-dependent. */ - resourceName?: string; + readonly resourceName?: string; } diff --git a/packages/@aws-cdk/cdk/lib/cfn-condition.ts b/packages/@aws-cdk/cdk/lib/cfn-condition.ts index 1f28cc15047df..275db39e1207b 100644 --- a/packages/@aws-cdk/cdk/lib/cfn-condition.ts +++ b/packages/@aws-cdk/cdk/lib/cfn-condition.ts @@ -3,7 +3,7 @@ import { Construct } from './construct'; import { ResolveContext } from './token'; export interface CfnConditionProps { - expression?: ICfnConditionExpression; + readonly expression?: ICfnConditionExpression; } /** @@ -25,6 +25,9 @@ export class CfnCondition extends CfnRefElement implements ICfnConditionExpressi this.expression = props && props.expression; } + /** + * @internal + */ public _toCloudFormation(): object { if (!this.expression) { return { }; diff --git a/packages/@aws-cdk/cdk/lib/cfn-mapping.ts b/packages/@aws-cdk/cdk/lib/cfn-mapping.ts index 2444dff11ba5d..d59455dfab95a 100644 --- a/packages/@aws-cdk/cdk/lib/cfn-mapping.ts +++ b/packages/@aws-cdk/cdk/lib/cfn-mapping.ts @@ -3,7 +3,7 @@ import { Construct } from './construct'; import { Fn } from './fn'; export interface CfnMappingProps { - mapping?: { [k1: string]: { [k2: string]: any } }; + readonly mapping?: { [k1: string]: { [k2: string]: any } }; } /** @@ -43,6 +43,9 @@ export class CfnMapping extends CfnRefElement { return Fn.findInMap(this.logicalId, key1, key2); } + /** + * @internal + */ public _toCloudFormation(): object { return { Mappings: { diff --git a/packages/@aws-cdk/cdk/lib/cfn-output.ts b/packages/@aws-cdk/cdk/lib/cfn-output.ts index 519c03980b297..285b825f03ca5 100644 --- a/packages/@aws-cdk/cdk/lib/cfn-output.ts +++ b/packages/@aws-cdk/cdk/lib/cfn-output.ts @@ -6,14 +6,14 @@ export interface CfnOutputProps { * A String type that describes the output value. * The description can be a maximum of 4 K in length. */ - description?: string; + readonly description?: string; /** * The value of the property returned by the aws cloudformation describe-stacks command. * The value of an output can include literals, parameter references, pseudo-parameters, * a mapping value, or intrinsic functions. */ - value?: any; + readonly value?: any; /** * The name used to export the value of this output across stacks. @@ -24,7 +24,7 @@ export interface CfnOutputProps { * @default Automatically allocate a name when `makeImportValue()` is * called. */ - export?: string; + readonly export?: string; /** * Disables the automatic allocation of an export name for this output. @@ -34,14 +34,14 @@ export interface CfnOutputProps { * * @default false */ - disableExport?: boolean; + readonly disableExport?: boolean; /** * A condition from the "Conditions" section to associate with this output * value. If the condition evaluates to `false`, this output value will not * be included in the stack. */ - condition?: CfnCondition; + readonly condition?: CfnCondition; } export class CfnOutput extends CfnElement { @@ -111,6 +111,9 @@ export class CfnOutput extends CfnElement { return fn().importValue(this.obtainExportName()); } + /** + * @internal + */ public _toCloudFormation(): object { return { Outputs: { diff --git a/packages/@aws-cdk/cdk/lib/cfn-parameter.ts b/packages/@aws-cdk/cdk/lib/cfn-parameter.ts index 3d8e982f79f75..b8477b4b9ab1f 100644 --- a/packages/@aws-cdk/cdk/lib/cfn-parameter.ts +++ b/packages/@aws-cdk/cdk/lib/cfn-parameter.ts @@ -6,24 +6,24 @@ export interface CfnParameterProps { /** * The data type for the parameter (DataType). */ - type: string; + readonly type: string; /** * A value of the appropriate type for the template to use if no value is specified * when a stack is created. If you define constraints for the parameter, you must specify * a value that adheres to those constraints. */ - default?: any; + readonly default?: any; /** * A regular expression that represents the patterns to allow for String types. */ - allowedPattern?: string; + readonly allowedPattern?: string; /** * An array containing the list of values allowed for the parameter. */ - allowedValues?: string[]; + readonly allowedValues?: string[]; /** * A string that explains a constraint when the constraint is violated. @@ -31,38 +31,38 @@ export interface CfnParameterProps { * pattern of [A-Za-z0-9]+ displays the following error message when the user specifies * an invalid value: */ - constraintDescription?: string; + readonly constraintDescription?: string; /** * A string of up to 4000 characters that describes the parameter. */ - description?: string; + readonly description?: string; /** * An integer value that determines the largest number of characters you want to allow for String types. */ - maxLength?: number; + readonly maxLength?: number; /** * A numeric value that determines the largest numeric value you want to allow for Number types. */ - maxValue?: number; + readonly maxValue?: number; /** * An integer value that determines the smallest number of characters you want to allow for String types. */ - minLength?: number; + readonly minLength?: number; /** * A numeric value that determines the smallest numeric value you want to allow for Number types. */ - minValue?: number; + readonly minValue?: number; /** * Whether to mask the parameter value when anyone makes a call that describes the stack. * If you set the value to ``true``, the parameter value is masked with asterisks (``*****``). */ - noEcho?: boolean; + readonly noEcho?: boolean; } /** @@ -104,6 +104,9 @@ export class CfnParameter extends CfnRefElement { this.stringListValue = this.value.toList(); } + /** + * @internal + */ public _toCloudFormation(): object { return { Parameters: { diff --git a/packages/@aws-cdk/cdk/lib/cfn-resource.ts b/packages/@aws-cdk/cdk/lib/cfn-resource.ts index 9694cdf08d7ed..bcf6ba2f380e9 100644 --- a/packages/@aws-cdk/cdk/lib/cfn-resource.ts +++ b/packages/@aws-cdk/cdk/lib/cfn-resource.ts @@ -13,12 +13,12 @@ export interface CfnResourceProps { /** * CloudFormation resource type. */ - type: string; + readonly type: string; /** * CloudFormation properties. */ - properties?: any; + readonly properties?: any; } export interface ITaggable { @@ -64,7 +64,7 @@ export class CfnResource extends CfnRefElement { /** * Options for this resource, such as condition, update policy etc. */ - public readonly options: ResourceOptions = {}; + public readonly options: IResourceOptions = {}; /** * AWS resource type. @@ -205,6 +205,7 @@ export class CfnResource extends CfnRefElement { /** * Emits CloudFormation for this resource. + * @internal */ public _toCloudFormation(): object { try { @@ -266,7 +267,7 @@ export enum TagType { NotTaggable = 'NotTaggable', } -export interface ResourceOptions { +export interface IResourceOptions { /** * A condition to associate with this resource. This means that only if the condition evaluates to 'true' when the stack * is deployed, the resource will be included. This is provided to allow CDK projects to produce legacy templates, but noramlly diff --git a/packages/@aws-cdk/cdk/lib/cfn-rule.ts b/packages/@aws-cdk/cdk/lib/cfn-rule.ts index 207e43a5b5a1f..aeae6537e9183 100644 --- a/packages/@aws-cdk/cdk/lib/cfn-rule.ts +++ b/packages/@aws-cdk/cdk/lib/cfn-rule.ts @@ -29,12 +29,12 @@ export interface CfnRuleProps { * If the rule condition evaluates to false, the rule doesn't take effect. * If the function in the rule condition evaluates to true, expressions in each assert are evaluated and applied. */ - ruleCondition?: ICfnConditionExpression; + readonly ruleCondition?: ICfnConditionExpression; /** * Assertions which define the rule. */ - assertions?: RuleAssertion[]; + readonly assertions?: RuleAssertion[]; } /** @@ -92,6 +92,9 @@ export class CfnRule extends CfnRefElement { }); } + /** + * @internal + */ public _toCloudFormation(): object { return { Rules: { @@ -111,10 +114,10 @@ export interface RuleAssertion { /** * The assertion. */ - assert: ICfnConditionExpression; + readonly assert: ICfnConditionExpression; /** * The assertion description. */ - assertDescription: string; + readonly assertDescription: string; } diff --git a/packages/@aws-cdk/cdk/lib/construct.ts b/packages/@aws-cdk/cdk/lib/construct.ts index 172ed9dc4981e..080c97fd7b602 100644 --- a/packages/@aws-cdk/cdk/lib/construct.ts +++ b/packages/@aws-cdk/cdk/lib/construct.ts @@ -651,17 +651,17 @@ export interface MetadataEntry { /** * The type of the metadata entry. */ - type: string; + readonly type: string; /** * The data. */ - data?: any; + readonly data?: any; /** * A stack trace for when the entry was created. */ - trace: string[]; + readonly trace: string[]; } export class ValidationError { @@ -708,12 +708,12 @@ export interface Dependency { /** * Source the dependency */ - source: IConstruct; + readonly source: IConstruct; /** * Target of the dependency */ - target: IConstruct; + readonly target: IConstruct; } /** @@ -723,17 +723,17 @@ export interface Dependency { /** * Source the dependency */ - source: IConstruct; + readonly source: IConstruct; /** * Target of the dependency */ - target: IConstruct; + readonly target: IConstruct; } export interface OutgoingReference { - source: IConstruct; - reference: Reference; + readonly source: IConstruct; + readonly reference: Reference; } // Import this _after_ everything else to help node work the classes out in the correct order... diff --git a/packages/@aws-cdk/cdk/lib/context.ts b/packages/@aws-cdk/cdk/lib/context.ts index 9ced8ea2a6bda..7d3debbc9375f 100644 --- a/packages/@aws-cdk/cdk/lib/context.ts +++ b/packages/@aws-cdk/cdk/lib/context.ts @@ -146,7 +146,7 @@ export interface SSMParameterProviderProps { /** * The name of the parameter to lookup */ - parameterName: string; + readonly parameterName: string; } /** * Context provider that will read values from the SSM parameter store in the indicated account and region diff --git a/packages/@aws-cdk/cdk/lib/dynamic-reference.ts b/packages/@aws-cdk/cdk/lib/dynamic-reference.ts index 7be363e1f2e33..0cc42f48be353 100644 --- a/packages/@aws-cdk/cdk/lib/dynamic-reference.ts +++ b/packages/@aws-cdk/cdk/lib/dynamic-reference.ts @@ -8,12 +8,12 @@ export interface DynamicReferenceProps { /** * The service to retrieve the dynamic reference from */ - service: DynamicReferenceService; + readonly service: DynamicReferenceService; /** * The reference key of the dynamic reference */ - referenceKey: string; + readonly referenceKey: string; } /** diff --git a/packages/@aws-cdk/cdk/lib/environment.ts b/packages/@aws-cdk/cdk/lib/environment.ts index e3e0cd76eca21..8ae44a4aebed2 100644 --- a/packages/@aws-cdk/cdk/lib/environment.ts +++ b/packages/@aws-cdk/cdk/lib/environment.ts @@ -6,13 +6,13 @@ export interface Environment { * The AWS account ID for this environment. * If not specified, the context parameter `default-account` is used. */ - account?: string; + readonly account?: string; /** * The AWS region for this environment. * If not specified, the context parameter `default-region` is used. */ - region?: string; + readonly region?: string; } /** diff --git a/packages/@aws-cdk/cdk/lib/include.ts b/packages/@aws-cdk/cdk/lib/include.ts index a6d9831568be6..50998841c415f 100644 --- a/packages/@aws-cdk/cdk/lib/include.ts +++ b/packages/@aws-cdk/cdk/lib/include.ts @@ -5,7 +5,7 @@ export interface IncludeProps { /** * The CloudFormation template to include in the stack (as is). */ - template: object; + readonly template: object; } /** @@ -31,6 +31,9 @@ export class Include extends CfnElement { this.template = props.template; } + /** + * @internal + */ public _toCloudFormation() { return this.template; } diff --git a/packages/@aws-cdk/cdk/lib/resource-policy.ts b/packages/@aws-cdk/cdk/lib/resource-policy.ts index a7dcf67986cc3..a3ff6b9d84691 100644 --- a/packages/@aws-cdk/cdk/lib/resource-policy.ts +++ b/packages/@aws-cdk/cdk/lib/resource-policy.ts @@ -19,13 +19,13 @@ export interface CreationPolicy { * For an Auto Scaling group replacement update, specifies how many instances must signal success for the * update to succeed. */ - autoScalingCreationPolicy?: AutoScalingCreationPolicy; + readonly autoScalingCreationPolicy?: AutoScalingCreationPolicy; /** * When AWS CloudFormation creates the associated resource, configures the number of required success signals and * the length of time that AWS CloudFormation waits for those signals. */ - resourceSignal?: ResourceSignal; + readonly resourceSignal?: ResourceSignal; } /** @@ -40,7 +40,7 @@ export interface AutoScalingCreationPolicy { * If an instance doesn't send a signal within the time specified by the Timeout property, AWS CloudFormation assumes that the * instance wasn't created. */ - minSuccessfulInstancesPercent?: number; + readonly minSuccessfulInstancesPercent?: number; } /** @@ -54,14 +54,14 @@ export interface ResourceSignal { * If the resource receives a failure signal or doesn't receive the specified number of signals before the timeout period * expires, the resource creation fails and AWS CloudFormation rolls the stack back. */ - count?: number; + readonly count?: number; /** * The length of time that AWS CloudFormation waits for the number of signals that was specified in the Count property. * The timeout period starts after AWS CloudFormation starts creating the resource, and the timeout expires no sooner * than the time you specify but can occur shortly thereafter. The maximum time that you can specify is 12 hours. */ - timeout?: string; + readonly timeout?: string; } /** @@ -108,33 +108,33 @@ export interface UpdatePolicy { * AWS CloudFormation retains the old group until it finishes creating the new one. If the update fails, AWS CloudFormation * can roll back to the old Auto Scaling group and delete the new Auto Scaling group. */ - autoScalingReplacingUpdate?: AutoScalingReplacingUpdate; + readonly autoScalingReplacingUpdate?: AutoScalingReplacingUpdate; /** * To specify how AWS CloudFormation handles rolling updates for an Auto Scaling group, use the AutoScalingRollingUpdate * policy. Rolling updates enable you to specify whether AWS CloudFormation updates instances that are in an Auto Scaling * group in batches or all at once. */ - autoScalingRollingUpdate?: AutoScalingRollingUpdate; + readonly autoScalingRollingUpdate?: AutoScalingRollingUpdate; /** * To specify how AWS CloudFormation handles updates for the MinSize, MaxSize, and DesiredCapacity properties when * the AWS::AutoScaling::AutoScalingGroup resource has an associated scheduled action, use the AutoScalingScheduledAction * policy. */ - autoScalingScheduledAction?: AutoScalingScheduledAction; + readonly autoScalingScheduledAction?: AutoScalingScheduledAction; /** * To perform an AWS CodeDeploy deployment when the version changes on an AWS::Lambda::Alias resource, * use the CodeDeployLambdaAliasUpdate update policy. */ - codeDeployLambdaAliasUpdate?: CodeDeployLambdaAliasUpdate; + readonly codeDeployLambdaAliasUpdate?: CodeDeployLambdaAliasUpdate; /** * To modify a replication group's shards by adding or removing shards, rather than replacing the entire * AWS::ElastiCache::ReplicationGroup resource, use the UseOnlineResharding update policy. */ - useOnlineResharding?: boolean; + readonly useOnlineResharding?: boolean; } @@ -148,13 +148,13 @@ export interface AutoScalingRollingUpdate { /** * Specifies the maximum number of instances that AWS CloudFormation updates. */ - maxBatchSize?: number; + readonly maxBatchSize?: number; /** * Specifies the minimum number of instances that must be in service within the Auto Scaling group while AWS * CloudFormation updates old instances. */ - minInstancesInService?: number; + readonly minInstancesInService?: number; /** * Specifies the percentage of instances in an Auto Scaling rolling update that must signal success for an update to succeed. @@ -166,7 +166,7 @@ export interface AutoScalingRollingUpdate { * * If you specify this property, you must also enable the WaitOnResourceSignals and PauseTime properties. */ - minSuccessfulInstancesPercent?: number; + readonly minSuccessfulInstancesPercent?: number; /** * The amount of time that AWS CloudFormation pauses after making a change to a batch of instances to give those instances @@ -182,7 +182,7 @@ export interface AutoScalingRollingUpdate { * Specify PauseTime in the ISO8601 duration format (in the format PT#H#M#S, where each # is the number of hours, minutes, * and seconds, respectively). The maximum PauseTime is one hour (PT1H). */ - pauseTime?: string; + readonly pauseTime?: string; /** * Specifies the Auto Scaling processes to suspend during a stack update. Suspending processes prevents Auto Scaling from @@ -190,7 +190,7 @@ export interface AutoScalingRollingUpdate { * policies associated with an alarm. For valid values, see the ScalingProcesses.member.N parameter for the SuspendProcesses * action in the Auto Scaling API Reference. */ - suspendProcesses?: string[]; + readonly suspendProcesses?: string[]; /** * Specifies whether the Auto Scaling group waits on signals from new instances during an update. Use this property to @@ -203,7 +203,7 @@ export interface AutoScalingRollingUpdate { * verification by using the cfn-init helper script. For an example, see the verify_instance_health command in the Auto Scaling * rolling updates sample template. */ - waitOnResourceSignals?: boolean; + readonly waitOnResourceSignals?: boolean; } /** @@ -220,7 +220,7 @@ export interface AutoScalingRollingUpdate { * Auto Scaling group. */ export interface AutoScalingReplacingUpdate { - willReplace?: boolean; + readonly willReplace?: boolean; } /** @@ -240,7 +240,7 @@ export interface AutoScalingScheduledAction { * a stack update. If you modify any of the group size property values in your template, AWS CloudFormation uses the modified * values and updates your Auto Scaling group. */ - ignoreUnmodifiedGroupSizeProperties?: boolean; + readonly ignoreUnmodifiedGroupSizeProperties?: boolean; } /** @@ -251,20 +251,20 @@ export interface CodeDeployLambdaAliasUpdate { /** * The name of the AWS CodeDeploy application. */ - applicationName: string; + readonly applicationName: string; /** * The name of the AWS CodeDeploy deployment group. This is where the traffic-shifting policy is set. */ - deploymentGroupName: string; + readonly deploymentGroupName: string; /** * The name of the Lambda function to run before traffic routing starts. */ - beforeAllowTrafficHook?: string; + readonly beforeAllowTrafficHook?: string; /** * The name of the Lambda function to run after traffic routing completes. */ - afterAllowTrafficHook?: string; + readonly afterAllowTrafficHook?: string; } diff --git a/packages/@aws-cdk/cdk/lib/secret.ts b/packages/@aws-cdk/cdk/lib/secret.ts index ba28803fe530c..9883ec0a5baec 100644 --- a/packages/@aws-cdk/cdk/lib/secret.ts +++ b/packages/@aws-cdk/cdk/lib/secret.ts @@ -18,23 +18,23 @@ export interface SecretParameterProps { /** * The name of the SSM parameter where the secret value is stored. */ - ssmParameter: string; + readonly ssmParameter: string; /** * A string of up to 4000 characters that describes the parameter. * @default No description */ - description?: string; + readonly description?: string; /** * A regular expression that represents the patterns to allow for String types. */ - allowedPattern?: string; + readonly allowedPattern?: string; /** * An array containing the list of values allowed for the parameter. */ - allowedValues?: string[]; + readonly allowedValues?: string[]; /** * A string that explains a constraint when the constraint is violated. @@ -42,17 +42,17 @@ export interface SecretParameterProps { * pattern of [A-Za-z0-9]+ displays the following error message when the user specifies * an invalid value: */ - constraintDescription?: string; + readonly constraintDescription?: string; /** * An integer value that determines the largest number of characters you want to allow for String types. */ - maxLength?: number; + readonly maxLength?: number; /** * An integer value that determines the smallest number of characters you want to allow for String types. */ - minLength?: number; + readonly minLength?: number; } /** diff --git a/packages/@aws-cdk/cdk/lib/stack.ts b/packages/@aws-cdk/cdk/lib/stack.ts index 3a309bcba6b99..ed1023ffaee36 100644 --- a/packages/@aws-cdk/cdk/lib/stack.ts +++ b/packages/@aws-cdk/cdk/lib/stack.ts @@ -14,21 +14,21 @@ export interface StackProps { * If not supplied, the `default-account` and `default-region` context parameters will be * used. If they are undefined, it will not be possible to deploy the stack. */ - env?: Environment; + readonly env?: Environment; /** * Name to deploy the stack with * * @default Derived from construct path */ - stackName?: string; + readonly stackName?: string; /** * Strategy for logical ID generation * * Optional. If not supplied, the HashedNamingScheme will be used. */ - namingScheme?: IAddressingScheme; + readonly namingScheme?: IAddressingScheme; /** * Should the Stack be deployed when running `cdk deploy` without arguments @@ -39,9 +39,11 @@ export interface StackProps { * * @default true */ - autoDeploy?: boolean; + readonly autoDeploy?: boolean; } +const STACK_SYMBOL = Symbol('@aws-cdk/cdk.CfnReference'); + /** * A root construct which represents a single CloudFormation stack. */ @@ -64,8 +66,8 @@ export class Stack extends Construct { * * We do attribute detection since we can't reliably use 'instanceof'. */ - public static isStack(construct: IConstruct): construct is Stack { - return (construct as any)._isStack; + public static isStack(x: any): x is Stack { + return x[STACK_SYMBOL] === true; } private static readonly VALID_STACK_NAME_REGEX = /^[A-Za-z][A-Za-z0-9-]*$/; @@ -90,7 +92,7 @@ export class Stack extends Construct { /** * Options for CloudFormation template (like version, transform, description). */ - public readonly templateOptions: TemplateOptions = {}; + public readonly templateOptions: ITemplateOptions = {}; /** * The CloudFormation stack name. @@ -111,11 +113,6 @@ export class Stack extends Construct { */ public readonly autoDeploy: boolean; - /* - * Used to determine if this construct is a stack. - */ - protected readonly _isStack = true; - /** * Other stacks this stack depends on */ @@ -144,6 +141,8 @@ export class Stack extends Construct { // For unit test convenience parents are optional, so bypass the type check when calling the parent. super(scope!, name!); + Object.defineProperty(this, STACK_SYMBOL, { value: true }); + if (name && !Stack.VALID_STACK_NAME_REGEX.test(name)) { throw new Error(`Stack name must match the regular expression: ${Stack.VALID_STACK_NAME_REGEX.toString()}, got '${name}'`); } @@ -452,6 +451,8 @@ export class Stack extends Construct { * * CloudFormation stack names can include dashes in addition to the regular identifier * character classes, and we don't allow one of the magic markers. + * + * @internal */ protected _validateId(name: string) { if (name && !Stack.VALID_STACK_NAME_REGEX.test(name)) { @@ -495,55 +496,32 @@ export class Stack extends Construct { // write the CloudFormation template as a JSON file session.store.writeJson(template, this._toCloudFormation()); - const artifact: cxapi.Artifact = { + const deps = this.dependencies().map(s => s.name); + const meta = this.collectMetadata(); + + // add an artifact that represents this stack + session.addArtifact(this.name, { type: cxapi.ArtifactType.AwsCloudFormationStack, environment: this.environment, properties: { templateFile: template, + parameters: Object.keys(this.parameterValues).length > 0 ? this.node.resolve(this.parameterValues) : undefined }, autoDeploy: this.autoDeploy ? undefined : false, - }; - - if (Object.keys(this.parameterValues).length > 0) { - artifact.properties = artifact.properties || { }; - artifact.properties.parameters = this.node.resolve(this.parameterValues); - } - - const deps = this.dependencies().map(s => s.name); - if (deps.length > 0) { - artifact.dependencies = deps; - } - - const meta = this.collectMetadata(); - if (Object.keys(meta).length > 0) { - artifact.metadata = meta; - } - - if (this.missingContext && Object.keys(this.missingContext).length > 0) { - artifact.missing = this.missingContext; - } - - // add an artifact that represents this stack - session.addArtifact(this.name, artifact); + dependencies: deps.length > 0 ? deps : undefined, + metadata: Object.keys(meta).length > 0 ? meta : undefined, + missing: this.missingContext && Object.keys(this.missingContext).length > 0 ? this.missingContext : undefined + }); } /** * Applied defaults to environment attributes. */ private parseEnvironment(env: Environment = {}) { - const ret: Environment = {...env}; - - // if account is not specified, attempt to read from context. - if (!ret.account) { - ret.account = this.node.getContext(cxapi.DEFAULT_ACCOUNT_CONTEXT_KEY); - } - - // if region is not specified, attempt to read from context. - if (!ret.region) { - ret.region = this.node.getContext(cxapi.DEFAULT_REGION_CONTEXT_KEY); - } - - return ret; + return { + account: env.account ? env.account : this.node.getContext(cxapi.DEFAULT_ACCOUNT_CONTEXT_KEY), + region: env.region ? env.region : this.node.getContext(cxapi.DEFAULT_REGION_CONTEXT_KEY) + }; } /** @@ -632,7 +610,7 @@ function merge(template: any, part: any) { /** * CloudFormation template options for a stack. */ -export interface TemplateOptions { +export interface ITemplateOptions { /** * Gets or sets the description of this stack. * If provided, it will be included in the CloudFormation template's "Description" attribute. diff --git a/packages/@aws-cdk/cdk/lib/synthesis.ts b/packages/@aws-cdk/cdk/lib/synthesis.ts index b1c169047525a..47d2cfdbd581e 100644 --- a/packages/@aws-cdk/cdk/lib/synthesis.ts +++ b/packages/@aws-cdk/cdk/lib/synthesis.ts @@ -2,7 +2,9 @@ import cxapi = require('@aws-cdk/cx-api'); import fs = require('fs'); import os = require('os'); import path = require('path'); +import { ConstructOrder, IConstruct } from './construct'; import { collectRuntimeInformation } from './runtime-info'; +import { filterUndefined } from './util'; export interface ISynthesizable { synthesize(session: ISynthesisSession): void; @@ -14,25 +16,54 @@ export interface ISynthesisSession { addArtifact(id: string, droplet: cxapi.Artifact): void; addBuildStep(id: string, step: cxapi.BuildStep): void; tryGetArtifact(id: string): cxapi.Artifact | undefined; + getArtifact(id: string): cxapi.Artifact; } -export interface SynthesisSessionOptions { +export interface SynthesisOptions extends ManifestOptions { /** * The file store used for this session. + * @default InMemoryStore */ - store: ISessionStore; + readonly store?: ISessionStore; /** - * Emit the legacy manifest (`cdk.out`) when the session is closed (alongside `manifest.json`). + * Whether synthesis should skip the validation phase. * @default false */ - legacyManifest?: boolean; + readonly skipValidation?: boolean; +} - /** - * Include runtime information (module versions) in manifest. - * @default true - */ - runtimeInformation?: boolean; +export class Synthesizer { + public synthesize(root: IConstruct, options: SynthesisOptions = { }): ISynthesisSession { + const session = new SynthesisSession(options); + + // the three holy phases of synthesis: prepare, validate and synthesize + + // prepare + root.node.prepareTree(); + + // validate + const validate = options.skipValidation === undefined ? true : !options.skipValidation; + if (validate) { + const errors = root.node.validateTree(); + if (errors.length > 0) { + const errorList = errors.map(e => `[${e.source.node.path}] ${e.message}`).join('\n '); + throw new Error(`Validation failed with the following errors:\n ${errorList}`); + } + } + + // synthesize (leaves first) + for (const c of root.node.findAll(ConstructOrder.PostOrder)) { + if (SynthesisSession.isSynthesizable(c)) { + c.synthesize(session); + } + } + + // write session manifest and lock store + session.close(options); + + return session; + } } export class SynthesisSession implements ISynthesisSession { @@ -48,13 +79,9 @@ export class SynthesisSession implements ISynthesisSession { private readonly artifacts: { [id: string]: cxapi.Artifact } = { }; private readonly buildSteps: { [id: string]: cxapi.BuildStep } = { }; private _manifest?: cxapi.AssemblyManifest; - private readonly legacyManifest: boolean; - private readonly runtimeInfo: boolean; - constructor(options: SynthesisSessionOptions) { - this.store = options.store; - this.legacyManifest = options.legacyManifest !== undefined ? options.legacyManifest : false; - this.runtimeInfo = options.runtimeInformation !== undefined ? options.runtimeInformation : true; + constructor(options: SynthesisOptions) { + this.store = options.store || new InMemoryStore(); } public get manifest() { @@ -67,29 +94,37 @@ export class SynthesisSession implements ISynthesisSession { public addArtifact(id: string, artifact: cxapi.Artifact): void { cxapi.validateArtifact(artifact); - this.artifacts[id] = artifact; + this.artifacts[id] = filterUndefined(artifact); } public tryGetArtifact(id: string): cxapi.Artifact | undefined { return this.artifacts[id]; } + public getArtifact(id: string): cxapi.Artifact { + const artifact = this.tryGetArtifact(id); + if (!artifact) { + throw new Error(`Cannot find artifact ${id}`); + } + return artifact; + } + public addBuildStep(id: string, step: cxapi.BuildStep) { if (id in this.buildSteps) { throw new Error(`Build step ${id} already exists`); } - this.buildSteps[id] = step; + this.buildSteps[id] = filterUndefined(step); } - public close(): cxapi.AssemblyManifest { - const manifest: cxapi.AssemblyManifest = this._manifest = { + public close(options: ManifestOptions = { }): cxapi.AssemblyManifest { + const legacyManifest = options.legacyManifest !== undefined ? options.legacyManifest : false; + const runtimeInfo = options.runtimeInformation !== undefined ? options.runtimeInformation : true; + + const manifest: cxapi.AssemblyManifest = this._manifest = filterUndefined({ version: cxapi.PROTO_RESPONSE_VERSION, artifacts: this.artifacts, - }; - - if (this.runtimeInfo) { - manifest.runtime = collectRuntimeInformation(); - } + runtime: runtimeInfo ? collectRuntimeInformation() : undefined + }); this.store.writeFile(cxapi.MANIFEST_FILE, JSON.stringify(manifest, undefined, 2)); @@ -102,20 +137,36 @@ export class SynthesisSession implements ISynthesisSession { this.store.writeFile(cxapi.BUILD_FILE, JSON.stringify(buildManifest, undefined, 2)); } - if (this.legacyManifest) { + if (legacyManifest) { const legacy: cxapi.SynthesizeResponse = { ...manifest, - stacks: renderLegacyStacks(this.artifacts, this.store) + stacks: renderLegacyStacks(manifest, this.store) }; // render the legacy manifest (cdk.out) which also contains a "stacks" attribute with all the rendered stacks. this.store.writeFile(cxapi.OUTFILE_NAME, JSON.stringify(legacy, undefined, 2)); } + this.store.lock(); + return manifest; } } +export interface ManifestOptions { + /** + * Emit the legacy manifest (`cdk.out`) when the session is closed (alongside `manifest.json`). + * @default false + */ + readonly legacyManifest?: boolean; + + /** + * Include runtime information (module versions) in manifest. + * @default true + */ + readonly runtimeInformation?: boolean; +} + export interface ISessionStore { /** * Creates a directory and returns it's full path. @@ -171,21 +222,14 @@ export interface ISessionStore { /** * Do not allow further writes into the store. */ - finalize(): void; -} - -export interface SynthesisSessionOptions { - /** - * Where to store the - */ - store: ISessionStore; + lock(): void; } export interface FileSystemStoreOptions { /** * The output directory for synthesis artifacts */ - outdir: string; + readonly outdir: string; } /** @@ -249,7 +293,7 @@ export class FileSystemStore implements ISessionStore { return fs.readdirSync(this.outdir).sort(); } - public finalize() { + public lock() { this.locked = true; } @@ -318,7 +362,7 @@ export class InMemoryStore implements ISessionStore { return [ ...Object.keys(this.files), ...Object.keys(this.dirs) ].sort(); } - public finalize() { + public lock() { this.locked = true; } @@ -332,9 +376,10 @@ export class InMemoryStore implements ISessionStore { } } -function renderLegacyStacks(artifacts: { [id: string]: cxapi.Artifact }, store: ISessionStore) { +export function renderLegacyStacks(manifest: cxapi.AssemblyManifest, store: ISessionStore) { // special case for backwards compat. build a list of stacks for the manifest const stacks = new Array(); + const artifacts = manifest.artifacts || { }; for (const [ id, artifact ] of Object.entries(artifacts)) { if (artifact.type === cxapi.ArtifactType.AwsCloudFormationStack) { @@ -349,23 +394,15 @@ function renderLegacyStacks(artifacts: { [id: string]: cxapi.Artifact }, store: throw new Error(`"environment" must match regex: ${cxapi.AWS_ENV_REGEX}`); } - const synthStack: cxapi.SynthesizedStack = { + stacks.push(filterUndefined({ name: id, environment: { name: artifact.environment.substr('aws://'.length), account: match[1], region: match[2] }, template, metadata: artifact.metadata || {}, autoDeploy: artifact.autoDeploy, - }; - - if (artifact.dependencies && artifact.dependencies.length > 0) { - synthStack.dependsOn = artifact.dependencies; - } - - if (artifact.missing) { - synthStack.missing = artifact.missing; - } - - stacks.push(synthStack); + dependsOn: artifact.dependencies && artifact.dependencies.length > 0 ? artifact.dependencies : undefined, + missing: artifact.missing + })); } } diff --git a/packages/@aws-cdk/cdk/lib/tag-aspect.ts b/packages/@aws-cdk/cdk/lib/tag-aspect.ts index 0e4623208170d..e6f373fffea92 100644 --- a/packages/@aws-cdk/cdk/lib/tag-aspect.ts +++ b/packages/@aws-cdk/cdk/lib/tag-aspect.ts @@ -11,7 +11,7 @@ export interface TagProps { * * @default true */ - applyToLaunchedInstances?: boolean; + readonly applyToLaunchedInstances?: boolean; /** * An array of Resource Types that will not receive this tag @@ -21,7 +21,7 @@ export interface TagProps { * this array. * @default [] */ - excludeResourceTypes?: string[]; + readonly excludeResourceTypes?: string[]; /** * An array of Resource Types that will receive this tag @@ -30,7 +30,7 @@ export interface TagProps { * tag only to Resource types that are included in this array. * @default [] */ - includeResourceTypes?: string[]; + readonly includeResourceTypes?: string[]; /** * Priority of the tag operation @@ -50,7 +50,7 @@ export interface TagProps { * - 50 for tags added directly to CloudFormation resources * */ - priority?: number; + readonly priority?: number; } /** diff --git a/packages/@aws-cdk/cdk/lib/tag.ts b/packages/@aws-cdk/cdk/lib/tag.ts index a05aa282335b9..5e3f2446018a5 100644 --- a/packages/@aws-cdk/cdk/lib/tag.ts +++ b/packages/@aws-cdk/cdk/lib/tag.ts @@ -5,10 +5,10 @@ export interface CfnTag { /** * @link http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-resource-tags.html#cfn-resource-tags-key */ - key: string; + readonly key: string; /** * @link http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-resource-tags.html#cfn-resource-tags-value */ - value: string; + readonly value: string; } diff --git a/packages/@aws-cdk/cdk/lib/token.ts b/packages/@aws-cdk/cdk/lib/token.ts index 709f17e1f5201..d9c72c769fe40 100644 --- a/packages/@aws-cdk/cdk/lib/token.ts +++ b/packages/@aws-cdk/cdk/lib/token.ts @@ -120,8 +120,8 @@ export class Token { * Current resolution context for tokens */ export interface ResolveContext { - scope: IConstruct; - prefix: string[]; + readonly scope: IConstruct; + readonly prefix: string[]; } /** diff --git a/packages/@aws-cdk/cdk/lib/util.ts b/packages/@aws-cdk/cdk/lib/util.ts index 941b14d8c1e8a..ba83bfc00f81b 100644 --- a/packages/@aws-cdk/cdk/lib/util.ts +++ b/packages/@aws-cdk/cdk/lib/util.ts @@ -50,6 +50,28 @@ export function ignoreEmpty(obj: any): any { }); } +/** + * Returns a copy of `obj` without undefined values in maps or arrays. + */ +export function filterUndefined(obj: any): any { + if (Array.isArray(obj)) { + return obj.filter(x => x !== undefined).map(x => filterUndefined(x)); + } + + if (typeof(obj) === 'object') { + const ret: any = { }; + for (const [key, value] of Object.entries(obj)) { + if (value === undefined) { + continue; + } + ret[key] = filterUndefined(value); + } + return ret; + } + + return obj; +} + /** * A Token that applies a function AFTER resolve resolution */ diff --git a/packages/@aws-cdk/cdk/package-lock.json b/packages/@aws-cdk/cdk/package-lock.json index e6f9c7b90b2c6..b6f124bfcc11a 100644 --- a/packages/@aws-cdk/cdk/package-lock.json +++ b/packages/@aws-cdk/cdk/package-lock.json @@ -1,6 +1,6 @@ { "name": "@aws-cdk/cdk", - "version": "0.25.3", + "version": "0.26.0", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/packages/@aws-cdk/cdk/test/test.app.ts b/packages/@aws-cdk/cdk/test/test.app.ts index 8897e98f2d29e..04c8995d0932b 100644 --- a/packages/@aws-cdk/cdk/test/test.app.ts +++ b/packages/@aws-cdk/cdk/test/test.app.ts @@ -41,7 +41,7 @@ function synthStack(name: string, includeMetadata: boolean = false, context?: an } if (!includeMetadata) { - delete stack.metadata; + delete (stack as any).metadata; } return stack; @@ -52,9 +52,9 @@ export = { const response = synth(); // clean up metadata so assertion will be sane - response.stacks.forEach(s => delete s.metadata); - delete response.runtime; - delete response.artifacts; + response.stacks.forEach(s => delete (s as any).metadata); + delete (response as any).runtime; + delete (response as any).artifacts; test.deepEqual(response, { version: '0.19.0', diff --git a/packages/@aws-cdk/cdk/test/test.synthesis.ts b/packages/@aws-cdk/cdk/test/test.synthesis.ts index 88d0582d8e755..c360054a24546 100644 --- a/packages/@aws-cdk/cdk/test/test.synthesis.ts +++ b/packages/@aws-cdk/cdk/test/test.synthesis.ts @@ -4,7 +4,7 @@ import { Test } from 'nodeunit'; import os = require('os'); import path = require('path'); import cdk = require('../lib'); -import { FileSystemStore, InMemoryStore, SynthesisSession } from '../lib'; +import { Construct, FileSystemStore, InMemoryStore, ISynthesisSession, SynthesisSession, Synthesizer } from '../lib'; const storeTestMatrix: any = {}; @@ -90,7 +90,6 @@ export = { type: 'aws:cloudformation:stack', environment: 'aws://unknown-account/unknown-region', properties: { templateFile: 'one-stack.template.json' }, - autoDeploy: undefined, } }, }); @@ -128,6 +127,49 @@ export = { test.done(); }, + 'it should be possible to synthesize without an app'(test: Test) { + const calls = new Array(); + + class SynthesizeMe extends Construct { + constructor() { + super(undefined as any, 'id'); + } + + protected validate(): string[] { + calls.push('validate'); + return []; + } + + protected prepare(): void { + calls.push('prepare'); + } + + protected synthesize(session: ISynthesisSession) { + calls.push('synthesize'); + + session.addArtifact('art', { + type: cxapi.ArtifactType.AwsEcrDockerImage, + environment: 'aws://unknown-account/us-east-1' + }); + + session.store.writeJson('hey.json', { hello: 123 }); + } + } + + const root = new SynthesizeMe(); + + const synth = new Synthesizer(); + const result = synth.synthesize(root); + + test.deepEqual(calls, [ 'prepare', 'validate', 'synthesize' ]); + test.deepEqual(result.store.readJson('hey.json'), { hello: 123 }); + test.deepEqual(result.manifest.artifacts!.art, { + type: 'aws:ecr:image', + environment: 'aws://unknown-account/us-east-1' + }); + test.done(); + }, + 'store': storeTestMatrix }; @@ -146,7 +188,7 @@ const storeTests = { test.throws(() => store.writeFile('bla.txt', 'override is forbidden')); // WHEN - store.finalize(); + store.lock(); // THEN test.throws(() => store.writeFile('another.txt', 'locked!')); @@ -174,7 +216,7 @@ const storeTests = { test.throws(() => store.mkdir('dir1')); // WHEN - store.finalize(); + store.lock(); test.throws(() => store.mkdir('dir3')); test.done(); }, diff --git a/packages/@aws-cdk/cfnspec/package-lock.json b/packages/@aws-cdk/cfnspec/package-lock.json index 55f1be9fac84a..27e9eab019c5e 100644 --- a/packages/@aws-cdk/cfnspec/package-lock.json +++ b/packages/@aws-cdk/cfnspec/package-lock.json @@ -1,6 +1,6 @@ { "name": "@aws-cdk/cfnspec", - "version": "0.25.3", + "version": "0.26.0", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/packages/@aws-cdk/cloudformation-diff/package-lock.json b/packages/@aws-cdk/cloudformation-diff/package-lock.json index 862d0c5f19609..faf6305d408f9 100644 --- a/packages/@aws-cdk/cloudformation-diff/package-lock.json +++ b/packages/@aws-cdk/cloudformation-diff/package-lock.json @@ -1,6 +1,6 @@ { "name": "@aws-cdk/cloudformation-diff", - "version": "0.25.3", + "version": "0.26.0", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/packages/@aws-cdk/cx-api/lib/artifacts.ts b/packages/@aws-cdk/cx-api/lib/artifacts.ts index 3d2e7727fcda4..ce59da7d077db 100644 --- a/packages/@aws-cdk/cx-api/lib/artifacts.ts +++ b/packages/@aws-cdk/cx-api/lib/artifacts.ts @@ -7,13 +7,13 @@ export enum ArtifactType { } export interface Artifact { - type: ArtifactType; - environment: string; // format: aws://account/region - metadata?: { [path: string]: any }; - dependencies?: string[]; - missing?: { [key: string]: any }; - properties?: { [name: string]: any }; - autoDeploy?: boolean; + readonly type: ArtifactType; + readonly environment: string; // format: aws://account/region + readonly metadata?: { [path: string]: any }; + readonly dependencies?: string[]; + readonly missing?: { [key: string]: any }; + readonly properties?: { [name: string]: any }; + readonly autoDeploy?: boolean; } export function validateArtifact(artifcat: Artifact) { diff --git a/packages/@aws-cdk/cx-api/lib/build.ts b/packages/@aws-cdk/cx-api/lib/build.ts index c4363f67d5f50..4b5ec14188ed5 100644 --- a/packages/@aws-cdk/cx-api/lib/build.ts +++ b/packages/@aws-cdk/cx-api/lib/build.ts @@ -1,13 +1,13 @@ export interface BuildStep { - type: string; - depends?: string[]; - parameters: { + readonly type: string; + readonly depends?: string[]; + readonly parameters: { [key: string]: any }; } export interface BuildManifest { - steps: { [id: string]: BuildStep }; + readonly steps: { [id: string]: BuildStep }; } export enum BuildStepType { diff --git a/packages/@aws-cdk/cx-api/lib/context/availability-zones.ts b/packages/@aws-cdk/cx-api/lib/context/availability-zones.ts index 6850c2e593fc1..fd66c220b9909 100644 --- a/packages/@aws-cdk/cx-api/lib/context/availability-zones.ts +++ b/packages/@aws-cdk/cx-api/lib/context/availability-zones.ts @@ -7,13 +7,12 @@ export interface AvailabilityZonesContextQuery { /** * Query account */ - account?: string; + readonly account?: string; /** * Query region */ - region?: string; - + readonly region?: string; } /** diff --git a/packages/@aws-cdk/cx-api/lib/context/hosted-zone.ts b/packages/@aws-cdk/cx-api/lib/context/hosted-zone.ts index 7862b0affac82..c2dad65d924f7 100644 --- a/packages/@aws-cdk/cx-api/lib/context/hosted-zone.ts +++ b/packages/@aws-cdk/cx-api/lib/context/hosted-zone.ts @@ -7,22 +7,22 @@ export interface HostedZoneContextQuery { /** * Query account */ - account?: string; + readonly account?: string; /** * Query region */ - region?: string; + readonly region?: string; /** * The domain name e.g. example.com to lookup */ - domainName: string; + readonly domainName: string; /** * True if the zone you want to find is a private hosted zone */ - privateZone?: boolean; + readonly privateZone?: boolean; /** * The VPC ID to that the private zone must be associated with @@ -30,7 +30,7 @@ export interface HostedZoneContextQuery { * If you provide VPC ID and privateZone is false, this will return no results * and raise an error. */ - vpcId?: string; + readonly vpcId?: string; } /** diff --git a/packages/@aws-cdk/cx-api/lib/context/ssm-parameter.ts b/packages/@aws-cdk/cx-api/lib/context/ssm-parameter.ts index caf807aca1ceb..c0b27a46db796 100644 --- a/packages/@aws-cdk/cx-api/lib/context/ssm-parameter.ts +++ b/packages/@aws-cdk/cx-api/lib/context/ssm-parameter.ts @@ -7,17 +7,17 @@ export interface SSMParameterContextQuery { /** * Query account */ - account?: string; + readonly account?: string; /** * Query region */ - region?: string; + readonly region?: string; /** * Parameter name to query */ - parameterName?: string; + readonly parameterName?: string; } // Response is a string \ No newline at end of file diff --git a/packages/@aws-cdk/cx-api/lib/context/vpc.ts b/packages/@aws-cdk/cx-api/lib/context/vpc.ts index 8a4490cfa3fe8..ac112df1fdbee 100644 --- a/packages/@aws-cdk/cx-api/lib/context/vpc.ts +++ b/packages/@aws-cdk/cx-api/lib/context/vpc.ts @@ -7,12 +7,12 @@ export interface VpcContextQuery { /** * Query account */ - account?: string; + readonly account?: string; /** * Query region */ - region?: string; + readonly region?: string; /** * Filters to apply to the VPC @@ -21,7 +21,7 @@ export interface VpcContextQuery { * * @see https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_DescribeVpcs.html */ - filter: {[key: string]: string}; + readonly filter: {[key: string]: string}; } /** @@ -32,57 +32,57 @@ export interface VpcContextResponse { /** * VPC id */ - vpcId: string; + readonly vpcId: string; /** * AZs */ - availabilityZones: string[]; + readonly availabilityZones: string[]; /** * IDs of all public subnets * * Element count: #(availabilityZones) · #(publicGroups) */ - publicSubnetIds?: string[]; + readonly publicSubnetIds?: string[]; /** * Name of public subnet groups * * Element count: #(publicGroups) */ - publicSubnetNames?: string[]; + readonly publicSubnetNames?: string[]; /** * IDs of all private subnets * * Element count: #(availabilityZones) · #(privateGroups) */ - privateSubnetIds?: string[]; + readonly privateSubnetIds?: string[]; /** * Name of private subnet groups * * Element count: #(privateGroups) */ - privateSubnetNames?: string[]; + readonly privateSubnetNames?: string[]; /** * IDs of all isolated subnets * * Element count: #(availabilityZones) · #(isolatedGroups) */ - isolatedSubnetIds?: string[]; + readonly isolatedSubnetIds?: string[]; /** * Name of isolated subnet groups * * Element count: #(isolatedGroups) */ - isolatedSubnetNames?: string[]; + readonly isolatedSubnetNames?: string[]; /** * The VPN gateway ID */ - vpnGatewayId?: string; + readonly vpnGatewayId?: string; } diff --git a/packages/@aws-cdk/cx-api/lib/cxapi.ts b/packages/@aws-cdk/cx-api/lib/cxapi.ts index f2ee63733958f..ae76ea0ea1eac 100644 --- a/packages/@aws-cdk/cx-api/lib/cxapi.ts +++ b/packages/@aws-cdk/cx-api/lib/cxapi.ts @@ -40,8 +40,8 @@ export const CONTEXT_ENV = 'CDK_CONTEXT_JSON'; * Represents a missing piece of context. */ export interface MissingContext { - provider: string; - props: { + readonly provider: string; + readonly props: { account?: string; region?: string; [key: string]: any; @@ -52,41 +52,41 @@ export interface AssemblyManifest { /** * Protocol version */ - version: string; + readonly version: string; /** * The set of artifacts in this assembly. */ - artifacts?: { [id: string]: Artifact }; + readonly artifacts?: { [id: string]: Artifact }; /** * Runtime information. */ - runtime?: AppRuntime; + readonly runtime?: AppRuntime; } /** * @deprecated use `AssemblyManifest` */ export interface SynthesizeResponse extends AssemblyManifest { - stacks: SynthesizedStack[]; + readonly stacks: SynthesizedStack[]; } /** * A complete synthesized stack */ export interface SynthesizedStack { - name: string; - environment: Environment; - missing?: { [key: string]: MissingContext }; - metadata: StackMetadata; - template: any; - autoDeploy?: boolean; + readonly name: string; + readonly environment: Environment; + readonly missing?: { [key: string]: MissingContext }; + readonly metadata: StackMetadata; + readonly template: any; + readonly autoDeploy?: boolean; /** * Other stacks this stack depends on */ - dependsOn?: string[]; + readonly dependsOn?: string[]; } /** @@ -96,17 +96,17 @@ export interface MetadataEntry { /** * The type of the metadata entry. */ - type: string; + readonly type: string; /** * The data. */ - data?: any; + readonly data?: any; /** * A stack trace for when the entry was created. */ - trace: string[]; + readonly trace: string[]; } /** @@ -121,7 +121,7 @@ export interface AppRuntime { /** * The list of libraries loaded in the application, associated with their versions. */ - libraries: { [name: string]: string }; + readonly libraries: { [name: string]: string }; } /** diff --git a/packages/@aws-cdk/cx-api/lib/environment.ts b/packages/@aws-cdk/cx-api/lib/environment.ts index 078379aed1c9c..6dac39a141f27 100644 --- a/packages/@aws-cdk/cx-api/lib/environment.ts +++ b/packages/@aws-cdk/cx-api/lib/environment.ts @@ -3,11 +3,11 @@ */ export interface Environment { /** The arbitrary name of this environment (user-set, or at least user-meaningful) */ - name: string; + readonly name: string; /** The 12-digit AWS account ID for the account this environment deploys into */ - account: string; + readonly account: string; /** The AWS region name where this environment deploys into */ - region: string; + readonly region: string; } diff --git a/packages/@aws-cdk/cx-api/lib/metadata/assets.ts b/packages/@aws-cdk/cx-api/lib/metadata/assets.ts index 3bcb79b6f0723..ef446fc583cac 100644 --- a/packages/@aws-cdk/cx-api/lib/metadata/assets.ts +++ b/packages/@aws-cdk/cx-api/lib/metadata/assets.ts @@ -30,49 +30,49 @@ export interface FileAssetMetadataEntry { /** * Requested packaging style */ - packaging: 'zip' | 'file'; + readonly packaging: 'zip' | 'file'; /** * Path on disk to the asset */ - path: string; + readonly path: string; /** * Logical identifier for the asset */ - id: string; + readonly id: string; /** * Name of parameter where S3 bucket should be passed in */ - s3BucketParameter: string; + readonly s3BucketParameter: string; /** * Name of parameter where S3 key should be passed in */ - s3KeyParameter: string; + readonly s3KeyParameter: string; } export interface ContainerImageAssetMetadataEntry { /** * Type of asset */ - packaging: 'container-image'; + readonly packaging: 'container-image'; /** * Path on disk to the asset */ - path: string; + readonly path: string; /** * Logical identifier for the asset */ - id: string; + readonly id: string; /** * ECR Repository name and tag (separated by ":") where this asset is stored. */ - imageNameParameter: string; + readonly imageNameParameter: string; /** * ECR repository name, if omitted a default name based on the asset's @@ -83,7 +83,7 @@ export interface ContainerImageAssetMetadataEntry { * * * @default automatically derived from the asset's ID. */ - repositoryName?: string; + readonly repositoryName?: string; } export type AssetMetadataEntry = FileAssetMetadataEntry | ContainerImageAssetMetadataEntry; diff --git a/packages/@aws-cdk/region-info/package-lock.json b/packages/@aws-cdk/region-info/package-lock.json index b6dfc9aa49e07..a2c72fb753949 100644 --- a/packages/@aws-cdk/region-info/package-lock.json +++ b/packages/@aws-cdk/region-info/package-lock.json @@ -1,6 +1,6 @@ { "name": "@aws-cdk/region-info", - "version": "0.25.3", + "version": "0.26.0", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/packages/@aws-cdk/runtime-values/lib/rtv.ts b/packages/@aws-cdk/runtime-values/lib/rtv.ts index 8407430b8698b..12811be13a3f3 100644 --- a/packages/@aws-cdk/runtime-values/lib/rtv.ts +++ b/packages/@aws-cdk/runtime-values/lib/rtv.ts @@ -7,12 +7,12 @@ export interface RuntimeValueProps { * A namespace for the runtime value. * It is recommended to use the name of the library/package that advertises this value. */ - package: string; + readonly package: string; /** * The value to advertise. Can be either a primitive value or a token. */ - value: any; + readonly value: any; } /** diff --git a/packages/@aws-cdk/runtime-values/test/test.rtv.ts b/packages/@aws-cdk/runtime-values/test/test.rtv.ts index ce965f9bf7436..05eb8b94625b1 100644 --- a/packages/@aws-cdk/runtime-values/test/test.rtv.ts +++ b/packages/@aws-cdk/runtime-values/test/test.rtv.ts @@ -13,7 +13,6 @@ export = { new RuntimeValueTest(stack, 'RuntimeValue'); - console.log(JSON.stringify(stack._toCloudFormation(), undefined, 2)); test.done(); } }; diff --git a/packages/decdk/package-lock.json b/packages/decdk/package-lock.json index 683752c1ff76b..c0de62ed61327 100644 --- a/packages/decdk/package-lock.json +++ b/packages/decdk/package-lock.json @@ -1,6 +1,6 @@ { "name": "decdk", - "version": "0.25.3", + "version": "0.26.0", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -2797,21 +2797,29 @@ } }, "jsii-reflect": { - "version": "0.7.15", - "resolved": "https://registry.npmjs.org/jsii-reflect/-/jsii-reflect-0.7.15.tgz", - "integrity": "sha512-ZY/1utHln83ly1UscerO93O+O4b5ZFaMlZDO1S+4wvhYs2yLxjLMhgzToHXdLiy1ja9hXqFpSBVDpUKB2sC9rA==", + "version": "0.8.0", + "resolved": "https://registry.npmjs.org/jsii-reflect/-/jsii-reflect-0.8.0.tgz", + "integrity": "sha512-rK6syj+Usm+rFzVSBM3FCT7ThzYUWck1YWyI+eDV1ffOjnh7rSG4NvUK3VcA+/IZ+DmJ/sPGnnTJ9w9XjZ7/2g==", "requires": { "colors": "^1.3.3", "fs-extra": "^7.0.1", - "jsii-spec": "^0.7.15", - "oo-ascii-tree": "^0.7.15", + "jsii-spec": "^0.8.0", + "oo-ascii-tree": "^0.8.0", "yargs": "^13.2.1" }, "dependencies": { "get-caller-file": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.1.tgz", - "integrity": "sha512-SpOZHfz845AH0wJYVuZk2jWDqFmu7Xubsx+ldIpwzy5pDUpu7OJHK7QYNSA2NPlDSKQwM1GFaAkciOWjjW92Sg==" + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", + "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==" + }, + "jsii-spec": { + "version": "0.8.0", + "resolved": "https://registry.npmjs.org/jsii-spec/-/jsii-spec-0.8.0.tgz", + "integrity": "sha512-vkPtZKE36nwKsJ9MfVmmy4tjRJ5rb/dVemCYGkmJ5+xX88BzxZCfHfhdbB3rEAMQPt5KKXc9aV/OrF1m6pc5HQ==", + "requires": { + "jsonschema": "^1.2.4" + } }, "require-main-filename": { "version": "2.0.0", @@ -2819,9 +2827,9 @@ "integrity": "sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg==" }, "yargs": { - "version": "13.2.1", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-13.2.1.tgz", - "integrity": "sha512-HgY0xHGmPPakg6kEDufqxZuXVtvPZcipORC8O7S44iEnwsUmP+qnhReHc6d1dyeIZkrPmYFblh45Z2oeDn++fQ==", + "version": "13.2.2", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-13.2.2.tgz", + "integrity": "sha512-WyEoxgyTD3w5XRpAQNYUB9ycVH/PQrToaTXdYXRdOXvEy1l19br+VJsc0vcO8PTGg5ro/l/GY7F/JMEBmI0BxA==", "requires": { "cliui": "^4.0.0", "find-up": "^3.0.0", @@ -2851,6 +2859,7 @@ "version": "0.7.15", "resolved": "https://registry.npmjs.org/jsii-spec/-/jsii-spec-0.7.15.tgz", "integrity": "sha512-OytA5XH4EvhJXTEac9h8ugqEosg9GZcqsIYQEzIi6zD44gjjIIPSbfyL8X70Z1dR3hlVNz7NdbTrxI88+X+h/w==", + "dev": true, "requires": { "jsonschema": "^1.2.4" } @@ -3356,9 +3365,9 @@ } }, "oo-ascii-tree": { - "version": "0.7.15", - "resolved": "https://registry.npmjs.org/oo-ascii-tree/-/oo-ascii-tree-0.7.15.tgz", - "integrity": "sha512-fMGG/Ns+kMO9def/XmzhH2M7X4Z0/BFJBTjo36puDjG6tieLIdgu+38yvTS3/PCV/JUr0v37ZrXOh/Hu/yX2Jg==" + "version": "0.8.0", + "resolved": "https://registry.npmjs.org/oo-ascii-tree/-/oo-ascii-tree-0.8.0.tgz", + "integrity": "sha512-NAE24C9mESzpHJsT92kA9+cdBD0FvPO2XNKxPonn2iZ2kPlcQ0V0N+Vytrfv5RNg3iVgV0ep7Ac0RSy26w++Ag==" }, "optimist": { "version": "0.6.1", @@ -4256,26 +4265,26 @@ } }, "string-width": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.0.0.tgz", - "integrity": "sha512-rr8CUxBbvOZDUvc5lNIJ+OC1nPVpz+Siw9VBtUjB9b6jZehZLFt0JMCZzShFHIsI8cbhm0EsNIfWJMFV3cu3Ew==", + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz", + "integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==", "requires": { "emoji-regex": "^7.0.1", "is-fullwidth-code-point": "^2.0.0", - "strip-ansi": "^5.0.0" + "strip-ansi": "^5.1.0" }, "dependencies": { "ansi-regex": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.0.0.tgz", - "integrity": "sha512-iB5Dda8t/UqpPI/IjsejXu5jOGDrzn41wJyljwPH65VCIbk6+1BzFIMJGFwTNrYXT1CrD+B4l19U7awiQ8rk7w==" + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz", + "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==" }, "strip-ansi": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.0.0.tgz", - "integrity": "sha512-Uu7gQyZI7J7gn5qLn1Np3G9vcYGTVqB+lFTytnDJv83dd8T22aGH451P3jueT2/QemInJDfxHB5Tde5OzgG1Ow==", + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", + "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", "requires": { - "ansi-regex": "^4.0.0" + "ansi-regex": "^4.1.0" } } } diff --git a/packages/decdk/package.json b/packages/decdk/package.json index ad90cc929fd52..1254477f0ac64 100644 --- a/packages/decdk/package.json +++ b/packages/decdk/package.json @@ -124,7 +124,7 @@ "@aws-cdk/region-info": "^0.26.0", "@aws-cdk/runtime-values": "^0.26.0", "fs-extra": "^7.0.1", - "jsii-reflect": "^0.7.15", + "jsii-reflect": "^0.8.0", "jsonschema": "^1.2.4", "yaml": "1.3.2", "yargs": "^13.1.0" diff --git a/packages/simple-resource-bundler/package-lock.json b/packages/simple-resource-bundler/package-lock.json index 7167892a01c0d..045577385fa86 100644 --- a/packages/simple-resource-bundler/package-lock.json +++ b/packages/simple-resource-bundler/package-lock.json @@ -1,6 +1,6 @@ { "name": "simple-resource-bundler", - "version": "0.25.3", + "version": "0.26.0", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/scripts/foreach.sh b/scripts/foreach.sh index e8e0cede9ca24..27b2db682dfb8 100755 --- a/scripts/foreach.sh +++ b/scripts/foreach.sh @@ -71,8 +71,8 @@ heading "${next}: ${command} (${remaining} remaining)" ( cd ${next} ${command} || { - error "error: last command failed. fix problem and resume by executing:" - error " $0" + error "error: last command failed. fix problem and resume by executing: $0" + error "directory: ${next}" exit 1 } ) diff --git a/tools/awslint/package-lock.json b/tools/awslint/package-lock.json index 642379f50f68a..8f012af8ca82a 100644 --- a/tools/awslint/package-lock.json +++ b/tools/awslint/package-lock.json @@ -1,6 +1,6 @@ { "name": "awslint", - "version": "0.25.3", + "version": "0.26.0", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/tools/cdk-build-tools/package-lock.json b/tools/cdk-build-tools/package-lock.json index 389e899f292bf..a596edcdc61e2 100644 --- a/tools/cdk-build-tools/package-lock.json +++ b/tools/cdk-build-tools/package-lock.json @@ -1,6 +1,6 @@ { "name": "cdk-build-tools", - "version": "0.25.3", + "version": "0.26.0", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -973,23 +973,13 @@ "integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=" }, "codemaker": { - "version": "0.7.15", - "resolved": "https://registry.npmjs.org/codemaker/-/codemaker-0.7.15.tgz", - "integrity": "sha512-eIbUqMweJnXZWTn0pzPBEZRDX+Y91c8P6d//YXhcHAw2WLVwUHs/xRZLGZJwdLc/NpAkRKns5F2SgJWc4ghWCw==", + "version": "0.8.0", + "resolved": "https://registry.npmjs.org/codemaker/-/codemaker-0.8.0.tgz", + "integrity": "sha512-SFpTLhnKKMVlFI5OryfvUIZZImjFlcUufcixKb2JpEThiUYs7uHEWyDj6ZwKVg6NHUus7qIK6J8j1/gnIx4ILQ==", "requires": { - "camelcase": "^5.0.0", - "decamelize": "^2.0.0", + "camelcase": "^5.2.0", + "decamelize": "^1.2.0", "fs-extra": "^7.0.1" - }, - "dependencies": { - "decamelize": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-2.0.0.tgz", - "integrity": "sha512-Ikpp5scV3MSYxY39ymh45ZLEecsTdv/Xj2CaQfI8RLMuwi7XvjX9H/fhraiSuU+C5w5NTDu4ZU72xNiZnurBPg==", - "requires": { - "xregexp": "4.0.0" - } - } } }, "collection-visit": { @@ -2652,62 +2642,42 @@ "integrity": "sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA==" }, "jsii": { - "version": "0.7.15", - "resolved": "https://registry.npmjs.org/jsii/-/jsii-0.7.15.tgz", - "integrity": "sha512-J49txVIwIo+Re0HqP5v6LPnR5VSamg8ygjzUhDAMkpiGM5wk61+bexvndH+e1Q5o/EYkgQlLju3wJdI7bw7cmw==", + "version": "0.8.0", + "resolved": "https://registry.npmjs.org/jsii/-/jsii-0.8.0.tgz", + "integrity": "sha512-K5U5XI/TIW5pzzLBf1DsGGTlT8r4YjNmVG9qephAQI5Y+I64g3cu4+4OPy28AhR6xBiZcIdXY9Hvph9x31Bv0w==", "requires": { "case": "^1.6.1", "colors": "^1.3.3", "deep-equal": "^1.0.1", "fs-extra": "^7.0.1", - "jsii-spec": "^0.7.15", + "jsii-spec": "^0.8.0", "log4js": "^4.0.2", "semver": "^5.6.0", "sort-json": "^2.0.0", "spdx-license-list": "^5.0.0", "typescript": "^3.3.3333", - "yargs": "^12.0.5" - }, - "dependencies": { - "yargs": { - "version": "12.0.5", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-12.0.5.tgz", - "integrity": "sha512-Lhz8TLaYnxq/2ObqHDql8dX8CJi97oHxrjUcYtzKbbykPtVW9WB+poxI+NM2UIzsMgNCZTIf0AQwsjK5yMAqZw==", - "requires": { - "cliui": "^4.0.0", - "decamelize": "^1.2.0", - "find-up": "^3.0.0", - "get-caller-file": "^1.0.1", - "os-locale": "^3.0.0", - "require-directory": "^2.1.1", - "require-main-filename": "^1.0.1", - "set-blocking": "^2.0.0", - "string-width": "^2.0.0", - "which-module": "^2.0.0", - "y18n": "^3.2.1 || ^4.0.0", - "yargs-parser": "^11.1.1" - } - } + "yargs": "^13.2.2" } }, "jsii-pacmak": { - "version": "0.7.15", - "resolved": "https://registry.npmjs.org/jsii-pacmak/-/jsii-pacmak-0.7.15.tgz", - "integrity": "sha512-F8XDh3p7j+vUxiHvx2uJOr4D/gGCilpNwpu/70tdgdZTL3A2gAtL+R4+g/BqbXT73J+BAUrsBdTpawyoWvBluA==", + "version": "0.8.0", + "resolved": "https://registry.npmjs.org/jsii-pacmak/-/jsii-pacmak-0.8.0.tgz", + "integrity": "sha512-RQ/CctxOsdvavS1lKzWwB3q7pjzfTWExOA4yYuGYQMZzTWpUte2QAsO3Bmr6/Y9rHWK6r6kxrQq3UwezCwkJow==", "requires": { "clone": "^2.1.2", - "codemaker": "^0.7.15", + "codemaker": "^0.8.0", + "escape-string-regexp": "^1.0.5", "fs-extra": "^7.0.1", - "jsii-spec": "^0.7.15", + "jsii-spec": "^0.8.0", "spdx-license-list": "^5.0.0", "xmlbuilder": "^11.0.0", - "yargs": "^13.2.1" + "yargs": "^13.2.2" } }, "jsii-spec": { - "version": "0.7.15", - "resolved": "https://registry.npmjs.org/jsii-spec/-/jsii-spec-0.7.15.tgz", - "integrity": "sha512-OytA5XH4EvhJXTEac9h8ugqEosg9GZcqsIYQEzIi6zD44gjjIIPSbfyL8X70Z1dR3hlVNz7NdbTrxI88+X+h/w==", + "version": "0.8.0", + "resolved": "https://registry.npmjs.org/jsii-spec/-/jsii-spec-0.8.0.tgz", + "integrity": "sha512-vkPtZKE36nwKsJ9MfVmmy4tjRJ5rb/dVemCYGkmJ5+xX88BzxZCfHfhdbB3rEAMQPt5KKXc9aV/OrF1m6pc5HQ==", "requires": { "jsonschema": "^1.2.4" } @@ -2842,21 +2812,21 @@ "integrity": "sha512-U7KCmLdqsGHBLeWqYlFA0V0Sl6P08EE1ZrmA9cxjUE0WVqT9qnyVDPz1kzpFEP0jdJuFnasWIfSd7fsaNXkpbg==" }, "log4js": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/log4js/-/log4js-4.0.2.tgz", - "integrity": "sha512-KE7HjiieVDPPdveA3bJZSuu0n8chMkFl8mIoisBFxwEJ9FmXe4YzNuiqSwYUiR1K8q8/5/8Yd6AClENY1RA9ww==", + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/log4js/-/log4js-4.1.0.tgz", + "integrity": "sha512-eDa+zZPeVEeK6QGJAePyXM6pg4P3n3TO5rX9iZMVY48JshsTyLJZLIL5HipI1kQ2qLsSyOpUqNND/C5H4WhhiA==", "requires": { "date-format": "^2.0.0", - "debug": "^3.1.0", + "debug": "^4.1.1", "flatted": "^2.0.0", "rfdc": "^1.1.2", - "streamroller": "^1.0.1" + "streamroller": "^1.0.4" }, "dependencies": { "debug": { - "version": "3.2.6", - "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.6.tgz", - "integrity": "sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==", + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", + "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", "requires": { "ms": "^2.1.1" } @@ -4902,9 +4872,9 @@ "integrity": "sha1-NbCYdbT/SfJqd35QmzCQoyJr8ks=" }, "streamroller": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/streamroller/-/streamroller-1.0.3.tgz", - "integrity": "sha512-P7z9NwP51EltdZ81otaGAN3ob+/F88USJE546joNq7bqRNTe6jc74fTBDyynxP4qpIfKlt/CesEYicuMzI0yJg==", + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/streamroller/-/streamroller-1.0.4.tgz", + "integrity": "sha512-Wc2Gm5ygjSX8ZpW9J7Y9FwiSzTlKSvcl0FTTMd3rn7RoxDXpBW+xD9TY5sWL2n0UR61COB0LG1BQvN6nTUQbLQ==", "requires": { "async": "^2.6.1", "date-format": "^2.0.0", @@ -5629,14 +5599,9 @@ "integrity": "sha512-A5CUptxDsvxKJEU3yO6DuWBSJz/qizqzJKOMIfUJHETbBw/sFaDxgd6fxm1ewUaM0jZ444Fc5vC5ROYurg/4Pw==" }, "xmlbuilder": { - "version": "11.0.0", - "resolved": "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-11.0.0.tgz", - "integrity": "sha512-LzeAc96zUlknAk0F+xOXC8hO1D4ISG1ivov9UBjFkPcbSk6jVGhm9J8pTQp1ksZp9YbOws8pae8tVs+hwQl12w==" - }, - "xregexp": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/xregexp/-/xregexp-4.0.0.tgz", - "integrity": "sha512-PHyM+sQouu7xspQQwELlGwwd05mXUFqwFYfqPO0cC7x4fxyHnnuetmQr6CjJiafIDoH4MogHb9dOoJzR/Y4rFg==" + "version": "11.0.1", + "resolved": "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-11.0.1.tgz", + "integrity": "sha512-fDlsI/kFEx7gLvbecc0/ohLG50fugQp8ryHzMTuW9vSa1GJ0XYWKnhsUx7oie3G98+r56aTQIUB4kht42R3JvA==" }, "y18n": { "version": "4.0.0", diff --git a/tools/cdk-build-tools/package.json b/tools/cdk-build-tools/package.json index 8bb0d2c59eaee..1cf005d3b872c 100644 --- a/tools/cdk-build-tools/package.json +++ b/tools/cdk-build-tools/package.json @@ -36,8 +36,8 @@ "awslint": "^0.26.0", "fs-extra": "^7.0.1", "jest": "^24.4.0", - "jsii": "^0.7.15", - "jsii-pacmak": "^0.7.15", + "jsii": "^0.8.0", + "jsii-pacmak": "^0.8.0", "nodeunit": "^0.11.3", "nyc": "^13.3.0", "ts-jest": "^24.0.0", diff --git a/tools/cdk-integ-tools/package-lock.json b/tools/cdk-integ-tools/package-lock.json index 0e9a7c871cd7a..6efc3446c73ff 100644 --- a/tools/cdk-integ-tools/package-lock.json +++ b/tools/cdk-integ-tools/package-lock.json @@ -1,6 +1,6 @@ { "name": "cdk-integ-tools", - "version": "0.25.3", + "version": "0.26.0", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/tools/cfn2ts/lib/codegen.ts b/tools/cfn2ts/lib/codegen.ts index 289e09c2a7bc3..80c8089fd5a5b 100644 --- a/tools/cfn2ts/lib/codegen.ts +++ b/tools/cfn2ts/lib/codegen.ts @@ -519,7 +519,7 @@ export default class CodeGenerator { const javascriptPropertyName = genspec.cloudFormationToScriptName(propName); this.docLink(spec.Documentation, additionalDocs); - this.code.line(`${javascriptPropertyName}${question}: ${this.findNativeType(context, spec, propName)};`); + this.code.line(`readonly ${javascriptPropertyName}${question}: ${this.findNativeType(context, spec, propName)};`); return javascriptPropertyName; } diff --git a/tools/cfn2ts/package-lock.json b/tools/cfn2ts/package-lock.json index c7850342cd8fd..40b48c88c01d6 100644 --- a/tools/cfn2ts/package-lock.json +++ b/tools/cfn2ts/package-lock.json @@ -1,6 +1,6 @@ { "name": "cfn2ts", - "version": "0.25.3", + "version": "0.26.0", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/tools/pkglint/package-lock.json b/tools/pkglint/package-lock.json index fd6259711e79b..f5745c72cd588 100644 --- a/tools/pkglint/package-lock.json +++ b/tools/pkglint/package-lock.json @@ -1,6 +1,6 @@ { "name": "pkglint", - "version": "0.25.3", + "version": "0.26.0", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/tools/pkgtools/package-lock.json b/tools/pkgtools/package-lock.json index 02974d4715eac..6d6923ab2fbd9 100644 --- a/tools/pkgtools/package-lock.json +++ b/tools/pkgtools/package-lock.json @@ -1,6 +1,6 @@ { "name": "pkgtools", - "version": "0.25.3", + "version": "0.26.0", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/tools/y-npm/package-lock.json b/tools/y-npm/package-lock.json index fe5ab164a17fc..251d43fff046d 100644 --- a/tools/y-npm/package-lock.json +++ b/tools/y-npm/package-lock.json @@ -1,6 +1,6 @@ { "name": "y-npm", - "version": "0.25.3", + "version": "0.26.0", "lockfileVersion": 1, "requires": true, "dependencies": {