From 7d10f360db924c0aa2c72572171d4e3668fe8d12 Mon Sep 17 00:00:00 2001 From: Yichun Ma Date: Tue, 15 Mar 2022 15:08:28 +0800 Subject: [PATCH 01/33] `dependencies`: Upgrade sqlvirtualmachine API version to 2021-11-01-preview --- internal/services/mssql/client/client.go | 2 +- .../mssql/mssql_virtual_machine_resource.go | 87 ++-- .../sqlvirtualmachine/_meta.json | 11 - .../sqlvirtualmachine/enums.go | 267 ------------- .../sqlvirtualmachine/CHANGELOG.md | 0 .../sqlvirtualmachine/_meta.json | 11 + .../availabilitygrouplisteners.go | 19 +- .../sqlvirtualmachine/client.go | 2 +- .../sqlvirtualmachine/enums.go | 375 ++++++++++++++++++ .../sqlvirtualmachine/groups.go | 13 +- .../sqlvirtualmachine/models.go | 260 +++++++++++- .../sqlvirtualmachine/operations.go | 4 +- .../sqlvirtualmachine/sqlvirtualmachines.go | 173 +++++++- .../sqlvirtualmachine/version.go | 2 +- vendor/modules.txt | 2 +- 15 files changed, 877 insertions(+), 351 deletions(-) delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/preview/sqlvirtualmachine/mgmt/2017-03-01-preview/sqlvirtualmachine/_meta.json delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/preview/sqlvirtualmachine/mgmt/2017-03-01-preview/sqlvirtualmachine/enums.go rename vendor/github.com/Azure/azure-sdk-for-go/services/preview/sqlvirtualmachine/mgmt/{2017-03-01-preview => 2021-11-01-preview}/sqlvirtualmachine/CHANGELOG.md (100%) create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/preview/sqlvirtualmachine/mgmt/2021-11-01-preview/sqlvirtualmachine/_meta.json rename vendor/github.com/Azure/azure-sdk-for-go/services/preview/sqlvirtualmachine/mgmt/{2017-03-01-preview => 2021-11-01-preview}/sqlvirtualmachine/availabilitygrouplisteners.go (96%) rename vendor/github.com/Azure/azure-sdk-for-go/services/preview/sqlvirtualmachine/mgmt/{2017-03-01-preview => 2021-11-01-preview}/sqlvirtualmachine/client.go (97%) create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/preview/sqlvirtualmachine/mgmt/2021-11-01-preview/sqlvirtualmachine/enums.go rename vendor/github.com/Azure/azure-sdk-for-go/services/preview/sqlvirtualmachine/mgmt/{2017-03-01-preview => 2021-11-01-preview}/sqlvirtualmachine/groups.go (98%) rename vendor/github.com/Azure/azure-sdk-for-go/services/preview/sqlvirtualmachine/mgmt/{2017-03-01-preview => 2021-11-01-preview}/sqlvirtualmachine/models.go (84%) rename vendor/github.com/Azure/azure-sdk-for-go/services/preview/sqlvirtualmachine/mgmt/{2017-03-01-preview => 2021-11-01-preview}/sqlvirtualmachine/operations.go (97%) rename vendor/github.com/Azure/azure-sdk-for-go/services/preview/sqlvirtualmachine/mgmt/{2017-03-01-preview => 2021-11-01-preview}/sqlvirtualmachine/sqlvirtualmachines.go (80%) rename vendor/github.com/Azure/azure-sdk-for-go/services/preview/sqlvirtualmachine/mgmt/{2017-03-01-preview => 2021-11-01-preview}/sqlvirtualmachine/version.go (97%) diff --git a/internal/services/mssql/client/client.go b/internal/services/mssql/client/client.go index 99b848ae755d..fadade3a2650 100644 --- a/internal/services/mssql/client/client.go +++ b/internal/services/mssql/client/client.go @@ -2,7 +2,7 @@ package client import ( "github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/v5.0/sql" - "github.com/Azure/azure-sdk-for-go/services/preview/sqlvirtualmachine/mgmt/2017-03-01-preview/sqlvirtualmachine" + "github.com/Azure/azure-sdk-for-go/services/preview/sqlvirtualmachine/mgmt/2021-11-01-preview/sqlvirtualmachine" "github.com/hashicorp/terraform-provider-azurerm/internal/common" ) diff --git a/internal/services/mssql/mssql_virtual_machine_resource.go b/internal/services/mssql/mssql_virtual_machine_resource.go index f40421edb089..e3f0ec7665a6 100644 --- a/internal/services/mssql/mssql_virtual_machine_resource.go +++ b/internal/services/mssql/mssql_virtual_machine_resource.go @@ -7,7 +7,7 @@ import ( "strings" "time" - "github.com/Azure/azure-sdk-for-go/services/preview/sqlvirtualmachine/mgmt/2017-03-01-preview/sqlvirtualmachine" + "github.com/Azure/azure-sdk-for-go/services/preview/sqlvirtualmachine/mgmt/2021-11-01-preview/sqlvirtualmachine" "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" @@ -58,9 +58,9 @@ func resourceMsSqlVirtualMachine() *pluginsdk.Resource { Required: true, ForceNew: true, ValidateFunc: validation.StringInSlice([]string{ - string(sqlvirtualmachine.PAYG), - string(sqlvirtualmachine.AHUB), - string(sqlvirtualmachine.DR), + string(sqlvirtualmachine.SQLServerLicenseTypePAYG), + string(sqlvirtualmachine.SQLServerLicenseTypeAHUB), + string(sqlvirtualmachine.SQLServerLicenseTypeDR), }, false), }, @@ -94,8 +94,8 @@ func resourceMsSqlVirtualMachine() *pluginsdk.Resource { Required: true, DiffSuppressFunc: suppress.CaseDifference, ValidateFunc: validation.StringInSlice([]string{ - string(sqlvirtualmachine.Daily), - string(sqlvirtualmachine.Weekly), + string(sqlvirtualmachine.FullBackupFrequencyTypeDaily), + string(sqlvirtualmachine.FullBackupFrequencyTypeWeekly), }, false), }, @@ -156,13 +156,13 @@ func resourceMsSqlVirtualMachine() *pluginsdk.Resource { Type: pluginsdk.TypeString, Required: true, ValidateFunc: validation.StringInSlice([]string{ - string(sqlvirtualmachine.Monday), - string(sqlvirtualmachine.Tuesday), - string(sqlvirtualmachine.Wednesday), - string(sqlvirtualmachine.Thursday), - string(sqlvirtualmachine.Friday), - string(sqlvirtualmachine.Saturday), - string(sqlvirtualmachine.Sunday), + string(sqlvirtualmachine.DayOfWeekMonday), + string(sqlvirtualmachine.DayOfWeekTuesday), + string(sqlvirtualmachine.DayOfWeekWednesday), + string(sqlvirtualmachine.DayOfWeekThursday), + string(sqlvirtualmachine.DayOfWeekFriday), + string(sqlvirtualmachine.DayOfWeekSaturday), + string(sqlvirtualmachine.DayOfWeekSunday), }, false), }, @@ -237,11 +237,11 @@ func resourceMsSqlVirtualMachine() *pluginsdk.Resource { "sql_connectivity_type": { Type: pluginsdk.TypeString, Optional: true, - Default: string(sqlvirtualmachine.PRIVATE), + Default: string(sqlvirtualmachine.ConnectivityTypePRIVATE), ValidateFunc: validation.StringInSlice([]string{ - string(sqlvirtualmachine.LOCAL), - string(sqlvirtualmachine.PRIVATE), - string(sqlvirtualmachine.PUBLIC), + string(sqlvirtualmachine.ConnectivityTypeLOCAL), + string(sqlvirtualmachine.ConnectivityTypePRIVATE), + string(sqlvirtualmachine.ConnectivityTypePUBLIC), }, false), }, @@ -269,18 +269,18 @@ func resourceMsSqlVirtualMachine() *pluginsdk.Resource { Type: pluginsdk.TypeString, Required: true, ValidateFunc: validation.StringInSlice([]string{ - string(sqlvirtualmachine.NEW), - string(sqlvirtualmachine.EXTEND), - string(sqlvirtualmachine.ADD), + string(sqlvirtualmachine.DiskConfigurationTypeNEW), + string(sqlvirtualmachine.DiskConfigurationTypeEXTEND), + string(sqlvirtualmachine.DiskConfigurationTypeADD), }, false), }, "storage_workload_type": { Type: pluginsdk.TypeString, Required: true, ValidateFunc: validation.StringInSlice([]string{ - string(sqlvirtualmachine.GENERAL), - string(sqlvirtualmachine.OLTP), - string(sqlvirtualmachine.DW), + string(sqlvirtualmachine.SQLWorkloadTypeGENERAL), + string(sqlvirtualmachine.SQLWorkloadTypeOLTP), + string(sqlvirtualmachine.SQLWorkloadTypeDW), }, false), }, "data_settings": helper.StorageSettingSchema(), @@ -356,7 +356,7 @@ func resourceMsSqlVirtualMachineCreateUpdate(d *pluginsdk.ResourceData, meta int Properties: &sqlvirtualmachine.Properties{ VirtualMachineResourceID: utils.String(d.Get("virtual_machine_id").(string)), SQLServerLicenseType: sqlvirtualmachine.SQLServerLicenseType(d.Get("sql_license_type").(string)), - SQLManagement: sqlvirtualmachine.Full, + SQLManagement: sqlvirtualmachine.SQLManagementModeFull, AutoBackupSettings: expandSqlVirtualMachineAutoBackupSettings(d.Get("auto_backup").([]interface{})), AutoPatchingSettings: expandSqlVirtualMachineAutoPatchingSettings(d.Get("auto_patching").([]interface{})), KeyVaultCredentialSettings: expandSqlVirtualMachineKeyVaultCredential(d.Get("key_vault_credential").([]interface{})), @@ -604,10 +604,10 @@ func expandSqlVirtualMachineAutoBackupSettings(input []interface{}) *sqlvirtualm ret.BackupSystemDbs = utils.Bool(v.(bool)) } - ret.BackupScheduleType = sqlvirtualmachine.Automated + ret.BackupScheduleType = sqlvirtualmachine.BackupScheduleTypeAutomated if v, ok := config["manual_schedule"]; ok && len(v.([]interface{})) > 0 { manualSchedule := v.([]interface{})[0].(map[string]interface{}) - ret.BackupScheduleType = sqlvirtualmachine.Manual + ret.BackupScheduleType = sqlvirtualmachine.BackupScheduleTypeManual if v, ok := manualSchedule["full_backup_frequency"]; ok { ret.FullBackupFrequency = sqlvirtualmachine.FullBackupFrequencyType(v.(string)) @@ -633,7 +633,7 @@ func flattenSqlVirtualMachineAutoBackup(autoBackup *sqlvirtualmachine.AutoBackup } manualSchedule := make([]interface{}, 0) - if strings.EqualFold(string(autoBackup.BackupScheduleType), string(sqlvirtualmachine.Manual)) { + if strings.EqualFold(string(autoBackup.BackupScheduleType), string(sqlvirtualmachine.BackupScheduleTypeManual)) { var fullBackupStartHour int if autoBackup.FullBackupStartTime != nil { fullBackupStartHour = int(*autoBackup.FullBackupStartTime) @@ -797,7 +797,7 @@ func expandSqlVirtualMachineStorageConfigurationSettings(input []interface{}) *s StorageWorkloadType: sqlvirtualmachine.StorageWorkloadType(storageSettings["storage_workload_type"].(string)), SQLDataSettings: expandSqlVirtualMachineDataStorageSettings(storageSettings["data_settings"].([]interface{})), SQLLogSettings: expandSqlVirtualMachineDataStorageSettings(storageSettings["log_settings"].([]interface{})), - SQLTempDbSettings: expandSqlVirtualMachineDataStorageSettings(storageSettings["temp_db_settings"].([]interface{})), + SQLTempDbSettings: expandSqlVirtualMachineTempDbSettings(storageSettings["temp_db_settings"].([]interface{})), } } @@ -811,7 +811,7 @@ func flattenSqlVirtualMachineStorageConfigurationSettings(input *sqlvirtualmachi "disk_type": string(input.DiskConfigurationType), "data_settings": flattenSqlVirtualMachineStorageSettings(input.SQLDataSettings), "log_settings": flattenSqlVirtualMachineStorageSettings(input.SQLLogSettings), - "temp_db_settings": flattenSqlVirtualMachineStorageSettings(input.SQLTempDbSettings), + "temp_db_settings": flattenSqlVirtualMachineTempDbSettings(input.SQLTempDbSettings), } if output["storage_workload_type"].(string) == "" && output["disk_type"] == "" && @@ -863,3 +863,32 @@ func flattenSqlVirtualMachineStorageSettings(input *sqlvirtualmachine.SQLStorage return []interface{}{attrs} } + +func expandSqlVirtualMachineTempDbSettings(input []interface{}) *sqlvirtualmachine.SQLTempDbSettings { + if len(input) == 0 || input[0] == nil { + return nil + } + dataStorageSettings := input[0].(map[string]interface{}) + + return &sqlvirtualmachine.SQLTempDbSettings{ + Luns: expandSqlVirtualMachineStorageSettingsLuns(dataStorageSettings["luns"].([]interface{})), + DefaultFilePath: utils.String(dataStorageSettings["default_file_path"].(string)), + } +} + +func flattenSqlVirtualMachineTempDbSettings(input *sqlvirtualmachine.SQLTempDbSettings) []interface{} { + if input == nil || input.Luns == nil { + return []interface{}{} + } + attrs := make(map[string]interface{}) + + if input.Luns != nil { + attrs["luns"] = *input.Luns + } + + if input.DefaultFilePath != nil { + attrs["default_file_path"] = *input.DefaultFilePath + } + + return []interface{}{attrs} +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/sqlvirtualmachine/mgmt/2017-03-01-preview/sqlvirtualmachine/_meta.json b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/sqlvirtualmachine/mgmt/2017-03-01-preview/sqlvirtualmachine/_meta.json deleted file mode 100644 index 54ad89eeec59..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/sqlvirtualmachine/mgmt/2017-03-01-preview/sqlvirtualmachine/_meta.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "commit": "3c764635e7d442b3e74caf593029fcd440b3ef82", - "readme": "/_/azure-rest-api-specs/specification/sqlvirtualmachine/resource-manager/readme.md", - "tag": "package-2017-03-01-preview", - "use": "@microsoft.azure/autorest.go@2.1.187", - "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", - "autorest_command": "autorest --use=@microsoft.azure/autorest.go@2.1.187 --tag=package-2017-03-01-preview --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION /_/azure-rest-api-specs/specification/sqlvirtualmachine/resource-manager/readme.md", - "additional_properties": { - "additional_options": "--go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION" - } -} \ No newline at end of file diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/sqlvirtualmachine/mgmt/2017-03-01-preview/sqlvirtualmachine/enums.go b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/sqlvirtualmachine/mgmt/2017-03-01-preview/sqlvirtualmachine/enums.go deleted file mode 100644 index d972fc9b916a..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/sqlvirtualmachine/mgmt/2017-03-01-preview/sqlvirtualmachine/enums.go +++ /dev/null @@ -1,267 +0,0 @@ -package sqlvirtualmachine - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// BackupScheduleType enumerates the values for backup schedule type. -type BackupScheduleType string - -const ( - // Automated ... - Automated BackupScheduleType = "Automated" - // Manual ... - Manual BackupScheduleType = "Manual" -) - -// PossibleBackupScheduleTypeValues returns an array of possible values for the BackupScheduleType const type. -func PossibleBackupScheduleTypeValues() []BackupScheduleType { - return []BackupScheduleType{Automated, Manual} -} - -// ClusterConfiguration enumerates the values for cluster configuration. -type ClusterConfiguration string - -const ( - // Domainful ... - Domainful ClusterConfiguration = "Domainful" -) - -// PossibleClusterConfigurationValues returns an array of possible values for the ClusterConfiguration const type. -func PossibleClusterConfigurationValues() []ClusterConfiguration { - return []ClusterConfiguration{Domainful} -} - -// ClusterManagerType enumerates the values for cluster manager type. -type ClusterManagerType string - -const ( - // WSFC ... - WSFC ClusterManagerType = "WSFC" -) - -// PossibleClusterManagerTypeValues returns an array of possible values for the ClusterManagerType const type. -func PossibleClusterManagerTypeValues() []ClusterManagerType { - return []ClusterManagerType{WSFC} -} - -// ConnectivityType enumerates the values for connectivity type. -type ConnectivityType string - -const ( - // LOCAL ... - LOCAL ConnectivityType = "LOCAL" - // PRIVATE ... - PRIVATE ConnectivityType = "PRIVATE" - // PUBLIC ... - PUBLIC ConnectivityType = "PUBLIC" -) - -// PossibleConnectivityTypeValues returns an array of possible values for the ConnectivityType const type. -func PossibleConnectivityTypeValues() []ConnectivityType { - return []ConnectivityType{LOCAL, PRIVATE, PUBLIC} -} - -// DayOfWeek enumerates the values for day of week. -type DayOfWeek string - -const ( - // Friday ... - Friday DayOfWeek = "Friday" - // Monday ... - Monday DayOfWeek = "Monday" - // Saturday ... - Saturday DayOfWeek = "Saturday" - // Sunday ... - Sunday DayOfWeek = "Sunday" - // Thursday ... - Thursday DayOfWeek = "Thursday" - // Tuesday ... - Tuesday DayOfWeek = "Tuesday" - // Wednesday ... - Wednesday DayOfWeek = "Wednesday" -) - -// PossibleDayOfWeekValues returns an array of possible values for the DayOfWeek const type. -func PossibleDayOfWeekValues() []DayOfWeek { - return []DayOfWeek{Friday, Monday, Saturday, Sunday, Thursday, Tuesday, Wednesday} -} - -// DiskConfigurationType enumerates the values for disk configuration type. -type DiskConfigurationType string - -const ( - // ADD ... - ADD DiskConfigurationType = "ADD" - // EXTEND ... - EXTEND DiskConfigurationType = "EXTEND" - // NEW ... - NEW DiskConfigurationType = "NEW" -) - -// PossibleDiskConfigurationTypeValues returns an array of possible values for the DiskConfigurationType const type. -func PossibleDiskConfigurationTypeValues() []DiskConfigurationType { - return []DiskConfigurationType{ADD, EXTEND, NEW} -} - -// FullBackupFrequencyType enumerates the values for full backup frequency type. -type FullBackupFrequencyType string - -const ( - // Daily ... - Daily FullBackupFrequencyType = "Daily" - // Weekly ... - Weekly FullBackupFrequencyType = "Weekly" -) - -// PossibleFullBackupFrequencyTypeValues returns an array of possible values for the FullBackupFrequencyType const type. -func PossibleFullBackupFrequencyTypeValues() []FullBackupFrequencyType { - return []FullBackupFrequencyType{Daily, Weekly} -} - -// IdentityType enumerates the values for identity type. -type IdentityType string - -const ( - // SystemAssigned ... - SystemAssigned IdentityType = "SystemAssigned" -) - -// PossibleIdentityTypeValues returns an array of possible values for the IdentityType const type. -func PossibleIdentityTypeValues() []IdentityType { - return []IdentityType{SystemAssigned} -} - -// OperationOrigin enumerates the values for operation origin. -type OperationOrigin string - -const ( - // System ... - System OperationOrigin = "system" - // User ... - User OperationOrigin = "user" -) - -// PossibleOperationOriginValues returns an array of possible values for the OperationOrigin const type. -func PossibleOperationOriginValues() []OperationOrigin { - return []OperationOrigin{System, User} -} - -// ScaleType enumerates the values for scale type. -type ScaleType string - -const ( - // HA ... - HA ScaleType = "HA" -) - -// PossibleScaleTypeValues returns an array of possible values for the ScaleType const type. -func PossibleScaleTypeValues() []ScaleType { - return []ScaleType{HA} -} - -// SQLImageSku enumerates the values for sql image sku. -type SQLImageSku string - -const ( - // Developer ... - Developer SQLImageSku = "Developer" - // Enterprise ... - Enterprise SQLImageSku = "Enterprise" - // Express ... - Express SQLImageSku = "Express" - // Standard ... - Standard SQLImageSku = "Standard" - // Web ... - Web SQLImageSku = "Web" -) - -// PossibleSQLImageSkuValues returns an array of possible values for the SQLImageSku const type. -func PossibleSQLImageSkuValues() []SQLImageSku { - return []SQLImageSku{Developer, Enterprise, Express, Standard, Web} -} - -// SQLManagementMode enumerates the values for sql management mode. -type SQLManagementMode string - -const ( - // Full ... - Full SQLManagementMode = "Full" - // LightWeight ... - LightWeight SQLManagementMode = "LightWeight" - // NoAgent ... - NoAgent SQLManagementMode = "NoAgent" -) - -// PossibleSQLManagementModeValues returns an array of possible values for the SQLManagementMode const type. -func PossibleSQLManagementModeValues() []SQLManagementMode { - return []SQLManagementMode{Full, LightWeight, NoAgent} -} - -// SQLServerLicenseType enumerates the values for sql server license type. -type SQLServerLicenseType string - -const ( - // AHUB ... - AHUB SQLServerLicenseType = "AHUB" - // DR ... - DR SQLServerLicenseType = "DR" - // PAYG ... - PAYG SQLServerLicenseType = "PAYG" -) - -// PossibleSQLServerLicenseTypeValues returns an array of possible values for the SQLServerLicenseType const type. -func PossibleSQLServerLicenseTypeValues() []SQLServerLicenseType { - return []SQLServerLicenseType{AHUB, DR, PAYG} -} - -// SQLVMGroupImageSku enumerates the values for sqlvm group image sku. -type SQLVMGroupImageSku string - -const ( - // SQLVMGroupImageSkuDeveloper ... - SQLVMGroupImageSkuDeveloper SQLVMGroupImageSku = "Developer" - // SQLVMGroupImageSkuEnterprise ... - SQLVMGroupImageSkuEnterprise SQLVMGroupImageSku = "Enterprise" -) - -// PossibleSQLVMGroupImageSkuValues returns an array of possible values for the SQLVMGroupImageSku const type. -func PossibleSQLVMGroupImageSkuValues() []SQLVMGroupImageSku { - return []SQLVMGroupImageSku{SQLVMGroupImageSkuDeveloper, SQLVMGroupImageSkuEnterprise} -} - -// SQLWorkloadType enumerates the values for sql workload type. -type SQLWorkloadType string - -const ( - // DW ... - DW SQLWorkloadType = "DW" - // GENERAL ... - GENERAL SQLWorkloadType = "GENERAL" - // OLTP ... - OLTP SQLWorkloadType = "OLTP" -) - -// PossibleSQLWorkloadTypeValues returns an array of possible values for the SQLWorkloadType const type. -func PossibleSQLWorkloadTypeValues() []SQLWorkloadType { - return []SQLWorkloadType{DW, GENERAL, OLTP} -} - -// StorageWorkloadType enumerates the values for storage workload type. -type StorageWorkloadType string - -const ( - // StorageWorkloadTypeDW ... - StorageWorkloadTypeDW StorageWorkloadType = "DW" - // StorageWorkloadTypeGENERAL ... - StorageWorkloadTypeGENERAL StorageWorkloadType = "GENERAL" - // StorageWorkloadTypeOLTP ... - StorageWorkloadTypeOLTP StorageWorkloadType = "OLTP" -) - -// PossibleStorageWorkloadTypeValues returns an array of possible values for the StorageWorkloadType const type. -func PossibleStorageWorkloadTypeValues() []StorageWorkloadType { - return []StorageWorkloadType{StorageWorkloadTypeDW, StorageWorkloadTypeGENERAL, StorageWorkloadTypeOLTP} -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/sqlvirtualmachine/mgmt/2017-03-01-preview/sqlvirtualmachine/CHANGELOG.md b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/sqlvirtualmachine/mgmt/2021-11-01-preview/sqlvirtualmachine/CHANGELOG.md similarity index 100% rename from vendor/github.com/Azure/azure-sdk-for-go/services/preview/sqlvirtualmachine/mgmt/2017-03-01-preview/sqlvirtualmachine/CHANGELOG.md rename to vendor/github.com/Azure/azure-sdk-for-go/services/preview/sqlvirtualmachine/mgmt/2021-11-01-preview/sqlvirtualmachine/CHANGELOG.md diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/sqlvirtualmachine/mgmt/2021-11-01-preview/sqlvirtualmachine/_meta.json b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/sqlvirtualmachine/mgmt/2021-11-01-preview/sqlvirtualmachine/_meta.json new file mode 100644 index 000000000000..7665abd86aa3 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/sqlvirtualmachine/mgmt/2021-11-01-preview/sqlvirtualmachine/_meta.json @@ -0,0 +1,11 @@ +{ + "commit": "bb4175d29020cfff55f1d9087c2a5a89765067dc", + "readme": "/_/azure-rest-api-specs/specification/sqlvirtualmachine/resource-manager/readme.md", + "tag": "package-preview-2021-11", + "use": "@microsoft.azure/autorest.go@2.1.187", + "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", + "autorest_command": "autorest --use=@microsoft.azure/autorest.go@2.1.187 --tag=package-preview-2021-11 --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION --enum-prefix /_/azure-rest-api-specs/specification/sqlvirtualmachine/resource-manager/readme.md", + "additional_properties": { + "additional_options": "--go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION --enum-prefix" + } +} \ No newline at end of file diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/sqlvirtualmachine/mgmt/2017-03-01-preview/sqlvirtualmachine/availabilitygrouplisteners.go b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/sqlvirtualmachine/mgmt/2021-11-01-preview/sqlvirtualmachine/availabilitygrouplisteners.go similarity index 96% rename from vendor/github.com/Azure/azure-sdk-for-go/services/preview/sqlvirtualmachine/mgmt/2017-03-01-preview/sqlvirtualmachine/availabilitygrouplisteners.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/preview/sqlvirtualmachine/mgmt/2021-11-01-preview/sqlvirtualmachine/availabilitygrouplisteners.go index 8d05ba1c0c77..3715eb6b6b40 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/sqlvirtualmachine/mgmt/2017-03-01-preview/sqlvirtualmachine/availabilitygrouplisteners.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/sqlvirtualmachine/mgmt/2021-11-01-preview/sqlvirtualmachine/availabilitygrouplisteners.go @@ -76,11 +76,12 @@ func (client AvailabilityGroupListenersClient) CreateOrUpdatePreparer(ctx contex "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-03-01-preview" + const APIVersion = "2021-11-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } + parameters.SystemData = nil preparer := autorest.CreatePreparer( autorest.AsContentType("application/json; charset=utf-8"), autorest.AsPut(), @@ -160,7 +161,7 @@ func (client AvailabilityGroupListenersClient) DeletePreparer(ctx context.Contex "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-03-01-preview" + const APIVersion = "2021-11-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -206,7 +207,8 @@ func (client AvailabilityGroupListenersClient) DeleteResponder(resp *http.Respon // the Azure Resource Manager API or the portal. // SQLVirtualMachineGroupName - name of the SQL virtual machine group. // availabilityGroupListenerName - name of the availability group listener. -func (client AvailabilityGroupListenersClient) Get(ctx context.Context, resourceGroupName string, SQLVirtualMachineGroupName string, availabilityGroupListenerName string) (result AvailabilityGroupListener, err error) { +// expand - the child resources to include in the response. +func (client AvailabilityGroupListenersClient) Get(ctx context.Context, resourceGroupName string, SQLVirtualMachineGroupName string, availabilityGroupListenerName string, expand string) (result AvailabilityGroupListener, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/AvailabilityGroupListenersClient.Get") defer func() { @@ -217,7 +219,7 @@ func (client AvailabilityGroupListenersClient) Get(ctx context.Context, resource tracing.EndSpan(ctx, sc, err) }() } - req, err := client.GetPreparer(ctx, resourceGroupName, SQLVirtualMachineGroupName, availabilityGroupListenerName) + req, err := client.GetPreparer(ctx, resourceGroupName, SQLVirtualMachineGroupName, availabilityGroupListenerName, expand) if err != nil { err = autorest.NewErrorWithError(err, "sqlvirtualmachine.AvailabilityGroupListenersClient", "Get", nil, "Failure preparing request") return @@ -240,7 +242,7 @@ func (client AvailabilityGroupListenersClient) Get(ctx context.Context, resource } // GetPreparer prepares the Get request. -func (client AvailabilityGroupListenersClient) GetPreparer(ctx context.Context, resourceGroupName string, SQLVirtualMachineGroupName string, availabilityGroupListenerName string) (*http.Request, error) { +func (client AvailabilityGroupListenersClient) GetPreparer(ctx context.Context, resourceGroupName string, SQLVirtualMachineGroupName string, availabilityGroupListenerName string, expand string) (*http.Request, error) { pathParameters := map[string]interface{}{ "availabilityGroupListenerName": autorest.Encode("path", availabilityGroupListenerName), "resourceGroupName": autorest.Encode("path", resourceGroupName), @@ -248,10 +250,13 @@ func (client AvailabilityGroupListenersClient) GetPreparer(ctx context.Context, "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-03-01-preview" + const APIVersion = "2021-11-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } + if len(expand) > 0 { + queryParameters["$expand"] = autorest.Encode("query", expand) + } preparer := autorest.CreatePreparer( autorest.AsGet(), @@ -330,7 +335,7 @@ func (client AvailabilityGroupListenersClient) ListByGroupPreparer(ctx context.C "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-03-01-preview" + const APIVersion = "2021-11-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/sqlvirtualmachine/mgmt/2017-03-01-preview/sqlvirtualmachine/client.go b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/sqlvirtualmachine/mgmt/2021-11-01-preview/sqlvirtualmachine/client.go similarity index 97% rename from vendor/github.com/Azure/azure-sdk-for-go/services/preview/sqlvirtualmachine/mgmt/2017-03-01-preview/sqlvirtualmachine/client.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/preview/sqlvirtualmachine/mgmt/2021-11-01-preview/sqlvirtualmachine/client.go index b1646fecd43c..4878862ce59b 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/sqlvirtualmachine/mgmt/2017-03-01-preview/sqlvirtualmachine/client.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/sqlvirtualmachine/mgmt/2021-11-01-preview/sqlvirtualmachine/client.go @@ -1,4 +1,4 @@ -// Package sqlvirtualmachine implements the Azure ARM Sqlvirtualmachine service API version 2017-03-01-preview. +// Package sqlvirtualmachine implements the Azure ARM Sqlvirtualmachine service API version 2021-11-01-preview. // // The SQL virtual machine management API provides a RESTful set of web APIs that interact with Azure Compute, Network // & Storage services to manage your SQL Server virtual machine. The API enables users to create, delete and retrieve a diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/sqlvirtualmachine/mgmt/2021-11-01-preview/sqlvirtualmachine/enums.go b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/sqlvirtualmachine/mgmt/2021-11-01-preview/sqlvirtualmachine/enums.go new file mode 100644 index 000000000000..c57f3db6b3e6 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/sqlvirtualmachine/mgmt/2021-11-01-preview/sqlvirtualmachine/enums.go @@ -0,0 +1,375 @@ +package sqlvirtualmachine + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// BackupScheduleType enumerates the values for backup schedule type. +type BackupScheduleType string + +const ( + // BackupScheduleTypeAutomated ... + BackupScheduleTypeAutomated BackupScheduleType = "Automated" + // BackupScheduleTypeManual ... + BackupScheduleTypeManual BackupScheduleType = "Manual" +) + +// PossibleBackupScheduleTypeValues returns an array of possible values for the BackupScheduleType const type. +func PossibleBackupScheduleTypeValues() []BackupScheduleType { + return []BackupScheduleType{BackupScheduleTypeAutomated, BackupScheduleTypeManual} +} + +// ClusterConfiguration enumerates the values for cluster configuration. +type ClusterConfiguration string + +const ( + // ClusterConfigurationDomainful ... + ClusterConfigurationDomainful ClusterConfiguration = "Domainful" +) + +// PossibleClusterConfigurationValues returns an array of possible values for the ClusterConfiguration const type. +func PossibleClusterConfigurationValues() []ClusterConfiguration { + return []ClusterConfiguration{ClusterConfigurationDomainful} +} + +// ClusterManagerType enumerates the values for cluster manager type. +type ClusterManagerType string + +const ( + // ClusterManagerTypeWSFC ... + ClusterManagerTypeWSFC ClusterManagerType = "WSFC" +) + +// PossibleClusterManagerTypeValues returns an array of possible values for the ClusterManagerType const type. +func PossibleClusterManagerTypeValues() []ClusterManagerType { + return []ClusterManagerType{ClusterManagerTypeWSFC} +} + +// Commit enumerates the values for commit. +type Commit string + +const ( + // CommitASYNCHRONOUSCOMMIT ... + CommitASYNCHRONOUSCOMMIT Commit = "ASYNCHRONOUS_COMMIT" + // CommitSYNCHRONOUSCOMMIT ... + CommitSYNCHRONOUSCOMMIT Commit = "SYNCHRONOUS_COMMIT" +) + +// PossibleCommitValues returns an array of possible values for the Commit const type. +func PossibleCommitValues() []Commit { + return []Commit{CommitASYNCHRONOUSCOMMIT, CommitSYNCHRONOUSCOMMIT} +} + +// ConnectivityType enumerates the values for connectivity type. +type ConnectivityType string + +const ( + // ConnectivityTypeLOCAL ... + ConnectivityTypeLOCAL ConnectivityType = "LOCAL" + // ConnectivityTypePRIVATE ... + ConnectivityTypePRIVATE ConnectivityType = "PRIVATE" + // ConnectivityTypePUBLIC ... + ConnectivityTypePUBLIC ConnectivityType = "PUBLIC" +) + +// PossibleConnectivityTypeValues returns an array of possible values for the ConnectivityType const type. +func PossibleConnectivityTypeValues() []ConnectivityType { + return []ConnectivityType{ConnectivityTypeLOCAL, ConnectivityTypePRIVATE, ConnectivityTypePUBLIC} +} + +// CreatedByType enumerates the values for created by type. +type CreatedByType string + +const ( + // CreatedByTypeApplication ... + CreatedByTypeApplication CreatedByType = "Application" + // CreatedByTypeKey ... + CreatedByTypeKey CreatedByType = "Key" + // CreatedByTypeManagedIdentity ... + CreatedByTypeManagedIdentity CreatedByType = "ManagedIdentity" + // CreatedByTypeUser ... + CreatedByTypeUser CreatedByType = "User" +) + +// PossibleCreatedByTypeValues returns an array of possible values for the CreatedByType const type. +func PossibleCreatedByTypeValues() []CreatedByType { + return []CreatedByType{CreatedByTypeApplication, CreatedByTypeKey, CreatedByTypeManagedIdentity, CreatedByTypeUser} +} + +// DayOfWeek enumerates the values for day of week. +type DayOfWeek string + +const ( + // DayOfWeekFriday ... + DayOfWeekFriday DayOfWeek = "Friday" + // DayOfWeekMonday ... + DayOfWeekMonday DayOfWeek = "Monday" + // DayOfWeekSaturday ... + DayOfWeekSaturday DayOfWeek = "Saturday" + // DayOfWeekSunday ... + DayOfWeekSunday DayOfWeek = "Sunday" + // DayOfWeekThursday ... + DayOfWeekThursday DayOfWeek = "Thursday" + // DayOfWeekTuesday ... + DayOfWeekTuesday DayOfWeek = "Tuesday" + // DayOfWeekWednesday ... + DayOfWeekWednesday DayOfWeek = "Wednesday" +) + +// PossibleDayOfWeekValues returns an array of possible values for the DayOfWeek const type. +func PossibleDayOfWeekValues() []DayOfWeek { + return []DayOfWeek{DayOfWeekFriday, DayOfWeekMonday, DayOfWeekSaturday, DayOfWeekSunday, DayOfWeekThursday, DayOfWeekTuesday, DayOfWeekWednesday} +} + +// DaysOfWeek enumerates the values for days of week. +type DaysOfWeek string + +const ( + // DaysOfWeekFriday ... + DaysOfWeekFriday DaysOfWeek = "Friday" + // DaysOfWeekMonday ... + DaysOfWeekMonday DaysOfWeek = "Monday" + // DaysOfWeekSaturday ... + DaysOfWeekSaturday DaysOfWeek = "Saturday" + // DaysOfWeekSunday ... + DaysOfWeekSunday DaysOfWeek = "Sunday" + // DaysOfWeekThursday ... + DaysOfWeekThursday DaysOfWeek = "Thursday" + // DaysOfWeekTuesday ... + DaysOfWeekTuesday DaysOfWeek = "Tuesday" + // DaysOfWeekWednesday ... + DaysOfWeekWednesday DaysOfWeek = "Wednesday" +) + +// PossibleDaysOfWeekValues returns an array of possible values for the DaysOfWeek const type. +func PossibleDaysOfWeekValues() []DaysOfWeek { + return []DaysOfWeek{DaysOfWeekFriday, DaysOfWeekMonday, DaysOfWeekSaturday, DaysOfWeekSunday, DaysOfWeekThursday, DaysOfWeekTuesday, DaysOfWeekWednesday} +} + +// DiskConfigurationType enumerates the values for disk configuration type. +type DiskConfigurationType string + +const ( + // DiskConfigurationTypeADD ... + DiskConfigurationTypeADD DiskConfigurationType = "ADD" + // DiskConfigurationTypeEXTEND ... + DiskConfigurationTypeEXTEND DiskConfigurationType = "EXTEND" + // DiskConfigurationTypeNEW ... + DiskConfigurationTypeNEW DiskConfigurationType = "NEW" +) + +// PossibleDiskConfigurationTypeValues returns an array of possible values for the DiskConfigurationType const type. +func PossibleDiskConfigurationTypeValues() []DiskConfigurationType { + return []DiskConfigurationType{DiskConfigurationTypeADD, DiskConfigurationTypeEXTEND, DiskConfigurationTypeNEW} +} + +// Failover enumerates the values for failover. +type Failover string + +const ( + // FailoverAUTOMATIC ... + FailoverAUTOMATIC Failover = "AUTOMATIC" + // FailoverMANUAL ... + FailoverMANUAL Failover = "MANUAL" +) + +// PossibleFailoverValues returns an array of possible values for the Failover const type. +func PossibleFailoverValues() []Failover { + return []Failover{FailoverAUTOMATIC, FailoverMANUAL} +} + +// FullBackupFrequencyType enumerates the values for full backup frequency type. +type FullBackupFrequencyType string + +const ( + // FullBackupFrequencyTypeDaily ... + FullBackupFrequencyTypeDaily FullBackupFrequencyType = "Daily" + // FullBackupFrequencyTypeWeekly ... + FullBackupFrequencyTypeWeekly FullBackupFrequencyType = "Weekly" +) + +// PossibleFullBackupFrequencyTypeValues returns an array of possible values for the FullBackupFrequencyType const type. +func PossibleFullBackupFrequencyTypeValues() []FullBackupFrequencyType { + return []FullBackupFrequencyType{FullBackupFrequencyTypeDaily, FullBackupFrequencyTypeWeekly} +} + +// IdentityType enumerates the values for identity type. +type IdentityType string + +const ( + // IdentityTypeNone ... + IdentityTypeNone IdentityType = "None" + // IdentityTypeSystemAssigned ... + IdentityTypeSystemAssigned IdentityType = "SystemAssigned" +) + +// PossibleIdentityTypeValues returns an array of possible values for the IdentityType const type. +func PossibleIdentityTypeValues() []IdentityType { + return []IdentityType{IdentityTypeNone, IdentityTypeSystemAssigned} +} + +// OperationOrigin enumerates the values for operation origin. +type OperationOrigin string + +const ( + // OperationOriginSystem ... + OperationOriginSystem OperationOrigin = "system" + // OperationOriginUser ... + OperationOriginUser OperationOrigin = "user" +) + +// PossibleOperationOriginValues returns an array of possible values for the OperationOrigin const type. +func PossibleOperationOriginValues() []OperationOrigin { + return []OperationOrigin{OperationOriginSystem, OperationOriginUser} +} + +// ReadableSecondary enumerates the values for readable secondary. +type ReadableSecondary string + +const ( + // ReadableSecondaryALL ... + ReadableSecondaryALL ReadableSecondary = "ALL" + // ReadableSecondaryNO ... + ReadableSecondaryNO ReadableSecondary = "NO" + // ReadableSecondaryREADONLY ... + ReadableSecondaryREADONLY ReadableSecondary = "READ_ONLY" +) + +// PossibleReadableSecondaryValues returns an array of possible values for the ReadableSecondary const type. +func PossibleReadableSecondaryValues() []ReadableSecondary { + return []ReadableSecondary{ReadableSecondaryALL, ReadableSecondaryNO, ReadableSecondaryREADONLY} +} + +// Role enumerates the values for role. +type Role string + +const ( + // RolePRIMARY ... + RolePRIMARY Role = "PRIMARY" + // RoleSECONDARY ... + RoleSECONDARY Role = "SECONDARY" +) + +// PossibleRoleValues returns an array of possible values for the Role const type. +func PossibleRoleValues() []Role { + return []Role{RolePRIMARY, RoleSECONDARY} +} + +// ScaleType enumerates the values for scale type. +type ScaleType string + +const ( + // ScaleTypeHA ... + ScaleTypeHA ScaleType = "HA" +) + +// PossibleScaleTypeValues returns an array of possible values for the ScaleType const type. +func PossibleScaleTypeValues() []ScaleType { + return []ScaleType{ScaleTypeHA} +} + +// SQLImageSku enumerates the values for sql image sku. +type SQLImageSku string + +const ( + // SQLImageSkuDeveloper ... + SQLImageSkuDeveloper SQLImageSku = "Developer" + // SQLImageSkuEnterprise ... + SQLImageSkuEnterprise SQLImageSku = "Enterprise" + // SQLImageSkuExpress ... + SQLImageSkuExpress SQLImageSku = "Express" + // SQLImageSkuStandard ... + SQLImageSkuStandard SQLImageSku = "Standard" + // SQLImageSkuWeb ... + SQLImageSkuWeb SQLImageSku = "Web" +) + +// PossibleSQLImageSkuValues returns an array of possible values for the SQLImageSku const type. +func PossibleSQLImageSkuValues() []SQLImageSku { + return []SQLImageSku{SQLImageSkuDeveloper, SQLImageSkuEnterprise, SQLImageSkuExpress, SQLImageSkuStandard, SQLImageSkuWeb} +} + +// SQLManagementMode enumerates the values for sql management mode. +type SQLManagementMode string + +const ( + // SQLManagementModeFull ... + SQLManagementModeFull SQLManagementMode = "Full" + // SQLManagementModeLightWeight ... + SQLManagementModeLightWeight SQLManagementMode = "LightWeight" + // SQLManagementModeNoAgent ... + SQLManagementModeNoAgent SQLManagementMode = "NoAgent" +) + +// PossibleSQLManagementModeValues returns an array of possible values for the SQLManagementMode const type. +func PossibleSQLManagementModeValues() []SQLManagementMode { + return []SQLManagementMode{SQLManagementModeFull, SQLManagementModeLightWeight, SQLManagementModeNoAgent} +} + +// SQLServerLicenseType enumerates the values for sql server license type. +type SQLServerLicenseType string + +const ( + // SQLServerLicenseTypeAHUB ... + SQLServerLicenseTypeAHUB SQLServerLicenseType = "AHUB" + // SQLServerLicenseTypeDR ... + SQLServerLicenseTypeDR SQLServerLicenseType = "DR" + // SQLServerLicenseTypePAYG ... + SQLServerLicenseTypePAYG SQLServerLicenseType = "PAYG" +) + +// PossibleSQLServerLicenseTypeValues returns an array of possible values for the SQLServerLicenseType const type. +func PossibleSQLServerLicenseTypeValues() []SQLServerLicenseType { + return []SQLServerLicenseType{SQLServerLicenseTypeAHUB, SQLServerLicenseTypeDR, SQLServerLicenseTypePAYG} +} + +// SQLVMGroupImageSku enumerates the values for sqlvm group image sku. +type SQLVMGroupImageSku string + +const ( + // SQLVMGroupImageSkuDeveloper ... + SQLVMGroupImageSkuDeveloper SQLVMGroupImageSku = "Developer" + // SQLVMGroupImageSkuEnterprise ... + SQLVMGroupImageSkuEnterprise SQLVMGroupImageSku = "Enterprise" +) + +// PossibleSQLVMGroupImageSkuValues returns an array of possible values for the SQLVMGroupImageSku const type. +func PossibleSQLVMGroupImageSkuValues() []SQLVMGroupImageSku { + return []SQLVMGroupImageSku{SQLVMGroupImageSkuDeveloper, SQLVMGroupImageSkuEnterprise} +} + +// SQLWorkloadType enumerates the values for sql workload type. +type SQLWorkloadType string + +const ( + // SQLWorkloadTypeDW ... + SQLWorkloadTypeDW SQLWorkloadType = "DW" + // SQLWorkloadTypeGENERAL ... + SQLWorkloadTypeGENERAL SQLWorkloadType = "GENERAL" + // SQLWorkloadTypeOLTP ... + SQLWorkloadTypeOLTP SQLWorkloadType = "OLTP" +) + +// PossibleSQLWorkloadTypeValues returns an array of possible values for the SQLWorkloadType const type. +func PossibleSQLWorkloadTypeValues() []SQLWorkloadType { + return []SQLWorkloadType{SQLWorkloadTypeDW, SQLWorkloadTypeGENERAL, SQLWorkloadTypeOLTP} +} + +// StorageWorkloadType enumerates the values for storage workload type. +type StorageWorkloadType string + +const ( + // StorageWorkloadTypeDW ... + StorageWorkloadTypeDW StorageWorkloadType = "DW" + // StorageWorkloadTypeGENERAL ... + StorageWorkloadTypeGENERAL StorageWorkloadType = "GENERAL" + // StorageWorkloadTypeOLTP ... + StorageWorkloadTypeOLTP StorageWorkloadType = "OLTP" +) + +// PossibleStorageWorkloadTypeValues returns an array of possible values for the StorageWorkloadType const type. +func PossibleStorageWorkloadTypeValues() []StorageWorkloadType { + return []StorageWorkloadType{StorageWorkloadTypeDW, StorageWorkloadTypeGENERAL, StorageWorkloadTypeOLTP} +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/sqlvirtualmachine/mgmt/2017-03-01-preview/sqlvirtualmachine/groups.go b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/sqlvirtualmachine/mgmt/2021-11-01-preview/sqlvirtualmachine/groups.go similarity index 98% rename from vendor/github.com/Azure/azure-sdk-for-go/services/preview/sqlvirtualmachine/mgmt/2017-03-01-preview/sqlvirtualmachine/groups.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/preview/sqlvirtualmachine/mgmt/2021-11-01-preview/sqlvirtualmachine/groups.go index ea07209245de..b72eb6379034 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/sqlvirtualmachine/mgmt/2017-03-01-preview/sqlvirtualmachine/groups.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/sqlvirtualmachine/mgmt/2021-11-01-preview/sqlvirtualmachine/groups.go @@ -72,11 +72,12 @@ func (client GroupsClient) CreateOrUpdatePreparer(ctx context.Context, resourceG "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-03-01-preview" + const APIVersion = "2021-11-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } + parameters.SystemData = nil preparer := autorest.CreatePreparer( autorest.AsContentType("application/json; charset=utf-8"), autorest.AsPut(), @@ -154,7 +155,7 @@ func (client GroupsClient) DeletePreparer(ctx context.Context, resourceGroupName "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-03-01-preview" + const APIVersion = "2021-11-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -240,7 +241,7 @@ func (client GroupsClient) GetPreparer(ctx context.Context, resourceGroupName st "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-03-01-preview" + const APIVersion = "2021-11-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -316,7 +317,7 @@ func (client GroupsClient) ListPreparer(ctx context.Context) (*http.Request, err "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-03-01-preview" + const APIVersion = "2021-11-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -433,7 +434,7 @@ func (client GroupsClient) ListByResourceGroupPreparer(ctx context.Context, reso "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-03-01-preview" + const APIVersion = "2021-11-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -541,7 +542,7 @@ func (client GroupsClient) UpdatePreparer(ctx context.Context, resourceGroupName "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-03-01-preview" + const APIVersion = "2021-11-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/sqlvirtualmachine/mgmt/2017-03-01-preview/sqlvirtualmachine/models.go b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/sqlvirtualmachine/mgmt/2021-11-01-preview/sqlvirtualmachine/models.go similarity index 84% rename from vendor/github.com/Azure/azure-sdk-for-go/services/preview/sqlvirtualmachine/mgmt/2017-03-01-preview/sqlvirtualmachine/models.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/preview/sqlvirtualmachine/mgmt/2021-11-01-preview/sqlvirtualmachine/models.go index 447e02bdcf23..9631b8144321 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/sqlvirtualmachine/mgmt/2017-03-01-preview/sqlvirtualmachine/models.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/sqlvirtualmachine/mgmt/2021-11-01-preview/sqlvirtualmachine/models.go @@ -11,6 +11,7 @@ import ( "encoding/json" "github.com/Azure/go-autorest/autorest" "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/date" "github.com/Azure/go-autorest/autorest/to" "github.com/Azure/go-autorest/tracing" "github.com/gofrs/uuid" @@ -18,7 +19,7 @@ import ( ) // The package's fully qualified name. -const fqdn = "github.com/Azure/azure-sdk-for-go/services/preview/sqlvirtualmachine/mgmt/2017-03-01-preview/sqlvirtualmachine" +const fqdn = "github.com/Azure/azure-sdk-for-go/services/preview/sqlvirtualmachine/mgmt/2021-11-01-preview/sqlvirtualmachine" // AdditionalFeaturesServerConfigurations additional SQL Server feature settings. type AdditionalFeaturesServerConfigurations struct { @@ -26,26 +27,66 @@ type AdditionalFeaturesServerConfigurations struct { IsRServicesEnabled *bool `json:"isRServicesEnabled,omitempty"` } +// AgConfiguration availability group configuration. +type AgConfiguration struct { + // Replicas - READ-ONLY; Replica configurations. + Replicas *[]AgReplica `json:"replicas,omitempty"` +} + +// MarshalJSON is the custom marshaler for AgConfiguration. +func (ac AgConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// AgReplica availability group replica configuration. +type AgReplica struct { + // SQLVirtualMachineInstanceID - Sql VirtualMachine Instance Id. + SQLVirtualMachineInstanceID *string `json:"sqlVirtualMachineInstanceId,omitempty"` + // Role - Replica Role in availability group. Possible values include: 'RolePRIMARY', 'RoleSECONDARY' + Role Role `json:"role,omitempty"` + // Commit - Replica commit mode in availability group. Possible values include: 'CommitSYNCHRONOUSCOMMIT', 'CommitASYNCHRONOUSCOMMIT' + Commit Commit `json:"commit,omitempty"` + // Failover - Replica failover mode in availability group. Possible values include: 'FailoverAUTOMATIC', 'FailoverMANUAL' + Failover Failover `json:"failover,omitempty"` + // ReadableSecondary - Replica readable secondary mode in availability group. Possible values include: 'ReadableSecondaryNO', 'ReadableSecondaryALL', 'ReadableSecondaryREADONLY' + ReadableSecondary ReadableSecondary `json:"readableSecondary,omitempty"` +} + +// AssessmentSettings configure assessment for databases in your SQL virtual machine. +type AssessmentSettings struct { + // Enable - Enable or disable assessment feature on SQL virtual machine. + Enable *bool `json:"enable,omitempty"` + // RunImmediately - Run assessment immediately on SQL virtual machine. + RunImmediately *bool `json:"runImmediately,omitempty"` + // Schedule - Schedule for Assessment. + Schedule *Schedule `json:"schedule,omitempty"` +} + // AutoBackupSettings configure backups for databases in your SQL virtual machine. type AutoBackupSettings struct { // Enable - Enable or disable autobackup on SQL virtual machine. Enable *bool `json:"enable,omitempty"` // EnableEncryption - Enable or disable encryption for backup on SQL virtual machine. EnableEncryption *bool `json:"enableEncryption,omitempty"` - // RetentionPeriod - Retention period of backup: 1-30 days. + // RetentionPeriod - Retention period of backup: 1-90 days. RetentionPeriod *int32 `json:"retentionPeriod,omitempty"` // StorageAccountURL - Storage account url where backup will be taken to. StorageAccountURL *string `json:"storageAccountUrl,omitempty"` + // StorageContainerName - Storage container name where backup will be taken to. + StorageContainerName *string `json:"storageContainerName,omitempty"` // StorageAccessKey - Storage account key where backup will be taken to. StorageAccessKey *string `json:"storageAccessKey,omitempty"` // Password - Password for encryption on backup. Password *string `json:"password,omitempty"` // BackupSystemDbs - Include or exclude system databases from auto backup. BackupSystemDbs *bool `json:"backupSystemDbs,omitempty"` - // BackupScheduleType - Backup schedule type. Possible values include: 'Manual', 'Automated' + // BackupScheduleType - Backup schedule type. Possible values include: 'BackupScheduleTypeManual', 'BackupScheduleTypeAutomated' BackupScheduleType BackupScheduleType `json:"backupScheduleType,omitempty"` - // FullBackupFrequency - Frequency of full backups. In both cases, full backups begin during the next scheduled time window. Possible values include: 'Daily', 'Weekly' + // FullBackupFrequency - Frequency of full backups. In both cases, full backups begin during the next scheduled time window. Possible values include: 'FullBackupFrequencyTypeDaily', 'FullBackupFrequencyTypeWeekly' FullBackupFrequency FullBackupFrequencyType `json:"fullBackupFrequency,omitempty"` + // DaysOfWeek - Days of the week for the backups when FullBackupFrequency is set to Weekly. + DaysOfWeek *[]DaysOfWeek `json:"daysOfWeek,omitempty"` // FullBackupStartTime - Start time of a given day during which full backups can take place. 0-23 hours. FullBackupStartTime *int32 `json:"fullBackupStartTime,omitempty"` // FullBackupWindowHours - Duration of the time window of a given day during which full backups can take place. 1-23 hours. @@ -58,7 +99,7 @@ type AutoBackupSettings struct { type AutoPatchingSettings struct { // Enable - Enable or disable autopatching on SQL virtual machine. Enable *bool `json:"enable,omitempty"` - // DayOfWeek - Day of week to apply the patch on. Possible values include: 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday' + // DayOfWeek - Day of week to apply the patch on. Possible values include: 'DayOfWeekMonday', 'DayOfWeekTuesday', 'DayOfWeekWednesday', 'DayOfWeekThursday', 'DayOfWeekFriday', 'DayOfWeekSaturday', 'DayOfWeekSunday' DayOfWeek DayOfWeek `json:"dayOfWeek,omitempty"` // MaintenanceWindowStartingHour - Hour of the day when patching is initiated. Local VM time. MaintenanceWindowStartingHour *int32 `json:"maintenanceWindowStartingHour,omitempty"` @@ -71,6 +112,8 @@ type AvailabilityGroupListener struct { autorest.Response `json:"-"` // AvailabilityGroupListenerProperties - Resource properties. *AvailabilityGroupListenerProperties `json:"properties,omitempty"` + // SystemData - READ-ONLY + SystemData *SystemData `json:"systemData,omitempty"` // ID - READ-ONLY; Resource ID. ID *string `json:"id,omitempty"` // Name - READ-ONLY; Resource name. @@ -106,6 +149,15 @@ func (agl *AvailabilityGroupListener) UnmarshalJSON(body []byte) error { } agl.AvailabilityGroupListenerProperties = &availabilityGroupListenerProperties } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + agl.SystemData = &systemData + } case "id": if v != nil { var ID string @@ -317,6 +369,8 @@ type AvailabilityGroupListenerProperties struct { CreateDefaultAvailabilityGroupIfNotExist *bool `json:"createDefaultAvailabilityGroupIfNotExist,omitempty"` // Port - Listener port. Port *int32 `json:"port,omitempty"` + // AvailabilityGroupConfiguration - Availability Group configuration. + AvailabilityGroupConfiguration *AgConfiguration `json:"availabilityGroupConfiguration,omitempty"` } // MarshalJSON is the custom marshaler for AvailabilityGroupListenerProperties. @@ -334,6 +388,9 @@ func (aglp AvailabilityGroupListenerProperties) MarshalJSON() ([]byte, error) { if aglp.Port != nil { objectMap["port"] = aglp.Port } + if aglp.AvailabilityGroupConfiguration != nil { + objectMap["availabilityGroupConfiguration"] = aglp.AvailabilityGroupConfiguration + } return json.Marshal(objectMap) } @@ -422,6 +479,8 @@ type Group struct { autorest.Response `json:"-"` // GroupProperties - Resource properties. *GroupProperties `json:"properties,omitempty"` + // SystemData - READ-ONLY + SystemData *SystemData `json:"systemData,omitempty"` // Location - Resource location. Location *string `json:"location,omitempty"` // Tags - Resource tags. @@ -467,6 +526,15 @@ func (g *Group) UnmarshalJSON(body []byte) error { } g.GroupProperties = &groupProperties } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + g.SystemData = &systemData + } case "location": if v != nil { var location string @@ -691,11 +759,11 @@ type GroupProperties struct { SQLImageOffer *string `json:"sqlImageOffer,omitempty"` // SQLImageSku - SQL image sku. Possible values include: 'SQLVMGroupImageSkuDeveloper', 'SQLVMGroupImageSkuEnterprise' SQLImageSku SQLVMGroupImageSku `json:"sqlImageSku,omitempty"` - // ScaleType - READ-ONLY; Scale type. Possible values include: 'HA' + // ScaleType - READ-ONLY; Scale type. Possible values include: 'ScaleTypeHA' ScaleType ScaleType `json:"scaleType,omitempty"` - // ClusterManagerType - READ-ONLY; Type of cluster manager: Windows Server Failover Cluster (WSFC), implied by the scale type of the group and the OS type. Possible values include: 'WSFC' + // ClusterManagerType - READ-ONLY; Type of cluster manager: Windows Server Failover Cluster (WSFC), implied by the scale type of the group and the OS type. Possible values include: 'ClusterManagerTypeWSFC' ClusterManagerType ClusterManagerType `json:"clusterManagerType,omitempty"` - // ClusterConfiguration - READ-ONLY; Cluster type. Possible values include: 'Domainful' + // ClusterConfiguration - READ-ONLY; Cluster type. Possible values include: 'ClusterConfigurationDomainful' ClusterConfiguration ClusterConfiguration `json:"clusterConfiguration,omitempty"` // WsfcDomainProfile - Cluster Active Directory domain profile. WsfcDomainProfile *WsfcDomainProfile `json:"wsfcDomainProfile,omitempty"` @@ -1052,7 +1120,7 @@ type Operation struct { Name *string `json:"name,omitempty"` // Display - READ-ONLY; The localized display information for this particular operation / action. Display *OperationDisplay `json:"display,omitempty"` - // Origin - READ-ONLY; The intended executor of the operation. Possible values include: 'User', 'System' + // Origin - READ-ONLY; The intended executor of the operation. Possible values include: 'OperationOriginUser', 'OperationOriginSystem' Origin OperationOrigin `json:"origin,omitempty"` // Properties - READ-ONLY; Additional descriptions for the operation. Properties map[string]interface{} `json:"properties"` @@ -1263,11 +1331,11 @@ type Properties struct { ProvisioningState *string `json:"provisioningState,omitempty"` // SQLImageOffer - SQL image offer. Examples include SQL2016-WS2016, SQL2017-WS2016. SQLImageOffer *string `json:"sqlImageOffer,omitempty"` - // SQLServerLicenseType - SQL Server license type. Possible values include: 'PAYG', 'AHUB', 'DR' + // SQLServerLicenseType - SQL Server license type. Possible values include: 'SQLServerLicenseTypePAYG', 'SQLServerLicenseTypeAHUB', 'SQLServerLicenseTypeDR' SQLServerLicenseType SQLServerLicenseType `json:"sqlServerLicenseType,omitempty"` - // SQLManagement - SQL Server Management type. Possible values include: 'Full', 'LightWeight', 'NoAgent' + // SQLManagement - SQL Server Management type. Possible values include: 'SQLManagementModeFull', 'SQLManagementModeLightWeight', 'SQLManagementModeNoAgent' SQLManagement SQLManagementMode `json:"sqlManagement,omitempty"` - // SQLImageSku - SQL Server edition type. Possible values include: 'Developer', 'Express', 'Standard', 'Enterprise', 'Web' + // SQLImageSku - SQL Server edition type. Possible values include: 'SQLImageSkuDeveloper', 'SQLImageSkuExpress', 'SQLImageSkuStandard', 'SQLImageSkuEnterprise', 'SQLImageSkuWeb' SQLImageSku SQLImageSku `json:"sqlImageSku,omitempty"` // SQLVirtualMachineGroupResourceID - ARM resource id of the SQL virtual machine group this SQL virtual machine is or will be part of. SQLVirtualMachineGroupResourceID *string `json:"sqlVirtualMachineGroupResourceId,omitempty"` @@ -1283,6 +1351,8 @@ type Properties struct { ServerConfigurationsManagementSettings *ServerConfigurationsManagementSettings `json:"serverConfigurationsManagementSettings,omitempty"` // StorageConfigurationSettings - Storage Configuration Settings. StorageConfigurationSettings *StorageConfigurationSettings `json:"storageConfigurationSettings,omitempty"` + // AssessmentSettings - Assessment Settings. + AssessmentSettings *AssessmentSettings `json:"assessmentSettings,omitempty"` } // MarshalJSON is the custom marshaler for Properties. @@ -1324,6 +1394,9 @@ func (p Properties) MarshalJSON() ([]byte, error) { if p.StorageConfigurationSettings != nil { objectMap["storageConfigurationSettings"] = p.StorageConfigurationSettings } + if p.AssessmentSettings != nil { + objectMap["assessmentSettings"] = p.AssessmentSettings + } return json.Marshal(objectMap) } @@ -1363,7 +1436,7 @@ func (r Resource) MarshalJSON() ([]byte, error) { type ResourceIdentity struct { // PrincipalID - READ-ONLY; The Azure Active Directory principal id. PrincipalID *uuid.UUID `json:"principalId,omitempty"` - // Type - The identity type. Set this to 'SystemAssigned' in order to automatically create and assign an Azure Active Directory principal for the resource. Possible values include: 'SystemAssigned' + // Type - The identity type. Set this to 'SystemAssigned' in order to automatically create and assign an Azure Active Directory principal for the resource. Possible values include: 'IdentityTypeNone', 'IdentityTypeSystemAssigned' Type IdentityType `json:"type,omitempty"` // TenantID - READ-ONLY; The Azure Active Directory tenant id. TenantID *uuid.UUID `json:"tenantId,omitempty"` @@ -1378,6 +1451,20 @@ func (ri ResourceIdentity) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } +// Schedule ... +type Schedule struct { + // Enable - Enable or disable assessment schedule on SQL virtual machine. + Enable *bool `json:"enable,omitempty"` + // WeeklyInterval - Number of weeks to schedule between 2 assessment runs. Takes value from 1-6 + WeeklyInterval *int32 `json:"weeklyInterval,omitempty"` + // MonthlyOccurrence - Occurrence of the DayOfWeek day within a month to schedule assessment. Takes values: 1,2,3,4 and -1. Use -1 for last DayOfWeek day of the month + MonthlyOccurrence *int32 `json:"monthlyOccurrence,omitempty"` + // DayOfWeek - Day of the week to run assessment. Possible values include: 'DayOfWeekMonday', 'DayOfWeekTuesday', 'DayOfWeekWednesday', 'DayOfWeekThursday', 'DayOfWeekFriday', 'DayOfWeekSaturday', 'DayOfWeekSunday' + DayOfWeek DayOfWeek `json:"dayOfWeek,omitempty"` + // StartTime - Time of the day in HH:mm format. Eg. 17:30 + StartTime *string `json:"startTime,omitempty"` +} + // ServerConfigurationsManagementSettings set the connectivity, storage and workload settings. type ServerConfigurationsManagementSettings struct { // SQLConnectivityUpdateSettings - SQL connectivity type settings. @@ -1388,11 +1475,13 @@ type ServerConfigurationsManagementSettings struct { SQLStorageUpdateSettings *SQLStorageUpdateSettings `json:"sqlStorageUpdateSettings,omitempty"` // AdditionalFeaturesServerConfigurations - Additional SQL feature settings. AdditionalFeaturesServerConfigurations *AdditionalFeaturesServerConfigurations `json:"additionalFeaturesServerConfigurations,omitempty"` + // SQLInstanceSettings - SQL Instance settings. + SQLInstanceSettings *SQLInstanceSettings `json:"sqlInstanceSettings,omitempty"` } // SQLConnectivityUpdateSettings set the access level and network port settings for SQL Server. type SQLConnectivityUpdateSettings struct { - // ConnectivityType - SQL Server connectivity option. Possible values include: 'LOCAL', 'PRIVATE', 'PUBLIC' + // ConnectivityType - SQL Server connectivity option. Possible values include: 'ConnectivityTypeLOCAL', 'ConnectivityTypePRIVATE', 'ConnectivityTypePUBLIC' ConnectivityType ConnectivityType `json:"connectivityType,omitempty"` // Port - SQL Server port. Port *int32 `json:"port,omitempty"` @@ -1402,6 +1491,20 @@ type SQLConnectivityUpdateSettings struct { SQLAuthUpdatePassword *string `json:"sqlAuthUpdatePassword,omitempty"` } +// SQLInstanceSettings set the server/instance-level settings for SQL Server. +type SQLInstanceSettings struct { + // Collation - SQL Server Collation. + Collation *string `json:"collation,omitempty"` + // MaxDop - SQL Server MAXDOP. + MaxDop *int32 `json:"maxDop,omitempty"` + // IsOptimizeForAdHocWorkloadsEnabled - SQL Server Optimize for Adhoc workloads. + IsOptimizeForAdHocWorkloadsEnabled *bool `json:"isOptimizeForAdHocWorkloadsEnabled,omitempty"` + // MinServerMemoryMB - SQL Server minimum memory. + MinServerMemoryMB *int32 `json:"minServerMemoryMB,omitempty"` + // MaxServerMemoryMB - SQL Server maximum memory. + MaxServerMemoryMB *int32 `json:"maxServerMemoryMB,omitempty"` +} + // SQLStorageSettings set disk storage settings for SQL Server. type SQLStorageSettings struct { // Luns - Logical Unit Numbers for the disks. @@ -1416,10 +1519,28 @@ type SQLStorageUpdateSettings struct { DiskCount *int32 `json:"diskCount,omitempty"` // StartingDeviceID - Device id of the first disk to be updated. StartingDeviceID *int32 `json:"startingDeviceId,omitempty"` - // DiskConfigurationType - Disk configuration to apply to SQL Server. Possible values include: 'NEW', 'EXTEND', 'ADD' + // DiskConfigurationType - Disk configuration to apply to SQL Server. Possible values include: 'DiskConfigurationTypeNEW', 'DiskConfigurationTypeEXTEND', 'DiskConfigurationTypeADD' DiskConfigurationType DiskConfigurationType `json:"diskConfigurationType,omitempty"` } +// SQLTempDbSettings ... +type SQLTempDbSettings struct { + // DataFileSize - SQL Server default file size + DataFileSize *int32 `json:"dataFileSize,omitempty"` + // DataGrowth - SQL Server default file autoGrowth size + DataGrowth *int32 `json:"dataGrowth,omitempty"` + // LogFileSize - SQL Server default file size + LogFileSize *int32 `json:"logFileSize,omitempty"` + // LogGrowth - SQL Server default file autoGrowth size + LogGrowth *int32 `json:"logGrowth,omitempty"` + // DataFileCount - SQL Server default file count + DataFileCount *int32 `json:"dataFileCount,omitempty"` + // Luns - Logical Unit Numbers for the disks. + Luns *[]int32 `json:"luns,omitempty"` + // DefaultFilePath - SQL Server default file path + DefaultFilePath *string `json:"defaultFilePath,omitempty"` +} + // SQLVirtualMachine a SQL virtual machine. type SQLVirtualMachine struct { autorest.Response `json:"-"` @@ -1427,6 +1548,8 @@ type SQLVirtualMachine struct { Identity *ResourceIdentity `json:"identity,omitempty"` // Properties - Resource properties. *Properties `json:"properties,omitempty"` + // SystemData - READ-ONLY + SystemData *SystemData `json:"systemData,omitempty"` // Location - Resource location. Location *string `json:"location,omitempty"` // Tags - Resource tags. @@ -1484,6 +1607,15 @@ func (svm *SQLVirtualMachine) UnmarshalJSON(body []byte) error { } svm.Properties = &properties } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + svm.SystemData = &systemData + } case "location": if v != nil { var location string @@ -1615,6 +1747,80 @@ func (future *SQLVirtualMachinesDeleteFutureType) result(client SQLVirtualMachin return } +// SQLVirtualMachinesRedeployFutureType an abstraction for monitoring and retrieving the results of a +// long-running operation. +type SQLVirtualMachinesRedeployFutureType struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(SQLVirtualMachinesClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *SQLVirtualMachinesRedeployFutureType) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for SQLVirtualMachinesRedeployFutureType.Result. +func (future *SQLVirtualMachinesRedeployFutureType) result(client SQLVirtualMachinesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "sqlvirtualmachine.SQLVirtualMachinesRedeployFutureType", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("sqlvirtualmachine.SQLVirtualMachinesRedeployFutureType") + return + } + ar.Response = future.Response() + return +} + +// SQLVirtualMachinesStartAssessmentFutureType an abstraction for monitoring and retrieving the results of +// a long-running operation. +type SQLVirtualMachinesStartAssessmentFutureType struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(SQLVirtualMachinesClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *SQLVirtualMachinesStartAssessmentFutureType) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for SQLVirtualMachinesStartAssessmentFutureType.Result. +func (future *SQLVirtualMachinesStartAssessmentFutureType) result(client SQLVirtualMachinesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "sqlvirtualmachine.SQLVirtualMachinesStartAssessmentFutureType", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("sqlvirtualmachine.SQLVirtualMachinesStartAssessmentFutureType") + return + } + ar.Response = future.Response() + return +} + // SQLVirtualMachinesUpdateFutureType an abstraction for monitoring and retrieving the results of a // long-running operation. type SQLVirtualMachinesUpdateFutureType struct { @@ -1660,7 +1866,7 @@ func (future *SQLVirtualMachinesUpdateFutureType) result(client SQLVirtualMachin // SQLWorkloadTypeUpdateSettings set workload type to optimize storage for SQL Server. type SQLWorkloadTypeUpdateSettings struct { - // SQLWorkloadType - SQL Server workload type. Possible values include: 'GENERAL', 'OLTP', 'DW' + // SQLWorkloadType - SQL Server workload type. Possible values include: 'SQLWorkloadTypeGENERAL', 'SQLWorkloadTypeOLTP', 'SQLWorkloadTypeDW' SQLWorkloadType SQLWorkloadType `json:"sqlWorkloadType,omitempty"` } @@ -1671,13 +1877,31 @@ type StorageConfigurationSettings struct { // SQLLogSettings - SQL Server Log Storage Settings. SQLLogSettings *SQLStorageSettings `json:"sqlLogSettings,omitempty"` // SQLTempDbSettings - SQL Server TempDb Storage Settings. - SQLTempDbSettings *SQLStorageSettings `json:"sqlTempDbSettings,omitempty"` - // DiskConfigurationType - Disk configuration to apply to SQL Server. Possible values include: 'NEW', 'EXTEND', 'ADD' + SQLTempDbSettings *SQLTempDbSettings `json:"sqlTempDbSettings,omitempty"` + // SQLSystemDbOnDataDisk - SQL Server SystemDb Storage on DataPool if true. + SQLSystemDbOnDataDisk *bool `json:"sqlSystemDbOnDataDisk,omitempty"` + // DiskConfigurationType - Disk configuration to apply to SQL Server. Possible values include: 'DiskConfigurationTypeNEW', 'DiskConfigurationTypeEXTEND', 'DiskConfigurationTypeADD' DiskConfigurationType DiskConfigurationType `json:"diskConfigurationType,omitempty"` // StorageWorkloadType - Storage workload type. Possible values include: 'StorageWorkloadTypeGENERAL', 'StorageWorkloadTypeOLTP', 'StorageWorkloadTypeDW' StorageWorkloadType StorageWorkloadType `json:"storageWorkloadType,omitempty"` } +// SystemData metadata pertaining to creation and last modification of the resource. +type SystemData struct { + // CreatedBy - The identity that created the resource. + CreatedBy *string `json:"createdBy,omitempty"` + // CreatedByType - The type of identity that created the resource. Possible values include: 'CreatedByTypeUser', 'CreatedByTypeApplication', 'CreatedByTypeManagedIdentity', 'CreatedByTypeKey' + CreatedByType CreatedByType `json:"createdByType,omitempty"` + // CreatedAt - The timestamp of resource creation (UTC). + CreatedAt *date.Time `json:"createdAt,omitempty"` + // LastModifiedBy - The identity that last modified the resource. + LastModifiedBy *string `json:"lastModifiedBy,omitempty"` + // LastModifiedByType - The type of identity that last modified the resource. Possible values include: 'CreatedByTypeUser', 'CreatedByTypeApplication', 'CreatedByTypeManagedIdentity', 'CreatedByTypeKey' + LastModifiedByType CreatedByType `json:"lastModifiedByType,omitempty"` + // LastModifiedAt - The timestamp of resource last modification (UTC) + LastModifiedAt *date.Time `json:"lastModifiedAt,omitempty"` +} + // TrackedResource ARM tracked top level resource. type TrackedResource struct { // Location - Resource location. diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/sqlvirtualmachine/mgmt/2017-03-01-preview/sqlvirtualmachine/operations.go b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/sqlvirtualmachine/mgmt/2021-11-01-preview/sqlvirtualmachine/operations.go similarity index 97% rename from vendor/github.com/Azure/azure-sdk-for-go/services/preview/sqlvirtualmachine/mgmt/2017-03-01-preview/sqlvirtualmachine/operations.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/preview/sqlvirtualmachine/mgmt/2021-11-01-preview/sqlvirtualmachine/operations.go index b35224191b20..4386fc4dce21 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/sqlvirtualmachine/mgmt/2017-03-01-preview/sqlvirtualmachine/operations.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/sqlvirtualmachine/mgmt/2021-11-01-preview/sqlvirtualmachine/operations.go @@ -32,7 +32,7 @@ func NewOperationsClientWithBaseURI(baseURI string, subscriptionID string) Opera return OperationsClient{NewWithBaseURI(baseURI, subscriptionID)} } -// List lists all of the available SQL Rest API operations. +// List lists all of the available SQL Virtual Machine Rest API operations. func (client OperationsClient) List(ctx context.Context) (result OperationListResultPage, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.List") @@ -73,7 +73,7 @@ func (client OperationsClient) List(ctx context.Context) (result OperationListRe // ListPreparer prepares the List request. func (client OperationsClient) ListPreparer(ctx context.Context) (*http.Request, error) { - const APIVersion = "2017-03-01-preview" + const APIVersion = "2021-11-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/sqlvirtualmachine/mgmt/2017-03-01-preview/sqlvirtualmachine/sqlvirtualmachines.go b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/sqlvirtualmachine/mgmt/2021-11-01-preview/sqlvirtualmachine/sqlvirtualmachines.go similarity index 80% rename from vendor/github.com/Azure/azure-sdk-for-go/services/preview/sqlvirtualmachine/mgmt/2017-03-01-preview/sqlvirtualmachine/sqlvirtualmachines.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/preview/sqlvirtualmachine/mgmt/2021-11-01-preview/sqlvirtualmachine/sqlvirtualmachines.go index aac9c00401ce..f0f611ec79be 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/sqlvirtualmachine/mgmt/2017-03-01-preview/sqlvirtualmachine/sqlvirtualmachines.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/sqlvirtualmachine/mgmt/2021-11-01-preview/sqlvirtualmachine/sqlvirtualmachines.go @@ -74,11 +74,12 @@ func (client SQLVirtualMachinesClient) CreateOrUpdatePreparer(ctx context.Contex "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-03-01-preview" + const APIVersion = "2021-11-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } + parameters.SystemData = nil preparer := autorest.CreatePreparer( autorest.AsContentType("application/json; charset=utf-8"), autorest.AsPut(), @@ -156,7 +157,7 @@ func (client SQLVirtualMachinesClient) DeletePreparer(ctx context.Context, resou "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-03-01-preview" + const APIVersion = "2021-11-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -243,7 +244,7 @@ func (client SQLVirtualMachinesClient) GetPreparer(ctx context.Context, resource "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-03-01-preview" + const APIVersion = "2021-11-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -322,7 +323,7 @@ func (client SQLVirtualMachinesClient) ListPreparer(ctx context.Context) (*http. "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-03-01-preview" + const APIVersion = "2021-11-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -439,7 +440,7 @@ func (client SQLVirtualMachinesClient) ListByResourceGroupPreparer(ctx context.C "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-03-01-preview" + const APIVersion = "2021-11-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -558,7 +559,7 @@ func (client SQLVirtualMachinesClient) ListBySQLVMGroupPreparer(ctx context.Cont "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-03-01-preview" + const APIVersion = "2021-11-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -626,6 +627,164 @@ func (client SQLVirtualMachinesClient) ListBySQLVMGroupComplete(ctx context.Cont return } +// Redeploy uninstalls and reinstalls the SQL Iaas Extension. +// Parameters: +// resourceGroupName - name of the resource group that contains the resource. You can obtain this value from +// the Azure Resource Manager API or the portal. +// SQLVirtualMachineName - name of the SQL virtual machine. +func (client SQLVirtualMachinesClient) Redeploy(ctx context.Context, resourceGroupName string, SQLVirtualMachineName string) (result SQLVirtualMachinesRedeployFutureType, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SQLVirtualMachinesClient.Redeploy") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.RedeployPreparer(ctx, resourceGroupName, SQLVirtualMachineName) + if err != nil { + err = autorest.NewErrorWithError(err, "sqlvirtualmachine.SQLVirtualMachinesClient", "Redeploy", nil, "Failure preparing request") + return + } + + result, err = client.RedeploySender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "sqlvirtualmachine.SQLVirtualMachinesClient", "Redeploy", result.Response(), "Failure sending request") + return + } + + return +} + +// RedeployPreparer prepares the Redeploy request. +func (client SQLVirtualMachinesClient) RedeployPreparer(ctx context.Context, resourceGroupName string, SQLVirtualMachineName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "sqlVirtualMachineName": autorest.Encode("path", SQLVirtualMachineName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-11-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SqlVirtualMachine/sqlVirtualMachines/{sqlVirtualMachineName}/redeploy", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// RedeploySender sends the Redeploy request. The method will close the +// http.Response Body if it receives an error. +func (client SQLVirtualMachinesClient) RedeploySender(req *http.Request) (future SQLVirtualMachinesRedeployFutureType, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// RedeployResponder handles the response to the Redeploy request. The method always +// closes the http.Response Body. +func (client SQLVirtualMachinesClient) RedeployResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// StartAssessment starts Assessment on SQL virtual machine. +// Parameters: +// resourceGroupName - name of the resource group that contains the resource. You can obtain this value from +// the Azure Resource Manager API or the portal. +// SQLVirtualMachineName - name of the SQL virtual machine. +func (client SQLVirtualMachinesClient) StartAssessment(ctx context.Context, resourceGroupName string, SQLVirtualMachineName string) (result SQLVirtualMachinesStartAssessmentFutureType, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SQLVirtualMachinesClient.StartAssessment") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.StartAssessmentPreparer(ctx, resourceGroupName, SQLVirtualMachineName) + if err != nil { + err = autorest.NewErrorWithError(err, "sqlvirtualmachine.SQLVirtualMachinesClient", "StartAssessment", nil, "Failure preparing request") + return + } + + result, err = client.StartAssessmentSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "sqlvirtualmachine.SQLVirtualMachinesClient", "StartAssessment", result.Response(), "Failure sending request") + return + } + + return +} + +// StartAssessmentPreparer prepares the StartAssessment request. +func (client SQLVirtualMachinesClient) StartAssessmentPreparer(ctx context.Context, resourceGroupName string, SQLVirtualMachineName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "sqlVirtualMachineName": autorest.Encode("path", SQLVirtualMachineName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-11-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SqlVirtualMachine/sqlVirtualMachines/{sqlVirtualMachineName}/startAssessment", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// StartAssessmentSender sends the StartAssessment request. The method will close the +// http.Response Body if it receives an error. +func (client SQLVirtualMachinesClient) StartAssessmentSender(req *http.Request) (future SQLVirtualMachinesStartAssessmentFutureType, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// StartAssessmentResponder handles the response to the StartAssessment request. The method always +// closes the http.Response Body. +func (client SQLVirtualMachinesClient) StartAssessmentResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + // Update updates a SQL virtual machine. // Parameters: // resourceGroupName - name of the resource group that contains the resource. You can obtain this value from @@ -666,7 +825,7 @@ func (client SQLVirtualMachinesClient) UpdatePreparer(ctx context.Context, resou "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-03-01-preview" + const APIVersion = "2021-11-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/sqlvirtualmachine/mgmt/2017-03-01-preview/sqlvirtualmachine/version.go b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/sqlvirtualmachine/mgmt/2021-11-01-preview/sqlvirtualmachine/version.go similarity index 97% rename from vendor/github.com/Azure/azure-sdk-for-go/services/preview/sqlvirtualmachine/mgmt/2017-03-01-preview/sqlvirtualmachine/version.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/preview/sqlvirtualmachine/mgmt/2021-11-01-preview/sqlvirtualmachine/version.go index b2cff4e65bde..5cc4d8057227 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/sqlvirtualmachine/mgmt/2017-03-01-preview/sqlvirtualmachine/version.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/sqlvirtualmachine/mgmt/2021-11-01-preview/sqlvirtualmachine/version.go @@ -10,7 +10,7 @@ import "github.com/Azure/azure-sdk-for-go/version" // UserAgent returns the UserAgent string to use when sending http.Requests. func UserAgent() string { - return "Azure-SDK-For-Go/" + Version() + " sqlvirtualmachine/2017-03-01-preview" + return "Azure-SDK-For-Go/" + Version() + " sqlvirtualmachine/2021-11-01-preview" } // Version returns the semantic version (see http://semver.org) of the client. diff --git a/vendor/modules.txt b/vendor/modules.txt index 049db55ff331..9c4802cb4322 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -85,7 +85,7 @@ github.com/Azure/azure-sdk-for-go/services/preview/servicefabricmesh/mgmt/2018-0 github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2017-03-01-preview/sql github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2018-06-01-preview/sql github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/v5.0/sql -github.com/Azure/azure-sdk-for-go/services/preview/sqlvirtualmachine/mgmt/2017-03-01-preview/sqlvirtualmachine +github.com/Azure/azure-sdk-for-go/services/preview/sqlvirtualmachine/mgmt/2021-11-01-preview/sqlvirtualmachine github.com/Azure/azure-sdk-for-go/services/preview/streamanalytics/mgmt/2020-03-01-preview/streamanalytics github.com/Azure/azure-sdk-for-go/services/preview/synapse/2019-06-01-preview/managedvirtualnetwork github.com/Azure/azure-sdk-for-go/services/preview/synapse/2020-08-01-preview/accesscontrol From e838ed98dcc3fcd71e61f180616aa4556d3a7def Mon Sep 17 00:00:00 2001 From: Ron Truex Date: Tue, 22 Mar 2022 13:49:11 -0700 Subject: [PATCH 02/33] sql updates --- .../sql_virtual_machine_storage_settings.go | 49 +++++++++++++++++++ .../mssql/mssql_virtual_machine_resource.go | 19 ++++--- .../r/mssql_virtual_machine.html.markdown | 20 +++++++- 3 files changed, 81 insertions(+), 7 deletions(-) diff --git a/internal/services/mssql/helper/sql_virtual_machine_storage_settings.go b/internal/services/mssql/helper/sql_virtual_machine_storage_settings.go index 2b5e2956357b..63beed901d6a 100644 --- a/internal/services/mssql/helper/sql_virtual_machine_storage_settings.go +++ b/internal/services/mssql/helper/sql_virtual_machine_storage_settings.go @@ -28,3 +28,52 @@ func StorageSettingSchema() *pluginsdk.Schema { }, } } + +func SQLTempDBStorageSettingSchema() *pluginsdk.Schema { + return &pluginsdk.Schema{ + Type: pluginsdk.TypeList, + Optional: true, + MaxItems: 1, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "data_file_count": { + Type: pluginsdk.TypeInt, + Optional: true, + Default: 8, + }, + "data_file_size": { + Type: pluginsdk.TypeInt, + Optional: true, + Default: 256, + }, + "data_growth": { + Type: pluginsdk.TypeInt, + Optional: true, + Default: 512, + }, + "default_file_path": { + Type: pluginsdk.TypeString, + Required: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + "log_file_size": { + Type: pluginsdk.TypeInt, + Optional: true, + Default: 256, + }, + "log_growth": { + Type: pluginsdk.TypeInt, + Optional: true, + Default: 512, + }, + "luns": { + Type: pluginsdk.TypeList, + Required: true, + Elem: &pluginsdk.Schema{ + Type: pluginsdk.TypeInt, + }, + }, + }, + }, + } +} diff --git a/internal/services/mssql/mssql_virtual_machine_resource.go b/internal/services/mssql/mssql_virtual_machine_resource.go index e3f0ec7665a6..19acedf74041 100644 --- a/internal/services/mssql/mssql_virtual_machine_resource.go +++ b/internal/services/mssql/mssql_virtual_machine_resource.go @@ -285,7 +285,12 @@ func resourceMsSqlVirtualMachine() *pluginsdk.Resource { }, "data_settings": helper.StorageSettingSchema(), "log_settings": helper.StorageSettingSchema(), - "temp_db_settings": helper.StorageSettingSchema(), + "temp_db_settings": helper.SQLTempDBStorageSettingSchema(), + "sql_system_db_on_datadisk": { + Type: pluginsdk.TypeBool, + Optional: true, + Default: false, + }, }, }, }, @@ -798,6 +803,7 @@ func expandSqlVirtualMachineStorageConfigurationSettings(input []interface{}) *s SQLDataSettings: expandSqlVirtualMachineDataStorageSettings(storageSettings["data_settings"].([]interface{})), SQLLogSettings: expandSqlVirtualMachineDataStorageSettings(storageSettings["log_settings"].([]interface{})), SQLTempDbSettings: expandSqlVirtualMachineTempDbSettings(storageSettings["temp_db_settings"].([]interface{})), + SQLSystemDbOnDataDisk: utils.Bool(storageSettings["sql_system_db_on_datadisk"].(bool)), } } @@ -807,11 +813,12 @@ func flattenSqlVirtualMachineStorageConfigurationSettings(input *sqlvirtualmachi } output := map[string]interface{}{ - "storage_workload_type": storageWorkloadType, - "disk_type": string(input.DiskConfigurationType), - "data_settings": flattenSqlVirtualMachineStorageSettings(input.SQLDataSettings), - "log_settings": flattenSqlVirtualMachineStorageSettings(input.SQLLogSettings), - "temp_db_settings": flattenSqlVirtualMachineTempDbSettings(input.SQLTempDbSettings), + "storage_workload_type": storageWorkloadType, + "disk_type": string(input.DiskConfigurationType), + "data_settings": flattenSqlVirtualMachineStorageSettings(input.SQLDataSettings), + "log_settings": flattenSqlVirtualMachineStorageSettings(input.SQLLogSettings), + "temp_db_settings": flattenSqlVirtualMachineTempDbSettings(input.SQLTempDbSettings), + "sql_system_db_on_datadisk": input.SQLSystemDbOnDataDisk, } if output["storage_workload_type"].(string) == "" && output["disk_type"] == "" && diff --git a/website/docs/r/mssql_virtual_machine.html.markdown b/website/docs/r/mssql_virtual_machine.html.markdown index 7b55e865e052..27c77309c71a 100644 --- a/website/docs/r/mssql_virtual_machine.html.markdown +++ b/website/docs/r/mssql_virtual_machine.html.markdown @@ -129,7 +129,7 @@ The `storage_configuration` block supports the following: * `log_settings` - (Optional) An `storage_settings` as defined below. -* `temp_db_settings` - (Optional) An `storage_settings` as defined below. +* `temp_db_settings` - (Optional) An `sqltempdb_storage_settings` as defined below. --- @@ -139,6 +139,24 @@ The `storage_settings` block supports the following: * `luns` - (Required) A list of Logical Unit Numbers for the disks. +--- + +The `sqltempdb_storage_settings` block supports the following: + +* `default_file_path` - (Required) The SQL Server default path + +* `luns` - (Required) A list of Logical Unit Numbers for the disks. + +* `data_file_count` - (Optional) SQL Server default file count - Default 8 + +* `data_file_size` - (Optional) SQL Server default file size - Default 256 + +* `data_growth` - (Optional) SQL Server default file size - Default 512 + +* `log_file_size` - (Optional) SQL Server default file size - Default 256 + +* `log_growth` - (Optional) SQL Server default file size - Default 512 + ## Attributes Reference The following attributes are exported: From 5940a09c30b7b75f01a4f8267699ddc76f94f18a Mon Sep 17 00:00:00 2001 From: Ron Date: Thu, 12 May 2022 13:41:48 -0700 Subject: [PATCH 03/33] Update internal/services/mssql/helper/sql_virtual_machine_storage_settings.go Co-authored-by: kt --- .../mssql/helper/sql_virtual_machine_storage_settings.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/services/mssql/helper/sql_virtual_machine_storage_settings.go b/internal/services/mssql/helper/sql_virtual_machine_storage_settings.go index 63beed901d6a..02c325ad0024 100644 --- a/internal/services/mssql/helper/sql_virtual_machine_storage_settings.go +++ b/internal/services/mssql/helper/sql_virtual_machine_storage_settings.go @@ -56,7 +56,7 @@ func SQLTempDBStorageSettingSchema() *pluginsdk.Schema { Required: true, ValidateFunc: validation.StringIsNotEmpty, }, - "log_file_size": { + "log_file_size_mb": { Type: pluginsdk.TypeInt, Optional: true, Default: 256, From 730ae2fc7397f307f6623839ca2b82cc0494a502 Mon Sep 17 00:00:00 2001 From: Ron Date: Thu, 12 May 2022 13:41:57 -0700 Subject: [PATCH 04/33] Update internal/services/mssql/helper/sql_virtual_machine_storage_settings.go Co-authored-by: kt --- .../mssql/helper/sql_virtual_machine_storage_settings.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/services/mssql/helper/sql_virtual_machine_storage_settings.go b/internal/services/mssql/helper/sql_virtual_machine_storage_settings.go index 02c325ad0024..459946734987 100644 --- a/internal/services/mssql/helper/sql_virtual_machine_storage_settings.go +++ b/internal/services/mssql/helper/sql_virtual_machine_storage_settings.go @@ -46,7 +46,7 @@ func SQLTempDBStorageSettingSchema() *pluginsdk.Schema { Optional: true, Default: 256, }, - "data_growth": { + "data_file_growth_in_mb": { Type: pluginsdk.TypeInt, Optional: true, Default: 512, From 64b24ba47864bca5f3ada1fd885dcdc0a2b9d5e4 Mon Sep 17 00:00:00 2001 From: Ron Date: Thu, 12 May 2022 13:42:08 -0700 Subject: [PATCH 05/33] Update internal/services/mssql/helper/sql_virtual_machine_storage_settings.go Co-authored-by: kt --- .../mssql/helper/sql_virtual_machine_storage_settings.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/services/mssql/helper/sql_virtual_machine_storage_settings.go b/internal/services/mssql/helper/sql_virtual_machine_storage_settings.go index 459946734987..0a0da621cf44 100644 --- a/internal/services/mssql/helper/sql_virtual_machine_storage_settings.go +++ b/internal/services/mssql/helper/sql_virtual_machine_storage_settings.go @@ -41,7 +41,7 @@ func SQLTempDBStorageSettingSchema() *pluginsdk.Schema { Optional: true, Default: 8, }, - "data_file_size": { + "data_file_size_mb": { Type: pluginsdk.TypeInt, Optional: true, Default: 256, From eca962d65f4d68938c0b3df07cc215c2b336504a Mon Sep 17 00:00:00 2001 From: Ron Date: Thu, 12 May 2022 13:42:15 -0700 Subject: [PATCH 06/33] Update internal/services/mssql/helper/sql_virtual_machine_storage_settings.go Co-authored-by: kt --- .../mssql/helper/sql_virtual_machine_storage_settings.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/services/mssql/helper/sql_virtual_machine_storage_settings.go b/internal/services/mssql/helper/sql_virtual_machine_storage_settings.go index 0a0da621cf44..5f80a8cf85e9 100644 --- a/internal/services/mssql/helper/sql_virtual_machine_storage_settings.go +++ b/internal/services/mssql/helper/sql_virtual_machine_storage_settings.go @@ -61,7 +61,7 @@ func SQLTempDBStorageSettingSchema() *pluginsdk.Schema { Optional: true, Default: 256, }, - "log_growth": { + "log_file_growth_mb": { Type: pluginsdk.TypeInt, Optional: true, Default: 512, From 916fee7e238385884b6d81e81cc3754859996f78 Mon Sep 17 00:00:00 2001 From: Ron Date: Thu, 12 May 2022 13:49:41 -0700 Subject: [PATCH 07/33] Update internal/services/mssql/mssql_virtual_machine_resource.go Co-authored-by: kt --- internal/services/mssql/mssql_virtual_machine_resource.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/services/mssql/mssql_virtual_machine_resource.go b/internal/services/mssql/mssql_virtual_machine_resource.go index ce904451c793..5456f3870865 100644 --- a/internal/services/mssql/mssql_virtual_machine_resource.go +++ b/internal/services/mssql/mssql_virtual_machine_resource.go @@ -286,7 +286,7 @@ func resourceMsSqlVirtualMachine() *pluginsdk.Resource { "data_settings": helper.StorageSettingSchema(), "log_settings": helper.StorageSettingSchema(), "temp_db_settings": helper.SQLTempDBStorageSettingSchema(), - "sql_system_db_on_datadisk": { + "system_db_on_datadisk_enabled": { Type: pluginsdk.TypeBool, Optional: true, Default: false, From e673a25b78f9e167424206f5c7e772fbee363a23 Mon Sep 17 00:00:00 2001 From: Ron Date: Thu, 12 May 2022 20:49:29 -0700 Subject: [PATCH 08/33] Update mssql_virtual_machine.html.markdown --- website/docs/r/mssql_virtual_machine.html.markdown | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/website/docs/r/mssql_virtual_machine.html.markdown b/website/docs/r/mssql_virtual_machine.html.markdown index 8893b6dfff6d..463882a949f7 100644 --- a/website/docs/r/mssql_virtual_machine.html.markdown +++ b/website/docs/r/mssql_virtual_machine.html.markdown @@ -149,13 +149,13 @@ The `sqltempdb_storage_settings` block supports the following: * `data_file_count` - (Optional) SQL Server default file count - Default 8 -* `data_file_size` - (Optional) SQL Server default file size - Default 256 +* `data_file_size_mb` - (Optional) SQL Server default file size - Default 256 -* `data_growth` - (Optional) SQL Server default file size - Default 512 +* `data_file_growth_in_mb` - (Optional) SQL Server default file size - Default 512 -* `log_file_size` - (Optional) SQL Server default file size - Default 256 +* `log_file_size_mb` - (Optional) SQL Server default file size - Default 256 -* `log_growth` - (Optional) SQL Server default file size - Default 512 +* `log_file_growth_mb` - (Optional) SQL Server default file size - Default 512 ## Attributes Reference From 764987d387bafa3cc773b52b0af22257191cd0c1 Mon Sep 17 00:00:00 2001 From: Ron Date: Thu, 12 May 2022 21:04:44 -0700 Subject: [PATCH 09/33] Update mssql_virtual_machine_resource.go --- .../mssql/mssql_virtual_machine_resource.go | 39 +++++++++++++++---- 1 file changed, 32 insertions(+), 7 deletions(-) diff --git a/internal/services/mssql/mssql_virtual_machine_resource.go b/internal/services/mssql/mssql_virtual_machine_resource.go index 5456f3870865..42b4a44698e4 100644 --- a/internal/services/mssql/mssql_virtual_machine_resource.go +++ b/internal/services/mssql/mssql_virtual_machine_resource.go @@ -875,11 +875,16 @@ func expandSqlVirtualMachineTempDbSettings(input []interface{}) *sqlvirtualmachi if len(input) == 0 || input[0] == nil { return nil } - dataStorageSettings := input[0].(map[string]interface{}) + tempDbSettings := input[0].(map[string]interface{}) return &sqlvirtualmachine.SQLTempDbSettings{ - Luns: expandSqlVirtualMachineStorageSettingsLuns(dataStorageSettings["luns"].([]interface{})), - DefaultFilePath: utils.String(dataStorageSettings["default_file_path"].(string)), + luns: expandSqlVirtualMachineStorageSettingsLuns(tempDbSettings["luns"].([]interface{})), + data_file_count: utils.Int32(int32(tempDbSettings.Get("data_file_count").(int))), + data_file_size_mb: utils.Int32(int32(tempDbSettings.Get("data_file_size_mb").(int))), + data_file_growth_in_mb: utils.Int32(int32(tempDbSettings.Get("data_file_growth_in_mb").(int))), + default_file_path: utils.String(tempDbSettings["default_file_path"].(string)), + log_file_size_mb: utils.Int32(int32(tempDbSettings.Get("log_file_size_mb").(int))), + log_file_growth_mb: utils.Int32(int32(tempDbSettings.Get("log_file_growth_mb").(int))) } } @@ -889,12 +894,32 @@ func flattenSqlVirtualMachineTempDbSettings(input *sqlvirtualmachine.SQLTempDbSe } attrs := make(map[string]interface{}) - if input.Luns != nil { - attrs["luns"] = *input.Luns + if input.luns != nil { + attrs["luns"] = *input.luns } - if input.DefaultFilePath != nil { - attrs["default_file_path"] = *input.DefaultFilePath + if input.data_file_count != nil { + attrs["data_file_count"] = *input.data_file_count + } + + if input.data_file_size_mb != nil { + attrs["data_file_size_mb"] = *input.data_file_size_mb + } + + if input.data_file_growth_in_mb != nil { + attrs["data_file_growth_in_mb"] = *input.data_file_growth_in_mb + } + + if input.default_file_path != nil { + attrs["default_file_path"] = *input.default_file_path + } + + if input.log_file_size_mb != nil { + attrs["log_file_size_mb"] = *input.log_file_size_mb + } + + if input.log_file_growth_mb != nil { + attrs["log_file_growth_mb"] = *input.log_file_growth_mb } return []interface{}{attrs} From 8f6b48de821b95e721ed4c42ff44c3877a7cfde0 Mon Sep 17 00:00:00 2001 From: Ron Date: Thu, 12 May 2022 21:16:50 -0700 Subject: [PATCH 10/33] Update mssql_virtual_machine_resource_test.go --- .../services/mssql/mssql_virtual_machine_resource_test.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/internal/services/mssql/mssql_virtual_machine_resource_test.go b/internal/services/mssql/mssql_virtual_machine_resource_test.go index 492b1b8a1d91..f171f97cdff7 100644 --- a/internal/services/mssql/mssql_virtual_machine_resource_test.go +++ b/internal/services/mssql/mssql_virtual_machine_resource_test.go @@ -633,8 +633,9 @@ resource "azurerm_mssql_virtual_machine" "test" { sql_license_type = "PAYG" storage_configuration { - disk_type = "NEW" - storage_workload_type = "OLTP" + disk_type = "NEW" + storage_workload_type = "OLTP" + system_db_on_datadisk_enabled = true data_settings { luns = [0] @@ -649,6 +650,7 @@ resource "azurerm_mssql_virtual_machine" "test" { temp_db_settings { luns = [0] default_file_path = "F:\\SQLTemp" + log_file_size_mb = 512 } } } From 67fd5308a89071cb2752cc089b4b7b648b63d7c1 Mon Sep 17 00:00:00 2001 From: Ron Date: Fri, 13 May 2022 07:36:06 -0700 Subject: [PATCH 11/33] Update mssql_virtual_machine_resource.go --- .../mssql/mssql_virtual_machine_resource.go | 42 +++++++++---------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/internal/services/mssql/mssql_virtual_machine_resource.go b/internal/services/mssql/mssql_virtual_machine_resource.go index 42b4a44698e4..dc60ca2282b9 100644 --- a/internal/services/mssql/mssql_virtual_machine_resource.go +++ b/internal/services/mssql/mssql_virtual_machine_resource.go @@ -878,13 +878,13 @@ func expandSqlVirtualMachineTempDbSettings(input []interface{}) *sqlvirtualmachi tempDbSettings := input[0].(map[string]interface{}) return &sqlvirtualmachine.SQLTempDbSettings{ - luns: expandSqlVirtualMachineStorageSettingsLuns(tempDbSettings["luns"].([]interface{})), - data_file_count: utils.Int32(int32(tempDbSettings.Get("data_file_count").(int))), - data_file_size_mb: utils.Int32(int32(tempDbSettings.Get("data_file_size_mb").(int))), - data_file_growth_in_mb: utils.Int32(int32(tempDbSettings.Get("data_file_growth_in_mb").(int))), - default_file_path: utils.String(tempDbSettings["default_file_path"].(string)), - log_file_size_mb: utils.Int32(int32(tempDbSettings.Get("log_file_size_mb").(int))), - log_file_growth_mb: utils.Int32(int32(tempDbSettings.Get("log_file_growth_mb").(int))) + Luns: expandSqlVirtualMachineStorageSettingsLuns(tempDbSettings["luns"].([]interface{})), + DataFileCount: utils.Int32(int32(tempDbSettings.Get("data_file_count").(int))), + DataFileSize: utils.Int32(int32(tempDbSettings.Get("data_file_size_mb").(int))), + DataGrowth: utils.Int32(int32(tempDbSettings.Get("data_file_growth_in_mb").(int))), + DefaultFilePath: utils.String(tempDbSettings["default_file_path"].(string)), + LogFileSize: utils.Int32(int32(tempDbSettings.Get("log_file_size_mb").(int))), + LogGrowth: utils.Int32(int32(tempDbSettings.Get("log_file_growth_mb").(int))) } } @@ -894,32 +894,32 @@ func flattenSqlVirtualMachineTempDbSettings(input *sqlvirtualmachine.SQLTempDbSe } attrs := make(map[string]interface{}) - if input.luns != nil { - attrs["luns"] = *input.luns + if input.Luns != nil { + attrs["luns"] = *input.Luns } - if input.data_file_count != nil { - attrs["data_file_count"] = *input.data_file_count + if input.DataFileCount != nil { + attrs["data_file_count"] = *input.DataFileCount } - if input.data_file_size_mb != nil { - attrs["data_file_size_mb"] = *input.data_file_size_mb + if input.DataFileSize != nil { + attrs["data_file_size_mb"] = *input.DataFileSize } - if input.data_file_growth_in_mb != nil { - attrs["data_file_growth_in_mb"] = *input.data_file_growth_in_mb + if input.DataGrowth != nil { + attrs["data_file_growth_in_mb"] = *input.DataGrowth } - if input.default_file_path != nil { - attrs["default_file_path"] = *input.default_file_path + if input.DefaultFilePath != nil { + attrs["default_file_path"] = *input.DefaultFilePath } - if input.log_file_size_mb != nil { - attrs["log_file_size_mb"] = *input.log_file_size_mb + if input.LogFileSize != nil { + attrs["log_file_size_mb"] = *input.LogFileSize } - if input.log_file_growth_mb != nil { - attrs["log_file_growth_mb"] = *input.log_file_growth_mb + if input.LogGrowth != nil { + attrs["log_file_growth_mb"] = *input.LogGrowth } return []interface{}{attrs} From 26805c9214ae125db1a0d030d140334454a90ade Mon Sep 17 00:00:00 2001 From: Ron Date: Fri, 20 May 2022 19:39:28 -0700 Subject: [PATCH 12/33] Update mssql_virtual_machine_resource.go fixed issue with comma --- internal/services/mssql/mssql_virtual_machine_resource.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/services/mssql/mssql_virtual_machine_resource.go b/internal/services/mssql/mssql_virtual_machine_resource.go index dc60ca2282b9..315d317ea498 100644 --- a/internal/services/mssql/mssql_virtual_machine_resource.go +++ b/internal/services/mssql/mssql_virtual_machine_resource.go @@ -884,7 +884,7 @@ func expandSqlVirtualMachineTempDbSettings(input []interface{}) *sqlvirtualmachi DataGrowth: utils.Int32(int32(tempDbSettings.Get("data_file_growth_in_mb").(int))), DefaultFilePath: utils.String(tempDbSettings["default_file_path"].(string)), LogFileSize: utils.Int32(int32(tempDbSettings.Get("log_file_size_mb").(int))), - LogGrowth: utils.Int32(int32(tempDbSettings.Get("log_file_growth_mb").(int))) + LogGrowth: utils.Int32(int32(tempDbSettings.Get("log_file_growth_mb").(int))), } } From 1ff4bba0e9d24ddd47e35f5797db7f65cb6c4bea Mon Sep 17 00:00:00 2001 From: Ron Truex Date: Wed, 25 May 2022 21:20:55 -0700 Subject: [PATCH 13/33] ran gofmt on code --- .../mssql/mssql_virtual_machine_resource.go | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/internal/services/mssql/mssql_virtual_machine_resource.go b/internal/services/mssql/mssql_virtual_machine_resource.go index 315d317ea498..e80d61a12e48 100644 --- a/internal/services/mssql/mssql_virtual_machine_resource.go +++ b/internal/services/mssql/mssql_virtual_machine_resource.go @@ -813,12 +813,12 @@ func flattenSqlVirtualMachineStorageConfigurationSettings(input *sqlvirtualmachi } output := map[string]interface{}{ - "storage_workload_type": storageWorkloadType, - "disk_type": string(input.DiskConfigurationType), - "data_settings": flattenSqlVirtualMachineStorageSettings(input.SQLDataSettings), - "log_settings": flattenSqlVirtualMachineStorageSettings(input.SQLLogSettings), - "temp_db_settings": flattenSqlVirtualMachineTempDbSettings(input.SQLTempDbSettings), - "sql_system_db_on_datadisk": input.SQLSystemDbOnDataDisk, + "storage_workload_type": storageWorkloadType, + "disk_type": string(input.DiskConfigurationType), + "data_settings": flattenSqlVirtualMachineStorageSettings(input.SQLDataSettings), + "log_settings": flattenSqlVirtualMachineStorageSettings(input.SQLLogSettings), + "temp_db_settings": flattenSqlVirtualMachineTempDbSettings(input.SQLTempDbSettings), + "sql_system_db_on_datadisk": input.SQLSystemDbOnDataDisk, } if output["storage_workload_type"].(string) == "" && output["disk_type"] == "" && @@ -878,13 +878,13 @@ func expandSqlVirtualMachineTempDbSettings(input []interface{}) *sqlvirtualmachi tempDbSettings := input[0].(map[string]interface{}) return &sqlvirtualmachine.SQLTempDbSettings{ - Luns: expandSqlVirtualMachineStorageSettingsLuns(tempDbSettings["luns"].([]interface{})), - DataFileCount: utils.Int32(int32(tempDbSettings.Get("data_file_count").(int))), - DataFileSize: utils.Int32(int32(tempDbSettings.Get("data_file_size_mb").(int))), - DataGrowth: utils.Int32(int32(tempDbSettings.Get("data_file_growth_in_mb").(int))), - DefaultFilePath: utils.String(tempDbSettings["default_file_path"].(string)), - LogFileSize: utils.Int32(int32(tempDbSettings.Get("log_file_size_mb").(int))), - LogGrowth: utils.Int32(int32(tempDbSettings.Get("log_file_growth_mb").(int))), + Luns: expandSqlVirtualMachineStorageSettingsLuns(tempDbSettings["luns"].([]interface{})), + DataFileCount: utils.Int32(int32(tempDbSettings.Get("data_file_count").(int))), + DataFileSize: utils.Int32(int32(tempDbSettings.Get("data_file_size_mb").(int))), + DataGrowth: utils.Int32(int32(tempDbSettings.Get("data_file_growth_in_mb").(int))), + DefaultFilePath: utils.String(tempDbSettings["default_file_path"].(string)), + LogFileSize: utils.Int32(int32(tempDbSettings.Get("log_file_size_mb").(int))), + LogGrowth: utils.Int32(int32(tempDbSettings.Get("log_file_growth_mb").(int))), } } From cac7f1e31999eb98bc6c5e4fa2e38177ca2e6f30 Mon Sep 17 00:00:00 2001 From: Ron Date: Wed, 25 May 2022 21:40:04 -0700 Subject: [PATCH 14/33] Update mssql_virtual_machine_resource.go object doesn't have .get --- .../services/mssql/mssql_virtual_machine_resource.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/internal/services/mssql/mssql_virtual_machine_resource.go b/internal/services/mssql/mssql_virtual_machine_resource.go index e80d61a12e48..f0b8c7245d2a 100644 --- a/internal/services/mssql/mssql_virtual_machine_resource.go +++ b/internal/services/mssql/mssql_virtual_machine_resource.go @@ -879,12 +879,12 @@ func expandSqlVirtualMachineTempDbSettings(input []interface{}) *sqlvirtualmachi return &sqlvirtualmachine.SQLTempDbSettings{ Luns: expandSqlVirtualMachineStorageSettingsLuns(tempDbSettings["luns"].([]interface{})), - DataFileCount: utils.Int32(int32(tempDbSettings.Get("data_file_count").(int))), - DataFileSize: utils.Int32(int32(tempDbSettings.Get("data_file_size_mb").(int))), - DataGrowth: utils.Int32(int32(tempDbSettings.Get("data_file_growth_in_mb").(int))), + DataFileCount: utils.Int32(int32(tempDbSettings["data_file_count"].(int))), + DataFileSize: utils.Int32(int32(tempDbSettings["data_file_size_mb"].(int))), + DataGrowth: utils.Int32(int32(tempDbSettings["data_file_growth_in_mb"].(int))), DefaultFilePath: utils.String(tempDbSettings["default_file_path"].(string)), - LogFileSize: utils.Int32(int32(tempDbSettings.Get("log_file_size_mb").(int))), - LogGrowth: utils.Int32(int32(tempDbSettings.Get("log_file_growth_mb").(int))), + LogFileSize: utils.Int32(int32(tempDbSettings["log_file_size_mb"].(int))), + LogGrowth: utils.Int32(int32(tempDbSettings["log_file_growth_mb"].(int))), } } From 1df346fde44532505d1fc88b058f20438cdf14e8 Mon Sep 17 00:00:00 2001 From: Ron Date: Thu, 2 Jun 2022 09:12:36 -0700 Subject: [PATCH 15/33] Update mssql_virtual_machine_resource.go added update to allow enabling of assesment --- .../mssql/mssql_virtual_machine_resource.go | 104 ++++++++++++++++++ 1 file changed, 104 insertions(+) diff --git a/internal/services/mssql/mssql_virtual_machine_resource.go b/internal/services/mssql/mssql_virtual_machine_resource.go index f0b8c7245d2a..f5dc471aa0fd 100644 --- a/internal/services/mssql/mssql_virtual_machine_resource.go +++ b/internal/services/mssql/mssql_virtual_machine_resource.go @@ -180,6 +180,45 @@ func resourceMsSqlVirtualMachine() *pluginsdk.Resource { }, }, }, + + "assessment_settings": { + Type: pluginsdk.TypeList, + Optional: true, + MaxItems: 1, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "schedule": { + Type: pluginsdk.TypeList, + Optional: false, + MaxItems: 1, + Elem: &pluginsdk.Resource{ + "weekly_interval": { + Type: pluginsdk.TypeInt, + Optional: true, + }, + "monthly_occurrence ": { + Type: pluginsdk.TypeInt, + Optional: true, + }, + "day_of_week ": { + Type: pluginsdk.TypeInt, + Optional: true, + }, + "start_time ": { + Type: pluginsdk.TypeString, + Optional: true, + }, + ), + }, + + "run_immediately": { + Type: pluginsdk.TypeBool, + Optional: true, + Default: false, + }, + }, + }, + }, "key_vault_credential": { Type: pluginsdk.TypeList, @@ -364,6 +403,7 @@ func resourceMsSqlVirtualMachineCreateUpdate(d *pluginsdk.ResourceData, meta int SQLManagement: sqlvirtualmachine.SQLManagementModeFull, AutoBackupSettings: expandSqlVirtualMachineAutoBackupSettings(d.Get("auto_backup").([]interface{})), AutoPatchingSettings: expandSqlVirtualMachineAutoPatchingSettings(d.Get("auto_patching").([]interface{})), + AssessmentSettings: expandSqlVirtualMachineAssessmentSettings(d.Get("assessment_settings").([]interface{})), KeyVaultCredentialSettings: expandSqlVirtualMachineKeyVaultCredential(d.Get("key_vault_credential").([]interface{})), ServerConfigurationsManagementSettings: &sqlvirtualmachine.ServerConfigurationsManagementSettings{ AdditionalFeaturesServerConfigurations: &sqlvirtualmachine.AdditionalFeaturesServerConfigurations{ @@ -729,6 +769,70 @@ func flattenSqlVirtualMachineAutoPatching(autoPatching *sqlvirtualmachine.AutoPa }, } } + +func expandSqlVirtualMachineAssessmentSettings(input []interface{}) *sqlvirtualmachine.AssessmentSettings { + if len(input) == 0 { + return nil + } + assessmentSetting := input[0].(map[string]interface{}) + + if len(assessmentSetting["schedule"]) == 0 { + schedule_data := nil + } + else { + schedule_data := &sqlvirtualmachine.Schedule{ + Enable: utils.Bool(true), + WeeklyInterval: utils.Int32(int32(autoPatchingSetting["weekly_interval"].(int))), + MonthlyOccurrence: utils.Int32(int32(autoPatchingSetting["monthly_occurrence"].(int))), + DayOfWeek: sqlvirtualmachine.DayOfWeek(autoPatchingSetting["day_of_week"].(string)), + StartTime: autoPatchingSetting["start_time"] + } + } + return &sqlvirtualmachine.AssessmentSettings{ + Enable: utils.Bool(true), + RunImmediately: utils.Bool(assessmentSetting["run_immediately"].(bool)), + schedule: schedule_data, + } +} + +func flattenSqlVirtualMachineAssessmentSettings(assessmentSettings *sqlvirtualmachine.AssessmentSettings) []interface{} { + if assessmentSettings == nil || assessmentSettings.Enable == nil || !*assessmentSettings.Enable { + return []interface{}{} + } + + var runImmediately bool + if assessmentSettings.RunImmediately != nil { + runImmediately = *assessmentSettings.RunImmediately + } + + var schedule *sqlvirtualmachine.Schedule + if assessmentSettings.Schedule != nil { + var weeklyInterval int32 + var monthlyOccurrence int32 + if assessmentSettings.Schedule.WeeklyInterval != nil { + weeklyInterval = *assessmentSettings.Schedule.WeeklyInterval + } + if assessmentSettings.Schedule.MonthlyOccurrence != nil { + monthlyOccurrence = *assessmentSettings.Schedule.MonthlyOccurrence + } + + schedule = map[string]interface{}{ + "weekly_interval": weeklyInterval, + "schedule": schedule, + "day_of_week": string(assessmentSettings.Schedule.DayOfWeek), + "start_time": string(assessmentSettings.Schedule.StartTime ), + } + + + } + + return []interface{}{ + map[string]interface{}{ + "run_immediately": runImmediately, + "schedule": schedule, + }, + } +} func expandSqlVirtualMachineKeyVaultCredential(input []interface{}) *sqlvirtualmachine.KeyVaultCredentialSettings { if len(input) == 0 { From 87b8b23cfbe94898f618207df63e838b3f38077f Mon Sep 17 00:00:00 2001 From: Ron Date: Thu, 2 Jun 2022 09:13:34 -0700 Subject: [PATCH 16/33] Update mssql_virtual_machine_resource.go --- internal/services/mssql/mssql_virtual_machine_resource.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/services/mssql/mssql_virtual_machine_resource.go b/internal/services/mssql/mssql_virtual_machine_resource.go index f5dc471aa0fd..bba13db4a33b 100644 --- a/internal/services/mssql/mssql_virtual_machine_resource.go +++ b/internal/services/mssql/mssql_virtual_machine_resource.go @@ -189,7 +189,7 @@ func resourceMsSqlVirtualMachine() *pluginsdk.Resource { Schema: map[string]*pluginsdk.Schema{ "schedule": { Type: pluginsdk.TypeList, - Optional: false, + Optional: true, MaxItems: 1, Elem: &pluginsdk.Resource{ "weekly_interval": { From 4ace7204e82c7bf6df9bf7549f9dbb1fd1c20fa9 Mon Sep 17 00:00:00 2001 From: Ron Date: Thu, 2 Jun 2022 09:16:07 -0700 Subject: [PATCH 17/33] Update mssql_virtual_machine_resource_test.go --- .../services/mssql/mssql_virtual_machine_resource_test.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/internal/services/mssql/mssql_virtual_machine_resource_test.go b/internal/services/mssql/mssql_virtual_machine_resource_test.go index f171f97cdff7..2b578b27ec46 100644 --- a/internal/services/mssql/mssql_virtual_machine_resource_test.go +++ b/internal/services/mssql/mssql_virtual_machine_resource_test.go @@ -631,7 +631,9 @@ resource "azurerm_virtual_machine_data_disk_attachment" "test" { resource "azurerm_mssql_virtual_machine" "test" { virtual_machine_id = azurerm_virtual_machine.test.id sql_license_type = "PAYG" - + + assessment_settings {} + storage_configuration { disk_type = "NEW" storage_workload_type = "OLTP" From b55d31cda25888dc67609e93f1d60f20f7b5a493 Mon Sep 17 00:00:00 2001 From: Ron Date: Mon, 6 Jun 2022 19:10:51 -0700 Subject: [PATCH 18/33] Update mssql_virtual_machine_resource.go added forgotten invocation --- internal/services/mssql/mssql_virtual_machine_resource.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/internal/services/mssql/mssql_virtual_machine_resource.go b/internal/services/mssql/mssql_virtual_machine_resource.go index bba13db4a33b..7d7c2a2b415b 100644 --- a/internal/services/mssql/mssql_virtual_machine_resource.go +++ b/internal/services/mssql/mssql_virtual_machine_resource.go @@ -495,6 +495,10 @@ func resourceMsSqlVirtualMachineRead(d *pluginsdk.ResourceData, meta interface{} if err := d.Set("auto_patching", flattenSqlVirtualMachineAutoPatching(props.AutoPatchingSettings)); err != nil { return fmt.Errorf("setting `auto_patching`: %+v", err) } + + if err := d.Set("assessment_settings", flattenSqlVirtualMachineAssessmentSettings(props.AssessmentSettings)); err != nil { + return fmt.Errorf("setting `assessment_settings`: %+v", err) + } if err := d.Set("key_vault_credential", flattenSqlVirtualMachineKeyVaultCredential(props.KeyVaultCredentialSettings, d)); err != nil { return fmt.Errorf("setting `key_vault_credential`: %+v", err) From de7c0921ffcc1e9c72ce8b791a2b32c313d2d1b5 Mon Sep 17 00:00:00 2001 From: Ron Date: Mon, 6 Jun 2022 19:14:15 -0700 Subject: [PATCH 19/33] Update mssql_virtual_machine_resource.go removed trailing space --- .../services/mssql/mssql_virtual_machine_resource.go | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/internal/services/mssql/mssql_virtual_machine_resource.go b/internal/services/mssql/mssql_virtual_machine_resource.go index 7d7c2a2b415b..106daedd26fd 100644 --- a/internal/services/mssql/mssql_virtual_machine_resource.go +++ b/internal/services/mssql/mssql_virtual_machine_resource.go @@ -196,15 +196,15 @@ func resourceMsSqlVirtualMachine() *pluginsdk.Resource { Type: pluginsdk.TypeInt, Optional: true, }, - "monthly_occurrence ": { + "monthly_occurrence": { Type: pluginsdk.TypeInt, Optional: true, }, - "day_of_week ": { + "day_of_week": { Type: pluginsdk.TypeInt, Optional: true, }, - "start_time ": { + "start_time": { Type: pluginsdk.TypeString, Optional: true, }, @@ -826,8 +826,7 @@ func flattenSqlVirtualMachineAssessmentSettings(assessmentSettings *sqlvirtualma "day_of_week": string(assessmentSettings.Schedule.DayOfWeek), "start_time": string(assessmentSettings.Schedule.StartTime ), } - - + } return []interface{}{ From 4e967bf2eaabf79bc4a7cf48976d7cc13a1d2a01 Mon Sep 17 00:00:00 2001 From: Ron Date: Mon, 6 Jun 2022 19:16:12 -0700 Subject: [PATCH 20/33] Update mssql_virtual_machine_resource_test.go added new test --- .../mssql_virtual_machine_resource_test.go | 50 +++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/internal/services/mssql/mssql_virtual_machine_resource_test.go b/internal/services/mssql/mssql_virtual_machine_resource_test.go index 2b578b27ec46..1741955f2de0 100644 --- a/internal/services/mssql/mssql_virtual_machine_resource_test.go +++ b/internal/services/mssql/mssql_virtual_machine_resource_test.go @@ -608,6 +608,56 @@ resource "azurerm_mssql_virtual_machine" "test" { `, r.template(data), data.RandomInteger) } +func (r MsSqlVirtualMachineResource) storageConfiguration(data acceptance.TestData) string { + return fmt.Sprintf(` +%[1]s + +resource "azurerm_managed_disk" "test" { + name = "accmd-sqlvm-%[2]d" + location = azurerm_resource_group.test.location + resource_group_name = azurerm_resource_group.test.name + storage_account_type = "Standard_LRS" + create_option = "Empty" + disk_size_gb = 10 +} + +resource "azurerm_virtual_machine_data_disk_attachment" "test" { + managed_disk_id = azurerm_managed_disk.test.id + virtual_machine_id = azurerm_virtual_machine.test.id + lun = "0" + caching = "None" +} + +resource "azurerm_mssql_virtual_machine" "test" { + virtual_machine_id = azurerm_virtual_machine.test.id + sql_license_type = "PAYG" + + storage_configuration { + disk_type = "NEW" + storage_workload_type = "OLTP" + system_db_on_datadisk_enabled = true + + data_settings { + luns = [0] + default_file_path = "F:\\SQLData" + } + + log_settings { + luns = [0] + default_file_path = "F:\\SQLLog" + } + + temp_db_settings { + luns = [0] + default_file_path = "F:\\SQLTemp" + log_file_size_mb = 512 + } + } +} +`, r.template(data), data.RandomInteger) +} + + func (r MsSqlVirtualMachineResource) storageConfiguration(data acceptance.TestData) string { return fmt.Sprintf(` %[1]s From 4ed6162f5d4119dbaffc6cb22ff3ada239cd55c8 Mon Sep 17 00:00:00 2001 From: Ron Date: Mon, 6 Jun 2022 19:17:02 -0700 Subject: [PATCH 21/33] Update mssql_virtual_machine_resource.go removed extra space --- internal/services/mssql/mssql_virtual_machine_resource.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/internal/services/mssql/mssql_virtual_machine_resource.go b/internal/services/mssql/mssql_virtual_machine_resource.go index 106daedd26fd..377318433531 100644 --- a/internal/services/mssql/mssql_virtual_machine_resource.go +++ b/internal/services/mssql/mssql_virtual_machine_resource.go @@ -825,8 +825,7 @@ func flattenSqlVirtualMachineAssessmentSettings(assessmentSettings *sqlvirtualma "schedule": schedule, "day_of_week": string(assessmentSettings.Schedule.DayOfWeek), "start_time": string(assessmentSettings.Schedule.StartTime ), - } - + } } return []interface{}{ From 8bf6a2fd1fa2a36a7d328de60fb86f041f2b16be Mon Sep 17 00:00:00 2001 From: Ron Truex Date: Wed, 8 Jun 2022 08:25:01 -0700 Subject: [PATCH 22/33] gofmt -s updates --- .../mssql/mssql_virtual_machine_resource.go | 59 +++++++++---------- .../mssql_virtual_machine_resource_test.go | 1 - 2 files changed, 29 insertions(+), 31 deletions(-) diff --git a/internal/services/mssql/mssql_virtual_machine_resource.go b/internal/services/mssql/mssql_virtual_machine_resource.go index 377318433531..915d06e1ece8 100644 --- a/internal/services/mssql/mssql_virtual_machine_resource.go +++ b/internal/services/mssql/mssql_virtual_machine_resource.go @@ -180,7 +180,7 @@ func resourceMsSqlVirtualMachine() *pluginsdk.Resource { }, }, }, - + "assessment_settings": { Type: pluginsdk.TypeList, Optional: true, @@ -208,7 +208,7 @@ func resourceMsSqlVirtualMachine() *pluginsdk.Resource { Type: pluginsdk.TypeString, Optional: true, }, - ), + }, }, "run_immediately": { @@ -495,7 +495,7 @@ func resourceMsSqlVirtualMachineRead(d *pluginsdk.ResourceData, meta interface{} if err := d.Set("auto_patching", flattenSqlVirtualMachineAutoPatching(props.AutoPatchingSettings)); err != nil { return fmt.Errorf("setting `auto_patching`: %+v", err) } - + if err := d.Set("assessment_settings", flattenSqlVirtualMachineAssessmentSettings(props.AssessmentSettings)); err != nil { return fmt.Errorf("setting `assessment_settings`: %+v", err) } @@ -773,65 +773,64 @@ func flattenSqlVirtualMachineAutoPatching(autoPatching *sqlvirtualmachine.AutoPa }, } } - + func expandSqlVirtualMachineAssessmentSettings(input []interface{}) *sqlvirtualmachine.AssessmentSettings { if len(input) == 0 { return nil } assessmentSetting := input[0].(map[string]interface{}) - + if len(assessmentSetting["schedule"]) == 0 { schedule_data := nil - } - else { + } else { schedule_data := &sqlvirtualmachine.Schedule{ - Enable: utils.Bool(true), - WeeklyInterval: utils.Int32(int32(autoPatchingSetting["weekly_interval"].(int))), - MonthlyOccurrence: utils.Int32(int32(autoPatchingSetting["monthly_occurrence"].(int))), - DayOfWeek: sqlvirtualmachine.DayOfWeek(autoPatchingSetting["day_of_week"].(string)), - StartTime: autoPatchingSetting["start_time"] + Enable: utils.Bool(true), + WeeklyInterval: utils.Int32(int32(autoPatchingSetting["weekly_interval"].(int))), + MonthlyOccurrence: utils.Int32(int32(autoPatchingSetting["monthly_occurrence"].(int))), + DayOfWeek: sqlvirtualmachine.DayOfWeek(autoPatchingSetting["day_of_week"].(string)), + StartTime: autoPatchingSetting["start_time"], } } return &sqlvirtualmachine.AssessmentSettings{ - Enable: utils.Bool(true), - RunImmediately: utils.Bool(assessmentSetting["run_immediately"].(bool)), - schedule: schedule_data, + Enable: utils.Bool(true), + RunImmediately: utils.Bool(assessmentSetting["run_immediately"].(bool)), + schedule: schedule_data, } } - + func flattenSqlVirtualMachineAssessmentSettings(assessmentSettings *sqlvirtualmachine.AssessmentSettings) []interface{} { if assessmentSettings == nil || assessmentSettings.Enable == nil || !*assessmentSettings.Enable { return []interface{}{} } var runImmediately bool - if assessmentSettings.RunImmediately != nil { - runImmediately = *assessmentSettings.RunImmediately + if assessmentSettings.RunImmediately != nil { + runImmediately = *assessmentSettings.RunImmediately } - var schedule *sqlvirtualmachine.Schedule + var schedule *sqlvirtualmachine.Schedule if assessmentSettings.Schedule != nil { var weeklyInterval int32 var monthlyOccurrence int32 if assessmentSettings.Schedule.WeeklyInterval != nil { - weeklyInterval = *assessmentSettings.Schedule.WeeklyInterval + weeklyInterval = *assessmentSettings.Schedule.WeeklyInterval } if assessmentSettings.Schedule.MonthlyOccurrence != nil { - monthlyOccurrence = *assessmentSettings.Schedule.MonthlyOccurrence + monthlyOccurrence = *assessmentSettings.Schedule.MonthlyOccurrence + } + + schedule = map[string]interface{}{ + "weekly_interval": weeklyInterval, + "schedule": schedule, + "day_of_week": string(assessmentSettings.Schedule.DayOfWeek), + "start_time": string(assessmentSettings.Schedule.StartTime), } - - schedule = map[string]interface{}{ - "weekly_interval": weeklyInterval, - "schedule": schedule, - "day_of_week": string(assessmentSettings.Schedule.DayOfWeek), - "start_time": string(assessmentSettings.Schedule.StartTime ), - } } return []interface{}{ map[string]interface{}{ - "run_immediately": runImmediately, - "schedule": schedule, + "run_immediately": runImmediately, + "schedule": schedule, }, } } diff --git a/internal/services/mssql/mssql_virtual_machine_resource_test.go b/internal/services/mssql/mssql_virtual_machine_resource_test.go index 1741955f2de0..75cf0e9158c7 100644 --- a/internal/services/mssql/mssql_virtual_machine_resource_test.go +++ b/internal/services/mssql/mssql_virtual_machine_resource_test.go @@ -657,7 +657,6 @@ resource "azurerm_mssql_virtual_machine" "test" { `, r.template(data), data.RandomInteger) } - func (r MsSqlVirtualMachineResource) storageConfiguration(data acceptance.TestData) string { return fmt.Sprintf(` %[1]s From 89d26318889922e2fed225910bf2f6463783b788 Mon Sep 17 00:00:00 2001 From: Ron Truex Date: Wed, 8 Jun 2022 08:27:51 -0700 Subject: [PATCH 23/33] updates based on feedback --- internal/services/mssql/mssql_virtual_machine_resource.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/services/mssql/mssql_virtual_machine_resource.go b/internal/services/mssql/mssql_virtual_machine_resource.go index 915d06e1ece8..c6dc7457cfc7 100644 --- a/internal/services/mssql/mssql_virtual_machine_resource.go +++ b/internal/services/mssql/mssql_virtual_machine_resource.go @@ -776,7 +776,7 @@ func flattenSqlVirtualMachineAutoPatching(autoPatching *sqlvirtualmachine.AutoPa func expandSqlVirtualMachineAssessmentSettings(input []interface{}) *sqlvirtualmachine.AssessmentSettings { if len(input) == 0 { - return nil + return &sqlvirtualmachine.AssessmentSettings{} } assessmentSetting := input[0].(map[string]interface{}) From 5d3d88e2dd7667163839d4e72eed1baa5f5ae007 Mon Sep 17 00:00:00 2001 From: Ron Truex Date: Wed, 8 Jun 2022 08:28:36 -0700 Subject: [PATCH 24/33] reverted change pending feedback --- internal/services/mssql/mssql_virtual_machine_resource.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/services/mssql/mssql_virtual_machine_resource.go b/internal/services/mssql/mssql_virtual_machine_resource.go index c6dc7457cfc7..915d06e1ece8 100644 --- a/internal/services/mssql/mssql_virtual_machine_resource.go +++ b/internal/services/mssql/mssql_virtual_machine_resource.go @@ -776,7 +776,7 @@ func flattenSqlVirtualMachineAutoPatching(autoPatching *sqlvirtualmachine.AutoPa func expandSqlVirtualMachineAssessmentSettings(input []interface{}) *sqlvirtualmachine.AssessmentSettings { if len(input) == 0 { - return &sqlvirtualmachine.AssessmentSettings{} + return nil } assessmentSetting := input[0].(map[string]interface{}) From 13c84549366034e6b71dff998739fb85443dd2a6 Mon Sep 17 00:00:00 2001 From: Ron Date: Fri, 10 Jun 2022 14:01:42 -0700 Subject: [PATCH 25/33] Update mssql_virtual_machine_resource.go --- .../mssql/mssql_virtual_machine_resource.go | 34 ++++++++++--------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/internal/services/mssql/mssql_virtual_machine_resource.go b/internal/services/mssql/mssql_virtual_machine_resource.go index 915d06e1ece8..061b5264f298 100644 --- a/internal/services/mssql/mssql_virtual_machine_resource.go +++ b/internal/services/mssql/mssql_virtual_machine_resource.go @@ -192,22 +192,24 @@ func resourceMsSqlVirtualMachine() *pluginsdk.Resource { Optional: true, MaxItems: 1, Elem: &pluginsdk.Resource{ - "weekly_interval": { - Type: pluginsdk.TypeInt, - Optional: true, - }, - "monthly_occurrence": { - Type: pluginsdk.TypeInt, - Optional: true, - }, - "day_of_week": { - Type: pluginsdk.TypeInt, - Optional: true, - }, - "start_time": { - Type: pluginsdk.TypeString, - Optional: true, - }, + Schema: map[string]*pluginsdk.Schema{ + "weekly_interval": { + Type: pluginsdk.TypeInt, + Optional: true, + }, + "monthly_occurrence": { + Type: pluginsdk.TypeInt, + Optional: true, + }, + "day_of_week": { + Type: pluginsdk.TypeInt, + Optional: true, + }, + "start_time": { + Type: pluginsdk.TypeString, + Optional: true, + }, + } }, }, From 8ef39579de7ef650cdca2f057e092d76496cab64 Mon Sep 17 00:00:00 2001 From: Ron Date: Fri, 10 Jun 2022 14:07:28 -0700 Subject: [PATCH 26/33] Update mssql_virtual_machine_resource.go --- internal/services/mssql/mssql_virtual_machine_resource.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/services/mssql/mssql_virtual_machine_resource.go b/internal/services/mssql/mssql_virtual_machine_resource.go index 061b5264f298..d2e6b64bc73b 100644 --- a/internal/services/mssql/mssql_virtual_machine_resource.go +++ b/internal/services/mssql/mssql_virtual_machine_resource.go @@ -783,7 +783,7 @@ func expandSqlVirtualMachineAssessmentSettings(input []interface{}) *sqlvirtualm assessmentSetting := input[0].(map[string]interface{}) if len(assessmentSetting["schedule"]) == 0 { - schedule_data := nil + schedule_data := &sqlvirtualmachine.Schedule{} } else { schedule_data := &sqlvirtualmachine.Schedule{ Enable: utils.Bool(true), From 42e7810dac75a14e6634966db0cd27e04f0abed2 Mon Sep 17 00:00:00 2001 From: Ron Truex Date: Fri, 10 Jun 2022 14:20:14 -0700 Subject: [PATCH 27/33] ran fmter --- .../mssql/mssql_virtual_machine_resource_test.go | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/internal/services/mssql/mssql_virtual_machine_resource_test.go b/internal/services/mssql/mssql_virtual_machine_resource_test.go index 75cf0e9158c7..dd4112e2c45b 100644 --- a/internal/services/mssql/mssql_virtual_machine_resource_test.go +++ b/internal/services/mssql/mssql_virtual_machine_resource_test.go @@ -631,10 +631,10 @@ resource "azurerm_virtual_machine_data_disk_attachment" "test" { resource "azurerm_mssql_virtual_machine" "test" { virtual_machine_id = azurerm_virtual_machine.test.id sql_license_type = "PAYG" - + storage_configuration { - disk_type = "NEW" - storage_workload_type = "OLTP" + disk_type = "NEW" + storage_workload_type = "OLTP" system_db_on_datadisk_enabled = true data_settings { @@ -680,12 +680,12 @@ resource "azurerm_virtual_machine_data_disk_attachment" "test" { resource "azurerm_mssql_virtual_machine" "test" { virtual_machine_id = azurerm_virtual_machine.test.id sql_license_type = "PAYG" - + assessment_settings {} - + storage_configuration { - disk_type = "NEW" - storage_workload_type = "OLTP" + disk_type = "NEW" + storage_workload_type = "OLTP" system_db_on_datadisk_enabled = true data_settings { From 75859c4086d98dc7534232eb36c128cc3ca79f6f Mon Sep 17 00:00:00 2001 From: Matthew Date: Thu, 20 Oct 2022 16:05:54 -0700 Subject: [PATCH 28/33] Start of refactor --- .../mssql/mssql_virtual_machine_resource.go | 115 +++++++++++------- .../mssql_virtual_machine_resource_test.go | 65 ++++------ 2 files changed, 91 insertions(+), 89 deletions(-) diff --git a/internal/services/mssql/mssql_virtual_machine_resource.go b/internal/services/mssql/mssql_virtual_machine_resource.go index dbc25d80c71f..465cdd2ebb22 100644 --- a/internal/services/mssql/mssql_virtual_machine_resource.go +++ b/internal/services/mssql/mssql_virtual_machine_resource.go @@ -187,6 +187,11 @@ func resourceMsSqlVirtualMachine() *pluginsdk.Resource { MaxItems: 1, Elem: &pluginsdk.Resource{ Schema: map[string]*pluginsdk.Schema{ + "enabled": { + Type: pluginsdk.TypeBool, + Optional: true, + Default: true, + }, "schedule": { Type: pluginsdk.TypeList, Optional: true, @@ -849,31 +854,37 @@ func flattenSqlVirtualMachineAutoPatching(autoPatching *sqlvirtualmachines.AutoP } } -func expandSqlVirtualMachineAssessmentSettings(input []interface{}) *sqlvirtualmachine.AssessmentSettings { +func expandSqlVirtualMachineAssessmentSettings(input []interface{}) *sqlvirtualmachines.AssessmentSettings { if len(input) == 0 { return nil } assessmentSetting := input[0].(map[string]interface{}) - if len(assessmentSetting["schedule"]) == 0 { - schedule_data := &sqlvirtualmachine.Schedule{} - } else { - schedule_data := &sqlvirtualmachine.Schedule{ - Enable: utils.Bool(true), - WeeklyInterval: utils.Int32(int32(autoPatchingSetting["weekly_interval"].(int))), - MonthlyOccurrence: utils.Int32(int32(autoPatchingSetting["monthly_occurrence"].(int))), - DayOfWeek: sqlvirtualmachine.DayOfWeek(autoPatchingSetting["day_of_week"].(string)), - StartTime: autoPatchingSetting["start_time"], - } - } - return &sqlvirtualmachine.AssessmentSettings{ + return &sqlvirtualmachines.AssessmentSettings{ Enable: utils.Bool(true), RunImmediately: utils.Bool(assessmentSetting["run_immediately"].(bool)), - schedule: schedule_data, + Schedule: expandSqlVirtualMachineAssessmentSettingsSchedule(assessmentSetting["schedule"].([]interface{})), } } -func flattenSqlVirtualMachineAssessmentSettings(assessmentSettings *sqlvirtualmachine.AssessmentSettings) []interface{} { +func expandSqlVirtualMachineAssessmentSettingsSchedule(input []interface{}) *sqlvirtualmachines.Schedule { + if len(input) == 0 { + return &sqlvirtualmachines.Schedule{} + } + + schedule := input[0].(map[string]interface{}) + + dayOfWeek := sqlvirtualmachines.AssessmentDayOfWeek(schedule["day_of_week"].(string)) + return &sqlvirtualmachines.Schedule{ + Enable: utils.Bool(true), + WeeklyInterval: utils.Int64(int64(schedule["weekly_interval"].(int))), + MonthlyOccurrence: utils.Int64(int64(schedule["monthly_occurrence"].(int))), + DayOfWeek: &dayOfWeek, + StartTime: utils.String(schedule["start_time"].(string)), + } +} + +func flattenSqlVirtualMachineAssessmentSettings(assessmentSettings *sqlvirtualmachines.AssessmentSettings) []interface{} { if assessmentSettings == nil || assessmentSettings.Enable == nil || !*assessmentSettings.Enable { return []interface{}{} } @@ -883,29 +894,41 @@ func flattenSqlVirtualMachineAssessmentSettings(assessmentSettings *sqlvirtualma runImmediately = *assessmentSettings.RunImmediately } - var schedule *sqlvirtualmachine.Schedule - if assessmentSettings.Schedule != nil { - var weeklyInterval int32 - var monthlyOccurrence int32 - if assessmentSettings.Schedule.WeeklyInterval != nil { - weeklyInterval = *assessmentSettings.Schedule.WeeklyInterval + var attr map[string]interface{} + if schedule := assessmentSettings.Schedule; schedule != nil { + var ( + weeklyInterval int64 + monthlyOccurrence int64 + dayOfWeek string + startTime string + ) + + if schedule.WeeklyInterval != nil { + weeklyInterval = *schedule.WeeklyInterval + } + if schedule.MonthlyOccurrence != nil { + monthlyOccurrence = *schedule.MonthlyOccurrence + } + if schedule.DayOfWeek != nil { + dayOfWeek = string(*schedule.DayOfWeek) } - if assessmentSettings.Schedule.MonthlyOccurrence != nil { - monthlyOccurrence = *assessmentSettings.Schedule.MonthlyOccurrence + if schedule.StartTime != nil { + startTime = *schedule.StartTime } - schedule = map[string]interface{}{ - "weekly_interval": weeklyInterval, - "schedule": schedule, - "day_of_week": string(assessmentSettings.Schedule.DayOfWeek), - "start_time": string(assessmentSettings.Schedule.StartTime), + attr = map[string]interface{}{ + "weekly_interval": weeklyInterval, + "monthly_occurrence": monthlyOccurrence, + "schedule": schedule, + "day_of_week": dayOfWeek, + "start_time": startTime, } } return []interface{}{ map[string]interface{}{ "run_immediately": runImmediately, - "schedule": schedule, + "schedule": attr, }, } } @@ -980,13 +1003,13 @@ func expandSqlVirtualMachineStorageConfigurationSettings(input []interface{}) *s diskConfigurationType := sqlvirtualmachines.DiskConfigurationType(storageSettings["disk_type"].(string)) storageWorkloadType := sqlvirtualmachines.StorageWorkloadType(storageSettings["storage_workload_type"].(string)) - return &sqlvirtualmachine.StorageConfigurationSettings{ + return &sqlvirtualmachines.StorageConfigurationSettings{ DiskConfigurationType: &diskConfigurationType, StorageWorkloadType: &storageWorkloadType, - SQLDataSettings: expandSqlVirtualMachineDataStorageSettings(storageSettings["data_settings"].([]interface{})), - SQLLogSettings: expandSqlVirtualMachineDataStorageSettings(storageSettings["log_settings"].([]interface{})), - SQLTempDbSettings: expandSqlVirtualMachineTempDbSettings(storageSettings["temp_db_settings"].([]interface{})), - SQLSystemDbOnDataDisk: utils.Bool(storageSettings["sql_system_db_on_datadisk"].(bool)), + SqlDataSettings: expandSqlVirtualMachineDataStorageSettings(storageSettings["data_settings"].([]interface{})), + SqlLogSettings: expandSqlVirtualMachineDataStorageSettings(storageSettings["log_settings"].([]interface{})), + SqlTempDbSettings: expandSqlVirtualMachineTempDbSettings(storageSettings["temp_db_settings"].([]interface{})), + SqlSystemDbOnDataDisk: utils.Bool(storageSettings["system_db_on_datadisk_enabled"].(bool)), } } @@ -1001,12 +1024,12 @@ func flattenSqlVirtualMachineStorageConfigurationSettings(input *sqlvirtualmachi } output := map[string]interface{}{ - "storage_workload_type": storageWorkloadType, - "disk_type": diskType, - "data_settings": flattenSqlVirtualMachineStorageSettings(input.SQLDataSettings), - "log_settings": flattenSqlVirtualMachineStorageSettings(input.SQLLogSettings), - "temp_db_settings": flattenSqlVirtualMachineTempDbSettings(input.SQLTempDbSettings), - "sql_system_db_on_datadisk": input.SQLSystemDbOnDataDisk, + "storage_workload_type": storageWorkloadType, + "disk_type": diskType, + "data_settings": flattenSqlVirtualMachineStorageSettings(input.SqlDataSettings), + "log_settings": flattenSqlVirtualMachineStorageSettings(input.SqlLogSettings), + "temp_db_settings": flattenSqlVirtualMachineTempDbSettings(input.SqlTempDbSettings), + "system_db_on_datadisk_enabled": input.SqlSystemDbOnDataDisk, } if output["storage_workload_type"].(string) == "" && output["disk_type"] == "" && @@ -1065,14 +1088,14 @@ func expandSqlVirtualMachineTempDbSettings(input []interface{}) *sqlvirtualmachi } tempDbSettings := input[0].(map[string]interface{}) - return &sqlvirtualmachine.SQLTempDbSettings{ + return &sqlvirtualmachines.SQLTempDbSettings{ Luns: expandSqlVirtualMachineStorageSettingsLuns(tempDbSettings["luns"].([]interface{})), DefaultFilePath: utils.String(tempDbSettings["default_file_path"].(string)), - DataFileCount: utils.Int32(int32(tempDbSettings["data_file_count"].(int))), - DataFileSize: utils.Int32(int32(tempDbSettings["data_file_size_mb"].(int))), - DataGrowth: utils.Int32(int32(tempDbSettings["data_file_growth_in_mb"].(int))), - LogFileSize: utils.Int32(int32(tempDbSettings["log_file_size_mb"].(int))), - LogGrowth: utils.Int32(int32(tempDbSettings["log_file_growth_mb"].(int))), + DataFileCount: utils.Int64(int64(tempDbSettings["data_file_count"].(int))), + DataFileSize: utils.Int64(int64(tempDbSettings["data_file_size_mb"].(int))), + DataGrowth: utils.Int64(int64(tempDbSettings["data_file_growth_in_mb"].(int))), + LogFileSize: utils.Int64(int64(tempDbSettings["log_file_size_mb"].(int))), + LogGrowth: utils.Int64(int64(tempDbSettings["log_file_growth_mb"].(int))), } } diff --git a/internal/services/mssql/mssql_virtual_machine_resource_test.go b/internal/services/mssql/mssql_virtual_machine_resource_test.go index af21a0da017e..468955c04d8b 100644 --- a/internal/services/mssql/mssql_virtual_machine_resource_test.go +++ b/internal/services/mssql/mssql_virtual_machine_resource_test.go @@ -170,6 +170,21 @@ func TestAccMsSqlVirtualMachine_storageConfiguration(t *testing.T) { }) } +func TestAccMsSqlVirtualMachine_assessmentSettings(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_mssql_virtual_machine", "test") + r := MsSqlVirtualMachineResource{} + + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.assessmentSettings(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + }) +} + func (MsSqlVirtualMachineResource) Exists(ctx context.Context, client *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { id, err := sqlvirtualmachines.ParseSqlVirtualMachineID(state.ID) if err != nil { @@ -658,7 +673,7 @@ resource "azurerm_mssql_virtual_machine" "test" { `, r.template(data), data.RandomInteger) } -func (r MsSqlVirtualMachineResource) storageConfiguration(data acceptance.TestData) string { +func (r MsSqlVirtualMachineResource) storageConfigurationRevert(data acceptance.TestData) string { return fmt.Sprintf(` %[1]s @@ -681,57 +696,21 @@ resource "azurerm_virtual_machine_data_disk_attachment" "test" { resource "azurerm_mssql_virtual_machine" "test" { virtual_machine_id = azurerm_virtual_machine.test.id sql_license_type = "PAYG" - - assessment_settings {} - - storage_configuration { - disk_type = "NEW" - storage_workload_type = "OLTP" - system_db_on_datadisk_enabled = true - - data_settings { - luns = [0] - default_file_path = "F:\\SQLData" - } - - log_settings { - luns = [0] - default_file_path = "F:\\SQLLog" - } - - temp_db_settings { - luns = [0] - default_file_path = "F:\\SQLTemp" - log_file_size_mb = 512 - } - } } `, r.template(data), data.RandomInteger) } -func (r MsSqlVirtualMachineResource) storageConfigurationRevert(data acceptance.TestData) string { +func (r MsSqlVirtualMachineResource) assessmentSettings(data acceptance.TestData) string { return fmt.Sprintf(` %[1]s -resource "azurerm_managed_disk" "test" { - name = "accmd-sqlvm-%[2]d" - location = azurerm_resource_group.test.location - resource_group_name = azurerm_resource_group.test.name - storage_account_type = "Standard_LRS" - create_option = "Empty" - disk_size_gb = 10 -} - -resource "azurerm_virtual_machine_data_disk_attachment" "test" { - managed_disk_id = azurerm_managed_disk.test.id - virtual_machine_id = azurerm_virtual_machine.test.id - lun = "0" - caching = "None" -} - resource "azurerm_mssql_virtual_machine" "test" { virtual_machine_id = azurerm_virtual_machine.test.id sql_license_type = "PAYG" + + assessment_settings { + + } } -`, r.template(data), data.RandomInteger) +`, r.template(data)) } From fe2028f1810116e9abf32e058821bb5b8549cd21 Mon Sep 17 00:00:00 2001 From: Matthew Date: Fri, 21 Oct 2022 17:08:09 -0700 Subject: [PATCH 29/33] Finalize fixes --- .../mssql/mssql_virtual_machine_resource.go | 62 +++++++++++++------ .../mssql_virtual_machine_resource_test.go | 43 ++++++++++++- .../r/mssql_virtual_machine.html.markdown | 41 +++++++++--- 3 files changed, 118 insertions(+), 28 deletions(-) diff --git a/internal/services/mssql/mssql_virtual_machine_resource.go b/internal/services/mssql/mssql_virtual_machine_resource.go index 465cdd2ebb22..5f07e9f8fb1a 100644 --- a/internal/services/mssql/mssql_virtual_machine_resource.go +++ b/internal/services/mssql/mssql_virtual_machine_resource.go @@ -4,6 +4,7 @@ import ( "context" "fmt" "log" + "regexp" "strings" "time" @@ -199,20 +200,29 @@ func resourceMsSqlVirtualMachine() *pluginsdk.Resource { Elem: &pluginsdk.Resource{ Schema: map[string]*pluginsdk.Schema{ "weekly_interval": { - Type: pluginsdk.TypeInt, - Optional: true, + Type: pluginsdk.TypeInt, + Optional: true, + ExactlyOneOf: []string{"assessment_settings.0.schedule.0.monthly_occurrence"}, + ValidateFunc: validation.IntBetween(1, 6), }, "monthly_occurrence": { - Type: pluginsdk.TypeInt, - Optional: true, + Type: pluginsdk.TypeInt, + Optional: true, + ExactlyOneOf: []string{"assessment_settings.0.schedule.0.weekly_interval"}, + ValidateFunc: validation.IntBetween(1, 5), }, "day_of_week": { - Type: pluginsdk.TypeInt, - Optional: true, + Type: pluginsdk.TypeString, + Required: true, + ValidateFunc: validation.StringInSlice(sqlvirtualmachines.PossibleValuesForAssessmentDayOfWeek(), false), }, "start_time": { Type: pluginsdk.TypeString, - Optional: true, + Required: true, + ValidateFunc: validation.StringMatch( + regexp.MustCompile("^(0[0-9]|1[0-9]|2[0-3]):[0-5][0-9]$"), + "duration must match the format HH:mm", + ), }, }, }, @@ -872,16 +882,25 @@ func expandSqlVirtualMachineAssessmentSettingsSchedule(input []interface{}) *sql return &sqlvirtualmachines.Schedule{} } - schedule := input[0].(map[string]interface{}) + scheduleConfig := input[0].(map[string]interface{}) + + dayOfWeek := sqlvirtualmachines.AssessmentDayOfWeek(scheduleConfig["day_of_week"].(string)) + + schedule := &sqlvirtualmachines.Schedule{ + Enable: utils.Bool(true), + DayOfWeek: &dayOfWeek, + StartTime: utils.String(scheduleConfig["start_time"].(string)), + } - dayOfWeek := sqlvirtualmachines.AssessmentDayOfWeek(schedule["day_of_week"].(string)) - return &sqlvirtualmachines.Schedule{ - Enable: utils.Bool(true), - WeeklyInterval: utils.Int64(int64(schedule["weekly_interval"].(int))), - MonthlyOccurrence: utils.Int64(int64(schedule["monthly_occurrence"].(int))), - DayOfWeek: &dayOfWeek, - StartTime: utils.String(schedule["start_time"].(string)), + if weeklyInterval := scheduleConfig["weekly_interval"].(int); weeklyInterval != 0 { + schedule.WeeklyInterval = utils.Int64(int64(weeklyInterval)) } + + if monthlyOccurrence := scheduleConfig["monthly_occurrence"].(int); monthlyOccurrence != 0 { + schedule.MonthlyOccurrence = utils.Int64(int64(monthlyOccurrence)) + } + + return schedule } func flattenSqlVirtualMachineAssessmentSettings(assessmentSettings *sqlvirtualmachines.AssessmentSettings) []interface{} { @@ -889,11 +908,18 @@ func flattenSqlVirtualMachineAssessmentSettings(assessmentSettings *sqlvirtualma return []interface{}{} } - var runImmediately bool + var ( + runImmediately bool + enabled bool + ) if assessmentSettings.RunImmediately != nil { runImmediately = *assessmentSettings.RunImmediately } + if assessmentSettings.Enable != nil { + enabled = *assessmentSettings.Enable + } + var attr map[string]interface{} if schedule := assessmentSettings.Schedule; schedule != nil { var ( @@ -919,7 +945,6 @@ func flattenSqlVirtualMachineAssessmentSettings(assessmentSettings *sqlvirtualma attr = map[string]interface{}{ "weekly_interval": weeklyInterval, "monthly_occurrence": monthlyOccurrence, - "schedule": schedule, "day_of_week": dayOfWeek, "start_time": startTime, } @@ -928,7 +953,8 @@ func flattenSqlVirtualMachineAssessmentSettings(assessmentSettings *sqlvirtualma return []interface{}{ map[string]interface{}{ "run_immediately": runImmediately, - "schedule": attr, + "enabled": enabled, + "schedule": []interface{}{attr}, }, } } diff --git a/internal/services/mssql/mssql_virtual_machine_resource_test.go b/internal/services/mssql/mssql_virtual_machine_resource_test.go index 468955c04d8b..b9dd84622a45 100644 --- a/internal/services/mssql/mssql_virtual_machine_resource_test.go +++ b/internal/services/mssql/mssql_virtual_machine_resource_test.go @@ -176,7 +176,21 @@ func TestAccMsSqlVirtualMachine_assessmentSettings(t *testing.T) { data.ResourceTest(t, r, []acceptance.TestStep{ { - Config: r.assessmentSettings(data), + Config: r.assessmentSettingsWeekly(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + { + Config: r.assessmentSettingsMonthly(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + { + Config: r.basic(data), Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), @@ -700,7 +714,26 @@ resource "azurerm_mssql_virtual_machine" "test" { `, r.template(data), data.RandomInteger) } -func (r MsSqlVirtualMachineResource) assessmentSettings(data acceptance.TestData) string { +func (r MsSqlVirtualMachineResource) assessmentSettingsWeekly(data acceptance.TestData) string { + return fmt.Sprintf(` +%[1]s + +resource "azurerm_mssql_virtual_machine" "test" { + virtual_machine_id = azurerm_virtual_machine.test.id + sql_license_type = "PAYG" + + assessment_settings { + schedule { + day_of_week = "Monday" + weekly_interval = 1 + start_time = "00:00" + } + } +} +`, r.template(data)) +} + +func (r MsSqlVirtualMachineResource) assessmentSettingsMonthly(data acceptance.TestData) string { return fmt.Sprintf(` %[1]s @@ -709,7 +742,11 @@ resource "azurerm_mssql_virtual_machine" "test" { sql_license_type = "PAYG" assessment_settings { - + schedule { + day_of_week = "Tuesday" + monthly_occurrence = 3 + start_time = "01:02" + } } } `, r.template(data)) diff --git a/website/docs/r/mssql_virtual_machine.html.markdown b/website/docs/r/mssql_virtual_machine.html.markdown index 56ad6b1bfbb4..0431175444ce 100644 --- a/website/docs/r/mssql_virtual_machine.html.markdown +++ b/website/docs/r/mssql_virtual_machine.html.markdown @@ -63,6 +63,8 @@ The following arguments are supported: * `storage_configuration` - (Optional) An `storage_configuration` block as defined below. +* `assessment_settings` - (Optional) An `assessment_settings` block as defined below. + * `tags` - (Optional) A mapping of tags to assign to the resource. --- @@ -129,7 +131,7 @@ The `storage_configuration` block supports the following: * `log_settings` - (Optional) An `storage_settings` as defined below. -* `temp_db_settings` - (Optional) An `sqltempdb_storage_settings` as defined below. +* `temp_db_settings` - (Optional) An `temp_db_settings` as defined below. --- @@ -141,25 +143,50 @@ The `storage_settings` block supports the following: --- -The `sqltempdb_storage_settings` block supports the following: +The `temp_db_settings` block supports the following: * `default_file_path` - (Required) The SQL Server default path * `luns` - (Required) A list of Logical Unit Numbers for the disks. -* `data_file_count` - (Optional) SQL Server default file count - Default 8 +* `data_file_count` - (Optional) The SQL Server default file count. This value defaults to `8` + +* `data_file_size_mb` - (Optional) The SQL Server default file size - This value defaults to `256` + +* `data_file_growth_in_mb` - (Optional) The SQL Server default file size - This value defaults to `512` + +* `log_file_size_mb` - (Optional) The SQL Server default file size - This value defaults to `256` + +* `log_file_growth_mb` - (Optional) The SQL Server default file size - This value defaults to `512` + +--- + +The `assessment_settings` block supports the following: -* `data_file_size_mb` - (Optional) SQL Server default file size - Default 256 +* `enabled` - (Optional) Should Assessment Settings be enabled? Defaults to `true`. -* `data_file_growth_in_mb` - (Optional) SQL Server default file size - Default 512 +* `run_immediately` - (Optional) Should Assessment Settings be run immediately? Defaults to `false`. -* `log_file_size_mb` - (Optional) SQL Server default file size - Default 256 +* `schedule` - (Optional) An `schedule` block as defined below. -* `log_file_growth_mb` - (Optional) SQL Server default file size - Default 512 +--- + +The `schedule` block supports the following: + +* `weekly_interval` - (Optional) How many weeks between assessment runs. Valid values are between `1` and `6`. + +* `monthly_occurrence` - (Optional) How many months between assessment runs. Valid values are between `1` and `5`. + +~> **NOTE:** Either one of `weekly_interval` or `monthly_occurrence` must be specified. + +* `day_of_week` - (Optional) What day of the week the assessment will be run. Default value is `Monday`. + +* `start_time` - (Optional) What time the assessment will be run. Must be in the format `HH:mm`. ## Attributes Reference The following attributes are exported: + * `id` - The ID of the SQL Virtual Machine. ## Timeouts From 21ac7a397eb014ad912dbb853c5a6b3850880a16 Mon Sep 17 00:00:00 2001 From: Matthew Date: Fri, 21 Oct 2022 17:13:13 -0700 Subject: [PATCH 30/33] Removed system_db_on_datadisk_enabled --- .../mssql/mssql_virtual_machine_resource.go | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/internal/services/mssql/mssql_virtual_machine_resource.go b/internal/services/mssql/mssql_virtual_machine_resource.go index 5f07e9f8fb1a..aa55397ee120 100644 --- a/internal/services/mssql/mssql_virtual_machine_resource.go +++ b/internal/services/mssql/mssql_virtual_machine_resource.go @@ -342,11 +342,6 @@ func resourceMsSqlVirtualMachine() *pluginsdk.Resource { "data_settings": helper.StorageSettingSchema(), "log_settings": helper.StorageSettingSchema(), "temp_db_settings": helper.SQLTempDBStorageSettingSchema(), - "system_db_on_datadisk_enabled": { - Type: pluginsdk.TypeBool, - Optional: true, - Default: false, - }, }, }, }, @@ -1035,7 +1030,6 @@ func expandSqlVirtualMachineStorageConfigurationSettings(input []interface{}) *s SqlDataSettings: expandSqlVirtualMachineDataStorageSettings(storageSettings["data_settings"].([]interface{})), SqlLogSettings: expandSqlVirtualMachineDataStorageSettings(storageSettings["log_settings"].([]interface{})), SqlTempDbSettings: expandSqlVirtualMachineTempDbSettings(storageSettings["temp_db_settings"].([]interface{})), - SqlSystemDbOnDataDisk: utils.Bool(storageSettings["system_db_on_datadisk_enabled"].(bool)), } } @@ -1050,12 +1044,11 @@ func flattenSqlVirtualMachineStorageConfigurationSettings(input *sqlvirtualmachi } output := map[string]interface{}{ - "storage_workload_type": storageWorkloadType, - "disk_type": diskType, - "data_settings": flattenSqlVirtualMachineStorageSettings(input.SqlDataSettings), - "log_settings": flattenSqlVirtualMachineStorageSettings(input.SqlLogSettings), - "temp_db_settings": flattenSqlVirtualMachineTempDbSettings(input.SqlTempDbSettings), - "system_db_on_datadisk_enabled": input.SqlSystemDbOnDataDisk, + "storage_workload_type": storageWorkloadType, + "disk_type": diskType, + "data_settings": flattenSqlVirtualMachineStorageSettings(input.SqlDataSettings), + "log_settings": flattenSqlVirtualMachineStorageSettings(input.SqlLogSettings), + "temp_db_settings": flattenSqlVirtualMachineTempDbSettings(input.SqlTempDbSettings), } if output["storage_workload_type"].(string) == "" && output["disk_type"] == "" && From 1a758464edad74e099af1f5c563a90fee96f61b4 Mon Sep 17 00:00:00 2001 From: Matthew Date: Mon, 24 Oct 2022 12:57:19 -0700 Subject: [PATCH 31/33] Fix tests --- .../services/mssql/mssql_virtual_machine_resource_test.go | 8 -------- 1 file changed, 8 deletions(-) diff --git a/internal/services/mssql/mssql_virtual_machine_resource_test.go b/internal/services/mssql/mssql_virtual_machine_resource_test.go index b9dd84622a45..269f78f56af6 100644 --- a/internal/services/mssql/mssql_virtual_machine_resource_test.go +++ b/internal/services/mssql/mssql_virtual_machine_resource_test.go @@ -189,13 +189,6 @@ func TestAccMsSqlVirtualMachine_assessmentSettings(t *testing.T) { ), }, data.ImportStep(), - { - Config: r.basic(data), - Check: acceptance.ComposeTestCheckFunc( - check.That(data.ResourceName).ExistsInAzure(r), - ), - }, - data.ImportStep(), }) } @@ -665,7 +658,6 @@ resource "azurerm_mssql_virtual_machine" "test" { storage_configuration { disk_type = "NEW" storage_workload_type = "OLTP" - system_db_on_datadisk_enabled = true data_settings { luns = [0] From b7cbb2a43daccf1671a1cda8e4d35cc0debab578 Mon Sep 17 00:00:00 2001 From: kt Date: Mon, 24 Oct 2022 13:22:59 -0700 Subject: [PATCH 32/33] make terrafmt --- .../services/mssql/mssql_virtual_machine_resource_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/services/mssql/mssql_virtual_machine_resource_test.go b/internal/services/mssql/mssql_virtual_machine_resource_test.go index 269f78f56af6..704808ab7352 100644 --- a/internal/services/mssql/mssql_virtual_machine_resource_test.go +++ b/internal/services/mssql/mssql_virtual_machine_resource_test.go @@ -656,8 +656,8 @@ resource "azurerm_mssql_virtual_machine" "test" { sql_license_type = "PAYG" storage_configuration { - disk_type = "NEW" - storage_workload_type = "OLTP" + disk_type = "NEW" + storage_workload_type = "OLTP" data_settings { luns = [0] From a4552c8b5f6cf573b96aeba2dec37b9dc24c1be1 Mon Sep 17 00:00:00 2001 From: Matthew Date: Mon, 24 Oct 2022 13:45:34 -0700 Subject: [PATCH 33/33] Address review --- .../services/mssql/mssql_virtual_machine_resource.go | 12 ++++++------ .../mssql/mssql_virtual_machine_resource_test.go | 4 ++-- website/docs/r/mssql_virtual_machine.html.markdown | 8 ++++---- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/services/mssql/mssql_virtual_machine_resource.go b/internal/services/mssql/mssql_virtual_machine_resource.go index aa55397ee120..9e836649474d 100644 --- a/internal/services/mssql/mssql_virtual_machine_resource.go +++ b/internal/services/mssql/mssql_virtual_machine_resource.go @@ -182,7 +182,7 @@ func resourceMsSqlVirtualMachine() *pluginsdk.Resource { }, }, - "assessment_settings": { + "assessment": { Type: pluginsdk.TypeList, Optional: true, MaxItems: 1, @@ -202,13 +202,13 @@ func resourceMsSqlVirtualMachine() *pluginsdk.Resource { "weekly_interval": { Type: pluginsdk.TypeInt, Optional: true, - ExactlyOneOf: []string{"assessment_settings.0.schedule.0.monthly_occurrence"}, + ExactlyOneOf: []string{"assessment.0.schedule.0.monthly_occurrence"}, ValidateFunc: validation.IntBetween(1, 6), }, "monthly_occurrence": { Type: pluginsdk.TypeInt, Optional: true, - ExactlyOneOf: []string{"assessment_settings.0.schedule.0.weekly_interval"}, + ExactlyOneOf: []string{"assessment.0.schedule.0.weekly_interval"}, ValidateFunc: validation.IntBetween(1, 5), }, "day_of_week": { @@ -416,7 +416,7 @@ func resourceMsSqlVirtualMachineCreateUpdate(d *pluginsdk.ResourceData, meta int Properties: &sqlvirtualmachines.SqlVirtualMachineProperties{ AutoBackupSettings: expandSqlVirtualMachineAutoBackupSettings(d.Get("auto_backup").([]interface{})), AutoPatchingSettings: expandSqlVirtualMachineAutoPatchingSettings(d.Get("auto_patching").([]interface{})), - AssessmentSettings: expandSqlVirtualMachineAssessmentSettings(d.Get("assessment_settings").([]interface{})), + AssessmentSettings: expandSqlVirtualMachineAssessmentSettings(d.Get("assessment").([]interface{})), KeyVaultCredentialSettings: expandSqlVirtualMachineKeyVaultCredential(d.Get("key_vault_credential").([]interface{})), ServerConfigurationsManagementSettings: &sqlvirtualmachines.ServerConfigurationsManagementSettings{ AdditionalFeaturesServerConfigurations: &sqlvirtualmachines.AdditionalFeaturesServerConfigurations{ @@ -525,8 +525,8 @@ func resourceMsSqlVirtualMachineRead(d *pluginsdk.ResourceData, meta interface{} return fmt.Errorf("setting `auto_patching`: %+v", err) } - if err := d.Set("assessment_settings", flattenSqlVirtualMachineAssessmentSettings(props.AssessmentSettings)); err != nil { - return fmt.Errorf("setting `assessment_settings`: %+v", err) + if err := d.Set("assessment", flattenSqlVirtualMachineAssessmentSettings(props.AssessmentSettings)); err != nil { + return fmt.Errorf("setting `assessment`: %+v", err) } if err := d.Set("key_vault_credential", flattenSqlVirtualMachineKeyVaultCredential(props.KeyVaultCredentialSettings, d)); err != nil { diff --git a/internal/services/mssql/mssql_virtual_machine_resource_test.go b/internal/services/mssql/mssql_virtual_machine_resource_test.go index 269f78f56af6..d7adb486d250 100644 --- a/internal/services/mssql/mssql_virtual_machine_resource_test.go +++ b/internal/services/mssql/mssql_virtual_machine_resource_test.go @@ -714,7 +714,7 @@ resource "azurerm_mssql_virtual_machine" "test" { virtual_machine_id = azurerm_virtual_machine.test.id sql_license_type = "PAYG" - assessment_settings { + assessment { schedule { day_of_week = "Monday" weekly_interval = 1 @@ -733,7 +733,7 @@ resource "azurerm_mssql_virtual_machine" "test" { virtual_machine_id = azurerm_virtual_machine.test.id sql_license_type = "PAYG" - assessment_settings { + assessment { schedule { day_of_week = "Tuesday" monthly_occurrence = 3 diff --git a/website/docs/r/mssql_virtual_machine.html.markdown b/website/docs/r/mssql_virtual_machine.html.markdown index 0431175444ce..19a48806634d 100644 --- a/website/docs/r/mssql_virtual_machine.html.markdown +++ b/website/docs/r/mssql_virtual_machine.html.markdown @@ -63,7 +63,7 @@ The following arguments are supported: * `storage_configuration` - (Optional) An `storage_configuration` block as defined below. -* `assessment_settings` - (Optional) An `assessment_settings` block as defined below. +* `assessment` - (Optional) An `assessment` block as defined below. * `tags` - (Optional) A mapping of tags to assign to the resource. @@ -161,11 +161,11 @@ The `temp_db_settings` block supports the following: --- -The `assessment_settings` block supports the following: +The `assessment` block supports the following: -* `enabled` - (Optional) Should Assessment Settings be enabled? Defaults to `true`. +* `enabled` - (Optional) Should Assessment be enabled? Defaults to `true`. -* `run_immediately` - (Optional) Should Assessment Settings be run immediately? Defaults to `false`. +* `run_immediately` - (Optional) Should Assessment be run immediately? Defaults to `false`. * `schedule` - (Optional) An `schedule` block as defined below.