Skip to content

Commit 02fba3e

Browse files
authored
Feature/INTMDB 700 ServerlessInstance x509 CloudBuckupSnapshot (#84)
1 parent 574ce66 commit 02fba3e

File tree

8 files changed

+98
-190
lines changed

8 files changed

+98
-190
lines changed

API.md

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

src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ export {
4848
CfnCloudBackupSchedule,
4949
CfnCloudBackupScheduleProps,
5050
Export,
51+
Link,
5152
} from "./l1-resources/cloud-backup-schedule";
5253

5354
export {
@@ -62,7 +63,6 @@ export {
6263
CfnCloudBackupSnapshotProps,
6364
CfnCloudBackupSnapshotPropsFrequencyType,
6465
CfnCloudBackupSnapshotPropsSnapshotType,
65-
Link,
6666
} from "./l1-resources/cloud-backup-snapshot";
6767

6868
export {

src/l1-resources/cloud-backup-snapshot/index.ts

Lines changed: 0 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -64,13 +64,6 @@ export interface CfnCloudBackupSnapshotProps {
6464
*/
6565
readonly itemsPerPage?: number;
6666

67-
/**
68-
* List of one or more Uniform Resource Locators (URLs) that point to API sub-resources, related API resources, or both. RFC 5988 outlines these relationships.
69-
*
70-
* @schema CfnCloudBackupSnapshotProps#Links
71-
*/
72-
readonly links?: Link[];
73-
7467
/**
7568
* List that includes the snapshots and the cloud provider that stores the snapshots. The resource returns this parameter when `"type" : "SHARDED_CLUSTER"`.
7669
*
@@ -140,7 +133,6 @@ export function toJson_CfnCloudBackupSnapshotProps(
140133
ProjectId: obj.projectId,
141134
IncludeCount: obj.includeCount,
142135
ItemsPerPage: obj.itemsPerPage,
143-
Links: obj.links?.map((y) => toJson_Link(y)),
144136
Members: obj.members?.map((y) =>
145137
toJson_ApiAtlasDiskBackupShardedClusterSnapshotMemberView(y)
146138
),
@@ -177,47 +169,6 @@ export enum CfnCloudBackupSnapshotPropsFrequencyType {
177169
MONTHLY = "monthly",
178170
}
179171

180-
/**
181-
* @schema Link
182-
*/
183-
export interface Link {
184-
/**
185-
* Uniform Resource Locator (URL) that points another API resource to which this response has some relationship. This URL often begins with `https://mms.mongodb.com`.
186-
*
187-
* @schema Link#Href
188-
*/
189-
readonly href?: string;
190-
191-
/**
192-
* Uniform Resource Locator (URL) that defines the semantic relationship between this resource and another API resource. This URL often begins with `https://mms.mongodb.com`.
193-
*
194-
* @schema Link#Rel
195-
*/
196-
readonly rel?: string;
197-
}
198-
199-
/**
200-
* Converts an object of type 'Link' to JSON representation.
201-
*/
202-
/* eslint-disable max-len, quote-props */
203-
export function toJson_Link(
204-
obj: Link | undefined
205-
): Record<string, any> | undefined {
206-
if (obj === undefined) {
207-
return undefined;
208-
}
209-
const result = {
210-
Href: obj.href,
211-
Rel: obj.rel,
212-
};
213-
// filter undefined values
214-
return Object.entries(result).reduce(
215-
(r, i) => (i[1] === undefined ? r : { ...r, [i[0]]: i[1] }),
216-
{}
217-
);
218-
}
219-
/* eslint-enable max-len, quote-props */
220-
221172
/**
222173
* @schema ApiAtlasDiskBackupShardedClusterSnapshotMemberView
223174
*/
@@ -306,13 +257,6 @@ export interface ApiAtlasDiskBackupShardedClusterSnapshotView {
306257
*/
307258
readonly id?: string;
308259

309-
/**
310-
* List of one or more Uniform Resource Locators (URLs) that point to API sub-resources, related API resources, or both. RFC 5988 outlines these relationships.
311-
*
312-
* @schema ApiAtlasDiskBackupShardedClusterSnapshotView#Links
313-
*/
314-
readonly links?: Link[];
315-
316260
/**
317261
* Unique string that identifies the Amazon Web Services (AWS) Key Management Service (KMS) Customer Master Key (CMK) used to encrypt the snapshot. The resource returns this value when `"encryptionEnabled" : true`.
318262
*
@@ -393,7 +337,6 @@ export function toJson_ApiAtlasDiskBackupShardedClusterSnapshotView(
393337
ExpiresAt: obj.expiresAt,
394338
FrequencyType: obj.frequencyType,
395339
Id: obj.id,
396-
Links: obj.links?.map((y) => toJson_Link(y)),
397340
MasterKeyUUID: obj.masterKeyUuid,
398341
Members: obj.members?.map((y) =>
399342
toJson_ApiAtlasDiskBackupShardedClusterSnapshotMemberView(y)

src/l1-resources/serverless-instance/index.ts

Lines changed: 0 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,6 @@ export interface CfnServerlessInstanceProps {
3636
*/
3737
readonly itemsPerPage?: number;
3838

39-
/**
40-
* List of one or more Uniform Resource Locators (URLs) that point to API sub-resources, related API resources, or both. RFC 5988 outlines these relationships.
41-
*
42-
* @schema CfnServerlessInstanceProps#Links
43-
*/
44-
readonly links?: Link[];
45-
4639
/**
4740
* Human-readable label that identifies the serverless instance.
4841
*
@@ -103,7 +96,6 @@ export function toJson_CfnServerlessInstanceProps(
10396
ContinuousBackupEnabled: obj.continuousBackupEnabled,
10497
IncludeCount: obj.includeCount,
10598
ItemsPerPage: obj.itemsPerPage,
106-
Links: obj.links?.map((y) => toJson_Link(y)),
10799
Name: obj.name,
108100
PageNum: obj.pageNum,
109101
ProjectID: obj.projectId,
@@ -162,47 +154,7 @@ export function toJson_ServerlessInstanceConnectionStrings(
162154
{}
163155
);
164156
}
165-
/* eslint-enable max-len, quote-props */
166-
167-
/**
168-
* @schema Link
169-
*/
170-
export interface Link {
171-
/**
172-
* Uniform Resource Locator (URL) that points another API resource to which this response has some relationship. This URL often begins with `https://mms.mongodb.com`.
173-
*
174-
* @schema Link#Href
175-
*/
176-
readonly href?: string;
177-
178-
/**
179-
* Uniform Resource Locator (URL) that defines the semantic relationship between this resource and another API resource. This URL often begins with `https://mms.mongodb.com`.
180-
*
181-
* @schema Link#Rel
182-
*/
183-
readonly rel?: string;
184-
}
185157

186-
/**
187-
* Converts an object of type 'Link' to JSON representation.
188-
*/
189-
/* eslint-disable max-len, quote-props */
190-
export function toJson_Link(
191-
obj: Link | undefined
192-
): Record<string, any> | undefined {
193-
if (obj === undefined) {
194-
return undefined;
195-
}
196-
const result = {
197-
Href: obj.href,
198-
Rel: obj.rel,
199-
};
200-
// filter undefined values
201-
return Object.entries(result).reduce(
202-
(r, i) => (i[1] === undefined ? r : { ...r, [i[0]]: i[1] }),
203-
{}
204-
);
205-
}
206158
/* eslint-enable max-len, quote-props */
207159

208160
/**

src/l1-resources/x509-authentication-database-user/index.ts

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -132,15 +132,6 @@ export class CfnX509AuthenticationDatabaseUser extends cdk.CfnResource {
132132
*/
133133
public readonly props: CfnX509AuthenticationDatabaseUserProps;
134134

135-
/**
136-
* Attribute `MongoDB::Atlas::X509AuthenticationDatabaseUser.Links`
137-
*/
138-
public readonly attrLinks: any[];
139-
/**
140-
* Attribute `MongoDB::Atlas::X509AuthenticationDatabaseUser.Results`
141-
*/
142-
public readonly attrResults: any[];
143-
144135
/**
145136
* Create a new `MongoDB::Atlas::X509AuthenticationDatabaseUser`.
146137
*
@@ -159,8 +150,5 @@ export class CfnX509AuthenticationDatabaseUser extends cdk.CfnResource {
159150
});
160151

161152
this.props = props;
162-
163-
this.attrLinks = cdk.Token.asList(this.getAtt("Links"));
164-
this.attrResults = cdk.Token.asList(this.getAtt("Results"));
165153
}
166154
}
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
// Copyright 2023 MongoDB Inc
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
import { App, Stack } from "aws-cdk-lib";
16+
import { Template } from "aws-cdk-lib/assertions";
17+
import { CfnCloudBackupSnapshot } from "../../../src/l1-resources/cloud-backup-snapshot";
18+
19+
const RESOURCE_NAME = "MongoDB::Atlas::CloudBackupSnapshot";
20+
const PROJECT_ID = "testProjectId";
21+
const CLUSTER_NAME = "testCluster";
22+
23+
test("CloudBackupSnapshot construct should contain default properties", () => {
24+
const mockApp = new App();
25+
const stack = new Stack(mockApp);
26+
27+
new CfnCloudBackupSnapshot(stack, "testing-stack", {
28+
projectId: PROJECT_ID,
29+
clusterName: CLUSTER_NAME,
30+
description: "snapshot through cloud formation template",
31+
retentionInDays: 5,
32+
});
33+
34+
const template = Template.fromStack(stack);
35+
36+
template.hasResourceProperties(RESOURCE_NAME, {
37+
ProjectId: PROJECT_ID,
38+
ClusterName: CLUSTER_NAME,
39+
Description: "snapshot through cloud formation template",
40+
RetentionInDays: 5,
41+
});
42+
});

0 commit comments

Comments
 (0)