From 740af4514cdf74877244e0d5dbe59a8994403b87 Mon Sep 17 00:00:00 2001 From: kt Date: Wed, 4 Mar 2020 18:25:03 -0800 Subject: [PATCH] azurerm_netapp_volume - support NFSv4.1, vol sizing issue (#5485) Hi Terraform team, I'm part of Azure NetApp team at Microsoft and I'm providing this PR that adds support for NFSv4.1 since we have a partner that needs this support to work internally and with their own customers. This is a summary of changes I made: - Bumped up the ANF's Go SDK version to the latest (2019-10-01) - Implemented an attribute name change for the ExportPolicyRule that got renamed to Nfsv41 since api version 2019-07-01 and applied the same renaming concept to Go's own object properties to avoid confusion. - Implemented the property called protocol_types as additional volume property since this is the one that controls what protocol the volume will support (it is defined as a list following our API definition but only one is supported) and included validation. - Implemented some changes on Tests so we can check if a NFSv4.1 volume gets created, plus testing for NFSv3 value on basic volume test - Stepped down the ServiceLevel from Premium to Standard on Tests so developer incur in less costs while working on ANF resource. - Fixed a bug related to volume size that was limiting a volume to 4TB while the correct maximum size is 100TB. --- .../internal/services/netapp/client/client.go | 2 +- .../netapp/data_source_netapp_volume.go | 12 + .../netapp/resource_arm_netapp_account.go | 2 +- .../netapp/resource_arm_netapp_pool.go | 2 +- .../netapp/resource_arm_netapp_snapshot.go | 2 +- .../netapp/resource_arm_netapp_volume.go | 142 ++++-- .../tests/data_source_netapp_volume_test.go | 1 + .../tests/resource_arm_netapp_pool_test.go | 4 +- .../resource_arm_netapp_snapshot_test.go | 2 + .../tests/resource_arm_netapp_volume_test.go | 106 +++- examples/netapp/volume/main.tf | 13 + go.sum | 2 +- .../netapp/accounts.go | 12 +- .../netapp/mgmt/2019-10-01/netapp/client.go | 51 ++ .../netapp/models.go | 182 ++++++- .../netapp/mounttargets.go | 2 +- .../netapp/operations.go | 2 +- .../netapp/pools.go | 10 +- .../netapp/resource.go} | 72 ++- .../netapp/snapshots.go | 10 +- .../netapp/version.go | 2 +- .../netapp/volumes.go | 460 +++++++++++++++++- vendor/modules.txt | 2 +- website/docs/r/netapp_volume.html.markdown | 17 +- 24 files changed, 958 insertions(+), 154 deletions(-) rename vendor/github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/{2019-06-01 => 2019-10-01}/netapp/accounts.go (99%) create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/2019-10-01/netapp/client.go rename vendor/github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/{2019-06-01 => 2019-10-01}/netapp/models.go (88%) rename vendor/github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/{2019-06-01 => 2019-10-01}/netapp/mounttargets.go (99%) rename vendor/github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/{2019-06-01 => 2019-10-01}/netapp/operations.go (99%) rename vendor/github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/{2019-06-01 => 2019-10-01}/netapp/pools.go (99%) rename vendor/github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/{2019-06-01/netapp/client.go => 2019-10-01/netapp/resource.go} (69%) rename vendor/github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/{2019-06-01 => 2019-10-01}/netapp/snapshots.go (99%) rename vendor/github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/{2019-06-01 => 2019-10-01}/netapp/version.go (94%) rename vendor/github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/{2019-06-01 => 2019-10-01}/netapp/volumes.go (52%) diff --git a/azurerm/internal/services/netapp/client/client.go b/azurerm/internal/services/netapp/client/client.go index cc0127c118bb..fdffa5a2214d 100644 --- a/azurerm/internal/services/netapp/client/client.go +++ b/azurerm/internal/services/netapp/client/client.go @@ -1,7 +1,7 @@ package client import ( - "github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/2019-06-01/netapp" + "github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/2019-10-01/netapp" "github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/common" ) diff --git a/azurerm/internal/services/netapp/data_source_netapp_volume.go b/azurerm/internal/services/netapp/data_source_netapp_volume.go index 5a55474e19bf..3cb9929de84c 100644 --- a/azurerm/internal/services/netapp/data_source_netapp_volume.go +++ b/azurerm/internal/services/netapp/data_source_netapp_volume.go @@ -61,6 +61,12 @@ func dataSourceArmNetAppVolume() *schema.Resource { Type: schema.TypeInt, Computed: true, }, + + "protocols": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Schema{Type: schema.TypeString}, + }, }, } } @@ -101,6 +107,12 @@ func dataSourceArmNetAppVolumeRead(d *schema.ResourceData, meta interface{}) err d.Set("service_level", props.ServiceLevel) d.Set("subnet_id", props.SubnetID) + protocolTypes := make([]string, 0) + if prtclTypes := props.ProtocolTypes; prtclTypes != nil { + protocolTypes = append(protocolTypes, *prtclTypes...) + } + d.Set("protocols", protocolTypes) + if props.UsageThreshold != nil { d.Set("storage_quota_in_gb", *props.UsageThreshold/1073741824) } diff --git a/azurerm/internal/services/netapp/resource_arm_netapp_account.go b/azurerm/internal/services/netapp/resource_arm_netapp_account.go index 168d9ff80cbe..13a5e3bea09f 100644 --- a/azurerm/internal/services/netapp/resource_arm_netapp_account.go +++ b/azurerm/internal/services/netapp/resource_arm_netapp_account.go @@ -7,7 +7,7 @@ import ( "strings" "time" - "github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/2019-06-01/netapp" + "github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/2019-10-01/netapp" "github.com/hashicorp/go-azure-helpers/response" "github.com/hashicorp/terraform-plugin-sdk/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/helper/validation" diff --git a/azurerm/internal/services/netapp/resource_arm_netapp_pool.go b/azurerm/internal/services/netapp/resource_arm_netapp_pool.go index 9c898e8f78d1..418df5a96d02 100644 --- a/azurerm/internal/services/netapp/resource_arm_netapp_pool.go +++ b/azurerm/internal/services/netapp/resource_arm_netapp_pool.go @@ -7,7 +7,7 @@ import ( "strconv" "time" - "github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/2019-06-01/netapp" + "github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/2019-10-01/netapp" "github.com/hashicorp/terraform-plugin-sdk/helper/resource" "github.com/hashicorp/terraform-plugin-sdk/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/helper/validation" diff --git a/azurerm/internal/services/netapp/resource_arm_netapp_snapshot.go b/azurerm/internal/services/netapp/resource_arm_netapp_snapshot.go index a8599b9e1e9a..dc8e0d3152f3 100644 --- a/azurerm/internal/services/netapp/resource_arm_netapp_snapshot.go +++ b/azurerm/internal/services/netapp/resource_arm_netapp_snapshot.go @@ -5,7 +5,7 @@ import ( "log" "time" - "github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/2019-06-01/netapp" + "github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/2019-10-01/netapp" "github.com/hashicorp/go-azure-helpers/response" "github.com/hashicorp/terraform-plugin-sdk/helper/schema" "github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/azure" diff --git a/azurerm/internal/services/netapp/resource_arm_netapp_volume.go b/azurerm/internal/services/netapp/resource_arm_netapp_volume.go index e795aadd9b64..a1c4fca422f8 100644 --- a/azurerm/internal/services/netapp/resource_arm_netapp_volume.go +++ b/azurerm/internal/services/netapp/resource_arm_netapp_volume.go @@ -8,7 +8,7 @@ import ( "strings" "time" - "github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/2019-06-01/netapp" + "github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/2019-10-01/netapp" "github.com/hashicorp/terraform-plugin-sdk/helper/resource" "github.com/hashicorp/terraform-plugin-sdk/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/helper/validation" @@ -36,7 +36,7 @@ func resourceArmNetAppVolume() *schema.Resource { Create: schema.DefaultTimeout(30 * time.Minute), Read: schema.DefaultTimeout(5 * time.Minute), Update: schema.DefaultTimeout(30 * time.Minute), - Delete: schema.DefaultTimeout(30 * time.Minute), + Delete: schema.DefaultTimeout(60 * time.Minute), }, Schema: map[string]*schema.Schema{ @@ -75,6 +75,7 @@ func resourceArmNetAppVolume() *schema.Resource { "service_level": { Type: schema.TypeString, Required: true, + ForceNew: true, ValidateFunc: validation.StringInSlice([]string{ string(netapp.Premium), string(netapp.Standard), @@ -89,6 +90,20 @@ func resourceArmNetAppVolume() *schema.Resource { ValidateFunc: azure.ValidateResourceID, }, + "protocols": { + Type: schema.TypeSet, + ForceNew: true, + Optional: true, + Computed: true, + MaxItems: 2, + Elem: &schema.Schema{Type: schema.TypeString, + ValidateFunc: validation.StringInSlice([]string{ + "NFSv3", + "NFSv4.1", + "CIFS", + }, false)}, + }, + "storage_quota_in_gb": { Type: schema.TypeInt, Required: true, @@ -96,7 +111,7 @@ func resourceArmNetAppVolume() *schema.Resource { }, "export_policy_rule": { - Type: schema.TypeSet, + Type: schema.TypeList, Optional: true, MaxItems: 5, Elem: &schema.Resource{ @@ -106,6 +121,7 @@ func resourceArmNetAppVolume() *schema.Resource { Required: true, ValidateFunc: validation.IntBetween(1, 5), }, + "allowed_clients": { Type: schema.TypeSet, Required: true, @@ -114,22 +130,47 @@ func resourceArmNetAppVolume() *schema.Resource { ValidateFunc: validate.CIDR, }, }, + + "protocols_enabled": { + Type: schema.TypeList, + Optional: true, + Computed: true, + MaxItems: 1, + MinItems: 1, + Elem: &schema.Schema{Type: schema.TypeString, + ValidateFunc: validation.StringInSlice([]string{ + "NFSv3", + "NFSv4.1", + "CIFS", + }, false)}, + }, + "cifs_enabled": { - Type: schema.TypeBool, - Required: true, + Type: schema.TypeBool, + Optional: true, + Computed: true, + Deprecated: "Deprecated in favor of `protocols_enabled`", }, + "nfsv3_enabled": { - Type: schema.TypeBool, - Required: true, + Type: schema.TypeBool, + Optional: true, + Computed: true, + Deprecated: "Deprecated in favor of `protocols_enabled`", }, + "nfsv4_enabled": { - Type: schema.TypeBool, - Required: true, + Type: schema.TypeBool, + Optional: true, + Computed: true, + Deprecated: "Deprecated in favor of `protocols_enabled`", }, + "unix_read_only": { Type: schema.TypeBool, Optional: true, }, + "unix_read_write": { Type: schema.TypeBool, Optional: true, @@ -167,8 +208,13 @@ func resourceArmNetAppVolumeCreateUpdate(d *schema.ResourceData, meta interface{ volumePath := d.Get("volume_path").(string) serviceLevel := d.Get("service_level").(string) subnetId := d.Get("subnet_id").(string) + protocols := d.Get("protocols").(*schema.Set).List() + if len(protocols) == 0 { + protocols = append(protocols, "NFSv3") + } + storageQuotaInGB := int64(d.Get("storage_quota_in_gb").(int) * 1073741824) - exportPolicyRule := d.Get("export_policy_rule").(*schema.Set).List() + exportPolicyRule := d.Get("export_policy_rule").([]interface{}) parameters := netapp.Volume{ Location: utils.String(location), @@ -176,6 +222,7 @@ func resourceArmNetAppVolumeCreateUpdate(d *schema.ResourceData, meta interface{ CreationToken: utils.String(volumePath), ServiceLevel: netapp.ServiceLevel(serviceLevel), SubnetID: utils.String(subnetId), + ProtocolTypes: utils.ExpandStringSlice(protocols), UsageThreshold: utils.Int64(storageQuotaInGB), ExportPolicy: expandArmNetAppVolumeExportPolicyRule(exportPolicyRule), }, @@ -236,7 +283,7 @@ func resourceArmNetAppVolumeRead(d *schema.ResourceData, meta interface{}) error d.Set("volume_path", props.CreationToken) d.Set("service_level", props.ServiceLevel) d.Set("subnet_id", props.SubnetID) - + d.Set("protocols", props.ProtocolTypes) if props.UsageThreshold != nil { d.Set("storage_quota_in_gb", *props.UsageThreshold/1073741824) } @@ -310,9 +357,34 @@ func expandArmNetAppVolumeExportPolicyRule(input []interface{}) *netapp.VolumePr v := item.(map[string]interface{}) ruleIndex := int32(v["rule_index"].(int)) allowedClients := strings.Join(*utils.ExpandStringSlice(v["allowed_clients"].(*schema.Set).List()), ",") - cifsEnabled := v["cifs_enabled"].(bool) - nfsv3Enabled := v["nfsv3_enabled"].(bool) - nfsv4Enabled := v["nfsv4_enabled"].(bool) + + cifsEnabled := false + nfsv3Enabled := false + nfsv41Enabled := false + + if vpe := v["protocols_enabled"]; vpe != nil { + protocolsEnabled := vpe.([]interface{}) + if len(protocolsEnabled) != 0 { + for _, protocol := range protocolsEnabled { + if protocol != nil { + switch strings.ToLower(protocol.(string)) { + case "cifs": + cifsEnabled = true + case "nfsv3": + nfsv3Enabled = true + case "nfsv4.1": + nfsv41Enabled = true + } + } + } + } else { + // TODO: Remove in next major version + cifsEnabled = v["cifs_enabled"].(bool) + nfsv3Enabled = v["nfsv3_enabled"].(bool) + nfsv41Enabled = v["nfsv4_enabled"].(bool) + } + } + unixReadOnly := v["unix_read_only"].(bool) unixReadWrite := v["unix_read_write"].(bool) @@ -320,7 +392,7 @@ func expandArmNetAppVolumeExportPolicyRule(input []interface{}) *netapp.VolumePr AllowedClients: utils.String(allowedClients), Cifs: utils.Bool(cifsEnabled), Nfsv3: utils.Bool(nfsv3Enabled), - Nfsv4: utils.Bool(nfsv4Enabled), + Nfsv41: utils.Bool(nfsv41Enabled), RuleIndex: utils.Int32(ruleIndex), UnixReadOnly: utils.Bool(unixReadOnly), UnixReadWrite: utils.Bool(unixReadWrite), @@ -350,17 +422,29 @@ func flattenArmNetAppVolumeExportPolicyRule(input *netapp.VolumePropertiesExport if v := item.AllowedClients; v != nil { allowedClients = strings.Split(*v, ",") } + //TODO: Start - Remove in next major version cifsEnabled := false + nfsv3Enabled := false + nfsv4Enabled := false + // End - Remove in next major version + protocolsEnabled := []string{} if v := item.Cifs; v != nil { - cifsEnabled = *v + if *v { + protocolsEnabled = append(protocolsEnabled, "CIFS") + } + cifsEnabled = *v //TODO: Remove in next major version } - nfsv3Enabled := false if v := item.Nfsv3; v != nil { - nfsv3Enabled = *v + if *v { + protocolsEnabled = append(protocolsEnabled, "NFSv3") + } + nfsv3Enabled = *v //TODO: Remove in next major version } - nfsv4Enabled := false - if v := item.Nfsv4; v != nil { - nfsv4Enabled = *v + if v := item.Nfsv41; v != nil { + if *v { + protocolsEnabled = append(protocolsEnabled, "NFSv4.1") + } + nfsv4Enabled = *v //TODO: Remove in next major version } unixReadOnly := false if v := item.UnixReadOnly; v != nil { @@ -372,13 +456,15 @@ func flattenArmNetAppVolumeExportPolicyRule(input *netapp.VolumePropertiesExport } results = append(results, map[string]interface{}{ - "rule_index": ruleIndex, - "allowed_clients": utils.FlattenStringSlice(&allowedClients), - "cifs_enabled": cifsEnabled, - "nfsv3_enabled": nfsv3Enabled, - "nfsv4_enabled": nfsv4Enabled, - "unix_read_only": unixReadOnly, - "unix_read_write": unixReadWrite, + "rule_index": ruleIndex, + "allowed_clients": utils.FlattenStringSlice(&allowedClients), + "unix_read_only": unixReadOnly, + "unix_read_write": unixReadWrite, + "protocols_enabled": utils.FlattenStringSlice(&protocolsEnabled), + //TODO: Remove in next major version + "cifs_enabled": cifsEnabled, + "nfsv3_enabled": nfsv3Enabled, + "nfsv4_enabled": nfsv4Enabled, }) } diff --git a/azurerm/internal/services/netapp/tests/data_source_netapp_volume_test.go b/azurerm/internal/services/netapp/tests/data_source_netapp_volume_test.go index be51ace2b876..3429d7fe785e 100644 --- a/azurerm/internal/services/netapp/tests/data_source_netapp_volume_test.go +++ b/azurerm/internal/services/netapp/tests/data_source_netapp_volume_test.go @@ -22,6 +22,7 @@ func TestAccDataSourceAzureRMNetAppVolume_basic(t *testing.T) { resource.TestCheckResourceAttrSet(data.ResourceName, "service_level"), resource.TestCheckResourceAttrSet(data.ResourceName, "subnet_id"), resource.TestCheckResourceAttrSet(data.ResourceName, "storage_quota_in_gb"), + resource.TestCheckResourceAttrSet(data.ResourceName, "protocols.0"), ), }, }, diff --git a/azurerm/internal/services/netapp/tests/resource_arm_netapp_pool_test.go b/azurerm/internal/services/netapp/tests/resource_arm_netapp_pool_test.go index b2badb749a2f..a0104f0588a1 100644 --- a/azurerm/internal/services/netapp/tests/resource_arm_netapp_pool_test.go +++ b/azurerm/internal/services/netapp/tests/resource_arm_netapp_pool_test.go @@ -91,7 +91,7 @@ func TestAccAzureRMNetAppPool_update(t *testing.T) { Config: testAccAzureRMNetAppPool_basic(data), Check: resource.ComposeTestCheckFunc( testCheckAzureRMNetAppPoolExists(data.ResourceName), - resource.TestCheckResourceAttr(data.ResourceName, "service_level", "Premium"), + resource.TestCheckResourceAttr(data.ResourceName, "service_level", "Standard"), resource.TestCheckResourceAttr(data.ResourceName, "size_in_tb", "4"), ), }, @@ -181,7 +181,7 @@ resource "azurerm_netapp_pool" "test" { account_name = azurerm_netapp_account.test.name location = azurerm_resource_group.test.location resource_group_name = azurerm_resource_group.test.name - service_level = "Premium" + service_level = "Standard" size_in_tb = 4 } `, data.RandomInteger, data.Locations.Primary, data.RandomInteger, data.RandomInteger) diff --git a/azurerm/internal/services/netapp/tests/resource_arm_netapp_snapshot_test.go b/azurerm/internal/services/netapp/tests/resource_arm_netapp_snapshot_test.go index e8d63f8a0965..bf598137a7a2 100644 --- a/azurerm/internal/services/netapp/tests/resource_arm_netapp_snapshot_test.go +++ b/azurerm/internal/services/netapp/tests/resource_arm_netapp_snapshot_test.go @@ -222,8 +222,10 @@ resource "azurerm_subnet" "update" { resource_group_name = azurerm_resource_group.test.name virtual_network_name = azurerm_virtual_network.update.name address_prefix = "10.0.2.0/24" + delegation { name = "netapp" + service_delegation { name = "Microsoft.Netapp/volumes" actions = ["Microsoft.Network/networkinterfaces/*", "Microsoft.Network/virtualNetworks/subnets/join/action"] diff --git a/azurerm/internal/services/netapp/tests/resource_arm_netapp_volume_test.go b/azurerm/internal/services/netapp/tests/resource_arm_netapp_volume_test.go index 188e22ae084b..8c3bae1720e5 100644 --- a/azurerm/internal/services/netapp/tests/resource_arm_netapp_volume_test.go +++ b/azurerm/internal/services/netapp/tests/resource_arm_netapp_volume_test.go @@ -25,6 +25,27 @@ func TestAccAzureRMNetAppVolume_basic(t *testing.T) { Config: testAccAzureRMNetAppVolume_basic(data), Check: resource.ComposeTestCheckFunc( testCheckAzureRMNetAppVolumeExists(data.ResourceName), + resource.TestCheckResourceAttr(data.ResourceName, "protocols.2676449260", "NFSv3"), + ), + }, + data.ImportStep(), + }, + }) +} + +func TestAccAzureRMNetAppVolume_nfsv41(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_netapp_volume", "test") + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { acceptance.PreCheck(t) }, + Providers: acceptance.SupportedProviders, + CheckDestroy: testCheckAzureRMNetAppVolumeDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAzureRMNetAppVolume_nfsv41(data), + Check: resource.ComposeTestCheckFunc( + testCheckAzureRMNetAppVolumeExists(data.ResourceName), + resource.TestCheckResourceAttr(data.ResourceName, "protocols.3098200649", "NFSv4.1"), ), }, data.ImportStep(), @@ -71,9 +92,9 @@ func TestAccAzureRMNetAppVolume_complete(t *testing.T) { Config: testAccAzureRMNetAppVolume_complete(data), Check: resource.ComposeTestCheckFunc( testCheckAzureRMNetAppVolumeExists(data.ResourceName), - resource.TestCheckResourceAttr(data.ResourceName, "service_level", "Premium"), + resource.TestCheckResourceAttr(data.ResourceName, "service_level", "Standard"), resource.TestCheckResourceAttr(data.ResourceName, "storage_quota_in_gb", "101"), - resource.TestCheckResourceAttr(data.ResourceName, "export_policy_rule.#", "2"), + resource.TestCheckResourceAttr(data.ResourceName, "export_policy_rule.#", "3"), ), }, data.ImportStep(), @@ -103,7 +124,7 @@ func TestAccAzureRMNetAppVolume_update(t *testing.T) { Check: resource.ComposeTestCheckFunc( testCheckAzureRMNetAppVolumeExists(data.ResourceName), resource.TestCheckResourceAttr(data.ResourceName, "storage_quota_in_gb", "101"), - resource.TestCheckResourceAttr(data.ResourceName, "export_policy_rule.#", "2"), + resource.TestCheckResourceAttr(data.ResourceName, "export_policy_rule.#", "3"), ), }, data.ImportStep(), @@ -170,7 +191,7 @@ func TestAccAzureRMNetAppVolume_updateExportPolicyRule(t *testing.T) { Config: testAccAzureRMNetAppVolume_complete(data), Check: resource.ComposeTestCheckFunc( testCheckAzureRMNetAppVolumeExists(data.ResourceName), - resource.TestCheckResourceAttr(data.ResourceName, "export_policy_rule.#", "2"), + resource.TestCheckResourceAttr(data.ResourceName, "export_policy_rule.#", "3"), ), }, data.ImportStep(), @@ -250,13 +271,41 @@ resource "azurerm_netapp_volume" "test" { account_name = azurerm_netapp_account.test.name pool_name = azurerm_netapp_pool.test.name volume_path = "my-unique-file-path-%d" - service_level = "Premium" + service_level = "Standard" subnet_id = azurerm_subnet.test.id storage_quota_in_gb = 100 } `, template, data.RandomInteger, data.RandomInteger) } +func testAccAzureRMNetAppVolume_nfsv41(data acceptance.TestData) string { + template := testAccAzureRMNetAppVolume_template(data) + return fmt.Sprintf(` +%s + +resource "azurerm_netapp_volume" "test" { + name = "acctest-NetAppVolume-%d" + location = "${azurerm_resource_group.test.location}" + resource_group_name = "${azurerm_resource_group.test.name}" + account_name = "${azurerm_netapp_account.test.name}" + pool_name = "${azurerm_netapp_pool.test.name}" + volume_path = "my-unique-file-path-%d" + service_level = "Standard" + subnet_id = "${azurerm_subnet.test.id}" + protocols = ["NFSv4.1"] + storage_quota_in_gb = 100 + + export_policy_rule { + rule_index = 1 + allowed_clients = ["1.2.3.0/24"] + protocols_enabled = ["NFSv4.1"] + unix_read_only = false + unix_read_write = true + } +} +`, template, data.RandomInteger, data.RandomInteger) +} + func testAccAzureRMNetAppVolume_requiresImport(data acceptance.TestData) string { return fmt.Sprintf(` %s @@ -280,24 +329,31 @@ resource "azurerm_netapp_volume" "test" { resource_group_name = azurerm_resource_group.test.name account_name = azurerm_netapp_account.test.name pool_name = azurerm_netapp_pool.test.name - service_level = "Premium" + service_level = "Standard" volume_path = "my-unique-file-path-%d" subnet_id = azurerm_subnet.test.id + protocols = ["NFSv3"] storage_quota_in_gb = 101 export_policy_rule { - rule_index = 1 - allowed_clients = ["1.2.3.0/24"] - cifs_enabled = false - nfsv3_enabled = true - nfsv4_enabled = false - unix_read_only = false - unix_read_write = true + rule_index = 1 + allowed_clients = ["1.2.3.0/24"] + protocols_enabled = ["NFSv3"] + unix_read_only = false + unix_read_write = true + } + + export_policy_rule { + rule_index = 2 + allowed_clients = ["1.2.5.0"] + protocols_enabled = ["NFSv3"] + unix_read_only = true + unix_read_write = false } export_policy_rule { - rule_index = 2 - allowed_clients = ["1.2.5.0"] + rule_index = 3 + allowed_clients = ["1.2.6.0/24"] cifs_enabled = false nfsv3_enabled = true nfsv4_enabled = false @@ -343,8 +399,9 @@ resource "azurerm_netapp_volume" "test" { account_name = azurerm_netapp_account.test.name pool_name = azurerm_netapp_pool.test.name volume_path = "my-updated-unique-file-path-%d" - service_level = "Premium" + service_level = "Standard" subnet_id = azurerm_subnet.updated.id + protocols = ["NFSv3"] storage_quota_in_gb = 100 } `, template, data.RandomInteger, data.RandomInteger, data.RandomInteger, data.RandomInteger) @@ -361,19 +418,18 @@ resource "azurerm_netapp_volume" "test" { resource_group_name = azurerm_resource_group.test.name account_name = azurerm_netapp_account.test.name pool_name = azurerm_netapp_pool.test.name - service_level = "Premium" + service_level = "Standard" volume_path = "my-unique-file-path-%d" subnet_id = azurerm_subnet.test.id + protocols = ["NFSv3"] storage_quota_in_gb = 101 export_policy_rule { - rule_index = 1 - allowed_clients = ["1.2.4.0/24", "1.3.4.0"] - cifs_enabled = false - nfsv3_enabled = true - nfsv4_enabled = false - unix_read_only = false - unix_read_write = true + rule_index = 1 + allowed_clients = ["1.2.4.0/24", "1.3.4.0"] + protocols_enabled = ["NFSv3"] + unix_read_only = false + unix_read_write = true } } `, template, data.RandomInteger, data.RandomInteger) @@ -424,7 +480,7 @@ resource "azurerm_netapp_pool" "test" { location = azurerm_resource_group.test.location resource_group_name = azurerm_resource_group.test.name account_name = azurerm_netapp_account.test.name - service_level = "Premium" + service_level = "Standard" size_in_tb = 4 } `, data.RandomInteger, data.Locations.Primary, data.RandomInteger, data.RandomInteger, data.RandomInteger, data.RandomInteger) diff --git a/examples/netapp/volume/main.tf b/examples/netapp/volume/main.tf index dd1883b3aff7..372255e0ee8b 100644 --- a/examples/netapp/volume/main.tf +++ b/examples/netapp/volume/main.tf @@ -46,6 +46,10 @@ resource "azurerm_netapp_pool" "example" { } resource "azurerm_netapp_volume" "example" { + lifecycle { + prevent_destroy = true + } + name = "${var.prefix}-netappvolume" location = "${azurerm_resource_group.example.location}" resource_group_name = "${azurerm_resource_group.example.name}" @@ -54,5 +58,14 @@ resource "azurerm_netapp_volume" "example" { volume_path = "my-unique-file-path" service_level = "Premium" subnet_id = "${azurerm_subnet.example.id}" + protocols = ["NFSv4.1"] storage_quota_in_gb = 100 + + export_policy_rule { + rule_index = 1 + allowed_clients = ["0.0.0.0/0"] + protocols_enabled = ["NFSv4.1"] + unix_read_only = false + unix_read_write = true + } } diff --git a/go.sum b/go.sum index e9d9fd7f47e2..96d963fc8f0f 100644 --- a/go.sum +++ b/go.sum @@ -463,4 +463,4 @@ honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWh honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= howett.net/plist v0.0.0-20181124034731-591f970eefbb/go.mod h1:vMygbs4qMhSZSc4lCUl2OEE+rDiIIJAIdR4m7MiMcm0= -rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= +rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= \ No newline at end of file diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/2019-06-01/netapp/accounts.go b/vendor/github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/2019-10-01/netapp/accounts.go similarity index 99% rename from vendor/github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/2019-06-01/netapp/accounts.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/2019-10-01/netapp/accounts.go index 982b13e95a8f..00f10b69d6f5 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/2019-06-01/netapp/accounts.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/2019-10-01/netapp/accounts.go @@ -90,7 +90,7 @@ func (client AccountsClient) CreateOrUpdatePreparer(ctx context.Context, body Ac "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2019-06-01" + const APIVersion = "2019-10-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -180,7 +180,7 @@ func (client AccountsClient) DeletePreparer(ctx context.Context, resourceGroupNa "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2019-06-01" + const APIVersion = "2019-10-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -270,7 +270,7 @@ func (client AccountsClient) GetPreparer(ctx context.Context, resourceGroupName "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2019-06-01" + const APIVersion = "2019-10-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -303,7 +303,7 @@ func (client AccountsClient) GetResponder(resp *http.Response) (result Account, return } -// List list and describe all NetApp accounts in the resource group +// List list and describe all NetApp accounts in the resource group. // Parameters: // resourceGroupName - the name of the resource group. func (client AccountsClient) List(ctx context.Context, resourceGroupName string) (result AccountList, err error) { @@ -353,7 +353,7 @@ func (client AccountsClient) ListPreparer(ctx context.Context, resourceGroupName "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2019-06-01" + const APIVersion = "2019-10-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -439,7 +439,7 @@ func (client AccountsClient) UpdatePreparer(ctx context.Context, body AccountPat "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2019-06-01" + const APIVersion = "2019-10-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/2019-10-01/netapp/client.go b/vendor/github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/2019-10-01/netapp/client.go new file mode 100644 index 000000000000..0dfd8925e16e --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/2019-10-01/netapp/client.go @@ -0,0 +1,51 @@ +// Package netapp implements the Azure ARM Netapp service API version 2019-10-01. +// +// Microsoft NetApp Azure Resource Provider specification +package netapp + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" +) + +const ( + // DefaultBaseURI is the default URI used for the service Netapp + DefaultBaseURI = "https://management.azure.com" +) + +// BaseClient is the base client for Netapp. +type BaseClient struct { + autorest.Client + BaseURI string + SubscriptionID string +} + +// New creates an instance of the BaseClient client. +func New(subscriptionID string) BaseClient { + return NewWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewWithBaseURI creates an instance of the BaseClient client. +func NewWithBaseURI(baseURI string, subscriptionID string) BaseClient { + return BaseClient{ + Client: autorest.NewClientWithUserAgent(UserAgent()), + BaseURI: baseURI, + SubscriptionID: subscriptionID, + } +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/2019-06-01/netapp/models.go b/vendor/github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/2019-10-01/netapp/models.go similarity index 88% rename from vendor/github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/2019-06-01/netapp/models.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/2019-10-01/netapp/models.go index e9c28731811f..e7f905978a96 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/2019-06-01/netapp/models.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/2019-10-01/netapp/models.go @@ -27,7 +27,7 @@ import ( ) // The package's fully qualified name. -const fqdn = "github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/2019-06-01/netapp" +const fqdn = "github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/2019-10-01/netapp" // CheckNameResourceTypes enumerates the values for check name resource types. type CheckNameResourceTypes string @@ -48,6 +48,21 @@ func PossibleCheckNameResourceTypesValues() []CheckNameResourceTypes { return []CheckNameResourceTypes{MicrosoftNetAppnetAppAccounts, MicrosoftNetAppnetAppAccountscapacityPools, MicrosoftNetAppnetAppAccountscapacityPoolsvolumes, MicrosoftNetAppnetAppAccountscapacityPoolsvolumessnapshots} } +// EndpointType enumerates the values for endpoint type. +type EndpointType string + +const ( + // Dst ... + Dst EndpointType = "dst" + // Src ... + Src EndpointType = "src" +) + +// PossibleEndpointTypeValues returns an array of possible values for the EndpointType const type. +func PossibleEndpointTypeValues() []EndpointType { + return []EndpointType{Dst, Src} +} + // InAvailabilityReasonType enumerates the values for in availability reason type. type InAvailabilityReasonType string @@ -63,6 +78,59 @@ func PossibleInAvailabilityReasonTypeValues() []InAvailabilityReasonType { return []InAvailabilityReasonType{AlreadyExists, Invalid} } +// MirrorState enumerates the values for mirror state. +type MirrorState string + +const ( + // Broken ... + Broken MirrorState = "Broken" + // Mirrored ... + Mirrored MirrorState = "Mirrored" + // Uninitialized ... + Uninitialized MirrorState = "Uninitialized" +) + +// PossibleMirrorStateValues returns an array of possible values for the MirrorState const type. +func PossibleMirrorStateValues() []MirrorState { + return []MirrorState{Broken, Mirrored, Uninitialized} +} + +// RelationshipStatus enumerates the values for relationship status. +type RelationshipStatus string + +const ( + // Idle ... + Idle RelationshipStatus = "Idle" + // Transferring ... + Transferring RelationshipStatus = "Transferring" +) + +// PossibleRelationshipStatusValues returns an array of possible values for the RelationshipStatus const type. +func PossibleRelationshipStatusValues() []RelationshipStatus { + return []RelationshipStatus{Idle, Transferring} +} + +// ReplicationSchedule enumerates the values for replication schedule. +type ReplicationSchedule string + +const ( + // OneZerominutely ... + OneZerominutely ReplicationSchedule = "_10minutely" + // Daily ... + Daily ReplicationSchedule = "daily" + // Hourly ... + Hourly ReplicationSchedule = "hourly" + // Monthly ... + Monthly ReplicationSchedule = "monthly" + // Weekly ... + Weekly ReplicationSchedule = "weekly" +) + +// PossibleReplicationScheduleValues returns an array of possible values for the ReplicationSchedule const type. +func PossibleReplicationScheduleValues() []ReplicationSchedule { + return []ReplicationSchedule{OneZerominutely, Daily, Hourly, Monthly, Weekly} +} + // ServiceLevel enumerates the values for service level. type ServiceLevel string @@ -92,7 +160,7 @@ type Account struct { // Type - READ-ONLY; Resource type Type *string `json:"type,omitempty"` // Tags - Resource tags - Tags interface{} `json:"tags,omitempty"` + Tags map[string]*string `json:"tags"` // AccountProperties - NetApp Account properties *AccountProperties `json:"properties,omitempty"` } @@ -159,7 +227,7 @@ func (a *Account) UnmarshalJSON(body []byte) error { } case "tags": if v != nil { - var tags interface{} + var tags map[string]*string err = json.Unmarshal(*v, &tags) if err != nil { return err @@ -199,7 +267,7 @@ type AccountPatch struct { // Type - READ-ONLY; Resource type Type *string `json:"type,omitempty"` // Tags - Resource tags - Tags interface{} `json:"tags,omitempty"` + Tags map[string]*string `json:"tags"` // AccountProperties - NetApp Account properties *AccountProperties `json:"properties,omitempty"` } @@ -266,7 +334,7 @@ func (ap *AccountPatch) UnmarshalJSON(body []byte) error { } case "tags": if v != nil { - var tags interface{} + var tags map[string]*string err = json.Unmarshal(*v, &tags) if err != nil { return err @@ -358,7 +426,7 @@ type ActiveDirectory struct { Password *string `json:"password,omitempty"` // Domain - Name of the Active Directory domain Domain *string `json:"domain,omitempty"` - // DNS - Comma separated list of DNS server IP addresses for the Active Directory domain + // DNS - Comma separated list of DNS server IP addresses (IPv4 only) for the Active Directory domain DNS *string `json:"dns,omitempty"` // Status - Status of the Active Directory Status *string `json:"status,omitempty"` @@ -368,6 +436,12 @@ type ActiveDirectory struct { OrganizationalUnit *string `json:"organizationalUnit,omitempty"` } +// AuthorizeRequest authorize request +type AuthorizeRequest struct { + // RemoteVolumeResourceID - Resource id + RemoteVolumeResourceID *string `json:"remoteVolumeResourceId,omitempty"` +} + // CapacityPool capacity pool resource type CapacityPool struct { autorest.Response `json:"-"` @@ -380,7 +454,7 @@ type CapacityPool struct { // Type - READ-ONLY; Resource type Type *string `json:"type,omitempty"` // Tags - Resource tags - Tags interface{} `json:"tags,omitempty"` + Tags map[string]*string `json:"tags"` // PoolProperties - Capacity pool properties *PoolProperties `json:"properties,omitempty"` } @@ -447,7 +521,7 @@ func (cp *CapacityPool) UnmarshalJSON(body []byte) error { } case "tags": if v != nil { - var tags interface{} + var tags map[string]*string err = json.Unmarshal(*v, &tags) if err != nil { return err @@ -487,7 +561,7 @@ type CapacityPoolPatch struct { // Type - READ-ONLY; Resource type Type *string `json:"type,omitempty"` // Tags - Resource tags - Tags interface{} `json:"tags,omitempty"` + Tags map[string]*string `json:"tags"` // PoolPatchProperties - Capacity pool properties *PoolPatchProperties `json:"properties,omitempty"` } @@ -554,7 +628,7 @@ func (cpp *CapacityPoolPatch) UnmarshalJSON(body []byte) error { } case "tags": if v != nil { - var tags interface{} + var tags map[string]*string err = json.Unmarshal(*v, &tags) if err != nil { return err @@ -596,8 +670,8 @@ type ExportPolicyRule struct { Cifs *bool `json:"cifs,omitempty"` // Nfsv3 - Allows NFSv3 protocol Nfsv3 *bool `json:"nfsv3,omitempty"` - // Nfsv4 - Deprecated: Will use the NFSv4.1 protocol, please use swagger version 2019-07-01 or later - Nfsv4 *bool `json:"nfsv4,omitempty"` + // Nfsv41 - Allows NFSv4.1 protocol + Nfsv41 *bool `json:"nfsv41,omitempty"` // AllowedClients - Client ingress specification as comma separated string with IPv4 CIDRs, IPv4 host addresses and host names AllowedClients *string `json:"allowedClients,omitempty"` } @@ -632,8 +706,10 @@ type MountTarget struct { ID *string `json:"id,omitempty"` // Name - READ-ONLY; Resource name Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type + Type *string `json:"type,omitempty"` // Tags - Resource tags - Tags interface{} `json:"tags,omitempty"` + Tags map[string]*string `json:"tags"` // MountTargetProperties - Mount Target Properties *MountTargetProperties `json:"properties,omitempty"` } @@ -689,9 +765,18 @@ func (mt *MountTarget) UnmarshalJSON(body []byte) error { } mt.Name = &name } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + mt.Type = &typeVar + } case "tags": if v != nil { - var tags interface{} + var tags map[string]*string err = json.Unmarshal(*v, &tags) if err != nil { return err @@ -922,6 +1007,35 @@ func (future *PoolsDeleteFuture) Result(client PoolsClient) (ar autorest.Respons return } +// ReplicationObject replication properties +type ReplicationObject struct { + // ReplicationID - Id + ReplicationID *string `json:"replicationId,omitempty"` + // EndpointType - Indicates whether the local volume is the source or destination for the Volume Replication. Possible values include: 'Src', 'Dst' + EndpointType EndpointType `json:"endpointType,omitempty"` + // ReplicationSchedule - Schedule. Possible values include: '10minutely', 'Hourly', 'Daily', 'Weekly', 'Monthly' + ReplicationSchedule ReplicationSchedule `json:"replicationSchedule,omitempty"` + // RemoteVolumeResourceID - The resource ID of the remote volume. + RemoteVolumeResourceID *string `json:"remoteVolumeResourceId,omitempty"` + // RemoteVolumeRegion - The remote region for the other end of the Volume Replication. + RemoteVolumeRegion *string `json:"remoteVolumeRegion,omitempty"` +} + +// ReplicationStatus replication status +type ReplicationStatus struct { + autorest.Response `json:"-"` + // Healthy - Replication health check + Healthy *bool `json:"healthy,omitempty"` + // RelationshipStatus - Status of the mirror relationship. Possible values include: 'Idle', 'Transferring' + RelationshipStatus RelationshipStatus `json:"relationshipStatus,omitempty"` + // MirrorState - The status of the replication. Possible values include: 'Uninitialized', 'Mirrored', 'Broken' + MirrorState MirrorState `json:"mirrorState,omitempty"` + // TotalProgress - The progress of the replication + TotalProgress *string `json:"totalProgress,omitempty"` + // ErrorMessage - Displays error message if the replication is in an error state + ErrorMessage *string `json:"errorMessage,omitempty"` +} + // ResourceNameAvailability information regarding availability of a resource name. type ResourceNameAvailability struct { autorest.Response `json:"-"` @@ -961,7 +1075,7 @@ type Snapshot struct { // Type - READ-ONLY; Resource type Type *string `json:"type,omitempty"` // Tags - Resource tags - Tags interface{} `json:"tags,omitempty"` + Tags map[string]*string `json:"tags"` // SnapshotProperties - Snapshot Properties *SnapshotProperties `json:"properties,omitempty"` } @@ -1028,7 +1142,7 @@ func (s *Snapshot) UnmarshalJSON(body []byte) error { } case "tags": if v != nil { - var tags interface{} + var tags map[string]*string err = json.Unmarshal(*v, &tags) if err != nil { return err @@ -1053,7 +1167,16 @@ func (s *Snapshot) UnmarshalJSON(body []byte) error { // SnapshotPatch snapshot patch type SnapshotPatch struct { // Tags - Resource tags - Tags interface{} `json:"tags,omitempty"` + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for SnapshotPatch. +func (sp SnapshotPatch) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if sp.Tags != nil { + objectMap["tags"] = sp.Tags + } + return json.Marshal(objectMap) } // SnapshotProperties snapshot properties @@ -1062,8 +1185,8 @@ type SnapshotProperties struct { SnapshotID *string `json:"snapshotId,omitempty"` // FileSystemID - UUID v4 used to identify the FileSystem FileSystemID *string `json:"fileSystemId,omitempty"` - // CreationDate - READ-ONLY; The creation date of the snapshot - CreationDate *date.Time `json:"creationDate,omitempty"` + // Created - READ-ONLY; The creation date of the snapshot + Created *date.Time `json:"created,omitempty"` // ProvisioningState - READ-ONLY; Azure lifecycle management ProvisioningState *string `json:"provisioningState,omitempty"` } @@ -1139,7 +1262,7 @@ type Volume struct { // Type - READ-ONLY; Resource type Type *string `json:"type,omitempty"` // Tags - Resource tags - Tags interface{} `json:"tags,omitempty"` + Tags map[string]*string `json:"tags"` // VolumeProperties - Volume properties *VolumeProperties `json:"properties,omitempty"` } @@ -1206,7 +1329,7 @@ func (vVar *Volume) UnmarshalJSON(body []byte) error { } case "tags": if v != nil { - var tags interface{} + var tags map[string]*string err = json.Unmarshal(*v, &tags) if err != nil { return err @@ -1246,7 +1369,7 @@ type VolumePatch struct { // Type - READ-ONLY; Resource type Type *string `json:"type,omitempty"` // Tags - Resource tags - Tags interface{} `json:"tags,omitempty"` + Tags map[string]*string `json:"tags"` // VolumePatchProperties - Patchable volume properties *VolumePatchProperties `json:"properties,omitempty"` } @@ -1313,7 +1436,7 @@ func (vp *VolumePatch) UnmarshalJSON(body []byte) error { } case "tags": if v != nil { - var tags interface{} + var tags map[string]*string err = json.Unmarshal(*v, &tags) if err != nil { return err @@ -1375,6 +1498,19 @@ type VolumeProperties struct { SubnetID *string `json:"subnetId,omitempty"` // MountTargets - List of mount targets MountTargets interface{} `json:"mountTargets,omitempty"` + // VolumeType - What type of volume is this + VolumeType *string `json:"volumeType,omitempty"` + // DataProtection - DataProtection type volumes include an object containing details of the replication + DataProtection *VolumePropertiesDataProtection `json:"dataProtection,omitempty"` + // IsRestoring - Restoring + IsRestoring *bool `json:"isRestoring,omitempty"` +} + +// VolumePropertiesDataProtection dataProtection type volumes include an object containing details of the +// replication +type VolumePropertiesDataProtection struct { + // Replication - Replication properties + Replication *ReplicationObject `json:"replication,omitempty"` } // VolumePropertiesExportPolicy set of export policy rules diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/2019-06-01/netapp/mounttargets.go b/vendor/github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/2019-10-01/netapp/mounttargets.go similarity index 99% rename from vendor/github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/2019-06-01/netapp/mounttargets.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/2019-10-01/netapp/mounttargets.go index f78422a4acb5..13e7dcbd3de9 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/2019-06-01/netapp/mounttargets.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/2019-10-01/netapp/mounttargets.go @@ -97,7 +97,7 @@ func (client MountTargetsClient) ListPreparer(ctx context.Context, resourceGroup "volumeName": autorest.Encode("path", volumeName), } - const APIVersion = "2019-06-01" + const APIVersion = "2019-10-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/2019-06-01/netapp/operations.go b/vendor/github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/2019-10-01/netapp/operations.go similarity index 99% rename from vendor/github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/2019-06-01/netapp/operations.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/2019-10-01/netapp/operations.go index 8c0765593327..cd2ea139ad24 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/2019-06-01/netapp/operations.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/2019-10-01/netapp/operations.go @@ -75,7 +75,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 = "2019-06-01" + const APIVersion = "2019-10-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/2019-06-01/netapp/pools.go b/vendor/github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/2019-10-01/netapp/pools.go similarity index 99% rename from vendor/github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/2019-06-01/netapp/pools.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/2019-10-01/netapp/pools.go index bdd8e5cb14d0..e7b76159b131 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/2019-06-01/netapp/pools.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/2019-10-01/netapp/pools.go @@ -103,7 +103,7 @@ func (client PoolsClient) CreateOrUpdatePreparer(ctx context.Context, body Capac "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2019-06-01" + const APIVersion = "2019-10-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -195,7 +195,7 @@ func (client PoolsClient) DeletePreparer(ctx context.Context, resourceGroupName "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2019-06-01" + const APIVersion = "2019-10-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -287,7 +287,7 @@ func (client PoolsClient) GetPreparer(ctx context.Context, resourceGroupName str "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2019-06-01" + const APIVersion = "2019-10-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -372,7 +372,7 @@ func (client PoolsClient) ListPreparer(ctx context.Context, resourceGroupName st "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2019-06-01" + const APIVersion = "2019-10-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -460,7 +460,7 @@ func (client PoolsClient) UpdatePreparer(ctx context.Context, body CapacityPoolP "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2019-06-01" + const APIVersion = "2019-10-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/2019-06-01/netapp/client.go b/vendor/github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/2019-10-01/netapp/resource.go similarity index 69% rename from vendor/github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/2019-06-01/netapp/client.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/2019-10-01/netapp/resource.go index 5e190522889c..98e2f1503c95 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/2019-06-01/netapp/client.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/2019-10-01/netapp/resource.go @@ -1,6 +1,3 @@ -// Package netapp implements the Azure ARM Netapp service API version 2019-06-01. -// -// Microsoft NetApp Azure Resource Provider specification package netapp // Copyright (c) Microsoft and contributors. All rights reserved. @@ -29,39 +26,28 @@ import ( "net/http" ) -const ( - // DefaultBaseURI is the default URI used for the service Netapp - DefaultBaseURI = "https://management.azure.com" -) - -// BaseClient is the base client for Netapp. -type BaseClient struct { - autorest.Client - BaseURI string - SubscriptionID string +// ResourceClient is the microsoft NetApp Azure Resource Provider specification +type ResourceClient struct { + BaseClient } -// New creates an instance of the BaseClient client. -func New(subscriptionID string) BaseClient { - return NewWithBaseURI(DefaultBaseURI, subscriptionID) +// NewResourceClient creates an instance of the ResourceClient client. +func NewResourceClient(subscriptionID string) ResourceClient { + return NewResourceClientWithBaseURI(DefaultBaseURI, subscriptionID) } -// NewWithBaseURI creates an instance of the BaseClient client. -func NewWithBaseURI(baseURI string, subscriptionID string) BaseClient { - return BaseClient{ - Client: autorest.NewClientWithUserAgent(UserAgent()), - BaseURI: baseURI, - SubscriptionID: subscriptionID, - } +// NewResourceClientWithBaseURI creates an instance of the ResourceClient client. +func NewResourceClientWithBaseURI(baseURI string, subscriptionID string) ResourceClient { + return ResourceClient{NewWithBaseURI(baseURI, subscriptionID)} } // CheckFilePathAvailability check if a file path is available. // Parameters: // body - file path availability request. // location - the location -func (client BaseClient) CheckFilePathAvailability(ctx context.Context, body ResourceNameAvailabilityRequest, location string) (result ResourceNameAvailability, err error) { +func (client ResourceClient) CheckFilePathAvailability(ctx context.Context, body ResourceNameAvailabilityRequest, location string) (result ResourceNameAvailability, err error) { if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.CheckFilePathAvailability") + ctx = tracing.StartSpan(ctx, fqdn+"/ResourceClient.CheckFilePathAvailability") defer func() { sc := -1 if result.Response.Response != nil { @@ -74,38 +60,38 @@ func (client BaseClient) CheckFilePathAvailability(ctx context.Context, body Res {TargetValue: body, Constraints: []validation.Constraint{{Target: "body.Name", Name: validation.Null, Rule: true, Chain: nil}, {Target: "body.ResourceGroup", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("netapp.BaseClient", "CheckFilePathAvailability", err.Error()) + return result, validation.NewError("netapp.ResourceClient", "CheckFilePathAvailability", err.Error()) } req, err := client.CheckFilePathAvailabilityPreparer(ctx, body, location) if err != nil { - err = autorest.NewErrorWithError(err, "netapp.BaseClient", "CheckFilePathAvailability", nil, "Failure preparing request") + err = autorest.NewErrorWithError(err, "netapp.ResourceClient", "CheckFilePathAvailability", nil, "Failure preparing request") return } resp, err := client.CheckFilePathAvailabilitySender(req) if err != nil { result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "netapp.BaseClient", "CheckFilePathAvailability", resp, "Failure sending request") + err = autorest.NewErrorWithError(err, "netapp.ResourceClient", "CheckFilePathAvailability", resp, "Failure sending request") return } result, err = client.CheckFilePathAvailabilityResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "netapp.BaseClient", "CheckFilePathAvailability", resp, "Failure responding to request") + err = autorest.NewErrorWithError(err, "netapp.ResourceClient", "CheckFilePathAvailability", resp, "Failure responding to request") } return } // CheckFilePathAvailabilityPreparer prepares the CheckFilePathAvailability request. -func (client BaseClient) CheckFilePathAvailabilityPreparer(ctx context.Context, body ResourceNameAvailabilityRequest, location string) (*http.Request, error) { +func (client ResourceClient) CheckFilePathAvailabilityPreparer(ctx context.Context, body ResourceNameAvailabilityRequest, location string) (*http.Request, error) { pathParameters := map[string]interface{}{ "location": autorest.Encode("path", location), "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2019-06-01" + const APIVersion = "2019-10-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -122,14 +108,14 @@ func (client BaseClient) CheckFilePathAvailabilityPreparer(ctx context.Context, // CheckFilePathAvailabilitySender sends the CheckFilePathAvailability request. The method will close the // http.Response Body if it receives an error. -func (client BaseClient) CheckFilePathAvailabilitySender(req *http.Request) (*http.Response, error) { +func (client ResourceClient) CheckFilePathAvailabilitySender(req *http.Request) (*http.Response, error) { sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) return autorest.SendWithSender(client, req, sd...) } // CheckFilePathAvailabilityResponder handles the response to the CheckFilePathAvailability request. The method always // closes the http.Response Body. -func (client BaseClient) CheckFilePathAvailabilityResponder(resp *http.Response) (result ResourceNameAvailability, err error) { +func (client ResourceClient) CheckFilePathAvailabilityResponder(resp *http.Response) (result ResourceNameAvailability, err error) { err = autorest.Respond( resp, client.ByInspecting(), @@ -144,9 +130,9 @@ func (client BaseClient) CheckFilePathAvailabilityResponder(resp *http.Response) // Parameters: // body - name availability request. // location - the location -func (client BaseClient) CheckNameAvailability(ctx context.Context, body ResourceNameAvailabilityRequest, location string) (result ResourceNameAvailability, err error) { +func (client ResourceClient) CheckNameAvailability(ctx context.Context, body ResourceNameAvailabilityRequest, location string) (result ResourceNameAvailability, err error) { if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.CheckNameAvailability") + ctx = tracing.StartSpan(ctx, fqdn+"/ResourceClient.CheckNameAvailability") defer func() { sc := -1 if result.Response.Response != nil { @@ -159,38 +145,38 @@ func (client BaseClient) CheckNameAvailability(ctx context.Context, body Resourc {TargetValue: body, Constraints: []validation.Constraint{{Target: "body.Name", Name: validation.Null, Rule: true, Chain: nil}, {Target: "body.ResourceGroup", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("netapp.BaseClient", "CheckNameAvailability", err.Error()) + return result, validation.NewError("netapp.ResourceClient", "CheckNameAvailability", err.Error()) } req, err := client.CheckNameAvailabilityPreparer(ctx, body, location) if err != nil { - err = autorest.NewErrorWithError(err, "netapp.BaseClient", "CheckNameAvailability", nil, "Failure preparing request") + err = autorest.NewErrorWithError(err, "netapp.ResourceClient", "CheckNameAvailability", nil, "Failure preparing request") return } resp, err := client.CheckNameAvailabilitySender(req) if err != nil { result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "netapp.BaseClient", "CheckNameAvailability", resp, "Failure sending request") + err = autorest.NewErrorWithError(err, "netapp.ResourceClient", "CheckNameAvailability", resp, "Failure sending request") return } result, err = client.CheckNameAvailabilityResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "netapp.BaseClient", "CheckNameAvailability", resp, "Failure responding to request") + err = autorest.NewErrorWithError(err, "netapp.ResourceClient", "CheckNameAvailability", resp, "Failure responding to request") } return } // CheckNameAvailabilityPreparer prepares the CheckNameAvailability request. -func (client BaseClient) CheckNameAvailabilityPreparer(ctx context.Context, body ResourceNameAvailabilityRequest, location string) (*http.Request, error) { +func (client ResourceClient) CheckNameAvailabilityPreparer(ctx context.Context, body ResourceNameAvailabilityRequest, location string) (*http.Request, error) { pathParameters := map[string]interface{}{ "location": autorest.Encode("path", location), "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2019-06-01" + const APIVersion = "2019-10-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -207,14 +193,14 @@ func (client BaseClient) CheckNameAvailabilityPreparer(ctx context.Context, body // CheckNameAvailabilitySender sends the CheckNameAvailability request. The method will close the // http.Response Body if it receives an error. -func (client BaseClient) CheckNameAvailabilitySender(req *http.Request) (*http.Response, error) { +func (client ResourceClient) CheckNameAvailabilitySender(req *http.Request) (*http.Response, error) { sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) return autorest.SendWithSender(client, req, sd...) } // CheckNameAvailabilityResponder handles the response to the CheckNameAvailability request. The method always // closes the http.Response Body. -func (client BaseClient) CheckNameAvailabilityResponder(resp *http.Response) (result ResourceNameAvailability, err error) { +func (client ResourceClient) CheckNameAvailabilityResponder(resp *http.Response) (result ResourceNameAvailability, err error) { err = autorest.Respond( resp, client.ByInspecting(), diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/2019-06-01/netapp/snapshots.go b/vendor/github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/2019-10-01/netapp/snapshots.go similarity index 99% rename from vendor/github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/2019-06-01/netapp/snapshots.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/2019-10-01/netapp/snapshots.go index e662e6ada9ac..19dbca87d9d3 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/2019-06-01/netapp/snapshots.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/2019-10-01/netapp/snapshots.go @@ -108,7 +108,7 @@ func (client SnapshotsClient) CreatePreparer(ctx context.Context, body Snapshot, "volumeName": autorest.Encode("path", volumeName), } - const APIVersion = "2019-06-01" + const APIVersion = "2019-10-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -204,7 +204,7 @@ func (client SnapshotsClient) DeletePreparer(ctx context.Context, resourceGroupN "volumeName": autorest.Encode("path", volumeName), } - const APIVersion = "2019-06-01" + const APIVersion = "2019-10-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -300,7 +300,7 @@ func (client SnapshotsClient) GetPreparer(ctx context.Context, resourceGroupName "volumeName": autorest.Encode("path", volumeName), } - const APIVersion = "2019-06-01" + const APIVersion = "2019-10-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -389,7 +389,7 @@ func (client SnapshotsClient) ListPreparer(ctx context.Context, resourceGroupNam "volumeName": autorest.Encode("path", volumeName), } - const APIVersion = "2019-06-01" + const APIVersion = "2019-10-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -481,7 +481,7 @@ func (client SnapshotsClient) UpdatePreparer(ctx context.Context, body SnapshotP "volumeName": autorest.Encode("path", volumeName), } - const APIVersion = "2019-06-01" + const APIVersion = "2019-10-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/2019-06-01/netapp/version.go b/vendor/github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/2019-10-01/netapp/version.go similarity index 94% rename from vendor/github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/2019-06-01/netapp/version.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/2019-10-01/netapp/version.go index 3d6f02d7d19a..15ae8573f032 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/2019-06-01/netapp/version.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/2019-10-01/netapp/version.go @@ -21,7 +21,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.Number + " netapp/2019-06-01" + return "Azure-SDK-For-Go/" + version.Number + " netapp/2019-10-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/netapp/mgmt/2019-06-01/netapp/volumes.go b/vendor/github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/2019-10-01/netapp/volumes.go similarity index 52% rename from vendor/github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/2019-06-01/netapp/volumes.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/2019-10-01/netapp/volumes.go index 91efe92d08c2..718315cc37e2 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/2019-06-01/netapp/volumes.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/2019-10-01/netapp/volumes.go @@ -41,6 +41,185 @@ func NewVolumesClientWithBaseURI(baseURI string, subscriptionID string) VolumesC return VolumesClient{NewWithBaseURI(baseURI, subscriptionID)} } +// AuthorizeReplication authorize the replication connection on the source volume +// Parameters: +// resourceGroupName - the name of the resource group. +// accountName - the name of the NetApp account +// poolName - the name of the capacity pool +// volumeName - the name of the volume +// body - authorize request object supplied in the body of the operation. +func (client VolumesClient) AuthorizeReplication(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, body AuthorizeRequest) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VolumesClient.AuthorizeReplication") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {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 { + return result, validation.NewError("netapp.VolumesClient", "AuthorizeReplication", err.Error()) + } + + req, err := client.AuthorizeReplicationPreparer(ctx, resourceGroupName, accountName, poolName, volumeName, body) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.VolumesClient", "AuthorizeReplication", nil, "Failure preparing request") + return + } + + resp, err := client.AuthorizeReplicationSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "netapp.VolumesClient", "AuthorizeReplication", resp, "Failure sending request") + return + } + + result, err = client.AuthorizeReplicationResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.VolumesClient", "AuthorizeReplication", resp, "Failure responding to request") + } + + return +} + +// AuthorizeReplicationPreparer prepares the AuthorizeReplication request. +func (client VolumesClient) AuthorizeReplicationPreparer(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, body AuthorizeRequest) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "poolName": autorest.Encode("path", poolName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "volumeName": autorest.Encode("path", volumeName), + } + + const APIVersion = "2019-10-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.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/authorizeReplication", pathParameters), + autorest.WithJSON(body), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// AuthorizeReplicationSender sends the AuthorizeReplication request. The method will close the +// http.Response Body if it receives an error. +func (client VolumesClient) AuthorizeReplicationSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + return autorest.SendWithSender(client, req, sd...) +} + +// AuthorizeReplicationResponder handles the response to the AuthorizeReplication request. The method always +// closes the http.Response Body. +func (client VolumesClient) AuthorizeReplicationResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// BreakReplication break the replication connection on the destination volume +// Parameters: +// resourceGroupName - the name of the resource group. +// accountName - the name of the NetApp account +// poolName - the name of the capacity pool +// volumeName - the name of the volume +func (client VolumesClient) BreakReplication(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VolumesClient.BreakReplication") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {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 { + return result, validation.NewError("netapp.VolumesClient", "BreakReplication", err.Error()) + } + + req, err := client.BreakReplicationPreparer(ctx, resourceGroupName, accountName, poolName, volumeName) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.VolumesClient", "BreakReplication", nil, "Failure preparing request") + return + } + + resp, err := client.BreakReplicationSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "netapp.VolumesClient", "BreakReplication", resp, "Failure sending request") + return + } + + result, err = client.BreakReplicationResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.VolumesClient", "BreakReplication", resp, "Failure responding to request") + } + + return +} + +// BreakReplicationPreparer prepares the BreakReplication request. +func (client VolumesClient) BreakReplicationPreparer(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "poolName": autorest.Encode("path", poolName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "volumeName": autorest.Encode("path", volumeName), + } + + const APIVersion = "2019-10-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/breakReplication", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// BreakReplicationSender sends the BreakReplication request. The method will close the +// http.Response Body if it receives an error. +func (client VolumesClient) BreakReplicationSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + return autorest.SendWithSender(client, req, sd...) +} + +// BreakReplicationResponder handles the response to the BreakReplication request. The method always +// closes the http.Response Body. +func (client VolumesClient) BreakReplicationResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + // CreateOrUpdate create or update the specified volume within the capacity pool // Parameters: // body - volume object supplied in the body of the operation. @@ -84,6 +263,10 @@ func (client VolumesClient) CreateOrUpdate(ctx context.Context, body Volume, res {Target: "body.VolumeProperties.BaremetalTenantID", Name: validation.Pattern, Rule: `^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$`, Chain: nil}, }}, {Target: "body.VolumeProperties.SubnetID", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "body.VolumeProperties.DataProtection", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "body.VolumeProperties.DataProtection.Replication", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "body.VolumeProperties.DataProtection.Replication.RemoteVolumeResourceID", Name: validation.Null, Rule: true, Chain: nil}}}, + }}, }}}}, {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, @@ -117,7 +300,7 @@ func (client VolumesClient) CreateOrUpdatePreparer(ctx context.Context, body Vol "volumeName": autorest.Encode("path", volumeName), } - const APIVersion = "2019-06-01" + const APIVersion = "2019-10-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -211,7 +394,7 @@ func (client VolumesClient) DeletePreparer(ctx context.Context, resourceGroupNam "volumeName": autorest.Encode("path", volumeName), } - const APIVersion = "2019-06-01" + const APIVersion = "2019-10-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -249,6 +432,95 @@ func (client VolumesClient) DeleteResponder(resp *http.Response) (result autores return } +// DeleteReplication delete the replication connection on the destination volume, and send release to the source +// replication +// Parameters: +// resourceGroupName - the name of the resource group. +// accountName - the name of the NetApp account +// poolName - the name of the capacity pool +// volumeName - the name of the volume +func (client VolumesClient) DeleteReplication(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VolumesClient.DeleteReplication") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {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 { + return result, validation.NewError("netapp.VolumesClient", "DeleteReplication", err.Error()) + } + + req, err := client.DeleteReplicationPreparer(ctx, resourceGroupName, accountName, poolName, volumeName) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.VolumesClient", "DeleteReplication", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteReplicationSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "netapp.VolumesClient", "DeleteReplication", resp, "Failure sending request") + return + } + + result, err = client.DeleteReplicationResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.VolumesClient", "DeleteReplication", resp, "Failure responding to request") + } + + return +} + +// DeleteReplicationPreparer prepares the DeleteReplication request. +func (client VolumesClient) DeleteReplicationPreparer(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "poolName": autorest.Encode("path", poolName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "volumeName": autorest.Encode("path", volumeName), + } + + const APIVersion = "2019-10-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/deleteReplication", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteReplicationSender sends the DeleteReplication request. The method will close the +// http.Response Body if it receives an error. +func (client VolumesClient) DeleteReplicationSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + return autorest.SendWithSender(client, req, sd...) +} + +// DeleteReplicationResponder handles the response to the DeleteReplication request. The method always +// closes the http.Response Body. +func (client VolumesClient) DeleteReplicationResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + // Get get the details of the specified volume // Parameters: // resourceGroupName - the name of the resource group. @@ -305,7 +577,7 @@ func (client VolumesClient) GetPreparer(ctx context.Context, resourceGroupName s "volumeName": autorest.Encode("path", volumeName), } - const APIVersion = "2019-06-01" + const APIVersion = "2019-10-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -392,7 +664,7 @@ func (client VolumesClient) ListPreparer(ctx context.Context, resourceGroupName "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2019-06-01" + const APIVersion = "2019-10-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -425,6 +697,184 @@ func (client VolumesClient) ListResponder(resp *http.Response) (result VolumeLis return } +// ReplicationStatusMethod get the status of the replication +// Parameters: +// resourceGroupName - the name of the resource group. +// accountName - the name of the NetApp account +// poolName - the name of the capacity pool +// volumeName - the name of the volume +func (client VolumesClient) ReplicationStatusMethod(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string) (result ReplicationStatus, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VolumesClient.ReplicationStatusMethod") + 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: 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 { + return result, validation.NewError("netapp.VolumesClient", "ReplicationStatusMethod", err.Error()) + } + + req, err := client.ReplicationStatusMethodPreparer(ctx, resourceGroupName, accountName, poolName, volumeName) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.VolumesClient", "ReplicationStatusMethod", nil, "Failure preparing request") + return + } + + resp, err := client.ReplicationStatusMethodSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "netapp.VolumesClient", "ReplicationStatusMethod", resp, "Failure sending request") + return + } + + result, err = client.ReplicationStatusMethodResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.VolumesClient", "ReplicationStatusMethod", resp, "Failure responding to request") + } + + return +} + +// ReplicationStatusMethodPreparer prepares the ReplicationStatusMethod request. +func (client VolumesClient) ReplicationStatusMethodPreparer(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "poolName": autorest.Encode("path", poolName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "volumeName": autorest.Encode("path", volumeName), + } + + const APIVersion = "2019-10-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.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/replicationStatus", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ReplicationStatusMethodSender sends the ReplicationStatusMethod request. The method will close the +// http.Response Body if it receives an error. +func (client VolumesClient) ReplicationStatusMethodSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + return autorest.SendWithSender(client, req, sd...) +} + +// ReplicationStatusMethodResponder handles the response to the ReplicationStatusMethod request. The method always +// closes the http.Response Body. +func (client VolumesClient) ReplicationStatusMethodResponder(resp *http.Response) (result ReplicationStatus, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ResyncReplication resync the connection on the destination volume. If the operation is ran on the source volume it +// will reverse-resync the connection and sync from source to destination. +// Parameters: +// resourceGroupName - the name of the resource group. +// accountName - the name of the NetApp account +// poolName - the name of the capacity pool +// volumeName - the name of the volume +func (client VolumesClient) ResyncReplication(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VolumesClient.ResyncReplication") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {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 { + return result, validation.NewError("netapp.VolumesClient", "ResyncReplication", err.Error()) + } + + req, err := client.ResyncReplicationPreparer(ctx, resourceGroupName, accountName, poolName, volumeName) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.VolumesClient", "ResyncReplication", nil, "Failure preparing request") + return + } + + resp, err := client.ResyncReplicationSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "netapp.VolumesClient", "ResyncReplication", resp, "Failure sending request") + return + } + + result, err = client.ResyncReplicationResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.VolumesClient", "ResyncReplication", resp, "Failure responding to request") + } + + return +} + +// ResyncReplicationPreparer prepares the ResyncReplication request. +func (client VolumesClient) ResyncReplicationPreparer(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "poolName": autorest.Encode("path", poolName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "volumeName": autorest.Encode("path", volumeName), + } + + const APIVersion = "2019-10-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/resyncReplication", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ResyncReplicationSender sends the ResyncReplication request. The method will close the +// http.Response Body if it receives an error. +func (client VolumesClient) ResyncReplicationSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + return autorest.SendWithSender(client, req, sd...) +} + +// ResyncReplicationResponder handles the response to the ResyncReplication request. The method always +// closes the http.Response Body. +func (client VolumesClient) ResyncReplicationResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + // Update patch the specified volume // Parameters: // body - volume object supplied in the body of the operation. @@ -482,7 +932,7 @@ func (client VolumesClient) UpdatePreparer(ctx context.Context, body VolumePatch "volumeName": autorest.Encode("path", volumeName), } - const APIVersion = "2019-06-01" + const APIVersion = "2019-10-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/modules.txt b/vendor/modules.txt index a09d4b808bd5..aa3d0d63c408 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -43,7 +43,7 @@ github.com/Azure/azure-sdk-for-go/services/mariadb/mgmt/2018-06-01/mariadb github.com/Azure/azure-sdk-for-go/services/marketplaceordering/mgmt/2015-06-01/marketplaceordering github.com/Azure/azure-sdk-for-go/services/mediaservices/mgmt/2018-07-01/media github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2017-12-01/mysql -github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/2019-06-01/netapp +github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/2019-10-01/netapp github.com/Azure/azure-sdk-for-go/services/network/mgmt/2019-09-01/network github.com/Azure/azure-sdk-for-go/services/notificationhubs/mgmt/2017-04-01/notificationhubs github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2017-12-01/postgresql diff --git a/website/docs/r/netapp_volume.html.markdown b/website/docs/r/netapp_volume.html.markdown index 0e24d8348fc3..891125b5dd5d 100644 --- a/website/docs/r/netapp_volume.html.markdown +++ b/website/docs/r/netapp_volume.html.markdown @@ -57,6 +57,10 @@ resource "azurerm_netapp_pool" "example" { } resource "azurerm_netapp_volume" "example" { + lifecycle { + prevent_destroy = true + } + name = "example-netappvolume" location = azurerm_resource_group.example.location resource_group_name = azurerm_resource_group.example.name @@ -65,6 +69,7 @@ resource "azurerm_netapp_volume" "example" { volume_path = "my-unique-file-path" service_level = "Premium" subnet_id = azurerm_subnet.example.id + protocols = ["NFSv4.1"] storage_quota_in_gb = 100 } ``` @@ -87,12 +92,16 @@ The following arguments are supported: * `service_level` - (Required) The target performance of the file system. Valid values include `Premium`, `Standard`, or `Ultra`. +* `protocols` - (Optional) The target volume protocol expressed as a list. Supported single value include `CIFS`, `NFSv3`, or `NFSv4.1`. If argument is not defined it will default to `NFSv3`. Changing this forces a new resource to be created and data will be lost. + * `subnet_id` - (Required) The ID of the Subnet the NetApp Volume resides in, which must have the `Microsoft.NetApp/volumes` delegation. Changing this forces a new resource to be created. * `storage_quota_in_gb` - (Required) The maximum Storage Quota allowed for a file system in Gigabytes. * `export_policy_rule` - (Optional) One or more `export_policy_rule` block defined below. +-> **Note**: It is highly recommended to use the **lifecycle** property as noted in the example since it will prevent an accidental deletion of the volume if the `protocols` argument changes to a different protocol type. + --- An `export_policy_rule` block supports the following: @@ -101,11 +110,13 @@ An `export_policy_rule` block supports the following: * `allowed_clients` - (Required) A list of allowed clients IPv4 addresses. -* `cifs_enabled` - (Required) Is the CIFS protocol allowed? +* `protocols_enabled` - (Optional) A list of allowed protocols. Valid values include `CIFS`, `NFSv3`, or `NFSv4.1`. Only one value is supported at this time. This replaces the previous arguments: `cifs_enabled`, `nfsv3_enabled` and `nfsv4_enabled`. + +* `cifs_enabled` - (Optional / **Deprecated in favour of `protocols_enabled`**) Is the CIFS protocol allowed? -* `nfsv3_enabled` - (Required) Is the NFSv3 protocol allowed? +* `nfsv3_enabled` - (Optional / **Deprecated in favour of `protocols_enabled`**) Is the NFSv3 protocol allowed? -* `nfsv4_enabled` - (Required) Is the NFSv4 protocol allowed? +* `nfsv4_enabled` - (Optional / **Deprecated in favour of `protocols_enabled`**) Is the NFSv4 protocol allowed? * `unix_read_only` - (Optional) Is the file system on unix read only?