Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade MySQL API version from 2022-11-01 to 2023-12-30 #27767

Merged
merged 1 commit into from
Oct 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions internal/services/mysql/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,22 @@ package client
import (
"fmt"

flexibleServers_v2022_01_01 "github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2022-01-01"
"github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2022-01-01/azureadadministrators"
flexibleServers_v2023_12_30 "github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2023-12-30"
"github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2023-12-30/azureadadministrators"
"github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager"

"github.com/hashicorp/terraform-provider-azurerm/internal/common"
)

type Client struct {
FlexibleServers *flexibleServers_v2022_01_01.Client
FlexibleServers *flexibleServers_v2023_12_30.Client

// TODO: port over to using the Meta Client (which involves bumping the API Version)
AzureADAdministratorsClient *azureadadministrators.AzureADAdministratorsClient
}

func NewClient(o *common.ClientOptions) (*Client, error) {
flexibleServersMetaClient, err := flexibleServers_v2022_01_01.NewClientWithBaseURI(o.Environment.ResourceManager, func(c *resourcemanager.Client) {
flexibleServersMetaClient, err := flexibleServers_v2023_12_30.NewClientWithBaseURI(o.Environment.ResourceManager, func(c *resourcemanager.Client) {
o.Configure(c, o.Authorizers.ResourceManager)
})
if err != nil {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"github.com/hashicorp/go-azure-helpers/lang/pointer"
"github.com/hashicorp/go-azure-helpers/lang/response"
"github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema"
"github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2022-01-01/databases"
"github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2023-12-30/databases"
"github.com/hashicorp/terraform-provider-azurerm/helpers/tf"
"github.com/hashicorp/terraform-provider-azurerm/internal/clients"
"github.com/hashicorp/terraform-provider-azurerm/internal/services/mysql/validate"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"fmt"
"testing"

"github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2022-01-01/databases"
"github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2023-12-30/databases"
"github.com/hashicorp/terraform-provider-azurerm/internal/acceptance"
"github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check"
"github.com/hashicorp/terraform-provider-azurerm/internal/clients"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
"github.com/hashicorp/go-azure-helpers/lang/pointer"
"github.com/hashicorp/go-azure-helpers/lang/response"
"github.com/hashicorp/go-azure-helpers/resourcemanager/commonids"
"github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2022-01-01/azureadadministrators"
"github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2023-12-30/azureadadministrators"
"github.com/hashicorp/terraform-provider-azurerm/internal/sdk"
"github.com/hashicorp/terraform-provider-azurerm/internal/services/mysql/parse"
"github.com/hashicorp/terraform-provider-azurerm/internal/services/mysql/validate"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"testing"

"github.com/hashicorp/go-azure-helpers/lang/response"
"github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2022-01-01/azureadadministrators"
"github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2023-12-30/azureadadministrators"
"github.com/hashicorp/terraform-provider-azurerm/internal/acceptance"
"github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check"
"github.com/hashicorp/terraform-provider-azurerm/internal/clients"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
"github.com/hashicorp/go-azure-helpers/lang/pointer"
"github.com/hashicorp/go-azure-helpers/lang/response"
"github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema"
"github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2022-01-01/configurations"
"github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2023-12-30/configurations"
"github.com/hashicorp/terraform-provider-azurerm/internal/clients"
"github.com/hashicorp/terraform-provider-azurerm/internal/locks"
"github.com/hashicorp/terraform-provider-azurerm/internal/services/mysql/validate"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import (
"time"

"github.com/hashicorp/go-azure-helpers/lang/response"
"github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2022-01-01/configurations"
"github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2022-01-01/servers"
"github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2023-12-30/configurations"
"github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2023-12-30/servers"
"github.com/hashicorp/terraform-provider-azurerm/internal/acceptance"
"github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check"
"github.com/hashicorp/terraform-provider-azurerm/internal/clients"
Expand Down
10 changes: 5 additions & 5 deletions internal/services/mysql/mysql_flexible_server_data_source.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
"github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema"
"github.com/hashicorp/go-azure-helpers/resourcemanager/location"
"github.com/hashicorp/go-azure-helpers/resourcemanager/tags"
"github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2022-01-01/servers"
"github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2023-12-30/servers"
"github.com/hashicorp/terraform-provider-azurerm/internal/clients"
"github.com/hashicorp/terraform-provider-azurerm/internal/services/mysql/validate"
"github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk"
Expand Down Expand Up @@ -264,18 +264,18 @@ func flattenDataSourceArmServerStorage(storage *servers.Storage) []interface{} {
}
}

func flattenDataSourceFlexibleServerSku(sku *servers.Sku) (string, error) {
func flattenDataSourceFlexibleServerSku(sku *servers.MySQLServerSku) (string, error) {
if sku == nil || sku.Name == "" || sku.Tier == "" {
return "", nil
}

var tier string
switch sku.Tier {
case servers.SkuTierBurstable:
case servers.ServerSkuTierBurstable:
tier = "B"
case servers.SkuTierGeneralPurpose:
case servers.ServerSkuTierGeneralPurpose:
tier = "GP"
case servers.SkuTierMemoryOptimized:
case servers.ServerSkuTierMemoryOptimized:
tier = "MO"
default:
return "", fmt.Errorf("sku_name has unknown sku tier %s", sku.Tier)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (

"github.com/hashicorp/go-azure-helpers/lang/response"
"github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema"
"github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2022-01-01/firewallrules"
"github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2023-12-30/firewallrules"
"github.com/hashicorp/terraform-provider-azurerm/helpers/tf"
azValidate "github.com/hashicorp/terraform-provider-azurerm/helpers/validate"
"github.com/hashicorp/terraform-provider-azurerm/internal/clients"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"fmt"
"testing"

"github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2022-01-01/firewallrules"
"github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2023-12-30/firewallrules"
"github.com/hashicorp/terraform-provider-azurerm/internal/acceptance"
"github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check"
"github.com/hashicorp/terraform-provider-azurerm/internal/clients"
Expand Down
30 changes: 15 additions & 15 deletions internal/services/mysql/mysql_flexible_server_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ import (
"github.com/hashicorp/go-azure-helpers/resourcemanager/identity"
"github.com/hashicorp/go-azure-helpers/resourcemanager/location"
"github.com/hashicorp/go-azure-helpers/resourcemanager/tags"
"github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2022-01-01/serverfailover"
"github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2022-01-01/servers"
"github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2023-12-30/serverfailover"
"github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2023-12-30/servers"
"github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2020-06-01/privatezones"
"github.com/hashicorp/terraform-provider-azurerm/helpers/tf"
"github.com/hashicorp/terraform-provider-azurerm/internal/clients"
Expand Down Expand Up @@ -847,42 +847,42 @@ func expandArmServerBackup(d *pluginsdk.ResourceData) *servers.Backup {
return &backup
}

func expandFlexibleServerSku(name string) (*servers.Sku, error) {
func expandFlexibleServerSku(name string) (*servers.MySQLServerSku, error) {
if name == "" {
return nil, nil
}
parts := strings.SplitAfterN(name, "_", 2)

var tier servers.SkuTier
var tier servers.ServerSkuTier
switch strings.TrimSuffix(parts[0], "_") {
case "B":
tier = servers.SkuTierBurstable
tier = servers.ServerSkuTierBurstable
case "GP":
tier = servers.SkuTierGeneralPurpose
tier = servers.ServerSkuTierGeneralPurpose
case "MO":
tier = servers.SkuTierMemoryOptimized
tier = servers.ServerSkuTierMemoryOptimized
default:
return nil, fmt.Errorf("sku_name %s has unknown sku tier %s", name, parts[0])
}

return &servers.Sku{
return &servers.MySQLServerSku{
Name: parts[1],
Tier: tier,
}, nil
}

func flattenFlexibleServerSku(sku *servers.Sku) (string, error) {
func flattenFlexibleServerSku(sku *servers.MySQLServerSku) (string, error) {
if sku == nil || sku.Name == "" || sku.Tier == "" {
return "", nil
}

var tier string
switch sku.Tier {
case servers.SkuTierBurstable:
case servers.ServerSkuTierBurstable:
tier = "B"
case servers.SkuTierGeneralPurpose:
case servers.ServerSkuTierGeneralPurpose:
tier = "GP"
case servers.SkuTierMemoryOptimized:
case servers.ServerSkuTierMemoryOptimized:
tier = "MO"
default:
return "", fmt.Errorf("sku_name has unknown sku tier %s", sku.Tier)
Expand Down Expand Up @@ -1028,14 +1028,14 @@ func flattenFlexibleServerDataEncryption(de *servers.DataEncryption) ([]interfac
return []interface{}{item}, nil
}

func expandFlexibleServerIdentity(input []interface{}) (*servers.Identity, error) {
func expandFlexibleServerIdentity(input []interface{}) (*servers.MySQLServerIdentity, error) {
expanded, err := identity.ExpandUserAssignedMap(input)
if err != nil {
return nil, err
}

identityType := servers.ManagedServiceIdentityType(string(expanded.Type))
out := servers.Identity{
out := servers.MySQLServerIdentity{
Type: &identityType,
}
if expanded.Type == identity.TypeUserAssigned {
Expand All @@ -1049,7 +1049,7 @@ func expandFlexibleServerIdentity(input []interface{}) (*servers.Identity, error
return &out, nil
}

func flattenFlexibleServerIdentity(input *servers.Identity) (*[]interface{}, error) {
func flattenFlexibleServerIdentity(input *servers.MySQLServerIdentity) (*[]interface{}, error) {
var transform *identity.UserAssignedMap

if input != nil {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"testing"
"time"

"github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2022-01-01/servers"
"github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2023-12-30/servers"
"github.com/hashicorp/terraform-provider-azurerm/internal/acceptance"
"github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check"
"github.com/hashicorp/terraform-provider-azurerm/internal/clients"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"time"

"github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2017-12-01/servers"
flexibleServers "github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2022-01-01/servers"
flexibleServers "github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2023-12-30/servers"
"github.com/hashicorp/terraform-provider-azurerm/helpers/tf"
"github.com/hashicorp/terraform-provider-azurerm/internal/clients"
"github.com/hashicorp/terraform-provider-azurerm/internal/services/springcloud/migration"
Expand Down

This file was deleted.

Loading
Loading