Skip to content

Commit ee3db00

Browse files
Adelmar92lantoli
andauthored
feat: CLOUDP-215176/CLOUDP-215176 215173 exported organization cluster outrage simulation (#172)
Co-authored-by: Leo Antoli <[email protected]>
1 parent 6b0bb6b commit ee3db00

File tree

6 files changed

+3471
-1686
lines changed

6 files changed

+3471
-1686
lines changed

API.md

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

src/index.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,13 @@ export {
9999
CfnCloudBackupSnapshotExportBucketProps,
100100
} from "./l1-resources/cloud-backup-snapshot-export-bucket";
101101

102+
export {
103+
CfnClusterOutageSimulation,
104+
CfnClusterOutageSimulationProps,
105+
Filter,
106+
FilterCloudProvider,
107+
} from "./l1-resources/cluster-outage-simulation";
108+
102109
export {
103110
CfnClusterProps,
104111
ProcessArgs,
@@ -211,6 +218,12 @@ export {
211218
CfnOrgInvitationPropsRoles,
212219
} from "./l1-resources/org-invitation";
213220

221+
export {
222+
CfnOrganization,
223+
CfnOrganizationProps,
224+
ApiKey,
225+
} from "./l1-resources/organization";
226+
214227
export {
215228
CfnPrivateEndpointProps,
216229
CfnPrivateEndpoint,
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# ClusterOutageSimulation
2+
3+
## CFN resource type used
4+
- MongoDB::Atlas::ClusterOutageSimulation
5+
6+
This CFN resource must be active in your AWS account while using this constructor.
7+
8+
## Manual QA
9+
- Follow prerequisite steps for testing a CDK construct in [TESTING.md](../../../TESTING.md).
10+
- Set any additional required configuration options/parameters as per your needs.
11+
- Please follow the steps in [TESTING.md](../../../TESTING.md).
12+
13+
### Success criteria when testing the resource
14+
1. Cluster Outage Simulation is created successfully.
15+
16+
2. Ensure general [CDK resource success criteria](../../../TESTING.md) for this resource is met.
17+
18+
## Important Links
19+
- [API Documentation](https://www.mongodb.com/docs/atlas/reference/api-resources-spec/v2/#tag/Cluster-Outage-Simulation)
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
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 {
18+
CfnClusterOutageSimulation,
19+
FilterCloudProvider,
20+
} from "../../../src/l1-resources/cluster-outage-simulation";
21+
22+
const RESOURCE_NAME = "MongoDB::Atlas::ClusterOutageSimulation";
23+
const PROJECTI_ID = "test_project_id";
24+
const PROFILE = "default";
25+
const CLUSTER_NAME = "testProjectId";
26+
const CLOUD_PROVIDER = FilterCloudProvider.AWS;
27+
const REGION = "US_WEST_1";
28+
const TYPE = "REGION";
29+
30+
test("CfnClusterOutageSimulation construct should contain default properties", () => {
31+
const mockApp = new App();
32+
const stack = new Stack(mockApp);
33+
34+
new CfnClusterOutageSimulation(stack, "testing-stack", {
35+
projectId: PROJECTI_ID,
36+
profile: PROFILE,
37+
clusterName: CLUSTER_NAME,
38+
outageFilters: [
39+
{
40+
cloudProvider: CLOUD_PROVIDER,
41+
region: REGION,
42+
type: TYPE,
43+
},
44+
],
45+
});
46+
47+
const template = Template.fromStack(stack);
48+
49+
template.hasResourceProperties(RESOURCE_NAME, {
50+
ProjectId: PROJECTI_ID,
51+
Profile: PROFILE,
52+
ClusterName: CLUSTER_NAME,
53+
OutageFilters: [
54+
{
55+
CloudProvider: CLOUD_PROVIDER,
56+
Region: REGION,
57+
Type: TYPE,
58+
},
59+
],
60+
});
61+
});
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Organization
2+
3+
## CFN resource type used
4+
- MongoDB::Atlas::Organization
5+
6+
This CFN resource must be active in your AWS account while using this constructor.
7+
8+
## Manual QA
9+
- Follow prerequisite steps for testing a CDK construct in [TESTING.md](../../../TESTING.md).
10+
- Set any additional required configuration options/parameters as per your needs.
11+
- Please follow the steps in [TESTING.md](../../../TESTING.md).
12+
13+
### Success criteria when testing the resource
14+
1. The Atlas Organization is created successfully.
15+
16+
2. Ensure general [CDK resource success criteria](../../../TESTING.md) for this resource is met.
17+
18+
## Important Links
19+
- [API Documentation](https://www.mongodb.com/docs/atlas/reference/api-resources-spec/v2/#tag/Organizations)
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
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 { CfnOrganization } from "../../../src/l1-resources/organization";
18+
19+
const RESOURCE_NAME = "MongoDB::Atlas::Organization";
20+
const NAME = "testProjectId";
21+
const ORG_OWNER_ID = "test";
22+
const PROFILE = "default";
23+
const AWS_SECRET_NAME = "secret_name_test";
24+
const ROLES = ["ORG_OWNER", "ORG_GROUP_CREATOR"];
25+
const API_KEY_DESC = "api key description";
26+
27+
test("CfnOrganization construct should contain default properties", () => {
28+
const mockApp = new App();
29+
const stack = new Stack(mockApp);
30+
31+
new CfnOrganization(stack, "testing-stack", {
32+
orgOwnerId: ORG_OWNER_ID,
33+
name: NAME,
34+
apiKey: {
35+
roles: ROLES,
36+
description: API_KEY_DESC,
37+
},
38+
profile: PROFILE,
39+
awsSecretName: AWS_SECRET_NAME,
40+
});
41+
42+
const template = Template.fromStack(stack);
43+
44+
template.hasResourceProperties(RESOURCE_NAME, {
45+
OrgOwnerId: ORG_OWNER_ID,
46+
Name: NAME,
47+
APIKey: {
48+
Roles: ROLES,
49+
Description: API_KEY_DESC,
50+
},
51+
Profile: PROFILE,
52+
AwsSecretName: AWS_SECRET_NAME,
53+
});
54+
});

0 commit comments

Comments
 (0)