@@ -3,186 +3,325 @@ private import bicep
3
3
module Databases {
4
4
/**
5
5
* Base class for all database resources in Azure.
6
+ * Provides common properties and methods for Azure database resources.
6
7
*/
7
8
abstract class DatabaseResource extends Resource {
8
9
/**
9
- * Returns the type of the database resource.
10
+ * Returns the type of the database resource (e.g., sql, postgresql, etc) .
10
11
*/
11
12
abstract string databaseType ( ) ;
12
13
14
+ /**
15
+ * Returns a string representation of the database resource.
16
+ */
13
17
override string toString ( ) { result = "DatabaseResource[" + this .databaseType ( ) + "]" }
14
18
19
+ /**
20
+ * Returns the properties object for the database resource.
21
+ */
15
22
DatabaseProperties:: Properties getProperties ( ) { result = this .getProperty ( "properties" ) }
16
23
24
+ /**
25
+ * Returns the version property of the database resource, if present.
26
+ */
17
27
string version ( ) {
18
28
result = this .getProperties ( ) .getProperty ( "version" ) .( StringLiteral ) .getValue ( )
19
29
}
20
30
31
+ /**
32
+ * Returns the sslEnforcement property of the database resource, if present.
33
+ */
21
34
string sslEnforcement ( ) {
22
35
result = this .getProperties ( ) .getProperty ( "sslEnforcement" ) .( StringLiteral ) .getValue ( )
23
36
}
24
37
38
+ /**
39
+ * Returns the infrastructureEncryption property of the database resource, if present.
40
+ */
25
41
string infrastructureEncryption ( ) {
26
42
result = this .getProperties ( ) .getProperty ( "infrastructureEncryption" ) .( StringLiteral ) .getValue ( )
27
43
}
28
44
45
+ /**
46
+ * Returns the minimalTlsVersion property of the database resource, if present.
47
+ */
29
48
string minimalTlsVersion ( ) {
30
49
result = this .getProperties ( ) .getProperty ( "minimalTlsVersion" ) .( StringLiteral ) .getValue ( )
31
50
}
32
51
52
+ /**
53
+ * Returns the storage profile for the database resource, if present.
54
+ */
33
55
DatabaseProperties:: StorageProfile getStorageProfile ( ) {
34
56
result = this .getProperties ( ) .getProperty ( "storageProfile" )
35
57
}
36
58
}
37
59
38
60
/**
39
- * Azure SQL Database/ Managed Instance
61
+ * Represents an Azure SQL Database or Managed Instance resource.
40
62
*/
41
63
class SqlServers extends DatabaseResource , Resource {
64
+ /**
65
+ * Constructs an instance for Azure SQL Database/Managed Instance resources.
66
+ */
42
67
SqlServers ( ) { this .getResourceType ( ) .regexpMatch ( "^Microsoft.Sql/servers@.*" ) }
43
68
69
+ /**
70
+ * Returns the type of the database resource ("sql").
71
+ */
44
72
override string databaseType ( ) { result = "sql" }
45
73
}
46
74
47
75
/**
48
- * Azure Cosmos DB
76
+ * Represents an Azure Cosmos DB account resource.
49
77
*/
50
78
class CosmosDBAccounts extends DatabaseResource , Resource {
79
+ /**
80
+ * Constructs an instance for Azure Cosmos DB account resources.
81
+ */
51
82
CosmosDBAccounts ( ) {
52
83
this .getResourceType ( ) .regexpMatch ( "^Microsoft.DocumentDB/databaseAccounts@.*" )
53
84
}
54
85
86
+ /**
87
+ * Returns the type of the database resource ("cosmosdb").
88
+ */
55
89
override string databaseType ( ) { result = "cosmosdb" }
56
90
91
+ /**
92
+ * Returns the databaseAccountOfferType property of the Cosmos DB account.
93
+ */
57
94
string databaseAccountOfferType ( ) {
58
95
result =
59
96
this .getProperties ( ) .getProperty ( "databaseAccountOfferType" ) .( StringLiteral ) .getValue ( )
60
97
}
61
98
99
+ /**
100
+ * Returns true if multiple write locations are enabled for the Cosmos DB account.
101
+ */
62
102
boolean isEnableMultipleWriteLocations ( ) {
63
103
result = this .getProperties ( ) .getProperty ( "enableMultipleWriteLocations" ) .( Boolean ) .getBool ( )
64
104
}
65
105
106
+ /**
107
+ * Returns the backup policy for the Cosmos DB account.
108
+ */
66
109
DatabaseProperties:: BackupPolicy getBackupPolicy ( ) {
67
110
result = this .getProperties ( ) .getProperty ( "backupPolicy" )
68
111
}
69
112
}
70
113
71
114
/**
72
- * Azure Database for PostgreSQL
115
+ * Represents an Azure Database for PostgreSQL server resource.
73
116
*/
74
117
class PostgreSQLServers extends DatabaseResource , Resource {
118
+ /**
119
+ * Constructs an instance for Azure Database for PostgreSQL server resources.
120
+ */
75
121
PostgreSQLServers ( ) {
76
122
this .getResourceType ( ) .regexpMatch ( "^Microsoft.DBforPostgreSQL/servers@.*" )
77
123
}
78
124
125
+ /**
126
+ * Returns the type of the database resource ("postgresql").
127
+ */
79
128
override string databaseType ( ) { result = "postgresql" }
80
129
}
81
130
82
131
/**
83
- * Azure Database for MySQL
132
+ * Represents an Azure Database for MySQL server resource.
84
133
*/
85
134
class MySQLServers extends DatabaseResource , Resource {
135
+ /**
136
+ * Constructs an instance for Azure Database for MySQL server resources.
137
+ */
86
138
MySQLServers ( ) { this .getResourceType ( ) .regexpMatch ( "^Microsoft.DBforMySQL/servers@.*" ) }
87
139
140
+ /**
141
+ * Returns the type of the database resource ("mysql").
142
+ */
88
143
override string databaseType ( ) { result = "mysql" }
89
144
}
90
145
91
146
/**
92
- * Azure Database for MariaDB
147
+ * Represents an Azure Database for MariaDB server resource.
93
148
*/
94
149
class MariaDBServers extends DatabaseResource , Resource {
150
+ /**
151
+ * Constructs an instance for Azure Database for MariaDB server resources.
152
+ */
95
153
MariaDBServers ( ) { this .getResourceType ( ) .regexpMatch ( "^Microsoft.DBforMariaDB/servers@.*" ) }
96
154
155
+ /**
156
+ * Returns the type of the database resource ("mariadb").
157
+ */
97
158
override string databaseType ( ) { result = "mariadb" }
98
159
}
99
160
100
161
/**
101
- * Azure Data Lake Store Gen1
162
+ * Represents an Azure Data Lake Store Gen1 account resource.
102
163
*/
103
164
class DataLakeStoreAccounts extends DatabaseResource , Resource {
165
+ /**
166
+ * Constructs an instance for Azure Data Lake Store Gen1 account resources.
167
+ */
104
168
DataLakeStoreAccounts ( ) {
105
169
this .getResourceType ( ) .regexpMatch ( "^Microsoft.DataLakeStore/accounts@.*" )
106
170
}
107
171
172
+ /**
173
+ * Returns the type of the database resource ("datalakestore").
174
+ */
108
175
override string databaseType ( ) { result = "datalakestore" }
109
176
}
110
177
111
178
/**
112
- * Azure Cache for Redis
179
+ * Represents an Azure Cache for Redis resource.
113
180
*/
114
181
class RedisCaches extends DatabaseResource , Resource {
182
+ /**
183
+ * Constructs an instance for Azure Cache for Redis resources.
184
+ */
115
185
RedisCaches ( ) { this .getResourceType ( ) .regexpMatch ( "^Microsoft.Cache/Redis@.*" ) }
116
186
187
+ /**
188
+ * Returns the type of the database resource ("redis").
189
+ */
117
190
override string databaseType ( ) { result = "redis" }
118
191
}
119
192
120
193
/**
121
- * Azure Data Explorer (Kusto)
194
+ * Represents an Azure Data Explorer (Kusto) cluster resource.
122
195
*/
123
196
class KustoClusters extends DatabaseResource , Resource {
197
+ /**
198
+ * Constructs an instance for Azure Data Explorer (Kusto) cluster resources.
199
+ */
124
200
KustoClusters ( ) { this .getResourceType ( ) .regexpMatch ( "^Microsoft.Kusto/Clusters@.*" ) }
125
201
202
+ /**
203
+ * Returns the type of the database resource ("kusto").
204
+ */
126
205
override string databaseType ( ) { result = "kusto" }
127
206
}
128
207
129
208
/**
130
- * Azure Arc-enabled SQL Managed Instance
209
+ * Represents an Azure Arc-enabled SQL Managed Instance resource.
131
210
*/
132
211
class ArcSqlManagedInstances extends DatabaseResource , Resource {
212
+ /**
213
+ * Constructs an instance for Azure Arc-enabled SQL Managed Instance resources.
214
+ */
133
215
ArcSqlManagedInstances ( ) {
134
216
this .getResourceType ( ) .regexpMatch ( "^Microsoft.AzureArcData/sqlManagedInstances@.*" )
135
217
}
136
218
219
+ /**
220
+ * Returns the type of the database resource ("arc-sql-managed-instance").
221
+ */
137
222
override string databaseType ( ) { result = "arc-sql-managed-instance" }
138
223
}
139
224
140
225
module DatabaseProperties {
226
+ /**
227
+ * Represents the properties object for a database resource.
228
+ */
141
229
class Properties extends Object {
142
230
private Resource resource ;
143
231
232
+ /**
233
+ * Constructs a Properties object for the given resource.
234
+ */
144
235
Properties ( ) { this = resource .getProperty ( "properties" ) }
145
236
237
+ /**
238
+ * Returns the underlying resource for these properties.
239
+ */
146
240
Resource getResource ( ) { result = resource }
147
241
}
148
242
243
+ /**
244
+ * Represents the backup object within database properties.
245
+ */
149
246
class Backup extends Object {
150
247
private Properties properties ;
151
248
249
+ /**
250
+ * Constructs a Backup object for the given properties.
251
+ */
152
252
Backup ( ) { this = properties .getProperty ( "backup" ) }
153
253
254
+ /**
255
+ * Returns a string representation of the backup object.
256
+ */
154
257
string toString ( ) { result = "Backup" }
155
258
259
+ /**
260
+ * Returns the geoRedundantBackup property of the backup object.
261
+ */
156
262
string geoRedundantBackup ( ) {
157
263
result = this .getProperty ( "geoRedundantBackup" ) .( StringLiteral ) .getValue ( )
158
264
}
159
265
}
160
266
267
+ /**
268
+ * Represents the backup policy object within database properties.
269
+ */
161
270
class BackupPolicy extends Object {
162
271
private Properties properties ;
163
272
273
+ /**
274
+ * Constructs a BackupPolicy object for the given properties.
275
+ */
164
276
BackupPolicy ( ) { this = properties .getProperty ( "backupPolicy" ) }
165
277
278
+ /**
279
+ * Returns a string representation of the backup policy object.
280
+ */
166
281
string toString ( ) { result = "BackupPolicy" }
167
282
283
+ /**
284
+ * Returns the type of the backup policy.
285
+ */
168
286
string getBackupPolicyType ( ) { result = this .getProperty ( "type" ) .( StringLiteral ) .getValue ( ) }
169
287
288
+ /**
289
+ * Returns the backupRetentionDays property of the backup policy.
290
+ */
170
291
Expr getBackupRetentionDays ( ) { result = this .getProperty ( "backupRetentionDays" ) }
171
292
293
+ /**
294
+ * Returns the backupStorageRedundancy property of the backup policy.
295
+ */
172
296
Expr getBackupStorageRedundancy ( ) { result = this .getProperty ( "backupStorageRedundancy" ) }
173
297
}
174
298
299
+ /**
300
+ * Represents the storage profile object within database properties.
301
+ */
175
302
class StorageProfile extends Object {
176
303
private Properties properties ;
177
304
305
+ /**
306
+ * Constructs a StorageProfile object for the given properties.
307
+ */
178
308
StorageProfile ( ) { this = properties .getProperty ( "storageProfile" ) }
179
309
310
+ /**
311
+ * Returns a string representation of the storage profile object.
312
+ */
180
313
string toString ( ) { result = "StorageProfile" }
181
314
315
+ /**
316
+ * Returns the storageMB property of the storage profile.
317
+ */
182
318
int storageMB ( ) {
183
319
result = this .getProperty ( "storageMB" ) .( Number ) .getValue ( )
184
320
}
185
321
322
+ /**
323
+ * Returns the autoGrow property of the storage profile.
324
+ */
186
325
string autoGrow ( ) {
187
326
result = this .getProperty ( "autoGrow" ) .( StringLiteral ) .getValue ( )
188
327
}
0 commit comments