Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 25 additions & 14 deletions .github/workflows/enum-auto-updater.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
NODE_OPTIONS: "--max-old-space-size=8196 --experimental-worker ${NODE_OPTIONS:-}"

- name: Install dependencies
run: yarn install --frozen-lockfile && cd tools/@aws-cdk/enum-updater && yarn build
run: cd tools/@aws-cdk/enum-updater && yarn install --frozen-lockfile && yarn build

- name: Identify Missing Values and Apply Code Changes
run: |
Expand All @@ -36,6 +36,11 @@ jobs:
else
echo "changes=false" >> $GITHUB_OUTPUT
fi

# Authentication is required for gh cli
- name: Setup GitHub CLI
run: |
gh auth login --with-token <<< "${{ secrets.GITHUB_TOKEN }}"

- name: Commit & Push changes
if: steps.git-check.outputs.changes == 'true'
Expand All @@ -46,33 +51,39 @@ jobs:
# Iterate through each module directory that has changes
for module in $(git diff --name-only | grep -E '^packages/(@aws-cdk|aws-cdk-lib)/.*' | sed -E 's|^packages/(@aws-cdk\|aws-cdk-lib)/([^/]+).*|\2|' | sort -u); do
moduleName=$(basename $module)

# Determine the correct path for the module
if [[ -d "packages/aws-cdk-lib/$module" ]]; then
modulePath="packages/aws-cdk-lib/$module"
elif [[ -d "packages/@aws-cdk/$module" ]]; then
modulePath="packages/@aws-cdk/$module"
else
echo "Cannot find module directory for $module"
continue
fi

# Check for existing PR with the same name
prExists=$(gh pr list --state open --search "feat(${moduleName#aws-}): add new enum values for ${moduleName#aws-}" --json number,title -q '.[].number')

# If a PR exists, close it and continue
if [[ -n "$prExists" ]]; then
echo "PR already exists for module ${moduleName#aws-}, closing the existing PR."
gh pr close "$prExists" --confirm # Close the PR by its number
gh pr close "$prExists" --confirm
fi

# Create a new branch for the module
branchName="enum-update/${moduleName#aws-}"
git checkout -b "$branchName"

# Stage, commit, and push changes for the module
git add "packages/$module" # Add only changes for this module
git add "$modulePath" # Using the correct path
git commit -m "chore(${moduleName#aws-}): add new enum values for ${moduleName#aws-}"
git push origin "$branchName"

# Create a new pull request
gh pr create --title "chore(${moduleName#aws-}): add new enum values for ${moduleName#aws-}" \
--body "This PR updates the enum values for ${moduleName#aws-}." \
--base main \
--head "$branchName"
--label "contribution/core,pr-linter/exempt-integ-test,pr-linter/exempt-readme,pr-linter/exempt-test" \
--reviewer "aws-cdk-team" \
done

env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Create a new pull request
gh pr create --title "chore(${moduleName#aws-}): add new enum values for ${moduleName#aws-}" \
--body "This PR updates the enum values for ${moduleName#aws-}." \
--base main \
--head "$branchName" \
--label "contribution/core,pr-linter/exempt-integ-test,pr-linter/exempt-readme,pr-linter/exempt-test"
done
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"@nx/workspace": "^20",
"@types/node": "18.11.19",
"@types/prettier": "2.6.0",
"@types/tmp": "^0.2.6",
"@yarnpkg/lockfile": "^1.1.0",
"aws-sdk-js-codemod": "^0.28.2",
"cdk-generate-synthetic-examples": "^0.2.22",
Expand Down Expand Up @@ -88,6 +89,7 @@
"tools/@aws-cdk/lazify",
"tools/@aws-cdk/lambda-integration-test-updater",
"tools/@aws-cdk/construct-metadata-updater",
"tools/@aws-cdk/enum-updater",
"scripts/@aws-cdk/script-tests"
],
"nohoist": [
Expand Down
12 changes: 12 additions & 0 deletions packages/aws-cdk-lib/aws-autoscaling/lib/auto-scaling-group.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2392,6 +2392,14 @@ export class HealthChecks {
enum HealthCheckType {
EC2 = 'EC2',
ELB = 'ELB',
/**
* PLACEHOLDER_COMMENT_TO_BE_FILLED_OUT
*/
EBS = 'EBS',
/**
* PLACEHOLDER_COMMENT_TO_BE_FILLED_OUT
*/
VPC_LATTICE = 'VPC_LATTICE',
}

/**
Expand All @@ -2410,6 +2418,10 @@ export enum AdditionalHealthCheckType {
* VPC LATTICE Health Check
*/
VPC_LATTICE = 'VPC_LATTICE',
/**
* PLACEHOLDER_COMMENT_TO_BE_FILLED_OUT
*/
EC2 = 'EC2',
}

/**
Expand Down
5 changes: 5 additions & 0 deletions packages/aws-cdk-lib/aws-autoscaling/lib/volume.ts
Original file line number Diff line number Diff line change
Expand Up @@ -210,4 +210,9 @@ export enum EbsDeviceVolumeType {
* Cold HDD
*/
SC1 = 'sc1',

/**
* PLACEHOLDER_COMMENT_TO_BE_FILLED_OUT
*/
IO2 = 'io2',
}
4 changes: 4 additions & 0 deletions packages/aws-cdk-lib/aws-cloudfront/lib/distribution.ts
Original file line number Diff line number Diff line change
Expand Up @@ -905,6 +905,10 @@ export enum OriginProtocolPolicy {
export enum SSLMethod {
SNI = 'sni-only',
VIP = 'vip',
/**
* PLACEHOLDER_COMMENT_TO_BE_FILLED_OUT
*/
STATIC_IP = 'static-ip',
}

/**
Expand Down
10 changes: 10 additions & 0 deletions packages/aws-cdk-lib/aws-cloudfront/lib/function.ts
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,16 @@ export enum FunctionEventType {
* The viewer-response specifies the outgoing response
*/
VIEWER_RESPONSE = 'viewer-response',

/**
* PLACEHOLDER_COMMENT_TO_BE_FILLED_OUT
*/
ORIGIN_REQUEST = 'origin-request',

/**
* PLACEHOLDER_COMMENT_TO_BE_FILLED_OUT
*/
ORIGIN_RESPONSE = 'origin-response',
}

/**
Expand Down
25 changes: 25 additions & 0 deletions packages/aws-cdk-lib/aws-cloudfront/lib/web-distribution.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,31 @@ export enum FailoverStatusCode {
* Gateway Timeout (504)
*/
GATEWAY_TIMEOUT = 504,

/**
* PLACEHOLDER_COMMENT_TO_BE_FILLED_OUT
*/
400 = '400',

/**
* PLACEHOLDER_COMMENT_TO_BE_FILLED_OUT
*/
405 = '405',

/**
* PLACEHOLDER_COMMENT_TO_BE_FILLED_OUT
*/
414 = '414',

/**
* PLACEHOLDER_COMMENT_TO_BE_FILLED_OUT
*/
416 = '416',

/**
* PLACEHOLDER_COMMENT_TO_BE_FILLED_OUT
*/
501 = '501',
}

/**
Expand Down
35 changes: 35 additions & 0 deletions packages/aws-cdk-lib/aws-cloudtrail/lib/cloudtrail.ts
Original file line number Diff line number Diff line change
Expand Up @@ -558,6 +558,41 @@ export enum DataResourceType {
* Data resource type for S3 objects
*/
S3_OBJECT = 'AWS::S3::Object',

/**
* PLACEHOLDER_COMMENT_TO_BE_FILLED_OUT
*/
AWS_DYNAMODB_TABLE = 'AWS::DynamoDB::Table',

/**
* PLACEHOLDER_COMMENT_TO_BE_FILLED_OUT
*/
AWS_S3OUTPOSTS_OBJECT = 'AWS::S3Outposts::Object',

/**
* PLACEHOLDER_COMMENT_TO_BE_FILLED_OUT
*/
AWS_MANAGEDBLOCKCHAIN_NODE = 'AWS::ManagedBlockchain::Node',

/**
* PLACEHOLDER_COMMENT_TO_BE_FILLED_OUT
*/
AWS_S3OBJECTLAMBDA_ACCESSPOINT = 'AWS::S3ObjectLambda::AccessPoint',

/**
* PLACEHOLDER_COMMENT_TO_BE_FILLED_OUT
*/
AWS_EC2_SNAPSHOT = 'AWS::EC2::Snapshot',

/**
* PLACEHOLDER_COMMENT_TO_BE_FILLED_OUT
*/
AWS_S3_ACCESSPOINT = 'AWS::S3::AccessPoint',

/**
* PLACEHOLDER_COMMENT_TO_BE_FILLED_OUT
*/
AWS_DYNAMODB_STREAM = 'AWS::DynamoDB::Stream',
}

interface EventSelector {
Expand Down
5 changes: 3 additions & 2 deletions tools/@aws-cdk/enum-updater/lib/missing-enum-updater.ts
Original file line number Diff line number Diff line change
Expand Up @@ -311,10 +311,11 @@ export class MissingEnumsUpdater {
let textToInsert = hasDoubleLineBreaks ? '\n' : '';

newEnumValues.forEach((enumVal: string, index: number) => {
const enumConstantName = enumVal.toUpperCase().replace(/[^A-Z0-9]+/g, '_').replace(/_+$/, '');
const enumValue = enumVal.toString();
const enumConstantName = enumValue.toUpperCase().replace(/[^A-Z0-9]+/g, '_').replace(/_+$/, '');

textToInsert += ` /**\n * PLACEHOLDER_COMMENT_TO_BE_FILLED_OUT\n */\n`;
textToInsert += ` ${enumConstantName} = '${enumVal}'`;
textToInsert += ` ${enumConstantName} = '${enumValue}'`;

// Add a comma and appropriate newlines after each member
textToInsert += ',';
Expand Down
Loading