Skip to content

Commit 969c499

Browse files
authored
feat: modify a single feature flag configuration (#738)
This change allows a user to modify a single feature flag value, view the difference in CloudFormation templates, and accept or reject the change. By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license
1 parent 2f44d1e commit 969c499

20 files changed

+745
-214
lines changed

.projenrc.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,6 @@ import { TypecheckTests } from './projenrc/TypecheckTests';
2121

2222
const TYPESCRIPT_VERSION = '5.8';
2323

24-
// This is a temporary aws-cdk-lib version until this PR is released: https://github.com/aws/aws-cdk/pull/34919
25-
const AWS_CDK_LIB_VERSION = '2.203.0';
26-
2724
/**
2825
* When adding an SDK dependency for a library, use this function
2926
*
@@ -854,7 +851,7 @@ const toolkitLib = configureProject(
854851
'@smithy/util-stream',
855852
'@types/fs-extra',
856853
'@types/split2',
857-
`aws-cdk-lib@${AWS_CDK_LIB_VERSION}`,
854+
'aws-cdk-lib',
858855
'aws-sdk-client-mock',
859856
'aws-sdk-client-mock-jest',
860857
'fast-check',

packages/@aws-cdk/toolkit-lib/.projen/deps.json

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/@aws-cdk/toolkit-lib/.projen/tasks.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/@aws-cdk/toolkit-lib/docs/message-registry.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@ Please let us know by [opening an issue](https://github.com/aws/aws-cdk-cli/issu
133133
| `CDK_TOOLKIT_I9210` | Confirm the deletion of a batch of assets | `info` | {@link AssetBatchDeletionRequest} |
134134
| `CDK_TOOLKIT_I9900` | Bootstrap results on success | `result` | [cxapi.Environment](https://docs.aws.amazon.com/cdk/api/v2/docs/@aws-cdk_cx-api.Environment.html) |
135135
| `CDK_TOOLKIT_E9900` | Bootstrap failed | `error` | {@link ErrorPayload} |
136+
| `CDK_TOOLKIT_I9300` | Confirm the feature flag configuration changes | `info` | {@link FeatureFlagChangeRequest} |
136137
| `CDK_TOOLKIT_I0100` | Notices decoration (the header or footer of a list of notices) | `info` | n/a |
137138
| `CDK_TOOLKIT_W0101` | A notice that is marked as a warning | `warn` | n/a |
138139
| `CDK_TOOLKIT_E0101` | A notice that is marked as an error | `error` | n/a |

packages/@aws-cdk/toolkit-lib/lib/api/io/private/messages.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import type { MissingContext, UpdatedContext } from '../../../payloads/context';
77
import type { BuildAsset, DeployConfirmationRequest, PublishAsset, StackDeployProgress, SuccessfulDeployStackResult } from '../../../payloads/deploy';
88
import type { StackDestroy, StackDestroyProgress } from '../../../payloads/destroy';
99
import type { DriftResultPayload } from '../../../payloads/drift';
10+
import type { FeatureFlagChangeRequest } from '../../../payloads/flags';
1011
import type { AssetBatchDeletionRequest } from '../../../payloads/gc';
1112
import type { HotswapDeploymentDetails, HotswapDeploymentAttempt, HotswappableChange, HotswapResult } from '../../../payloads/hotswap';
1213
import type { ResourceIdentificationRequest, ResourceImportRequest } from '../../../payloads/import';
@@ -416,6 +417,13 @@ export const IO = {
416417
interface: 'ErrorPayload',
417418
}),
418419

420+
// flags (93xxx)
421+
CDK_TOOLKIT_I9300: make.info<FeatureFlagChangeRequest>({
422+
code: 'CDK_TOOLKIT_I9300',
423+
description: 'Confirm the feature flag configuration changes',
424+
interface: 'FeatureFlagChangeRequest',
425+
}),
426+
419427
// Notices
420428
CDK_TOOLKIT_I0100: make.info({
421429
code: 'CDK_TOOLKIT_I0100',
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import type { DataRequest } from './types';
2+
3+
/**
4+
* Request to confirm or deny the feature flag configuration changes.
5+
*
6+
*/
7+
export interface FeatureFlagChangeRequest extends DataRequest {
8+
readonly flagName: string;
9+
readonly currentValue?: boolean;
10+
readonly newValue: boolean;
11+
}

packages/@aws-cdk/toolkit-lib/package.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/aws-cdk/lib/api-private.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,3 @@ export * from '../../@aws-cdk/toolkit-lib/lib/api/io/private';
66
export * from '../../@aws-cdk/toolkit-lib/lib/api/tags/private';
77
export * from '../../@aws-cdk/toolkit-lib/lib/private/activity-printer';
88
export * from '../../@aws-cdk/toolkit-lib/lib/api/cloud-assembly/private/borrowed-assembly';
9-

packages/aws-cdk/lib/cli/cdk-toolkit.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1913,7 +1913,6 @@ export interface GarbageCollectionOptions {
19131913
*/
19141914
readonly confirm?: boolean;
19151915
}
1916-
19171916
export interface MigrateOptions {
19181917
/**
19191918
* The name assigned to the generated stack. This is also used to get

packages/aws-cdk/lib/cli/cli-config.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,15 @@ export async function makeConfig(): Promise<CliConfig> {
115115
},
116116
'flags': {
117117
description: 'View and toggle feature flags.',
118+
arg: {
119+
name: 'FLAGNAME',
120+
variadic: true,
121+
},
122+
options: {
123+
value: { type: 'string', desc: 'The value the user would like to set the feature flag configuration to', requiresArg: true },
124+
set: { type: 'boolean', desc: 'Signifies the user would like to modify their feature flag configuration', requiresArg: false },
125+
all: { type: 'boolean', desc: 'Modify or view all feature flags', requiresArg: false },
126+
},
118127
},
119128
'deploy': {
120129
description: 'Deploys the stack(s) named STACKS into your AWS account',

0 commit comments

Comments
 (0)