-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
19 changed files
with
886 additions
and
156 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,182 +1,75 @@ | ||
targetScope = 'resourceGroup' | ||
|
||
@minLength(1) | ||
@description('The name of the test container to create') | ||
param containerName string = 'Movies' | ||
@secure() | ||
@description('The password for the administrator') | ||
param administratorPassword string | ||
|
||
@minLength(1) | ||
@description('The name of the test database to create') | ||
param databaseName string = 'unittests' | ||
@description('The username for the administrator') | ||
param administratorUsername string = 'tester' | ||
|
||
@description('The list of firewall rules to install') | ||
param firewallRules FirewallRule[] = [ | ||
{ startIpAddress: '0.0.0.0', endIpAddress: '0.0.0.0' } | ||
] | ||
|
||
@minLength(1) | ||
@description('Primary location for all resources') | ||
param location string = resourceGroup().location | ||
|
||
@allowed(['3.2', '3.6', '4.0', '4.2']) | ||
@description('Specifies the MongoDB server version to use.') | ||
param mongoVersion string = '4.2' | ||
|
||
@description('The name of the Mongo Server to create.') | ||
param serverName string | ||
|
||
@description('The list of tags to apply to all resources.') | ||
param tags object = {} | ||
|
||
/*********************************************************************************/ | ||
|
||
var compositeIndices = [ | ||
[ | ||
{ path: '/BestPictureWinner', order: 'ascending' } | ||
{ path: '/id', order: 'ascending' } | ||
] | ||
[ | ||
{ path: '/BestPictureWinner', order: 'descending' } | ||
{ path: '/id', order: 'ascending' } | ||
] | ||
[ | ||
{ path: '/Duration', order: 'ascending' } | ||
{ path: '/id', order: 'ascending' } | ||
] | ||
[ | ||
{ path: '/Duration', order: 'descending' } | ||
{ path: '/id', order: 'ascending' } | ||
] | ||
[ | ||
{ path: '/Rating', order: 'ascending' } | ||
{ path: '/id', order: 'ascending' } | ||
] | ||
[ | ||
{ path: '/Rating', order: 'descending' } | ||
{ path: '/id', order: 'ascending' } | ||
] | ||
[ | ||
{ path: '/ReleaseDate', order: 'ascending' } | ||
{ path: '/id', order: 'ascending' } | ||
] | ||
[ | ||
{ path: '/ReleaseDate', order: 'descending' } | ||
{ path: '/id', order: 'ascending' } | ||
] | ||
[ | ||
{ path: '/Title', order: 'ascending' } | ||
{ path: '/id', order: 'ascending' } | ||
] | ||
[ | ||
{ path: '/Title', order: 'descending' } | ||
{ path: '/id', order: 'ascending' } | ||
] | ||
[ | ||
{ path: '/UpdatedAt', order: 'ascending' } | ||
{ path: '/id', order: 'ascending' } | ||
] | ||
[ | ||
{ path: '/UpdatedAt', order: 'descending' } | ||
{ path: '/id', order: 'ascending' } | ||
] | ||
[ | ||
{ path: '/Year', order: 'ascending' } | ||
{ path: '/id', order: 'ascending' } | ||
] | ||
[ | ||
{ path: '/Year', order: 'descending' } | ||
{ path: '/id', order: 'ascending' } | ||
] | ||
[ | ||
{ path: '/Year', order: 'ascending' } | ||
{ path: '/Title', order: 'ascending' } | ||
{ path: '/id', order: 'ascending' } | ||
] | ||
[ | ||
{ path: '/Year', order: 'descending' } | ||
{ path: '/Title', order: 'ascending' } | ||
{ path: '/id', order: 'ascending' } | ||
] | ||
[ | ||
{ path: '/Year', order: 'ascending' } | ||
{ path: '/Title', order: 'descending' } | ||
{ path: '/id', order: 'ascending' } | ||
] | ||
[ | ||
{ path: '/Year', order: 'descending' } | ||
{ path: '/Title', order: 'descending' } | ||
{ path: '/id', order: 'ascending' } | ||
] | ||
] | ||
@description('The tier to use for compute') | ||
@allowed([ 'Free', 'M10', 'M20', 'M25', 'M30', 'M40', 'M50', 'M60', 'M80', 'M200', 'M200-Autoscale']) | ||
param tier string = 'M10' | ||
|
||
/*********************************************************************************/ | ||
|
||
resource account 'Microsoft.DocumentDB/databaseAccounts@2022-05-15' = { | ||
resource cluster 'Microsoft.DocumentDB/mongoClusters@2024-07-01' = { | ||
name: toLower(serverName) | ||
location: location | ||
kind: 'MongoDB' | ||
tags: tags | ||
properties: { | ||
apiProperties: { | ||
serverVersion: mongoVersion | ||
administrator: { | ||
userName: administratorUsername | ||
password: administratorPassword | ||
} | ||
capabilities: [ | ||
{ | ||
name: 'DisableRateLimitingResponses' | ||
} | ||
] | ||
consistencyPolicy: { | ||
defaultConsistencyLevel: 'Session' | ||
compute: { tier: tier } | ||
highAvailability: { | ||
targetMode: 'Disabled' | ||
} | ||
databaseAccountOfferType: 'Standard' | ||
disableLocalAuth: false | ||
locations: [ | ||
{ | ||
locationName: location | ||
isZoneRedundant: false | ||
} | ||
] | ||
} | ||
} | ||
|
||
resource database 'Microsoft.DocumentDB/databaseAccounts/mongodbDatabases@2022-05-15' = { | ||
parent: account | ||
name: databaseName | ||
tags: tags | ||
properties: { | ||
resource: { | ||
id: databaseName | ||
} | ||
options: { | ||
throughput: 400 | ||
publicNetworkAccess: 'Enabled' | ||
serverVersion: '7.0' | ||
sharding: { | ||
shardCount: 1 | ||
} | ||
storage: { sizeGb: 32 } | ||
} | ||
} | ||
|
||
resource collection 'Microsoft.DocumentDb/databaseAccounts/mongodbDatabases/collections@2022-05-15' = { | ||
parent: database | ||
name: containerName | ||
tags: tags | ||
properties: { | ||
resource: { | ||
id: containerName | ||
shardKey: { | ||
_id: 'Hash' | ||
} | ||
indexes: [ | ||
{ | ||
key: { | ||
keys: [ | ||
'_id' | ||
] | ||
} | ||
} | ||
{ | ||
key: { | ||
keys: [ | ||
'$**' | ||
] | ||
} | ||
} | ||
] | ||
resource mongoFirewallRule 'Microsoft.DocumentDB/mongoClusters/firewallRules@2024-07-01' = [ | ||
for (fwRule, index) in firewallRules: { | ||
name: fwRule.?name ?? 'rule-${index}' | ||
parent: cluster | ||
properties: { | ||
startIpAddress: fwRule.startIpAddress | ||
endIpAddress: fwRule.endIpAddress | ||
} | ||
} | ||
} | ||
] | ||
|
||
/*********************************************************************************/ | ||
|
||
#disable-next-line outputs-should-not-contain-secrets | ||
output MONGODB_CONNECTIONSTRING string = account.listConnectionStrings().connectionStrings[1].connectionString | ||
output MONGO_CONNECTIONSTRING string = replace(replace(cluster.listConnectionStrings().connectionStrings[0].connectionString, '<user>', administratorUsername), '<password>', administratorPassword) | ||
|
||
/*********************************************************************************/ | ||
|
||
type FirewallRule = { | ||
name: string? | ||
startIpAddress: string | ||
endIpAddress: string | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
src/CommunityToolkit.Datasync.Server.MongoDB/CommunityToolkit.Datasync.Server.MongoDB.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
<PropertyGroup> | ||
<Description>A repository for the server-side of the Datasync Toolkit that uses MongoDB for storage.</Description> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<InternalsVisibleTo Include="CommunityToolkit.Datasync.Server.Test" /> | ||
<InternalsVisibleTo Include="CommunityToolkit.Datasync.Server.MongoDB.Test" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="MongoDB.Driver" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\CommunityToolkit.Datasync.Server.Abstractions\CommunityToolkit.Datasync.Server.Abstractions.csproj" /> | ||
</ItemGroup> | ||
</Project> |
Oops, something went wrong.