Skip to content

Commit

Permalink
Merge branch 'main' into feat/entrypoint-cmd-17092
Browse files Browse the repository at this point in the history
  • Loading branch information
pallymore authored Oct 26, 2022
2 parents c038a53 + 89a7365 commit c44fd86
Show file tree
Hide file tree
Showing 185 changed files with 7,208 additions and 2,383 deletions.
9 changes: 0 additions & 9 deletions .devcontainer.json

This file was deleted.

19 changes: 19 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
FROM jsii/superchain:1-buster-slim

USER root

# Change uid/guid of superchain so it can work with the docker-in-docker feature
RUN groupmod --gid 1000 superchain \
&& usermod --uid 1000 --gid 1000 superchain \
&& chown -R 1000:1000 /home/superchain

USER superchain

# Setup oh-my-zsh
RUN sudo apt-get update && export DEBIAN_FRONTEND=noninteractive \
&& sudo apt-get -y install --no-install-recommends zsh vim \
&& sudo rm -rf /var/lib/apt/lists/* \
&& sudo chsh -s $(which zsh) $(whoami)
RUN sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattended \
# Required, otherwise shell is extermly slow due the size of the aws-cdk
&& sudo sh -c 'echo "[oh-my-zsh]\n hide-dirty = 1" > /etc/gitconfig'
21 changes: 21 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"name": "aws-cdk",
"build": {
"dockerfile": "Dockerfile"
},

"customizations": {
"vscode": {
"extensions": ["dbaeumer.vscode-eslint"]
}
},

"postCreateCommand": "yarn install",
"remoteUser": "superchain",
"features": {
"docker-in-docker": {
"version": "latest",
"moby": true
}
}
}
2 changes: 1 addition & 1 deletion .github/workflows/auto-approve.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ jobs:
permissions:
pull-requests: write
steps:
- uses: hmarr/auto-approve-action@v3.0.0
- uses: hmarr/auto-approve-action@v3.1.0
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"
13 changes: 11 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ This document describes how to set up a development environment and submit your
let us know if it's not up-to-date (even better, submit a PR with your corrections ;-)).

- [Getting Started](#getting-started)
- [Local setup](#setup)
- [Dev Container](#dev-container)
- [Pull Requests](#pull-requests)
- [Step 1: Find something to work on](#step-1-find-something-to-work-on)
- [Step 2: Design (optional)](#step-2-design)
Expand All @@ -23,7 +25,7 @@ let us know if it's not up-to-date (even better, submit a PR with your correcti
- [Breaking Changes](#breaking-changes)
- [Documentation](#documentation)
- [Rosetta](#rosetta)
- [Tools](#tools)
- [Tools](#tools-advanced)
- [Linters](#linters)
- [cfn2ts](#cfn2ts)
- [scripts/foreach.sh](#scriptsforeachsh)
Expand Down Expand Up @@ -147,7 +149,14 @@ docker$ exit

The `dist/` folder within each module contains the packaged up language artifacts.

## Gitpod (Alternative)
### Dev Container

The AWS CDK provides a VS Code Dev Container with all dependencies pre-installed.
Please follow the [setup instructions](https://code.visualstudio.com/docs/remote/containers-tutorial) to configure VS Code.

With VS Code setup, you will be prompted to open the `aws-cdk` repo in a Dev Container, or you can choos "Dev Containers: Reopen in Container" from the VS Code command palette.

### Gitpod (Alternative)

You may also set up your local development environment using [Gitpod](http://gitpod.io) -
a service that allows you to spin up an in-browser Visual Studio Code-compatible editor,
Expand Down
12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,17 @@
"devDependencies": {
"@types/prettier": "2.6.0",
"@yarnpkg/lockfile": "^1.1.0",
"cdk-generate-synthetic-examples": "^0.1.36",
"cdk-generate-synthetic-examples": "^0.1.43",
"conventional-changelog-cli": "^2.2.2",
"fs-extra": "^9.1.0",
"graceful-fs": "^4.2.10",
"jest-junit": "^13.2.0",
"jsii-diff": "^1.69.0",
"jsii-pacmak": "^1.69.0",
"jsii-reflect": "^1.69.0",
"jsii-rosetta": "^1.69.0",
"jsii-diff": "^1.70.0",
"jsii-pacmak": "^1.70.0",
"jsii-reflect": "^1.70.0",
"jsii-rosetta": "^1.70.0",
"lerna": "^4.0.0",
"patch-package": "^6.4.7",
"patch-package": "^6.5.0",
"semver": "^6.3.0",
"standard-version": "^9.5.0",
"typescript": "~3.9.10"
Expand Down
12 changes: 6 additions & 6 deletions packages/@aws-cdk/aws-apigateway/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,13 +128,13 @@ You can use Amazon API Gateway with AWS Step Functions as the backend integratio

The `StepFunctionsRestApi` only supports integration with Synchronous Express state machine. The `StepFunctionsRestApi` construct makes this easy by setting up input, output and error mapping.

The construct sets up an API endpoint and maps the `ANY` HTTP method and any calls to the API endpoint starts an express workflow execution for the underlying state machine.
The construct sets up an API endpoint and maps the `ANY` HTTP method and any calls to the API endpoint starts an express workflow execution for the underlying state machine.

Invoking the endpoint with any HTTP method (`GET`, `POST`, `PUT`, `DELETE`, ...) in the example below will send the request to the state machine as a new execution. On success, an HTTP code `200` is returned with the execution output as the Response Body.

If the execution fails, an HTTP `500` response is returned with the `error` and `cause` from the execution output as the Response Body. If the request is invalid (ex. bad execution input) HTTP code `400` is returned.

The response from the invocation contains only the `output` field from the
The response from the invocation contains only the `output` field from the
[StartSyncExecution](https://docs.aws.amazon.com/step-functions/latest/apireference/API_StartSyncExecution.html#API_StartSyncExecution_ResponseSyntax) API.
In case of failures, the fields `error` and `cause` are returned as part of the response.
Other metadata such as billing details, AWS account ID and resource ARNs are not returned in the API response.
Expand All @@ -154,7 +154,7 @@ const stateMachine: stepfunctions.IStateMachine = new stepfunctions.StateMachine
definition: stateMachineDefinition,
stateMachineType: stepfunctions.StateMachineType.EXPRESS,
});

new apigateway.StepFunctionsRestApi(this, 'StepFunctionsRestApi', {
deploy: true,
stateMachine: stateMachine,
Expand All @@ -172,7 +172,7 @@ AWS Step Functions will receive the request body in its input as follows:
```json
{
"body": {
"customerId": 1
"customerId": 1
},
"path": "/",
"querystring": {}
Expand Down Expand Up @@ -1378,8 +1378,8 @@ api.addGatewayResponse('test-response', {
type: apigateway.ResponseType.ACCESS_DENIED,
statusCode: '500',
responseHeaders: {
'Access-Control-Allow-Origin': "test.com",
'test-key': 'test-value'
'Access-Control-Allow-Origin': 'test.com',
'test-key': 'test-value',
},
templates: {
'application/json': '{ "message": $context.error.messageString, "statusCode": "488", "type": "$context.error.responseType" }'
Expand Down
3 changes: 2 additions & 1 deletion packages/@aws-cdk/aws-apigateway/lib/gateway-response.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { IResource, Resource } from '@aws-cdk/core';
import { Construct } from 'constructs';
import { CfnGatewayResponse, CfnGatewayResponseProps } from './apigateway.generated';
import { IRestApi } from './restapi';
import { normalizeResponseParameterValue } from './util';

/**
* Represents gateway response resource.
Expand Down Expand Up @@ -88,7 +89,7 @@ export class GatewayResponse extends Resource implements IGatewayResponse {

const responseParameters: { [key: string]: string } = {};
for (const [header, value] of Object.entries(responseHeaders)) {
responseParameters[`gatewayresponse.header.${header}`] = value;
responseParameters[`gatewayresponse.header.${header}`] = normalizeResponseParameterValue(value) ;
}
return responseParameters;
}
Expand Down
16 changes: 16 additions & 0 deletions packages/@aws-cdk/aws-apigateway/lib/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,22 @@ export function validateHttpMethod(method: string, messagePrefix: string = '') {
}
}

/**
* Response header values need to be enclosed in single quotes.
*/
export function normalizeResponseParameterValue(value: string) {
if (!value) {
return value;
}

// check if the value is already enclosed in single quotes
if (value.startsWith("'") && value.endsWith("'")) {
return value;
}

return `'${value}'`;
}

export function parseMethodOptionsPath(originalPath: string): { resourcePath: string, httpMethod: string } {
if (!originalPath.startsWith('/')) {
throw new Error(`Method options path must start with '/': ${originalPath}`);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ describe('gateway response', () => {
responseHeaders: {
'Access-Control-Allow-Origin': 'test.com',
'test-key': 'test-value',
'another-test': "'test-value-enclosed-within-single-quotes'",
},
});

Expand All @@ -54,8 +55,9 @@ describe('gateway response', () => {
RestApiId: stack.resolve(api.restApiId),
StatusCode: '500',
ResponseParameters: {
'gatewayresponse.header.Access-Control-Allow-Origin': 'test.com',
'gatewayresponse.header.test-key': 'test-value',
'gatewayresponse.header.Access-Control-Allow-Origin': "'test.com'",
'gatewayresponse.header.test-key': "'test-value'",
'gatewayresponse.header.another-test': "'test-value-enclosed-within-single-quotes'",
},
ResponseTemplates: Match.absent(),
});
Expand Down
39 changes: 0 additions & 39 deletions packages/@aws-cdk/aws-ec2/lib/vpc-endpoint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -260,33 +260,22 @@ export class InterfaceVpcEndpointService implements IInterfaceVpcEndpointService
export class InterfaceVpcEndpointAwsService implements IInterfaceVpcEndpointService {
public static readonly SAGEMAKER_STUDIO = new InterfaceVpcEndpointAwsService('studio', 'aws.sagemaker');
public static readonly SAGEMAKER_NOTEBOOK = new InterfaceVpcEndpointAwsService('notebook', 'aws.sagemaker');
/** Access Analyzer */
public static readonly ACCESS_ANALYZER = new InterfaceVpcEndpointAwsService('access-analyzer');
/** AWS Account Management */
public static readonly ACCOUNT_MANAGEMENT = new InterfaceVpcEndpointAwsService('account');
/** AWS App Mesh */
public static readonly APP_MESH = new InterfaceVpcEndpointAwsService('appmesh-envoy-management');
/** AWS App Runner */
public static readonly APP_RUNNER = new InterfaceVpcEndpointAwsService('apprunner');
/** AWS Application Migration Service */
public static readonly APPLICATION_MIGRATION_SERVICE = new InterfaceVpcEndpointAwsService('mgn');
public static readonly ATHENA = new InterfaceVpcEndpointAwsService('athena');
/** AWS Audit Manager */
public static readonly AUDIT_MANAGER = new InterfaceVpcEndpointAwsService('auditmanager');
public static readonly APPLICATION_AUTOSCALING = new InterfaceVpcEndpointAwsService('application-autoscaling');
public static readonly AUTOSCALING = new InterfaceVpcEndpointAwsService('autoscaling');
public static readonly AUTOSCALING_PLANS = new InterfaceVpcEndpointAwsService('autoscaling-plans');
public static readonly BATCH = new InterfaceVpcEndpointAwsService('batch');
/** AWS Billing Conductor */
public static readonly BILLING_CONDUCTOR = new InterfaceVpcEndpointAwsService('billingconductor');
/** Amazon Braket */
public static readonly BRAKET = new InterfaceVpcEndpointAwsService('braket');
/** AWS Private Certificate Authority */
public static readonly PRIVATE_CERTIFICATE_AUTHORITY = new InterfaceVpcEndpointAwsService('acm-pca');
/** Amazon Cloud Directory */
public static readonly CLOUD_DIRECTORY = new InterfaceVpcEndpointAwsService('clouddirectory');
public static readonly CLOUDFORMATION = new InterfaceVpcEndpointAwsService('cloudformation');
/** AWS CloudHSM */
public static readonly CLOUDHSM = new InterfaceVpcEndpointAwsService('cloudhsmv2');
public static readonly CLOUDTRAIL = new InterfaceVpcEndpointAwsService('cloudtrail');
public static readonly CODEARTIFACT_API = new InterfaceVpcEndpointAwsService('codeartifact.api');
Expand All @@ -298,24 +287,16 @@ export class InterfaceVpcEndpointAwsService implements IInterfaceVpcEndpointServ
public static readonly CODEGURU_PROFILER = new InterfaceVpcEndpointAwsService('codeguru-profiler');
public static readonly CODEGURU_REVIEWER = new InterfaceVpcEndpointAwsService('codeguru-reviewer');
public static readonly CODEPIPELINE = new InterfaceVpcEndpointAwsService('codepipeline');
/** AWS CodeStar Connections */
public static readonly CODESTAR_CONNECTIONS = new InterfaceVpcEndpointAwsService('codestar-connections.api');
/** Amazon Comprehend */
public static readonly COMPREHEND = new InterfaceVpcEndpointAwsService('comprehend');
/** Amazon Comprehend Medical */
public static readonly COMPREHEND_MEDICAL = new InterfaceVpcEndpointAwsService('comprehendmedical');
public static readonly CONFIG = new InterfaceVpcEndpointAwsService('config');
/** AWS Data Exchange */
public static readonly DATA_EXCHANGE = new InterfaceVpcEndpointAwsService('dataexchange');
/** AWS DataSync */
public static readonly DATASYNC = new InterfaceVpcEndpointAwsService('datasync');
/** Amazon DevOps Guru */
public static readonly DEVOPS_GURU = new InterfaceVpcEndpointAwsService('devops-guru');
/** Amazon EBS direct APIs */
public static readonly EBS_DIRECT = new InterfaceVpcEndpointAwsService('ebs');
public static readonly EC2 = new InterfaceVpcEndpointAwsService('ec2');
public static readonly EC2_MESSAGES = new InterfaceVpcEndpointAwsService('ec2messages');
/** EC2 Image Builder */
public static readonly IMAGE_BUILDER = new InterfaceVpcEndpointAwsService('imagebuilder');
public static readonly ECR = new InterfaceVpcEndpointAwsService('ecr.api');
public static readonly ECR_DOCKER = new InterfaceVpcEndpointAwsService('ecr.dkr');
Expand All @@ -326,40 +307,25 @@ export class InterfaceVpcEndpointAwsService implements IInterfaceVpcEndpointServ
public static readonly ELASTIC_FILESYSTEM_FIPS = new InterfaceVpcEndpointAwsService('elasticfilesystem-fips');
public static readonly ELASTIC_INFERENCE_RUNTIME = new InterfaceVpcEndpointAwsService('elastic-inference.runtime');
public static readonly ELASTIC_LOAD_BALANCING = new InterfaceVpcEndpointAwsService('elasticloadbalancing');
/** Amazon ElastiCache */
public static readonly ELASTICACHE = new InterfaceVpcEndpointAwsService('elasticache');
/** Amazon EMR */
public static readonly EMR = new InterfaceVpcEndpointAwsService('elasticmapreduce');
/** Amazon EMR on EKS */
public static readonly EMR_EKS = new InterfaceVpcEndpointAwsService('emr-containers');
/** Amazon EMR Serverless */
public static readonly EMR_SERVERLESS = new InterfaceVpcEndpointAwsService('.emr-serverless');
public static readonly CLOUDWATCH_EVENTS = new InterfaceVpcEndpointAwsService('events');
public static readonly APIGATEWAY = new InterfaceVpcEndpointAwsService('execute-api');
/** AWS Fault Injection Simulator */
public static readonly FAULT_INJECTION_SIMULATOR = new InterfaceVpcEndpointAwsService('fis');
/** Amazon Fraud Detector */
public static readonly FRAUD_DETECTOR = new InterfaceVpcEndpointAwsService('frauddetector');
public static readonly CODECOMMIT_GIT = new InterfaceVpcEndpointAwsService('git-codecommit');
public static readonly CODECOMMIT_GIT_FIPS = new InterfaceVpcEndpointAwsService('git-codecommit-fips');
public static readonly GLUE = new InterfaceVpcEndpointAwsService('glue');
/** AWS Glue DataBrew */
public static readonly GLUE_DATABREW = new InterfaceVpcEndpointAwsService('databrew');
/** Amazon Managed Grafana */
public static readonly GRAFANA = new InterfaceVpcEndpointAwsService('grafana');
/** AWS Ground Station */
public static readonly GROUNDSTATION = new InterfaceVpcEndpointAwsService('groundstation');
/** Amazon HealthLake */
public static readonly HEALTHLAKE = new InterfaceVpcEndpointAwsService('healthlake');
/** IAM Identity Center */
public static readonly IAM_IDENTITY_CENTER = new InterfaceVpcEndpointAwsService('identitystore');
/** IAM Roles Anywhere */
public static readonly IAM_ROLES_ANYWHERE = new InterfaceVpcEndpointAwsService('rolesanywhere');
/** Amazon Inspector */
public static readonly INSPECTOR = new InterfaceVpcEndpointAwsService('inspector2');
/** AWS IoT Core */
public static readonly IOT_CORE = new InterfaceVpcEndpointAwsService('iot.data');
/** AWS IoT Greengrass */
public static readonly IOT_GREENGRASS = new InterfaceVpcEndpointAwsService('greengrass');
public static readonly KEYSPACES = new InterfaceVpcEndpointAwsService('cassandra', '', 9142);
public static readonly KINESIS_STREAMS = new InterfaceVpcEndpointAwsService('kinesis-streams');
Expand All @@ -368,25 +334,21 @@ export class InterfaceVpcEndpointAwsService implements IInterfaceVpcEndpointServ
public static readonly CLOUDWATCH_LOGS = new InterfaceVpcEndpointAwsService('logs');
public static readonly CLOUDWATCH = new InterfaceVpcEndpointAwsService('monitoring');
public static readonly RDS = new InterfaceVpcEndpointAwsService('rds');
/** AWS RoboMaker */
public static readonly ROBOMAKER = new InterfaceVpcEndpointAwsService('robomaker');
public static readonly RDS_DATA = new InterfaceVpcEndpointAwsService('rds-data');
public static readonly S3 = new InterfaceVpcEndpointAwsService('s3');
/** Amazon S3 on Outposts */
public static readonly S3_OUTPOSTS = new InterfaceVpcEndpointAwsService('s3-outposts');
public static readonly SAGEMAKER_API = new InterfaceVpcEndpointAwsService('sagemaker.api');
public static readonly SAGEMAKER_RUNTIME = new InterfaceVpcEndpointAwsService('sagemaker.runtime');
public static readonly SAGEMAKER_RUNTIME_FIPS = new InterfaceVpcEndpointAwsService('sagemaker.runtime-fips');
public static readonly SECRETS_MANAGER = new InterfaceVpcEndpointAwsService('secretsmanager');
public static readonly SERVICE_CATALOG = new InterfaceVpcEndpointAwsService('servicecatalog');
/** Amazon SES */
public static readonly SES = new InterfaceVpcEndpointAwsService('email-smtp');
public static readonly SNS = new InterfaceVpcEndpointAwsService('sns');
public static readonly SQS = new InterfaceVpcEndpointAwsService('sqs');
public static readonly SSM = new InterfaceVpcEndpointAwsService('ssm');
public static readonly SSM_MESSAGES = new InterfaceVpcEndpointAwsService('ssmmessages');
public static readonly STS = new InterfaceVpcEndpointAwsService('sts');
/** AWS Snow Device Management */
public static readonly SNOW_DEVICE_MANAGEMENT = new InterfaceVpcEndpointAwsService('snow-device-management');
public static readonly TEXTRACT = new InterfaceVpcEndpointAwsService('textract');
public static readonly TEXTRACT_FIPS = new InterfaceVpcEndpointAwsService('textract-fips');
Expand All @@ -397,7 +359,6 @@ export class InterfaceVpcEndpointAwsService implements IInterfaceVpcEndpointServ
public static readonly STEP_FUNCTIONS = new InterfaceVpcEndpointAwsService('states');
public static readonly LAMBDA = new InterfaceVpcEndpointAwsService('lambda');
public static readonly TRANSCRIBE = new InterfaceVpcEndpointAwsService('transcribe');
/** Amazon WorkSpaces */
public static readonly WORKSPACES = new InterfaceVpcEndpointAwsService('workspaces');
public static readonly XRAY = new InterfaceVpcEndpointAwsService('xray');
public static readonly SECURITYHUB = new InterfaceVpcEndpointAwsService('securityhub');
Expand Down
Loading

0 comments on commit c44fd86

Please sign in to comment.