From a470c69b35de1931c62b2d35ddb7e6ce6c5aa0d2 Mon Sep 17 00:00:00 2001 From: Karan Popat Date: Mon, 3 Apr 2023 17:45:12 +0530 Subject: [PATCH] Fix error on fetching throughput settings --- azure/table_azure_cosmosdb_mongo_collection.go | 10 ++++++---- azure/table_azure_cosmosdb_mongo_database.go | 10 ++++++---- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/azure/table_azure_cosmosdb_mongo_collection.go b/azure/table_azure_cosmosdb_mongo_collection.go index 581fbd88..8a561fa0 100644 --- a/azure/table_azure_cosmosdb_mongo_collection.go +++ b/azure/table_azure_cosmosdb_mongo_collection.go @@ -341,10 +341,12 @@ func mapCollectionThroughputSettings(result documentdb.ThroughputSettingsGetResu data.AutoscaleSettingsMaxThroughput = *result.Resource.AutoscaleSettings.MaxThroughput } - if result.Resource.AutoscaleSettings.AutoUpgradePolicy.ThroughputPolicy != nil { - data.AutoscaleSettingsThroughputPolicy = documentdb.ThroughputPolicyResource{ - IsEnabled: result.Resource.AutoscaleSettings.AutoUpgradePolicy.ThroughputPolicy.IsEnabled, - IncrementPercent: result.Resource.AutoscaleSettings.AutoUpgradePolicy.ThroughputPolicy.IncrementPercent, + if result.Resource.AutoscaleSettings.AutoUpgradePolicy != nil { + if result.Resource.AutoscaleSettings.AutoUpgradePolicy.ThroughputPolicy != nil { + data.AutoscaleSettingsThroughputPolicy = documentdb.ThroughputPolicyResource{ + IsEnabled: result.Resource.AutoscaleSettings.AutoUpgradePolicy.ThroughputPolicy.IsEnabled, + IncrementPercent: result.Resource.AutoscaleSettings.AutoUpgradePolicy.ThroughputPolicy.IncrementPercent, + } } } diff --git a/azure/table_azure_cosmosdb_mongo_database.go b/azure/table_azure_cosmosdb_mongo_database.go index 83ff66b0..688d5b91 100644 --- a/azure/table_azure_cosmosdb_mongo_database.go +++ b/azure/table_azure_cosmosdb_mongo_database.go @@ -288,10 +288,12 @@ func mapThroughputSettings(result documentdb.ThroughputSettingsGetResults) *Thro data.AutoscaleSettingsMaxThroughput = *result.Resource.AutoscaleSettings.MaxThroughput } - if result.Resource.AutoscaleSettings.AutoUpgradePolicy.ThroughputPolicy != nil { - data.AutoscaleSettingsThroughputPolicy = documentdb.ThroughputPolicyResource{ - IsEnabled: result.Resource.AutoscaleSettings.AutoUpgradePolicy.ThroughputPolicy.IsEnabled, - IncrementPercent: result.Resource.AutoscaleSettings.AutoUpgradePolicy.ThroughputPolicy.IncrementPercent, + if result.Resource.AutoscaleSettings.AutoUpgradePolicy != nil { + if result.Resource.AutoscaleSettings.AutoUpgradePolicy.ThroughputPolicy != nil { + data.AutoscaleSettingsThroughputPolicy = documentdb.ThroughputPolicyResource{ + IsEnabled: result.Resource.AutoscaleSettings.AutoUpgradePolicy.ThroughputPolicy.IsEnabled, + IncrementPercent: result.Resource.AutoscaleSettings.AutoUpgradePolicy.ThroughputPolicy.IncrementPercent, + } } }