From 6cf95c4d4a35088f36c3b44b8c143162bb1885bc Mon Sep 17 00:00:00 2001 From: magodo Date: Tue, 11 Aug 2020 16:04:43 +0800 Subject: [PATCH 1/4] azurerm_hpc_cache: update API version to 2020-03-01 and support network/security settings --- .../services/storage/client/client.go | 2 +- .../storage/hpc_cache_target_import.go | 38 ++ .../storage/resource_arm_hpc_cache.go | 38 +- .../resource_arm_hpc_cache_blob_target.go | 17 +- .../resource_arm_hpc_cache_nfs_target.go | 16 +- .../tests/resource_arm_hpc_cache_test.go | 159 +++++- .../2020-03-01/storagecache/ascoperations.go | 119 +++++ .../storagecache/caches.go | 77 ++- .../storagecache/client.go | 2 +- .../storagecache/models.go | 493 +++++++++++++++++- .../storagecache/operations.go | 2 +- .../storagecache/skus.go | 2 +- .../storagecache/storagetargets.go | 51 +- .../storagecache/usagemodels.go | 2 +- .../storagecache/version.go | 2 +- vendor/modules.txt | 2 +- 16 files changed, 906 insertions(+), 116 deletions(-) create mode 100644 azurerm/internal/services/storage/hpc_cache_target_import.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/storagecache/mgmt/2020-03-01/storagecache/ascoperations.go rename vendor/github.com/Azure/azure-sdk-for-go/services/storagecache/mgmt/{2019-11-01 => 2020-03-01}/storagecache/caches.go (91%) rename vendor/github.com/Azure/azure-sdk-for-go/services/storagecache/mgmt/{2019-11-01 => 2020-03-01}/storagecache/client.go (98%) rename vendor/github.com/Azure/azure-sdk-for-go/services/storagecache/mgmt/{2019-11-01 => 2020-03-01}/storagecache/models.go (74%) rename vendor/github.com/Azure/azure-sdk-for-go/services/storagecache/mgmt/{2019-11-01 => 2020-03-01}/storagecache/operations.go (99%) rename vendor/github.com/Azure/azure-sdk-for-go/services/storagecache/mgmt/{2019-11-01 => 2020-03-01}/storagecache/skus.go (99%) rename vendor/github.com/Azure/azure-sdk-for-go/services/storagecache/mgmt/{2019-11-01 => 2020-03-01}/storagecache/storagetargets.go (90%) rename vendor/github.com/Azure/azure-sdk-for-go/services/storagecache/mgmt/{2019-11-01 => 2020-03-01}/storagecache/usagemodels.go (99%) rename vendor/github.com/Azure/azure-sdk-for-go/services/storagecache/mgmt/{2019-11-01 => 2020-03-01}/storagecache/version.go (94%) diff --git a/azurerm/internal/services/storage/client/client.go b/azurerm/internal/services/storage/client/client.go index 25a2e40f2e70..14cfd5c9ce6f 100644 --- a/azurerm/internal/services/storage/client/client.go +++ b/azurerm/internal/services/storage/client/client.go @@ -5,7 +5,7 @@ import ( "fmt" "github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2019-04-01/storage" - "github.com/Azure/azure-sdk-for-go/services/storagecache/mgmt/2019-11-01/storagecache" + "github.com/Azure/azure-sdk-for-go/services/storagecache/mgmt/2020-03-01/storagecache" "github.com/Azure/go-autorest/autorest" az "github.com/Azure/go-autorest/autorest/azure" "github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/common" diff --git a/azurerm/internal/services/storage/hpc_cache_target_import.go b/azurerm/internal/services/storage/hpc_cache_target_import.go new file mode 100644 index 000000000000..fee5848601f7 --- /dev/null +++ b/azurerm/internal/services/storage/hpc_cache_target_import.go @@ -0,0 +1,38 @@ +package storage + +import ( + "fmt" + + "github.com/Azure/azure-sdk-for-go/services/storagecache/mgmt/2020-03-01/storagecache" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/clients" + "github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/services/storage/parsers" + "github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/timeouts" +) + +func importHpcCache(kind storagecache.StorageTargetType) func(d *schema.ResourceData, meta interface{}) (data []*schema.ResourceData, err error) { + return func(d *schema.ResourceData, meta interface{}) (data []*schema.ResourceData, err error) { + id, err := parsers.HPCCacheTargetID(d.Id()) + if err != nil { + return nil, err + } + + client := meta.(*clients.Client).Storage.StorageTargetsClient + ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) + defer cancel() + + resp, err := client.Get(ctx, id.ResourceGroup, id.Cache, id.Name) + if err != nil { + return nil, fmt.Errorf("retrieving HPC Cache Target %q (Resource Group %q, Cahe %q): %+v", id.Name, id.ResourceGroup, id.Cache, err) + } + + if resp.Type == nil { + return nil, fmt.Errorf(`HPC Cache Target %q (Resource Group %q, Cahe %q) nil "type"`, id.Name, id.ResourceGroup, id.Cache) + } + + if *resp.Type != string(kind) { + return nil, fmt.Errorf(`HPC Cache Target %q (Resource Group %q, Cahe %q) "type" mismatch, expected "%s", got "%s"`, id.Name, id.ResourceGroup, id.Cache, kind, *resp.Type) + } + return []*schema.ResourceData{d}, nil + } +} diff --git a/azurerm/internal/services/storage/resource_arm_hpc_cache.go b/azurerm/internal/services/storage/resource_arm_hpc_cache.go index 66a9b2d9ecb6..39c2642c0bca 100644 --- a/azurerm/internal/services/storage/resource_arm_hpc_cache.go +++ b/azurerm/internal/services/storage/resource_arm_hpc_cache.go @@ -5,7 +5,7 @@ import ( "log" "time" - "github.com/Azure/azure-sdk-for-go/services/storagecache/mgmt/2019-11-01/storagecache" + "github.com/Azure/azure-sdk-for-go/services/storagecache/mgmt/2020-03-01/storagecache" "github.com/hashicorp/terraform-plugin-sdk/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/helper/validation" "github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/azure" @@ -20,7 +20,8 @@ import ( func resourceArmHPCCache() *schema.Resource { return &schema.Resource{ - Create: resourceArmHPCCacheCreate, + Create: resourceArmHPCCacheCreateOrUpdate, + Update: resourceArmHPCCacheCreateOrUpdate, Read: resourceArmHPCCacheRead, Delete: resourceArmHPCCacheDelete, @@ -77,6 +78,23 @@ func resourceArmHPCCache() *schema.Resource { }, false), }, + "mtu": { + Type: schema.TypeInt, + Optional: true, + Default: 1500, + ValidateFunc: validation.IntBetween(576, 1500), + }, + + "root_squash_enabled": { + Type: schema.TypeBool, + Optional: true, + // TODO 3.0: remove "Computed: true" and add "Deafult: true" + // The old resource has no consistent default for the rootSquash setting. In order not to + // break users, we intentionally mark this property as Computed. + // https://docs.microsoft.com/en-us/azure/hpc-cache/configuration#configure-root-squash. + Computed: true, + }, + "mount_addresses": { Type: schema.TypeList, Computed: true, @@ -86,7 +104,7 @@ func resourceArmHPCCache() *schema.Resource { } } -func resourceArmHPCCacheCreate(d *schema.ResourceData, meta interface{}) error { +func resourceArmHPCCacheCreateOrUpdate(d *schema.ResourceData, meta interface{}) error { client := meta.(*clients.Client).Storage.CachesClient ctx, cancel := timeouts.ForCreate(meta.(*clients.Client).StopContext, d) defer cancel() @@ -112,6 +130,8 @@ func resourceArmHPCCacheCreate(d *schema.ResourceData, meta interface{}) error { cacheSize := d.Get("cache_size_in_gb").(int) subnet := d.Get("subnet_id").(string) skuName := d.Get("sku_name").(string) + rootSquash := d.Get("root_squash_enabled").(bool) + mtu := d.Get("mtu").(int) cache := &storagecache.Cache{ Name: utils.String(name), @@ -119,6 +139,12 @@ func resourceArmHPCCacheCreate(d *schema.ResourceData, meta interface{}) error { CacheProperties: &storagecache.CacheProperties{ CacheSizeGB: utils.Int32(int32(cacheSize)), Subnet: utils.String(subnet), + NetworkSettings: &storagecache.CacheNetworkSettings{ + Mtu: utils.Int32(int32(mtu)), + }, + SecuritySettings: &storagecache.CacheSecuritySettings{ + RootSquash: &rootSquash, + }, }, Sku: &storagecache.CacheSku{ Name: utils.String(skuName), @@ -175,6 +201,12 @@ func resourceArmHPCCacheRead(d *schema.ResourceData, meta interface{}) error { d.Set("cache_size_in_gb", props.CacheSizeGB) d.Set("subnet_id", props.Subnet) d.Set("mount_addresses", utils.FlattenStringSlice(props.MountAddresses)) + if props.NetworkSettings != nil { + d.Set("mtu", props.NetworkSettings.Mtu) + } + if props.SecuritySettings != nil { + d.Set("root_squash_enabled", props.SecuritySettings.RootSquash) + } } if sku := resp.Sku; sku != nil { diff --git a/azurerm/internal/services/storage/resource_arm_hpc_cache_blob_target.go b/azurerm/internal/services/storage/resource_arm_hpc_cache_blob_target.go index 36d100959928..58843a0d117c 100644 --- a/azurerm/internal/services/storage/resource_arm_hpc_cache_blob_target.go +++ b/azurerm/internal/services/storage/resource_arm_hpc_cache_blob_target.go @@ -5,7 +5,7 @@ import ( "log" "time" - "github.com/Azure/azure-sdk-for-go/services/storagecache/mgmt/2019-11-01/storagecache" + "github.com/Azure/azure-sdk-for-go/services/storagecache/mgmt/2020-03-01/storagecache" "github.com/hashicorp/terraform-plugin-sdk/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/helper/validation" "github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/azure" @@ -25,10 +25,10 @@ func resourceArmHPCCacheBlobTarget() *schema.Resource { Read: resourceArmHPCCacheBlobTargetRead, Delete: resourceArmHPCCacheBlobTargetDelete, - Importer: azSchema.ValidateResourceIDPriorToImport(func(id string) error { + Importer: azSchema.ValidateResourceIDPriorToImportThen(func(id string) error { _, err := parsers.HPCCacheTargetID(id) return err - }), + }, importHpcCache(storagecache.StorageTargetTypeClfs)), Timeouts: &schema.ResourceTimeout{ Create: schema.DefaultTimeout(30 * time.Minute), @@ -104,9 +104,9 @@ func resourceArmHPCCacheBlobTargetCreateOrUpdate(d *schema.ResourceData, meta in }, } param := &storagecache.StorageTarget{ - StorageTargetProperties: &storagecache.StorageTargetProperties{ + BasicStorageTargetProperties: &storagecache.ClfsTargetProperties{ Junctions: &namespaceJunction, - TargetType: storagecache.StorageTargetTypeClfs, + TargetType: utils.String(string(storagecache.StorageTargetTypeClfs)), Clfs: &storagecache.ClfsTarget{ Target: utils.String(containerId), }, @@ -161,7 +161,12 @@ func resourceArmHPCCacheBlobTargetRead(d *schema.ResourceData, meta interface{}) d.Set("resource_group_name", id.ResourceGroup) d.Set("cache_name", id.Cache) - if props := resp.StorageTargetProperties; props != nil { + if props := resp.BasicStorageTargetProperties; props != nil { + props, ok := props.AsClfsTargetProperties() + if !ok { + return fmt.Errorf("The type of this HPC Cache Target %q (Resource Group %q, Cahe %q) is not a Blob Target", id.Name, id.ResourceGroup, id.Cache) + } + storageContainerId := "" if props.Clfs != nil && props.Clfs.Target != nil { storageContainerId = *props.Clfs.Target diff --git a/azurerm/internal/services/storage/resource_arm_hpc_cache_nfs_target.go b/azurerm/internal/services/storage/resource_arm_hpc_cache_nfs_target.go index ef1b555aec46..bbee6fd5c04e 100644 --- a/azurerm/internal/services/storage/resource_arm_hpc_cache_nfs_target.go +++ b/azurerm/internal/services/storage/resource_arm_hpc_cache_nfs_target.go @@ -7,7 +7,7 @@ import ( azSchema "github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/tf/schema" - "github.com/Azure/azure-sdk-for-go/services/storagecache/mgmt/2019-11-01/storagecache" + "github.com/Azure/azure-sdk-for-go/services/storagecache/mgmt/2020-03-01/storagecache" "github.com/hashicorp/terraform-plugin-sdk/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/helper/validation" @@ -27,10 +27,10 @@ func resourceArmHPCCacheNFSTarget() *schema.Resource { Read: resourceArmHPCCacheNFSTargetRead, Delete: resourceArmHPCCacheNFSTargetDelete, - Importer: azSchema.ValidateResourceIDPriorToImport(func(id string) error { + Importer: azSchema.ValidateResourceIDPriorToImportThen(func(id string) error { _, err := parsers.HPCCacheTargetID(id) return err - }), + }, importHpcCache(storagecache.StorageTargetTypeNfs3)), Timeouts: &schema.ResourceTimeout{ Create: schema.DefaultTimeout(30 * time.Minute), @@ -129,9 +129,9 @@ func resourceArmHPCCacheNFSTargetCreateOrUpdate(d *schema.ResourceData, meta int // Construct parameters param := &storagecache.StorageTarget{ - StorageTargetProperties: &storagecache.StorageTargetProperties{ + BasicStorageTargetProperties: &storagecache.Nfs3TargetProperties{ Junctions: expandNamespaceJunctions(d.Get("namespace_junction").(*schema.Set).List()), - TargetType: storagecache.StorageTargetTypeNfs3, + TargetType: utils.String(string(storagecache.StorageTargetTypeNfs3)), Nfs3: &storagecache.Nfs3Target{ Target: utils.String(d.Get("target_host_name").(string)), UsageModel: utils.String(d.Get("usage_model").(string)), @@ -186,7 +186,11 @@ func resourceArmHPCCacheNFSTargetRead(d *schema.ResourceData, meta interface{}) d.Set("resource_group_name", id.ResourceGroup) d.Set("cache_name", id.Cache) - if props := resp.StorageTargetProperties; props != nil { + if props := resp.BasicStorageTargetProperties; props != nil { + props, ok := props.AsNfs3TargetProperties() + if !ok { + return fmt.Errorf("The type of this HPC Cache Target %q (Resource Group %q, Cahe %q) is not a NFS Target", id.Name, id.ResourceGroup, id.Cache) + } if nfs3 := props.Nfs3; nfs3 != nil { d.Set("target_host_name", nfs3.Target) d.Set("usage_model", nfs3.UsageModel) diff --git a/azurerm/internal/services/storage/tests/resource_arm_hpc_cache_test.go b/azurerm/internal/services/storage/tests/resource_arm_hpc_cache_test.go index 1ea780e2641f..a9ab3556a642 100644 --- a/azurerm/internal/services/storage/tests/resource_arm_hpc_cache_test.go +++ b/azurerm/internal/services/storage/tests/resource_arm_hpc_cache_test.go @@ -31,6 +31,78 @@ func TestAccAzureRMHPCCache_basic(t *testing.T) { }) } +func TestAccAzureRMHPCCache_mtu(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_hpc_cache", "test") + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { acceptance.PreCheck(t) }, + Providers: acceptance.SupportedProviders, + CheckDestroy: testCheckAzureRMHPCCacheDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAzureRMHPCCache_mtu(data, 1000), + Check: resource.ComposeTestCheckFunc( + testCheckAzureRMHPCCacheExists(data.ResourceName), + resource.TestCheckResourceAttrSet(data.ResourceName, "mount_addresses.#"), + ), + }, + data.ImportStep(), + { + Config: testAccAzureRMHPCCache_mtu(data, 1500), + Check: resource.ComposeTestCheckFunc( + testCheckAzureRMHPCCacheExists(data.ResourceName), + resource.TestCheckResourceAttrSet(data.ResourceName, "mount_addresses.#"), + ), + }, + data.ImportStep(), + { + Config: testAccAzureRMHPCCache_mtu(data, 1000), + Check: resource.ComposeTestCheckFunc( + testCheckAzureRMHPCCacheExists(data.ResourceName), + resource.TestCheckResourceAttrSet(data.ResourceName, "mount_addresses.#"), + ), + }, + data.ImportStep(), + }, + }) +} + +func TestAccAzureRMHPCCache_rootSquash(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_hpc_cache", "test") + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { acceptance.PreCheck(t) }, + Providers: acceptance.SupportedProviders, + CheckDestroy: testCheckAzureRMHPCCacheDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAzureRMHPCCache_rootSquash(data, false), + Check: resource.ComposeTestCheckFunc( + testCheckAzureRMHPCCacheExists(data.ResourceName), + resource.TestCheckResourceAttrSet(data.ResourceName, "mount_addresses.#"), + ), + }, + data.ImportStep(), + { + Config: testAccAzureRMHPCCache_rootSquash(data, true), + Check: resource.ComposeTestCheckFunc( + testCheckAzureRMHPCCacheExists(data.ResourceName), + resource.TestCheckResourceAttrSet(data.ResourceName, "mount_addresses.#"), + ), + }, + data.ImportStep(), + { + Config: testAccAzureRMHPCCache_rootSquash(data, true), + Check: resource.ComposeTestCheckFunc( + testCheckAzureRMHPCCacheExists(data.ResourceName), + resource.TestCheckResourceAttrSet(data.ResourceName, "mount_addresses.#"), + ), + }, + data.ImportStep(), + }, + }) +} + func TestAccAzureRMHPCCache_requiresImport(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_hpc_cache", "test") resource.ParallelTest(t, resource.TestCase{ @@ -101,29 +173,9 @@ func testCheckAzureRMHPCCacheDestroy(s *terraform.State) error { } func testAccAzureRMHPCCache_basic(data acceptance.TestData) string { + template := testAccAzureRMHPCCache_template(data) return fmt.Sprintf(` -provider "azurerm" { - features {} -} - -resource "azurerm_resource_group" "test" { - name = "acctestRG-storage-%d" - location = "%s" -} - -resource "azurerm_virtual_network" "test" { - name = "acctest-VN-%d" - address_space = ["10.0.0.0/16"] - location = azurerm_resource_group.test.location - resource_group_name = azurerm_resource_group.test.name -} - -resource "azurerm_subnet" "test" { - name = "acctestsub-%d" - resource_group_name = azurerm_resource_group.test.name - virtual_network_name = azurerm_virtual_network.test.name - address_prefix = "10.0.2.0/24" -} +%s resource "azurerm_hpc_cache" "test" { name = "acctest-HPCC-%d" @@ -133,7 +185,7 @@ resource "azurerm_hpc_cache" "test" { subnet_id = azurerm_subnet.test.id sku_name = "Standard_2G" } -`, data.RandomInteger, data.Locations.Primary, data.RandomInteger, data.RandomInteger, data.RandomInteger) +`, template, data.RandomInteger) } func testAccAzureRMHPCCahce_requiresImport(data acceptance.TestData) string { @@ -151,3 +203,64 @@ resource "azurerm_hpc_cache" "import" { } `, template) } + +func testAccAzureRMHPCCache_mtu(data acceptance.TestData, mtu int) string { + template := testAccAzureRMHPCCache_template(data) + return fmt.Sprintf(` +%s + +resource "azurerm_hpc_cache" "test" { + name = "acctest-HPCC-%d" + resource_group_name = azurerm_resource_group.test.name + location = azurerm_resource_group.test.location + cache_size_in_gb = 3072 + subnet_id = azurerm_subnet.test.id + sku_name = "Standard_2G" + mtu = %d +} +`, template, data.RandomInteger, mtu) +} + +func testAccAzureRMHPCCache_rootSquash(data acceptance.TestData, enable bool) string { + template := testAccAzureRMHPCCache_template(data) + return fmt.Sprintf(` +%s + +resource "azurerm_hpc_cache" "test" { + name = "acctest-HPCC-%d" + resource_group_name = azurerm_resource_group.test.name + location = azurerm_resource_group.test.location + cache_size_in_gb = 3072 + subnet_id = azurerm_subnet.test.id + sku_name = "Standard_2G" + root_squash_enabled = %t +} +`, template, data.RandomInteger, enable) +} + +func testAccAzureRMHPCCache_template(data acceptance.TestData) string { + return fmt.Sprintf(` +provider "azurerm" { + features {} +} + +resource "azurerm_resource_group" "test" { + name = "acctestRG-storage-%d" + location = "%s" +} + +resource "azurerm_virtual_network" "test" { + name = "acctest-VN-%d" + address_space = ["10.0.0.0/16"] + location = azurerm_resource_group.test.location + resource_group_name = azurerm_resource_group.test.name +} + +resource "azurerm_subnet" "test" { + name = "acctestsub-%d" + resource_group_name = azurerm_resource_group.test.name + virtual_network_name = azurerm_virtual_network.test.name + address_prefix = "10.0.2.0/24" +} +`, data.RandomInteger, data.Locations.Primary, data.RandomInteger, data.RandomInteger) +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/storagecache/mgmt/2020-03-01/storagecache/ascoperations.go b/vendor/github.com/Azure/azure-sdk-for-go/services/storagecache/mgmt/2020-03-01/storagecache/ascoperations.go new file mode 100644 index 000000000000..e40670c20942 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/storagecache/mgmt/2020-03-01/storagecache/ascoperations.go @@ -0,0 +1,119 @@ +package storagecache + +// 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 ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// AscOperationsClient is the a Storage Cache provides scalable caching service for NAS clients, serving data from +// either NFSv3 or Blob at-rest storage (referred to as "Storage Targets"). These operations allow you to manage +// Caches. +type AscOperationsClient struct { + BaseClient +} + +// NewAscOperationsClient creates an instance of the AscOperationsClient client. +func NewAscOperationsClient(subscriptionID string) AscOperationsClient { + return NewAscOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewAscOperationsClientWithBaseURI creates an instance of the AscOperationsClient 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 NewAscOperationsClientWithBaseURI(baseURI string, subscriptionID string) AscOperationsClient { + return AscOperationsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Get gets the status of an asynchronous operation for the Azure HPC cache +// Parameters: +// location - the region name which the operation will lookup into. +// operationID - the operation id which uniquely identifies the asynchronous operation. +func (client AscOperationsClient) Get(ctx context.Context, location string, operationID string) (result AscOperation, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AscOperationsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, location, operationID) + if err != nil { + err = autorest.NewErrorWithError(err, "storagecache.AscOperationsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "storagecache.AscOperationsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "storagecache.AscOperationsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client AscOperationsClient) GetPreparer(ctx context.Context, location string, operationID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "location": autorest.Encode("path", location), + "operationId": autorest.Encode("path", operationID), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.StorageCache/locations/{location}/ascOperations/{operationId}", 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 AscOperationsClient) 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 AscOperationsClient) GetResponder(resp *http.Response) (result AscOperation, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/storagecache/mgmt/2019-11-01/storagecache/caches.go b/vendor/github.com/Azure/azure-sdk-for-go/services/storagecache/mgmt/2020-03-01/storagecache/caches.go similarity index 91% rename from vendor/github.com/Azure/azure-sdk-for-go/services/storagecache/mgmt/2019-11-01/storagecache/caches.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/storagecache/mgmt/2020-03-01/storagecache/caches.go index 77b8b8e4e226..63e973780405 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/storagecache/mgmt/2019-11-01/storagecache/caches.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/storagecache/mgmt/2020-03-01/storagecache/caches.go @@ -46,7 +46,8 @@ func NewCachesClientWithBaseURI(baseURI string, subscriptionID string) CachesCli // CreateOrUpdate create or update a Cache. // Parameters: // resourceGroupName - target resource group. -// cacheName - name of Cache. +// cacheName - name of Cache. Length of name must be not greater than 80 and chars must be in list of +// [-0-9a-zA-Z_] char class. // cache - object containing the user-selectable properties of the new Cache. If read-only properties are // included, they must match the existing values of those properties. func (client CachesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, cacheName string, cache *Cache) (result CachesCreateOrUpdateFuture, err error) { @@ -62,7 +63,24 @@ func (client CachesClient) CreateOrUpdate(ctx context.Context, resourceGroupName } if err := validation.Validate([]validation.Validation{ {TargetValue: cacheName, - Constraints: []validation.Constraint{{Target: "cacheName", Name: validation.Pattern, Rule: `^[-0-9a-zA-Z_]{1,31}$`, Chain: nil}}}}); err != nil { + Constraints: []validation.Constraint{{Target: "cacheName", Name: validation.Pattern, Rule: `^[-0-9a-zA-Z_]{1,80}$`, Chain: nil}}}, + {TargetValue: cache, + Constraints: []validation.Constraint{{Target: "cache", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "cache.CacheProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "cache.CacheProperties.NetworkSettings", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "cache.CacheProperties.NetworkSettings.Mtu", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "cache.CacheProperties.NetworkSettings.Mtu", Name: validation.InclusiveMaximum, Rule: int64(1500), Chain: nil}, + {Target: "cache.CacheProperties.NetworkSettings.Mtu", Name: validation.InclusiveMinimum, Rule: int64(576), Chain: nil}, + }}, + }}, + {Target: "cache.CacheProperties.EncryptionSettings", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "cache.CacheProperties.EncryptionSettings.KeyEncryptionKey", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "cache.CacheProperties.EncryptionSettings.KeyEncryptionKey.KeyURL", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "cache.CacheProperties.EncryptionSettings.KeyEncryptionKey.SourceVault", Name: validation.Null, Rule: true, Chain: nil}, + }}, + }}, + }}, + }}}}}); err != nil { return result, validation.NewError("storagecache.CachesClient", "CreateOrUpdate", err.Error()) } @@ -89,7 +107,7 @@ func (client CachesClient) CreateOrUpdatePreparer(ctx context.Context, resourceG "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2019-11-01" + const APIVersion = "2020-03-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -137,7 +155,8 @@ func (client CachesClient) CreateOrUpdateResponder(resp *http.Response) (result // Delete schedules a Cache for deletion. // Parameters: // resourceGroupName - target resource group. -// cacheName - name of Cache. +// cacheName - name of Cache. Length of name must be not greater than 80 and chars must be in list of +// [-0-9a-zA-Z_] char class. func (client CachesClient) Delete(ctx context.Context, resourceGroupName string, cacheName string) (result CachesDeleteFuture, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/CachesClient.Delete") @@ -151,7 +170,7 @@ func (client CachesClient) Delete(ctx context.Context, resourceGroupName string, } if err := validation.Validate([]validation.Validation{ {TargetValue: cacheName, - Constraints: []validation.Constraint{{Target: "cacheName", Name: validation.Pattern, Rule: `^[-0-9a-zA-Z_]{1,31}$`, Chain: nil}}}}); err != nil { + Constraints: []validation.Constraint{{Target: "cacheName", Name: validation.Pattern, Rule: `^[-0-9a-zA-Z_]{1,80}$`, Chain: nil}}}}); err != nil { return result, validation.NewError("storagecache.CachesClient", "Delete", err.Error()) } @@ -178,7 +197,7 @@ func (client CachesClient) DeletePreparer(ctx context.Context, resourceGroupName "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2019-11-01" + const APIVersion = "2020-03-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -219,7 +238,8 @@ func (client CachesClient) DeleteResponder(resp *http.Response) (result SetObjec // returned until the flush is complete. // Parameters: // resourceGroupName - target resource group. -// cacheName - name of Cache. +// cacheName - name of Cache. Length of name must be not greater than 80 and chars must be in list of +// [-0-9a-zA-Z_] char class. func (client CachesClient) Flush(ctx context.Context, resourceGroupName string, cacheName string) (result CachesFlushFuture, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/CachesClient.Flush") @@ -233,7 +253,7 @@ func (client CachesClient) Flush(ctx context.Context, resourceGroupName string, } if err := validation.Validate([]validation.Validation{ {TargetValue: cacheName, - Constraints: []validation.Constraint{{Target: "cacheName", Name: validation.Pattern, Rule: `^[-0-9a-zA-Z_]{1,31}$`, Chain: nil}}}}); err != nil { + Constraints: []validation.Constraint{{Target: "cacheName", Name: validation.Pattern, Rule: `^[-0-9a-zA-Z_]{1,80}$`, Chain: nil}}}}); err != nil { return result, validation.NewError("storagecache.CachesClient", "Flush", err.Error()) } @@ -260,7 +280,7 @@ func (client CachesClient) FlushPreparer(ctx context.Context, resourceGroupName "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2019-11-01" + const APIVersion = "2020-03-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -300,7 +320,8 @@ func (client CachesClient) FlushResponder(resp *http.Response) (result SetObject // Get returns a Cache. // Parameters: // resourceGroupName - target resource group. -// cacheName - name of Cache. +// cacheName - name of Cache. Length of name must be not greater than 80 and chars must be in list of +// [-0-9a-zA-Z_] char class. func (client CachesClient) Get(ctx context.Context, resourceGroupName string, cacheName string) (result Cache, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/CachesClient.Get") @@ -314,7 +335,7 @@ func (client CachesClient) Get(ctx context.Context, resourceGroupName string, ca } if err := validation.Validate([]validation.Validation{ {TargetValue: cacheName, - Constraints: []validation.Constraint{{Target: "cacheName", Name: validation.Pattern, Rule: `^[-0-9a-zA-Z_]{1,31}$`, Chain: nil}}}}); err != nil { + Constraints: []validation.Constraint{{Target: "cacheName", Name: validation.Pattern, Rule: `^[-0-9a-zA-Z_]{1,80}$`, Chain: nil}}}}); err != nil { return result, validation.NewError("storagecache.CachesClient", "Get", err.Error()) } @@ -347,7 +368,7 @@ func (client CachesClient) GetPreparer(ctx context.Context, resourceGroupName st "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2019-11-01" + const APIVersion = "2020-03-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -418,7 +439,7 @@ func (client CachesClient) ListPreparer(ctx context.Context) (*http.Request, err "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2019-11-01" + const APIVersion = "2020-03-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -529,7 +550,7 @@ func (client CachesClient) ListByResourceGroupPreparer(ctx context.Context, reso "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2019-11-01" + const APIVersion = "2020-03-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -600,7 +621,8 @@ func (client CachesClient) ListByResourceGroupComplete(ctx context.Context, reso // Start tells a Stopped state Cache to transition to Active state. // Parameters: // resourceGroupName - target resource group. -// cacheName - name of Cache. +// cacheName - name of Cache. Length of name must be not greater than 80 and chars must be in list of +// [-0-9a-zA-Z_] char class. func (client CachesClient) Start(ctx context.Context, resourceGroupName string, cacheName string) (result CachesStartFuture, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/CachesClient.Start") @@ -614,7 +636,7 @@ func (client CachesClient) Start(ctx context.Context, resourceGroupName string, } if err := validation.Validate([]validation.Validation{ {TargetValue: cacheName, - Constraints: []validation.Constraint{{Target: "cacheName", Name: validation.Pattern, Rule: `^[-0-9a-zA-Z_]{1,31}$`, Chain: nil}}}}); err != nil { + Constraints: []validation.Constraint{{Target: "cacheName", Name: validation.Pattern, Rule: `^[-0-9a-zA-Z_]{1,80}$`, Chain: nil}}}}); err != nil { return result, validation.NewError("storagecache.CachesClient", "Start", err.Error()) } @@ -641,7 +663,7 @@ func (client CachesClient) StartPreparer(ctx context.Context, resourceGroupName "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2019-11-01" + const APIVersion = "2020-03-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -681,7 +703,8 @@ func (client CachesClient) StartResponder(resp *http.Response) (result SetObject // Stop tells an Active Cache to transition to Stopped state. // Parameters: // resourceGroupName - target resource group. -// cacheName - name of Cache. +// cacheName - name of Cache. Length of name must be not greater than 80 and chars must be in list of +// [-0-9a-zA-Z_] char class. func (client CachesClient) Stop(ctx context.Context, resourceGroupName string, cacheName string) (result CachesStopFuture, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/CachesClient.Stop") @@ -695,7 +718,7 @@ func (client CachesClient) Stop(ctx context.Context, resourceGroupName string, c } if err := validation.Validate([]validation.Validation{ {TargetValue: cacheName, - Constraints: []validation.Constraint{{Target: "cacheName", Name: validation.Pattern, Rule: `^[-0-9a-zA-Z_]{1,31}$`, Chain: nil}}}}); err != nil { + Constraints: []validation.Constraint{{Target: "cacheName", Name: validation.Pattern, Rule: `^[-0-9a-zA-Z_]{1,80}$`, Chain: nil}}}}); err != nil { return result, validation.NewError("storagecache.CachesClient", "Stop", err.Error()) } @@ -722,7 +745,7 @@ func (client CachesClient) StopPreparer(ctx context.Context, resourceGroupName s "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2019-11-01" + const APIVersion = "2020-03-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -762,7 +785,8 @@ func (client CachesClient) StopResponder(resp *http.Response) (result SetObject, // Update update a Cache instance. // Parameters: // resourceGroupName - target resource group. -// cacheName - name of Cache. +// cacheName - name of Cache. Length of name must be not greater than 80 and chars must be in list of +// [-0-9a-zA-Z_] char class. // cache - object containing the user-selectable properties of the Cache. If read-only properties are included, // they must match the existing values of those properties. func (client CachesClient) Update(ctx context.Context, resourceGroupName string, cacheName string, cache *Cache) (result Cache, err error) { @@ -778,7 +802,7 @@ func (client CachesClient) Update(ctx context.Context, resourceGroupName string, } if err := validation.Validate([]validation.Validation{ {TargetValue: cacheName, - Constraints: []validation.Constraint{{Target: "cacheName", Name: validation.Pattern, Rule: `^[-0-9a-zA-Z_]{1,31}$`, Chain: nil}}}}); err != nil { + Constraints: []validation.Constraint{{Target: "cacheName", Name: validation.Pattern, Rule: `^[-0-9a-zA-Z_]{1,80}$`, Chain: nil}}}}); err != nil { return result, validation.NewError("storagecache.CachesClient", "Update", err.Error()) } @@ -811,7 +835,7 @@ func (client CachesClient) UpdatePreparer(ctx context.Context, resourceGroupName "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2019-11-01" + const APIVersion = "2020-03-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -853,7 +877,8 @@ func (client CachesClient) UpdateResponder(resp *http.Response) (result Cache, e // UpgradeFirmware upgrade a Cache's firmware if a new version is available. Otherwise, this operation has no effect. // Parameters: // resourceGroupName - target resource group. -// cacheName - name of Cache. +// cacheName - name of Cache. Length of name must be not greater than 80 and chars must be in list of +// [-0-9a-zA-Z_] char class. func (client CachesClient) UpgradeFirmware(ctx context.Context, resourceGroupName string, cacheName string) (result CachesUpgradeFirmwareFuture, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/CachesClient.UpgradeFirmware") @@ -867,7 +892,7 @@ func (client CachesClient) UpgradeFirmware(ctx context.Context, resourceGroupNam } if err := validation.Validate([]validation.Validation{ {TargetValue: cacheName, - Constraints: []validation.Constraint{{Target: "cacheName", Name: validation.Pattern, Rule: `^[-0-9a-zA-Z_]{1,31}$`, Chain: nil}}}}); err != nil { + Constraints: []validation.Constraint{{Target: "cacheName", Name: validation.Pattern, Rule: `^[-0-9a-zA-Z_]{1,80}$`, Chain: nil}}}}); err != nil { return result, validation.NewError("storagecache.CachesClient", "UpgradeFirmware", err.Error()) } @@ -894,7 +919,7 @@ func (client CachesClient) UpgradeFirmwarePreparer(ctx context.Context, resource "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2019-11-01" + const APIVersion = "2020-03-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/storagecache/mgmt/2019-11-01/storagecache/client.go b/vendor/github.com/Azure/azure-sdk-for-go/services/storagecache/mgmt/2020-03-01/storagecache/client.go similarity index 98% rename from vendor/github.com/Azure/azure-sdk-for-go/services/storagecache/mgmt/2019-11-01/storagecache/client.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/storagecache/mgmt/2020-03-01/storagecache/client.go index 875d0b7d8704..baa73a8fa62a 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/storagecache/mgmt/2019-11-01/storagecache/client.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/storagecache/mgmt/2020-03-01/storagecache/client.go @@ -1,4 +1,4 @@ -// Package storagecache implements the Azure ARM Storagecache service API version 2019-11-01. +// Package storagecache implements the Azure ARM Storagecache service API version 2020-03-01. // // A Storage Cache provides scalable caching service for NAS clients, serving data from either NFSv3 or Blob at-rest // storage (referred to as "Storage Targets"). These operations allow you to manage Caches. diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/storagecache/mgmt/2019-11-01/storagecache/models.go b/vendor/github.com/Azure/azure-sdk-for-go/services/storagecache/mgmt/2020-03-01/storagecache/models.go similarity index 74% rename from vendor/github.com/Azure/azure-sdk-for-go/services/storagecache/mgmt/2019-11-01/storagecache/models.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/storagecache/mgmt/2020-03-01/storagecache/models.go index b02cecd0b3ec..5f0607a7369f 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/storagecache/mgmt/2019-11-01/storagecache/models.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/storagecache/mgmt/2020-03-01/storagecache/models.go @@ -29,7 +29,22 @@ import ( ) // The package's fully qualified name. -const fqdn = "github.com/Azure/azure-sdk-for-go/services/storagecache/mgmt/2019-11-01/storagecache" +const fqdn = "github.com/Azure/azure-sdk-for-go/services/storagecache/mgmt/2020-03-01/storagecache" + +// CacheIdentityType enumerates the values for cache identity type. +type CacheIdentityType string + +const ( + // None ... + None CacheIdentityType = "None" + // SystemAssigned ... + SystemAssigned CacheIdentityType = "SystemAssigned" +) + +// PossibleCacheIdentityTypeValues returns an array of possible values for the CacheIdentityType const type. +func PossibleCacheIdentityTypeValues() []CacheIdentityType { + return []CacheIdentityType{None, SystemAssigned} +} // FirmwareStatusType enumerates the values for firmware status type. type FirmwareStatusType string @@ -130,6 +145,25 @@ func PossibleStorageTargetTypeValues() []StorageTargetType { return []StorageTargetType{StorageTargetTypeClfs, StorageTargetTypeNfs3, StorageTargetTypeUnknown} } +// TargetBaseType enumerates the values for target base type. +type TargetBaseType string + +const ( + // TargetBaseTypeClfs ... + TargetBaseTypeClfs TargetBaseType = "clfs" + // TargetBaseTypeNfs3 ... + TargetBaseTypeNfs3 TargetBaseType = "nfs3" + // TargetBaseTypeStorageTargetProperties ... + TargetBaseTypeStorageTargetProperties TargetBaseType = "StorageTargetProperties" + // TargetBaseTypeUnknown ... + TargetBaseTypeUnknown TargetBaseType = "unknown" +) + +// PossibleTargetBaseTypeValues returns an array of possible values for the TargetBaseType const type. +func PossibleTargetBaseTypeValues() []TargetBaseType { + return []TargetBaseType{TargetBaseTypeClfs, TargetBaseTypeNfs3, TargetBaseTypeStorageTargetProperties, TargetBaseTypeUnknown} +} + // APIOperation REST API operation description: see // https://github.com/Azure/azure-rest-api-specs/blob/master/documentation/openapi-authoring-automated-guidelines.md#r3023-operationsapiimplementation type APIOperation struct { @@ -296,6 +330,23 @@ func NewAPIOperationListResultPage(getNextPage func(context.Context, APIOperatio return APIOperationListResultPage{fn: getNextPage} } +// AscOperation the status of operation. +type AscOperation struct { + autorest.Response `json:"-"` + // ID - The operation Id. + ID *string `json:"id,omitempty"` + // Name - The operation name. + Name *string `json:"name,omitempty"` + // StartTime - The start time of the operation. + StartTime *string `json:"startTime,omitempty"` + // EndTime - The end time of the operation. + EndTime *string `json:"endTime,omitempty"` + // Status - The status of the operation. + Status *string `json:"status,omitempty"` + // Error - The error detail of the operation if any. + Error *ErrorResponse `json:"error,omitempty"` +} + // Cache a Cache instance. Follows Azure Resource Manager standards: // https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/resource-api-reference.md type Cache struct { @@ -310,6 +361,8 @@ type Cache struct { Name *string `json:"name,omitempty"` // Type - READ-ONLY; Type of the Cache; Microsoft.StorageCache/Cache Type *string `json:"type,omitempty"` + // Identity - The identity of the cache, if configured. + Identity *CacheIdentity `json:"identity,omitempty"` // CacheProperties - Properties of the Cache. *CacheProperties `json:"properties,omitempty"` // Sku - SKU for the Cache. @@ -325,6 +378,9 @@ func (c Cache) MarshalJSON() ([]byte, error) { if c.Location != nil { objectMap["location"] = c.Location } + if c.Identity != nil { + objectMap["identity"] = c.Identity + } if c.CacheProperties != nil { objectMap["properties"] = c.CacheProperties } @@ -388,6 +444,15 @@ func (c *Cache) UnmarshalJSON(body []byte) error { } c.Type = &typeVar } + case "identity": + if v != nil { + var identity CacheIdentity + err = json.Unmarshal(*v, &identity) + if err != nil { + return err + } + c.Identity = &identity + } case "properties": if v != nil { var cacheProperties CacheProperties @@ -412,6 +477,12 @@ func (c *Cache) UnmarshalJSON(body []byte) error { return nil } +// CacheEncryptionSettings cache encryption settings. +type CacheEncryptionSettings struct { + // KeyEncryptionKey - Specifies the location of the key encryption key in Key Vault. + KeyEncryptionKey *KeyVaultKeyReference `json:"keyEncryptionKey,omitempty"` +} + // CacheHealth an indication of Cache health. Gives more information about health than just that related to // provisioning. type CacheHealth struct { @@ -421,6 +492,24 @@ type CacheHealth struct { StatusDescription *string `json:"statusDescription,omitempty"` } +// CacheIdentity cache identity properties. +type CacheIdentity struct { + // PrincipalID - READ-ONLY; The principal id of the cache. + PrincipalID *string `json:"principalId,omitempty"` + // TenantID - READ-ONLY; The tenant id associated with the cache. + TenantID *string `json:"tenantId,omitempty"` + // Type - The type of identity used for the cache. Possible values include: 'SystemAssigned', 'None' + Type CacheIdentityType `json:"type,omitempty"` +} + +// CacheNetworkSettings cache network settings. +type CacheNetworkSettings struct { + // Mtu - The IPv4 maximum transmission unit configured for the subnet. + Mtu *int32 `json:"mtu,omitempty"` + // UtilityAddresses - READ-ONLY; Array of additional IP addresses used by this Cache. + UtilityAddresses *[]string `json:"utilityAddresses,omitempty"` +} + // CacheProperties properties of the Cache. type CacheProperties struct { // CacheSizeGB - The size of this Cache, in GB. @@ -435,6 +524,12 @@ type CacheProperties struct { Subnet *string `json:"subnet,omitempty"` // UpgradeStatus - Upgrade status of the Cache. UpgradeStatus *CacheUpgradeStatus `json:"upgradeStatus,omitempty"` + // NetworkSettings - Specifies network settings of the cache. + NetworkSettings *CacheNetworkSettings `json:"networkSettings,omitempty"` + // EncryptionSettings - Specifies encryption settings of the cache. + EncryptionSettings *CacheEncryptionSettings `json:"encryptionSettings,omitempty"` + // SecuritySettings - Specifies security settings of the cache. + SecuritySettings *CacheSecuritySettings `json:"securitySettings,omitempty"` } // CachesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running @@ -494,6 +589,12 @@ func (future *CachesDeleteFuture) Result(client CachesClient) (so SetObject, err return } +// CacheSecuritySettings cache security settings. +type CacheSecuritySettings struct { + // RootSquash - root squash of cache property. + RootSquash *bool `json:"rootSquash,omitempty"` +} + // CachesFlushFuture an abstraction for monitoring and retrieving the results of a long-running operation. type CachesFlushFuture struct { azure.Future @@ -774,12 +875,83 @@ type CacheUpgradeStatus struct { PendingFirmwareVersion *string `json:"pendingFirmwareVersion,omitempty"` } -// ClfsTarget storage container for use as a CLFS Storage Target. +// ClfsTarget properties pertained to ClfsTarget type ClfsTarget struct { // Target - Resource ID of storage container. Target *string `json:"target,omitempty"` } +// ClfsTargetProperties storage container for use as a CLFS Storage Target. +type ClfsTargetProperties struct { + // Junctions - List of Cache namespace junctions to target for namespace associations. + Junctions *[]NamespaceJunction `json:"junctions,omitempty"` + // TargetType - Type of the Storage Target. + TargetType *string `json:"targetType,omitempty"` + // ProvisioningState - ARM provisioning state, see https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/Addendum.md#provisioningstate-property. Possible values include: 'Succeeded', 'Failed', 'Cancelled', 'Creating', 'Deleting', 'Updating' + ProvisioningState ProvisioningStateType `json:"provisioningState,omitempty"` + // Nfs3 - Properties when targetType is nfs3. + Nfs3 *Nfs3Target `json:"nfs3,omitempty"` + // Clfs - Properties when targetType is clfs. + Clfs *ClfsTarget `json:"clfs,omitempty"` + // Unknown - Properties when targetType is unknown. + Unknown *UnknownTarget `json:"unknown,omitempty"` + // TargetBaseType - Possible values include: 'TargetBaseTypeStorageTargetProperties', 'TargetBaseTypeNfs3', 'TargetBaseTypeClfs', 'TargetBaseTypeUnknown' + TargetBaseType TargetBaseType `json:"targetBaseType,omitempty"` +} + +// MarshalJSON is the custom marshaler for ClfsTargetProperties. +func (ctp ClfsTargetProperties) MarshalJSON() ([]byte, error) { + ctp.TargetBaseType = TargetBaseTypeClfs + objectMap := make(map[string]interface{}) + if ctp.Junctions != nil { + objectMap["junctions"] = ctp.Junctions + } + if ctp.TargetType != nil { + objectMap["targetType"] = ctp.TargetType + } + if ctp.ProvisioningState != "" { + objectMap["provisioningState"] = ctp.ProvisioningState + } + if ctp.Nfs3 != nil { + objectMap["nfs3"] = ctp.Nfs3 + } + if ctp.Clfs != nil { + objectMap["clfs"] = ctp.Clfs + } + if ctp.Unknown != nil { + objectMap["unknown"] = ctp.Unknown + } + if ctp.TargetBaseType != "" { + objectMap["targetBaseType"] = ctp.TargetBaseType + } + return json.Marshal(objectMap) +} + +// AsNfs3TargetProperties is the BasicStorageTargetProperties implementation for ClfsTargetProperties. +func (ctp ClfsTargetProperties) AsNfs3TargetProperties() (*Nfs3TargetProperties, bool) { + return nil, false +} + +// AsClfsTargetProperties is the BasicStorageTargetProperties implementation for ClfsTargetProperties. +func (ctp ClfsTargetProperties) AsClfsTargetProperties() (*ClfsTargetProperties, bool) { + return &ctp, true +} + +// AsUnknownTargetProperties is the BasicStorageTargetProperties implementation for ClfsTargetProperties. +func (ctp ClfsTargetProperties) AsUnknownTargetProperties() (*UnknownTargetProperties, bool) { + return nil, false +} + +// AsStorageTargetProperties is the BasicStorageTargetProperties implementation for ClfsTargetProperties. +func (ctp ClfsTargetProperties) AsStorageTargetProperties() (*StorageTargetProperties, bool) { + return nil, false +} + +// AsBasicStorageTargetProperties is the BasicStorageTargetProperties implementation for ClfsTargetProperties. +func (ctp ClfsTargetProperties) AsBasicStorageTargetProperties() (BasicStorageTargetProperties, bool) { + return &ctp, true +} + // CloudError an error response. type CloudError struct { // Error - The body of the error. @@ -798,6 +970,28 @@ type CloudErrorBody struct { Target *string `json:"target,omitempty"` } +// ErrorResponse describes the format of Error response. +type ErrorResponse struct { + // Code - Error code + Code *string `json:"code,omitempty"` + // Message - Error message indicating why the operation failed. + Message *string `json:"message,omitempty"` +} + +// KeyVaultKeyReference describes a reference to Key Vault Key. +type KeyVaultKeyReference struct { + // KeyURL - The URL referencing a key encryption key in Key Vault. + KeyURL *string `json:"keyUrl,omitempty"` + // SourceVault - Describes a resource Id to source Key Vault. + SourceVault *KeyVaultKeyReferenceSourceVault `json:"sourceVault,omitempty"` +} + +// KeyVaultKeyReferenceSourceVault describes a resource Id to source Key Vault. +type KeyVaultKeyReferenceSourceVault struct { + // ID - Resource Id. + ID *string `json:"id,omitempty"` +} + // NamespaceJunction a namespace junction. type NamespaceJunction struct { // NamespacePath - Namespace path on a Cache for a Storage Target. @@ -808,7 +1002,7 @@ type NamespaceJunction struct { NfsExport *string `json:"nfsExport,omitempty"` } -// Nfs3Target an NFSv3 mount point for use as a Storage Target. +// Nfs3Target properties pertained to Nfs3Target type Nfs3Target struct { // Target - IP address or host name of an NFSv3 host (e.g., 10.0.44.44). Target *string `json:"target,omitempty"` @@ -816,6 +1010,77 @@ type Nfs3Target struct { UsageModel *string `json:"usageModel,omitempty"` } +// Nfs3TargetProperties an NFSv3 mount point for use as a Storage Target. +type Nfs3TargetProperties struct { + // Junctions - List of Cache namespace junctions to target for namespace associations. + Junctions *[]NamespaceJunction `json:"junctions,omitempty"` + // TargetType - Type of the Storage Target. + TargetType *string `json:"targetType,omitempty"` + // ProvisioningState - ARM provisioning state, see https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/Addendum.md#provisioningstate-property. Possible values include: 'Succeeded', 'Failed', 'Cancelled', 'Creating', 'Deleting', 'Updating' + ProvisioningState ProvisioningStateType `json:"provisioningState,omitempty"` + // Nfs3 - Properties when targetType is nfs3. + Nfs3 *Nfs3Target `json:"nfs3,omitempty"` + // Clfs - Properties when targetType is clfs. + Clfs *ClfsTarget `json:"clfs,omitempty"` + // Unknown - Properties when targetType is unknown. + Unknown *UnknownTarget `json:"unknown,omitempty"` + // TargetBaseType - Possible values include: 'TargetBaseTypeStorageTargetProperties', 'TargetBaseTypeNfs3', 'TargetBaseTypeClfs', 'TargetBaseTypeUnknown' + TargetBaseType TargetBaseType `json:"targetBaseType,omitempty"` +} + +// MarshalJSON is the custom marshaler for Nfs3TargetProperties. +func (n3tp Nfs3TargetProperties) MarshalJSON() ([]byte, error) { + n3tp.TargetBaseType = TargetBaseTypeNfs3 + objectMap := make(map[string]interface{}) + if n3tp.Junctions != nil { + objectMap["junctions"] = n3tp.Junctions + } + if n3tp.TargetType != nil { + objectMap["targetType"] = n3tp.TargetType + } + if n3tp.ProvisioningState != "" { + objectMap["provisioningState"] = n3tp.ProvisioningState + } + if n3tp.Nfs3 != nil { + objectMap["nfs3"] = n3tp.Nfs3 + } + if n3tp.Clfs != nil { + objectMap["clfs"] = n3tp.Clfs + } + if n3tp.Unknown != nil { + objectMap["unknown"] = n3tp.Unknown + } + if n3tp.TargetBaseType != "" { + objectMap["targetBaseType"] = n3tp.TargetBaseType + } + return json.Marshal(objectMap) +} + +// AsNfs3TargetProperties is the BasicStorageTargetProperties implementation for Nfs3TargetProperties. +func (n3tp Nfs3TargetProperties) AsNfs3TargetProperties() (*Nfs3TargetProperties, bool) { + return &n3tp, true +} + +// AsClfsTargetProperties is the BasicStorageTargetProperties implementation for Nfs3TargetProperties. +func (n3tp Nfs3TargetProperties) AsClfsTargetProperties() (*ClfsTargetProperties, bool) { + return nil, false +} + +// AsUnknownTargetProperties is the BasicStorageTargetProperties implementation for Nfs3TargetProperties. +func (n3tp Nfs3TargetProperties) AsUnknownTargetProperties() (*UnknownTargetProperties, bool) { + return nil, false +} + +// AsStorageTargetProperties is the BasicStorageTargetProperties implementation for Nfs3TargetProperties. +func (n3tp Nfs3TargetProperties) AsStorageTargetProperties() (*StorageTargetProperties, bool) { + return nil, false +} + +// AsBasicStorageTargetProperties is the BasicStorageTargetProperties implementation for Nfs3TargetProperties. +func (n3tp Nfs3TargetProperties) AsBasicStorageTargetProperties() (BasicStorageTargetProperties, bool) { + return &n3tp, true +} + // ResourceSku a resource SKU. type ResourceSku struct { // ResourceType - READ-ONLY; The type of resource the SKU applies to. @@ -1010,25 +1275,23 @@ type SetObject struct { Value interface{} `json:"value,omitempty"` } -// StorageTarget a storage system being cached by a Cache. +// StorageTarget type of the Storage Target. type StorageTarget struct { autorest.Response `json:"-"` + // BasicStorageTargetProperties - StorageTarget properties + BasicStorageTargetProperties `json:"properties,omitempty"` // Name - READ-ONLY; Name of the Storage Target. Name *string `json:"name,omitempty"` // ID - READ-ONLY; Resource ID of the Storage Target. ID *string `json:"id,omitempty"` // Type - READ-ONLY; Type of the Storage Target; Microsoft.StorageCache/Cache/StorageTarget Type *string `json:"type,omitempty"` - // StorageTargetProperties - Properties of the Storage Target. - *StorageTargetProperties `json:"properties,omitempty"` } // MarshalJSON is the custom marshaler for StorageTarget. func (st StorageTarget) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - if st.StorageTargetProperties != nil { - objectMap["properties"] = st.StorageTargetProperties - } + objectMap["properties"] = st.BasicStorageTargetProperties return json.Marshal(objectMap) } @@ -1041,6 +1304,14 @@ func (st *StorageTarget) UnmarshalJSON(body []byte) error { } for k, v := range m { switch k { + case "properties": + if v != nil { + basicStorageTargetProperties, err := unmarshalBasicStorageTargetProperties(*v) + if err != nil { + return err + } + st.BasicStorageTargetProperties = basicStorageTargetProperties + } case "name": if v != nil { var name string @@ -1068,27 +1339,26 @@ func (st *StorageTarget) UnmarshalJSON(body []byte) error { } st.Type = &typeVar } - case "properties": - if v != nil { - var storageTargetProperties StorageTargetProperties - err = json.Unmarshal(*v, &storageTargetProperties) - if err != nil { - return err - } - st.StorageTargetProperties = &storageTargetProperties - } } } return nil } +// BasicStorageTargetProperties properties of the Storage Target. +type BasicStorageTargetProperties interface { + AsNfs3TargetProperties() (*Nfs3TargetProperties, bool) + AsClfsTargetProperties() (*ClfsTargetProperties, bool) + AsUnknownTargetProperties() (*UnknownTargetProperties, bool) + AsStorageTargetProperties() (*StorageTargetProperties, bool) +} + // StorageTargetProperties properties of the Storage Target. type StorageTargetProperties struct { // Junctions - List of Cache namespace junctions to target for namespace associations. Junctions *[]NamespaceJunction `json:"junctions,omitempty"` - // TargetType - Type of the Storage Target. Possible values include: 'StorageTargetTypeNfs3', 'StorageTargetTypeClfs', 'StorageTargetTypeUnknown' - TargetType StorageTargetType `json:"targetType,omitempty"` + // TargetType - Type of the Storage Target. + TargetType *string `json:"targetType,omitempty"` // ProvisioningState - ARM provisioning state, see https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/Addendum.md#provisioningstate-property. Possible values include: 'Succeeded', 'Failed', 'Cancelled', 'Creating', 'Deleting', 'Updating' ProvisioningState ProvisioningStateType `json:"provisioningState,omitempty"` // Nfs3 - Properties when targetType is nfs3. @@ -1097,6 +1367,116 @@ type StorageTargetProperties struct { Clfs *ClfsTarget `json:"clfs,omitempty"` // Unknown - Properties when targetType is unknown. Unknown *UnknownTarget `json:"unknown,omitempty"` + // TargetBaseType - Possible values include: 'TargetBaseTypeStorageTargetProperties', 'TargetBaseTypeNfs3', 'TargetBaseTypeClfs', 'TargetBaseTypeUnknown' + TargetBaseType TargetBaseType `json:"targetBaseType,omitempty"` +} + +func unmarshalBasicStorageTargetProperties(body []byte) (BasicStorageTargetProperties, error) { + var m map[string]interface{} + err := json.Unmarshal(body, &m) + if err != nil { + return nil, err + } + + switch m["targetBaseType"] { + case string(TargetBaseTypeNfs3): + var n3tp Nfs3TargetProperties + err := json.Unmarshal(body, &n3tp) + return n3tp, err + case string(TargetBaseTypeClfs): + var ctp ClfsTargetProperties + err := json.Unmarshal(body, &ctp) + return ctp, err + case string(TargetBaseTypeUnknown): + var utp UnknownTargetProperties + err := json.Unmarshal(body, &utp) + return utp, err + default: + var stp StorageTargetProperties + err := json.Unmarshal(body, &stp) + return stp, err + } +} +func unmarshalBasicStorageTargetPropertiesArray(body []byte) ([]BasicStorageTargetProperties, error) { + var rawMessages []*json.RawMessage + err := json.Unmarshal(body, &rawMessages) + if err != nil { + return nil, err + } + + stpArray := make([]BasicStorageTargetProperties, len(rawMessages)) + + for index, rawMessage := range rawMessages { + stp, err := unmarshalBasicStorageTargetProperties(*rawMessage) + if err != nil { + return nil, err + } + stpArray[index] = stp + } + return stpArray, nil +} + +// MarshalJSON is the custom marshaler for StorageTargetProperties. +func (stp StorageTargetProperties) MarshalJSON() ([]byte, error) { + stp.TargetBaseType = TargetBaseTypeStorageTargetProperties + objectMap := make(map[string]interface{}) + if stp.Junctions != nil { + objectMap["junctions"] = stp.Junctions + } + if stp.TargetType != nil { + objectMap["targetType"] = stp.TargetType + } + if stp.ProvisioningState != "" { + objectMap["provisioningState"] = stp.ProvisioningState + } + if stp.Nfs3 != nil { + objectMap["nfs3"] = stp.Nfs3 + } + if stp.Clfs != nil { + objectMap["clfs"] = stp.Clfs + } + if stp.Unknown != nil { + objectMap["unknown"] = stp.Unknown + } + if stp.TargetBaseType != "" { + objectMap["targetBaseType"] = stp.TargetBaseType + } + return json.Marshal(objectMap) +} + +// AsNfs3TargetProperties is the BasicStorageTargetProperties implementation for StorageTargetProperties. +func (stp StorageTargetProperties) AsNfs3TargetProperties() (*Nfs3TargetProperties, bool) { + return nil, false +} + +// AsClfsTargetProperties is the BasicStorageTargetProperties implementation for StorageTargetProperties. +func (stp StorageTargetProperties) AsClfsTargetProperties() (*ClfsTargetProperties, bool) { + return nil, false +} + +// AsUnknownTargetProperties is the BasicStorageTargetProperties implementation for StorageTargetProperties. +func (stp StorageTargetProperties) AsUnknownTargetProperties() (*UnknownTargetProperties, bool) { + return nil, false +} + +// AsStorageTargetProperties is the BasicStorageTargetProperties implementation for StorageTargetProperties. +func (stp StorageTargetProperties) AsStorageTargetProperties() (*StorageTargetProperties, bool) { + return &stp, true +} + +// AsBasicStorageTargetProperties is the BasicStorageTargetProperties implementation for StorageTargetProperties. +func (stp StorageTargetProperties) AsBasicStorageTargetProperties() (BasicStorageTargetProperties, bool) { + return &stp, true +} + +// StorageTargetResource resource used by a Cache. +type StorageTargetResource struct { + // Name - READ-ONLY; Name of the Storage Target. + Name *string `json:"name,omitempty"` + // ID - READ-ONLY; Resource ID of the Storage Target. + ID *string `json:"id,omitempty"` + // Type - READ-ONLY; Type of the Storage Target; Microsoft.StorageCache/Cache/StorageTarget + Type *string `json:"type,omitempty"` } // StorageTargetsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a @@ -1303,7 +1683,7 @@ func NewStorageTargetsResultPage(getNextPage func(context.Context, StorageTarget return StorageTargetsResultPage{fn: getNextPage} } -// UnknownTarget storage container for use as an Unknown Storage Target. +// UnknownTarget properties pertained to UnknownTarget type UnknownTarget struct { // UnknownMap - Dictionary of string->string pairs containing information about the Storage Target. UnknownMap map[string]*string `json:"unknownMap"` @@ -1318,6 +1698,77 @@ func (ut UnknownTarget) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } +// UnknownTargetProperties storage container for use as an Unknown Storage Target. +type UnknownTargetProperties struct { + // Junctions - List of Cache namespace junctions to target for namespace associations. + Junctions *[]NamespaceJunction `json:"junctions,omitempty"` + // TargetType - Type of the Storage Target. + TargetType *string `json:"targetType,omitempty"` + // ProvisioningState - ARM provisioning state, see https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/Addendum.md#provisioningstate-property. Possible values include: 'Succeeded', 'Failed', 'Cancelled', 'Creating', 'Deleting', 'Updating' + ProvisioningState ProvisioningStateType `json:"provisioningState,omitempty"` + // Nfs3 - Properties when targetType is nfs3. + Nfs3 *Nfs3Target `json:"nfs3,omitempty"` + // Clfs - Properties when targetType is clfs. + Clfs *ClfsTarget `json:"clfs,omitempty"` + // Unknown - Properties when targetType is unknown. + Unknown *UnknownTarget `json:"unknown,omitempty"` + // TargetBaseType - Possible values include: 'TargetBaseTypeStorageTargetProperties', 'TargetBaseTypeNfs3', 'TargetBaseTypeClfs', 'TargetBaseTypeUnknown' + TargetBaseType TargetBaseType `json:"targetBaseType,omitempty"` +} + +// MarshalJSON is the custom marshaler for UnknownTargetProperties. +func (utp UnknownTargetProperties) MarshalJSON() ([]byte, error) { + utp.TargetBaseType = TargetBaseTypeUnknown + objectMap := make(map[string]interface{}) + if utp.Junctions != nil { + objectMap["junctions"] = utp.Junctions + } + if utp.TargetType != nil { + objectMap["targetType"] = utp.TargetType + } + if utp.ProvisioningState != "" { + objectMap["provisioningState"] = utp.ProvisioningState + } + if utp.Nfs3 != nil { + objectMap["nfs3"] = utp.Nfs3 + } + if utp.Clfs != nil { + objectMap["clfs"] = utp.Clfs + } + if utp.Unknown != nil { + objectMap["unknown"] = utp.Unknown + } + if utp.TargetBaseType != "" { + objectMap["targetBaseType"] = utp.TargetBaseType + } + return json.Marshal(objectMap) +} + +// AsNfs3TargetProperties is the BasicStorageTargetProperties implementation for UnknownTargetProperties. +func (utp UnknownTargetProperties) AsNfs3TargetProperties() (*Nfs3TargetProperties, bool) { + return nil, false +} + +// AsClfsTargetProperties is the BasicStorageTargetProperties implementation for UnknownTargetProperties. +func (utp UnknownTargetProperties) AsClfsTargetProperties() (*ClfsTargetProperties, bool) { + return nil, false +} + +// AsUnknownTargetProperties is the BasicStorageTargetProperties implementation for UnknownTargetProperties. +func (utp UnknownTargetProperties) AsUnknownTargetProperties() (*UnknownTargetProperties, bool) { + return &utp, true +} + +// AsStorageTargetProperties is the BasicStorageTargetProperties implementation for UnknownTargetProperties. +func (utp UnknownTargetProperties) AsStorageTargetProperties() (*StorageTargetProperties, bool) { + return nil, false +} + +// AsBasicStorageTargetProperties is the BasicStorageTargetProperties implementation for UnknownTargetProperties. +func (utp UnknownTargetProperties) AsBasicStorageTargetProperties() (BasicStorageTargetProperties, bool) { + return &utp, true +} + // UsageModel a usage model. type UsageModel struct { // Display - Localized information describing this usage model. diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/storagecache/mgmt/2019-11-01/storagecache/operations.go b/vendor/github.com/Azure/azure-sdk-for-go/services/storagecache/mgmt/2020-03-01/storagecache/operations.go similarity index 99% rename from vendor/github.com/Azure/azure-sdk-for-go/services/storagecache/mgmt/2019-11-01/storagecache/operations.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/storagecache/mgmt/2020-03-01/storagecache/operations.go index eae3fff511d4..3372a08630e7 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/storagecache/mgmt/2019-11-01/storagecache/operations.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/storagecache/mgmt/2020-03-01/storagecache/operations.go @@ -78,7 +78,7 @@ func (client OperationsClient) List(ctx context.Context) (result APIOperationLis // ListPreparer prepares the List request. func (client OperationsClient) ListPreparer(ctx context.Context) (*http.Request, error) { - const APIVersion = "2019-11-01" + const APIVersion = "2020-03-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/storagecache/mgmt/2019-11-01/storagecache/skus.go b/vendor/github.com/Azure/azure-sdk-for-go/services/storagecache/mgmt/2020-03-01/storagecache/skus.go similarity index 99% rename from vendor/github.com/Azure/azure-sdk-for-go/services/storagecache/mgmt/2019-11-01/storagecache/skus.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/storagecache/mgmt/2020-03-01/storagecache/skus.go index 6f2514c0611a..2bf6f89d676a 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/storagecache/mgmt/2019-11-01/storagecache/skus.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/storagecache/mgmt/2020-03-01/storagecache/skus.go @@ -82,7 +82,7 @@ func (client SkusClient) ListPreparer(ctx context.Context) (*http.Request, error "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2019-11-01" + const APIVersion = "2020-03-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/storagecache/mgmt/2019-11-01/storagecache/storagetargets.go b/vendor/github.com/Azure/azure-sdk-for-go/services/storagecache/mgmt/2020-03-01/storagecache/storagetargets.go similarity index 90% rename from vendor/github.com/Azure/azure-sdk-for-go/services/storagecache/mgmt/2019-11-01/storagecache/storagetargets.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/storagecache/mgmt/2020-03-01/storagecache/storagetargets.go index b690b63e8ad5..5fd550a754d7 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/storagecache/mgmt/2019-11-01/storagecache/storagetargets.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/storagecache/mgmt/2020-03-01/storagecache/storagetargets.go @@ -48,8 +48,10 @@ func NewStorageTargetsClientWithBaseURI(baseURI string, subscriptionID string) S // unhealthy, the actual creation/modification of the Storage Target may be delayed until the Cache is healthy again. // Parameters: // resourceGroupName - target resource group. -// cacheName - name of Cache. -// storageTargetName - name of the Storage Target. +// cacheName - name of Cache. Length of name must be not greater than 80 and chars must be in list of +// [-0-9a-zA-Z_] char class. +// storageTargetName - name of the Storage Target. Length of name must be not greater than 80 and chars must be +// in list of [-0-9a-zA-Z_] char class. // storagetarget - object containing the definition of a Storage Target. func (client StorageTargetsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, cacheName string, storageTargetName string, storagetarget *StorageTarget) (result StorageTargetsCreateOrUpdateFuture, err error) { if tracing.IsEnabled() { @@ -64,15 +66,15 @@ func (client StorageTargetsClient) CreateOrUpdate(ctx context.Context, resourceG } if err := validation.Validate([]validation.Validation{ {TargetValue: cacheName, - Constraints: []validation.Constraint{{Target: "cacheName", Name: validation.Pattern, Rule: `^[-0-9a-zA-Z_]{1,31}$`, Chain: nil}}}, + Constraints: []validation.Constraint{{Target: "cacheName", Name: validation.Pattern, Rule: `^[-0-9a-zA-Z_]{1,80}$`, Chain: nil}}}, {TargetValue: storageTargetName, - Constraints: []validation.Constraint{{Target: "storageTargetName", Name: validation.Pattern, Rule: `^[-0-9a-zA-Z_]{1,31}$`, Chain: nil}}}, + Constraints: []validation.Constraint{{Target: "storageTargetName", Name: validation.Pattern, Rule: `^[-0-9a-zA-Z_]{1,80}$`, Chain: nil}}}, {TargetValue: storagetarget, Constraints: []validation.Constraint{{Target: "storagetarget", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "storagetarget.StorageTargetProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "storagetarget.StorageTargetProperties.Nfs3", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "storagetarget.StorageTargetProperties.Nfs3.Target", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "storagetarget.StorageTargetProperties.Nfs3.Target", Name: validation.Pattern, Rule: `^[-.0-9a-zA-Z]+$`, Chain: nil}}}, + Chain: []validation.Constraint{{Target: "storagetarget.BasicStorageTargetProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "storagetarget.BasicStorageTargetProperties.Nfs3", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "storagetarget.BasicStorageTargetProperties.Nfs3.Target", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "storagetarget.BasicStorageTargetProperties.Nfs3.Target", Name: validation.Pattern, Rule: `^[-.0-9a-zA-Z]+$`, Chain: nil}}}, }}, }}, }}}}}); err != nil { @@ -103,14 +105,11 @@ func (client StorageTargetsClient) CreateOrUpdatePreparer(ctx context.Context, r "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2019-11-01" + const APIVersion = "2020-03-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } - storagetarget.Name = nil - storagetarget.ID = nil - storagetarget.Type = nil preparer := autorest.CreatePreparer( autorest.AsContentType("application/json; charset=utf-8"), autorest.AsPut(), @@ -154,7 +153,8 @@ func (client StorageTargetsClient) CreateOrUpdateResponder(resp *http.Response) // deleted. // Parameters: // resourceGroupName - target resource group. -// cacheName - name of Cache. +// cacheName - name of Cache. Length of name must be not greater than 80 and chars must be in list of +// [-0-9a-zA-Z_] char class. // storageTargetName - name of Storage Target. func (client StorageTargetsClient) Delete(ctx context.Context, resourceGroupName string, cacheName string, storageTargetName string) (result StorageTargetsDeleteFuture, err error) { if tracing.IsEnabled() { @@ -169,9 +169,9 @@ func (client StorageTargetsClient) Delete(ctx context.Context, resourceGroupName } if err := validation.Validate([]validation.Validation{ {TargetValue: cacheName, - Constraints: []validation.Constraint{{Target: "cacheName", Name: validation.Pattern, Rule: `^[-0-9a-zA-Z_]{1,31}$`, Chain: nil}}}, + Constraints: []validation.Constraint{{Target: "cacheName", Name: validation.Pattern, Rule: `^[-0-9a-zA-Z_]{1,80}$`, Chain: nil}}}, {TargetValue: storageTargetName, - Constraints: []validation.Constraint{{Target: "storageTargetName", Name: validation.Pattern, Rule: `^[-0-9a-zA-Z_]{1,31}$`, Chain: nil}}}}); err != nil { + Constraints: []validation.Constraint{{Target: "storageTargetName", Name: validation.Pattern, Rule: `^[-0-9a-zA-Z_]{1,80}$`, Chain: nil}}}}); err != nil { return result, validation.NewError("storagecache.StorageTargetsClient", "Delete", err.Error()) } @@ -199,7 +199,7 @@ func (client StorageTargetsClient) DeletePreparer(ctx context.Context, resourceG "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2019-11-01" + const APIVersion = "2020-03-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -239,8 +239,10 @@ func (client StorageTargetsClient) DeleteResponder(resp *http.Response) (result // Get returns a Storage Target from a Cache. // Parameters: // resourceGroupName - target resource group. -// cacheName - name of Cache. -// storageTargetName - name of the Storage Target. +// cacheName - name of Cache. Length of name must be not greater than 80 and chars must be in list of +// [-0-9a-zA-Z_] char class. +// storageTargetName - name of the Storage Target. Length of name must be not greater than 80 and chars must be +// in list of [-0-9a-zA-Z_] char class. func (client StorageTargetsClient) Get(ctx context.Context, resourceGroupName string, cacheName string, storageTargetName string) (result StorageTarget, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/StorageTargetsClient.Get") @@ -254,9 +256,9 @@ func (client StorageTargetsClient) Get(ctx context.Context, resourceGroupName st } if err := validation.Validate([]validation.Validation{ {TargetValue: cacheName, - Constraints: []validation.Constraint{{Target: "cacheName", Name: validation.Pattern, Rule: `^[-0-9a-zA-Z_]{1,31}$`, Chain: nil}}}, + Constraints: []validation.Constraint{{Target: "cacheName", Name: validation.Pattern, Rule: `^[-0-9a-zA-Z_]{1,80}$`, Chain: nil}}}, {TargetValue: storageTargetName, - Constraints: []validation.Constraint{{Target: "storageTargetName", Name: validation.Pattern, Rule: `^[-0-9a-zA-Z_]{1,31}$`, Chain: nil}}}}); err != nil { + Constraints: []validation.Constraint{{Target: "storageTargetName", Name: validation.Pattern, Rule: `^[-0-9a-zA-Z_]{1,80}$`, Chain: nil}}}}); err != nil { return result, validation.NewError("storagecache.StorageTargetsClient", "Get", err.Error()) } @@ -290,7 +292,7 @@ func (client StorageTargetsClient) GetPreparer(ctx context.Context, resourceGrou "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2019-11-01" + const APIVersion = "2020-03-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -324,7 +326,8 @@ func (client StorageTargetsClient) GetResponder(resp *http.Response) (result Sto // ListByCache returns a list of Storage Targets for the specified Cache. // Parameters: // resourceGroupName - target resource group. -// cacheName - name of Cache. +// cacheName - name of Cache. Length of name must be not greater than 80 and chars must be in list of +// [-0-9a-zA-Z_] char class. func (client StorageTargetsClient) ListByCache(ctx context.Context, resourceGroupName string, cacheName string) (result StorageTargetsResultPage, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/StorageTargetsClient.ListByCache") @@ -338,7 +341,7 @@ func (client StorageTargetsClient) ListByCache(ctx context.Context, resourceGrou } if err := validation.Validate([]validation.Validation{ {TargetValue: cacheName, - Constraints: []validation.Constraint{{Target: "cacheName", Name: validation.Pattern, Rule: `^[-0-9a-zA-Z_]{1,31}$`, Chain: nil}}}}); err != nil { + Constraints: []validation.Constraint{{Target: "cacheName", Name: validation.Pattern, Rule: `^[-0-9a-zA-Z_]{1,80}$`, Chain: nil}}}}); err != nil { return result, validation.NewError("storagecache.StorageTargetsClient", "ListByCache", err.Error()) } @@ -372,7 +375,7 @@ func (client StorageTargetsClient) ListByCachePreparer(ctx context.Context, reso "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2019-11-01" + const APIVersion = "2020-03-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/storagecache/mgmt/2019-11-01/storagecache/usagemodels.go b/vendor/github.com/Azure/azure-sdk-for-go/services/storagecache/mgmt/2020-03-01/storagecache/usagemodels.go similarity index 99% rename from vendor/github.com/Azure/azure-sdk-for-go/services/storagecache/mgmt/2019-11-01/storagecache/usagemodels.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/storagecache/mgmt/2020-03-01/storagecache/usagemodels.go index 7e78b4b52e28..e7f92a128926 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/storagecache/mgmt/2019-11-01/storagecache/usagemodels.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/storagecache/mgmt/2020-03-01/storagecache/usagemodels.go @@ -82,7 +82,7 @@ func (client UsageModelsClient) ListPreparer(ctx context.Context) (*http.Request "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2019-11-01" + const APIVersion = "2020-03-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/storagecache/mgmt/2019-11-01/storagecache/version.go b/vendor/github.com/Azure/azure-sdk-for-go/services/storagecache/mgmt/2020-03-01/storagecache/version.go similarity index 94% rename from vendor/github.com/Azure/azure-sdk-for-go/services/storagecache/mgmt/2019-11-01/storagecache/version.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/storagecache/mgmt/2020-03-01/storagecache/version.go index 75ce2d61fa6c..de6fc4707922 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/storagecache/mgmt/2019-11-01/storagecache/version.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/storagecache/mgmt/2020-03-01/storagecache/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() + " storagecache/2019-11-01" + return "Azure-SDK-For-Go/" + Version() + " storagecache/2020-03-01" } // Version returns the semantic version (see http://semver.org) of the client. diff --git a/vendor/modules.txt b/vendor/modules.txt index d8daddd3eede..7a1f3f7e6191 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -99,7 +99,7 @@ github.com/Azure/azure-sdk-for-go/services/servicebus/mgmt/2017-04-01/servicebus github.com/Azure/azure-sdk-for-go/services/servicefabric/mgmt/2018-02-01/servicefabric github.com/Azure/azure-sdk-for-go/services/signalr/mgmt/2018-10-01/signalr github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2019-04-01/storage -github.com/Azure/azure-sdk-for-go/services/storagecache/mgmt/2019-11-01/storagecache +github.com/Azure/azure-sdk-for-go/services/storagecache/mgmt/2020-03-01/storagecache github.com/Azure/azure-sdk-for-go/services/streamanalytics/mgmt/2016-03-01/streamanalytics github.com/Azure/azure-sdk-for-go/services/trafficmanager/mgmt/2018-04-01/trafficmanager github.com/Azure/azure-sdk-for-go/services/web/mgmt/2019-08-01/web From 0e2c29b35dbfad7755f70883de8a0260305a8059 Mon Sep 17 00:00:00 2001 From: magodo Date: Thu, 13 Aug 2020 09:35:07 +0800 Subject: [PATCH 2/4] add update timeout and document --- azurerm/internal/services/storage/resource_arm_hpc_cache.go | 3 ++- website/docs/r/hpc_cache.html.markdown | 6 ++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/azurerm/internal/services/storage/resource_arm_hpc_cache.go b/azurerm/internal/services/storage/resource_arm_hpc_cache.go index 39c2642c0bca..a4543aca0650 100644 --- a/azurerm/internal/services/storage/resource_arm_hpc_cache.go +++ b/azurerm/internal/services/storage/resource_arm_hpc_cache.go @@ -27,6 +27,7 @@ func resourceArmHPCCache() *schema.Resource { Timeouts: &schema.ResourceTimeout{ Create: schema.DefaultTimeout(30 * time.Minute), + Update: schema.DefaultTimeout(30 * time.Minute), Read: schema.DefaultTimeout(5 * time.Minute), Delete: schema.DefaultTimeout(30 * time.Minute), }, @@ -88,7 +89,7 @@ func resourceArmHPCCache() *schema.Resource { "root_squash_enabled": { Type: schema.TypeBool, Optional: true, - // TODO 3.0: remove "Computed: true" and add "Deafult: true" + // TODO 3.0: remove "Computed: true" and add "Default: true" // The old resource has no consistent default for the rootSquash setting. In order not to // break users, we intentionally mark this property as Computed. // https://docs.microsoft.com/en-us/azure/hpc-cache/configuration#configure-root-squash. diff --git a/website/docs/r/hpc_cache.html.markdown b/website/docs/r/hpc_cache.html.markdown index 0cb2e189d161..335f9bfb01f2 100644 --- a/website/docs/r/hpc_cache.html.markdown +++ b/website/docs/r/hpc_cache.html.markdown @@ -62,6 +62,12 @@ The following arguments are supported: * `sku_name` - (Required) The SKU of HPC Cache to use. Possible values are `Standard_2G`, `Standard_4G` and `Standard_8G`. Changing this forces a new resource to be created. +--- + +* `mtu` - (Optional) The IPv4 maximum transmission unit configured for the subnet of the HPC Cache. Possible values range from 576 - 1500. Defaults to 1500. + +* `root_squash_enabled` - (Optional) Whether root squash property is enabled for this HPC Cache. + ## Attributes Reference The following attributes are exported: From 83788c955befb2500ec0841aa7290eaf5d689238 Mon Sep 17 00:00:00 2001 From: magodo Date: Tue, 22 Sep 2020 10:49:51 +0800 Subject: [PATCH 3/4] pass the build due to Go sdk update --- azurerm/internal/services/storage/hpc_cache_target_import.go | 2 +- .../services/storage/resource_arm_hpc_cache_blob_target.go | 4 ++-- .../services/storage/resource_arm_hpc_cache_nfs_target.go | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/azurerm/internal/services/storage/hpc_cache_target_import.go b/azurerm/internal/services/storage/hpc_cache_target_import.go index fee5848601f7..566f77e08dea 100644 --- a/azurerm/internal/services/storage/hpc_cache_target_import.go +++ b/azurerm/internal/services/storage/hpc_cache_target_import.go @@ -10,7 +10,7 @@ import ( "github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/timeouts" ) -func importHpcCache(kind storagecache.StorageTargetType) func(d *schema.ResourceData, meta interface{}) (data []*schema.ResourceData, err error) { +func importHpcCache(kind storagecache.TargetType) func(d *schema.ResourceData, meta interface{}) (data []*schema.ResourceData, err error) { return func(d *schema.ResourceData, meta interface{}) (data []*schema.ResourceData, err error) { id, err := parsers.HPCCacheTargetID(d.Id()) if err != nil { diff --git a/azurerm/internal/services/storage/resource_arm_hpc_cache_blob_target.go b/azurerm/internal/services/storage/resource_arm_hpc_cache_blob_target.go index 58843a0d117c..9ce8b1746a88 100644 --- a/azurerm/internal/services/storage/resource_arm_hpc_cache_blob_target.go +++ b/azurerm/internal/services/storage/resource_arm_hpc_cache_blob_target.go @@ -28,7 +28,7 @@ func resourceArmHPCCacheBlobTarget() *schema.Resource { Importer: azSchema.ValidateResourceIDPriorToImportThen(func(id string) error { _, err := parsers.HPCCacheTargetID(id) return err - }, importHpcCache(storagecache.StorageTargetTypeClfs)), + }, importHpcCache(storagecache.TargetTypeClfs)), Timeouts: &schema.ResourceTimeout{ Create: schema.DefaultTimeout(30 * time.Minute), @@ -106,7 +106,7 @@ func resourceArmHPCCacheBlobTargetCreateOrUpdate(d *schema.ResourceData, meta in param := &storagecache.StorageTarget{ BasicStorageTargetProperties: &storagecache.ClfsTargetProperties{ Junctions: &namespaceJunction, - TargetType: utils.String(string(storagecache.StorageTargetTypeClfs)), + TargetType: storagecache.TargetTypeClfs, Clfs: &storagecache.ClfsTarget{ Target: utils.String(containerId), }, diff --git a/azurerm/internal/services/storage/resource_arm_hpc_cache_nfs_target.go b/azurerm/internal/services/storage/resource_arm_hpc_cache_nfs_target.go index bbee6fd5c04e..bd79e5dd372f 100644 --- a/azurerm/internal/services/storage/resource_arm_hpc_cache_nfs_target.go +++ b/azurerm/internal/services/storage/resource_arm_hpc_cache_nfs_target.go @@ -30,7 +30,7 @@ func resourceArmHPCCacheNFSTarget() *schema.Resource { Importer: azSchema.ValidateResourceIDPriorToImportThen(func(id string) error { _, err := parsers.HPCCacheTargetID(id) return err - }, importHpcCache(storagecache.StorageTargetTypeNfs3)), + }, importHpcCache(storagecache.TargetTypeNfs3)), Timeouts: &schema.ResourceTimeout{ Create: schema.DefaultTimeout(30 * time.Minute), @@ -131,7 +131,7 @@ func resourceArmHPCCacheNFSTargetCreateOrUpdate(d *schema.ResourceData, meta int param := &storagecache.StorageTarget{ BasicStorageTargetProperties: &storagecache.Nfs3TargetProperties{ Junctions: expandNamespaceJunctions(d.Get("namespace_junction").(*schema.Set).List()), - TargetType: utils.String(string(storagecache.StorageTargetTypeNfs3)), + TargetType: storagecache.TargetTypeNfs3, Nfs3: &storagecache.Nfs3Target{ Target: utils.String(d.Get("target_host_name").(string)), UsageModel: utils.String(d.Get("usage_model").(string)), From 08834b70a0586d1fe4381e150ccfb48f59ca709c Mon Sep 17 00:00:00 2001 From: magodo Date: Sun, 27 Sep 2020 11:08:20 +0800 Subject: [PATCH 4/4] remove the importer as the type is checked in Read callback --- .../storage/hpc_cache_target_import.go | 38 ------------------- .../resource_arm_hpc_cache_blob_target.go | 4 +- .../resource_arm_hpc_cache_nfs_target.go | 4 +- 3 files changed, 4 insertions(+), 42 deletions(-) delete mode 100644 azurerm/internal/services/storage/hpc_cache_target_import.go diff --git a/azurerm/internal/services/storage/hpc_cache_target_import.go b/azurerm/internal/services/storage/hpc_cache_target_import.go deleted file mode 100644 index 566f77e08dea..000000000000 --- a/azurerm/internal/services/storage/hpc_cache_target_import.go +++ /dev/null @@ -1,38 +0,0 @@ -package storage - -import ( - "fmt" - - "github.com/Azure/azure-sdk-for-go/services/storagecache/mgmt/2020-03-01/storagecache" - "github.com/hashicorp/terraform-plugin-sdk/helper/schema" - "github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/clients" - "github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/services/storage/parsers" - "github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/timeouts" -) - -func importHpcCache(kind storagecache.TargetType) func(d *schema.ResourceData, meta interface{}) (data []*schema.ResourceData, err error) { - return func(d *schema.ResourceData, meta interface{}) (data []*schema.ResourceData, err error) { - id, err := parsers.HPCCacheTargetID(d.Id()) - if err != nil { - return nil, err - } - - client := meta.(*clients.Client).Storage.StorageTargetsClient - ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) - defer cancel() - - resp, err := client.Get(ctx, id.ResourceGroup, id.Cache, id.Name) - if err != nil { - return nil, fmt.Errorf("retrieving HPC Cache Target %q (Resource Group %q, Cahe %q): %+v", id.Name, id.ResourceGroup, id.Cache, err) - } - - if resp.Type == nil { - return nil, fmt.Errorf(`HPC Cache Target %q (Resource Group %q, Cahe %q) nil "type"`, id.Name, id.ResourceGroup, id.Cache) - } - - if *resp.Type != string(kind) { - return nil, fmt.Errorf(`HPC Cache Target %q (Resource Group %q, Cahe %q) "type" mismatch, expected "%s", got "%s"`, id.Name, id.ResourceGroup, id.Cache, kind, *resp.Type) - } - return []*schema.ResourceData{d}, nil - } -} diff --git a/azurerm/internal/services/storage/resource_arm_hpc_cache_blob_target.go b/azurerm/internal/services/storage/resource_arm_hpc_cache_blob_target.go index 9ce8b1746a88..68dfda40aa34 100644 --- a/azurerm/internal/services/storage/resource_arm_hpc_cache_blob_target.go +++ b/azurerm/internal/services/storage/resource_arm_hpc_cache_blob_target.go @@ -25,10 +25,10 @@ func resourceArmHPCCacheBlobTarget() *schema.Resource { Read: resourceArmHPCCacheBlobTargetRead, Delete: resourceArmHPCCacheBlobTargetDelete, - Importer: azSchema.ValidateResourceIDPriorToImportThen(func(id string) error { + Importer: azSchema.ValidateResourceIDPriorToImport(func(id string) error { _, err := parsers.HPCCacheTargetID(id) return err - }, importHpcCache(storagecache.TargetTypeClfs)), + }), Timeouts: &schema.ResourceTimeout{ Create: schema.DefaultTimeout(30 * time.Minute), diff --git a/azurerm/internal/services/storage/resource_arm_hpc_cache_nfs_target.go b/azurerm/internal/services/storage/resource_arm_hpc_cache_nfs_target.go index bd79e5dd372f..d462c4d36802 100644 --- a/azurerm/internal/services/storage/resource_arm_hpc_cache_nfs_target.go +++ b/azurerm/internal/services/storage/resource_arm_hpc_cache_nfs_target.go @@ -27,10 +27,10 @@ func resourceArmHPCCacheNFSTarget() *schema.Resource { Read: resourceArmHPCCacheNFSTargetRead, Delete: resourceArmHPCCacheNFSTargetDelete, - Importer: azSchema.ValidateResourceIDPriorToImportThen(func(id string) error { + Importer: azSchema.ValidateResourceIDPriorToImport(func(id string) error { _, err := parsers.HPCCacheTargetID(id) return err - }, importHpcCache(storagecache.TargetTypeNfs3)), + }), Timeouts: &schema.ResourceTimeout{ Create: schema.DefaultTimeout(30 * time.Minute),