Skip to content

Commit 37efb07

Browse files
authored
fix!: INTMDB-1175 fixed cloud Backup snapshot primary identifier (#149)
1 parent 2e6dd08 commit 37efb07

File tree

5 files changed

+75
-29
lines changed

5 files changed

+75
-29
lines changed

API.md

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

examples/l1-resources/cloud-backup-snapshot.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import * as cdk from 'aws-cdk-lib';
22
import { Construct } from 'constructs';
3-
import { CfnCloudBackupSnapshot } from 'awscdk-resources-mongodbatlas';
3+
import { CfnCloudBackupSnapshot,CfnCloudBackupSnapshotPropsInstanceType } from 'awscdk-resources-mongodbatlas';
44

55
interface AtlasStackProps {
66
readonly projId: string;
@@ -15,8 +15,9 @@ export class CdkTestingStack extends cdk.Stack {
1515

1616
const atlasProps = this.getContextProps();
1717

18-
const cloudBackupSnapshot = new CfnCloudBackupSnapshot(this, 'CloudBackupSnapshot', {
19-
clusterName: atlasProps.clusterName,
18+
new CfnCloudBackupSnapshot(this, 'CloudBackupSnapshot', {
19+
instanceName: atlasProps.clusterName,
20+
instanceType: CfnCloudBackupSnapshotPropsInstanceType.CLUSTER,
2021
profile: atlasProps.profile,
2122
projectId: atlasProps.projId,
2223
description: 'Snapshot created with CDK',

src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ export {
9191
CfnCloudBackupSnapshotProps,
9292
CfnCloudBackupSnapshotPropsFrequencyType,
9393
CfnCloudBackupSnapshotPropsSnapshotType,
94+
CfnCloudBackupSnapshotPropsInstanceType,
9495
} from "./l1-resources/cloud-backup-snapshot";
9596

9697
export {

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

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,18 @@ export interface CfnCloudBackupSnapshotProps {
1616
readonly profile?: string;
1717

1818
/**
19-
* Human-readable label that identifies the cluster.
19+
* Type of instance specified on the Instance Name serverless or cluster
2020
*
21-
* @schema CfnCloudBackupSnapshotProps#ClusterName
21+
* @schema CfnCloudBackupSnapshotProps#InstanceType
2222
*/
23-
readonly clusterName: string;
23+
readonly instanceType: CfnCloudBackupSnapshotPropsInstanceType;
2424

2525
/**
26-
* Human-readable label that identifies the serverless instance.
26+
* The instance name of the Serverless/Cluster whose snapshot you want to restore or you want to retrieve restore snapshot.
2727
*
2828
* @schema CfnCloudBackupSnapshotProps#InstanceName
2929
*/
30-
readonly instanceName?: string;
30+
readonly instanceName: string;
3131

3232
/**
3333
* Human-readable phrase or sentence that explains the purpose of the snapshot. The resource returns this parameter when `"status": "onDemand"`.
@@ -126,7 +126,7 @@ export function toJson_CfnCloudBackupSnapshotProps(
126126
}
127127
const result = {
128128
Profile: obj.profile,
129-
ClusterName: obj.clusterName,
129+
InstanceType: obj.instanceType,
130130
InstanceName: obj.instanceName,
131131
Description: obj.description,
132132
FrequencyType: obj.frequencyType,
@@ -153,6 +153,18 @@ export function toJson_CfnCloudBackupSnapshotProps(
153153
}
154154
/* eslint-enable max-len, quote-props */
155155

156+
/**
157+
* Type of instance specified on the Instance Name serverless or cluster
158+
*
159+
* @schema CfnCloudBackupSnapshotPropsInstanceType
160+
*/
161+
export enum CfnCloudBackupSnapshotPropsInstanceType {
162+
/** serverless */
163+
SERVERLESS = "serverless",
164+
/** cluster */
165+
CLUSTER = "cluster",
166+
}
167+
156168
/**
157169
* Human-readable label that identifies how often this snapshot triggers.
158170
*

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

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,10 @@
1414

1515
import { App, Stack } from "aws-cdk-lib";
1616
import { Template } from "aws-cdk-lib/assertions";
17-
import { CfnCloudBackupSnapshot } from "../../../src/l1-resources/cloud-backup-snapshot";
17+
import {
18+
CfnCloudBackupSnapshot,
19+
CfnCloudBackupSnapshotPropsInstanceType,
20+
} from "../../../src/l1-resources/cloud-backup-snapshot";
1821

1922
const RESOURCE_NAME = "MongoDB::Atlas::CloudBackupSnapshot";
2023
const PROJECT_ID = "testProjectId";
@@ -26,7 +29,8 @@ test("CloudBackupSnapshot construct should contain default properties", () => {
2629

2730
new CfnCloudBackupSnapshot(stack, "testing-stack", {
2831
projectId: PROJECT_ID,
29-
clusterName: CLUSTER_NAME,
32+
instanceName: CLUSTER_NAME,
33+
instanceType: CfnCloudBackupSnapshotPropsInstanceType.CLUSTER,
3034
description: "snapshot through cloud formation template",
3135
retentionInDays: 5,
3236
});
@@ -35,7 +39,8 @@ test("CloudBackupSnapshot construct should contain default properties", () => {
3539

3640
template.hasResourceProperties(RESOURCE_NAME, {
3741
ProjectId: PROJECT_ID,
38-
ClusterName: CLUSTER_NAME,
42+
InstanceName: CLUSTER_NAME,
43+
InstanceType: CfnCloudBackupSnapshotPropsInstanceType.CLUSTER,
3944
Description: "snapshot through cloud formation template",
4045
RetentionInDays: 5,
4146
});

0 commit comments

Comments
 (0)