Azure / Azure/azure-rest-api-specs
[BUG] Microsoft.DocumentDB - lack of property autoscaleSettings in GET of mongodbDatabases
- Dominant language
- TypeSpec
- Stars
- 3.1k
- Forks
- 5.9k
- Avg merge
- 3d 37m
- Merged PRs (30d)
- 446
Description
### API Spec link
https://github.com/Azure/azure-rest-api-specs/blob/main/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-08-15/cosmos-db.json
### API Spec version
2024-08-15, 2024-02-15-preview
### Describe the bug
In a [ARM template (Bicep)](https://learn.microsoft.com/en-us/azure/templates/microsoft.documentdb/databaseaccounts/mongodbdatabases?pivots=deployment-language-arm-template#resource-format-1) of Microsoft.DocumentDB/databaseAccounts/mongodbDatabases
``` json
{
"type": "Microsoft.DocumentDB/databaseAccounts/mongodbDatabases",
"apiVersion": "2024-05-15",
"name": "string",
"location": "string",
...
"properties": {
"options": {
"autoscaleSettings": {
"maxThroughput": "int"
},
"throughput": "int"
},
"resource": {
"createMode": "string",
"id": "string",
...
}
}
}
```
points out that `CreateUpdateOptionsOrMongoDBDatabaseGetPropertiesOptions` is a part of the template, so in GET request it may be in a response, but in `az rest` and `az cosmosdb mongodb database show` response is not.
Example [CosmosDBMongoDBDatabaseGet.json](https://github.com/Azure/azure-rest-api-specs/blob/main/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-08-15/examples/CosmosDBMongoDBDatabaseGet.json) has a response with main properties of the resource without `CreateUpdateOptionsOrMongoDBDatabaseGetPropertiesOptions`. In [Cosmos DB REST API - Get a Database](https://learn.microsoft.com/en-us/rest/api/cosmos-db/get-a-database?view=rest-policy-2023-04-01#body-1) it's the same.
In my case I struggle with [What-If operation](https://learn.microsoft.com/en-us/azure/azure-resource-manager/bicep/deploy-what-if) response showing me lack of `autoscaleSettings.maxThroughput` in Azure, where it's set and valid. I assume [arm-template-whatif](https://github.com/Azure/arm-template-whatif) receives information from Azure REST API and compares it with my generated ARM template (Bicep).
Should `CreateUpdateOptionsOrMongoDBDatabaseGetPropertiesOptions` be a part of GET mongoDB database? Or could you guide me to the root cause?
I know that there is a separate `Microsoft.DocumentDB/databaseAccounts/mongodbDatabases/mongodbCollections/throughputSettings` extension resource with adequate example [CosmosDBMongoDBCollectionThroughputGet.json](https://github.com/Azure/azure-rest-api-specs/blob/main/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-08-15/examples/CosmosDBMongoDBDatabaseThroughputGet.json). In my case I tried use it, but without good result.
### Expected behavior
``` json
{
"id": "/subscriptions/aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb/resourceGroups/my-rg/providers/Microsoft.DocumentDB/databaseAccounts/my-cosmos-account/mongodbDatabases/my-mongo-db",
"name": "my-mongo-db",
"properties": {
"options": {
"autoscaleSettings": {
"maxThroughput": 1000
}
},
"resource": {
"id": "my-mongo-db"
}
},
"type": "Microsoft.DocumentDB/databaseAccounts/mongodbDatabases"
}
```
### Actual behavior
``` json
{
"id": "/subscriptions/aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb/resourceGroups/my-rg/providers/Microsoft.DocumentDB/databaseAccounts/my-cosmos-account/mongodbDatabases/my-mongo-db",
"name": "my-mongo-db",
"properties": {
"resource": {
"id": "my-mongo-db"
}
},
"type": "Microsoft.DocumentDB/databaseAccounts/mongodbDatabases"
}
```
### Reproduction Steps
```sh
az cosmosdb mongodb database show --resource-group 'my-rg' --name 'my-mongo-db' --account-name 'my-cosmos-account'
```
||
`az rest --method get --header "Accept=application/json" --url 'https://management.azure.com/subscriptions/aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb/resourceGroups/my-rg/providers/Microsoft.DocumentDB/databaseAccounts/my-cosmos-account/mongodbDatabases/my-mongo-db?api-version=2024-08-15'`
||
GET `https://management.azure.com/subscriptions/aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb/resourceGroups/my-rg/providers/Microsoft.DocumentDB/databaseAccounts/my-cosmos-account/mongodbDatabases/my-mongo-db?api-version=2024-08-15`
### Environment
_No response_
Contributor guide
Assessment
This issue has not been assessed yet.