Skip to content

Commit 4ea2594

Browse files
committed
revert property name to ignoreErrorOnMissingContext
1 parent 3218de7 commit 4ea2594

File tree

5 files changed

+22
-22
lines changed

5 files changed

+22
-22
lines changed

packages/@aws-cdk/cloud-assembly-schema/lib/cloud-assembly/context-queries.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -386,7 +386,7 @@ export interface CcApiContextQuery extends ContextLookupRoleOptions {
386386
readonly propertiesToReturn: string[];
387387

388388
/**
389-
* The value to return if the resource was not found and `ignoreFailedLookup` is true.
389+
* The value to return if the resource was not found and `ignoreErrorOnMissingContext` is true.
390390
* @default - None
391391
*/
392392
readonly dummyValue?: any;
@@ -395,7 +395,7 @@ export interface CcApiContextQuery extends ContextLookupRoleOptions {
395395
* Ignore an error and return the `dummyValue` instead if the resource was not found.
396396
* @default false
397397
*/
398-
readonly ignoreFailedLookup?: boolean;
398+
readonly ignoreErrorOnMissingContext?: boolean;
399399
}
400400

401401
/**

packages/@aws-cdk/cloud-assembly-schema/schema/cloud-assembly.schema.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1047,9 +1047,9 @@
10471047
}
10481048
},
10491049
"dummyValue": {
1050-
"description": "The value to return if the resource was not found and `ignoreFailedLookup` is true. (Default - None)"
1050+
"description": "The value to return if the resource was not found and `ignoreErrorOnMissingContext` is true. (Default - None)"
10511051
},
1052-
"ignoreFailedLookup": {
1052+
"ignoreErrorOnMissingContext": {
10531053
"description": "Ignore an error and return the `dummyValue` instead if the resource was not found.",
10541054
"default": false,
10551055
"type": "boolean"
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
2-
"schemaHash": "71bdf8c99c7f07e515b118a81c9900b0eb38763c221f64b78c8097810f501422",
2+
"schemaHash": "7c650e458026e83b3de23aef106137c69f10031147873e2638b6d8e078419777",
33
"revision": 42
44
}

packages/aws-cdk/lib/context-providers/cc-api-provider.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,10 @@ export class CcApiContextProviderPlugin implements ContextProviderPlugin {
4444

4545
if (args.exactIdentifier) {
4646
// use getResource to get the exact indentifier
47-
return this.getResource(cc, args.typeName, args.exactIdentifier, args.propertiesToReturn, args.ignoreFailedLookup);
47+
return this.getResource(cc, args.typeName, args.exactIdentifier, args.propertiesToReturn, args.ignoreErrorOnMissingContext);
4848
} else {
4949
// use listResource
50-
return this.listResources(cc, args.typeName, args.propertyMatch!, args.propertiesToReturn, args.ignoreFailedLookup);
50+
return this.listResources(cc, args.typeName, args.propertyMatch!, args.propertiesToReturn, args.ignoreErrorOnMissingContext);
5151
}
5252
}
5353

@@ -63,7 +63,7 @@ export class CcApiContextProviderPlugin implements ContextProviderPlugin {
6363
typeName: string,
6464
exactIdentifier: string,
6565
propertiesToReturn: string[],
66-
ignoreFailedLookup?: boolean,
66+
ignoreErrorOnMissingContext?: boolean,
6767
): Promise<{[key: string]: any}[]> {
6868
const resultObjs: {[key: string]: any}[] = [];
6969
try {
@@ -80,7 +80,7 @@ export class CcApiContextProviderPlugin implements ContextProviderPlugin {
8080
throw new ContextProviderError(`Could not get resource ${exactIdentifier}.`);
8181
}
8282
} catch (err) {
83-
if (err instanceof ResourceNotFoundException && ignoreFailedLookup) {
83+
if (err instanceof ResourceNotFoundException && ignoreErrorOnMissingContext) {
8484
throw err;
8585
}
8686
throw new ContextProviderError(`Encountered CC API error while getting resource ${exactIdentifier}. Error: ${err}`);
@@ -100,7 +100,7 @@ export class CcApiContextProviderPlugin implements ContextProviderPlugin {
100100
typeName: string,
101101
propertyMatch: Record<string, unknown>,
102102
propertiesToReturn: string[],
103-
ignoreFailedLookup?: boolean,
103+
ignoreErrorOnMissingContext?: boolean,
104104
): Promise<{[key: string]: any}[]> {
105105
const resultObjs: {[key: string]: any}[] = [];
106106

@@ -136,7 +136,7 @@ export class CcApiContextProviderPlugin implements ContextProviderPlugin {
136136
}
137137
});
138138
} catch (err) {
139-
if (err instanceof ResourceNotFoundException && ignoreFailedLookup) {
139+
if (err instanceof ResourceNotFoundException && ignoreErrorOnMissingContext) {
140140
throw err;
141141
}
142142
throw new ContextProviderError(`Could not get resources ${JSON.stringify(propertyMatch)}. Error: ${err}`);

packages/aws-cdk/test/context-providers/cc-api-provider.test.ts

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ describe('dummy value', () => {
253253
typeName: 'AWS::RDS::DBInstance',
254254
exactIdentifier: 'bad-identifier',
255255
propertiesToReturn: ['DBInstanceArn', 'StorageEncrypted'],
256-
ignoreFailedLookup: true,
256+
ignoreErrorOnMissingContext: true,
257257
dummyValue: [
258258
{
259259
DBInstanceArn: 'arn:aws:rds:us-east-1:123456789012:db:dummy-instance',
@@ -282,7 +282,7 @@ describe('dummy value', () => {
282282
typeName: 'AWS::RDS::DBInstance',
283283
propertyMatch: { 'StorageEncrypted': 'true' },
284284
propertiesToReturn: ['DBInstanceArn', 'StorageEncrypted'],
285-
ignoreFailedLookup: true,
285+
ignoreErrorOnMissingContext: true,
286286
dummyValue: [
287287
{
288288
DBInstanceArn: 'arn:aws:rds:us-east-1:123456789012:db:dummy-instance',
@@ -312,7 +312,7 @@ describe('dummy value', () => {
312312
typeName: 'AWS::RDS::DBInstance',
313313
exactIdentifier: 'bad-identifier',
314314
propertiesToReturn: ['DBInstanceArn', 'StorageEncrypted'],
315-
ignoreFailedLookup: true,
315+
ignoreErrorOnMissingContext: true,
316316
dummyValue: [
317317
{
318318
DBInstanceArn: 'arn:aws:rds:us-east-1:123456789012:db:dummy-instance',
@@ -335,7 +335,7 @@ describe('dummy value', () => {
335335
typeName: 'AWS::RDS::DBInstance',
336336
propertyMatch: { 'StorageEncrypted': 'true' },
337337
propertiesToReturn: ['DBInstanceArn', 'StorageEncrypted'],
338-
ignoreFailedLookup: true,
338+
ignoreErrorOnMissingContext: true,
339339
dummyValue: [
340340
{
341341
DBInstanceArn: 'arn:aws:rds:us-east-1:123456789012:db:dummy-instance',
@@ -346,7 +346,7 @@ describe('dummy value', () => {
346346
).rejects.toThrow('Could not get resources {"StorageEncrypted":"true"}.');
347347
});
348348

349-
test('throws error when CC API fails and ignoreFailedLookup is not provided', async () => {
349+
test('throws error when CC API fails and ignoreErrorOnMissingContext is not provided', async () => {
350350
// GIVEN
351351
mockCloudControlClient.on(GetResourceCommand).rejects(createResourceNotFoundException());
352352

@@ -368,7 +368,7 @@ describe('dummy value', () => {
368368
).rejects.toThrow('Encountered CC API error while getting resource bad-identifier.');
369369
});
370370

371-
test('throws error when CC API fails and ignoreFailedLookup is false', async () => {
371+
test('throws error when CC API fails and ignoreErrorOnMissingContext is false', async () => {
372372
// GIVEN
373373
mockCloudControlClient.on(GetResourceCommand).rejects(createResourceNotFoundException());
374374

@@ -380,7 +380,7 @@ describe('dummy value', () => {
380380
typeName: 'AWS::RDS::DBInstance',
381381
exactIdentifier: 'bad-identifier',
382382
propertiesToReturn: ['DBInstanceArn', 'StorageEncrypted'],
383-
ignoreFailedLookup: false,
383+
ignoreErrorOnMissingContext: false,
384384
dummyValue: [
385385
{
386386
DBInstanceArn: 'arn:aws:rds:us-east-1:123456789012:db:dummy-instance',
@@ -403,7 +403,7 @@ describe('dummy value', () => {
403403
typeName: 'AWS::RDS::DBInstance',
404404
exactIdentifier: 'bad-identifier',
405405
propertiesToReturn: ['DBInstanceArn', 'StorageEncrypted'],
406-
ignoreFailedLookup: true,
406+
ignoreErrorOnMissingContext: true,
407407
}),
408408
).rejects.toThrow('dummyValue must be an array of objects. Failed to get dummy objects for type AWS::RDS::DBInstance.');
409409
});
@@ -420,7 +420,7 @@ describe('dummy value', () => {
420420
typeName: 'AWS::RDS::DBInstance',
421421
exactIdentifier: 'bad-identifier',
422422
propertiesToReturn: ['DBInstanceArn', 'StorageEncrypted'],
423-
ignoreFailedLookup: true,
423+
ignoreErrorOnMissingContext: true,
424424
dummyValue: {
425425
DBInstanceArn: 'arn:aws:rds:us-east-1:123456789012:db:dummy-instance',
426426
StorageEncrypted: 'true',
@@ -441,7 +441,7 @@ describe('dummy value', () => {
441441
typeName: 'AWS::RDS::DBInstance',
442442
exactIdentifier: 'bad-identifier',
443443
propertiesToReturn: ['DBInstanceArn', 'StorageEncrypted'],
444-
ignoreFailedLookup: true,
444+
ignoreErrorOnMissingContext: true,
445445
dummyValue: [],
446446
}),
447447
).rejects.toThrow('dummyValue must be an array of objects. Failed to get dummy objects for type AWS::RDS::DBInstance.');
@@ -459,7 +459,7 @@ describe('dummy value', () => {
459459
typeName: 'AWS::RDS::DBInstance',
460460
exactIdentifier: 'bad-identifier',
461461
propertiesToReturn: ['DBInstanceArn', 'StorageEncrypted'],
462-
ignoreFailedLookup: true,
462+
ignoreErrorOnMissingContext: true,
463463
dummyValue: [
464464
'not an object',
465465
],

0 commit comments

Comments
 (0)