Skip to content

Commit

Permalink
temp check
Browse files Browse the repository at this point in the history
  • Loading branch information
moelasmar committed Oct 17, 2024
1 parent 4971444 commit f802a1c
Show file tree
Hide file tree
Showing 2 changed files with 148 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { fp, registerServicePatches } from './core';
import { fp, registerServicePatches, replaceResourceProperty, forResource } from './core';
import { patching, types } from '@aws-cdk/service-spec-importers';

registerServicePatches(
Expand All @@ -15,4 +15,142 @@ registerServicePatches(
return readOnlyProperties;
},
),

forResource('AWS::DMS::DataProvider', (lens) => {
replaceResourceProperty(
'Settings',
{
type: 'object',
description: 'The property identifies the exact type of settings for the data provider.',
properties: {
PostgreSqlSettings: {
description: 'PostgreSqlSettings property identifier.',
type: 'object',
properties: {
ServerName: {
type: 'string',
},
Port: {
type: 'integer',
},
DatabaseName: {
type: 'string',
},
SslMode: {
type: 'object',
$ref: '#/definitions/DmsSslModeValue',
},
CertificateArn: {
type: 'string',
},
},
required: ['ServerName', 'Port', 'SslMode', 'DatabaseName'],
additionalProperties: false,
},
MySqlSettings: {
description: 'MySqlSettings property identifier.',
type: 'object',
properties: {
ServerName: {
type: 'string',
},
Port: {
type: 'integer',
},
SslMode: {
type: 'object',
$ref: '#/definitions/DmsSslModeValue',
},
CertificateArn: {
type: 'string',
},
},
required: ['ServerName', 'Port', 'SslMode'],
additionalProperties: false,
},
OracleSettings: {
description: 'OracleSettings property identifier.',
type: 'object',
properties: {
ServerName: {
type: 'string',
},
Port: {
type: 'integer',
},
DatabaseName: {
type: 'string',
},
SslMode: {
type: 'object',
$ref: '#/definitions/DmsSslModeValue',
},
CertificateArn: {
type: 'string',
},
AsmServer: {
type: 'string',
},
SecretsManagerOracleAsmSecretId: {
type: 'string',
},
SecretsManagerOracleAsmAccessRoleArn: {
type: 'string',
},
SecretsManagerSecurityDbEncryptionSecretId: {
type: 'string',
},
SecretsManagerSecurityDbEncryptionAccessRoleArn: {
type: 'string',
},
},
required: ['ServerName', 'Port', 'SslMode', 'DatabaseName'],
additionalProperties: false,
},
MicrosoftSqlServerSettings: {
description: 'MicrosoftSqlServerSettings property identifier.',
type: 'object',
properties: {
ServerName: {
type: 'string',
},
Port: {
type: 'integer',
},
DatabaseName: {
type: 'string',
},
SslMode: {
type: 'object',
$ref: '#/definitions/DmsSslModeValue',
},
CertificateArn: {
type: 'string',
},
},
required: ['ServerName', 'Port', 'SslMode', 'DatabaseName'],
additionalProperties: false,
},
},
anyOf: [
{
required: ['PostgreSqlSettings'],
},
{
required: ['MySqlSettings'],
},
{
required: ['OracleSettings'],
},
{
required: ['MicrosoftSqlServerSettings'],
},
],
additionalProperties: false,
},
patching.Reason.other(
'Temporary fix to fix the issue of missing the Settings property till we fix the anyOff issue',
),
)(lens);
}),
);
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export namespace jsonschema {
}

function isTypeDefined(x: any) {
return 'type' in x;
return 'type' in x && !('$ref' in x);
}

export interface Annotatable {
Expand Down Expand Up @@ -89,7 +89,14 @@ export namespace jsonschema {
* Determines whether or not the provided schema represents an `anyOf` type operator.
*/
export function isAnyOf(x: Schema): x is AnyOf<any> {
return !isAnyType(x) && 'anyOf' in x;
if ('anyOf' in (x as any) && !isAnyType(x)) {
for (const elem of (x as RecordLikeObject).anyOf!) {
if (!isAnyType(elem) && (isTypeDefined(elem) || isReference(elem))) {
return true;
}
}
}
return false;
}

export interface OneOf<S> extends Annotatable {
Expand Down

0 comments on commit f802a1c

Please sign in to comment.