1
- import * as documentdb from " @pulumi/azure-native/documentdb" ;
2
- import { getCosmosDbName } from " ../Common/Naming" ;
3
- import { DefaultResourceArgs , KeyVaultInfo , ResourceGroupInfo } from " ../types" ;
4
- import ResourceCreator from " ../Core/ResourceCreator" ;
5
- import { defaultTags , isPrd } from " ../Common/AzureEnv" ;
6
- import { createThreatProtection } from " ../Logs/Helpers" ;
7
- import { Input } from " @pulumi/pulumi" ;
1
+ import * as documentdb from ' @pulumi/azure-native/documentdb' ;
2
+ import { getCosmosDbName } from ' ../Common/Naming' ;
3
+ import { DefaultResourceArgs , KeyVaultInfo , ResourceGroupInfo } from ' ../types' ;
4
+ import ResourceCreator from ' ../Core/ResourceCreator' ;
5
+ import { defaultTags , isPrd } from ' ../Common/AzureEnv' ;
6
+ import { createThreatProtection } from ' ../Logs/Helpers' ;
7
+ import { Input } from ' @pulumi/pulumi' ;
8
8
9
9
interface CosmosDbProps {
10
10
name : string ;
11
11
group : ResourceGroupInfo ;
12
12
vaultInfo ?: KeyVaultInfo ;
13
13
locations ?: Input < string > [ ] ;
14
14
enableMultipleWriteLocations ?: boolean ;
15
- capabilities ?: Array < " EnableCassandra" | " EnableTable" | " EnableGremlin" > ;
16
- kind ?: documentdb . DatabaseAccountKind ,
17
- enableThreatProtection ?:boolean ;
15
+ capabilities ?: Array < ' EnableCassandra' | ' EnableTable' | ' EnableGremlin' > ;
16
+ kind ?: documentdb . DatabaseAccountKind ;
17
+ enableThreatProtection ?: boolean ;
18
18
network ?: {
19
19
publicNetworkAccess ?: boolean ;
20
20
allowAzureServicesAccess ?: boolean ;
@@ -47,7 +47,7 @@ export default async ({
47
47
enableThreatProtection,
48
48
network,
49
49
sqlDbs,
50
- kind= documentdb . DatabaseAccountKind . GlobalDocumentDB ,
50
+ kind = documentdb . DatabaseAccountKind . GlobalDocumentDB ,
51
51
} : CosmosDbProps ) => {
52
52
name = getCosmosDbName ( name ) ;
53
53
@@ -70,7 +70,7 @@ export default async ({
70
70
...group ,
71
71
databaseAccountOfferType : documentdb . DatabaseAccountOfferType . Standard ,
72
72
kind,
73
- identity : { type : " SystemAssigned" } ,
73
+ identity : { type : ' SystemAssigned' } ,
74
74
75
75
capabilities : capabilities
76
76
? capabilities . map ( ( n ) => ( { name : n } ) )
@@ -80,7 +80,7 @@ export default async ({
80
80
81
81
backupPolicy : isPrd
82
82
? {
83
- type : " Periodic" ,
83
+ type : ' Periodic' ,
84
84
periodicModeProperties : {
85
85
backupIntervalInMinutes : 30 ,
86
86
backupRetentionIntervalInHours : 4 ,
@@ -126,21 +126,24 @@ export default async ({
126
126
//keyVaultKeyId: encryptKey?.properties.id,
127
127
monitoring : {
128
128
logsCategories : [
129
- " CassandraRequests" ,
130
- " PartitionKeyStatistics" ,
131
- " ControlPlaneRequests" ,
132
- " MongoRequests" ,
133
- " QueryRuntimeStatistics" ,
134
- " GremlinRequests" ,
135
- " PartitionKeyRUConsumption" ,
136
- " DataPlaneRequests" ,
129
+ ' CassandraRequests' ,
130
+ ' PartitionKeyStatistics' ,
131
+ ' ControlPlaneRequests' ,
132
+ ' MongoRequests' ,
133
+ ' QueryRuntimeStatistics' ,
134
+ ' GremlinRequests' ,
135
+ ' PartitionKeyRUConsumption' ,
136
+ ' DataPlaneRequests' ,
137
137
] ,
138
- metricsCategories : [ " Requests" ] ,
138
+ metricsCategories : [ ' Requests' ] ,
139
139
} ,
140
140
tags : defaultTags ,
141
141
} as unknown as documentdb . DatabaseAccountArgs & DefaultResourceArgs ) ;
142
142
143
- if ( enableThreatProtection && kind !== documentdb . DatabaseAccountKind . MongoDB ) {
143
+ if (
144
+ enableThreatProtection &&
145
+ kind !== documentdb . DatabaseAccountKind . MongoDB
146
+ ) {
144
147
//Thread Protection
145
148
createThreatProtection ( {
146
149
name,
@@ -150,7 +153,7 @@ export default async ({
150
153
151
154
//Vault variables
152
155
if ( vaultInfo ) {
153
- const keys = resource . id . apply ( async ( id ) => {
156
+ resource . id . apply ( async ( id ) => {
154
157
if ( ! id ) return undefined ;
155
158
return await documentdb . listDatabaseAccountKeys ( {
156
159
accountName : name ,
@@ -162,7 +165,7 @@ export default async ({
162
165
//Database and Containers
163
166
if ( sqlDbs ) {
164
167
sqlDbs . forEach ( ( db ) => {
165
- const database = new documentdb . SqlResourceSqlDatabase (
168
+ new documentdb . SqlResourceSqlDatabase (
166
169
db . name ,
167
170
{
168
171
databaseName : db . name ,
@@ -184,7 +187,7 @@ export default async ({
184
187
resource : {
185
188
id : c . name ,
186
189
defaultTtl : c . ttl ,
187
- partitionKey : { paths : [ c . partitionKeyPath || " /id" ] } ,
190
+ partitionKey : { paths : [ c . partitionKeyPath || ' /id' ] } ,
188
191
} ,
189
192
} )
190
193
) ;
0 commit comments