Skip to content

Commit eb31582

Browse files
committed
more api updates
1 parent 80ac015 commit eb31582

4 files changed

Lines changed: 14 additions & 14 deletions

File tree

internal/services/cosmos/common/conflict_resolution_policy.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
package common
55

66
import (
7+
"github.com/hashicorp/go-azure-helpers/lang/pointer"
78
"github.com/hashicorp/go-azure-sdk/resource-manager/cosmosdb/2025-04-15/cosmosdb"
8-
"github.com/hashicorp/terraform-provider-azurerm/utils"
99
)
1010

1111
func ExpandCosmosDbConflicResolutionPolicy(inputs []interface{}) *cosmosdb.ConflictResolutionPolicy {
@@ -20,11 +20,11 @@ func ExpandCosmosDbConflicResolutionPolicy(inputs []interface{}) *cosmosdb.Confl
2020
}
2121

2222
if conflictResolutionPath, ok := input["conflict_resolution_path"].(string); ok {
23-
conflict.ConflictResolutionPath = utils.String(conflictResolutionPath)
23+
conflict.ConflictResolutionPath = pointer.To(conflictResolutionPath)
2424
}
2525

2626
if conflictResolutionProcedure, ok := input["conflict_resolution_procedure"].(string); ok {
27-
conflict.ConflictResolutionProcedure = utils.String(conflictResolutionProcedure)
27+
conflict.ConflictResolutionProcedure = pointer.To(conflictResolutionProcedure)
2828
}
2929

3030
return conflict

internal/services/cosmos/common/cors_rule.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,9 @@ func ExpandCosmosCorsRule(input []interface{}) *[]cosmosdb.CorsPolicy {
9696
corsRuleAttr := attr.(map[string]interface{})
9797
corsRule := cosmosdb.CorsPolicy{}
9898
corsRule.AllowedOrigins = strings.Join(*utils.ExpandStringSlice(corsRuleAttr["allowed_origins"].([]interface{})), ",")
99-
corsRule.ExposedHeaders = utils.String(strings.Join(*utils.ExpandStringSlice(corsRuleAttr["exposed_headers"].([]interface{})), ","))
100-
corsRule.AllowedHeaders = utils.String(strings.Join(*utils.ExpandStringSlice(corsRuleAttr["allowed_headers"].([]interface{})), ","))
101-
corsRule.AllowedMethods = utils.String(strings.Join(*utils.ExpandStringSlice(corsRuleAttr["allowed_methods"].([]interface{})), ","))
99+
corsRule.ExposedHeaders = pointer.To(strings.Join(*utils.ExpandStringSlice(corsRuleAttr["exposed_headers"].([]interface{})), ","))
100+
corsRule.AllowedHeaders = pointer.To(strings.Join(*utils.ExpandStringSlice(corsRuleAttr["allowed_headers"].([]interface{})), ","))
101+
corsRule.AllowedMethods = pointer.To(strings.Join(*utils.ExpandStringSlice(corsRuleAttr["allowed_methods"].([]interface{})), ","))
102102

103103
if corsRuleAttr["max_age_in_seconds"].(int) != 0 {
104104
corsRule.MaxAgeInSeconds = utils.Int64(int64(corsRuleAttr["max_age_in_seconds"].(int)))

internal/services/cosmos/common/indexing_policy.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ import (
77
"fmt"
88
"strings"
99

10+
"github.com/hashicorp/go-azure-helpers/lang/pointer"
1011
"github.com/hashicorp/go-azure-sdk/resource-manager/cosmosdb/2025-04-15/cosmosdb"
1112
"github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk"
12-
"github.com/hashicorp/terraform-provider-azurerm/utils"
1313
)
1414

1515
func expandAzureRmCosmosDBIndexingPolicyIncludedPaths(input []interface{}) *[]cosmosdb.IncludedPath {
@@ -21,7 +21,7 @@ func expandAzureRmCosmosDBIndexingPolicyIncludedPaths(input []interface{}) *[]co
2121
for _, v := range input {
2222
includedPath := v.(map[string]interface{})
2323
path := cosmosdb.IncludedPath{
24-
Path: utils.String(includedPath["path"].(string)),
24+
Path: pointer.To(includedPath["path"].(string)),
2525
}
2626

2727
includedPaths = append(includedPaths, path)
@@ -39,7 +39,7 @@ func expandAzureRmCosmosDBIndexingPolicyExcludedPaths(input []interface{}) *[]co
3939
for _, v := range input {
4040
block := v.(map[string]interface{})
4141
paths = append(paths, cosmosdb.ExcludedPath{
42-
Path: utils.String(block["path"].(string)),
42+
Path: pointer.To(block["path"].(string)),
4343
})
4444
}
4545

@@ -57,7 +57,7 @@ func ExpandAzureRmCosmosDBIndexingPolicyCompositeIndexes(input []interface{}) *[
5757

5858
order := cosmosdb.CompositePathSortOrder(strings.ToLower(data["order"].(string)))
5959
index := cosmosdb.CompositePath{
60-
Path: utils.String(data["path"].(string)),
60+
Path: pointer.To(data["path"].(string)),
6161
Order: &order,
6262
}
6363
indexPairs = append(indexPairs, index)
@@ -85,7 +85,7 @@ func ExpandAzureRmCosmosDBIndexingPolicySpatialIndexes(input []interface{}) *[]c
8585
indexPair := i.(map[string]interface{})
8686
indexes = append(indexes, cosmosdb.SpatialSpec{
8787
Types: &spatialTypes,
88-
Path: utils.String(indexPair["path"].(string)),
88+
Path: pointer.To(indexPair["path"].(string)),
8989
})
9090
}
9191

internal/services/cosmos/common/ip_rules.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ package common
66
import (
77
"strings"
88

9+
"github.com/hashicorp/go-azure-helpers/lang/pointer"
910
"github.com/hashicorp/go-azure-sdk/resource-manager/cosmosdb/2025-04-15/cosmosdb"
10-
"github.com/hashicorp/terraform-provider-azurerm/utils"
1111
)
1212

1313
// CosmosDBIpRulesToIpRangeFilterDataSource todo Remove for 4.0
@@ -37,7 +37,7 @@ func CosmosDBIpRangeFilterToIpRules(ipRangeFilter []string) *[]cosmosdb.IPAddres
3737
ipRules := make([]cosmosdb.IPAddressOrRange, 0)
3838
for _, ipRange := range ipRangeFilter {
3939
ipRules = append(ipRules, cosmosdb.IPAddressOrRange{
40-
IPAddressOrRange: utils.String(ipRange),
40+
IPAddressOrRange: pointer.To(ipRange),
4141
})
4242
}
4343

@@ -50,7 +50,7 @@ func CosmosDBIpRangeFilterToIpRulesThreePointOh(ipRangeFilter string) *[]cosmosd
5050
if len(ipRangeFilter) > 0 {
5151
for _, ipRange := range strings.Split(ipRangeFilter, ",") {
5252
ipRules = append(ipRules, cosmosdb.IPAddressOrRange{
53-
IPAddressOrRange: utils.String(ipRange),
53+
IPAddressOrRange: pointer.To(ipRange),
5454
})
5555
}
5656
}

0 commit comments

Comments
 (0)