Skip to content

Commit 0ad33f4

Browse files
committed
index.ts
1 parent cae50ba commit 0ad33f4

File tree

1 file changed

+340
-0
lines changed

1 file changed

+340
-0
lines changed
Lines changed: 340 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,340 @@
1+
// Generated by cdk-import
2+
import * as cdk from "aws-cdk-lib";
3+
import * as constructs from "constructs";
4+
5+
/**
6+
* The flex cluster resource provides access to your flex cluster configurations. The resource lets you create, edit and delete flex clusters. The resource requires your Project ID.
7+
*
8+
* @schema CfnFlexClusterProps
9+
*/
10+
export interface CfnFlexClusterProps {
11+
/**
12+
* Profile used to provide credentials information, (a secret with the cfn/atlas/profile/{Profile}, is required), if not provided default is used
13+
*
14+
* @schema CfnFlexClusterProps#Profile
15+
*/
16+
readonly profile?: string;
17+
18+
/**
19+
* Unique identifier of the project the cluster belongs to.
20+
*
21+
* @schema CfnFlexClusterProps#ProjectId
22+
*/
23+
readonly projectId: string;
24+
25+
/**
26+
* Human-readable label that identifies the flex cluster.
27+
*
28+
* @schema CfnFlexClusterProps#Name
29+
*/
30+
readonly name: string;
31+
32+
/**
33+
* @schema CfnFlexClusterProps#ProviderSettings
34+
*/
35+
readonly providerSettings: ProviderSettings;
36+
37+
/**
38+
* @schema CfnFlexClusterProps#BackupSettings
39+
*/
40+
readonly backupSettings?: BackupSettings;
41+
42+
/**
43+
* @schema CfnFlexClusterProps#ConnectionStrings
44+
*/
45+
readonly connectionStrings?: ConnectionStrings;
46+
47+
/**
48+
* Flag that indicates whether termination protection is enabled on the cluster. If set to true, MongoDB Cloud won't delete the cluster. If set to false, MongoDB Cloud will delete the cluster.
49+
*
50+
* @schema CfnFlexClusterProps#TerminationProtectionEnabled
51+
*/
52+
readonly terminationProtectionEnabled?: boolean;
53+
54+
/**
55+
* Map that contains key-value pairs between 1 to 255 characters in length for tagging and categorizing the flex cluster.
56+
*
57+
* @schema CfnFlexClusterProps#Tags
58+
*/
59+
readonly tags?: Tag[];
60+
}
61+
62+
/**
63+
* Converts an object of type 'CfnFlexClusterProps' to JSON representation.
64+
*/
65+
/* eslint-disable max-len, quote-props */
66+
export function toJson_CfnFlexClusterProps(
67+
obj: CfnFlexClusterProps | undefined
68+
): Record<string, any> | undefined {
69+
if (obj === undefined) {
70+
return undefined;
71+
}
72+
const result = {
73+
Profile: obj.profile,
74+
ProjectId: obj.projectId,
75+
Name: obj.name,
76+
ProviderSettings: toJson_ProviderSettings(obj.providerSettings),
77+
BackupSettings: toJson_BackupSettings(obj.backupSettings),
78+
ConnectionStrings: toJson_ConnectionStrings(obj.connectionStrings),
79+
TerminationProtectionEnabled: obj.terminationProtectionEnabled,
80+
Tags: obj.tags?.map((y) => toJson_Tag(y)),
81+
};
82+
// filter undefined values
83+
return Object.entries(result).reduce(
84+
(r, i) => (i[1] === undefined ? r : { ...r, [i[0]]: i[1] }),
85+
{}
86+
);
87+
}
88+
/* eslint-enable max-len, quote-props */
89+
90+
/**
91+
* Group of cloud provider settings that configure the provisioned MongoDB flex cluster.
92+
*
93+
* @schema ProviderSettings
94+
*/
95+
export interface ProviderSettings {
96+
/**
97+
* Cloud service provider on which MongoDB Cloud provisioned the flex cluster.
98+
*
99+
* @schema ProviderSettings#BackingProviderName
100+
*/
101+
readonly backingProviderName: string;
102+
103+
/**
104+
* Human-readable label that identifies the geographic location of your MongoDB flex cluster. The region you choose can affect network latency for clients accessing your databases.
105+
*
106+
* @schema ProviderSettings#RegionName
107+
*/
108+
readonly regionName: string;
109+
110+
/**
111+
* Storage capacity available to the flex cluster expressed in gigabytes.
112+
*
113+
* @schema ProviderSettings#DiskSizeGB
114+
*/
115+
readonly diskSizeGb?: number;
116+
117+
/**
118+
* Human-readable label that identifies the cloud service provider.
119+
*
120+
* @schema ProviderSettings#ProviderName
121+
*/
122+
readonly providerName?: string;
123+
}
124+
125+
/**
126+
* Converts an object of type 'ProviderSettings' to JSON representation.
127+
*/
128+
/* eslint-disable max-len, quote-props */
129+
export function toJson_ProviderSettings(
130+
obj: ProviderSettings | undefined
131+
): Record<string, any> | undefined {
132+
if (obj === undefined) {
133+
return undefined;
134+
}
135+
const result = {
136+
BackingProviderName: obj.backingProviderName,
137+
RegionName: obj.regionName,
138+
DiskSizeGB: obj.diskSizeGb,
139+
ProviderName: obj.providerName,
140+
};
141+
// filter undefined values
142+
return Object.entries(result).reduce(
143+
(r, i) => (i[1] === undefined ? r : { ...r, [i[0]]: i[1] }),
144+
{}
145+
);
146+
}
147+
/* eslint-enable max-len, quote-props */
148+
149+
/**
150+
* Flex backup configuration
151+
*
152+
* @schema BackupSettings
153+
*/
154+
export interface BackupSettings {
155+
/**
156+
* Flag that indicates whether backups are performed for this flex cluster. Backup uses flex cluster backups.
157+
*
158+
* @schema BackupSettings#Enabled
159+
*/
160+
readonly enabled?: boolean;
161+
}
162+
163+
/**
164+
* Converts an object of type 'BackupSettings' to JSON representation.
165+
*/
166+
/* eslint-disable max-len, quote-props */
167+
export function toJson_BackupSettings(
168+
obj: BackupSettings | undefined
169+
): Record<string, any> | undefined {
170+
if (obj === undefined) {
171+
return undefined;
172+
}
173+
const result = {
174+
Enabled: obj.enabled,
175+
};
176+
// filter undefined values
177+
return Object.entries(result).reduce(
178+
(r, i) => (i[1] === undefined ? r : { ...r, [i[0]]: i[1] }),
179+
{}
180+
);
181+
}
182+
/* eslint-enable max-len, quote-props */
183+
184+
/**
185+
* Collection of Uniform Resource Locators that point to the MongoDB database.
186+
*
187+
* @schema ConnectionStrings
188+
*/
189+
export interface ConnectionStrings {
190+
/**
191+
* Public connection string that you can use to connect to this cluster. This connection string uses the mongodb:// protocol.
192+
*
193+
* @schema ConnectionStrings#Standard
194+
*/
195+
readonly standard?: string;
196+
197+
/**
198+
* Public connection string that you can use to connect to this flex cluster. This connection string uses the mongodb+srv:// protocol.
199+
*
200+
* @schema ConnectionStrings#StandardSrv
201+
*/
202+
readonly standardSrv?: string;
203+
}
204+
205+
/**
206+
* Converts an object of type 'ConnectionStrings' to JSON representation.
207+
*/
208+
/* eslint-disable max-len, quote-props */
209+
export function toJson_ConnectionStrings(
210+
obj: ConnectionStrings | undefined
211+
): Record<string, any> | undefined {
212+
if (obj === undefined) {
213+
return undefined;
214+
}
215+
const result = {
216+
Standard: obj.standard,
217+
StandardSrv: obj.standardSrv,
218+
};
219+
// filter undefined values
220+
return Object.entries(result).reduce(
221+
(r, i) => (i[1] === undefined ? r : { ...r, [i[0]]: i[1] }),
222+
{}
223+
);
224+
}
225+
/* eslint-enable max-len, quote-props */
226+
227+
/**
228+
* List that contains key-value pairs between 1 to 255 characters in length for tagging and categorizing the cluster.
229+
*
230+
* @schema tag
231+
*/
232+
export interface Tag {
233+
/**
234+
* Constant that defines the set of the tag. For example, environment in the environment : production tag.
235+
*
236+
* @schema tag#Key
237+
*/
238+
readonly key: string;
239+
240+
/**
241+
* Variable that belongs to the set of the tag. For example, production in the environment : production tag.
242+
*
243+
* @schema tag#Value
244+
*/
245+
readonly value: string;
246+
}
247+
248+
/**
249+
* Converts an object of type 'Tag' to JSON representation.
250+
*/
251+
/* eslint-disable max-len, quote-props */
252+
export function toJson_Tag(
253+
obj: Tag | undefined
254+
): Record<string, any> | undefined {
255+
if (obj === undefined) {
256+
return undefined;
257+
}
258+
const result = {
259+
Key: obj.key,
260+
Value: obj.value,
261+
};
262+
// filter undefined values
263+
return Object.entries(result).reduce(
264+
(r, i) => (i[1] === undefined ? r : { ...r, [i[0]]: i[1] }),
265+
{}
266+
);
267+
}
268+
/* eslint-enable max-len, quote-props */
269+
270+
/**
271+
* A CloudFormation `MongoDB::Atlas::FlexCluster`
272+
*
273+
* @cloudformationResource MongoDB::Atlas::FlexCluster
274+
* @stability external
275+
*/
276+
export class CfnFlexCluster extends cdk.CfnResource {
277+
/**
278+
* The CloudFormation resource type name for this resource class.
279+
*/
280+
public static readonly CFN_RESOURCE_TYPE_NAME = "MongoDB::Atlas::FlexCluster";
281+
282+
/**
283+
* Resource props.
284+
*/
285+
public readonly props: CfnFlexClusterProps;
286+
287+
/**
288+
* Attribute `MongoDB::Atlas::FlexCluster.Id`
289+
*/
290+
public readonly attrId: string;
291+
/**
292+
* Attribute `MongoDB::Atlas::FlexCluster.StateName`
293+
*/
294+
public readonly attrStateName: string;
295+
/**
296+
* Attribute `MongoDB::Atlas::FlexCluster.ClusterType`
297+
*/
298+
public readonly attrClusterType: string;
299+
/**
300+
* Attribute `MongoDB::Atlas::FlexCluster.CreateDate`
301+
*/
302+
public readonly attrCreateDate: string;
303+
/**
304+
* Attribute `MongoDB::Atlas::FlexCluster.MongoDBVersion`
305+
*/
306+
public readonly attrMongoDBVersion: string;
307+
/**
308+
* Attribute `MongoDB::Atlas::FlexCluster.VersionReleaseSystem`
309+
*/
310+
public readonly attrVersionReleaseSystem: string;
311+
312+
/**
313+
* Create a new `MongoDB::Atlas::FlexCluster`.
314+
*
315+
* @param scope - scope in which this resource is defined
316+
* @param id - scoped id of the resource
317+
* @param props - resource properties
318+
*/
319+
constructor(
320+
scope: constructs.Construct,
321+
id: string,
322+
props: CfnFlexClusterProps
323+
) {
324+
super(scope, id, {
325+
type: CfnFlexCluster.CFN_RESOURCE_TYPE_NAME,
326+
properties: toJson_CfnFlexClusterProps(props)!,
327+
});
328+
329+
this.props = props;
330+
331+
this.attrId = cdk.Token.asString(this.getAtt("Id"));
332+
this.attrStateName = cdk.Token.asString(this.getAtt("StateName"));
333+
this.attrClusterType = cdk.Token.asString(this.getAtt("ClusterType"));
334+
this.attrCreateDate = cdk.Token.asString(this.getAtt("CreateDate"));
335+
this.attrMongoDBVersion = cdk.Token.asString(this.getAtt("MongoDBVersion"));
336+
this.attrVersionReleaseSystem = cdk.Token.asString(
337+
this.getAtt("VersionReleaseSystem")
338+
);
339+
}
340+
}

0 commit comments

Comments
 (0)