From 81e12e22b68072ca45e2939779c73b504995fe4a Mon Sep 17 00:00:00 2001 From: Nick Metz Date: Tue, 29 Jun 2021 09:57:58 +0200 Subject: [PATCH 1/2] Update postgres flexserver api version to 2021-06-01 noteworthy changes: - cmk_enabled is not exposed in 2021-06-01 - now also postgres version 13 is available --- .../services/postgres/client/client.go | 2 +- .../postgresql_flexible_server_data_source.go | 22 +- ...gresql_flexible_server_data_source_test.go | 1 - ..._flexible_server_firewall_rule_resource.go | 2 +- .../postgresql_flexible_server_resource.go | 123 +-- ...ostgresql_flexible_server_resource_test.go | 17 +- go.mod | 2 +- go.sum | 4 +- .../postgresqlflexibleservers/CHANGELOG.md | 2 + .../postgresqlflexibleservers/_meta.json | 11 + .../checknameavailability.go | 2 +- .../postgresqlflexibleservers/client.go | 3 +- .../configurations.go | 109 ++- .../postgresqlflexibleservers/databases.go | 429 +++++++++++ .../postgresqlflexibleservers/enums.go | 236 ++++++ .../firewallrules.go | 21 +- .../getprivatednszonesuffix.go | 101 +++ .../locationbasedcapabilities.go | 2 +- .../postgresqlflexibleservers/models.go | 722 +++++++++++++++--- .../postgresqlflexibleservers/operations.go | 2 +- .../postgresqlflexibleservers/servers.go | 55 +- .../postgresqlflexibleservers/version.go | 2 +- .../virtualnetworksubnetusage.go | 2 +- .../postgresqlflexibleservers/CHANGELOG.md | 13 - .../postgresqlflexibleservers/_meta.json | 11 - .../postgresqlflexibleservers/enums.go | 181 ----- .../Azure/azure-sdk-for-go/version/version.go | 2 +- vendor/modules.txt | 4 +- .../postgresql_flexible_server.html.markdown | 2 - .../postgresql_flexible_server.html.markdown | 4 +- 30 files changed, 1630 insertions(+), 459 deletions(-) create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2021-06-01/postgresqlflexibleservers/CHANGELOG.md create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2021-06-01/postgresqlflexibleservers/_meta.json rename vendor/github.com/Azure/azure-sdk-for-go/services/{preview/postgresql/mgmt/2020-02-14-preview => postgresql/mgmt/2021-06-01}/postgresqlflexibleservers/checknameavailability.go (99%) rename vendor/github.com/Azure/azure-sdk-for-go/services/{preview/postgresql/mgmt/2020-02-14-preview => postgresql/mgmt/2021-06-01}/postgresqlflexibleservers/client.go (96%) rename vendor/github.com/Azure/azure-sdk-for-go/services/{preview/postgresql/mgmt/2020-02-14-preview => postgresql/mgmt/2021-06-01}/postgresqlflexibleservers/configurations.go (77%) create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2021-06-01/postgresqlflexibleservers/databases.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2021-06-01/postgresqlflexibleservers/enums.go rename vendor/github.com/Azure/azure-sdk-for-go/services/{preview/postgresql/mgmt/2020-02-14-preview => postgresql/mgmt/2021-06-01}/postgresqlflexibleservers/firewallrules.go (96%) create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2021-06-01/postgresqlflexibleservers/getprivatednszonesuffix.go rename vendor/github.com/Azure/azure-sdk-for-go/services/{preview/postgresql/mgmt/2020-02-14-preview => postgresql/mgmt/2021-06-01}/postgresqlflexibleservers/locationbasedcapabilities.go (99%) rename vendor/github.com/Azure/azure-sdk-for-go/services/{preview/postgresql/mgmt/2020-02-14-preview => postgresql/mgmt/2021-06-01}/postgresqlflexibleservers/models.go (74%) rename vendor/github.com/Azure/azure-sdk-for-go/services/{preview/postgresql/mgmt/2020-02-14-preview => postgresql/mgmt/2021-06-01}/postgresqlflexibleservers/operations.go (98%) rename vendor/github.com/Azure/azure-sdk-for-go/services/{preview/postgresql/mgmt/2020-02-14-preview => postgresql/mgmt/2021-06-01}/postgresqlflexibleservers/servers.go (95%) rename vendor/github.com/Azure/azure-sdk-for-go/services/{preview/postgresql/mgmt/2020-02-14-preview => postgresql/mgmt/2021-06-01}/postgresqlflexibleservers/version.go (96%) rename vendor/github.com/Azure/azure-sdk-for-go/services/{preview/postgresql/mgmt/2020-02-14-preview => postgresql/mgmt/2021-06-01}/postgresqlflexibleservers/virtualnetworksubnetusage.go (99%) delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/preview/postgresql/mgmt/2020-02-14-preview/postgresqlflexibleservers/CHANGELOG.md delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/preview/postgresql/mgmt/2020-02-14-preview/postgresqlflexibleservers/_meta.json delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/preview/postgresql/mgmt/2020-02-14-preview/postgresqlflexibleservers/enums.go diff --git a/azurerm/internal/services/postgres/client/client.go b/azurerm/internal/services/postgres/client/client.go index 0b70da454ed6..53950fd3cf4c 100644 --- a/azurerm/internal/services/postgres/client/client.go +++ b/azurerm/internal/services/postgres/client/client.go @@ -2,7 +2,7 @@ package client import ( "github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2020-01-01/postgresql" - "github.com/Azure/azure-sdk-for-go/services/preview/postgresql/mgmt/2020-02-14-preview/postgresqlflexibleservers" + "github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2021-06-01/postgresqlflexibleservers" "github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/common" ) diff --git a/azurerm/internal/services/postgres/postgresql_flexible_server_data_source.go b/azurerm/internal/services/postgres/postgresql_flexible_server_data_source.go index 0d1d3b3f3b33..9053bbfa6de5 100644 --- a/azurerm/internal/services/postgres/postgresql_flexible_server_data_source.go +++ b/azurerm/internal/services/postgres/postgresql_flexible_server_data_source.go @@ -4,7 +4,7 @@ import ( "fmt" "time" - "github.com/Azure/azure-sdk-for-go/services/preview/postgresql/mgmt/2020-02-14-preview/postgresqlflexibleservers" + "github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2021-06-01/postgresqlflexibleservers" "github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/azure" "github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/clients" "github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/location" @@ -63,11 +63,6 @@ func dataSourcePostgresqlFlexibleServer() *pluginsdk.Resource { Computed: true, }, - "cmk_enabled": { - Type: pluginsdk.TypeString, - Computed: true, - }, - "fqdn": { Type: pluginsdk.TypeString, Computed: true, @@ -108,19 +103,14 @@ func dataSourceArmPostgresqlFlexibleServerRead(d *pluginsdk.ResourceData, meta i d.Set("location", location.NormalizeNilable(resp.Location)) if props := resp.ServerProperties; props != nil { d.Set("administrator_login", props.AdministratorLogin) - d.Set("storage_mb", props.StorageProfile.StorageMB) + d.Set("storage_mb", (*props.Storage.StorageSizeGB * 1024)) d.Set("version", props.Version) - d.Set("cmk_enabled", props.ByokEnforcement) d.Set("fqdn", props.FullyQualifiedDomainName) - d.Set("public_network_access_enabled", props.PublicNetworkAccess == postgresqlflexibleservers.ServerPublicNetworkAccessStateEnabled) - - if props.DelegatedSubnetArguments != nil { - d.Set("delegated_subnet_id", props.DelegatedSubnetArguments.SubnetArmResourceID) - } + d.Set("public_network_access_enabled", props.Network.PublicNetworkAccess == postgresqlflexibleservers.ServerPublicNetworkAccessStateEnabled) + d.Set("backup_retention_days", props.Backup.BackupRetentionDays) - if storage := props.StorageProfile; storage != nil { - d.Set("storage_mb", storage.StorageMB) - d.Set("backup_retention_days", storage.BackupRetentionDays) + if props.Network.DelegatedSubnetResourceID != nil { + d.Set("delegated_subnet_id", props.Network.DelegatedSubnetResourceID) } } diff --git a/azurerm/internal/services/postgres/postgresql_flexible_server_data_source_test.go b/azurerm/internal/services/postgres/postgresql_flexible_server_data_source_test.go index b40b61e167a3..52f35387aa89 100644 --- a/azurerm/internal/services/postgres/postgresql_flexible_server_data_source_test.go +++ b/azurerm/internal/services/postgres/postgresql_flexible_server_data_source_test.go @@ -24,7 +24,6 @@ func TestAccDataSourcePostgresqlflexibleServer_basic(t *testing.T) { check.That(data.ResourceName).Key("storage_mb").Exists(), check.That(data.ResourceName).Key("version").Exists(), check.That(data.ResourceName).Key("backup_retention_days").Exists(), - check.That(data.ResourceName).Key("cmk_enabled").Exists(), check.That(data.ResourceName).Key("fqdn").Exists(), check.That(data.ResourceName).Key("public_network_access_enabled").Exists(), ), diff --git a/azurerm/internal/services/postgres/postgresql_flexible_server_firewall_rule_resource.go b/azurerm/internal/services/postgres/postgresql_flexible_server_firewall_rule_resource.go index 680b0371f189..f570a288c915 100644 --- a/azurerm/internal/services/postgres/postgresql_flexible_server_firewall_rule_resource.go +++ b/azurerm/internal/services/postgres/postgresql_flexible_server_firewall_rule_resource.go @@ -5,7 +5,7 @@ import ( "log" "time" - "github.com/Azure/azure-sdk-for-go/services/preview/postgresql/mgmt/2020-02-14-preview/postgresqlflexibleservers" + "github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2021-06-01/postgresqlflexibleservers" "github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/tf" "github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/clients" "github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/services/postgres/parse" diff --git a/azurerm/internal/services/postgres/postgresql_flexible_server_resource.go b/azurerm/internal/services/postgres/postgresql_flexible_server_resource.go index 95ac56c01f09..aaee4e450e73 100644 --- a/azurerm/internal/services/postgres/postgresql_flexible_server_resource.go +++ b/azurerm/internal/services/postgres/postgresql_flexible_server_resource.go @@ -6,7 +6,7 @@ import ( "strings" "time" - "github.com/Azure/azure-sdk-for-go/services/preview/postgresql/mgmt/2020-02-14-preview/postgresqlflexibleservers" + "github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2021-06-01/postgresqlflexibleservers" "github.com/Azure/go-autorest/autorest/date" "github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/azure" "github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/tf" @@ -22,6 +22,11 @@ import ( "github.com/terraform-providers/terraform-provider-azurerm/azurerm/utils" ) +const ( + ServerMaintenanceWindowEnabled = "Enabled" + ServerMaintenanceWindowDisabled = "Disabled" +) + func resourcePostgresqlFlexibleServer() *pluginsdk.Resource { return &pluginsdk.Resource{ Create: resourcePostgresqlFlexibleServerCreate, @@ -88,8 +93,9 @@ func resourcePostgresqlFlexibleServer() *pluginsdk.Resource { Computed: true, ForceNew: true, ValidateFunc: validation.StringInSlice([]string{ - string(postgresqlflexibleservers.OneOne), - string(postgresqlflexibleservers.OneTwo), + string(postgresqlflexibleservers.ServerVersionOneOne), + string(postgresqlflexibleservers.ServerVersionOneTwo), + string(postgresqlflexibleservers.ServerVersionOneThree), }, false), }, @@ -100,8 +106,8 @@ func resourcePostgresqlFlexibleServer() *pluginsdk.Resource { Optional: true, ForceNew: true, ValidateFunc: validation.StringInSlice([]string{ - string(postgresqlflexibleservers.Default), - string(postgresqlflexibleservers.PointInTimeRestore), + string(postgresqlflexibleservers.CreateModeDefault), + string(postgresqlflexibleservers.CreateModePointInTimeRestore), }, false), }, @@ -163,11 +169,6 @@ func resourcePostgresqlFlexibleServer() *pluginsdk.Resource { ValidateFunc: validation.IntBetween(7, 35), }, - "cmk_enabled": { - Type: pluginsdk.TypeString, - Computed: true, - }, - "fqdn": { Type: pluginsdk.TypeString, Computed: true, @@ -205,7 +206,7 @@ func resourcePostgresqlFlexibleServerCreate(d *pluginsdk.ResourceData, meta inte createMode := d.Get("create_mode").(string) - if postgresqlflexibleservers.CreateMode(createMode) == postgresqlflexibleservers.PointInTimeRestore { + if postgresqlflexibleservers.CreateMode(createMode) == postgresqlflexibleservers.CreateModePointInTimeRestore { if _, ok := d.GetOk("source_server_id"); !ok { return fmt.Errorf("`source_server_id` is required when `create_mode` is `PointInTimeRestore`") } @@ -214,7 +215,7 @@ func resourcePostgresqlFlexibleServerCreate(d *pluginsdk.ResourceData, meta inte } } - if createMode == "" || postgresqlflexibleservers.CreateMode(createMode) == postgresqlflexibleservers.Default { + if createMode == "" || postgresqlflexibleservers.CreateMode(createMode) == postgresqlflexibleservers.CreateModeDefault { if _, ok := d.GetOk("administrator_login"); !ok { return fmt.Errorf("`administrator_login` is required when `create_mode` is `Default`") } @@ -240,10 +241,11 @@ func resourcePostgresqlFlexibleServerCreate(d *pluginsdk.ResourceData, meta inte parameters := postgresqlflexibleservers.Server{ Location: utils.String(location.Normalize(d.Get("location").(string))), ServerProperties: &postgresqlflexibleservers.ServerProperties{ - CreateMode: postgresqlflexibleservers.CreateMode(d.Get("create_mode").(string)), - DelegatedSubnetArguments: expandArmServerServerPropertiesDelegatedSubnetArguments(d.Get("delegated_subnet_id").(string)), - Version: postgresqlflexibleservers.ServerVersion(d.Get("version").(string)), - StorageProfile: expandArmServerStorageProfile(d), + CreateMode: postgresqlflexibleservers.CreateMode(d.Get("create_mode").(string)), + Network: expandArmServerNetwork(d), + Version: postgresqlflexibleservers.ServerVersion(d.Get("version").(string)), + Storage: expandArmServerStorage(d), + Backup: expandArmServerBackup(d), }, Sku: sku, Tags: tags.Expand(d.Get("tags").(map[string]interface{})), @@ -262,13 +264,7 @@ func resourcePostgresqlFlexibleServerCreate(d *pluginsdk.ResourceData, meta inte } if v, ok := d.GetOk("source_server_id"); ok && v.(string) != "" { - sourceServer, err := parse.FlexibleServerID(v.(string)) - if err != nil { - return err - } - parameters.ServerProperties.SourceSubscriptionID = utils.String(sourceServer.SubscriptionId) - parameters.ServerProperties.SourceResourceGroupName = utils.String(sourceServer.ResourceGroup) - parameters.ServerProperties.SourceServerName = utils.String(sourceServer.Name) + parameters.SourceServerResourceID = utils.String(v.(string)) } pointInTimeUTC := d.Get("point_in_time_restore_time_in_utc").(string) @@ -337,25 +333,28 @@ func resourcePostgresqlFlexibleServerRead(d *pluginsdk.ResourceData, meta interf if props := resp.ServerProperties; props != nil { d.Set("administrator_login", props.AdministratorLogin) d.Set("zone", props.AvailabilityZone) - if props.SourceServerName != nil && props.SourceSubscriptionID != nil && props.SourceResourceGroupName != nil { - d.Set("source_server_id", parse.NewFlexibleServerID(*props.SourceSubscriptionID, *props.SourceResourceGroupName, *props.SourceServerName).ID()) - } d.Set("version", props.Version) - d.Set("cmk_enabled", props.ByokEnforcement) d.Set("fqdn", props.FullyQualifiedDomainName) - d.Set("public_network_access_enabled", props.PublicNetworkAccess == postgresqlflexibleservers.ServerPublicNetworkAccessStateEnabled) + d.Set("public_network_access_enabled", props.Network.PublicNetworkAccess == postgresqlflexibleservers.ServerPublicNetworkAccessStateEnabled) - if props.DelegatedSubnetArguments != nil { - d.Set("delegated_subnet_id", props.DelegatedSubnetArguments.SubnetArmResourceID) + if props.SourceServerResourceID != nil { + d.Set("source_server_id", props.SourceServerResourceID) + } + + if props.Network.DelegatedSubnetResourceID != nil { + d.Set("delegated_subnet_id", props.Network.DelegatedSubnetResourceID) } if err := d.Set("maintenance_window", flattenArmServerMaintenanceWindow(props.MaintenanceWindow)); err != nil { return fmt.Errorf("setting `maintenance_window`: %+v", err) } - if storage := props.StorageProfile; storage != nil { - d.Set("storage_mb", storage.StorageMB) - d.Set("backup_retention_days", storage.BackupRetentionDays) + if storage := props.Storage; storage != nil { + d.Set("storage_mb", (*storage.StorageSizeGB * 1024)) + } + + if backup := props.Backup; backup != nil { + d.Set("backup_retention_days", backup.BackupRetentionDays) } } @@ -388,8 +387,12 @@ func resourcePostgresqlFlexibleServerUpdate(d *pluginsdk.ResourceData, meta inte parameters.ServerPropertiesForUpdate.AdministratorLoginPassword = utils.String(d.Get("administrator_password").(string)) } - if d.HasChange("backup_retention_days") || d.HasChange("storage_mb") { - parameters.ServerPropertiesForUpdate.StorageProfile = expandArmServerStorageProfile(d) + if d.HasChange("storage_mb") { + parameters.ServerPropertiesForUpdate.Storage = expandArmServerStorage(d) + } + + if d.HasChange("backup_retention_days") { + parameters.ServerPropertiesForUpdate.Backup = expandArmServerBackup(d) } if d.HasChange("maintenance_window") { @@ -441,26 +444,26 @@ func resourcePostgresqlFlexibleServerDelete(d *pluginsdk.ResourceData, meta inte return nil } -func expandArmServerServerPropertiesDelegatedSubnetArguments(input string) *postgresqlflexibleservers.ServerPropertiesDelegatedSubnetArguments { - if len(input) == 0 { - return nil - } +func expandArmServerNetwork(d *pluginsdk.ResourceData) *postgresqlflexibleservers.Network { + network := postgresqlflexibleservers.Network{} - return &postgresqlflexibleservers.ServerPropertiesDelegatedSubnetArguments{ - SubnetArmResourceID: utils.String(input), + if v, ok := d.GetOk("delegated_subnet_id"); ok { + network.DelegatedSubnetResourceID = utils.String(v.(string)) } + + return &network } func expandArmServerMaintenanceWindow(input []interface{}) *postgresqlflexibleservers.MaintenanceWindow { if len(input) == 0 { return &postgresqlflexibleservers.MaintenanceWindow{ - CustomWindow: utils.String(string(postgresqlflexibleservers.Disabled)), + CustomWindow: utils.String(ServerMaintenanceWindowDisabled), } } v := input[0].(map[string]interface{}) maintenanceWindow := postgresqlflexibleservers.MaintenanceWindow{ - CustomWindow: utils.String(string(postgresqlflexibleservers.Enabled)), + CustomWindow: utils.String(ServerMaintenanceWindowEnabled), StartHour: utils.Int32(int32(v["start_hour"].(int))), StartMinute: utils.Int32(int32(v["start_minute"].(int))), DayOfWeek: utils.Int32(int32(v["day_of_week"].(int))), @@ -469,20 +472,26 @@ func expandArmServerMaintenanceWindow(input []interface{}) *postgresqlflexiblese return &maintenanceWindow } -func expandArmServerStorageProfile(d *pluginsdk.ResourceData) *postgresqlflexibleservers.StorageProfile { - storage := postgresqlflexibleservers.StorageProfile{} - - if v, ok := d.GetOk("backup_retention_days"); ok { - storage.BackupRetentionDays = utils.Int32(int32(v.(int))) - } +func expandArmServerStorage(d *pluginsdk.ResourceData) *postgresqlflexibleservers.Storage { + storage := postgresqlflexibleservers.Storage{} if v, ok := d.GetOk("storage_mb"); ok { - storage.StorageMB = utils.Int32(int32(v.(int))) + storage.StorageSizeGB = utils.Int32(int32(v.(int) / 1024)) } return &storage } +func expandArmServerBackup(d *pluginsdk.ResourceData) *postgresqlflexibleservers.Backup { + backup := postgresqlflexibleservers.Backup{} + + if v, ok := d.GetOk("backup_retention_days"); ok { + backup.BackupRetentionDays = utils.Int32(int32(v.(int))) + } + + return &backup +} + func expandFlexibleServerSku(name string) (*postgresqlflexibleservers.Sku, error) { if name == "" { return nil, nil @@ -492,11 +501,11 @@ func expandFlexibleServerSku(name string) (*postgresqlflexibleservers.Sku, error var tier postgresqlflexibleservers.SkuTier switch strings.TrimSuffix(parts[0], "_") { case "B": - tier = postgresqlflexibleservers.Burstable + tier = postgresqlflexibleservers.SkuTierBurstable case "GP": - tier = postgresqlflexibleservers.GeneralPurpose + tier = postgresqlflexibleservers.SkuTierGeneralPurpose case "MO": - tier = postgresqlflexibleservers.MemoryOptimized + tier = postgresqlflexibleservers.SkuTierMemoryOptimized default: return nil, fmt.Errorf("sku_name %s has unknown sku tier %s", name, parts[0]) } @@ -514,11 +523,11 @@ func flattenFlexibleServerSku(sku *postgresqlflexibleservers.Sku) (string, error var tier string switch sku.Tier { - case postgresqlflexibleservers.Burstable: + case postgresqlflexibleservers.SkuTierBurstable: tier = "B" - case postgresqlflexibleservers.GeneralPurpose: + case postgresqlflexibleservers.SkuTierGeneralPurpose: tier = "GP" - case postgresqlflexibleservers.MemoryOptimized: + case postgresqlflexibleservers.SkuTierMemoryOptimized: tier = "MO" default: return "", fmt.Errorf("sku_name has unknown sku tier %s", sku.Tier) @@ -528,7 +537,7 @@ func flattenFlexibleServerSku(sku *postgresqlflexibleservers.Sku) (string, error } func flattenArmServerMaintenanceWindow(input *postgresqlflexibleservers.MaintenanceWindow) []interface{} { - if input == nil || input.CustomWindow == nil || *input.CustomWindow == string(postgresqlflexibleservers.Disabled) { + if input == nil || input.CustomWindow == nil || *input.CustomWindow == string(ServerMaintenanceWindowDisabled) { return make([]interface{}, 0) } diff --git a/azurerm/internal/services/postgres/postgresql_flexible_server_resource_test.go b/azurerm/internal/services/postgres/postgresql_flexible_server_resource_test.go index 3ad942c88a78..b909148e440a 100644 --- a/azurerm/internal/services/postgres/postgresql_flexible_server_resource_test.go +++ b/azurerm/internal/services/postgres/postgresql_flexible_server_resource_test.go @@ -26,7 +26,6 @@ func TestAccPostgresqlflexibleServer_basic(t *testing.T) { Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), check.That(data.ResourceName).Key("zone").Exists(), - check.That(data.ResourceName).Key("cmk_enabled").Exists(), check.That(data.ResourceName).Key("fqdn").Exists(), check.That(data.ResourceName).Key("public_network_access_enabled").Exists(), ), @@ -57,7 +56,6 @@ func TestAccPostgresqlflexibleServer_complete(t *testing.T) { Config: r.complete(data), Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), - check.That(data.ResourceName).Key("cmk_enabled").Exists(), check.That(data.ResourceName).Key("fqdn").Exists(), check.That(data.ResourceName).Key("public_network_access_enabled").Exists(), ), @@ -74,7 +72,6 @@ func TestAccPostgresqlflexibleServer_completeUpdate(t *testing.T) { Config: r.complete(data), Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), - check.That(data.ResourceName).Key("cmk_enabled").Exists(), check.That(data.ResourceName).Key("fqdn").Exists(), check.That(data.ResourceName).Key("public_network_access_enabled").Exists(), ), @@ -84,7 +81,6 @@ func TestAccPostgresqlflexibleServer_completeUpdate(t *testing.T) { Config: r.completeUpdate(data), Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), - check.That(data.ResourceName).Key("cmk_enabled").Exists(), check.That(data.ResourceName).Key("fqdn").Exists(), check.That(data.ResourceName).Key("public_network_access_enabled").Exists(), ), @@ -102,7 +98,6 @@ func TestAccPostgresqlflexibleServer_updateMaintenanceWindow(t *testing.T) { Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), check.That(data.ResourceName).Key("zone").Exists(), - check.That(data.ResourceName).Key("cmk_enabled").Exists(), check.That(data.ResourceName).Key("fqdn").Exists(), check.That(data.ResourceName).Key("public_network_access_enabled").Exists(), ), @@ -113,7 +108,6 @@ func TestAccPostgresqlflexibleServer_updateMaintenanceWindow(t *testing.T) { Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), check.That(data.ResourceName).Key("zone").Exists(), - check.That(data.ResourceName).Key("cmk_enabled").Exists(), check.That(data.ResourceName).Key("fqdn").Exists(), check.That(data.ResourceName).Key("public_network_access_enabled").Exists(), ), @@ -124,7 +118,6 @@ func TestAccPostgresqlflexibleServer_updateMaintenanceWindow(t *testing.T) { Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), check.That(data.ResourceName).Key("zone").Exists(), - check.That(data.ResourceName).Key("cmk_enabled").Exists(), check.That(data.ResourceName).Key("fqdn").Exists(), check.That(data.ResourceName).Key("public_network_access_enabled").Exists(), ), @@ -135,7 +128,6 @@ func TestAccPostgresqlflexibleServer_updateMaintenanceWindow(t *testing.T) { Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), check.That(data.ResourceName).Key("zone").Exists(), - check.That(data.ResourceName).Key("cmk_enabled").Exists(), check.That(data.ResourceName).Key("fqdn").Exists(), check.That(data.ResourceName).Key("public_network_access_enabled").Exists(), ), @@ -153,7 +145,6 @@ func TestAccPostgresqlflexibleServer_updateSku(t *testing.T) { Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), check.That(data.ResourceName).Key("zone").Exists(), - check.That(data.ResourceName).Key("cmk_enabled").Exists(), check.That(data.ResourceName).Key("fqdn").Exists(), check.That(data.ResourceName).Key("public_network_access_enabled").Exists(), ), @@ -164,7 +155,6 @@ func TestAccPostgresqlflexibleServer_updateSku(t *testing.T) { Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), check.That(data.ResourceName).Key("zone").Exists(), - check.That(data.ResourceName).Key("cmk_enabled").Exists(), check.That(data.ResourceName).Key("fqdn").Exists(), check.That(data.ResourceName).Key("public_network_access_enabled").Exists(), ), @@ -175,7 +165,6 @@ func TestAccPostgresqlflexibleServer_updateSku(t *testing.T) { Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), check.That(data.ResourceName).Key("zone").Exists(), - check.That(data.ResourceName).Key("cmk_enabled").Exists(), check.That(data.ResourceName).Key("fqdn").Exists(), check.That(data.ResourceName).Key("public_network_access_enabled").Exists(), ), @@ -193,7 +182,6 @@ func TestAccPostgresqlflexibleServer_pitr(t *testing.T) { Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), check.That(data.ResourceName).Key("zone").Exists(), - check.That(data.ResourceName).Key("cmk_enabled").Exists(), check.That(data.ResourceName).Key("fqdn").Exists(), check.That(data.ResourceName).Key("public_network_access_enabled").Exists(), ), @@ -205,7 +193,6 @@ func TestAccPostgresqlflexibleServer_pitr(t *testing.T) { Check: acceptance.ComposeTestCheckFunc( check.That("azurerm_postgresql_flexible_server.pitr").ExistsInAzure(r), check.That("azurerm_postgresql_flexible_server.pitr").Key("zone").Exists(), - check.That("azurerm_postgresql_flexible_server.pitr").Key("cmk_enabled").Exists(), check.That("azurerm_postgresql_flexible_server.pitr").Key("fqdn").Exists(), check.That("azurerm_postgresql_flexible_server.pitr").Key("public_network_access_enabled").Exists(), ), @@ -310,7 +297,7 @@ resource "azurerm_postgresql_flexible_server" "test" { administrator_login = "adminTerraform" administrator_password = "QAZwsx123" zone = "1" - version = "12" + version = "13" backup_retention_days = 7 storage_mb = 32768 delegated_subnet_id = azurerm_subnet.test.id @@ -364,7 +351,7 @@ resource "azurerm_postgresql_flexible_server" "test" { administrator_login = "adminTerraform" administrator_password = "123wsxQAZ" zone = "1" - version = "12" + version = "13" backup_retention_days = 10 storage_mb = 65536 delegated_subnet_id = azurerm_subnet.test.id diff --git a/go.mod b/go.mod index 273160f722f9..80e7eddaa751 100644 --- a/go.mod +++ b/go.mod @@ -2,7 +2,7 @@ module github.com/terraform-providers/terraform-provider-azurerm require ( cloud.google.com/go/storage v1.16.0 // indirect - github.com/Azure/azure-sdk-for-go v55.3.0+incompatible + github.com/Azure/azure-sdk-for-go v55.4.0+incompatible github.com/Azure/go-autorest/autorest v0.11.19 github.com/Azure/go-autorest/autorest/adal v0.9.14 // indirect github.com/Azure/go-autorest/autorest/date v0.3.0 diff --git a/go.sum b/go.sum index 28e8e2cc44d4..ff8ed8261570 100644 --- a/go.sum +++ b/go.sum @@ -45,8 +45,8 @@ dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7 github.com/Azure/azure-sdk-for-go v45.0.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= github.com/Azure/azure-sdk-for-go v47.1.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= github.com/Azure/azure-sdk-for-go v51.2.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= -github.com/Azure/azure-sdk-for-go v55.3.0+incompatible h1:rLKCdFMMCAXt/QZ96skZJUArYS3UDo9Qm1ZWzoDtC9E= -github.com/Azure/azure-sdk-for-go v55.3.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= +github.com/Azure/azure-sdk-for-go v55.4.0+incompatible h1:zn3+QwgCjRgIRgE0iWpF2LrFy5er/T0e5/EHrp1Zgak= +github.com/Azure/azure-sdk-for-go v55.4.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= github.com/Azure/go-autorest v14.2.0+incompatible h1:V5VMDjClD3GiElqLWO7mz2MxNAK/vTfRHdAubSIPRgs= github.com/Azure/go-autorest v14.2.0+incompatible/go.mod h1:r+4oMnoxhatjLLJ6zxSWATqVooLgysK6ZNox3g/xq24= github.com/Azure/go-autorest/autorest v0.11.3/go.mod h1:JFgpikqFJ/MleTTxwepExTKnFUKKszPS8UavbQYUMuw= diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2021-06-01/postgresqlflexibleservers/CHANGELOG.md b/vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2021-06-01/postgresqlflexibleservers/CHANGELOG.md new file mode 100644 index 000000000000..52911e4cc5e4 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2021-06-01/postgresqlflexibleservers/CHANGELOG.md @@ -0,0 +1,2 @@ +# Change History + diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2021-06-01/postgresqlflexibleservers/_meta.json b/vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2021-06-01/postgresqlflexibleservers/_meta.json new file mode 100644 index 000000000000..64b0ebcc1a17 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2021-06-01/postgresqlflexibleservers/_meta.json @@ -0,0 +1,11 @@ +{ + "commit": "8dff86df71bee429af84ea4713288ef3cdd1db2f", + "readme": "/_/azure-rest-api-specs/specification/postgresql/resource-manager/readme.md", + "tag": "package-flexibleserver-2021-06", + "use": "@microsoft.azure/autorest.go@2.1.183", + "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", + "autorest_command": "autorest --use=@microsoft.azure/autorest.go@2.1.183 --tag=package-flexibleserver-2021-06 --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=V2 --go.license-header=MICROSOFT_MIT_NO_VERSION --enum-prefix /_/azure-rest-api-specs/specification/postgresql/resource-manager/readme.md", + "additional_properties": { + "additional_options": "--go --verbose --use-onever --version=V2 --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/postgresql/mgmt/2020-02-14-preview/postgresqlflexibleservers/checknameavailability.go b/vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2021-06-01/postgresqlflexibleservers/checknameavailability.go similarity index 99% rename from vendor/github.com/Azure/azure-sdk-for-go/services/preview/postgresql/mgmt/2020-02-14-preview/postgresqlflexibleservers/checknameavailability.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2021-06-01/postgresqlflexibleservers/checknameavailability.go index 451c400734a7..f8187aaf040e 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/postgresql/mgmt/2020-02-14-preview/postgresqlflexibleservers/checknameavailability.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2021-06-01/postgresqlflexibleservers/checknameavailability.go @@ -84,7 +84,7 @@ func (client CheckNameAvailabilityClient) ExecutePreparer(ctx context.Context, n "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2020-02-14-preview" + const APIVersion = "2021-06-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/postgresql/mgmt/2020-02-14-preview/postgresqlflexibleservers/client.go b/vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2021-06-01/postgresqlflexibleservers/client.go similarity index 96% rename from vendor/github.com/Azure/azure-sdk-for-go/services/preview/postgresql/mgmt/2020-02-14-preview/postgresqlflexibleservers/client.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2021-06-01/postgresqlflexibleservers/client.go index c3956fc8cf31..a3b40a7fc77a 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/postgresql/mgmt/2020-02-14-preview/postgresqlflexibleservers/client.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2021-06-01/postgresqlflexibleservers/client.go @@ -1,5 +1,4 @@ -// Package postgresqlflexibleservers implements the Azure ARM Postgresqlflexibleservers service API version -// 2020-02-14-preview. +// Package postgresqlflexibleservers implements the Azure ARM Postgresqlflexibleservers service API version 2021-06-01. // // The Microsoft Azure management API provides create, read, update, and delete functionality for Azure PostgreSQL // resources including servers, databases, firewall rules, VNET rules, security alert policies, log files and diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/postgresql/mgmt/2020-02-14-preview/postgresqlflexibleservers/configurations.go b/vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2021-06-01/postgresqlflexibleservers/configurations.go similarity index 77% rename from vendor/github.com/Azure/azure-sdk-for-go/services/preview/postgresql/mgmt/2020-02-14-preview/postgresqlflexibleservers/configurations.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2021-06-01/postgresqlflexibleservers/configurations.go index bd7cfde6d96d..5b2fa4b70660 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/postgresql/mgmt/2020-02-14-preview/postgresqlflexibleservers/configurations.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2021-06-01/postgresqlflexibleservers/configurations.go @@ -54,8 +54,7 @@ func (client ConfigurationsClient) Get(ctx context.Context, resourceGroupName st Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("postgresqlflexibleservers.ConfigurationsClient", "Get", err.Error()) } @@ -90,7 +89,7 @@ func (client ConfigurationsClient) GetPreparer(ctx context.Context, resourceGrou "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2020-02-14-preview" + const APIVersion = "2021-06-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -141,8 +140,7 @@ func (client ConfigurationsClient) ListByServer(ctx context.Context, resourceGro Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("postgresqlflexibleservers.ConfigurationsClient", "ListByServer", err.Error()) } @@ -181,7 +179,7 @@ func (client ConfigurationsClient) ListByServerPreparer(ctx context.Context, res "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2020-02-14-preview" + const APIVersion = "2021-06-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -249,6 +247,99 @@ func (client ConfigurationsClient) ListByServerComplete(ctx context.Context, res return } +// Put updates a configuration of a server. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// serverName - the name of the server. +// configurationName - the name of the server configuration. +// parameters - the required parameters for updating a server configuration. +func (client ConfigurationsClient) Put(ctx context.Context, resourceGroupName string, serverName string, configurationName string, parameters Configuration) (result ConfigurationsPutFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ConfigurationsClient.Put") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("postgresqlflexibleservers.ConfigurationsClient", "Put", err.Error()) + } + + req, err := client.PutPreparer(ctx, resourceGroupName, serverName, configurationName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "postgresqlflexibleservers.ConfigurationsClient", "Put", nil, "Failure preparing request") + return + } + + result, err = client.PutSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "postgresqlflexibleservers.ConfigurationsClient", "Put", nil, "Failure sending request") + return + } + + return +} + +// PutPreparer prepares the Put request. +func (client ConfigurationsClient) PutPreparer(ctx context.Context, resourceGroupName string, serverName string, configurationName string, parameters Configuration) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "configurationName": autorest.Encode("path", configurationName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serverName": autorest.Encode("path", serverName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + parameters.SystemData = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBForPostgreSql/flexibleServers/{serverName}/configurations/{configurationName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// PutSender sends the Put request. The method will close the +// http.Response Body if it receives an error. +func (client ConfigurationsClient) PutSender(req *http.Request) (future ConfigurationsPutFuture, err error) { + var resp *http.Response + 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 +} + +// PutResponder handles the response to the Put request. The method always +// closes the http.Response Body. +func (client ConfigurationsClient) PutResponder(resp *http.Response) (result Configuration, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + // Update updates a configuration of a server. // Parameters: // resourceGroupName - the name of the resource group. The name is case insensitive. @@ -271,8 +362,7 @@ func (client ConfigurationsClient) Update(ctx context.Context, resourceGroupName Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("postgresqlflexibleservers.ConfigurationsClient", "Update", err.Error()) } @@ -300,11 +390,12 @@ func (client ConfigurationsClient) UpdatePreparer(ctx context.Context, resourceG "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2020-02-14-preview" + const APIVersion = "2021-06-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } + parameters.SystemData = nil preparer := autorest.CreatePreparer( autorest.AsContentType("application/json; charset=utf-8"), autorest.AsPatch(), diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2021-06-01/postgresqlflexibleservers/databases.go b/vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2021-06-01/postgresqlflexibleservers/databases.go new file mode 100644 index 000000000000..6e9a51c8dc71 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2021-06-01/postgresqlflexibleservers/databases.go @@ -0,0 +1,429 @@ +package postgresqlflexibleservers + +// 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. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// DatabasesClient is the the Microsoft Azure management API provides create, read, update, and delete functionality +// for Azure PostgreSQL resources including servers, databases, firewall rules, VNET rules, security alert policies, +// log files and configurations with new business model. +type DatabasesClient struct { + BaseClient +} + +// NewDatabasesClient creates an instance of the DatabasesClient client. +func NewDatabasesClient(subscriptionID string) DatabasesClient { + return NewDatabasesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewDatabasesClientWithBaseURI creates an instance of the DatabasesClient client using a custom endpoint. Use this +// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewDatabasesClientWithBaseURI(baseURI string, subscriptionID string) DatabasesClient { + return DatabasesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Create creates a new database or updates an existing database. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// serverName - the name of the server. +// databaseName - the name of the database. +// parameters - the required parameters for creating or updating a database. +func (client DatabasesClient) Create(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters Database) (result DatabasesCreateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DatabasesClient.Create") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("postgresqlflexibleservers.DatabasesClient", "Create", err.Error()) + } + + req, err := client.CreatePreparer(ctx, resourceGroupName, serverName, databaseName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "postgresqlflexibleservers.DatabasesClient", "Create", nil, "Failure preparing request") + return + } + + result, err = client.CreateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "postgresqlflexibleservers.DatabasesClient", "Create", nil, "Failure sending request") + return + } + + return +} + +// CreatePreparer prepares the Create request. +func (client DatabasesClient) CreatePreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters Database) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "databaseName": autorest.Encode("path", databaseName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serverName": autorest.Encode("path", serverName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + parameters.SystemData = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBForPostgreSql/flexibleServers/{serverName}/databases/{databaseName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateSender sends the Create request. The method will close the +// http.Response Body if it receives an error. +func (client DatabasesClient) CreateSender(req *http.Request) (future DatabasesCreateFuture, err error) { + var resp *http.Response + 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 +} + +// CreateResponder handles the response to the Create request. The method always +// closes the http.Response Body. +func (client DatabasesClient) CreateResponder(resp *http.Response) (result Database, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes a database. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// serverName - the name of the server. +// databaseName - the name of the database. +func (client DatabasesClient) Delete(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result DatabasesDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DatabasesClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("postgresqlflexibleservers.DatabasesClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, serverName, databaseName) + if err != nil { + err = autorest.NewErrorWithError(err, "postgresqlflexibleservers.DatabasesClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "postgresqlflexibleservers.DatabasesClient", "Delete", nil, "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client DatabasesClient) DeletePreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "databaseName": autorest.Encode("path", databaseName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serverName": autorest.Encode("path", serverName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBForPostgreSql/flexibleServers/{serverName}/databases/{databaseName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client DatabasesClient) DeleteSender(req *http.Request) (future DatabasesDeleteFuture, err error) { + var resp *http.Response + 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 +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client DatabasesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets information about a database. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// serverName - the name of the server. +// databaseName - the name of the database. +func (client DatabasesClient) Get(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result Database, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DatabasesClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("postgresqlflexibleservers.DatabasesClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, serverName, databaseName) + if err != nil { + err = autorest.NewErrorWithError(err, "postgresqlflexibleservers.DatabasesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "postgresqlflexibleservers.DatabasesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "postgresqlflexibleservers.DatabasesClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client DatabasesClient) GetPreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "databaseName": autorest.Encode("path", databaseName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serverName": autorest.Encode("path", serverName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBForPostgreSql/flexibleServers/{serverName}/databases/{databaseName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client DatabasesClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client DatabasesClient) GetResponder(resp *http.Response) (result Database, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByServer list all the databases in a given server. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// serverName - the name of the server. +func (client DatabasesClient) ListByServer(ctx context.Context, resourceGroupName string, serverName string) (result DatabaseListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DatabasesClient.ListByServer") + defer func() { + sc := -1 + if result.dlr.Response.Response != nil { + sc = result.dlr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("postgresqlflexibleservers.DatabasesClient", "ListByServer", err.Error()) + } + + result.fn = client.listByServerNextResults + req, err := client.ListByServerPreparer(ctx, resourceGroupName, serverName) + if err != nil { + err = autorest.NewErrorWithError(err, "postgresqlflexibleservers.DatabasesClient", "ListByServer", nil, "Failure preparing request") + return + } + + resp, err := client.ListByServerSender(req) + if err != nil { + result.dlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "postgresqlflexibleservers.DatabasesClient", "ListByServer", resp, "Failure sending request") + return + } + + result.dlr, err = client.ListByServerResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "postgresqlflexibleservers.DatabasesClient", "ListByServer", resp, "Failure responding to request") + return + } + if result.dlr.hasNextLink() && result.dlr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListByServerPreparer prepares the ListByServer request. +func (client DatabasesClient) ListByServerPreparer(ctx context.Context, resourceGroupName string, serverName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serverName": autorest.Encode("path", serverName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBForPostgreSql/flexibleServers/{serverName}/databases", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByServerSender sends the ListByServer request. The method will close the +// http.Response Body if it receives an error. +func (client DatabasesClient) ListByServerSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByServerResponder handles the response to the ListByServer request. The method always +// closes the http.Response Body. +func (client DatabasesClient) ListByServerResponder(resp *http.Response) (result DatabaseListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByServerNextResults retrieves the next set of results, if any. +func (client DatabasesClient) listByServerNextResults(ctx context.Context, lastResults DatabaseListResult) (result DatabaseListResult, err error) { + req, err := lastResults.databaseListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "postgresqlflexibleservers.DatabasesClient", "listByServerNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByServerSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "postgresqlflexibleservers.DatabasesClient", "listByServerNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByServerResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "postgresqlflexibleservers.DatabasesClient", "listByServerNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByServerComplete enumerates all values, automatically crossing page boundaries as required. +func (client DatabasesClient) ListByServerComplete(ctx context.Context, resourceGroupName string, serverName string) (result DatabaseListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DatabasesClient.ListByServer") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListByServer(ctx, resourceGroupName, serverName) + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2021-06-01/postgresqlflexibleservers/enums.go b/vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2021-06-01/postgresqlflexibleservers/enums.go new file mode 100644 index 000000000000..9941d56ca3c7 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2021-06-01/postgresqlflexibleservers/enums.go @@ -0,0 +1,236 @@ +package postgresqlflexibleservers + +// 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. + +// ConfigurationDataType enumerates the values for configuration data type. +type ConfigurationDataType string + +const ( + // ConfigurationDataTypeBoolean ... + ConfigurationDataTypeBoolean ConfigurationDataType = "Boolean" + // ConfigurationDataTypeEnumeration ... + ConfigurationDataTypeEnumeration ConfigurationDataType = "Enumeration" + // ConfigurationDataTypeInteger ... + ConfigurationDataTypeInteger ConfigurationDataType = "Integer" + // ConfigurationDataTypeNumeric ... + ConfigurationDataTypeNumeric ConfigurationDataType = "Numeric" +) + +// PossibleConfigurationDataTypeValues returns an array of possible values for the ConfigurationDataType const type. +func PossibleConfigurationDataTypeValues() []ConfigurationDataType { + return []ConfigurationDataType{ConfigurationDataTypeBoolean, ConfigurationDataTypeEnumeration, ConfigurationDataTypeInteger, ConfigurationDataTypeNumeric} +} + +// 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} +} + +// CreateMode enumerates the values for create mode. +type CreateMode string + +const ( + // CreateModeCreate ... + CreateModeCreate CreateMode = "Create" + // CreateModeDefault ... + CreateModeDefault CreateMode = "Default" + // CreateModePointInTimeRestore ... + CreateModePointInTimeRestore CreateMode = "PointInTimeRestore" + // CreateModeUpdate ... + CreateModeUpdate CreateMode = "Update" +) + +// PossibleCreateModeValues returns an array of possible values for the CreateMode const type. +func PossibleCreateModeValues() []CreateMode { + return []CreateMode{CreateModeCreate, CreateModeDefault, CreateModePointInTimeRestore, CreateModeUpdate} +} + +// CreateModeForUpdate enumerates the values for create mode for update. +type CreateModeForUpdate string + +const ( + // CreateModeForUpdateDefault ... + CreateModeForUpdateDefault CreateModeForUpdate = "Default" + // CreateModeForUpdateUpdate ... + CreateModeForUpdateUpdate CreateModeForUpdate = "Update" +) + +// PossibleCreateModeForUpdateValues returns an array of possible values for the CreateModeForUpdate const type. +func PossibleCreateModeForUpdateValues() []CreateModeForUpdate { + return []CreateModeForUpdate{CreateModeForUpdateDefault, CreateModeForUpdateUpdate} +} + +// GeoRedundantBackupEnum enumerates the values for geo redundant backup enum. +type GeoRedundantBackupEnum string + +const ( + // GeoRedundantBackupEnumDisabled ... + GeoRedundantBackupEnumDisabled GeoRedundantBackupEnum = "Disabled" + // GeoRedundantBackupEnumEnabled ... + GeoRedundantBackupEnumEnabled GeoRedundantBackupEnum = "Enabled" +) + +// PossibleGeoRedundantBackupEnumValues returns an array of possible values for the GeoRedundantBackupEnum const type. +func PossibleGeoRedundantBackupEnumValues() []GeoRedundantBackupEnum { + return []GeoRedundantBackupEnum{GeoRedundantBackupEnumDisabled, GeoRedundantBackupEnumEnabled} +} + +// HighAvailabilityMode enumerates the values for high availability mode. +type HighAvailabilityMode string + +const ( + // HighAvailabilityModeDisabled ... + HighAvailabilityModeDisabled HighAvailabilityMode = "Disabled" + // HighAvailabilityModeZoneRedundant ... + HighAvailabilityModeZoneRedundant HighAvailabilityMode = "ZoneRedundant" +) + +// PossibleHighAvailabilityModeValues returns an array of possible values for the HighAvailabilityMode const type. +func PossibleHighAvailabilityModeValues() []HighAvailabilityMode { + return []HighAvailabilityMode{HighAvailabilityModeDisabled, HighAvailabilityModeZoneRedundant} +} + +// OperationOrigin enumerates the values for operation origin. +type OperationOrigin string + +const ( + // OperationOriginNotSpecified ... + OperationOriginNotSpecified OperationOrigin = "NotSpecified" + // 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{OperationOriginNotSpecified, OperationOriginSystem, OperationOriginUser} +} + +// ResourceIdentityType enumerates the values for resource identity type. +type ResourceIdentityType string + +const ( + // ResourceIdentityTypeSystemAssigned ... + ResourceIdentityTypeSystemAssigned ResourceIdentityType = "SystemAssigned" +) + +// PossibleResourceIdentityTypeValues returns an array of possible values for the ResourceIdentityType const type. +func PossibleResourceIdentityTypeValues() []ResourceIdentityType { + return []ResourceIdentityType{ResourceIdentityTypeSystemAssigned} +} + +// ServerHAState enumerates the values for server ha state. +type ServerHAState string + +const ( + // ServerHAStateCreatingStandby ... + ServerHAStateCreatingStandby ServerHAState = "CreatingStandby" + // ServerHAStateFailingOver ... + ServerHAStateFailingOver ServerHAState = "FailingOver" + // ServerHAStateHealthy ... + ServerHAStateHealthy ServerHAState = "Healthy" + // ServerHAStateNotEnabled ... + ServerHAStateNotEnabled ServerHAState = "NotEnabled" + // ServerHAStateRemovingStandby ... + ServerHAStateRemovingStandby ServerHAState = "RemovingStandby" + // ServerHAStateReplicatingData ... + ServerHAStateReplicatingData ServerHAState = "ReplicatingData" +) + +// PossibleServerHAStateValues returns an array of possible values for the ServerHAState const type. +func PossibleServerHAStateValues() []ServerHAState { + return []ServerHAState{ServerHAStateCreatingStandby, ServerHAStateFailingOver, ServerHAStateHealthy, ServerHAStateNotEnabled, ServerHAStateRemovingStandby, ServerHAStateReplicatingData} +} + +// ServerPublicNetworkAccessState enumerates the values for server public network access state. +type ServerPublicNetworkAccessState string + +const ( + // ServerPublicNetworkAccessStateDisabled ... + ServerPublicNetworkAccessStateDisabled ServerPublicNetworkAccessState = "Disabled" + // ServerPublicNetworkAccessStateEnabled ... + ServerPublicNetworkAccessStateEnabled ServerPublicNetworkAccessState = "Enabled" +) + +// PossibleServerPublicNetworkAccessStateValues returns an array of possible values for the ServerPublicNetworkAccessState const type. +func PossibleServerPublicNetworkAccessStateValues() []ServerPublicNetworkAccessState { + return []ServerPublicNetworkAccessState{ServerPublicNetworkAccessStateDisabled, ServerPublicNetworkAccessStateEnabled} +} + +// ServerState enumerates the values for server state. +type ServerState string + +const ( + // ServerStateDisabled ... + ServerStateDisabled ServerState = "Disabled" + // ServerStateDropping ... + ServerStateDropping ServerState = "Dropping" + // ServerStateReady ... + ServerStateReady ServerState = "Ready" + // ServerStateStarting ... + ServerStateStarting ServerState = "Starting" + // ServerStateStopped ... + ServerStateStopped ServerState = "Stopped" + // ServerStateStopping ... + ServerStateStopping ServerState = "Stopping" + // ServerStateUpdating ... + ServerStateUpdating ServerState = "Updating" +) + +// PossibleServerStateValues returns an array of possible values for the ServerState const type. +func PossibleServerStateValues() []ServerState { + return []ServerState{ServerStateDisabled, ServerStateDropping, ServerStateReady, ServerStateStarting, ServerStateStopped, ServerStateStopping, ServerStateUpdating} +} + +// ServerVersion enumerates the values for server version. +type ServerVersion string + +const ( + // ServerVersionOneOne ... + ServerVersionOneOne ServerVersion = "11" + // ServerVersionOneThree ... + ServerVersionOneThree ServerVersion = "13" + // ServerVersionOneTwo ... + ServerVersionOneTwo ServerVersion = "12" +) + +// PossibleServerVersionValues returns an array of possible values for the ServerVersion const type. +func PossibleServerVersionValues() []ServerVersion { + return []ServerVersion{ServerVersionOneOne, ServerVersionOneThree, ServerVersionOneTwo} +} + +// SkuTier enumerates the values for sku tier. +type SkuTier string + +const ( + // SkuTierBurstable ... + SkuTierBurstable SkuTier = "Burstable" + // SkuTierGeneralPurpose ... + SkuTierGeneralPurpose SkuTier = "GeneralPurpose" + // SkuTierMemoryOptimized ... + SkuTierMemoryOptimized SkuTier = "MemoryOptimized" +) + +// PossibleSkuTierValues returns an array of possible values for the SkuTier const type. +func PossibleSkuTierValues() []SkuTier { + return []SkuTier{SkuTierBurstable, SkuTierGeneralPurpose, SkuTierMemoryOptimized} +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/postgresql/mgmt/2020-02-14-preview/postgresqlflexibleservers/firewallrules.go b/vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2021-06-01/postgresqlflexibleservers/firewallrules.go similarity index 96% rename from vendor/github.com/Azure/azure-sdk-for-go/services/preview/postgresql/mgmt/2020-02-14-preview/postgresqlflexibleservers/firewallrules.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2021-06-01/postgresqlflexibleservers/firewallrules.go index 2c2483d9851d..0e631a40aa53 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/postgresql/mgmt/2020-02-14-preview/postgresqlflexibleservers/firewallrules.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2021-06-01/postgresqlflexibleservers/firewallrules.go @@ -55,8 +55,7 @@ func (client FirewallRulesClient) CreateOrUpdate(ctx context.Context, resourceGr Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: parameters, Constraints: []validation.Constraint{{Target: "parameters.FirewallRuleProperties", Name: validation.Null, Rule: true, Chain: []validation.Constraint{{Target: "parameters.FirewallRuleProperties.StartIPAddress", Name: validation.Null, Rule: true, @@ -91,11 +90,12 @@ func (client FirewallRulesClient) CreateOrUpdatePreparer(ctx context.Context, re "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2020-02-14-preview" + const APIVersion = "2021-06-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } + parameters.SystemData = nil preparer := autorest.CreatePreparer( autorest.AsContentType("application/json; charset=utf-8"), autorest.AsPut(), @@ -154,8 +154,7 @@ func (client FirewallRulesClient) Delete(ctx context.Context, resourceGroupName Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("postgresqlflexibleservers.FirewallRulesClient", "Delete", err.Error()) } @@ -183,7 +182,7 @@ func (client FirewallRulesClient) DeletePreparer(ctx context.Context, resourceGr "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2020-02-14-preview" + const APIVersion = "2021-06-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -243,8 +242,7 @@ func (client FirewallRulesClient) Get(ctx context.Context, resourceGroupName str Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("postgresqlflexibleservers.FirewallRulesClient", "Get", err.Error()) } @@ -279,7 +277,7 @@ func (client FirewallRulesClient) GetPreparer(ctx context.Context, resourceGroup "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2020-02-14-preview" + const APIVersion = "2021-06-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -330,8 +328,7 @@ func (client FirewallRulesClient) ListByServer(ctx context.Context, resourceGrou Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("postgresqlflexibleservers.FirewallRulesClient", "ListByServer", err.Error()) } @@ -370,7 +367,7 @@ func (client FirewallRulesClient) ListByServerPreparer(ctx context.Context, reso "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2020-02-14-preview" + const APIVersion = "2021-06-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2021-06-01/postgresqlflexibleservers/getprivatednszonesuffix.go b/vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2021-06-01/postgresqlflexibleservers/getprivatednszonesuffix.go new file mode 100644 index 000000000000..0c0fe2ef390c --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2021-06-01/postgresqlflexibleservers/getprivatednszonesuffix.go @@ -0,0 +1,101 @@ +package postgresqlflexibleservers + +// 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. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// GetPrivateDNSZoneSuffixClient is the the Microsoft Azure management API provides create, read, update, and delete +// functionality for Azure PostgreSQL resources including servers, databases, firewall rules, VNET rules, security +// alert policies, log files and configurations with new business model. +type GetPrivateDNSZoneSuffixClient struct { + BaseClient +} + +// NewGetPrivateDNSZoneSuffixClient creates an instance of the GetPrivateDNSZoneSuffixClient client. +func NewGetPrivateDNSZoneSuffixClient(subscriptionID string) GetPrivateDNSZoneSuffixClient { + return NewGetPrivateDNSZoneSuffixClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewGetPrivateDNSZoneSuffixClientWithBaseURI creates an instance of the GetPrivateDNSZoneSuffixClient client using a +// custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, +// Azure stack). +func NewGetPrivateDNSZoneSuffixClientWithBaseURI(baseURI string, subscriptionID string) GetPrivateDNSZoneSuffixClient { + return GetPrivateDNSZoneSuffixClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Execute get private DNS zone suffix in the cloud +func (client GetPrivateDNSZoneSuffixClient) Execute(ctx context.Context) (result String, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/GetPrivateDNSZoneSuffixClient.Execute") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ExecutePreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "postgresqlflexibleservers.GetPrivateDNSZoneSuffixClient", "Execute", nil, "Failure preparing request") + return + } + + resp, err := client.ExecuteSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "postgresqlflexibleservers.GetPrivateDNSZoneSuffixClient", "Execute", resp, "Failure sending request") + return + } + + result, err = client.ExecuteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "postgresqlflexibleservers.GetPrivateDNSZoneSuffixClient", "Execute", resp, "Failure responding to request") + return + } + + return +} + +// ExecutePreparer prepares the Execute request. +func (client GetPrivateDNSZoneSuffixClient) ExecutePreparer(ctx context.Context) (*http.Request, error) { + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPath("/providers/Microsoft.DBForPostgreSql/getPrivateDnsZoneSuffix"), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ExecuteSender sends the Execute request. The method will close the +// http.Response Body if it receives an error. +func (client GetPrivateDNSZoneSuffixClient) ExecuteSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// ExecuteResponder handles the response to the Execute request. The method always +// closes the http.Response Body. +func (client GetPrivateDNSZoneSuffixClient) ExecuteResponder(resp *http.Response) (result String, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/postgresql/mgmt/2020-02-14-preview/postgresqlflexibleservers/locationbasedcapabilities.go b/vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2021-06-01/postgresqlflexibleservers/locationbasedcapabilities.go similarity index 99% rename from vendor/github.com/Azure/azure-sdk-for-go/services/preview/postgresql/mgmt/2020-02-14-preview/postgresqlflexibleservers/locationbasedcapabilities.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2021-06-01/postgresqlflexibleservers/locationbasedcapabilities.go index 55c5a6262db7..65d7191dcb73 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/postgresql/mgmt/2020-02-14-preview/postgresqlflexibleservers/locationbasedcapabilities.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2021-06-01/postgresqlflexibleservers/locationbasedcapabilities.go @@ -88,7 +88,7 @@ func (client LocationBasedCapabilitiesClient) ExecutePreparer(ctx context.Contex "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2020-02-14-preview" + const APIVersion = "2021-06-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/postgresql/mgmt/2020-02-14-preview/postgresqlflexibleservers/models.go b/vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2021-06-01/postgresqlflexibleservers/models.go similarity index 74% rename from vendor/github.com/Azure/azure-sdk-for-go/services/preview/postgresql/mgmt/2020-02-14-preview/postgresqlflexibleservers/models.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2021-06-01/postgresqlflexibleservers/models.go index 0c4edcedecd1..e3ae89b26bbb 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/postgresql/mgmt/2020-02-14-preview/postgresqlflexibleservers/models.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2021-06-01/postgresqlflexibleservers/models.go @@ -18,7 +18,7 @@ import ( ) // The package's fully qualified name. -const fqdn = "github.com/Azure/azure-sdk-for-go/services/preview/postgresql/mgmt/2020-02-14-preview/postgresqlflexibleservers" +const fqdn = "github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2021-06-01/postgresqlflexibleservers" // AzureEntityResource the resource model definition for an Azure Resource Manager resource with an etag. type AzureEntityResource struct { @@ -38,6 +38,28 @@ func (aer AzureEntityResource) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } +// Backup backup properties of a server +type Backup struct { + // BackupRetentionDays - Backup retention days for the server. + BackupRetentionDays *int32 `json:"backupRetentionDays,omitempty"` + // GeoRedundantBackup - A value indicating whether Geo-Redundant backup is enabled on the server. Possible values include: 'GeoRedundantBackupEnumEnabled', 'GeoRedundantBackupEnumDisabled' + GeoRedundantBackup GeoRedundantBackupEnum `json:"geoRedundantBackup,omitempty"` + // EarliestRestoreDate - READ-ONLY; The earliest restore point time (ISO8601 format) for server. + EarliestRestoreDate *date.Time `json:"earliestRestoreDate,omitempty"` +} + +// MarshalJSON is the custom marshaler for Backup. +func (b Backup) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if b.BackupRetentionDays != nil { + objectMap["backupRetentionDays"] = b.BackupRetentionDays + } + if b.GeoRedundantBackup != "" { + objectMap["geoRedundantBackup"] = b.GeoRedundantBackup + } + return json.Marshal(objectMap) +} + // CapabilitiesListResult location capability type CapabilitiesListResult struct { autorest.Response `json:"-"` @@ -207,8 +229,18 @@ func NewCapabilitiesListResultPage(cur CapabilitiesListResult, getNextPage func( type CapabilityProperties struct { // Zone - READ-ONLY; zone name Zone *string `json:"zone,omitempty"` + // GeoBackupSupported - READ-ONLY; A value indicating whether a new server in this region can have geo-backups to paired region. + GeoBackupSupported *bool `json:"geoBackupSupported,omitempty"` + // ZoneRedundantHaSupported - READ-ONLY; A value indicating whether a new server in this region can support multi zone HA. + ZoneRedundantHaSupported *bool `json:"zoneRedundantHaSupported,omitempty"` + // ZoneRedundantHaAndGeoBackupSupported - READ-ONLY; A value indicating whether a new server in this region can have geo-backups to paired region. + ZoneRedundantHaAndGeoBackupSupported *bool `json:"zoneRedundantHaAndGeoBackupSupported,omitempty"` // SupportedFlexibleServerEditions - READ-ONLY - SupportedFlexibleServerEditions *[]ServerEditionCapability `json:"supportedFlexibleServerEditions,omitempty"` + SupportedFlexibleServerEditions *[]FlexibleServerEditionCapability `json:"supportedFlexibleServerEditions,omitempty"` + // SupportedHyperscaleNodeEditions - READ-ONLY + SupportedHyperscaleNodeEditions *[]HyperscaleNodeEditionCapability `json:"supportedHyperscaleNodeEditions,omitempty"` + // Status - READ-ONLY; The status + Status *string `json:"status,omitempty"` } // MarshalJSON is the custom marshaler for CapabilityProperties. @@ -227,6 +259,8 @@ type Configuration struct { autorest.Response `json:"-"` // ConfigurationProperties - The properties of a configuration. *ConfigurationProperties `json:"properties,omitempty"` + // SystemData - READ-ONLY; The system metadata relating to this resource. + SystemData *SystemData `json:"systemData,omitempty"` // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} ID *string `json:"id,omitempty"` // Name - READ-ONLY; The name of the resource @@ -262,6 +296,15 @@ func (c *Configuration) UnmarshalJSON(body []byte) error { } c.ConfigurationProperties = &configurationProperties } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + c.SystemData = &systemData + } case "id": if v != nil { var ID string @@ -462,7 +505,7 @@ type ConfigurationProperties struct { Description *string `json:"description,omitempty"` // DefaultValue - READ-ONLY; Default value of the configuration. DefaultValue *string `json:"defaultValue,omitempty"` - // DataType - READ-ONLY; Data type of the configuration. Possible values include: 'Boolean', 'Numeric', 'Integer', 'Enumeration' + // DataType - READ-ONLY; Data type of the configuration. Possible values include: 'ConfigurationDataTypeBoolean', 'ConfigurationDataTypeNumeric', 'ConfigurationDataTypeInteger', 'ConfigurationDataTypeEnumeration' DataType ConfigurationDataType `json:"dataType,omitempty"` // AllowedValues - READ-ONLY; Allowed values of the configuration. AllowedValues *string `json:"allowedValues,omitempty"` @@ -482,6 +525,49 @@ func (cp ConfigurationProperties) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } +// ConfigurationsPutFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type ConfigurationsPutFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ConfigurationsClient) (Configuration, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ConfigurationsPutFuture) 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 ConfigurationsPutFuture.Result. +func (future *ConfigurationsPutFuture) result(client ConfigurationsClient) (c Configuration, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "postgresqlflexibleservers.ConfigurationsPutFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + c.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("postgresqlflexibleservers.ConfigurationsPutFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if c.Response.Response, err = future.GetResult(sender); err == nil && c.Response.Response.StatusCode != http.StatusNoContent { + c, err = client.PutResponder(c.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "postgresqlflexibleservers.ConfigurationsPutFuture", "Result", c.Response.Response, "Failure responding to request") + } + } + return +} + // ConfigurationsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running // operation. type ConfigurationsUpdateFuture struct { @@ -525,6 +611,337 @@ func (future *ConfigurationsUpdateFuture) result(client ConfigurationsClient) (c return } +// Database represents a Database. +type Database struct { + autorest.Response `json:"-"` + // DatabaseProperties - The properties of a database. + *DatabaseProperties `json:"properties,omitempty"` + // SystemData - READ-ONLY; The system metadata relating to this resource. + SystemData *SystemData `json:"systemData,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for Database. +func (d Database) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if d.DatabaseProperties != nil { + objectMap["properties"] = d.DatabaseProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for Database struct. +func (d *Database) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var databaseProperties DatabaseProperties + err = json.Unmarshal(*v, &databaseProperties) + if err != nil { + return err + } + d.DatabaseProperties = &databaseProperties + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + d.SystemData = &systemData + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + d.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + d.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + d.Type = &typeVar + } + } + } + + return nil +} + +// DatabaseListResult a List of databases. +type DatabaseListResult struct { + autorest.Response `json:"-"` + // Value - The list of databases housed in a server + Value *[]Database `json:"value,omitempty"` + // NextLink - The link used to get the next page of databases. + NextLink *string `json:"nextLink,omitempty"` +} + +// DatabaseListResultIterator provides access to a complete listing of Database values. +type DatabaseListResultIterator struct { + i int + page DatabaseListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *DatabaseListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *DatabaseListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter DatabaseListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter DatabaseListResultIterator) Response() DatabaseListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter DatabaseListResultIterator) Value() Database { + if !iter.page.NotDone() { + return Database{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the DatabaseListResultIterator type. +func NewDatabaseListResultIterator(page DatabaseListResultPage) DatabaseListResultIterator { + return DatabaseListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (dlr DatabaseListResult) IsEmpty() bool { + return dlr.Value == nil || len(*dlr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (dlr DatabaseListResult) hasNextLink() bool { + return dlr.NextLink != nil && len(*dlr.NextLink) != 0 +} + +// databaseListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (dlr DatabaseListResult) databaseListResultPreparer(ctx context.Context) (*http.Request, error) { + if !dlr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(dlr.NextLink))) +} + +// DatabaseListResultPage contains a page of Database values. +type DatabaseListResultPage struct { + fn func(context.Context, DatabaseListResult) (DatabaseListResult, error) + dlr DatabaseListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *DatabaseListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.dlr) + if err != nil { + return err + } + page.dlr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *DatabaseListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page DatabaseListResultPage) NotDone() bool { + return !page.dlr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page DatabaseListResultPage) Response() DatabaseListResult { + return page.dlr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page DatabaseListResultPage) Values() []Database { + if page.dlr.IsEmpty() { + return nil + } + return *page.dlr.Value +} + +// Creates a new instance of the DatabaseListResultPage type. +func NewDatabaseListResultPage(cur DatabaseListResult, getNextPage func(context.Context, DatabaseListResult) (DatabaseListResult, error)) DatabaseListResultPage { + return DatabaseListResultPage{ + fn: getNextPage, + dlr: cur, + } +} + +// DatabaseProperties the properties of a database. +type DatabaseProperties struct { + // Charset - The charset of the database. + Charset *string `json:"charset,omitempty"` + // Collation - The collation of the database. + Collation *string `json:"collation,omitempty"` +} + +// DatabasesCreateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type DatabasesCreateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(DatabasesClient) (Database, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *DatabasesCreateFuture) 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 DatabasesCreateFuture.Result. +func (future *DatabasesCreateFuture) result(client DatabasesClient) (d Database, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "postgresqlflexibleservers.DatabasesCreateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + d.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("postgresqlflexibleservers.DatabasesCreateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if d.Response.Response, err = future.GetResult(sender); err == nil && d.Response.Response.StatusCode != http.StatusNoContent { + d, err = client.CreateResponder(d.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "postgresqlflexibleservers.DatabasesCreateFuture", "Result", d.Response.Response, "Failure responding to request") + } + } + return +} + +// DatabasesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type DatabasesDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(DatabasesClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *DatabasesDeleteFuture) 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 DatabasesDeleteFuture.Result. +func (future *DatabasesDeleteFuture) result(client DatabasesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "postgresqlflexibleservers.DatabasesDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("postgresqlflexibleservers.DatabasesDeleteFuture") + return + } + ar.Response = future.Response() + return +} + // DelegatedSubnetUsage delegated subnet usage data. type DelegatedSubnetUsage struct { // SubnetName - READ-ONLY; name of the subnet @@ -579,6 +996,8 @@ type FirewallRule struct { autorest.Response `json:"-"` // FirewallRuleProperties - The properties of a firewall rule. *FirewallRuleProperties `json:"properties,omitempty"` + // SystemData - READ-ONLY; The system metadata relating to this resource. + SystemData *SystemData `json:"systemData,omitempty"` // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} ID *string `json:"id,omitempty"` // Name - READ-ONLY; The name of the resource @@ -614,6 +1033,15 @@ func (fr *FirewallRule) UnmarshalJSON(body []byte) error { } fr.FirewallRuleProperties = &firewallRuleProperties } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + fr.SystemData = &systemData + } case "id": if v != nil { var ID string @@ -894,13 +1322,73 @@ func (future *FirewallRulesDeleteFuture) result(client FirewallRulesClient) (ar return } +// FlexibleServerEditionCapability flexible server edition capabilities. +type FlexibleServerEditionCapability struct { + // Name - READ-ONLY; Server edition name + Name *string `json:"name,omitempty"` + // SupportedStorageEditions - READ-ONLY; The list of editions supported by this server edition. + SupportedStorageEditions *[]StorageEditionCapability `json:"supportedStorageEditions,omitempty"` + // SupportedServerVersions - READ-ONLY; The list of server versions supported by this server edition. + SupportedServerVersions *[]ServerVersionCapability `json:"supportedServerVersions,omitempty"` + // Status - READ-ONLY; The status + Status *string `json:"status,omitempty"` +} + +// MarshalJSON is the custom marshaler for FlexibleServerEditionCapability. +func (fsec FlexibleServerEditionCapability) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// HighAvailability high availability properties of a server +type HighAvailability struct { + // Mode - The HA mode for the server. Possible values include: 'HighAvailabilityModeDisabled', 'HighAvailabilityModeZoneRedundant' + Mode HighAvailabilityMode `json:"mode,omitempty"` + // State - READ-ONLY; A state of a HA server that is visible to user. Possible values include: 'ServerHAStateNotEnabled', 'ServerHAStateCreatingStandby', 'ServerHAStateReplicatingData', 'ServerHAStateFailingOver', 'ServerHAStateHealthy', 'ServerHAStateRemovingStandby' + State ServerHAState `json:"state,omitempty"` + // StandbyAvailabilityZone - availability zone information of the standby. + StandbyAvailabilityZone *string `json:"standbyAvailabilityZone,omitempty"` +} + +// MarshalJSON is the custom marshaler for HighAvailability. +func (ha HighAvailability) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ha.Mode != "" { + objectMap["mode"] = ha.Mode + } + if ha.StandbyAvailabilityZone != nil { + objectMap["standbyAvailabilityZone"] = ha.StandbyAvailabilityZone + } + return json.Marshal(objectMap) +} + +// HyperscaleNodeEditionCapability hyperscale node edition capabilities. +type HyperscaleNodeEditionCapability struct { + // Name - READ-ONLY; Server edition name + Name *string `json:"name,omitempty"` + // SupportedStorageEditions - READ-ONLY; The list of editions supported by this server edition. + SupportedStorageEditions *[]StorageEditionCapability `json:"supportedStorageEditions,omitempty"` + // SupportedServerVersions - READ-ONLY; The list of server versions supported by this server edition. + SupportedServerVersions *[]ServerVersionCapability `json:"supportedServerVersions,omitempty"` + // SupportedNodeTypes - READ-ONLY; The list of Node Types supported by this server edition. + SupportedNodeTypes *[]NodeTypeCapability `json:"supportedNodeTypes,omitempty"` + // Status - READ-ONLY; The status + Status *string `json:"status,omitempty"` +} + +// MarshalJSON is the custom marshaler for HyperscaleNodeEditionCapability. +func (hnec HyperscaleNodeEditionCapability) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + // Identity identity for the resource. type Identity struct { // PrincipalID - READ-ONLY; The principal ID of resource identity. PrincipalID *string `json:"principalId,omitempty"` // TenantID - READ-ONLY; The tenant ID of resource. TenantID *string `json:"tenantId,omitempty"` - // Type - The identity type. Possible values include: 'SystemAssigned' + // Type - The identity type. Possible values include: 'ResourceIdentityTypeSystemAssigned' Type ResourceIdentityType `json:"type,omitempty"` } @@ -913,7 +1401,7 @@ func (i Identity) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } -// MaintenanceWindow maintenance window of a server. +// MaintenanceWindow maintenance window properties of a server. type MaintenanceWindow struct { // CustomWindow - indicates whether custom window is enabled or disabled CustomWindow *string `json:"customWindow,omitempty"` @@ -946,6 +1434,44 @@ type NameAvailabilityRequest struct { Type *string `json:"type,omitempty"` } +// Network network properties of a server +type Network struct { + // PublicNetworkAccess - READ-ONLY; public network access is enabled or not. Possible values include: 'ServerPublicNetworkAccessStateEnabled', 'ServerPublicNetworkAccessStateDisabled' + PublicNetworkAccess ServerPublicNetworkAccessState `json:"publicNetworkAccess,omitempty"` + // DelegatedSubnetResourceID - delegated subnet arm resource id. + DelegatedSubnetResourceID *string `json:"delegatedSubnetResourceId,omitempty"` + // PrivateDNSZoneArmResourceID - private dns zone arm resource id. + PrivateDNSZoneArmResourceID *string `json:"privateDnsZoneArmResourceId,omitempty"` +} + +// MarshalJSON is the custom marshaler for Network. +func (n Network) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if n.DelegatedSubnetResourceID != nil { + objectMap["delegatedSubnetResourceId"] = n.DelegatedSubnetResourceID + } + if n.PrivateDNSZoneArmResourceID != nil { + objectMap["privateDnsZoneArmResourceId"] = n.PrivateDNSZoneArmResourceID + } + return json.Marshal(objectMap) +} + +// NodeTypeCapability node type capability +type NodeTypeCapability struct { + // Name - READ-ONLY; note type name + Name *string `json:"name,omitempty"` + // NodeType - READ-ONLY; note type + NodeType *string `json:"nodeType,omitempty"` + // Status - READ-ONLY; The status + Status *string `json:"status,omitempty"` +} + +// MarshalJSON is the custom marshaler for NodeTypeCapability. +func (ntc NodeTypeCapability) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + // Operation REST API operation definition. type Operation struct { // Name - READ-ONLY; The name of the operation being performed on this particular object. @@ -954,7 +1480,7 @@ type Operation struct { Display *OperationDisplay `json:"display,omitempty"` // IsDataAction - Indicates whether the operation is a data action IsDataAction *bool `json:"isDataAction,omitempty"` - // Origin - READ-ONLY; The intended executor of the operation. Possible values include: 'NotSpecified', 'User', 'System' + // Origin - READ-ONLY; The intended executor of the operation. Possible values include: 'OperationOriginNotSpecified', 'OperationOriginUser', 'OperationOriginSystem' Origin OperationOrigin `json:"origin,omitempty"` // Properties - READ-ONLY; Additional descriptions for the operation. Properties map[string]interface{} `json:"properties"` @@ -1102,7 +1628,7 @@ type ResourceModelWithAllowedPropertySetIdentity struct { PrincipalID *string `json:"principalId,omitempty"` // TenantID - READ-ONLY; The tenant ID of resource. TenantID *string `json:"tenantId,omitempty"` - // Type - The identity type. Possible values include: 'SystemAssigned' + // Type - The identity type. Possible values include: 'ResourceIdentityTypeSystemAssigned' Type ResourceIdentityType `json:"type,omitempty"` } @@ -1133,10 +1659,18 @@ type ResourceModelWithAllowedPropertySetPlan struct { type ResourceModelWithAllowedPropertySetSku struct { // Name - The name of the sku, typically, tier + family + cores, e.g. Standard_D4s_v3. Name *string `json:"name,omitempty"` - // Tier - The tier of the particular SKU, e.g. Burstable. Possible values include: 'Burstable', 'GeneralPurpose', 'MemoryOptimized' + // Tier - The tier of the particular SKU, e.g. Burstable. Possible values include: 'SkuTierBurstable', 'SkuTierGeneralPurpose', 'SkuTierMemoryOptimized' Tier SkuTier `json:"tier,omitempty"` } +// RestartParameter represents server restart parameters. +type RestartParameter struct { + // RestartWithFailover - Indicates whether to restart the server with failover. + RestartWithFailover *bool `json:"restartWithFailover,omitempty"` + // FailoverMode - Failover mode. + FailoverMode *string `json:"failoverMode,omitempty"` +} + // Server represents a server. type Server struct { autorest.Response `json:"-"` @@ -1146,6 +1680,8 @@ type Server struct { Sku *Sku `json:"sku,omitempty"` // ServerProperties - Properties of the server. *ServerProperties `json:"properties,omitempty"` + // SystemData - READ-ONLY; The system metadata relating to this resource. + SystemData *SystemData `json:"systemData,omitempty"` // Tags - Resource tags. Tags map[string]*string `json:"tags"` // Location - The geo-location where the resource lives @@ -1215,6 +1751,15 @@ func (s *Server) UnmarshalJSON(body []byte) error { } s.ServerProperties = &serverProperties } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + s.SystemData = &systemData + } case "tags": if v != nil { var tags map[string]*string @@ -1266,22 +1811,6 @@ func (s *Server) UnmarshalJSON(body []byte) error { return nil } -// ServerEditionCapability server edition capabilities. -type ServerEditionCapability struct { - // Name - READ-ONLY; Server edition name - Name *string `json:"name,omitempty"` - // SupportedStorageEditions - READ-ONLY - SupportedStorageEditions *[]StorageEditionCapability `json:"supportedStorageEditions,omitempty"` - // SupportedServerVersions - READ-ONLY - SupportedServerVersions *[]ServerVersionCapability `json:"supportedServerVersions,omitempty"` -} - -// MarshalJSON is the custom marshaler for ServerEditionCapability. -func (sec ServerEditionCapability) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - // ServerForUpdate represents a server to be updated. type ServerForUpdate struct { // Location - The location the resource resides in. @@ -1528,41 +2057,31 @@ type ServerProperties struct { AdministratorLogin *string `json:"administratorLogin,omitempty"` // AdministratorLoginPassword - The administrator login password (required for server creation). AdministratorLoginPassword *string `json:"administratorLoginPassword,omitempty"` - // Version - PostgreSQL Server version. Possible values include: 'OneTwo', 'OneOne' + // Version - PostgreSQL Server version. Possible values include: 'ServerVersionOneThree', 'ServerVersionOneTwo', 'ServerVersionOneOne' Version ServerVersion `json:"version,omitempty"` + // MinorVersion - READ-ONLY; The minor version of the server. + MinorVersion *string `json:"minorVersion,omitempty"` // State - READ-ONLY; A state of a server that is visible to user. Possible values include: 'ServerStateReady', 'ServerStateDropping', 'ServerStateDisabled', 'ServerStateStarting', 'ServerStateStopping', 'ServerStateStopped', 'ServerStateUpdating' State ServerState `json:"state,omitempty"` - // HaState - READ-ONLY; A state of a HA server that is visible to user. Possible values include: 'NotEnabled', 'CreatingStandby', 'ReplicatingData', 'FailingOver', 'Healthy', 'RemovingStandby' - HaState ServerHAState `json:"haState,omitempty"` // FullyQualifiedDomainName - READ-ONLY; The fully qualified domain name of a server. FullyQualifiedDomainName *string `json:"fullyQualifiedDomainName,omitempty"` - // DisplayName - The display name of a server. - DisplayName *string `json:"displayName,omitempty"` - // StorageProfile - Storage profile of a server. - StorageProfile *StorageProfile `json:"storageProfile,omitempty"` - // PublicNetworkAccess - READ-ONLY; public network access is enabled or not. Possible values include: 'ServerPublicNetworkAccessStateEnabled', 'ServerPublicNetworkAccessStateDisabled' - PublicNetworkAccess ServerPublicNetworkAccessState `json:"publicNetworkAccess,omitempty"` - // MaintenanceWindow - Maintenance window of a server. + // Storage - Storage properties of a server. + Storage *Storage `json:"storage,omitempty"` + // Backup - Backup properties of a server. + Backup *Backup `json:"backup,omitempty"` + // Network - Network properties of a server. + Network *Network `json:"network,omitempty"` + // HighAvailability - High availability properties of a server. + HighAvailability *HighAvailability `json:"highAvailability,omitempty"` + // MaintenanceWindow - Maintenance window properties of a server. MaintenanceWindow *MaintenanceWindow `json:"maintenanceWindow,omitempty"` - // HaEnabled - stand by count value can be either enabled or disabled. Possible values include: 'Enabled', 'Disabled' - HaEnabled HAEnabledEnum `json:"haEnabled,omitempty"` - // SourceServerName - The source PostgreSQL server name to restore from. - SourceServerName *string `json:"sourceServerName,omitempty"` - // SourceSubscriptionID - The subscription id of source serve PostgreSQL server name to restore from. - SourceSubscriptionID *string `json:"sourceSubscriptionId,omitempty"` - // SourceResourceGroupName - The resource group name of source serve PostgreSQL server name to restore from. - SourceResourceGroupName *string `json:"sourceResourceGroupName,omitempty"` - // PointInTimeUTC - Restore point creation time (ISO8601 format), specifying the time to restore from. + // SourceServerResourceID - The source server resource ID to restore from. It's required when 'createMode' is 'PointInTimeRestore'. + SourceServerResourceID *string `json:"sourceServerResourceId,omitempty"` + // PointInTimeUTC - Restore point creation time (ISO8601 format), specifying the time to restore from. It's required when 'createMode' is 'PointInTimeRestore'. PointInTimeUTC *date.Time `json:"pointInTimeUTC,omitempty"` - // AvailabilityZone - availability Zone information of the server. + // AvailabilityZone - availability zone information of the server. AvailabilityZone *string `json:"availabilityZone,omitempty"` - // StandbyAvailabilityZone - READ-ONLY; availability Zone information of the server. - StandbyAvailabilityZone *string `json:"standbyAvailabilityZone,omitempty"` - // ByokEnforcement - READ-ONLY; Status showing whether the data encryption is enabled with customer-managed keys. - ByokEnforcement *string `json:"byokEnforcement,omitempty"` - DelegatedSubnetArguments *ServerPropertiesDelegatedSubnetArguments `json:"delegatedSubnetArguments,omitempty"` - PrivateDNSZoneArguments *ServerPropertiesPrivateDNSZoneArguments `json:"privateDnsZoneArguments,omitempty"` - // CreateMode - The mode to create a new PostgreSQL server. Possible values include: 'Default', 'PointInTimeRestore' + // CreateMode - The mode to create a new PostgreSQL server. Possible values include: 'CreateModeDefault', 'CreateModeCreate', 'CreateModeUpdate', 'CreateModePointInTimeRestore' CreateMode CreateMode `json:"createMode,omitempty"` // Tags - Application-specific metadata in the form of key-value pairs. Tags map[string]*string `json:"tags"` @@ -1580,26 +2099,23 @@ func (sp ServerProperties) MarshalJSON() ([]byte, error) { if sp.Version != "" { objectMap["version"] = sp.Version } - if sp.DisplayName != nil { - objectMap["displayName"] = sp.DisplayName + if sp.Storage != nil { + objectMap["storage"] = sp.Storage } - if sp.StorageProfile != nil { - objectMap["storageProfile"] = sp.StorageProfile - } - if sp.MaintenanceWindow != nil { - objectMap["maintenanceWindow"] = sp.MaintenanceWindow + if sp.Backup != nil { + objectMap["backup"] = sp.Backup } - if sp.HaEnabled != "" { - objectMap["haEnabled"] = sp.HaEnabled + if sp.Network != nil { + objectMap["network"] = sp.Network } - if sp.SourceServerName != nil { - objectMap["sourceServerName"] = sp.SourceServerName + if sp.HighAvailability != nil { + objectMap["highAvailability"] = sp.HighAvailability } - if sp.SourceSubscriptionID != nil { - objectMap["sourceSubscriptionId"] = sp.SourceSubscriptionID + if sp.MaintenanceWindow != nil { + objectMap["maintenanceWindow"] = sp.MaintenanceWindow } - if sp.SourceResourceGroupName != nil { - objectMap["sourceResourceGroupName"] = sp.SourceResourceGroupName + if sp.SourceServerResourceID != nil { + objectMap["sourceServerResourceId"] = sp.SourceServerResourceID } if sp.PointInTimeUTC != nil { objectMap["pointInTimeUTC"] = sp.PointInTimeUTC @@ -1607,12 +2123,6 @@ func (sp ServerProperties) MarshalJSON() ([]byte, error) { if sp.AvailabilityZone != nil { objectMap["availabilityZone"] = sp.AvailabilityZone } - if sp.DelegatedSubnetArguments != nil { - objectMap["delegatedSubnetArguments"] = sp.DelegatedSubnetArguments - } - if sp.PrivateDNSZoneArguments != nil { - objectMap["privateDnsZoneArguments"] = sp.PrivateDNSZoneArguments - } if sp.CreateMode != "" { objectMap["createMode"] = sp.CreateMode } @@ -1622,28 +2132,20 @@ func (sp ServerProperties) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } -// ServerPropertiesDelegatedSubnetArguments ... -type ServerPropertiesDelegatedSubnetArguments struct { - // SubnetArmResourceID - delegated subnet arm resource id. - SubnetArmResourceID *string `json:"subnetArmResourceId,omitempty"` -} - // ServerPropertiesForUpdate ... type ServerPropertiesForUpdate struct { // AdministratorLoginPassword - The password of the administrator login. AdministratorLoginPassword *string `json:"administratorLoginPassword,omitempty"` - // StorageProfile - Storage profile of a server. - StorageProfile *StorageProfile `json:"storageProfile,omitempty"` - // HaEnabled - stand by count value can be either enabled or disabled. Possible values include: 'Enabled', 'Disabled' - HaEnabled HAEnabledEnum `json:"haEnabled,omitempty"` - // MaintenanceWindow - Maintenance window of a server. + // Storage - Storage properties of a server. + Storage *Storage `json:"storage,omitempty"` + // Backup - Backup properties of a server. + Backup *Backup `json:"backup,omitempty"` + // HighAvailability - High availability properties of a server. + HighAvailability *HighAvailability `json:"highAvailability,omitempty"` + // MaintenanceWindow - Maintenance window properties of a server. MaintenanceWindow *MaintenanceWindow `json:"maintenanceWindow,omitempty"` -} - -// ServerPropertiesPrivateDNSZoneArguments ... -type ServerPropertiesPrivateDNSZoneArguments struct { - // PrivateDNSZoneArmResourceID - private dns zone arm resource id. - PrivateDNSZoneArmResourceID *string `json:"privateDnsZoneArmResourceId,omitempty"` + // CreateMode - The mode to update a new PostgreSQL server. Possible values include: 'CreateModeForUpdateDefault', 'CreateModeForUpdateUpdate' + CreateMode CreateModeForUpdate `json:"createMode,omitempty"` } // ServersCreateFuture an abstraction for monitoring and retrieving the results of a long-running @@ -1884,6 +2386,8 @@ type ServerVersionCapability struct { Name *string `json:"name,omitempty"` // SupportedVcores - READ-ONLY SupportedVcores *[]VcoreCapability `json:"supportedVcores,omitempty"` + // Status - READ-ONLY; The status + Status *string `json:"status,omitempty"` } // MarshalJSON is the custom marshaler for ServerVersionCapability. @@ -1896,16 +2400,24 @@ func (svc ServerVersionCapability) MarshalJSON() ([]byte, error) { type Sku struct { // Name - The name of the sku, typically, tier + family + cores, e.g. Standard_D4s_v3. Name *string `json:"name,omitempty"` - // Tier - The tier of the particular SKU, e.g. Burstable. Possible values include: 'Burstable', 'GeneralPurpose', 'MemoryOptimized' + // Tier - The tier of the particular SKU, e.g. Burstable. Possible values include: 'SkuTierBurstable', 'SkuTierGeneralPurpose', 'SkuTierMemoryOptimized' Tier SkuTier `json:"tier,omitempty"` } +// Storage storage properties of a server +type Storage struct { + // StorageSizeGB - Max storage allowed for a server. + StorageSizeGB *int32 `json:"storageSizeGB,omitempty"` +} + // StorageEditionCapability storage edition capability type StorageEditionCapability struct { // Name - READ-ONLY; storage edition name Name *string `json:"name,omitempty"` // SupportedStorageMB - READ-ONLY SupportedStorageMB *[]StorageMBCapability `json:"supportedStorageMB,omitempty"` + // Status - READ-ONLY; The status + Status *string `json:"status,omitempty"` } // MarshalJSON is the custom marshaler for StorageEditionCapability. @@ -1922,6 +2434,8 @@ type StorageMBCapability struct { SupportedIops *int64 `json:"supportedIops,omitempty"` // StorageSizeMB - READ-ONLY; storage size in MB StorageSizeMB *int64 `json:"storageSizeMB,omitempty"` + // Status - READ-ONLY; The status + Status *string `json:"status,omitempty"` } // MarshalJSON is the custom marshaler for StorageMBCapability. @@ -1930,12 +2444,26 @@ func (smc StorageMBCapability) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } -// StorageProfile storage Profile properties of a server -type StorageProfile struct { - // BackupRetentionDays - Backup retention days for the server. - BackupRetentionDays *int32 `json:"backupRetentionDays,omitempty"` - // StorageMB - Max storage allowed for a server. - StorageMB *int32 `json:"storageMB,omitempty"` +// String ... +type String struct { + autorest.Response `json:"-"` + Value *string `json:"value,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 the resource model definition for an Azure Resource Manager tracked top level resource @@ -1975,6 +2503,8 @@ type VcoreCapability struct { SupportedIops *int64 `json:"supportedIops,omitempty"` // SupportedMemoryPerVcoreMB - READ-ONLY; supported memory per vCore in MB SupportedMemoryPerVcoreMB *int64 `json:"supportedMemoryPerVcoreMB,omitempty"` + // Status - READ-ONLY; The status + Status *string `json:"status,omitempty"` } // MarshalJSON is the custom marshaler for VcoreCapability. diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/postgresql/mgmt/2020-02-14-preview/postgresqlflexibleservers/operations.go b/vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2021-06-01/postgresqlflexibleservers/operations.go similarity index 98% rename from vendor/github.com/Azure/azure-sdk-for-go/services/preview/postgresql/mgmt/2020-02-14-preview/postgresqlflexibleservers/operations.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2021-06-01/postgresqlflexibleservers/operations.go index 0a033431406b..93008c1c249c 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/postgresql/mgmt/2020-02-14-preview/postgresqlflexibleservers/operations.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2021-06-01/postgresqlflexibleservers/operations.go @@ -68,7 +68,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 = "2020-02-14-preview" + const APIVersion = "2021-06-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/postgresql/mgmt/2020-02-14-preview/postgresqlflexibleservers/servers.go b/vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2021-06-01/postgresqlflexibleservers/servers.go similarity index 95% rename from vendor/github.com/Azure/azure-sdk-for-go/services/preview/postgresql/mgmt/2020-02-14-preview/postgresqlflexibleservers/servers.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2021-06-01/postgresqlflexibleservers/servers.go index 06cab4e9150a..090e59b2e3ac 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/postgresql/mgmt/2020-02-14-preview/postgresqlflexibleservers/servers.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2021-06-01/postgresqlflexibleservers/servers.go @@ -54,8 +54,7 @@ func (client ServersClient) Create(ctx context.Context, resourceGroupName string Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: parameters, Constraints: []validation.Constraint{{Target: "parameters.Sku", Name: validation.Null, Rule: false, Chain: []validation.Constraint{{Target: "parameters.Sku.Name", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { @@ -85,11 +84,12 @@ func (client ServersClient) CreatePreparer(ctx context.Context, resourceGroupNam "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2020-02-14-preview" + const APIVersion = "2021-06-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } + parameters.SystemData = nil preparer := autorest.CreatePreparer( autorest.AsContentType("application/json; charset=utf-8"), autorest.AsPut(), @@ -147,8 +147,7 @@ func (client ServersClient) Delete(ctx context.Context, resourceGroupName string Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("postgresqlflexibleservers.ServersClient", "Delete", err.Error()) } @@ -175,7 +174,7 @@ func (client ServersClient) DeletePreparer(ctx context.Context, resourceGroupNam "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2020-02-14-preview" + const APIVersion = "2021-06-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -234,8 +233,7 @@ func (client ServersClient) Get(ctx context.Context, resourceGroupName string, s Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("postgresqlflexibleservers.ServersClient", "Get", err.Error()) } @@ -269,7 +267,7 @@ func (client ServersClient) GetPreparer(ctx context.Context, resourceGroupName s "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2020-02-14-preview" + const APIVersion = "2021-06-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -351,7 +349,7 @@ func (client ServersClient) ListPreparer(ctx context.Context) (*http.Request, er "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2020-02-14-preview" + const APIVersion = "2021-06-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -438,8 +436,7 @@ func (client ServersClient) ListByResourceGroup(ctx context.Context, resourceGro Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("postgresqlflexibleservers.ServersClient", "ListByResourceGroup", err.Error()) } @@ -477,7 +474,7 @@ func (client ServersClient) ListByResourceGroupPreparer(ctx context.Context, res "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2020-02-14-preview" + const APIVersion = "2021-06-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -549,7 +546,8 @@ func (client ServersClient) ListByResourceGroupComplete(ctx context.Context, res // Parameters: // resourceGroupName - the name of the resource group. The name is case insensitive. // serverName - the name of the server. -func (client ServersClient) Restart(ctx context.Context, resourceGroupName string, serverName string) (result ServersRestartFuture, err error) { +// parameters - the parameters for restarting a server. +func (client ServersClient) Restart(ctx context.Context, resourceGroupName string, serverName string, parameters *RestartParameter) (result ServersRestartFuture, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/ServersClient.Restart") defer func() { @@ -565,12 +563,11 @@ func (client ServersClient) Restart(ctx context.Context, resourceGroupName strin Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("postgresqlflexibleservers.ServersClient", "Restart", err.Error()) } - req, err := client.RestartPreparer(ctx, resourceGroupName, serverName) + req, err := client.RestartPreparer(ctx, resourceGroupName, serverName, parameters) if err != nil { err = autorest.NewErrorWithError(err, "postgresqlflexibleservers.ServersClient", "Restart", nil, "Failure preparing request") return @@ -586,23 +583,28 @@ func (client ServersClient) Restart(ctx context.Context, resourceGroupName strin } // RestartPreparer prepares the Restart request. -func (client ServersClient) RestartPreparer(ctx context.Context, resourceGroupName string, serverName string) (*http.Request, error) { +func (client ServersClient) RestartPreparer(ctx context.Context, resourceGroupName string, serverName string, parameters *RestartParameter) (*http.Request, error) { pathParameters := map[string]interface{}{ "resourceGroupName": autorest.Encode("path", resourceGroupName), "serverName": autorest.Encode("path", serverName), "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2020-02-14-preview" + const APIVersion = "2021-06-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), autorest.AsPost(), autorest.WithBaseURL(client.BaseURI), autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBForPostgreSql/flexibleServers/{serverName}/restart", pathParameters), autorest.WithQueryParameters(queryParameters)) + if parameters != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithJSON(parameters)) + } return preparer.Prepare((&http.Request{}).WithContext(ctx)) } @@ -652,8 +654,7 @@ func (client ServersClient) Start(ctx context.Context, resourceGroupName string, Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("postgresqlflexibleservers.ServersClient", "Start", err.Error()) } @@ -680,7 +681,7 @@ func (client ServersClient) StartPreparer(ctx context.Context, resourceGroupName "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2020-02-14-preview" + const APIVersion = "2021-06-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -739,8 +740,7 @@ func (client ServersClient) Stop(ctx context.Context, resourceGroupName string, Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("postgresqlflexibleservers.ServersClient", "Stop", err.Error()) } @@ -767,7 +767,7 @@ func (client ServersClient) StopPreparer(ctx context.Context, resourceGroupName "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2020-02-14-preview" + const APIVersion = "2021-06-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -828,8 +828,7 @@ func (client ServersClient) Update(ctx context.Context, resourceGroupName string Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("postgresqlflexibleservers.ServersClient", "Update", err.Error()) } @@ -856,7 +855,7 @@ func (client ServersClient) UpdatePreparer(ctx context.Context, resourceGroupNam "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2020-02-14-preview" + const APIVersion = "2021-06-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/postgresql/mgmt/2020-02-14-preview/postgresqlflexibleservers/version.go b/vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2021-06-01/postgresqlflexibleservers/version.go similarity index 96% rename from vendor/github.com/Azure/azure-sdk-for-go/services/preview/postgresql/mgmt/2020-02-14-preview/postgresqlflexibleservers/version.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2021-06-01/postgresqlflexibleservers/version.go index 4624f1d99e65..e13132f4b75a 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/postgresql/mgmt/2020-02-14-preview/postgresqlflexibleservers/version.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2021-06-01/postgresqlflexibleservers/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() + " postgresqlflexibleservers/2020-02-14-preview" + return "Azure-SDK-For-Go/" + Version() + " postgresqlflexibleservers/2021-06-01" } // Version returns the semantic version (see http://semver.org) of the client. diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/postgresql/mgmt/2020-02-14-preview/postgresqlflexibleservers/virtualnetworksubnetusage.go b/vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2021-06-01/postgresqlflexibleservers/virtualnetworksubnetusage.go similarity index 99% rename from vendor/github.com/Azure/azure-sdk-for-go/services/preview/postgresql/mgmt/2020-02-14-preview/postgresqlflexibleservers/virtualnetworksubnetusage.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2021-06-01/postgresqlflexibleservers/virtualnetworksubnetusage.go index c8a84d9988bb..729356b5cf89 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/postgresql/mgmt/2020-02-14-preview/postgresqlflexibleservers/virtualnetworksubnetusage.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2021-06-01/postgresqlflexibleservers/virtualnetworksubnetusage.go @@ -84,7 +84,7 @@ func (client VirtualNetworkSubnetUsageClient) ExecutePreparer(ctx context.Contex "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2020-02-14-preview" + const APIVersion = "2021-06-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/postgresql/mgmt/2020-02-14-preview/postgresqlflexibleservers/CHANGELOG.md b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/postgresql/mgmt/2020-02-14-preview/postgresqlflexibleservers/CHANGELOG.md deleted file mode 100644 index b9c893a846b8..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/postgresql/mgmt/2020-02-14-preview/postgresqlflexibleservers/CHANGELOG.md +++ /dev/null @@ -1,13 +0,0 @@ -# Change History - -## Additive Changes - -### Struct Changes - -#### New Structs - -1. ServerPropertiesPrivateDNSZoneArguments - -#### New Struct Fields - -1. ServerProperties.PrivateDNSZoneArguments diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/postgresql/mgmt/2020-02-14-preview/postgresqlflexibleservers/_meta.json b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/postgresql/mgmt/2020-02-14-preview/postgresqlflexibleservers/_meta.json deleted file mode 100644 index 82a7639f5aa9..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/postgresql/mgmt/2020-02-14-preview/postgresqlflexibleservers/_meta.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "commit": "ef7ffaa1ae68ab17dba86d8e0be5fd1fb615ef64", - "readme": "/_/azure-rest-api-specs/specification/postgresql/resource-manager/readme.md", - "tag": "package-2020-02-14-preview", - "use": "@microsoft.azure/autorest.go@2.1.183", - "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", - "autorest_command": "autorest --use=@microsoft.azure/autorest.go@2.1.183 --tag=package-2020-02-14-preview --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=V2 --go.license-header=MICROSOFT_MIT_NO_VERSION /_/azure-rest-api-specs/specification/postgresql/resource-manager/readme.md", - "additional_properties": { - "additional_options": "--go --verbose --use-onever --version=V2 --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/postgresql/mgmt/2020-02-14-preview/postgresqlflexibleservers/enums.go b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/postgresql/mgmt/2020-02-14-preview/postgresqlflexibleservers/enums.go deleted file mode 100644 index 4f2fe50fa57a..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/postgresql/mgmt/2020-02-14-preview/postgresqlflexibleservers/enums.go +++ /dev/null @@ -1,181 +0,0 @@ -package postgresqlflexibleservers - -// 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. - -// ConfigurationDataType enumerates the values for configuration data type. -type ConfigurationDataType string - -const ( - // Boolean ... - Boolean ConfigurationDataType = "Boolean" - // Enumeration ... - Enumeration ConfigurationDataType = "Enumeration" - // Integer ... - Integer ConfigurationDataType = "Integer" - // Numeric ... - Numeric ConfigurationDataType = "Numeric" -) - -// PossibleConfigurationDataTypeValues returns an array of possible values for the ConfigurationDataType const type. -func PossibleConfigurationDataTypeValues() []ConfigurationDataType { - return []ConfigurationDataType{Boolean, Enumeration, Integer, Numeric} -} - -// CreateMode enumerates the values for create mode. -type CreateMode string - -const ( - // Default ... - Default CreateMode = "Default" - // PointInTimeRestore ... - PointInTimeRestore CreateMode = "PointInTimeRestore" -) - -// PossibleCreateModeValues returns an array of possible values for the CreateMode const type. -func PossibleCreateModeValues() []CreateMode { - return []CreateMode{Default, PointInTimeRestore} -} - -// HAEnabledEnum enumerates the values for ha enabled enum. -type HAEnabledEnum string - -const ( - // Disabled ... - Disabled HAEnabledEnum = "Disabled" - // Enabled ... - Enabled HAEnabledEnum = "Enabled" -) - -// PossibleHAEnabledEnumValues returns an array of possible values for the HAEnabledEnum const type. -func PossibleHAEnabledEnumValues() []HAEnabledEnum { - return []HAEnabledEnum{Disabled, Enabled} -} - -// OperationOrigin enumerates the values for operation origin. -type OperationOrigin string - -const ( - // NotSpecified ... - NotSpecified OperationOrigin = "NotSpecified" - // 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{NotSpecified, System, User} -} - -// ResourceIdentityType enumerates the values for resource identity type. -type ResourceIdentityType string - -const ( - // SystemAssigned ... - SystemAssigned ResourceIdentityType = "SystemAssigned" -) - -// PossibleResourceIdentityTypeValues returns an array of possible values for the ResourceIdentityType const type. -func PossibleResourceIdentityTypeValues() []ResourceIdentityType { - return []ResourceIdentityType{SystemAssigned} -} - -// ServerHAState enumerates the values for server ha state. -type ServerHAState string - -const ( - // CreatingStandby ... - CreatingStandby ServerHAState = "CreatingStandby" - // FailingOver ... - FailingOver ServerHAState = "FailingOver" - // Healthy ... - Healthy ServerHAState = "Healthy" - // NotEnabled ... - NotEnabled ServerHAState = "NotEnabled" - // RemovingStandby ... - RemovingStandby ServerHAState = "RemovingStandby" - // ReplicatingData ... - ReplicatingData ServerHAState = "ReplicatingData" -) - -// PossibleServerHAStateValues returns an array of possible values for the ServerHAState const type. -func PossibleServerHAStateValues() []ServerHAState { - return []ServerHAState{CreatingStandby, FailingOver, Healthy, NotEnabled, RemovingStandby, ReplicatingData} -} - -// ServerPublicNetworkAccessState enumerates the values for server public network access state. -type ServerPublicNetworkAccessState string - -const ( - // ServerPublicNetworkAccessStateDisabled ... - ServerPublicNetworkAccessStateDisabled ServerPublicNetworkAccessState = "Disabled" - // ServerPublicNetworkAccessStateEnabled ... - ServerPublicNetworkAccessStateEnabled ServerPublicNetworkAccessState = "Enabled" -) - -// PossibleServerPublicNetworkAccessStateValues returns an array of possible values for the ServerPublicNetworkAccessState const type. -func PossibleServerPublicNetworkAccessStateValues() []ServerPublicNetworkAccessState { - return []ServerPublicNetworkAccessState{ServerPublicNetworkAccessStateDisabled, ServerPublicNetworkAccessStateEnabled} -} - -// ServerState enumerates the values for server state. -type ServerState string - -const ( - // ServerStateDisabled ... - ServerStateDisabled ServerState = "Disabled" - // ServerStateDropping ... - ServerStateDropping ServerState = "Dropping" - // ServerStateReady ... - ServerStateReady ServerState = "Ready" - // ServerStateStarting ... - ServerStateStarting ServerState = "Starting" - // ServerStateStopped ... - ServerStateStopped ServerState = "Stopped" - // ServerStateStopping ... - ServerStateStopping ServerState = "Stopping" - // ServerStateUpdating ... - ServerStateUpdating ServerState = "Updating" -) - -// PossibleServerStateValues returns an array of possible values for the ServerState const type. -func PossibleServerStateValues() []ServerState { - return []ServerState{ServerStateDisabled, ServerStateDropping, ServerStateReady, ServerStateStarting, ServerStateStopped, ServerStateStopping, ServerStateUpdating} -} - -// ServerVersion enumerates the values for server version. -type ServerVersion string - -const ( - // OneOne ... - OneOne ServerVersion = "11" - // OneTwo ... - OneTwo ServerVersion = "12" -) - -// PossibleServerVersionValues returns an array of possible values for the ServerVersion const type. -func PossibleServerVersionValues() []ServerVersion { - return []ServerVersion{OneOne, OneTwo} -} - -// SkuTier enumerates the values for sku tier. -type SkuTier string - -const ( - // Burstable ... - Burstable SkuTier = "Burstable" - // GeneralPurpose ... - GeneralPurpose SkuTier = "GeneralPurpose" - // MemoryOptimized ... - MemoryOptimized SkuTier = "MemoryOptimized" -) - -// PossibleSkuTierValues returns an array of possible values for the SkuTier const type. -func PossibleSkuTierValues() []SkuTier { - return []SkuTier{Burstable, GeneralPurpose, MemoryOptimized} -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/version/version.go b/vendor/github.com/Azure/azure-sdk-for-go/version/version.go index 25ff8c0689b2..3e4ff42109fd 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/version/version.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/version/version.go @@ -4,4 +4,4 @@ package version // Licensed under the MIT License. See License.txt in the project root for license information. // Number contains the semantic version of this SDK. -const Number = "v55.3.0" +const Number = "v55.4.0" diff --git a/vendor/modules.txt b/vendor/modules.txt index 3da391d06ae4..c44b1e0665cd 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -9,7 +9,7 @@ cloud.google.com/go/internal/version # cloud.google.com/go/storage v1.16.0 ## explicit cloud.google.com/go/storage -# github.com/Azure/azure-sdk-for-go v55.3.0+incompatible +# github.com/Azure/azure-sdk-for-go v55.4.0+incompatible ## explicit github.com/Azure/azure-sdk-for-go/profiles/2017-03-09/resources/mgmt/resources github.com/Azure/azure-sdk-for-go/services/aad/mgmt/2017-04-01/aad @@ -70,6 +70,7 @@ github.com/Azure/azure-sdk-for-go/services/network/mgmt/2020-11-01/network github.com/Azure/azure-sdk-for-go/services/notificationhubs/mgmt/2017-04-01/notificationhubs github.com/Azure/azure-sdk-for-go/services/operationalinsights/mgmt/2020-08-01/operationalinsights github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2020-01-01/postgresql +github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2021-06-01/postgresqlflexibleservers github.com/Azure/azure-sdk-for-go/services/powerbidedicated/mgmt/2017-10-01/powerbidedicated github.com/Azure/azure-sdk-for-go/services/preview/alertsmanagement/mgmt/2019-06-01-preview/alertsmanagement github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2020-11-01-preview/appplatform @@ -89,7 +90,6 @@ github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2019-06-01/insig github.com/Azure/azure-sdk-for-go/services/preview/operationsmanagement/mgmt/2015-11-01-preview/operationsmanagement github.com/Azure/azure-sdk-for-go/services/preview/policyinsights/mgmt/2019-10-01-preview/policyinsights github.com/Azure/azure-sdk-for-go/services/preview/portal/mgmt/2019-01-01-preview/portal -github.com/Azure/azure-sdk-for-go/services/preview/postgresql/mgmt/2020-02-14-preview/postgresqlflexibleservers github.com/Azure/azure-sdk-for-go/services/preview/purview/mgmt/2020-12-01-preview/purview github.com/Azure/azure-sdk-for-go/services/preview/resources/mgmt/2018-03-01-preview/managementgroups github.com/Azure/azure-sdk-for-go/services/preview/resources/mgmt/2019-06-01-preview/templatespecs diff --git a/website/docs/d/postgresql_flexible_server.html.markdown b/website/docs/d/postgresql_flexible_server.html.markdown index d05e75270802..218043847c8d 100644 --- a/website/docs/d/postgresql_flexible_server.html.markdown +++ b/website/docs/d/postgresql_flexible_server.html.markdown @@ -43,8 +43,6 @@ In addition to the Arguments listed above - the following Attributes are exporte * `backup_retention_days` - The backup retention days for the PostgreSQL Flexible Server. -* `cmk_enabled` - The status showing whether the data encryption is enabled with a customer-managed key. - * `delegated_subnet_id` - The ID of the virtual network subnet to create the PostgreSQL Flexible Server. * `fqdn` - The FQDN of the PostgreSQL Flexible Server. diff --git a/website/docs/r/postgresql_flexible_server.html.markdown b/website/docs/r/postgresql_flexible_server.html.markdown index f8a594445098..412d3531b012 100644 --- a/website/docs/r/postgresql_flexible_server.html.markdown +++ b/website/docs/r/postgresql_flexible_server.html.markdown @@ -93,7 +93,7 @@ The following arguments are supported: * `storage_mb` - (Optional) The max storage allowed for the PostgreSQL Flexible Server. Possible values are `32768`, `65536`, `131072`, `262144`, `524288`, `1048576`, `2097152`, `4194304`, `8388608`, `16777216`, and `33554432`. -* `version` - (Optional) The version of PostgreSQL Flexible Server to use. Possible values are `11` and `12`. Required when `create_mode` is `Default`. Changing this forces a new PostgreSQL Flexible Server to be created. +* `version` - (Optional) The version of PostgreSQL Flexible Server to use. Possible values are `11`,`12` and `13`. Required when `create_mode` is `Default`. Changing this forces a new PostgreSQL Flexible Server to be created. * `tags` - (Optional) A mapping of tags which should be assigned to the PostgreSQL Flexible Server. @@ -113,8 +113,6 @@ In addition to the Arguments listed above - the following Attributes are exporte * `id` - The ID of the PostgreSQL Flexible Server. -* `cmk_enabled` - The status showing whether the data encryption is enabled with a customer-managed key. - * `fqdn` - The FQDN of the PostgreSQL Flexible Server. * `public_network_access_enabled` - Is public network access enabled? From c0de0c2b991884b37fd2f78dec5e0c73567fe964 Mon Sep 17 00:00:00 2001 From: Nick Metz Date: Tue, 6 Jul 2021 17:37:57 +0200 Subject: [PATCH 2/2] Update postgres flexserver api version to 2021-06-01 - set attribute cmk_enabled to deprecated and empty value - update documentation set `cmk_enabled` to deprecated - add test to check that `cmk_enabled` is empty - secure pointer dereferences --- .../postgresql_flexible_server_data_source.go | 27 +++++++++++++++---- ...gresql_flexible_server_data_source_test.go | 1 + .../postgresql_flexible_server_resource.go | 23 ++++++++++------ ...ostgresql_flexible_server_resource_test.go | 1 + .../postgresql_flexible_server.html.markdown | 4 +++ .../postgresql_flexible_server.html.markdown | 4 +++ 6 files changed, 47 insertions(+), 13 deletions(-) diff --git a/azurerm/internal/services/postgres/postgresql_flexible_server_data_source.go b/azurerm/internal/services/postgres/postgresql_flexible_server_data_source.go index 9053bbfa6de5..33d3968c616f 100644 --- a/azurerm/internal/services/postgres/postgresql_flexible_server_data_source.go +++ b/azurerm/internal/services/postgres/postgresql_flexible_server_data_source.go @@ -63,6 +63,12 @@ func dataSourcePostgresqlFlexibleServer() *pluginsdk.Resource { Computed: true, }, + "cmk_enabled": { + Type: pluginsdk.TypeString, + Computed: true, + Deprecated: "This attribute has been removed from the API and will be removed in version 3.0 of the provider.", + }, + "fqdn": { Type: pluginsdk.TypeString, Computed: true, @@ -101,16 +107,27 @@ func dataSourceArmPostgresqlFlexibleServerRead(d *pluginsdk.ResourceData, meta i d.Set("name", id.Name) d.Set("resource_group_name", id.ResourceGroup) d.Set("location", location.NormalizeNilable(resp.Location)) + + // `cmk_enabled` has been removed from API since 2021-06-01 + // and should be removed in version 3.0 of the provider. + d.Set("cmk_enabled", "") + if props := resp.ServerProperties; props != nil { d.Set("administrator_login", props.AdministratorLogin) - d.Set("storage_mb", (*props.Storage.StorageSizeGB * 1024)) d.Set("version", props.Version) d.Set("fqdn", props.FullyQualifiedDomainName) - d.Set("public_network_access_enabled", props.Network.PublicNetworkAccess == postgresqlflexibleservers.ServerPublicNetworkAccessStateEnabled) - d.Set("backup_retention_days", props.Backup.BackupRetentionDays) - if props.Network.DelegatedSubnetResourceID != nil { - d.Set("delegated_subnet_id", props.Network.DelegatedSubnetResourceID) + if storage := props.Storage; storage != nil && storage.StorageSizeGB != nil { + d.Set("storage_mb", (*props.Storage.StorageSizeGB * 1024)) + } + + if backup := props.Backup; backup != nil { + d.Set("backup_retention_days", props.Backup.BackupRetentionDays) + } + + if network := props.Network; network != nil { + d.Set("delegated_subnet_id", network.DelegatedSubnetResourceID) + d.Set("public_network_access_enabled", network.PublicNetworkAccess == postgresqlflexibleservers.ServerPublicNetworkAccessStateEnabled) } } diff --git a/azurerm/internal/services/postgres/postgresql_flexible_server_data_source_test.go b/azurerm/internal/services/postgres/postgresql_flexible_server_data_source_test.go index 52f35387aa89..cf7f116308c9 100644 --- a/azurerm/internal/services/postgres/postgresql_flexible_server_data_source_test.go +++ b/azurerm/internal/services/postgres/postgresql_flexible_server_data_source_test.go @@ -26,6 +26,7 @@ func TestAccDataSourcePostgresqlflexibleServer_basic(t *testing.T) { check.That(data.ResourceName).Key("backup_retention_days").Exists(), check.That(data.ResourceName).Key("fqdn").Exists(), check.That(data.ResourceName).Key("public_network_access_enabled").Exists(), + check.That(data.ResourceName).Key("cmk_enabled").IsEmpty(), ), }, }) diff --git a/azurerm/internal/services/postgres/postgresql_flexible_server_resource.go b/azurerm/internal/services/postgres/postgresql_flexible_server_resource.go index aaee4e450e73..c6556f4556d2 100644 --- a/azurerm/internal/services/postgres/postgresql_flexible_server_resource.go +++ b/azurerm/internal/services/postgres/postgresql_flexible_server_resource.go @@ -169,6 +169,12 @@ func resourcePostgresqlFlexibleServer() *pluginsdk.Resource { ValidateFunc: validation.IntBetween(7, 35), }, + "cmk_enabled": { + Type: pluginsdk.TypeString, + Computed: true, + Deprecated: "This attribute has been removed from the API and will be removed in version 3.0 of the provider.", + }, + "fqdn": { Type: pluginsdk.TypeString, Computed: true, @@ -330,26 +336,27 @@ func resourcePostgresqlFlexibleServerRead(d *pluginsdk.ResourceData, meta interf d.Set("name", id.Name) d.Set("resource_group_name", id.ResourceGroup) d.Set("location", location.NormalizeNilable(resp.Location)) + + // `cmk_enabled` has been removed from API since 2021-06-01 + // and should be removed in version 3.0 of the provider. + d.Set("cmk_enabled", "") + if props := resp.ServerProperties; props != nil { d.Set("administrator_login", props.AdministratorLogin) d.Set("zone", props.AvailabilityZone) d.Set("version", props.Version) d.Set("fqdn", props.FullyQualifiedDomainName) - d.Set("public_network_access_enabled", props.Network.PublicNetworkAccess == postgresqlflexibleservers.ServerPublicNetworkAccessStateEnabled) - - if props.SourceServerResourceID != nil { - d.Set("source_server_id", props.SourceServerResourceID) - } - if props.Network.DelegatedSubnetResourceID != nil { - d.Set("delegated_subnet_id", props.Network.DelegatedSubnetResourceID) + if network := props.Network; network != nil { + d.Set("public_network_access_enabled", network.PublicNetworkAccess == postgresqlflexibleservers.ServerPublicNetworkAccessStateEnabled) + d.Set("delegated_subnet_id", network.DelegatedSubnetResourceID) } if err := d.Set("maintenance_window", flattenArmServerMaintenanceWindow(props.MaintenanceWindow)); err != nil { return fmt.Errorf("setting `maintenance_window`: %+v", err) } - if storage := props.Storage; storage != nil { + if storage := props.Storage; storage != nil && storage.StorageSizeGB != nil { d.Set("storage_mb", (*storage.StorageSizeGB * 1024)) } diff --git a/azurerm/internal/services/postgres/postgresql_flexible_server_resource_test.go b/azurerm/internal/services/postgres/postgresql_flexible_server_resource_test.go index b909148e440a..fe12801aaf45 100644 --- a/azurerm/internal/services/postgres/postgresql_flexible_server_resource_test.go +++ b/azurerm/internal/services/postgres/postgresql_flexible_server_resource_test.go @@ -26,6 +26,7 @@ func TestAccPostgresqlflexibleServer_basic(t *testing.T) { Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), check.That(data.ResourceName).Key("zone").Exists(), + check.That(data.ResourceName).Key("cmk_enabled").IsEmpty(), check.That(data.ResourceName).Key("fqdn").Exists(), check.That(data.ResourceName).Key("public_network_access_enabled").Exists(), ), diff --git a/website/docs/d/postgresql_flexible_server.html.markdown b/website/docs/d/postgresql_flexible_server.html.markdown index 218043847c8d..add1fb86d11f 100644 --- a/website/docs/d/postgresql_flexible_server.html.markdown +++ b/website/docs/d/postgresql_flexible_server.html.markdown @@ -43,6 +43,10 @@ In addition to the Arguments listed above - the following Attributes are exporte * `backup_retention_days` - The backup retention days for the PostgreSQL Flexible Server. +* `cmk_enabled` - The status showing whether the data encryption is enabled with a customer-managed key. + +~> **Note:** Attribute `cmk_enabled` has been deprecated and will be removed in version 3.0 of the provider. + * `delegated_subnet_id` - The ID of the virtual network subnet to create the PostgreSQL Flexible Server. * `fqdn` - The FQDN of the PostgreSQL Flexible Server. diff --git a/website/docs/r/postgresql_flexible_server.html.markdown b/website/docs/r/postgresql_flexible_server.html.markdown index 412d3531b012..bb3c112e63cb 100644 --- a/website/docs/r/postgresql_flexible_server.html.markdown +++ b/website/docs/r/postgresql_flexible_server.html.markdown @@ -113,6 +113,10 @@ In addition to the Arguments listed above - the following Attributes are exporte * `id` - The ID of the PostgreSQL Flexible Server. +* `cmk_enabled` - The status showing whether the data encryption is enabled with a customer-managed key. + +~> **Note:** Attribute `cmk_enabled` has been deprecated and will be removed in version 3.0 of the provider. + * `fqdn` - The FQDN of the PostgreSQL Flexible Server. * `public_network_access_enabled` - Is public network access enabled?