-
Notifications
You must be signed in to change notification settings - Fork 454
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Modules] Added CosmosDB Gremlin API & updated mongodb to current ver…
…sion (#1638) * [Modules] Added CosmosDB Gremlin API and updated mongodb to… (#1566) * feat(document-db): Added CosmosDB Gremlin API and updated mongodb to current version * docs(graphs): Updated readme.md * feat(document-db): Added backupPolicy, updated docs * Update arm/Microsoft.DocumentDB/databaseAccounts/deploy.bicep Co-authored-by: Alexander Sehr <[email protected]> * feat(gremlin-databases): Added tests and small bugfixes * feat(gremlin): Updated tests, pipeline, parameters * refactor(test): Changed .parameters to .test Co-authored-by: Alexander Sehr <[email protected]> * Minor updates * Adjusted telemetry * Additional small updates * Updated docs * Applied several fixes * Updated throughput logic Co-authored-by: Jan-Henrik Damaschke <[email protected]>
- Loading branch information
1 parent
b0505a6
commit 86678e9
Showing
12 changed files
with
938 additions
and
24 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
101 changes: 101 additions & 0 deletions
101
modules/Microsoft.DocumentDB/databaseAccounts/.test/gremlindb.parameters.json
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,101 @@ | ||
{ | ||
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentParameters.json#", | ||
"contentVersion": "1.0.0.0", | ||
"parameters": { | ||
"name": { | ||
"value": "<<namePrefix>>-az-cdb-gremlindb-001" | ||
}, | ||
"location": { | ||
"value": "West Europe" | ||
}, | ||
"locations": { | ||
"value": [ | ||
{ | ||
"locationName": "West Europe", | ||
"failoverPriority": 0, | ||
"isZoneRedundant": false | ||
}, | ||
{ | ||
"locationName": "North Europe", | ||
"failoverPriority": 1, | ||
"isZoneRedundant": false | ||
} | ||
] | ||
}, | ||
"capabilitiesToAdd": { | ||
"value": [ | ||
"EnableGremlin" | ||
] | ||
}, | ||
"roleAssignments": { | ||
"value": [ | ||
{ | ||
"roleDefinitionIdOrName": "Reader", | ||
"principalIds": [ | ||
"<<deploymentSpId>>" | ||
] | ||
} | ||
] | ||
}, | ||
"gremlinDatabases": { | ||
"value": [ | ||
{ | ||
"name": "<<namePrefix>>-az-gdb-x-001", | ||
"graphs": [ | ||
{ | ||
"name": "car_collection", | ||
"automaticIndexing": true, | ||
"partitionKeyPaths": [ | ||
"/car_id" | ||
] | ||
}, | ||
{ | ||
"name": "truck_collection", | ||
"automaticIndexing": true, | ||
"partitionKeyPaths": [ | ||
"/truck_id" | ||
] | ||
} | ||
] | ||
}, | ||
{ | ||
"name": "<<namePrefix>>-az-gdb-x-002", | ||
"collections": [ | ||
{ | ||
"name": "bike_collection", | ||
"automaticIndexing": true, | ||
"partitionKeyPaths": [ | ||
"/bike_id" | ||
] | ||
}, | ||
{ | ||
"name": "bicycle_collection", | ||
"automaticIndexing": true, | ||
"partitionKeyPaths": [ | ||
"/bicycle_id" | ||
] | ||
} | ||
] | ||
} | ||
] | ||
}, | ||
"diagnosticLogsRetentionInDays": { | ||
"value": 7 | ||
}, | ||
"diagnosticStorageAccountId": { | ||
"value": "/subscriptions/<<subscriptionId>>/resourceGroups/validation-rg/providers/Microsoft.Storage/storageAccounts/adp<<namePrefix>>azsax001" | ||
}, | ||
"diagnosticWorkspaceId": { | ||
"value": "/subscriptions/<<subscriptionId>>/resourcegroups/validation-rg/providers/microsoft.operationalinsights/workspaces/adp-<<namePrefix>>-az-law-x-001" | ||
}, | ||
"diagnosticEventHubAuthorizationRuleId": { | ||
"value": "/subscriptions/<<subscriptionId>>/resourceGroups/validation-rg/providers/Microsoft.EventHub/namespaces/adp-<<namePrefix>>-az-evhns-x-001/AuthorizationRules/RootManageSharedAccessKey" | ||
}, | ||
"diagnosticEventHubName": { | ||
"value": "adp-<<namePrefix>>-az-evh-x-001" | ||
}, | ||
"systemAssignedIdentity": { | ||
"value": true | ||
} | ||
} | ||
} |
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
92 changes: 92 additions & 0 deletions
92
modules/Microsoft.DocumentDB/databaseAccounts/gremlinDatabases/deploy.bicep
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,92 @@ | ||
@description('Required. Name of the Gremlin database.') | ||
param name string | ||
|
||
@description('Optional. Tags of the Gremlin database resource.') | ||
param tags object = {} | ||
|
||
@description('Optional. Enables system assigned managed identity on the resource.') | ||
param systemAssignedIdentity bool = false | ||
|
||
@description('Optional. The ID(s) to assign to the resource.') | ||
param userAssignedIdentities object = {} | ||
|
||
@description('Conditional. The name of the parent Gremlin database. Required if the template is used in a standalone deployment.') | ||
param databaseAccountName string | ||
|
||
@description('Optional. Array of graphs to deploy in the Gremlin database.') | ||
param graphs array = [] | ||
|
||
@description('Optional. Represents maximum throughput, the resource can scale up to. Cannot be set together with `throughput`. If `throughput` is set to something else than -1, this autoscale setting is ignored.') | ||
param maxThroughput int = 4000 | ||
|
||
@description('Optional. Request Units per second (for example 10000). Cannot be set together with `maxThroughput`.') | ||
param throughput int = -1 | ||
|
||
@description('Optional. Enable telemetry via the Customer Usage Attribution ID (GUID).') | ||
param enableDefaultTelemetry bool = true | ||
|
||
var enableReferencedModulesTelemetry = false | ||
|
||
var identityType = systemAssignedIdentity ? (!empty(userAssignedIdentities) ? 'SystemAssigned, UserAssigned' : 'SystemAssigned') : (!empty(userAssignedIdentities) ? 'UserAssigned' : 'None') | ||
|
||
var identity = identityType != 'None' ? { | ||
type: identityType | ||
userAssignedIdentities: !empty(userAssignedIdentities) ? userAssignedIdentities : null | ||
} : null | ||
|
||
resource defaultTelemetry 'Microsoft.Resources/deployments@2021-04-01' = if (enableDefaultTelemetry) { | ||
name: 'pid-47ed15a6-730a-4827-bcb4-0fd963ffbd82-${uniqueString(deployment().name)}' | ||
properties: { | ||
mode: 'Incremental' | ||
template: { | ||
'$schema': 'https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#' | ||
contentVersion: '1.0.0.0' | ||
resources: [] | ||
} | ||
} | ||
} | ||
|
||
resource databaseAccount 'Microsoft.DocumentDB/databaseAccounts@2022-02-15-preview' existing = { | ||
name: databaseAccountName | ||
} | ||
|
||
var databaseOptions = contains(databaseAccount.properties.capabilities, 'EnableServerless') ? {} : { | ||
autoscaleSettings: throughput == -1 ? { | ||
maxThroughput: maxThroughput | ||
} : null | ||
throughput: throughput != -1 ? throughput : null | ||
} | ||
|
||
resource gremlinDatabase 'Microsoft.DocumentDB/databaseAccounts/gremlinDatabases@2022-02-15-preview' = { | ||
name: name | ||
tags: tags | ||
parent: databaseAccount | ||
identity: identity | ||
properties: { | ||
options: databaseOptions | ||
resource: { | ||
id: name | ||
} | ||
} | ||
} | ||
|
||
module gremlinDatabase_gremlinGraphs 'graphs/deploy.bicep' = [for graph in graphs: { | ||
name: '${uniqueString(deployment().name, gremlinDatabase.name)}-gremlindb-${graph.name}' | ||
params: { | ||
name: graph.name | ||
gremlinDatabaseName: name | ||
databaseAccountName: databaseAccountName | ||
enableDefaultTelemetry: enableReferencedModulesTelemetry | ||
automaticIndexing: contains(graph, 'automaticIndexing') ? graph.automaticIndexing : true | ||
partitionKeyPaths: !empty(graph.partitionKeyPaths) ? graph.partitionKeyPaths : [] | ||
} | ||
}] | ||
|
||
@description('The name of the Gremlin database.') | ||
output name string = gremlinDatabase.name | ||
|
||
@description('The resource ID of the Gremlin database.') | ||
output resourceId string = gremlinDatabase.id | ||
|
||
@description('The name of the resource group the Gremlin database was created in.') | ||
output resourceGroupName string = resourceGroup().name |
Oops, something went wrong.