Skip to content

Commit

Permalink
Merge branch 'main' into rmuller/fix-alpha-clib
Browse files Browse the repository at this point in the history
  • Loading branch information
mergify[bot] committed Jun 27, 2023
2 parents 7a3bf4b + 3c29223 commit 89e9c96
Show file tree
Hide file tree
Showing 9 changed files with 175 additions and 56 deletions.
88 changes: 44 additions & 44 deletions packages/@aws-cdk/cfnspec/spec-source/cfn-docs/cfn-docs.json

Large diffs are not rendered by default.

26 changes: 26 additions & 0 deletions packages/aws-cdk-lib/aws-rds/lib/instance-engine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,8 @@ export class MariaDbEngineVersion {
public static readonly VER_10_3_37 = MariaDbEngineVersion.of('10.3.37', '10.3');
/** Version "10.3.38". */
public static readonly VER_10_3_38 = MariaDbEngineVersion.of('10.3.38', '10.3');
/** Version "10.3.39". */
public static readonly VER_10_3_39 = MariaDbEngineVersion.of('10.3.39', '10.3');

/** Version "10.4" (only a major version, without a specific minor version). */
public static readonly VER_10_4 = MariaDbEngineVersion.of('10.4', '10.4');
Expand All @@ -338,6 +340,10 @@ export class MariaDbEngineVersion {
public static readonly VER_10_4_27 = MariaDbEngineVersion.of('10.4.27', '10.4')
/** Version "10.4.28". */
public static readonly VER_10_4_28 = MariaDbEngineVersion.of('10.4.28', '10.4')
/** Version "10.4.29". */
public static readonly VER_10_4_29 = MariaDbEngineVersion.of('10.4.29', '10.4')
/** Version "10.4.30". */
public static readonly VER_10_4_30 = MariaDbEngineVersion.of('10.4.30', '10.4')

/** Version "10.5" (only a major version, without a specific minor version). */
public static readonly VER_10_5 = MariaDbEngineVersion.of('10.5', '10.5');
Expand All @@ -359,6 +365,10 @@ export class MariaDbEngineVersion {
public static readonly VER_10_5_18 = MariaDbEngineVersion.of('10.5.18', '10.5');
/** Version "10.5.19". */
public static readonly VER_10_5_19 = MariaDbEngineVersion.of('10.5.19', '10.5');
/** Version "10.5.20". */
public static readonly VER_10_5_20 = MariaDbEngineVersion.of('10.5.20', '10.5');
/** Version "10.5.21". */
public static readonly VER_10_5_21 = MariaDbEngineVersion.of('10.5.21', '10.5');

/** Version "10.6" (only a major version, without a specific minor version). */
public static readonly VER_10_6 = MariaDbEngineVersion.of('10.6', '10.6');
Expand All @@ -374,6 +384,10 @@ export class MariaDbEngineVersion {
public static readonly VER_10_6_11 = MariaDbEngineVersion.of('10.6.11', '10.6');
/** Version "10.6.12". */
public static readonly VER_10_6_12 = MariaDbEngineVersion.of('10.6.12', '10.6');
/** Version "10.6.13". */
public static readonly VER_10_6_13 = MariaDbEngineVersion.of('10.6.13', '10.6');
/** Version "10.6.14". */
public static readonly VER_10_6_14 = MariaDbEngineVersion.of('10.6.14', '10.6');

/**
* Create a new MariaDbEngineVersion with an arbitrary version.
Expand Down Expand Up @@ -1435,6 +1449,8 @@ export class OracleEngineVersion {
public static readonly VER_19_0_0_0_2022_10_R1 = OracleEngineVersion.of('19.0.0.0.ru-2022-10.rur-2022-10.r1', '19');
/** Version "19.0.0.0.ru-2023-01.rur-2023-01.r1". */
public static readonly VER_19_0_0_0_2023_01_R1 = OracleEngineVersion.of('19.0.0.0.ru-2023-01.rur-2023-01.r1', '19');
/** Version "19.0.0.0.ru-2023-04.rur-2023-04.r1". */
public static readonly VER_19_0_0_0_2023_04_R1 = OracleEngineVersion.of('19.0.0.0.ru-2023-04.rur-2023-04.r1', '19');

/** Version "21" (only a major version, without a specific minor version). */
public static readonly VER_21 = OracleEngineVersion.of('21', '21');
Expand All @@ -1448,6 +1464,8 @@ export class OracleEngineVersion {
public static readonly VER_21_0_0_0_2022_10_R1 = OracleEngineVersion.of('21.0.0.0.ru-2022-10.rur-2022-10.r1', '21');
/** Version "21.0.0.0.ru-2023-01.rur-2023-01.r1". */
public static readonly VER_21_0_0_0_2023_01_R1 = OracleEngineVersion.of('21.0.0.0.ru-2023-01.rur-2023-01.r1', '21');
/** Version "21.0.0.0.ru-2023-04.rur-2023-04.r1". */
public static readonly VER_21_0_0_0_2023_04_R1 = OracleEngineVersion.of('21.0.0.0.ru-2023-04.rur-2023-04.r1', '21');

/**
* Creates a new OracleEngineVersion with an arbitrary version.
Expand Down Expand Up @@ -1697,6 +1715,8 @@ export class SqlServerEngineVersion {
public static readonly VER_12_00_6433_1_V1 = SqlServerEngineVersion.of('12.00.6433.1.v1', '12.00');
/** Version "12.00.6439.10.v1". */
public static readonly VER_12_00_6439_10_V1 = SqlServerEngineVersion.of('12.00.6439.10.v1', '12.00');
/** Version "12.00.6444.4.v1". */
public static readonly VER_12_00_6444_4_V1 = SqlServerEngineVersion.of('12.00.6444.4.v1', '12.00');

/** Version "13.00" (only a major version, without a specific minor version). */
public static readonly VER_13 = SqlServerEngineVersion.of('13.00', '13.00');
Expand Down Expand Up @@ -1730,6 +1750,8 @@ export class SqlServerEngineVersion {
public static readonly VER_13_00_6300_2_V1 = SqlServerEngineVersion.of('13.00.6300.2.v1', '13.00');
/** Version "13.00.6419.1.v1". */
public static readonly VER_13_00_6419_1_V1 = SqlServerEngineVersion.of('13.00.6419.1.v1', '13.00');
/** Version "13.00.6430.49.v1". */
public static readonly VER_13_00_6430_49_V1 = SqlServerEngineVersion.of('13.00.6430.49.v1', '13.00');

/** Version "14.00" (only a major version, without a specific minor version). */
public static readonly VER_14 = SqlServerEngineVersion.of('14.00', '14.00');
Expand Down Expand Up @@ -1762,6 +1784,8 @@ export class SqlServerEngineVersion {
public static readonly VER_14_00_3421_10_V1 = SqlServerEngineVersion.of('14.00.3421.10.v1', '14.00');
/** Version "14.00.3451.2.v1". */
public static readonly VER_14_00_3451_2_V1 = SqlServerEngineVersion.of('14.00.3451.2.v1', '14.00');
/** Version "14.00.3460.9.v1". */
public static readonly VER_14_00_3460_9_V1 = SqlServerEngineVersion.of('14.00.3460.9.v1', '14.00');

/** Version "15.00" (only a major version, without a specific minor version). */
public static readonly VER_15 = SqlServerEngineVersion.of('15.00', '15.00');
Expand All @@ -1780,6 +1804,8 @@ export class SqlServerEngineVersion {
public static readonly VER_15_00_4198_2_V1 = SqlServerEngineVersion.of('15.00.4198.2.v1', '15.00');
/** Version "15.00.4236.7.v1". */
public static readonly VER_15_00_4236_7_V1 = SqlServerEngineVersion.of('15.00.4236.7.v1', '15.00');
/** Version "15.00.4312.2.v1". */
public static readonly VER_15_00_4312_2_V1 = SqlServerEngineVersion.of('15.00.4312.2.v1', '15.00');

/**
* Create a new SqlServerEngineVersion with an arbitrary version.
Expand Down
27 changes: 17 additions & 10 deletions packages/aws-cdk-lib/aws-stepfunctions/lib/private/json-path.ts
Original file line number Diff line number Diff line change
Expand Up @@ -183,18 +183,25 @@ function recurseArray(key: string, arr: any[], handlers: FieldHandlers, visited:
}

return {
[key]: arr.map(value => {
if ((typeof value === 'string' && jsonPathString(value) !== undefined)
[key]: resolveArray(arr, handlers, visited),
};
}

function resolveArray(arr: any[], handlers: FieldHandlers, visited: object[] = []): any[] {
return arr.map(value => {
if ((typeof value === 'string' && jsonPathString(value) !== undefined)
|| (typeof value === 'number' && jsonPathNumber(value) !== undefined)
|| (isStringArray(value) && jsonPathStringList(value) !== undefined)) {
throw new Error('Cannot use JsonPath fields in an array, they must be used in objects');
}
if (typeof value === 'object' && value !== null) {
return recurseObject(value, handlers, visited);
}
return value;
}),
};
throw new Error('Cannot use JsonPath fields in an array, they must be used in objects');
}
if (Array.isArray(value)) {
return resolveArray(value, handlers, visited);
}
if (typeof value === 'object' && value !== null) {
return recurseObject(value, handlers, visited);
}
return value;
});
}

function isStringArray(x: any): x is string[] {
Expand Down
42 changes: 42 additions & 0 deletions packages/aws-cdk-lib/aws-stepfunctions/test/fields.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -470,6 +470,48 @@ describe('intrinsics constructors', () => {
'Field.$': 'States.JsonToString($.Obj)',
});
});

test('correctly serialize a nested array', () => {
expect(
FieldUtils.renderObject({
nestedArray: [
[
[123, 123],
[456, 456],
],
],
}),
).toStrictEqual({
nestedArray: [
[
[123, 123],
[456, 456],
],
],
});
});

test('deep replace correctly handles fields in nested arrays', () => {
expect(
FieldUtils.renderObject({
deep: [
[
{
deepField: JsonPath.numberAt('$.numField'),
},
],
],
}),
).toStrictEqual({
deep: [
[
{
'deepField.$': '$.numField',
},
],
],
});
});
});

test('find task token even if nested in intrinsic functions', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,13 @@ export class DefaultStackSynthesizer extends StackSynthesizer implements IReusab
return this.qualifier;
}

/**
* The role used to lookup for this stack
*/
public get lookupRole(): string | undefined {
return this.lookupRoleArn;
}

public bind(stack: Stack): void {
super.bind(stack);

Expand Down
6 changes: 5 additions & 1 deletion packages/aws-cdk-lib/core/lib/stack-synthesizers/nested.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ export class NestedStackSynthesizer extends StackSynthesizer {
return this.parentDeployment.bootstrapQualifier;
}

public get lookupRole(): string | undefined {
return this.parentDeployment.lookupRole;
}

public addFileAsset(asset: FileAssetSource): FileAssetLocation {
// Forward to parent deployment. By the magic of cross-stack references any parameter
// returned and used will magically be forwarded to the nested stack.
Expand All @@ -34,6 +38,6 @@ export class NestedStackSynthesizer extends StackSynthesizer {
public synthesize(session: ISynthesisSession): void {
// Synthesize the template, but don't emit as a cloud assembly artifact.
// It will be registered as an S3 asset of its parent instead.
this.synthesizeTemplate(session);
this.synthesizeTemplate(session, this.lookupRole);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,13 @@ export abstract class StackSynthesizer implements IStackSynthesizer {
return undefined;
}

/**
* The role used to lookup for this stack
*/
public get lookupRole(): string | undefined {
return undefined;
}

private _boundStack?: Stack;

/**
Expand Down
7 changes: 7 additions & 0 deletions packages/aws-cdk-lib/core/lib/stack-synthesizers/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,13 @@ export interface IStackSynthesizer {
*/
readonly bootstrapQualifier?: string;

/**
* The role used to lookup for this stack
*
* @default - no role
*/
readonly lookupRole?: string;

/**
* Bind to the stack this environment is going to be used on
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import * as fs from 'fs';
import * as cxschema from '../../../cloud-assembly-schema';
import { ArtifactType } from '../../../cloud-assembly-schema';
import * as cxapi from '../../../cx-api';
import { App, Aws, CfnResource, ContextProvider, DefaultStackSynthesizer, FileAssetPackaging, Stack } from '../../lib';
import { App, Aws, CfnResource, ContextProvider, DefaultStackSynthesizer, FileAssetPackaging, Stack, NestedStack } from '../../lib';
import { ISynthesisSession } from '../../lib/stack-synthesizers/types';
import { evaluateCFN } from '../evaluate-cfn';

Expand All @@ -15,6 +15,7 @@ const CFN_CONTEXT = {
describe('new style synthesis', () => {
let app: App;
let stack: Stack;
let nestedStack: NestedStack;

beforeEach(() => {
app = new App({
Expand Down Expand Up @@ -187,6 +188,24 @@ describe('new style synthesis', () => {

});

test('nested Stack uses the lookup role ARN of the parent stack', () => {
// GIVEN
const myapp = new App();
const mystack = new Stack(myapp, 'mystack', {
synthesizer: new DefaultStackSynthesizer({
generateBootstrapVersionRule: false,
}),
env: {
account: '111111111111', region: 'us-east-1',
},
});
nestedStack = new NestedStack(mystack, 'nestedStack');

// THEN
expect(nestedStack.synthesizer.lookupRole).toEqual('arn:${AWS::Partition}:iam::111111111111:role/cdk-hnb659fds-lookup-role-111111111111-us-east-1');

});

test('add file asset', () => {
// WHEN
const location = stack.synthesizer.addFileAsset({
Expand Down

0 comments on commit 89e9c96

Please sign in to comment.